Mesa (main): gallivm/img: use uint for image coord builder.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 22 21:05:27 UTC 2021


Module: Mesa
Branch: main
Commit: 1087cf680aa6de878645ce4bb80da0038e0afc88
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1087cf680aa6de878645ce4bb80da0038e0afc88

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jul 15 14:52:07 2021 +1000

gallivm/img: use uint for image coord builder.

VK CTS has a test that does -256 for sample index but since we use
signed >= we fail and write to random memory, changing to uint here
for comparisons for out of bounds and address calcs should ensure,
we stay within bounds even for negative vals.

Remove unused int_type/bld while here.

Fixes dEQP-VK.texture.multisample.invalid_sample_index.sample_count_4

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11913>

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index c5616be348a..5895e1a6eea 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -4604,15 +4604,13 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
    unsigned target = params->target;
    unsigned dims = texture_dims(target);
    /** regular scalar int type */
-   struct lp_type int_type, int_coord_type;
-   struct lp_build_context int_bld, int_coord_bld;
+   struct lp_type int_coord_type;
+   struct lp_build_context int_coord_bld;
    const struct util_format_description *format_desc = util_format_description(static_texture_state->format);
    LLVMValueRef x = params->coords[0], y = params->coords[1], z = params->coords[2];
    LLVMValueRef ms_index = params->ms_index;
    LLVMValueRef row_stride_vec = NULL, img_stride_vec = NULL;
-   int_type = lp_type_int(32);
-   int_coord_type = lp_int_type(params->type);
-   lp_build_context_init(&int_bld, gallivm, int_type);
+   int_coord_type = lp_uint_type(params->type);
    lp_build_context_init(&int_coord_bld, gallivm, int_coord_type);
 
    if (static_texture_state->format == PIPE_FORMAT_NONE) {



More information about the mesa-commit mailing list