diff --git a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt index 5c9762f3aec..e47e9d75053 100644 --- a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt @@ -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 diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c index a02147a8244..96b1984ad6f 100644 --- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c +++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c @@ -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}, diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c b/src/gallium/drivers/r300/compiler/radeon_compiler.c index fddc23702f7..ed806045d33 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler.c +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c @@ -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 diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h index 0e4321fae83..05bc8d6cb4b 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler.h +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h @@ -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);