Merge pull request #1590 from KhronosGroup/fix-1584

Update ray-tracing support to include SPV_KHR_ray_tracing
This commit is contained in:
Hans-Kristian Arntzen 2021-01-09 22:28:19 +01:00 committed by GitHub
commit 820179bf46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
107 changed files with 1516 additions and 78 deletions

View File

@ -0,0 +1,17 @@
#version 460
#extension GL_EXT_ray_tracing : require
rayPayloadInEXT float payload;
void main()
{
if (payload > 0.0)
{
ignoreIntersectionEXT;
}
else
{
terminateRayEXT;
}
}

View File

@ -0,0 +1,17 @@
#version 460
#extension GL_NV_ray_tracing : require
rayPayloadInNV float payload;
void main()
{
if (payload > 0.0)
{
ignoreIntersectionNV();
}
else
{
terminateRayNV();
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_HitKindEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTmaxEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_IncomingRayFlagsEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = uint(gl_InstanceCustomIndexEXT);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = uint(gl_InstanceID);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_ObjectRayDirectionEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_ObjectRayOriginEXT;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = uint(gl_PrimitiveID);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTmaxEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTminEXT;
}

View File

@ -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);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_WorldRayDirectionEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_WorldRayOriginEXT;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -0,0 +1,8 @@
#version 460
#extension GL_EXT_ray_tracing : require
void main()
{
bool _16 = reportIntersectionEXT(0.5, 10u);
}

View File

@ -0,0 +1,8 @@
#version 460
#extension GL_NV_ray_tracing : require
void main()
{
bool _16 = reportIntersectionNV(0.5, 10u);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = 0.0;
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_HitKindEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTmaxEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_IncomingRayFlagsEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = uint(gl_InstanceCustomIndexEXT);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = uint(gl_InstanceID);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_ObjectRayDirectionEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_ObjectRayOriginEXT;
}

View File

@ -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);
}

View File

@ -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();
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = uint(gl_PrimitiveID);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTmaxEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTminEXT;
}

View File

@ -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);
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_WorldRayDirectionEXT;
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_WorldRayOriginEXT;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -0,0 +1,10 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = 0.0;
}

View 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();
}

View 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();
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_HitKindEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_HitTEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_IncomingRayFlagsEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_InstanceCustomIndexEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_InstanceID;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_ObjectRayDirectionEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_ObjectRayOriginEXT;
}

View File

@ -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);
}

View 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();
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT uint payload;
void main()
{
payload = gl_PrimitiveID;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTmaxEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = gl_RayTminEXT;
}

View File

@ -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);
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_WorldRayDirectionEXT;
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT vec3 payload;
void main()
{
payload = gl_WorldRayOriginEXT;
}

View File

@ -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);
}

View 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);
}

View File

@ -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));
}

View 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));
}

View 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_LaunchSizeEXT.xy) - 1, vec4(1.0));
}

View 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);
}

View 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));
}

View 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);
}

View File

@ -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);
}

View File

@ -0,0 +1,12 @@
#version 460
#extension GL_EXT_ray_tracing : require
void in_func()
{
reportIntersectionEXT(0.5, 10);
}
void main()
{
in_func();
}

View File

@ -0,0 +1,12 @@
#version 460
#extension GL_NV_ray_tracing : require
void in_func()
{
reportIntersectionNV(0.5, 10);
}
void main()
{
in_func();
}

View File

@ -0,0 +1,9 @@
#version 460
#extension GL_EXT_ray_tracing : require
layout(location = 0) rayPayloadInEXT float payload;
void main()
{
payload = 0.0;
}

View File

@ -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