panfrost: Fix gl_VertexID/InstanceID
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 20 Feb 2020 15:03:29 +0000 (10:03 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 27 Feb 2020 15:31:37 +0000 (16:31 +0100)
Fixes a bunch of tests in dEQP-GLES3.functional.instanced.*.

Fixes: 027944c7c8c ("panfrost: Avoid reading GPU memory when packing
vertices")

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3950>

.gitlab-ci/deqp-panfrost-t860-fails.txt
src/gallium/drivers/panfrost/pan_attributes.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index 16df212525fafb411eaa2000e32a094cec3d3436..689e0601b5588bceec1787a1882553fd2e1522da 100644 (file)
@@ -571,22 +571,6 @@ dEQP-GLES3.functional.fragment_out.array.uint.rgba8ui_mediump_uvec2
 dEQP-GLES3.functional.fragment_out.array.uint.rgba8ui_mediump_uvec3
 dEQP-GLES3.functional.fragment_out.array.uint.rgba8ui_mediump_uvec4
 dEQP-GLES3.functional.fragment_out.random.30
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.instance_id.1_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.instance_id.20_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.instance_id.2_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.instance_id.4_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.mixed.1_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.mixed.20_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.mixed.2_instances
-dEQP-GLES3.functional.instanced.draw_arrays_instanced.mixed.4_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.instance_id.1_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.instance_id.20_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.instance_id.2_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.instance_id.4_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.mixed.1_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.mixed.20_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.mixed.2_instances
-dEQP-GLES3.functional.instanced.draw_elements_instanced.mixed.4_instances
 dEQP-GLES3.functional.multisample.fbo_4_samples.common_edge_big_quad
 dEQP-GLES3.functional.multisample.fbo_4_samples.common_edge_small_quads
 dEQP-GLES3.functional.multisample.fbo_4_samples.common_edge_viewport_quad
index c19af9f1c5988944e8c6a93e09933928f777fc9c..ada95d181c7d2eeb4354e451426c598c102599d1 100644 (file)
@@ -118,10 +118,8 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch)
         /* Add special gl_VertexID/gl_InstanceID buffers */
 
         panfrost_vertex_id(ctx->padded_count, &attrs[k]);
-        so->hw[PAN_VERTEX_ID].index = k++;
-
-        panfrost_instance_id(ctx->padded_count, &attrs[k]);
-        so->hw[PAN_INSTANCE_ID].index = k++;
+        so->vertexid_index = k++;
+        panfrost_instance_id(ctx->padded_count, &attrs[k++]);
 
         /* Upload whatever we emitted and go */
 
index 598009ba1c078a9c4a90b76e9ef93759f3688e1c..efc7c37111e9099caa19c1f72d03cc8cc6742b22 100644 (file)
@@ -430,7 +430,11 @@ panfrost_stage_attributes(struct panfrost_context *ctx)
         };
 
         /* See mali_attr_meta specification for the magic number */
+
+        builtin.index = so->vertexid_index;
         memcpy(&target[PAN_VERTEX_ID], &builtin, 4);
+
+        builtin.index = so->vertexid_index + 1;
         memcpy(&target[PAN_INSTANCE_ID], &builtin, 4);
 
         ctx->payloads[PIPE_SHADER_VERTEX].postfix.attribute_meta = transfer.gpu;
index 375569d7c735288e531c303edd50b98f353e0115..bbef58292c6345eaff290adca24c83c3ec6e8c13 100644 (file)
@@ -248,6 +248,7 @@ struct panfrost_shader_variants {
 
 struct panfrost_vertex_state {
         unsigned num_elements;
+        unsigned vertexid_index;
 
         struct pipe_vertex_element pipe[PIPE_MAX_ATTRIBS];
         struct mali_attr_meta hw[PIPE_MAX_ATTRIBS];