From 23c859717216253ee06482051fc08cecb63f7543 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 20 Feb 2020 10:03:29 -0500 Subject: [PATCH] panfrost: Fix gl_VertexID/InstanceID 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 Reviewed-by: Tomeu Vizoso Part-of: --- .gitlab-ci/deqp-panfrost-t860-fails.txt | 16 ---------------- src/gallium/drivers/panfrost/pan_attributes.c | 6 ++---- src/gallium/drivers/panfrost/pan_context.c | 4 ++++ src/gallium/drivers/panfrost/pan_context.h | 1 + 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci/deqp-panfrost-t860-fails.txt b/.gitlab-ci/deqp-panfrost-t860-fails.txt index 16df212525f..689e0601b55 100644 --- a/.gitlab-ci/deqp-panfrost-t860-fails.txt +++ b/.gitlab-ci/deqp-panfrost-t860-fails.txt @@ -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 diff --git a/src/gallium/drivers/panfrost/pan_attributes.c b/src/gallium/drivers/panfrost/pan_attributes.c index c19af9f1c59..ada95d181c7 100644 --- a/src/gallium/drivers/panfrost/pan_attributes.c +++ b/src/gallium/drivers/panfrost/pan_attributes.c @@ -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 */ diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 598009ba1c0..efc7c37111e 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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; diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 375569d7c73..bbef58292c6 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -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]; -- 2.30.2