Module: Mesa
Branch: main
Commit: 53c17d85abad095c9d381785d29531e8a4532ffc
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=53c17d85abad095c9d381785d29531e8a4532ffc

Author: Pavel Ondračka <pavel.ondra...@gmail.com>
Date:   Tue Jan  9 16:03:38 2024 +0100

r300: fix reusing of color varying slots for generic ones

This was broken when I added texcoord support, the problem is that we
failed to properly count the number of used fs inputs and thus we failed
to make the proper decision when to reuse the color varying slot
Also fix the error messages, they were incorrect after the rewrite as
well. This fixes a bunch of piglits.

Fixes: d4b8e8a48144f4b899d48c271558f0dc613632cb

Signed-off-by: Pavel Ondračka <pavel.ondra...@gmail.com>
Reviewed-by: Filip Gawin <filip.ga...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27003>

---

 .../drivers/r300/ci/r300-rv530-nohiz-fails.txt     | 29 ----------------------
 src/gallium/drivers/r300/r300_fs.c                 |  2 ++
 src/gallium/drivers/r300/r300_state_derived.c      | 24 ++++++++++++------
 3 files changed, 18 insertions(+), 37 deletions(-)

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 736e4e0abaf..5bebb4eb040 100644
--- a/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt
+++ b/src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt
@@ -368,8 +368,6 @@ shaders@glsl-bug-110796,Fail
 shaders@glsl-fs-bug25902,Fail
 shaders@glsl-fwidth,Fail
 shaders@glsl-lod-bias,Fail
-shaders@glsl-max-varyings,Fail
-shaders@glsl-max-varyings >max_varying_components,Fail
 shaders@glsl-orangebook-ch06-bump,Fail
 shaders@glsl-uniform-interstage-limits@subdivide 5,Fail
 shaders@glsl-uniform-interstage-limits@subdivide 5- statechanges,Fail
@@ -841,33 +839,6 @@ spec@glsl-1.10@execution@loops@glsl-vs-loop-300,Fail
 
 
spec@glsl-1.10@execution@variable-indexing@vs-output-array-vec2-index-wr-no-unroll,Fail
 
-spec@glsl-1.10@execution@varying-packing@simple float array,Fail
-spec@glsl-1.10@execution@varying-packing@simple float separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat2 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat2 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat2x3 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat2x3 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat2x4 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat2x4 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat3 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat3 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat3x2 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat3x2 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat3x4 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat3x4 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat4 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat4 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat4x2 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat4x2 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat4x3 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple mat4x3 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple vec2 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple vec2 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple vec3 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple vec3 separate,Fail
-spec@glsl-1.10@execution@varying-packing@simple vec4 array,Fail
-spec@glsl-1.10@execution@varying-packing@simple vec4 separate,Fail
-
 spec@glsl-1.20@execution@clipping@vs-clip-vertex-const-accept,Fail
 spec@glsl-1.20@execution@clipping@vs-clip-vertex-different-from-position,Fail
 spec@glsl-1.20@execution@clipping@vs-clip-vertex-homogeneity,Fail
diff --git a/src/gallium/drivers/r300/r300_fs.c 
b/src/gallium/drivers/r300/r300_fs.c
index 4c25492b634..5300c8bf047 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -65,11 +65,13 @@ void r300_shader_read_fs_inputs(struct tgsi_shader_info* 
info,
             case TGSI_SEMANTIC_TEXCOORD:
                 assert(index < ATTR_TEXCOORD_COUNT);
                 fs_inputs->texcoord[index] = i;
+                fs_inputs->num_texcoord++;
                 break;
 
             case TGSI_SEMANTIC_GENERIC:
                 assert(index < ATTR_GENERIC_COUNT);
                 fs_inputs->generic[index] = i;
+                fs_inputs->num_generic++;
                 break;
 
             case TGSI_SEMANTIC_FOG:
diff --git a/src/gallium/drivers/r300/r300_state_derived.c 
b/src/gallium/drivers/r300/r300_state_derived.c
index 3adb031247f..2a2326b2397 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -541,6 +541,14 @@ static void r300_update_rs_block(struct r300_context *r300)
         }
     }
 
+    for (; i < ATTR_GENERIC_COUNT; i++) {
+        if (fs_inputs->generic[i] != ATTR_UNUSED) {
+            fprintf(stderr, "r300: ERROR: FS input generic %i unassigned, "
+                    "not enough hardware slots (it's not a bug, do not "
+                    "report it).\n", i);
+        }
+    }
+
     gen_offset = 0;
     /* Re-use color varyings for texcoords if possible.
      *
@@ -645,6 +653,14 @@ static void r300_update_rs_block(struct r300_context *r300)
         }
     }
 
+    for (; i < ATTR_TEXCOORD_COUNT; i++) {
+        if (fs_inputs->texcoord[i] != ATTR_UNUSED) {
+            fprintf(stderr, "r300: ERROR: FS input texcoord %i unassigned, "
+                    "not enough hardware slots (it's not a bug, do not "
+                    "report it).\n", i);
+        }
+    }
+
     /* Rasterize pointcoord. */
     if (fs_inputs->pcoord != ATTR_UNUSED && tex_count < 8) {
 
@@ -666,14 +682,6 @@ static void r300_update_rs_block(struct r300_context *r300)
         tex_ptr += 2;
     }
 
-    for (; i < ATTR_GENERIC_COUNT; i++) {
-        if (fs_inputs->generic[i] != ATTR_UNUSED) {
-            fprintf(stderr, "r300: ERROR: FS input generic %i unassigned, "
-                    "not enough hardware slots (it's not a bug, do not "
-                    "report it).\n", i);
-        }
-    }
-
     /* Rasterize fog coordinates. */
     if (vs_outputs->fog != ATTR_UNUSED && tex_count < 8) {
         /* Set up the fog coordinates in VAP. */

Reply via email to