Commit a8093036 authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund
Browse files

microsoft/clc: When lowering non-normalized coordinates for point sampling,...

microsoft/clc: When lowering non-normalized coordinates for point sampling, add a half pixel offset after flooring

This ensures that even after dividing by image dimensions, the coordinate doesn't snap to a different pixel.
parent 2bbae1ba
......@@ -560,7 +560,7 @@ clc_lower_nonnormalized_samplers(nir_shader *nir,
// The CTS is pretty clear that this value has to be floored for nearest sampling
// but must not be for linear sampling.
if (!states[sampler->data.binding].is_linear_filtering)
comps[i] = nir_ffloor(&b, comps[i]);
comps[i] = nir_fadd_imm(&b, nir_ffloor(&b, comps[i]), 0.5f);
comps[i] = nir_fmul(&b, comps[i], nir_channel(&b, scale, i));
}
nir_ssa_def *normalized_coords = nir_vec(&b, comps, coords->num_components);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment