diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-25 15:45:09 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-07-31 14:55:42 +0200 |
commit | 0f9e32519bb8d00dae0b9ce998d0183d1a46a121 (patch) | |
tree | 6a00ce0405dda496b2c6fce3d8937747c65c0379 /src/amd/common | |
parent | ac2ab5acadb9b792b41e0cdb3c59b8edb6dde64b (diff) |
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 <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index f75d8958fcc..8b76cd9cbe6 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -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 */ |