radv: fix missing variants for the last VGT stage with shader object

Last VGT stages (VS, TES or GS) can always be used with a null FS when
nextStage is non-zero. Like if a VS is created with nextStage=TCS, it's
also allowed to draw without binding a CTS (ie. nextStage=None is always
a valid case).

Because we don't want to compile two variants for NONE and FRAGMENT,
let's compile only the FRAGMENT one when necessary.

Fixes new CTS coverage, see https://gerrit.khronos.org/c/vk-gl-cts/+/15976.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32665>
This commit is contained in:
Samuel Pitoiset
2024-12-16 18:36:01 +01:00
committed by Marge Bot
parent 5ad025b675
commit 0223f0f54d

View File

@@ -165,7 +165,16 @@ radv_shader_object_init_graphics(struct radv_shader_object *shader_obj, struct r
shader_obj->shader = shader;
shader_obj->binary = binary;
} else {
radv_foreach_stage(next_stage, pCreateInfo->nextStage)
VkShaderStageFlags next_stages = pCreateInfo->nextStage;
/* The last VGT stage can always be used with rasterization enabled and a null fragment shader
* (ie. depth-only rendering). Because we don't want to have two variants for NONE and
* FRAGMENT, let's compile only one variant that works for both.
*/
if (stage == MESA_SHADER_VERTEX || stage == MESA_SHADER_TESS_EVAL || stage == MESA_SHADER_GEOMETRY)
next_stages |= VK_SHADER_STAGE_FRAGMENT_BIT;
radv_foreach_stage(next_stage, next_stages)
{
struct radv_shader *shaders[MESA_VULKAN_SHADER_STAGES] = {NULL};
struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL};