r300: handle presubtract when rewriting non-native swizzles
authorPavel Ondračka <pavel.ondracka@gmail.com>
Tue, 15 Nov 2022 20:50:51 +0000 (21:50 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 16 Nov 2022 19:51:47 +0000 (19:51 +0000)
The extra presubtract limitations were completelly ignored.
Fixes 4 dEQP asin and atan tests.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7554
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Tested-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19764>

src/gallium/drivers/r300/ci/r300-r480-fails.txt
src/gallium/drivers/r300/compiler/r300_fragprog_swizzle.c

index e891ed5..3f8b4d4 100644 (file)
@@ -618,10 +618,6 @@ dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.unconditional_conti
 dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.unconditional_continue_vertex,Fail
 dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.vector_counter_fragment,Fail
 dEQP-GLES2.functional.shaders.loops.while_uniform_iterations.vector_counter_vertex,Fail
-dEQP-GLES2.functional.shaders.operator.angle_and_trigonometry.asin.highp_vec2_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.angle_and_trigonometry.asin.mediump_vec2_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.angle_and_trigonometry.atan.highp_vec2_fragment,Fail
-dEQP-GLES2.functional.shaders.operator.angle_and_trigonometry.atan.mediump_vec2_fragment,Fail
 dEQP-GLES2.functional.shaders.random.all_features.fragment.1,Fail
 dEQP-GLES2.functional.shaders.random.all_features.fragment.5,Fail
 dEQP-GLES2.functional.shaders.random.all_features.fragment.6,Fail
index 4e8fdf5..d5e37e3 100644 (file)
@@ -64,6 +64,9 @@ static const struct swizzle_data native_swizzles[] = {
 };
 
 static const int num_native_swizzles = ARRAY_SIZE(native_swizzles);
+/* Only swizzles with srcp_stride != 0 can be used for presub, so
+ * just the first five from the list. */
+static const int num_presub_swizzles = 5;
 
 /**
  * Find a native RGB swizzle that matches the given swizzle.
@@ -158,7 +161,9 @@ static void r300_swizzle_split(
                unsigned int best_matchmask = 0;
                int i, comp;
 
-               for(i = 0; i < num_native_swizzles; ++i) {
+               unsigned num_swizzles = src.File == RC_FILE_PRESUB ? num_presub_swizzles : num_native_swizzles;
+
+               for(i = 0; i < num_swizzles; ++i) {
                        const struct swizzle_data *sd = &native_swizzles[i];
                        unsigned int matchcount = 0;
                        unsigned int matchmask = 0;