broadcom/vc5: Account for InstanceID/VertexID in VPM segment size.
authorEric Anholt <eric@anholt.net>
Thu, 22 Mar 2018 20:52:11 +0000 (13:52 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 22 Mar 2018 22:12:21 +0000 (15:12 -0700)
Fixes failure in
GTF-GLES3.gtf.GL3Tests.draw_instanced.draw_instanced_attrib_size

src/broadcom/compiler/vir.c

index ff9405e6c120d41e2a979451ad70e9841018fca3..93990ee806f61de98051e89204223da724782d52 100644 (file)
@@ -728,15 +728,20 @@ uint64_t *v3d_compile_vs(const struct v3d_compiler *compiler,
                 prog_data->vpm_input_size += c->vattr_sizes[i];
         }
 
-        /* Input/output segment size are in 8x32-bit multiples. */
-        prog_data->vpm_input_size = align(prog_data->vpm_input_size, 8) / 8;
-        prog_data->vpm_output_size = align(c->num_vpm_writes, 8) / 8;
-
         prog_data->uses_vid = (s->info.system_values_read &
                                (1ull << SYSTEM_VALUE_VERTEX_ID));
         prog_data->uses_iid = (s->info.system_values_read &
                                (1ull << SYSTEM_VALUE_INSTANCE_ID));
 
+        if (prog_data->uses_vid)
+                prog_data->vpm_input_size++;
+        if (prog_data->uses_iid)
+                prog_data->vpm_input_size++;
+
+        /* Input/output segment size are in 8x32-bit multiples. */
+        prog_data->vpm_input_size = align(prog_data->vpm_input_size, 8) / 8;
+        prog_data->vpm_output_size = align(c->num_vpm_writes, 8) / 8;
+
         return v3d_return_qpu_insts(c, final_assembly_size);
 }