diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-06-06 01:42:17 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2018-06-07 23:59:52 +0200 |
commit | 4fc2d5e14125709d2eaa23d36f74f11bb760c73e (patch) | |
tree | 261824911f4c84eeaeb277582288e8c6624fb0fb /src | |
parent | 9be56316cf3d1b8db0b38f260e7b6ff2592d7a13 (diff) |
amd/common: Fix number of coords for getlod.
The LLVM 6 code reduced it to a non-array call. We need to do that
with the new code too.
This fixes dEQP-VK.glsl.texture_functions.query.texturequerylod.*array* for radv.
Fixes: a9a79934412 "amd/common: use the dimension-aware image intrinsics on LLVM 7+"
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index a686b72287b..4052488f03a 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1662,6 +1662,7 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, unsigned num_overloads = 0; LLVMValueRef args[18]; unsigned num_args = 0; + enum ac_image_dim dim = a->dim; assert(!a->lod || a->lod == ctx->i32_0 || a->lod == ctx->f32_0 || !a->level_zero); @@ -1681,6 +1682,20 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, if (HAVE_LLVM < 0x0700) return ac_build_image_opcode_llvm6(ctx, a); + if (a->opcode == ac_image_get_lod) { + switch (dim) { + case ac_image_1darray: + dim = ac_image_1d; + break; + case ac_image_2darray: + case ac_image_cube: + dim = ac_image_2d; + break; + default: + break; + } + } + bool sample = a->opcode == ac_image_sample || a->opcode == ac_image_gather4 || a->opcode == ac_image_get_lod; @@ -1706,13 +1721,13 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, if (a->compare) args[num_args++] = ac_to_float(ctx, a->compare); if (a->derivs[0]) { - unsigned count = ac_num_derivs(a->dim); + unsigned count = ac_num_derivs(dim); for (unsigned i = 0; i < count; ++i) args[num_args++] = ac_to_float(ctx, a->derivs[i]); overload[num_overloads++] = ".f32"; } unsigned num_coords = - a->opcode != ac_image_get_resinfo ? ac_num_coords(a->dim) : 0; + a->opcode != ac_image_get_resinfo ? ac_num_coords(dim) : 0; for (unsigned i = 0; i < num_coords; ++i) args[num_args++] = LLVMBuildBitCast(ctx->builder, a->coords[i], coord_type, ""); if (a->lod) @@ -1751,7 +1766,7 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, } const char *dimname; - switch (a->dim) { + switch (dim) { case ac_image_1d: dimname = "1d"; break; case ac_image_2d: dimname = "2d"; break; case ac_image_3d: dimname = "3d"; break; |