mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 22:00:05 +00:00
GLSL: Support both SPV_KHR_ray_tracing and NV_ray_tracing.
Fairly minor differences, so can keep them side by side without too much effort. NV support is effectively deprecated now however. - Add OpConvertUToAccelerationStructureKHR - Ignore/Terminate ray is now a terminator in KHR, but a call in NV. - Fix some bugs with reportIntersection.
This commit is contained in:
parent
702c903f98
commit
2097c30985
@ -0,0 +1,17 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (payload > 0.0)
|
||||
{
|
||||
ignoreIntersectionEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
terminateRayEXT;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
rayPayloadInNV float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (payload > 0.0)
|
||||
{
|
||||
ignoreIntersectionNV();
|
||||
}
|
||||
else
|
||||
{
|
||||
terminateRayNV();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_HitKindEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTmaxEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_IncomingRayFlagsEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = uint(gl_InstanceCustomIndexEXT);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = uint(gl_InstanceID);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_ObjectRayDirectionEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_ObjectRayOriginEXT;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = uint(gl_PrimitiveID);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTmaxEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTminEXT;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_WorldRayDirectionEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_WorldRayOriginEXT;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
void main()
|
||||
{
|
||||
bool _16 = reportIntersectionEXT(0.5, 10u);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
void main()
|
||||
{
|
||||
bool _16 = reportIntersectionNV(0.5, 10u);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 0.0;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_HitKindEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTmaxEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_IncomingRayFlagsEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = uint(gl_InstanceCustomIndexEXT);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = uint(gl_InstanceID);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_ObjectRayDirectionEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_ObjectRayOriginEXT;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = uint(gl_PrimitiveID);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTmaxEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTminEXT;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_WorldRayDirectionEXT;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_WorldRayOriginEXT;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 0.0;
|
||||
}
|
||||
|
17
shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit
Normal file
17
shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit
Normal file
@ -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();
|
||||
}
|
17
shaders/vulkan/rahit/terminators.nocompat.vk.rahit
Normal file
17
shaders/vulkan/rahit/terminators.nocompat.vk.rahit
Normal file
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_HitKindEXT;
|
||||
}
|
9
shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit
Normal file
9
shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit
Normal file
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_HitTEXT;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_IncomingRayFlagsEXT;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_InstanceCustomIndexEXT;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_InstanceID;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_ObjectRayDirectionEXT;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_ObjectRayOriginEXT;
|
||||
}
|
@ -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);
|
||||
}
|
19
shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit
Normal file
19
shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit
Normal file
@ -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();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT uint payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_PrimitiveID;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTmaxEXT;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_RayTminEXT;
|
||||
}
|
@ -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);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_WorldRayDirectionEXT;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT vec3 payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = gl_WorldRayOriginEXT;
|
||||
}
|
@ -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);
|
||||
}
|
16
shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen
Normal file
16
shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen
Normal file
@ -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);
|
||||
}
|
@ -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));
|
||||
}
|
9
shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen
Normal file
9
shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen
Normal file
@ -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));
|
||||
}
|
@ -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));
|
||||
}
|
49
shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen
Normal file
49
shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen
Normal file
@ -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);
|
||||
}
|
18
shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen
Normal file
18
shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen
Normal file
@ -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));
|
||||
}
|
16
shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen
Normal file
16
shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen
Normal file
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
void in_func()
|
||||
{
|
||||
reportIntersectionEXT(0.5, 10);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
in_func();
|
||||
}
|
12
shaders/vulkan/rint/report-intersection.nocompat.vk.rint
Normal file
12
shaders/vulkan/rint/report-intersection.nocompat.vk.rint
Normal file
@ -0,0 +1,12 @@
|
||||
#version 460
|
||||
#extension GL_NV_ray_tracing : require
|
||||
|
||||
void in_func()
|
||||
{
|
||||
reportIntersectionNV(0.5, 10);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
in_func();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
|
||||
layout(location = 0) rayPayloadInEXT float payload;
|
||||
|
||||
void main()
|
||||
{
|
||||
payload = 0.0;
|
||||
}
|
@ -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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user