diff options
Diffstat (limited to 'tests/vkray')
| -rw-r--r-- | tests/vkray/callable-caller.slang.glsl | 62 | ||||
| -rw-r--r-- | tests/vkray/intersection.slang.glsl | 72 | ||||
| -rw-r--r-- | tests/vkray/raygen.slang.glsl | 231 |
3 files changed, 104 insertions, 261 deletions
diff --git a/tests/vkray/callable-caller.slang.glsl b/tests/vkray/callable-caller.slang.glsl index b0d174381..91b788655 100644 --- a/tests/vkray/callable-caller.slang.glsl +++ b/tests/vkray/callable-caller.slang.glsl @@ -1,30 +1,18 @@ +//TEST_IGNORE_FILE: #version 460 - +#extension GL_NV_ray_tracing : require layout(row_major) uniform; layout(row_major) buffer; -#extension GL_NV_ray_tracing : require - -#define tmp_ubo _S1 -#define tmp_launchid _S2 -#define tmp_luanchidf _S3 -#define tmp_launchsize _S4 -#define tmp_launchpos _S5 -#define tmp_shaderidx _S6 -#define tmp_payload _S7 -#define tmp_launchid2 _S8 - struct SLANG_ParameterGroup_C_0 { uint shaderIndex_0; }; layout(binding = 0) -layout(std140) -uniform tmp_ubo +layout(std140) uniform _S1 { SLANG_ParameterGroup_C_0 _data; } C_0; - struct MaterialPayload_0 { vec4 albedo_0; @@ -32,15 +20,10 @@ struct MaterialPayload_0 }; layout(location = 0) -rayPayloadNV MaterialPayload_0 p_0; - -layout(rgba32f) -layout(binding = 1) -uniform image2D gImage_0; +rayPayloadNV +MaterialPayload_0 p_0; -void CallShader_0( - uint shaderIndex_1, - inout MaterialPayload_0 payload_0) +void CallShader_0(uint shaderIndex_1, inout MaterialPayload_0 payload_0) { p_0 = payload_0; executeCallableNV(shaderIndex_1, (0)); @@ -48,30 +31,21 @@ void CallShader_0( return; } +layout(rgba32f) +layout(binding = 1) +uniform image2D gImage_0; + void main() { MaterialPayload_0 payload_1; payload_1.albedo_0 = vec4(0); - - uvec3 tmp_launchid = gl_LaunchIDNV; - vec2 tmp_luanchidf = vec2(tmp_launchid.xy); - - uvec3 tmp_launchsize = gl_LaunchSizeNV; - vec2 tmp_launchpos = tmp_luanchidf / vec2(tmp_launchsize.xy); - - payload_1.uv_0 = tmp_launchpos; - - uint tmp_shaderidx = C_0._data.shaderIndex_0; - - MaterialPayload_0 tmp_payload; - tmp_payload = payload_1; - CallShader_0(tmp_shaderidx, tmp_payload); - payload_1 = tmp_payload; - - uvec3 tmp_launchid2 = gl_LaunchIDNV; - imageStore( - gImage_0, - ivec2(tmp_launchid2.xy), - payload_1.albedo_0); + uvec3 _S2 = ((gl_LaunchIDNV)); + vec2 _S3 = vec2(_S2.xy); + uvec3 _S4 = ((gl_LaunchSizeNV)); + vec2 _S5 = _S3 / vec2(_S4.xy); + payload_1.uv_0 = _S5; + CallShader_0(C_0._data.shaderIndex_0, payload_1); + uvec3 _S6 = ((gl_LaunchIDNV)); + imageStore((gImage_0), ivec2((_S6.xy)), payload_1.albedo_0); return; } diff --git a/tests/vkray/intersection.slang.glsl b/tests/vkray/intersection.slang.glsl index 66846d993..ac95432dd 100644 --- a/tests/vkray/intersection.slang.glsl +++ b/tests/vkray/intersection.slang.glsl @@ -1,19 +1,8 @@ //TEST_IGNORE_FILE: #version 460 - #extension GL_NV_ray_tracing : require - -#define tmp_ubo _S1 -#define tmp_reportHit _S2 -#define tmp_origin _S3 -#define tmp_direction _S4 -#define tmp_tmin _S5 -#define tmp_tmax _S6 -#define tmp_thit _S7 -#define tmp_hitattrs _S8 -#define tmp_dithit _S9 -#define tmp_reportresult _S10 - +layout(row_major) uniform; +layout(row_major) buffer; struct Sphere_0 { vec3 position_0; @@ -26,12 +15,10 @@ struct SLANG_ParameterGroup_U_0 }; layout(binding = 0) -layout(std140) -uniform tmp_ubo +layout(std140) uniform _S1 { SLANG_ParameterGroup_U_0 _data; } U_0; - struct RayDesc_0 { vec3 Origin_0; @@ -45,54 +32,43 @@ struct SphereHitAttributes_0 vec3 normal_0; }; -bool rayIntersectsSphere_0( - RayDesc_0 ray_0, - Sphere_0 sphere_0, - out float tHit_0, - out SphereHitAttributes_0 attrs_0) +bool rayIntersectsSphere_0(RayDesc_0 ray_0, Sphere_0 sphere_0, out float tHit_0, out SphereHitAttributes_0 attrs_0) { tHit_0 = sphere_0.radius_0; attrs_0.normal_0 = sphere_0.position_0; return tHit_0 >= ray_0.TMin_0; } -hitAttributeNV SphereHitAttributes_0 a_0; +hitAttributeNV +SphereHitAttributes_0 a_0; bool ReportHit_0(float tHit_1, uint hitKind_0, SphereHitAttributes_0 attributes_0) { a_0 = attributes_0; - bool tmp_reportHit = reportIntersectionNV(tHit_1, hitKind_0); - return tmp_reportHit; + bool _S2 = reportIntersectionNV(tHit_1, hitKind_0); + return _S2; } void main() { RayDesc_0 ray_1; - - vec3 tmp_origin = gl_ObjectRayOriginNV; - ray_1.Origin_0 = tmp_origin; - - vec3 tmp_direction = gl_ObjectRayDirectionNV; - ray_1.Direction_0 = tmp_direction; - - float tmp_tmin = gl_RayTminNV; - ray_1.TMin_0 = tmp_tmin; - - float tmp_tmax = gl_RayTmaxNV; - ray_1.TMax_0 = tmp_tmax; - - float tmp_thit; - SphereHitAttributes_0 tmp_hitattrs; - bool tmp_dithit = rayIntersectsSphere_0(ray_1, U_0._data.gSphere_0, tmp_thit, tmp_hitattrs); - - float tHit_2 = tmp_thit; - SphereHitAttributes_0 attrs_1 = tmp_hitattrs; - - if(tmp_dithit) + vec3 _S3 = ((gl_ObjectRayOriginNV)); + ray_1.Origin_0 = _S3; + vec3 _S4 = ((gl_ObjectRayDirectionNV)); + ray_1.Direction_0 = _S4; + float _S5 = ((gl_RayTminNV)); + ray_1.TMin_0 = _S5; + float _S6 = ((gl_RayTmaxNV)); + ray_1.TMax_0 = _S6; + float tHit_2; + SphereHitAttributes_0 attrs_1; + bool _S7 = rayIntersectsSphere_0(ray_1, U_0._data.gSphere_0, tHit_2, attrs_1); + if(_S7) + { + bool _S8 = ReportHit_0(tHit_2, uint(0), attrs_1); + } + else { - bool tmp_reportresult = ReportHit_0(tHit_2, (uint((0))), attrs_1); } - return; } - diff --git a/tests/vkray/raygen.slang.glsl b/tests/vkray/raygen.slang.glsl index 79162be9f..f8b97973b 100644 --- a/tests/vkray/raygen.slang.glsl +++ b/tests/vkray/raygen.slang.glsl @@ -1,60 +1,16 @@ //TEST_IGNORE_FILE: #version 460 - -layout(row_major) uniform; - -#if USE_NV_RT -#extension GL_NV_ray_tracing : require -#define accelerationStructureEXT accelerationStructureNV -#define callableDataInEXT callableDataInNV -#define gl_LaunchIDEXT gl_LaunchIDNV -#define hitAttributeEXT hitAttributeNV -#define ignoreIntersectionEXT ignoreIntersectionNV -#define rayPayloadInEXT rayPayloadInNV -#define terminateRayEXT terminateRayNV -#define traceRayEXT traceNV -#else #extension GL_EXT_ray_tracing : require -#endif - -#define TRACING_EPSILON 1e-6 - -#define tmp_ubo _S1 -#define tmp_saturate _S2 -#define tmp_launchID_x _S3 -#define tmp_add_x _S4 -#define tmp_launchSize_x _S5 -#define tmp_div_x _S6 -#define tmp_launchID_y _S7 -#define tmp_add_y _S8 -#define tmp_launchSize_y _S9 -#define tmp_div_y _S10 -#define tmp_tex_pos _S11 -#define tmp_tex_nrm _S12 -#define tmp_light_invDist _S13 -#define tmp_trace_A _S14 -#define tmp_trace_B _S15 -#define tmp_trace_C _S16 -#define tmp_trace_D _S17 -#define tmp_trace_E _S18 -#define tmp_trace_ray _S19 -#define tmp_trace_payload _S20 -#define tmp_color _S21 -#define tmp_dot _S22 -#define tmp_sat _S23 -#define tmp_trace2_A _S24 -#define tmp_trace2_B _S25 -#define tmp_trace2_C _S26 -#define tmp_trace2_D _S27 -#define tmp_trace2_E _S28 -#define tmp_trace2_ray _S39 -#define tmp_trace2_payload _S30 -#define tmp_storeIdx _S31 +layout(row_major) uniform; +layout(row_major) buffer; +layout(binding = 0) +uniform texture2D samplerPosition_0; +layout(binding = 2) +uniform sampler sampler_0; -layout(binding = 0) uniform texture2D samplerPosition_0; -layout(binding = 2) uniform sampler sampler_0; -layout(binding = 1) uniform texture2D samplerNormal_0; +layout(binding = 1) +uniform texture2D samplerNormal_0; struct Light_0 { @@ -62,8 +18,6 @@ struct Light_0 vec4 color_0; }; -#define NUM_LIGHTS 17 - struct Uniforms_0 { Light_0 light_0; @@ -73,26 +27,18 @@ struct Uniforms_0 }; layout(binding = 3) -layout(std140) uniform tmp_ubo +layout(std140) uniform _S1 { Uniforms_0 _data; } ubo_0; - -layout(binding = 5) uniform accelerationStructureEXT as_0; - struct ShadowRay_0 { float hitDistance_0; }; -layout(location = 0) rayPayloadEXT ShadowRay_0 p_0; -struct ReflectionRay_0 -{ - float color_1; -}; -layout(location = 1) rayPayloadEXT ReflectionRay_0 p_1; - -layout(rgba32f) layout(binding = 4) uniform image2D outputImage_0; +layout(location = 0) +rayPayloadEXT +ShadowRay_0 p_0; struct RayDesc_0 { @@ -102,141 +48,88 @@ struct RayDesc_0 float TMax_0; }; -void TraceRay_0( - accelerationStructureEXT AccelerationStructure_0, - uint RayFlags_0, - uint InstanceInclusionMask_0, - uint RayContributionToHitGroupIndex_0, - uint MultiplierForGeometryContributionToHitGroupIndex_0, - uint MissShaderIndex_0, - RayDesc_0 Ray_0, - inout ShadowRay_0 Payload_0) +void TraceRay_0(accelerationStructureEXT AccelerationStructure_0, uint RayFlags_0, uint InstanceInclusionMask_0, uint RayContributionToHitGroupIndex_0, uint MultiplierForGeometryContributionToHitGroupIndex_0, uint MissShaderIndex_0, RayDesc_0 Ray_0, inout ShadowRay_0 Payload_0) { p_0 = Payload_0; - traceRayEXT( - AccelerationStructure_0, - RayFlags_0, - InstanceInclusionMask_0, - RayContributionToHitGroupIndex_0, - MultiplierForGeometryContributionToHitGroupIndex_0, - MissShaderIndex_0, - Ray_0.Origin_0, - Ray_0.TMin_0, - Ray_0.Direction_0, - Ray_0.TMax_0, - 0); + traceRayEXT(AccelerationStructure_0, RayFlags_0, InstanceInclusionMask_0, RayContributionToHitGroupIndex_0, MultiplierForGeometryContributionToHitGroupIndex_0, MissShaderIndex_0, Ray_0.Origin_0, Ray_0.TMin_0, Ray_0.Direction_0, Ray_0.TMax_0, (0)); Payload_0 = p_0; return; } -void TraceRay_1( - accelerationStructureEXT AccelerationStructure_1, - uint RayFlags_1, - uint InstanceInclusionMask_1, - uint RayContributionToHitGroupIndex_1, - uint MultiplierForGeometryContributionToHitGroupIndex_1, - uint MissShaderIndex_1, - RayDesc_0 Ray_1, - inout ReflectionRay_0 Payload_1) +struct ReflectionRay_0 +{ + float color_1; +}; + +layout(location = 1) +rayPayloadEXT +ReflectionRay_0 p_1; + +void TraceRay_1(accelerationStructureEXT AccelerationStructure_1, uint RayFlags_1, uint InstanceInclusionMask_1, uint RayContributionToHitGroupIndex_1, uint MultiplierForGeometryContributionToHitGroupIndex_1, uint MissShaderIndex_1, RayDesc_0 Ray_1, inout ReflectionRay_0 Payload_1) { p_1 = Payload_1; - traceRayEXT( - AccelerationStructure_1, - RayFlags_1, - InstanceInclusionMask_1, - RayContributionToHitGroupIndex_1, - MultiplierForGeometryContributionToHitGroupIndex_1, - MissShaderIndex_1, - Ray_1.Origin_0, - Ray_1.TMin_0, - Ray_1.Direction_0, - Ray_1.TMax_0, - 1); + traceRayEXT(AccelerationStructure_1, RayFlags_1, InstanceInclusionMask_1, RayContributionToHitGroupIndex_1, MultiplierForGeometryContributionToHitGroupIndex_1, MissShaderIndex_1, Ray_1.Origin_0, Ray_1.TMin_0, Ray_1.Direction_0, Ray_1.TMax_0, (1)); Payload_1 = p_1; return; } +layout(binding = 5) +uniform accelerationStructureEXT as_0; + float saturate_0(float x_0) { - float tmp_saturate = clamp(x_0, float(0), float(1)); - return tmp_saturate; + float _S2 = clamp(x_0, float(0), float(1)); + return _S2; } -void main() +layout(rgba32f) +layout(binding = 4) +uniform image2D outputImage_0; + +void main() { float atten_0; - - uvec3 tmp_launchID_x = gl_LaunchIDEXT; - float tmp_add_x = float(tmp_launchID_x.x) + 0.5; - uvec3 tmp_launchSize_x = gl_LaunchSizeEXT; - float tmp_div_x = tmp_add_x / float(tmp_launchSize_x.x); - - uvec3 tmp_launchID_y = gl_LaunchIDEXT; - float tmp_add_y = float(tmp_launchID_y.y) + 0.5; - uvec3 tmp_launchSize_y = gl_LaunchSizeEXT; - float tmp_div_y = tmp_add_y / float(tmp_launchSize_y.y); - vec2 inUV_0 = vec2(tmp_div_x, tmp_div_y); - - vec4 tmp_tex_pos = texture(sampler2D(samplerPosition_0, sampler_0), inUV_0); - vec3 P_0 = tmp_tex_pos.xyz; - - vec4 tmp_tex_nrm = texture(sampler2D(samplerNormal_0, sampler_0), inUV_0); - vec3 N_0 = tmp_tex_nrm.xyz * 2.0 - 1.0; - + uvec3 _S3 = ((gl_LaunchIDEXT)); + float _S4 = float(_S3.x) + 0.50000000000000000000; + uvec3 _S5 = ((gl_LaunchSizeEXT)); + float _S6 = _S4 / float(_S5.x); + uvec3 _S7 = ((gl_LaunchIDEXT)); + float _S8 = float(_S7.y) + 0.50000000000000000000; + uvec3 _S9 = ((gl_LaunchSizeEXT)); + float _S10 = _S8 / float(_S9.y); + vec2 inUV_0 = vec2(_S6, _S10); + vec4 _S11 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))); + vec3 P_0 = _S11.xyz; + vec4 _S12 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); + vec3 N_0 = _S12.xyz * 2.00000000000000000000 - 1.00000000000000000000; vec3 lightDelta_0 = ubo_0._data.light_0.position_0.xyz - P_0; float lightDist_0 = length(lightDelta_0); vec3 L_0 = normalize(lightDelta_0); - - float tmp_light_invDist = 1.0 / (lightDist_0 * lightDist_0); - + float _S13 = 1.00000000000000000000 / (lightDist_0 * lightDist_0); RayDesc_0 ray_0; ray_0.Origin_0 = P_0; - ray_0.TMin_0 = TRACING_EPSILON; + ray_0.TMin_0 = 0.00000100000000000000; ray_0.Direction_0 = lightDelta_0; ray_0.TMax_0 = lightDist_0; - ShadowRay_0 shadowRay_0; shadowRay_0.hitDistance_0 = float(0); - const uint tmp_trace_A = uint(1); - const uint tmp_trace_B = uint(0xFF); - const uint tmp_trace_C = uint(0); - const uint tmp_trace_D = uint(0); - const uint tmp_trace_E = uint(2); - - RayDesc_0 tmp_trace_ray = ray_0; - ShadowRay_0 tmp_trace_payload; - tmp_trace_payload = shadowRay_0; - TraceRay_0(as_0, tmp_trace_A, tmp_trace_B, tmp_trace_C, tmp_trace_D, tmp_trace_E, tmp_trace_ray, tmp_trace_payload); - shadowRay_0 = tmp_trace_payload; - - ReflectionRay_0 reflectionRay_0; + TraceRay_0(as_0, uint(1), uint(255), uint(0), uint(0), uint(2), ray_0, shadowRay_0); if(shadowRay_0.hitDistance_0 < lightDist_0) { - atten_0 = (0.00000000000000000000); + atten_0 = 0.00000000000000000000; } else { - atten_0 = tmp_light_invDist; + atten_0 = _S13; } - - vec3 tmp_color = ubo_0._data.light_0.color_0.xyz; - float tmp_dot = dot(N_0, L_0); - float tmp_sat = saturate_0(tmp_dot); - vec3 color_2 = (tmp_color * tmp_sat) * atten_0; - - const uint tmp_trace2_A = uint(1); - const uint tmp_trace2_B = uint(255); - const uint tmp_trace2_C = uint(0); - const uint tmp_trace2_D = uint(0); - const uint tmp_trace2_E = uint(2); - RayDesc_0 tmp_trace2_ray = ray_0; - ReflectionRay_0 tmp_trace2_payload; - tmp_trace2_payload = reflectionRay_0; - TraceRay_1(as_0, tmp_trace2_A, tmp_trace2_B, tmp_trace2_C, tmp_trace2_D, tmp_trace2_E, tmp_trace2_ray, tmp_trace2_payload); - - vec3 color_3 = color_2 + tmp_trace2_payload.color_1; - - uvec3 tmp_storeIdx = gl_LaunchIDEXT; - imageStore(outputImage_0, ivec2(uvec2(ivec2(tmp_storeIdx.xy))), vec4(color_3, 1.0)); + vec3 _S14 = ubo_0._data.light_0.color_0.xyz; + float _S15 = dot(N_0, L_0); + float _S16 = saturate_0(_S15); + vec3 color_2 = _S14 * _S16 * atten_0; + ReflectionRay_0 reflectionRay_0; + TraceRay_1(as_0, uint(1), uint(255), uint(0), uint(0), uint(2), ray_0, reflectionRay_0); + vec3 color_3 = color_2 + reflectionRay_0.color_1; + uvec3 _S17 = ((gl_LaunchIDEXT)); + imageStore((outputImage_0), ivec2((uvec2(ivec2(_S17.xy)))), vec4(color_3, 1.00000000000000000000)); return; } |
