Module: Mesa
Branch: 18.1
Commit: 762c07b5a0b3495b372c3b81e595c563d648a70c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=762c07b5a0b3495b372c3b81e595c563d648a70c

Author: Samuel Pitoiset <[email protected]>
Date:   Mon Apr 23 17:05:10 2018 +0200

ac: fix the number of coordinates for ac_image_get_lod and arrays

This fixes crashes for the following CTS:
dEQP-VK.glsl.texture_functions.query.texturequerylod.*

Cubemaps are the same as 2D arrays.

Fixes: 625dcbbc456 ("amd/common: pass address components individually to
ac_build_image_intrinsic")
Cc: 18.1 <[email protected]>
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
(cherry picked from commit d136a5fad9c7e67c1362453388914ecc60420883)

---

 src/amd/common/ac_llvm_build.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 02739f9da9..f21a5d2623 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1521,6 +1521,20 @@ LLVMValueRef ac_build_image_opcode(struct 
ac_llvm_context *ctx,
        LLVMValueRef addr;
        unsigned num_addr = 0;
 
+       if (a->opcode == ac_image_get_lod) {
+               switch (a->dim) {
+               case ac_image_1darray:
+                       num_coords = 1;
+                       break;
+               case ac_image_2darray:
+               case ac_image_cube:
+                       num_coords = 2;
+                       break;
+               default:
+                       break;
+               }
+       }
+
        if (a->offset)
                args[num_addr++] = ac_to_integer(ctx, a->offset);
        if (a->bias)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to