mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
r300: skip backend DCE for vertex shaders
Only mark the unused channels according to the writemask for now, but this can go as well when we translate directly form NIR. Right now we still need to do this separatelly as TGSI has no concept of unused swizzle. The old DCE pass was known to be buggy, so this also fixes at least piglit glsl-vs-copy-propagation-1. Reviewed-by: Filip Gawin <filip.gawin@collabora.com> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9279 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26848>
This commit is contained in:
parent
0e2e4688af
commit
78404cc57d
4 changed files with 21 additions and 5 deletions
|
|
@ -809,9 +809,6 @@ spec@glsl-1.10@execution@built-in-functions@vs-pow-vec4-vec4,Fail
|
|||
spec@glsl-1.10@execution@clipping@clip-plane-transformation clipvert_pos,Fail
|
||||
spec@glsl-1.10@execution@clipping@clip-plane-transformation pos_clipvert,Fail
|
||||
|
||||
# https://gitlab.freedesktop.org/mesa/mesa/-/issues/9279
|
||||
spec@glsl-1.10@execution@copy-propagation@glsl-vs-copy-propagation-1,Crash
|
||||
|
||||
spec@glsl-1.10@execution@glsl-1.10-built-in-uniform-state,Fail
|
||||
|
||||
spec@glsl-1.10@execution@interpolation@interpolation-none-gl_backcolor-flat-vertex,Fail
|
||||
|
|
|
|||
|
|
@ -865,7 +865,7 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
|
|||
{"add artificial outputs", 0, 1, rc_vs_add_artificial_outputs, NULL},
|
||||
{"native rewrite", 1, 1, rc_local_transform, alu_rewrite},
|
||||
{"emulate modifiers", 1, !is_r500, rc_local_transform, emulate_modifiers},
|
||||
{"deadcode", 1, opt, rc_dataflow_deadcode, NULL},
|
||||
{"unused channels", 1, opt, rc_mark_unused_channels, NULL},
|
||||
{"dataflow optimize", 1, opt, rc_optimize, NULL},
|
||||
/* This pass must be done after optimizations. */
|
||||
{"source conflict resolve", 1, 1, rc_local_transform, resolve_src_conflicts},
|
||||
|
|
|
|||
|
|
@ -108,6 +108,25 @@ int rc_if_fail_helper(struct radeon_compiler * c, const char * file, int line, c
|
|||
return 1;
|
||||
}
|
||||
|
||||
void rc_mark_unused_channels(struct radeon_compiler * c, void *user)
|
||||
{
|
||||
unsigned int srcmasks[3];
|
||||
|
||||
for(struct rc_instruction * inst = c->Program.Instructions.Next;
|
||||
inst != &c->Program.Instructions;
|
||||
inst = inst->Next) {
|
||||
|
||||
rc_compute_sources_for_writemask(inst, inst->U.I.DstReg.WriteMask, srcmasks);
|
||||
|
||||
for(unsigned int src = 0; src < 3; ++src) {
|
||||
for(unsigned int chan = 0; chan < 4; ++chan) {
|
||||
if (!GET_BIT(srcmasks[src], chan))
|
||||
SET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan, RC_SWIZZLE_UNUSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recompute c->Program.InputsRead and c->Program.OutputsWritten
|
||||
* based on which inputs and outputs are actually referenced
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ int rc_if_fail_helper(struct radeon_compiler * c, const char * file, int line, c
|
|||
#define rc_assert(c, cond) \
|
||||
(!(cond) && rc_if_fail_helper(c, __FILE__, __LINE__, #cond))
|
||||
|
||||
void rc_mark_unused_channels(struct radeon_compiler * c, void *user);
|
||||
void rc_calculate_inputs_outputs(struct radeon_compiler * c);
|
||||
|
||||
void rc_copy_output(struct radeon_compiler * c, unsigned output, unsigned dup_output);
|
||||
void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsigned new_input,
|
||||
int full_vtransform);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue