Support gl_InstanceID in RT shaders.
This commit is contained in:
parent
b7823ec389
commit
86380acf4d
@ -5,6 +5,6 @@ layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 1.0;
|
||||
payload = 1.0 + float(gl_InstanceID);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,6 @@ layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 1.0;
|
||||
payload = 1.0 + float(gl_InstanceID);
|
||||
}
|
||||
|
||||
|
@ -5,5 +5,5 @@ layout(location = 0) rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 1.0;
|
||||
payload = 1.0 + float(gl_InstanceID);
|
||||
}
|
||||
|
@ -6792,8 +6792,21 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
|
||||
return "gl_VertexID";
|
||||
case BuiltInInstanceId:
|
||||
if (options.vulkan_semantics)
|
||||
SPIRV_CROSS_THROW(
|
||||
"Cannot implement gl_InstanceID in Vulkan GLSL. This shader was created with GL semantics.");
|
||||
{
|
||||
auto model = get_entry_point().model;
|
||||
switch (model)
|
||||
{
|
||||
case spv::ExecutionModelIntersectionKHR:
|
||||
case spv::ExecutionModelAnyHitKHR:
|
||||
case spv::ExecutionModelClosestHitKHR:
|
||||
// gl_InstanceID is allowed in these shaders.
|
||||
break;
|
||||
|
||||
default:
|
||||
SPIRV_CROSS_THROW(
|
||||
"Cannot implement gl_InstanceID in Vulkan GLSL. This shader was created with GL semantics.");
|
||||
}
|
||||
}
|
||||
return "gl_InstanceID";
|
||||
case BuiltInVertexIndex:
|
||||
if (options.vulkan_semantics)
|
||||
|
Loading…
Reference in New Issue
Block a user