r300: Fix omod failing to increase the number of channels stored.

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>
This commit is contained in:
Emma Anholt 2022-01-04 16:51:01 -08:00 committed by Marge Bot
parent 946fe209d9
commit 105b48c85c
2 changed files with 10 additions and 8 deletions

View 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

View 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(