diff --git a/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk b/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk new file mode 100644 index 00000000..a7f63a50 --- /dev/null +++ b/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +rayPayloadInEXT float payload; + +void main() +{ + if (payload > 0.0) + { + ignoreIntersectionEXT; + } + else + { + terminateRayEXT; + } +} + diff --git a/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk b/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk new file mode 100644 index 00000000..9b9e34b3 --- /dev/null +++ b/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +rayPayloadInNV float payload; + +void main() +{ + if (payload > 0.0) + { + ignoreIntersectionNV(); + } + else + { + terminateRayNV(); + } +} + diff --git a/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..b6c1876d --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..b6c1876d --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..eeccd3bb --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec2 payload; +hitAttributeEXT vec2 hit; + +void main() +{ + payload = hit; +} + diff --git a/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..a51e6b08 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo hit; + +void main() +{ + payload = hit; +} + diff --git a/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e4e0103d --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_HitKindEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..a013baa1 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e28af5d2 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceCustomIndexEXT); +} + diff --git a/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..0413e0d2 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceID); +} + diff --git a/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..237d4790 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..5739ac09 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..7922e1ef --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldEXT * vec4(payload, 1.0); +} + diff --git a/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..0bde7872 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInEXT Payload payload; + +void main() +{ + payload.a = vec4(10.0); +} + diff --git a/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..667c015e --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_PrimitiveID); +} + diff --git a/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..04b89549 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTminEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..05af948b --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} + diff --git a/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..68ba2baf --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..a5c6766e --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginEXT; +} + diff --git a/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk b/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..309ca4c6 --- /dev/null +++ b/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldToObjectEXT * vec4(payload, 1.0); +} + diff --git a/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk b/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk new file mode 100644 index 00000000..335f476d --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(push_constant, std430) uniform Registers +{ + uvec2 ptr; +} _19; + +layout(location = 0) rayPayloadEXT vec4 payload; + +void main() +{ + traceRayEXT(accelerationStructureEXT(_19.ptr), 1u, 255u, 0u, 0u, 0u, vec3(0.0), 0.0, vec3(0.0, 0.0, -1.0), 100.0, 0); +} + diff --git a/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk new file mode 100644 index 00000000..2cb00f26 --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT vec4 payload; +layout(location = 1) callableDataEXT float blend; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; + +void main() +{ + traceRayEXT(as, 1u, 255u, 0u, 0u, 0u, vec3(0.0), 0.0, vec3(0.0, 0.0, -1.0), 100.0, 0); + executeCallableEXT(0u, 1); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), payload + vec4(blend)); +} + diff --git a/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..1614c496 --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDEXT.xy), vec4(1.0)); +} + diff --git a/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..240e93da --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeEXT.xy) - ivec2(1), vec4(1.0)); +} + diff --git a/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..434eadf2 --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,31 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + float a; + float b; +}; + +struct Block +{ + float a; + float b; + Payload c; + Payload d; +}; + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT Payload payload2; +layout(location = 1) rayPayloadEXT float payload1; +layout(location = 2) rayPayloadEXT Block _71; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 1); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 2); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), (vec4(payload1) + (vec4(payload2.a) + vec4(payload2.b))) + vec4(((((_71.a + _71.b) + _71.c.a) + _71.c.b) + _71.d.a) + _71.d.b)); +} + diff --git a/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..25b8f287 --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + vec2 _57 = vec2(gl_LaunchIDEXT.xy); + vec2 _61 = vec2(gl_LaunchSizeEXT.xy); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(_57.x / _61.x, _57.y / _61.y, 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); +} + diff --git a/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..d8814465 --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); + vec4 _68 = vec4(0.0, 0.0, 0.0, 1.0); + _68.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), _68); +} + diff --git a/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk b/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..3056e8ad --- /dev/null +++ b/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(shaderRecordEXT, std430) buffer sbt +{ + vec3 direction; + float tmax; +} _20; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0); +} + diff --git a/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk b/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk new file mode 100644 index 00000000..f9eb7335 --- /dev/null +++ b/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk @@ -0,0 +1,8 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +void main() +{ + bool _16 = reportIntersectionEXT(0.5, 10u); +} + diff --git a/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk b/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk new file mode 100644 index 00000000..56873aff --- /dev/null +++ b/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk @@ -0,0 +1,8 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +void main() +{ + bool _16 = reportIntersectionNV(0.5, 10u); +} + diff --git a/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk b/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk new file mode 100644 index 00000000..c055a268 --- /dev/null +++ b/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 0.0; +} + diff --git a/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk b/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk new file mode 100644 index 00000000..37252f31 --- /dev/null +++ b/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk @@ -0,0 +1,22 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +rayPayloadInEXT float payload; + +void in_func() +{ + if (payload > 0.0) + { + ignoreIntersectionEXT; + } + else + { + terminateRayEXT; + } +} + +void main() +{ + in_func(); +} + diff --git a/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk b/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk new file mode 100644 index 00000000..cee09bc0 --- /dev/null +++ b/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk @@ -0,0 +1,22 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +rayPayloadInNV float payload; + +void in_func() +{ + if (payload > 0.0) + { + ignoreIntersectionNV(); + } + else + { + terminateRayNV(); + } +} + +void main() +{ + in_func(); +} + diff --git a/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..b6c1876d --- /dev/null +++ b/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..56e8ff4a --- /dev/null +++ b/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void in_function() +{ + payload.a = hit.a; + payload.b = hit.b; +} + +void main() +{ + in_function(); +} + diff --git a/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..eeccd3bb --- /dev/null +++ b/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec2 payload; +hitAttributeEXT vec2 hit; + +void main() +{ + payload = hit; +} + diff --git a/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..a51e6b08 --- /dev/null +++ b/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo hit; + +void main() +{ + payload = hit; +} + diff --git a/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e4e0103d --- /dev/null +++ b/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_HitKindEXT; +} + diff --git a/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..a013baa1 --- /dev/null +++ b/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsEXT; +} + diff --git a/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e28af5d2 --- /dev/null +++ b/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceCustomIndexEXT); +} + diff --git a/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..0413e0d2 --- /dev/null +++ b/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceID); +} + diff --git a/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..237d4790 --- /dev/null +++ b/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionEXT; +} + diff --git a/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..5739ac09 --- /dev/null +++ b/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginEXT; +} + diff --git a/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..7922e1ef --- /dev/null +++ b/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldEXT * vec4(payload, 1.0); +} + diff --git a/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e896816e --- /dev/null +++ b/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,20 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInEXT Payload payload; + +void write_incoming_payload_in_function() +{ + payload.a = vec4(10.0); +} + +void main() +{ + write_incoming_payload_in_function(); +} + diff --git a/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..667c015e --- /dev/null +++ b/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_PrimitiveID); +} + diff --git a/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..04b89549 --- /dev/null +++ b/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTminEXT; +} + diff --git a/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..05af948b --- /dev/null +++ b/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} + diff --git a/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..68ba2baf --- /dev/null +++ b/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionEXT; +} + diff --git a/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..a5c6766e --- /dev/null +++ b/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginEXT; +} + diff --git a/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk b/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 00000000..309ca4c6 --- /dev/null +++ b/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldToObjectEXT * vec4(payload, 1.0); +} + diff --git a/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk b/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk new file mode 100644 index 00000000..d131b0aa --- /dev/null +++ b/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(push_constant, std430) uniform Registers +{ + uvec2 ptr; +} _19; + +layout(location = 0) rayPayloadEXT vec4 payload; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(accelerationStructureEXT(_19.ptr), 1u, 255u, 0u, 0u, 0u, origin, 0.0, direction, 100.0, 0); +} + diff --git a/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk b/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk new file mode 100644 index 00000000..8bb3d007 --- /dev/null +++ b/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT vec4 payload; +layout(location = 1) callableDataEXT float blend; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 1u, 255u, 0u, 0u, 0u, origin, 0.0, direction, 100.0, 0); + executeCallableEXT(0u, 1); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), payload + vec4(blend)); +} + diff --git a/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk b/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..1614c496 --- /dev/null +++ b/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDEXT.xy), vec4(1.0)); +} + diff --git a/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk b/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..240e93da --- /dev/null +++ b/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeEXT.xy) - ivec2(1), vec4(1.0)); +} + diff --git a/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk b/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..7885f4f3 --- /dev/null +++ b/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,47 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + float a; + float b; +}; + +struct Block +{ + float a; + float b; + Payload c; + Payload d; +}; + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT Payload payload2; +layout(location = 1) rayPayloadEXT float payload1; +layout(location = 2) rayPayloadEXT Block _71; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +vec4 trace_in_function() +{ + vec4 result = vec4(0.0); + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + result += vec4(payload2.a); + result += vec4(payload2.b); + return result; +} + +void main() +{ + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 1); + vec4 result = vec4(payload1); + vec4 _62 = trace_in_function(); + result += _62; + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 2); + result += vec4(((((_71.a + _71.b) + _71.c.a) + _71.c.b) + _71.d.a) + _71.d.b); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), result); +} + diff --git a/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk b/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..71e04d67 --- /dev/null +++ b/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,21 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +float pure_call(vec2 launchID, vec2 launchSize) +{ + vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + return 0.0; +} + +void main() +{ + vec2 param = vec2(gl_LaunchIDEXT.xy); + vec2 param_1 = vec2(gl_LaunchSizeEXT.xy); + float _64 = pure_call(param, param_1); +} + diff --git a/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk b/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..67deac22 --- /dev/null +++ b/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), col); +} + diff --git a/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk b/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 00000000..3056e8ad --- /dev/null +++ b/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(shaderRecordEXT, std430) buffer sbt +{ + vec3 direction; + float tmax; +} _20; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0); +} + diff --git a/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk b/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk new file mode 100644 index 00000000..761609a8 --- /dev/null +++ b/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +void in_func() +{ + bool _13 = reportIntersectionEXT(0.5, 10u); +} + +void main() +{ + in_func(); +} + diff --git a/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk b/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk new file mode 100644 index 00000000..c99b7849 --- /dev/null +++ b/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +void in_func() +{ + bool _13 = reportIntersectionNV(0.5, 10u); +} + +void main() +{ + in_func(); +} + diff --git a/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk b/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk new file mode 100644 index 00000000..c055a268 --- /dev/null +++ b/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 0.0; +} + diff --git a/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit b/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit new file mode 100644 index 00000000..dab43778 --- /dev/null +++ b/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +rayPayloadInEXT float payload; + +void in_func() +{ + if (payload > 0.0) + ignoreIntersectionEXT; + else + terminateRayEXT; +} + +void main() +{ + in_func(); +} diff --git a/shaders/vulkan/rahit/terminators.nocompat.vk.rahit b/shaders/vulkan/rahit/terminators.nocompat.vk.rahit new file mode 100644 index 00000000..943be33c --- /dev/null +++ b/shaders/vulkan/rahit/terminators.nocompat.vk.rahit @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +rayPayloadInNV float payload; + +void in_func() +{ + if (payload > 0.0) + ignoreIntersectionNV(); + else + terminateRayNV(); +} + +void main() +{ + in_func(); +} diff --git a/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..fd82f5bf --- /dev/null +++ b/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT Foo { float a; float b; } payload; +hitAttributeEXT Foo2 { float a; float b; } hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} diff --git a/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..7b8d53dd --- /dev/null +++ b/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT Foo { float a; float b; } payload; +hitAttributeEXT Foo2 { float a; float b; } hit; + +void in_function() +{ + payload.a = hit.a; + payload.b = hit.b; +} + +void main() +{ + in_function(); +} diff --git a/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..14568773 --- /dev/null +++ b/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec2 payload; +hitAttributeEXT vec2 hit; + +void main() +{ + payload = hit; +} diff --git a/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..f391f1eb --- /dev/null +++ b/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo { float a; float b; }; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo hit; + +void main() +{ + payload = hit; +} diff --git a/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..1bf15000 --- /dev/null +++ b/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_HitKindEXT; +} diff --git a/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..5b4fc4dd --- /dev/null +++ b/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_HitTEXT; +} diff --git a/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..2c286465 --- /dev/null +++ b/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsEXT; +} diff --git a/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..330dfceb --- /dev/null +++ b/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_InstanceCustomIndexEXT; +} diff --git a/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..23d1e02c --- /dev/null +++ b/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_InstanceID; +} diff --git a/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..4d45134c --- /dev/null +++ b/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionEXT; +} diff --git a/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..0964b7b5 --- /dev/null +++ b/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginEXT; +} diff --git a/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..4377443c --- /dev/null +++ b/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldEXT * vec4(payload, 1.0); +} diff --git a/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..12ed5a7d --- /dev/null +++ b/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,19 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInEXT Payload payload; + +void write_incoming_payload_in_function() +{ + payload.a = vec4(10.0); +} + +void main() +{ + write_incoming_payload_in_function(); +} diff --git a/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..f3798c1f --- /dev/null +++ b/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_PrimitiveID; +} diff --git a/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..2f688baf --- /dev/null +++ b/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} diff --git a/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..3f8ddf05 --- /dev/null +++ b/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTminEXT; +} diff --git a/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..d48995b8 --- /dev/null +++ b/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} diff --git a/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..191905a3 --- /dev/null +++ b/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionEXT; +} diff --git a/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..2c86a723 --- /dev/null +++ b/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginEXT; +} diff --git a/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit b/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit new file mode 100644 index 00000000..eb64bd0b --- /dev/null +++ b/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldToObjectEXT * vec4(payload, 1.0); +} diff --git a/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen b/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen new file mode 100644 index 00000000..8d6f1f4a --- /dev/null +++ b/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 3) rayPayloadEXT vec4 payload; + +layout(push_constant) uniform Registers +{ + uvec2 ptr; +}; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(accelerationStructureEXT(ptr), gl_RayFlagsOpaqueEXT, 0xFF, 0u, 0u, 0u, origin, 0.0, direction, 100.0f, 3); +} diff --git a/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen b/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen new file mode 100644 index 00000000..9a4380e0 --- /dev/null +++ b/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; +layout(location = 3) rayPayloadEXT vec4 payload; +layout(location = 4) callableDataEXT float blend; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, gl_RayFlagsOpaqueEXT, 0xFF, 0u, 0u, 0u, origin, 0.0, direction, 100.0f, 3); + executeCallableEXT(0u, 4); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), payload + vec4(blend)); +} diff --git a/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen b/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen new file mode 100644 index 00000000..6f9983e9 --- /dev/null +++ b/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDEXT.xy), vec4(1.0)); +} diff --git a/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen b/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen new file mode 100644 index 00000000..955f57dc --- /dev/null +++ b/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeEXT.xy) - 1, vec4(1.0)); +} diff --git a/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen b/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen new file mode 100644 index 00000000..b73a2463 --- /dev/null +++ b/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,49 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; + +struct Payload +{ + float a, b; +}; + +// Plain payload +layout(location = 0) rayPayloadEXT float payload1; +// Struct payload +layout(location = 1) rayPayloadEXT Payload payload2; + +// This is syntactic sugar with the struct formulation (pretty sure), spec is kinda vague. +layout(location = 2) rayPayloadEXT Block +{ + float a, b; + Payload c, d; +}; + +vec4 trace_in_function() +{ + vec4 result = vec4(0.0); + // Test that we can write to a payload in a function. + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 1); + result += payload2.a; + result += payload2.b; + return result; +} + +void main() +{ + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + vec4 result = vec4(payload1); + + result += trace_in_function(); + + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 2); + result += a + b + c.a + c.b + d.a + d.b; + + imageStore(image, ivec2(gl_LaunchIDEXT.xy), result); +} diff --git a/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen b/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen new file mode 100644 index 00000000..6763f553 --- /dev/null +++ b/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,18 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +float pure_call(vec2 launchID, vec2 launchSize) +{ + vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + return 0.0; +} + +void main() +{ + pure_call(vec2(gl_LaunchIDEXT.xy), vec2(gl_LaunchSizeEXT.xy)); +} diff --git a/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen b/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen new file mode 100644 index 00000000..40f16489 --- /dev/null +++ b/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), col); +} diff --git a/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen b/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen new file mode 100644 index 00000000..39c9bf27 --- /dev/null +++ b/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(shaderRecordEXT, std430) buffer sbt +{ + vec3 direction; + float tmax; +}; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, direction, tmax, 0); +} diff --git a/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint b/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint new file mode 100644 index 00000000..b930e5c6 --- /dev/null +++ b/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +void in_func() +{ + reportIntersectionEXT(0.5, 10); +} + +void main() +{ + in_func(); +} diff --git a/shaders/vulkan/rint/report-intersection.nocompat.vk.rint b/shaders/vulkan/rint/report-intersection.nocompat.vk.rint new file mode 100644 index 00000000..ee384fc8 --- /dev/null +++ b/shaders/vulkan/rint/report-intersection.nocompat.vk.rint @@ -0,0 +1,12 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +void in_func() +{ + reportIntersectionNV(0.5, 10); +} + +void main() +{ + in_func(); +} diff --git a/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss b/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss new file mode 100644 index 00000000..ee873cb9 --- /dev/null +++ b/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 0.0; +} diff --git a/spirv_common.hpp b/spirv_common.hpp index ecb84077..8e3b1373 100644 --- a/spirv_common.hpp +++ b/spirv_common.hpp @@ -729,7 +729,9 @@ struct SPIRBlock : IVariant Return, // Block ends with return. Unreachable, // Noop - Kill // Discard + Kill, // Discard + IgnoreIntersection, // Ray Tracing + TerminateRay // Ray Tracing }; enum Merge diff --git a/spirv_cross.cpp b/spirv_cross.cpp index 5fd78769..d814cd64 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -96,7 +96,9 @@ bool Compiler::variable_storage_is_aliased(const SPIRVariable &v) bool Compiler::block_is_pure(const SPIRBlock &block) { // This is a global side effect of the function. - if (block.terminator == SPIRBlock::Kill) + if (block.terminator == SPIRBlock::Kill || + block.terminator == SPIRBlock::TerminateRay || + block.terminator == SPIRBlock::IgnoreIntersection) return false; for (auto &i : block.ops) @@ -158,11 +160,13 @@ bool Compiler::block_is_pure(const SPIRBlock &block) return false; // Ray tracing builtins are impure. - case OpReportIntersectionNV: + case OpReportIntersectionKHR: case OpIgnoreIntersectionNV: case OpTerminateRayNV: case OpTraceNV: + case OpTraceRayKHR: case OpExecuteCallableNV: + case OpExecuteCallableKHR: return false; // OpExtInst is potentially impure depending on extension, but GLSL builtins are at least pure. @@ -2287,16 +2291,22 @@ SPIREntryPoint &Compiler::get_entry_point() bool Compiler::interface_variable_exists_in_entry_point(uint32_t id) const { auto &var = get(id); - if (var.storage != StorageClassInput && var.storage != StorageClassOutput && - var.storage != StorageClassUniformConstant) - SPIRV_CROSS_THROW("Only Input, Output variables and Uniform constants are part of a shader linking interface."); - // This is to avoid potential problems with very old glslang versions which did - // not emit input/output interfaces properly. - // We can assume they only had a single entry point, and single entry point - // shaders could easily be assumed to use every interface variable anyways. - if (ir.entry_points.size() <= 1) - return true; + if (ir.get_spirv_version() < 0x10400) + { + if (var.storage != StorageClassInput && var.storage != StorageClassOutput && + var.storage != StorageClassUniformConstant) + SPIRV_CROSS_THROW("Only Input, Output variables and Uniform constants are part of a shader linking interface."); + + // This is to avoid potential problems with very old glslang versions which did + // not emit input/output interfaces properly. + // We can assume they only had a single entry point, and single entry point + // shaders could easily be assumed to use every interface variable anyways. + if (ir.entry_points.size() <= 1) + return true; + } + + // In SPIR-V 1.4 and later, all global resource variables must be present. auto &execution = get_entry_point(); return find(begin(execution.interface_variables), end(execution.interface_variables), VariableID(id)) != diff --git a/spirv_cross_parsed_ir.cpp b/spirv_cross_parsed_ir.cpp index ff1b63fb..a9ade42b 100644 --- a/spirv_cross_parsed_ir.cpp +++ b/spirv_cross_parsed_ir.cpp @@ -235,6 +235,11 @@ bool ParsedIR::is_globally_reserved_identifier(std::string &str, bool allow_rese return is_reserved_identifier(str, false, allow_reserved_prefixes); } +uint32_t ParsedIR::get_spirv_version() const +{ + return spirv[1]; +} + static string make_unreserved_identifier(const string &name) { if (is_reserved_prefix(name)) diff --git a/spirv_cross_parsed_ir.hpp b/spirv_cross_parsed_ir.hpp index ee202d2f..ca37a9bc 100644 --- a/spirv_cross_parsed_ir.hpp +++ b/spirv_cross_parsed_ir.hpp @@ -222,6 +222,8 @@ public: static void sanitize_identifier(std::string &str, bool member, bool allow_reserved_prefixes); static bool is_globally_reserved_identifier(std::string &str, bool allow_reserved_prefixes); + uint32_t get_spirv_version() const; + private: template T &get(uint32_t id) diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index ab479410..7a740711 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -427,15 +427,37 @@ void CompilerGLSL::find_static_extensions() require_extension_internal("GL_ARB_tessellation_shader"); break; - case ExecutionModelRayGenerationNV: - case ExecutionModelIntersectionNV: - case ExecutionModelAnyHitNV: - case ExecutionModelClosestHitNV: - case ExecutionModelMissNV: - case ExecutionModelCallableNV: + case ExecutionModelRayGenerationKHR: + case ExecutionModelIntersectionKHR: + case ExecutionModelAnyHitKHR: + case ExecutionModelClosestHitKHR: + case ExecutionModelMissKHR: + case ExecutionModelCallableKHR: + // NV enums are aliases. if (options.es || options.version < 460) SPIRV_CROSS_THROW("Ray tracing shaders require non-es profile with version 460 or above."); - require_extension_internal("GL_NV_ray_tracing"); + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Ray tracing requires Vulkan semantics."); + + // Need to figure out if we should target KHR or NV extension based on capabilities. + for (auto &cap : ir.declared_capabilities) + { + if (cap == CapabilityRayTracingKHR || cap == CapabilityRayQueryKHR) + { + ray_tracing_is_khr = true; + break; + } + } + + if (ray_tracing_is_khr) + { + // In KHR ray tracing we pass payloads by pointer instead of location, + // so make sure we assign locations properly. + ray_tracing_khr_fixup_locations(); + require_extension_internal("GL_EXT_ray_tracing"); + } + else + require_extension_internal("GL_NV_ray_tracing"); break; default: @@ -512,6 +534,18 @@ void CompilerGLSL::find_static_extensions() } } +void CompilerGLSL::ray_tracing_khr_fixup_locations() +{ + uint32_t location = 0; + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + if (var.storage != StorageClassRayPayloadKHR && var.storage != StorageClassCallableDataKHR) + return; + if (!interface_variable_exists_in_entry_point(var.self)) + return; + set_decoration(var.self, DecorationLocation, location++); + }); +} + string CompilerGLSL::compile() { ir.fixup_reserved_names(); @@ -1620,8 +1654,8 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var) if (options.vulkan_semantics && var.storage == StorageClassPushConstant) attr.push_back("push_constant"); - else if (var.storage == StorageClassShaderRecordBufferNV) - attr.push_back("shaderRecordNV"); + else if (var.storage == StorageClassShaderRecordBufferKHR) + attr.push_back(ray_tracing_is_khr ? "shaderRecordEXT" : "shaderRecordNV"); if (flags.get(DecorationRowMajor)) attr.push_back("row_major"); @@ -1777,14 +1811,14 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var) // Do not emit set = decoration in regular GLSL output, but // we need to preserve it in Vulkan GLSL mode. - if (var.storage != StorageClassPushConstant && var.storage != StorageClassShaderRecordBufferNV) + if (var.storage != StorageClassPushConstant && var.storage != StorageClassShaderRecordBufferKHR) { if (flags.get(DecorationDescriptorSet) && options.vulkan_semantics) attr.push_back(join("set = ", get_decoration(var.self, DecorationDescriptorSet))); } bool push_constant_block = options.vulkan_semantics && var.storage == StorageClassPushConstant; - bool ssbo_block = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferNV || + bool ssbo_block = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferKHR || (var.storage == StorageClassUniform && typeflags.get(DecorationBufferBlock)); bool emulated_ubo = var.storage == StorageClassPushConstant && options.emit_push_constant_as_uniform_buffer; bool ubo_block = var.storage == StorageClassUniform && typeflags.get(DecorationBlock); @@ -1806,7 +1840,7 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var) if (!can_use_buffer_blocks && var.storage == StorageClassUniform) can_use_binding = false; - if (var.storage == StorageClassShaderRecordBufferNV) + if (var.storage == StorageClassShaderRecordBufferKHR) can_use_binding = false; if (can_use_binding && flags.get(DecorationBinding)) @@ -2086,7 +2120,7 @@ void CompilerGLSL::emit_buffer_block_native(const SPIRVariable &var) auto &type = get(var.basetype); Bitset flags = ir.get_buffer_block_flags(var); - bool ssbo = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferNV || + bool ssbo = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferKHR || ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock); bool is_restrict = ssbo && flags.get(DecorationRestrict); bool is_writeonly = ssbo && flags.get(DecorationNonReadable); @@ -2201,25 +2235,25 @@ const char *CompilerGLSL::to_storage_qualifiers_glsl(const SPIRVariable &var) { return "uniform "; } - else if (var.storage == StorageClassRayPayloadNV) + else if (var.storage == StorageClassRayPayloadKHR) { - return "rayPayloadNV "; + return ray_tracing_is_khr ? "rayPayloadEXT " : "rayPayloadNV "; } - else if (var.storage == StorageClassIncomingRayPayloadNV) + else if (var.storage == StorageClassIncomingRayPayloadKHR) { - return "rayPayloadInNV "; + return ray_tracing_is_khr ? "rayPayloadInEXT " : "rayPayloadInNV "; } - else if (var.storage == StorageClassHitAttributeNV) + else if (var.storage == StorageClassHitAttributeKHR) { - return "hitAttributeNV "; + return ray_tracing_is_khr ? "hitAttributeEXT " : "hitAttributeNV "; } - else if (var.storage == StorageClassCallableDataNV) + else if (var.storage == StorageClassCallableDataKHR) { - return "callableDataNV "; + return ray_tracing_is_khr ? "callableDataEXT " : "callableDataNV "; } - else if (var.storage == StorageClassIncomingCallableDataNV) + else if (var.storage == StorageClassIncomingCallableDataKHR) { - return "callableDataInNV "; + return ray_tracing_is_khr ? "callableDataInEXT " : "callableDataInNV "; } return ""; @@ -3218,8 +3252,8 @@ void CompilerGLSL::emit_resources() // Special case, ray payload and hit attribute blocks are not really blocks, just regular structs. if (type->basetype == SPIRType::Struct && type->pointer && has_decoration(type->self, DecorationBlock) && - (type->storage == StorageClassRayPayloadNV || type->storage == StorageClassIncomingRayPayloadNV || - type->storage == StorageClassHitAttributeNV)) + (type->storage == StorageClassRayPayloadKHR || type->storage == StorageClassIncomingRayPayloadKHR || + type->storage == StorageClassHitAttributeKHR)) { type = &get(type->parent_type); is_natural_struct = true; @@ -3295,7 +3329,7 @@ void CompilerGLSL::emit_resources() auto &type = this->get(var.basetype); bool is_block_storage = type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform || - type.storage == StorageClassShaderRecordBufferNV; + type.storage == StorageClassShaderRecordBufferKHR; bool has_block_flags = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) || ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock); @@ -3335,9 +3369,9 @@ void CompilerGLSL::emit_resources() if (var.storage != StorageClassFunction && type.pointer && (type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter || - type.storage == StorageClassRayPayloadNV || type.storage == StorageClassIncomingRayPayloadNV || - type.storage == StorageClassCallableDataNV || type.storage == StorageClassIncomingCallableDataNV || - type.storage == StorageClassHitAttributeNV) && + type.storage == StorageClassRayPayloadKHR || type.storage == StorageClassIncomingRayPayloadKHR || + type.storage == StorageClassCallableDataKHR || type.storage == StorageClassIncomingCallableDataKHR || + type.storage == StorageClassHitAttributeKHR) && !is_hidden_variable(var)) { emit_uniform(var); @@ -8138,34 +8172,35 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMask); return "gl_SubgroupLtMask"; - case BuiltInLaunchIdNV: - return "gl_LaunchIDNV"; - case BuiltInLaunchSizeNV: - return "gl_LaunchSizeNV"; - case BuiltInWorldRayOriginNV: - return "gl_WorldRayOriginNV"; - case BuiltInWorldRayDirectionNV: - return "gl_WorldRayDirectionNV"; - case BuiltInObjectRayOriginNV: - return "gl_ObjectRayOriginNV"; - case BuiltInObjectRayDirectionNV: - return "gl_ObjectRayDirectionNV"; - case BuiltInRayTminNV: - return "gl_RayTminNV"; - case BuiltInRayTmaxNV: - return "gl_RayTmaxNV"; - case BuiltInInstanceCustomIndexNV: - return "gl_InstanceCustomIndexNV"; - case BuiltInObjectToWorldNV: - return "gl_ObjectToWorldNV"; - case BuiltInWorldToObjectNV: - return "gl_WorldToObjectNV"; + case BuiltInLaunchIdKHR: + return ray_tracing_is_khr ? "gl_LaunchIDEXT" : "gl_LaunchIDNV"; + case BuiltInLaunchSizeKHR: + return ray_tracing_is_khr ? "gl_LaunchSizeEXT" : "gl_LaunchSizeNV"; + case BuiltInWorldRayOriginKHR: + return ray_tracing_is_khr ? "gl_WorldRayOriginEXT" : "gl_WorldRayOriginNV"; + case BuiltInWorldRayDirectionKHR: + return ray_tracing_is_khr ? "gl_WorldRayDirectionEXT" : "gl_WorldRayDirectionNV"; + case BuiltInObjectRayOriginKHR: + return ray_tracing_is_khr ? "gl_ObjectRayOriginEXT" : "gl_ObjectRayOriginNV"; + case BuiltInObjectRayDirectionKHR: + return ray_tracing_is_khr ? "gl_ObjectRayDirectionEXT" : "gl_ObjectRayDirectionNV"; + case BuiltInRayTminKHR: + return ray_tracing_is_khr ? "gl_RayTminEXT" : "gl_RayTminNV"; + case BuiltInRayTmaxKHR: + return ray_tracing_is_khr ? "gl_RayTmaxEXT" : "gl_RayTmaxNV"; + case BuiltInInstanceCustomIndexKHR: + return ray_tracing_is_khr ? "gl_InstanceCustomIndexEXT" : "gl_InstanceCustomIndexNV"; + case BuiltInObjectToWorldKHR: + return ray_tracing_is_khr ? "gl_ObjectToWorldEXT" : "gl_ObjectToWorldNV"; + case BuiltInWorldToObjectKHR: + return ray_tracing_is_khr ? "gl_WorldToObjectEXT" : "gl_WorldToObjectNV"; case BuiltInHitTNV: + // gl_HitTEXT is an alias of RayTMax in KHR. return "gl_HitTNV"; - case BuiltInHitKindNV: - return "gl_HitKindNV"; - case BuiltInIncomingRayFlagsNV: - return "gl_IncomingRayFlagsNV"; + case BuiltInHitKindKHR: + return ray_tracing_is_khr ? "gl_HitKindEXT" : "gl_HitKindNV"; + case BuiltInIncomingRayFlagsKHR: + return ray_tracing_is_khr ? "gl_IncomingRayFlagsEXT" : "gl_IncomingRayFlagsNV"; case BuiltInBaryCoordNV: { @@ -12161,34 +12196,55 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) break; } - case OpReportIntersectionNV: - // KHR is same opcode. - statement("reportIntersectionNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ");"); + case OpReportIntersectionKHR: + // NV is same opcode. + forced_temporaries.insert(ops[1]); + if (ray_tracing_is_khr) + GLSL_BFOP(reportIntersectionEXT); + else + GLSL_BFOP(reportIntersectionNV); flush_control_dependent_expressions(current_emitting_block->self); break; case OpIgnoreIntersectionNV: - case OpIgnoreIntersectionKHR: + // KHR variant is a terminator. statement("ignoreIntersectionNV();"); flush_control_dependent_expressions(current_emitting_block->self); break; case OpTerminateRayNV: - case OpTerminateRayKHR: + // KHR variant is a terminator. statement("terminateRayNV();"); flush_control_dependent_expressions(current_emitting_block->self); break; case OpTraceNV: - case OpTraceRayKHR: statement("traceNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ", ", to_expression(ops[2]), ", ", to_expression(ops[3]), ", ", to_expression(ops[4]), ", ", to_expression(ops[5]), ", ", to_expression(ops[6]), ", ", to_expression(ops[7]), ", ", to_expression(ops[8]), ", ", to_expression(ops[9]), ", ", to_expression(ops[10]), ");"); flush_control_dependent_expressions(current_emitting_block->self); break; + case OpTraceRayKHR: + if (!has_decoration(ops[10], DecorationLocation)) + SPIRV_CROSS_THROW("A memory declaration object must be used in TraceRayKHR."); + statement("traceRayEXT(", to_expression(ops[0]), ", ", to_expression(ops[1]), ", ", to_expression(ops[2]), ", ", + to_expression(ops[3]), ", ", to_expression(ops[4]), ", ", to_expression(ops[5]), ", ", + to_expression(ops[6]), ", ", to_expression(ops[7]), ", ", to_expression(ops[8]), ", ", + to_expression(ops[9]), ", ", get_decoration(ops[10], DecorationLocation), ");"); + flush_control_dependent_expressions(current_emitting_block->self); + break; case OpExecuteCallableNV: - case OpExecuteCallableKHR: statement("executeCallableNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ");"); flush_control_dependent_expressions(current_emitting_block->self); break; + case OpExecuteCallableKHR: + if (!has_decoration(ops[1], DecorationLocation)) + SPIRV_CROSS_THROW("A memory declaration object must be used in ExecuteCallableKHR."); + statement("executeCallableEXT(", to_expression(ops[0]), ", ", get_decoration(ops[1], DecorationLocation), ");"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + + case OpConvertUToAccelerationStructureKHR: + GLSL_UFOP(accelerationStructureEXT); + break; case OpConvertUToPtr: { @@ -12983,7 +13039,7 @@ string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) return comparison_ids.count(id) ? "samplerShadow" : "sampler"; case SPIRType::AccelerationStructure: - return "accelerationStructureNV"; + return ray_tracing_is_khr ? "accelerationStructureEXT" : "accelerationStructureNV"; case SPIRType::Void: return "void"; @@ -14622,6 +14678,14 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) emit_next_block = false; break; + case SPIRBlock::IgnoreIntersection: + statement("ignoreIntersectionEXT;"); + break; + + case SPIRBlock::TerminateRay: + statement("terminateRayEXT;"); + break; + default: SPIRV_CROSS_THROW("Unimplemented block terminator."); } diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp index df0f3d3b..a32edc0a 100644 --- a/spirv_glsl.hpp +++ b/spirv_glsl.hpp @@ -817,6 +817,8 @@ protected: bool requires_transpose_2x2 = false; bool requires_transpose_3x3 = false; bool requires_transpose_4x4 = false; + bool ray_tracing_is_khr = false; + void ray_tracing_khr_fixup_locations(); bool args_will_forward(uint32_t id, const uint32_t *args, uint32_t num_args, bool pure); void register_call_out_argument(uint32_t id); diff --git a/spirv_parser.cpp b/spirv_parser.cpp index f1133852..eff50dd3 100644 --- a/spirv_parser.cpp +++ b/spirv_parser.cpp @@ -992,6 +992,22 @@ void Parser::parse(const Instruction &instruction) break; } + case OpTerminateRayKHR: + // NV variant is not a terminator. + if (!current_block) + SPIRV_CROSS_THROW("Trying to end a non-existing block."); + current_block->terminator = SPIRBlock::TerminateRay; + current_block = nullptr; + break; + + case OpIgnoreIntersectionKHR: + // NV variant is not a terminator. + if (!current_block) + SPIRV_CROSS_THROW("Trying to end a non-existing block."); + current_block->terminator = SPIRBlock::IgnoreIntersection; + current_block = nullptr; + break; + case OpReturn: { if (!current_block) diff --git a/test_shaders.py b/test_shaders.py index 3811781b..b302bc9e 100755 --- a/test_shaders.py +++ b/test_shaders.py @@ -476,7 +476,9 @@ def cross_compile_reflect(shader, spirv, opt, iterations, paths): def validate_shader(shader, vulkan, paths): if vulkan: - subprocess.check_call([paths.glslang, '--amb', '--target-env', 'vulkan1.1', '-V', shader]) + spirv_14 = '.spv14.' in shader + glslang_env = 'spirv1.4' if spirv_14 else 'vulkan1.1' + subprocess.check_call([paths.glslang, '--amb', '--target-env', glslang_env, '-V', shader]) else: subprocess.check_call([paths.glslang, shader]) @@ -484,7 +486,8 @@ def cross_compile(shader, vulkan, spirv, invalid_spirv, eliminate, is_legacy, fl spirv_path = create_temporary() glsl_path = create_temporary(os.path.basename(shader)) - spirv_env = 'vulkan1.1spv1.4' if ('.spv14.' in shader) else 'vulkan1.1' + spirv_14 = '.spv14.' in shader + spirv_env = 'vulkan1.1spv1.4' if spirv_14 else 'vulkan1.1' if vulkan or spirv: vulkan_glsl_path = create_temporary('vk' + os.path.basename(shader)) @@ -496,7 +499,8 @@ def cross_compile(shader, vulkan, spirv, invalid_spirv, eliminate, is_legacy, fl if spirv: subprocess.check_call(spirv_cmd) else: - subprocess.check_call([paths.glslang, '--amb', '--target-env', 'vulkan1.1', '-V', '-o', spirv_path, shader]) + glslang_env = 'spirv1.4' if spirv_14 else 'vulkan1.1' + subprocess.check_call([paths.glslang, '--amb', '--target-env', glslang_env, '-V', '-o', spirv_path, shader]) if opt and (not invalid_spirv): subprocess.check_call([paths.spirv_opt, '--skip-validation', '-O', '-o', spirv_path, spirv_path])