mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
r600/sfn: sort FS color outputs before all other outputs
The color outputs must be checked against the number of available
color buffers, therefore it is best to sort the color outputs to be
on the driver locations before the other FS outputs.
Fixes: 79ca456b48
r600/sfn: rewrite NIR backend
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7530
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19804>
This commit is contained in:
parent
85e140aa5c
commit
be570cd322
3 changed files with 17 additions and 9 deletions
|
|
@ -169,7 +169,19 @@ insert_fsoutput_sorted(struct exec_list *var_list, nir_variable *new_var)
|
|||
|
||||
nir_foreach_variable_in_list(var, var_list)
|
||||
{
|
||||
if (var->data.location > new_var->data.location ||
|
||||
if ((var->data.location >= FRAG_RESULT_DATA0 ||
|
||||
var->data.location == FRAG_RESULT_COLOR) &&
|
||||
(new_var->data.location < FRAG_RESULT_COLOR ||
|
||||
new_var->data.location == FRAG_RESULT_SAMPLE_MASK)) {
|
||||
exec_node_insert_after(&var->node, &new_var->node);
|
||||
return;
|
||||
} else if ((new_var->data.location >= FRAG_RESULT_DATA0 ||
|
||||
new_var->data.location == FRAG_RESULT_COLOR) &&
|
||||
(var->data.location < FRAG_RESULT_COLOR ||
|
||||
var->data.location == FRAG_RESULT_SAMPLE_MASK)) {
|
||||
exec_node_insert_node_before(&var->node, &new_var->node);
|
||||
return;
|
||||
} else if (var->data.location > new_var->data.location ||
|
||||
(var->data.location == new_var->data.location &&
|
||||
var->data.index > new_var->data.index)) {
|
||||
exec_node_insert_node_before(&var->node, &new_var->node);
|
||||
|
|
@ -803,6 +815,9 @@ r600_shader_from_nir(struct r600_context *rctx,
|
|||
if (sh->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
NIR_PASS_V(sh, nir_lower_fragcoord_wtrans);
|
||||
NIR_PASS_V(sh, r600_lower_fs_out_to_vector);
|
||||
NIR_PASS_V(sh, nir_opt_dce);
|
||||
NIR_PASS_V(sh, nir_remove_dead_variables, nir_var_shader_out, 0);
|
||||
r600::sort_fsoutput(sh);
|
||||
}
|
||||
nir_variable_mode io_modes = nir_var_uniform | nir_var_shader_in | nir_var_shader_out;
|
||||
|
||||
|
|
@ -909,9 +924,6 @@ r600_shader_from_nir(struct r600_context *rctx,
|
|||
|
||||
NIR_PASS_V(sh, nir_lower_bool_to_int32);
|
||||
|
||||
if (sh->info.stage == MESA_SHADER_FRAGMENT)
|
||||
r600::sort_fsoutput(sh);
|
||||
|
||||
NIR_PASS_V(sh, nir_lower_locals_to_regs);
|
||||
|
||||
NIR_PASS_V(sh,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ FragmentShader::FragmentShader(const r600_shader_key& key):
|
|||
m_export_highest(0),
|
||||
m_num_color_exports(0),
|
||||
m_color_export_mask(0),
|
||||
m_depth_exports(0),
|
||||
m_last_pixel_export(nullptr),
|
||||
m_pos_input(127, false),
|
||||
m_fs_write_all(false),
|
||||
|
|
@ -511,8 +510,7 @@ FragmentShader::emit_export_pixel(nir_intrinsic_instr& intr)
|
|||
unsigned location =
|
||||
(m_dual_source_blend && (semantics.location == FRAG_RESULT_COLOR)
|
||||
? semantics.dual_source_blend_index
|
||||
: driver_location) +
|
||||
k - m_depth_exports;
|
||||
: driver_location) + k;
|
||||
|
||||
sfn_log << SfnLog::io << "Pixel output at loc:" << location << "\n";
|
||||
|
||||
|
|
@ -547,7 +545,6 @@ FragmentShader::emit_export_pixel(nir_intrinsic_instr& intr)
|
|||
} else if (semantics.location == FRAG_RESULT_DEPTH ||
|
||||
semantics.location == FRAG_RESULT_STENCIL ||
|
||||
semantics.location == FRAG_RESULT_SAMPLE_MASK) {
|
||||
m_depth_exports++;
|
||||
emit_instruction(new ExportInstr(ExportInstr::pixel, 61, value));
|
||||
int semantic = TGSI_SEMANTIC_POSITION;
|
||||
if (semantics.location == FRAG_RESULT_STENCIL)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ private:
|
|||
unsigned m_export_highest;
|
||||
unsigned m_num_color_exports;
|
||||
unsigned m_color_export_mask;
|
||||
unsigned m_depth_exports;
|
||||
ExportInstr *m_last_pixel_export;
|
||||
|
||||
std::bitset<s_max_interpolators> m_interpolators_used;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue