Browse Source

ac/nir: clamp shadow texture comparison value on VI

Needed for TC-compatible HTILE in radeonsi for test cases like
piglit spec/arb_texture_rg/execution/fs-shadow2d-red-01.shader_test

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
tags/17.3-branchpoint
Nicolai Hähnle 8 years ago
parent
commit
0f9e32519b
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      src/amd/common/ac_nir_to_llvm.c

+ 13
- 1
src/amd/common/ac_nir_to_llvm.c View File

@@ -4483,7 +4483,19 @@ static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr)

/* Pack depth comparison value */
if (instr->is_shadow && comparator) {
address[count++] = llvm_extract_elem(&ctx->ac, comparator, 0);
LLVMValueRef z = llvm_extract_elem(&ctx->ac, comparator, 0);

/* TC-compatible HTILE promotes Z16 and Z24 to Z32_FLOAT,
* so the depth comparison value isn't clamped for Z16 and
* Z24 anymore. Do it manually here.
*
* It's unnecessary if the original texture format was
* Z32_FLOAT, but we don't know that here.
*/
if (ctx->abi->chip_class == VI)
z = ac_build_clamp(&ctx->ac, z);

address[count++] = z;
}

/* pack derivatives */

Loading…
Cancel
Save