mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
pan/compiler: Allow 16-bit alpha for atest_pan
We just need to handle it while translating NIR to BIR, the hardware can do automatic widening to 32-bits. Signed-off-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41096>
This commit is contained in:
parent
2a7d817591
commit
abde403a7c
2 changed files with 9 additions and 2 deletions
|
|
@ -1786,8 +1786,15 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr)
|
|||
}
|
||||
|
||||
case nir_intrinsic_atest_pan: {
|
||||
unsigned alpha_bit_size = instr->src[1].ssa->bit_size;
|
||||
assert(alpha_bit_size == 16 || alpha_bit_size == 32);
|
||||
|
||||
bi_index coverage = bi_src_index(&instr->src[0]);
|
||||
bi_index alpha = bi_src_index(&instr->src[1]);
|
||||
|
||||
if (alpha_bit_size == 16)
|
||||
alpha = bi_half(alpha, false);
|
||||
|
||||
bi_atest_to(b, dst, coverage, alpha, bi_fau(BIR_FAU_ATEST_PARAM, false));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ pan_nir_lower_fs_outputs(nir_shader *shader, bool skip_atest)
|
|||
*/
|
||||
nir_def *alpha;
|
||||
if (color0 && glsl_type_is_float_16_32(color0->type))
|
||||
alpha = nir_f2f32(b, nir_channel(b, nir_load_var(b, color0), 3));
|
||||
alpha = nir_channel(b, nir_load_var(b, color0), 3);
|
||||
else
|
||||
alpha = nir_imm_float(b, 1.0f);
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ pan_nir_lower_fs_outputs(nir_shader *shader, bool skip_atest)
|
|||
* skipped for pure integer framebuffers, so the issue is moot.
|
||||
*/
|
||||
if (!skip_atest)
|
||||
coverage = nir_atest_pan(b, coverage, nir_f2f32(b, alpha));
|
||||
coverage = nir_atest_pan(b, coverage, alpha);
|
||||
|
||||
/* We discard depth/stencil writes if early fragment tests is forced. */
|
||||
if ((out.depth || out.stencil) && !shader->info.fs.early_fragment_tests) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue