spirv: Add 0.5 to integer coordinates for OpImageSampleExplicitLod
Just casting to a float is insufficient because that gives us the upper-left corner
of the texel rather than the center.
Fixes: 701cb9d60c
"nir/vtn: Handle integer sampling coordinates"
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7069>
This commit is contained in:
parent
2015a109ff
commit
589d918a4f
|
@ -2661,7 +2661,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
||||||
"Unless the Kernel capability is being used, the coordinate parameter "
|
"Unless the Kernel capability is being used, the coordinate parameter "
|
||||||
"OpImageSampleExplicitLod must be floating point.");
|
"OpImageSampleExplicitLod must be floating point.");
|
||||||
|
|
||||||
p->src = nir_src_for_ssa(nir_i2f32(&b->nb, p->src.ssa));
|
p->src = nir_src_for_ssa(
|
||||||
|
nir_fadd(&b->nb, nir_i2f32(&b->nb, p->src.ssa),
|
||||||
|
nir_imm_float(&b->nb, 0.5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
p->src_type = nir_tex_src_coord;
|
p->src_type = nir_tex_src_coord;
|
||||||
|
|
Loading…
Reference in New Issue