panfrost: Extend attribute_count for vertex builtins
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 19 Dec 2019 18:39:14 +0000 (13:39 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 25 Dec 2019 03:55:04 +0000 (22:55 -0500)
They stretch beyond the usual limit for attributes so are included
implicitly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_assemble.c

index 54c5ba7970099a8be6d12a42ca1387fe21143066..6928f33faaed0d7338ca8dbabd2288a7985db0a0 100644 (file)
@@ -96,10 +96,20 @@ panfrost_shader_compile(
         meta->midgard1.uniform_count = MIN2(program.uniform_count, program.uniform_cutoff);
         meta->midgard1.work_count = program.work_register_count;
 
+        bool vertex_id = s->info.system_values_read & (1 << SYSTEM_VALUE_VERTEX_ID);
+        bool instance_id = s->info.system_values_read & (1 << SYSTEM_VALUE_INSTANCE_ID);
+
         switch (stage) {
         case MESA_SHADER_VERTEX:
                 meta->attribute_count = util_bitcount64(s->info.inputs_read);
                 meta->varying_count = util_bitcount64(s->info.outputs_written);
+
+                if (vertex_id)
+                        meta->attribute_count = MAX2(meta->attribute_count, PAN_VERTEX_ID + 1);
+
+                if (instance_id)
+                        meta->attribute_count = MAX2(meta->attribute_count, PAN_INSTANCE_ID + 1);
+
                 break;
         case MESA_SHADER_FRAGMENT:
                 meta->attribute_count = 0;