From 1e9e5618110542550b9f92dca8392f213bfd46b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Wed, 19 Oct 2022 10:23:11 +0200 Subject: [PATCH] r300: fix generation of invalid swizzles in regalloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rc_adjust_channels is inteded for moving the swizzles to a new channels when rewriting the writemask of an instruction. However for readers one needs to keep the swizzles in the old channels but rather convert to the new values, so use the proper helper rc_rewrite_swizzle. With the new swizzle fixed, we should properly detect that it would be invalid and thus we can select the proper register class to prevent the writemask rewrite in the regalloc. Documentation was added to rc_adjust_channels to make it more clear what it actually does. Fixes a bunch of dEQP tests. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7521 Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Part-of: --- src/gallium/drivers/r300/ci/r300-r480-fails.txt | 7 ------- .../drivers/r300/compiler/radeon_compiler_util.c | 11 +++++++++-- .../drivers/r300/compiler/radeon_pair_regalloc.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/r300/ci/r300-r480-fails.txt b/src/gallium/drivers/r300/ci/r300-r480-fails.txt index d09fedb4e08..5b24b52cc96 100644 --- a/src/gallium/drivers/r300/ci/r300-r480-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-r480-fails.txt @@ -159,7 +159,6 @@ dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_loop_subscr dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_loop_subscript_write_static_subscript_read_vertex dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_dynamic_loop_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_dynamic_loop_subscript_read_vertex -dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_dynamic_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_static_loop_subscript_write_dynamic_loop_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_static_loop_subscript_write_dynamic_loop_subscript_read_vertex dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_static_subscript_write_dynamic_loop_subscript_read_fragment @@ -180,13 +179,8 @@ dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_loop_subscr dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_loop_subscript_write_static_loop_subscript_read_vertex dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_loop_subscript_write_static_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_loop_subscript_write_static_subscript_read_vertex -dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_component_read_fragment -dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_direct_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_dynamic_loop_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_dynamic_loop_subscript_read_vertex -dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_dynamic_subscript_read_fragment -dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_static_loop_subscript_read_fragment -dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_static_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_static_loop_subscript_write_dynamic_loop_subscript_read_fragment dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_static_loop_subscript_write_dynamic_loop_subscript_read_vertex dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_static_subscript_write_dynamic_loop_subscript_read_fragment @@ -640,7 +634,6 @@ dEQP-GLES2.functional.shaders.operator.angle_and_trigonometry.atan.mediump_vec2_ dEQP-GLES2.functional.shaders.random.all_features.fragment.1 dEQP-GLES2.functional.shaders.random.all_features.fragment.5 dEQP-GLES2.functional.shaders.random.all_features.fragment.6 -dEQP-GLES2.functional.shaders.random.all_features.fragment.91 dEQP-GLES2.functional.shaders.random.texture.fragment.141 dEQP-GLES2.functional.shaders.random.texture.fragment.42 dEQP-GLES2.functional.shaders.return.return_in_dynamic_loop_dynamic_fragment diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c index 5d368299231..f4e4238c541 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c +++ b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c @@ -142,8 +142,15 @@ static unsigned int srcs_need_rewrite(const struct rc_opcode_info * info) } /** - * @return A swizzle the results from converting old_swizzle using - * conversion_swizzle + * This function moves the old swizzles to new channels using the values + * in the conversion swizzle. For example if the instruction writemask is + * changed from x to y, then conversion_swizzle should be y___ and this + * function will adjust the old argument swizzles (of the same instruction) + * to the new channels, so x___ will become _x__, etc... + * + * @param old_swizzle The swizzle to change + * @param conversion_swizzle Describes the conversion to perform on the swizzle + * @return A new swizzle */ unsigned int rc_adjust_channels( unsigned int old_swizzle, diff --git a/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c b/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c index d3a589c98d1..53da5e5b48f 100644 --- a/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c +++ b/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c @@ -390,7 +390,7 @@ static enum rc_reg_class variable_get_class( can_change_writemask = 0; break; } - new_swizzle = rc_adjust_channels( + new_swizzle = rc_rewrite_swizzle( old_swizzle, conversion_swizzle); if (!r300_swizzle_is_native_basic( new_swizzle)) {