mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
anv: limit compiler valid color outputs using NIR variables
This fixes a test from the vkd3d-proton test_dual_source_blending_dxbc test which asserts in the backend with : brw_fs_visitor.cpp:716: void fs_visitor::emit_fb_writes(): Assertion `!prog_data->dual_src_blend || key->nr_color_regions == 1' failed. This is because there is 2 color attachments provided by the renderpass so we initially set nr_color_regions = 2. But once we've parsed the shader, we can see it's only using one output (with dual source color blending). This change looks at the output variables to update the valid output variables. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14417>
This commit is contained in:
parent
b8f0459d6f
commit
07bc6b7ed9
1 changed files with 18 additions and 0 deletions
|
|
@ -1190,6 +1190,24 @@ anv_pipeline_link_fs(const struct brw_compiler *compiler,
|
|||
if (deleted_output)
|
||||
nir_fixup_deref_modes(stage->nir);
|
||||
|
||||
/* Initially the valid outputs value is based off the renderpass color
|
||||
* attachments (see populate_wm_prog_key()), now that we've potentially
|
||||
* deleted variables that map to unused attachments, we need to update the
|
||||
* valid outputs for the backend compiler based on what output variables
|
||||
* are actually used. */
|
||||
stage->key.wm.color_outputs_valid = 0;
|
||||
nir_foreach_shader_out_variable_safe(var, stage->nir) {
|
||||
if (var->data.location < FRAG_RESULT_DATA0)
|
||||
continue;
|
||||
|
||||
const unsigned rt = var->data.location - FRAG_RESULT_DATA0;
|
||||
const unsigned array_len =
|
||||
glsl_type_is_array(var->type) ? glsl_get_length(var->type) : 1;
|
||||
assert(rt + array_len <= MAX_RTS);
|
||||
|
||||
stage->key.wm.color_outputs_valid |= BITFIELD_RANGE(rt, array_len);
|
||||
}
|
||||
|
||||
/* We stored the number of subpass color attachments in nr_color_regions
|
||||
* when calculating the key for caching. Now that we've computed the bind
|
||||
* map, we can reduce this to the actual max before we go into the back-end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue