r300: Fix omod failing to increase the number of channels stored.
authorEmma Anholt <emma@anholt.net>
Wed, 5 Jan 2022 00:51:01 +0000 (16:51 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 5 Jan 2022 17:07:38 +0000 (17:07 +0000)
In dEQP-GLES2.functional.shaders.operator.geometric.reflect.highp_vec2_fragment
and friends this pass would turn:

  0: DP3 temp[1].x, input[1].yx0_, input[0].wy0_;
  1: MUL temp[2].xy, temp[1].xx__, const[0].xx__;

into

  0: DP3 temp[2].x * 2, input[1].yx0_, input[0].wy0_;
  1: MUL temp[3].xy, temp[2].xy__, input[1].yx__;

Note the attempt to use .y of temp[2].  Just bail when we more dst
channels than src channels, since the rewrite can't generate more channels
for us.  Fixes this subset of tests (which I hadn't included in the xfails
until now since results hadn't quite been stable).

Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Filip Gawin <filip.gawin@zoho.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14405>

src/gallium/drivers/r300/ci/r300-rv515-fails.txt
src/gallium/drivers/r300/compiler/radeon_optimize.c

index 02f463f..6d129ee 100644 (file)
@@ -85,13 +85,6 @@ dEQP-GLES2.functional.shaders.loops.for_constant_iterations.mixed_break_continue
 dEQP-GLES2.functional.shaders.loops.for_dynamic_iterations.mixed_break_continue_vertex,Fail
 dEQP-GLES2.functional.shaders.loops.for_uniform_iterations.mixed_break_continue_vertex,Fail
 
-dEQP-GLES2.functional.shaders.operator.geometric.reflect.highp_vec2_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.geometric.reflect.highp_vec3_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.geometric.reflect.highp_vec4_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.geometric.reflect.mediump_vec2_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.geometric.reflect.mediump_vec3_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.geometric.reflect.mediump_vec4_fragment,Fail
-
 dEQP-GLES2.functional.shaders.return.return_in_dynamic_loop_dynamic_vertex,Fail
 
 dEQP-GLES2.functional.shaders.random.texture.fragment.141,Fail
index 5c825a0..a7e9445 100644 (file)
@@ -26,6 +26,8 @@
  *
  */
 
+#include "util/u_math.h"
+
 #include "radeon_dataflow.h"
 
 #include "radeon_compiler.h"
@@ -837,8 +839,15 @@ static int peephole_mul_omod(
                return 0;
        }
 
-       /* Rewrite the instructions */
        writemask_sum = rc_variable_writemask_sum(writer_list->Item);
+
+       /* rc_normal_rewrite_writemask can't expand a previous writemask to store
+        * more channels replicated.
+        */
+       if (util_bitcount(writemask_sum) < util_bitcount(inst_mul->U.I.DstReg.WriteMask))
+               return 0;
+
+       /* Rewrite the instructions */
        for (var = writer_list->Item; var; var = var->Friend) {
                struct rc_variable * writer = var;
                unsigned conversion_swizzle = rc_make_conversion_swizzle(