vkd3d-shader/spirv: Use capability ShaderViewportIndexLayerEXT for decoration ViewportIndex.

This commit is contained in:
Giovanni Mascellani 2024-01-09 22:47:38 +01:00 committed by Alexandre Julliard
parent 6ac525d6c3
commit 45495f54f2
Notes: Alexandre Julliard 2024-01-22 22:53:41 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/546

View File

@ -4270,8 +4270,32 @@ static void spirv_compiler_decorate_builtin(struct spirv_compiler *compiler,
}
break;
case SpvBuiltInViewportIndex:
switch (compiler->shader_type)
{
case VKD3D_SHADER_TYPE_PIXEL:
case VKD3D_SHADER_TYPE_GEOMETRY:
vkd3d_spirv_enable_capability(builder, SpvCapabilityMultiViewport);
break;
case VKD3D_SHADER_TYPE_VERTEX:
case VKD3D_SHADER_TYPE_DOMAIN:
if (!spirv_compiler_is_target_extension_supported(compiler,
VKD3D_SHADER_SPIRV_EXTENSION_EXT_VIEWPORT_INDEX_LAYER))
{
FIXME("The target environment does not support decoration ViewportIndex.\n");
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE,
"Cannot use SV_ViewportArrayIndex. "
"The target environment does not support decoration ViewportIndex.");
}
vkd3d_spirv_enable_capability(builder, SpvCapabilityShaderViewportIndexLayerEXT);
break;
default:
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_SHADER,
"Invalid use of SV_ViewportArrayIndex.");
break;
}
break;
case SpvBuiltInSampleId:
vkd3d_spirv_enable_capability(builder, SpvCapabilitySampleRateShading);
break;