mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
nir/lower_input_attachments: Handle unscaled input attachments with no index
With VK_KHR_dynamic_rendering_local_read we can have input attachments with no index, which normally correspond to depth/stencil attachments, and we have to handle this here when determining whether we need to emit an unscaled fragcoord for FDM. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31261>
This commit is contained in:
parent
4bd506a7f3
commit
65c0846537
2 changed files with 8 additions and 3 deletions
|
|
@ -6449,6 +6449,7 @@ typedef struct nir_input_attachment_options {
|
|||
bool use_fragcoord_sysval;
|
||||
bool use_layer_id_sysval;
|
||||
bool use_view_id_for_layer;
|
||||
bool unscaled_depth_stencil_ir3;
|
||||
uint32_t unscaled_input_attachment_ir3;
|
||||
} nir_input_attachment_options;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,18 +30,22 @@ load_frag_coord(nir_builder *b, nir_deref_instr *deref,
|
|||
{
|
||||
if (options->use_fragcoord_sysval) {
|
||||
nir_def *frag_coord = nir_load_frag_coord(b);
|
||||
if (options->unscaled_input_attachment_ir3) {
|
||||
if (options->unscaled_input_attachment_ir3 ||
|
||||
options->unscaled_depth_stencil_ir3) {
|
||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||
unsigned base = var->data.index;
|
||||
nir_def *unscaled_frag_coord = nir_load_frag_coord_unscaled_ir3(b);
|
||||
if (deref->deref_type == nir_deref_type_array) {
|
||||
if (deref->deref_type == nir_deref_type_array &&
|
||||
options->unscaled_input_attachment_ir3) {
|
||||
nir_def *unscaled =
|
||||
nir_i2b(b, nir_iand(b, nir_ishr(b, nir_imm_int(b, options->unscaled_input_attachment_ir3 >> base), deref->arr.index.ssa),
|
||||
nir_imm_int(b, 1)));
|
||||
frag_coord = nir_bcsel(b, unscaled, unscaled_frag_coord, frag_coord);
|
||||
} else {
|
||||
assert(deref->deref_type == nir_deref_type_var);
|
||||
bool unscaled = (options->unscaled_input_attachment_ir3 >> base) & 1;
|
||||
bool unscaled = base == NIR_VARIABLE_NO_INDEX ?
|
||||
options->unscaled_depth_stencil_ir3 :
|
||||
((options->unscaled_input_attachment_ir3 >> base) & 1);
|
||||
frag_coord = unscaled ? unscaled_frag_coord : frag_coord;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue