pan/mdg: Lower away gl_VertexID offset
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 4 Jun 2021 23:07:41 +0000 (19:07 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 18:06:10 +0000 (18:06 +0000)
Technically we can stick the offset in the vertex ID attribute record,
but this is a faster way to get the test passing and Midgard perf?
what's that?

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>

src/panfrost/lib/pan_shader.c
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_compile.h

index 3b302db..f1d4d44 100644 (file)
@@ -193,7 +193,7 @@ pan_shader_compile(const struct panfrost_device *dev,
                 info->attribute_count = util_bitcount64(s->info.inputs_read);
 
                 bool vertex_id = BITSET_TEST(s->info.system_values_read,
-                                             SYSTEM_VALUE_VERTEX_ID);
+                                             SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
                 if (vertex_id && !pan_is_bifrost(dev))
                         info->attribute_count = MAX2(info->attribute_count, PAN_VERTEX_ID + 1);
 
index 37954c2..23d624e 100644 (file)
@@ -1602,7 +1602,7 @@ static unsigned
 vertex_builtin_arg(nir_intrinsic_op op)
 {
         switch (op) {
-        case nir_intrinsic_load_vertex_id:
+        case nir_intrinsic_load_vertex_id_zero_base:
                 return PAN_VERTEX_ID;
         case nir_intrinsic_load_instance_id:
                 return PAN_INSTANCE_ID;
@@ -2049,7 +2049,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
                 emit_compute_builtin(ctx, instr);
                 break;
 
-        case nir_intrinsic_load_vertex_id:
+        case nir_intrinsic_load_vertex_id_zero_base:
         case nir_intrinsic_load_instance_id:
                 emit_vertex_builtin(ctx, instr);
                 break;
index 242ac11..d3bce99 100644 (file)
@@ -93,6 +93,7 @@ static const nir_shader_compiler_options midgard_nir_options = {
         .vectorize_io = true,
         .use_interpolated_input_intrinsics = true,
 
+        .vertex_id_zero_based = true,
         .has_cs_global_id = true,
         .lower_cs_local_index_from_id = true,
         .max_unroll_iterations = 32,