Mesa (13.0): radv: fix texel fetch offset with 2d arrays.
Emil Velikov
evelikov at kemper.freedesktop.org
Mon Nov 28 15:07:44 UTC 2016
Module: Mesa
Branch: 13.0
Commit: 960a87fb174290f36ce0434a631b879d01397589
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=960a87fb174290f36ce0434a631b879d01397589
Author: Dave Airlie <airlied at redhat.com>
Date: Thu Nov 24 03:10:52 2016 +0000
radv: fix texel fetch offset with 2d arrays.
The code didn't limit the offsets to the number supplied, so
if we expected 3 but only got 2 we were accessing undefined memory.
This fixes random failures in:
dEQP-VK.glsl.texture_functions.texelfetchoffset.sampler2darray_*
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Cc: "13.0" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit bb8ac183404541ca8dee31563709d5aca8de0e73)
---
src/amd/common/ac_nir_to_llvm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 31d7b6e..799eb34 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3517,12 +3517,13 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
if (offsets && instr->op == nir_texop_txf) {
nir_const_value *const_offset =
nir_src_as_const_value(instr->src[const_src].src);
-
+ int num_offsets = instr->src[const_src].src.ssa->num_components;
assert(const_offset);
- if (instr->coord_components > 2)
+ num_offsets = MIN2(num_offsets, instr->coord_components);
+ if (num_offsets > 2)
address[2] = LLVMBuildAdd(ctx->builder,
address[2], LLVMConstInt(ctx->i32, const_offset->i32[2], false), "");
- if (instr->coord_components > 1)
+ if (num_offsets > 1)
address[1] = LLVMBuildAdd(ctx->builder,
address[1], LLVMConstInt(ctx->i32, const_offset->i32[1], false), "");
address[0] = LLVMBuildAdd(ctx->builder,
More information about the mesa-commit
mailing list