GLSL: Support shading rate builtins.
This commit is contained in:
parent
3cb8e7c223
commit
c89b5a1a3f
@ -0,0 +1,10 @@
|
||||
#version 450
|
||||
#extension GL_EXT_fragment_shading_rate : require
|
||||
|
||||
layout(location = 0) out uint FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = uint(gl_ShadingRateEXT);
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
#version 450
|
||||
#extension GL_EXT_fragment_shading_rate : require
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_PrimitiveShadingRateEXT = 3;
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
|
9
shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag
Normal file
9
shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag
Normal file
@ -0,0 +1,9 @@
|
||||
#version 450
|
||||
#extension GL_EXT_fragment_shading_rate : require
|
||||
|
||||
layout(location = 0) out uint FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = gl_ShadingRateEXT;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
#version 450
|
||||
#extension GL_EXT_fragment_shading_rate : require
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_PrimitiveShadingRateEXT = 3;
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
@ -8317,6 +8317,22 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
|
||||
SPIRV_CROSS_THROW("Stencil export not supported in GLES.");
|
||||
}
|
||||
|
||||
case BuiltInPrimitiveShadingRateKHR:
|
||||
{
|
||||
if (!options.vulkan_semantics)
|
||||
SPIRV_CROSS_THROW("Can only use PrimitiveShadingRateKHR in Vulkan GLSL.");
|
||||
require_extension_internal("GL_EXT_fragment_shading_rate");
|
||||
return "gl_PrimitiveShadingRateEXT";
|
||||
}
|
||||
|
||||
case BuiltInShadingRateKHR:
|
||||
{
|
||||
if (!options.vulkan_semantics)
|
||||
SPIRV_CROSS_THROW("Can only use ShadingRateKHR in Vulkan GLSL.");
|
||||
require_extension_internal("GL_EXT_fragment_shading_rate");
|
||||
return "gl_ShadingRateEXT";
|
||||
}
|
||||
|
||||
case BuiltInDeviceIndex:
|
||||
if (!options.vulkan_semantics)
|
||||
SPIRV_CROSS_THROW("Need Vulkan semantics for device group support.");
|
||||
@ -15149,6 +15165,8 @@ void CompilerGLSL::cast_from_builtin_load(uint32_t source_id, std::string &expr,
|
||||
case BuiltInFragStencilRefEXT:
|
||||
case BuiltInInstanceCustomIndexNV:
|
||||
case BuiltInSampleMask:
|
||||
case BuiltInPrimitiveShadingRateKHR:
|
||||
case BuiltInShadingRateKHR:
|
||||
expected_type = SPIRType::Int;
|
||||
break;
|
||||
|
||||
@ -15193,6 +15211,8 @@ void CompilerGLSL::cast_to_builtin_store(uint32_t target_id, std::string &expr,
|
||||
case BuiltInViewportIndex:
|
||||
case BuiltInFragStencilRefEXT:
|
||||
case BuiltInSampleMask:
|
||||
case BuiltInPrimitiveShadingRateKHR:
|
||||
case BuiltInShadingRateKHR:
|
||||
expected_type = SPIRType::Int;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user