broadcom/compiler: implement gl_PrimitiveID in FS without a GS
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 13 Jul 2021 10:47:20 +0000 (12:47 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Jul 2021 12:05:56 +0000 (12:05 +0000)
commit940725a7d991939aae576f73e4815fad34a68a22
tree364037e5a7733d78bae91253646f27a7522911e7
parent82fadbd3ab3809184c0ca21d4dcb995abac7baa5
broadcom/compiler: implement gl_PrimitiveID in FS without a GS

OpenGL ES 3.1 specifies that a geometry shader can write to gl_PrimitiveID,
which can then be read by a fragment shader.

OpenGL ES 3.2 additionally adds the capacity for the fragment shader
to read gl_PrimitiveID even if there is no geometry shader. This
commit adds support for this feature, which is also implicitly
expected by the geometry shader feature in Vulkan 1.0.

Fixes:
dEQP-VK.pipeline.framebuffer_attachment.no_attachments
dEQP-VK.pipeline.framebuffer_attachment.no_attachments_ms

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11874>
src/broadcom/compiler/nir_to_vir.c
src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/vir.c
src/broadcom/vulkan/v3dv_pipeline.c
src/broadcom/vulkan/v3dvx_cmd_buffer.c
src/gallium/drivers/v3d/v3d_program.c
src/gallium/drivers/v3d/v3dx_draw.c