diff options
Diffstat (limited to 'tests/vkray')
| -rw-r--r-- | tests/vkray/anyhit.slang.glsl | 6 | ||||
| -rw-r--r-- | tests/vkray/callable-caller.slang.glsl | 40 | ||||
| -rw-r--r-- | tests/vkray/closesthit.slang.glsl | 58 | ||||
| -rw-r--r-- | tests/vkray/intersection.slang.glsl | 62 | ||||
| -rw-r--r-- | tests/vkray/raygen.slang.glsl | 152 |
5 files changed, 204 insertions, 114 deletions
diff --git a/tests/vkray/anyhit.slang.glsl b/tests/vkray/anyhit.slang.glsl index 43fd29e01..07789cdbd 100644 --- a/tests/vkray/anyhit.slang.glsl +++ b/tests/vkray/anyhit.slang.glsl @@ -10,8 +10,8 @@ struct Params_0 layout(binding = 0) layout(std140) uniform _S1 { - Params_0 gParams_0; -}; + Params_0 _data; +} gParams_0; layout(binding = 1) uniform texture2D gParams_alphaMap_0; @@ -35,7 +35,7 @@ void main() { SphereHitAttributes_0 _S4 = _S2; - if(bool(gParams_0.mode_0)) + if(bool(gParams_0._data.mode_0)) { float val_0 = textureLod( sampler2D(gParams_alphaMap_0, gParams_sampler_0), diff --git a/tests/vkray/callable-caller.slang.glsl b/tests/vkray/callable-caller.slang.glsl index 2704e6720..b0d174381 100644 --- a/tests/vkray/callable-caller.slang.glsl +++ b/tests/vkray/callable-caller.slang.glsl @@ -4,16 +4,26 @@ 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 C_0 +layout(std140) +uniform tmp_ubo { - uint shaderIndex_0; -}; + SLANG_ParameterGroup_C_0 _data; +} C_0; struct MaterialPayload_0 { @@ -43,25 +53,25 @@ void main() MaterialPayload_0 payload_1; payload_1.albedo_0 = vec4(0); - uvec3 _S1 = gl_LaunchIDNV; - vec2 _S2 = vec2(_S1.xy); + uvec3 tmp_launchid = gl_LaunchIDNV; + vec2 tmp_luanchidf = vec2(tmp_launchid.xy); - uvec3 _S3 = gl_LaunchSizeNV; - vec2 _S4 = _S2 / vec2(_S3.xy); + uvec3 tmp_launchsize = gl_LaunchSizeNV; + vec2 tmp_launchpos = tmp_luanchidf / vec2(tmp_launchsize.xy); - payload_1.uv_0 = _S4; + payload_1.uv_0 = tmp_launchpos; - uint _S5 = shaderIndex_0; + uint tmp_shaderidx = C_0._data.shaderIndex_0; - MaterialPayload_0 _S6; - _S6 = payload_1; - CallShader_0(_S5, _S6); - payload_1 = _S6; + MaterialPayload_0 tmp_payload; + tmp_payload = payload_1; + CallShader_0(tmp_shaderidx, tmp_payload); + payload_1 = tmp_payload; - uvec3 _S7 = gl_LaunchIDNV; + uvec3 tmp_launchid2 = gl_LaunchIDNV; imageStore( gImage_0, - ivec2(_S7.xy), + ivec2(tmp_launchid2.xy), payload_1.albedo_0); return; } diff --git a/tests/vkray/closesthit.slang.glsl b/tests/vkray/closesthit.slang.glsl index a056b7809..79fd3afbe 100644 --- a/tests/vkray/closesthit.slang.glsl +++ b/tests/vkray/closesthit.slang.glsl @@ -2,50 +2,70 @@ #version 460 #extension GL_NV_ray_tracing : require -layout(shaderRecordNV) -buffer ShaderRecord_0 +#define tmp_shaderrecord _S1 +#define tmp_colors _S2 +#define tmp_hitattrs _S3 +#define tmp_payload _S4 +#define tmp_localattrs _S5 +#define tmp_customidx _S6 +#define tmp_instanceid _S7 +#define tmp_add_0 _S8 +#define tmp_primid _S9 +#define tmp_add_1 _S10 +#define tmp_hitkind _S11 +#define tmp_hitt _S12 +#define tmp_tmin _S13 + +struct SLANG_ParameterGroup_ShaderRecord_0 { - uint shaderRecordID_0; + uint shaderRecordID_0; }; -layout(std430, binding = 0) buffer _S1 +layout(shaderRecordNV) +buffer tmp_shaderrecord { - vec4 colors_0[]; -}; + SLANG_ParameterGroup_ShaderRecord_0 _data; +} ShaderRecord_0; + +layout(std430, binding = 0) buffer tmp_colors +{ + vec4 _data[]; +} colors_0; struct BuiltInTriangleIntersectionAttributes_0 { vec2 barycentrics_0; }; -hitAttributeNV BuiltInTriangleIntersectionAttributes_0 _S2; + +hitAttributeNV BuiltInTriangleIntersectionAttributes_0 tmp_hitattrs; struct ReflectionRay_0 { vec4 color_0; }; -rayPayloadInNV ReflectionRay_0 _S3; +rayPayloadInNV ReflectionRay_0 tmp_payload; void main() { - BuiltInTriangleIntersectionAttributes_0 _S4 = _S2; + BuiltInTriangleIntersectionAttributes_0 tmp_localattrs = tmp_hitattrs; - uint _S5 = gl_InstanceCustomIndexNV; - uint _S6 = gl_InstanceID; + uint tmp_customidx = gl_InstanceCustomIndexNV; + uint tmp_instanceid = gl_InstanceID; - uint _S7 = _S5 + _S6; - uint _S8 = gl_PrimitiveID; + uint tmp_add_0 = tmp_customidx + tmp_instanceid; + uint tmp_primid = gl_PrimitiveID; - uint _S9 = _S7 + _S8; - uint _S10 = gl_HitKindNV; + uint tmp_add_1 = tmp_add_0 + tmp_primid; + uint tmp_hitkind = gl_HitKindNV; - vec4 color_1 = colors_0[_S9 + _S10 + shaderRecordID_0]; + vec4 color_1 = colors_0._data[tmp_add_1 + tmp_hitkind + ShaderRecord_0._data.shaderRecordID_0]; - float _S11 = gl_HitTNV; - float _S12 = gl_RayTminNV; + float tmp_hitt = gl_HitTNV; + float tmp_tmin = gl_RayTminNV; - _S3.color_0 = color_1 * (_S11 - _S12); + tmp_payload.color_0 = color_1 * (tmp_hitt - tmp_tmin); return; } diff --git a/tests/vkray/intersection.slang.glsl b/tests/vkray/intersection.slang.glsl index cfa53efa7..09d7e63a5 100644 --- a/tests/vkray/intersection.slang.glsl +++ b/tests/vkray/intersection.slang.glsl @@ -3,19 +3,37 @@ #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_ray _S7 +#define tmp_sphere _S8 +#define tmp_thit _S9 +#define tmp_hitattrs _S10 +#define tmp_dithit _S11 +#define tmp_reportresult _S12 + struct Sphere_0 { vec3 position_0; float radius_0; }; -layout(binding = 0) -layout(std140) -uniform U_0 +struct SLANG_ParameterGroup_U_0 { Sphere_0 gSphere_0; }; +layout(binding = 0) +layout(std140) +uniform tmp_ubo +{ + SLANG_ParameterGroup_U_0 _data; +} U_0; + struct RayDesc_0 { vec3 Origin_0; @@ -45,40 +63,40 @@ hitAttributeNV SphereHitAttributes_0 a_0; bool ReportHit_0(float tHit_1, uint hitKind_0, SphereHitAttributes_0 attributes_0) { a_0 = attributes_0; - bool _S1 = reportIntersectionNV(tHit_1, hitKind_0); - return _S1; + bool tmp_reportHit = reportIntersectionNV(tHit_1, hitKind_0); + return tmp_reportHit; } void main() { RayDesc_0 ray_1; - vec3 _S2 = gl_ObjectRayOriginNV; - ray_1.Origin_0 = _S2; - vec3 _S3 = gl_ObjectRayDirectionNV; + vec3 tmp_origin = gl_ObjectRayOriginNV; + ray_1.Origin_0 = tmp_origin; - ray_1.Direction_0 = _S3; - float _S4 = gl_RayTminNV; + vec3 tmp_direction = gl_ObjectRayDirectionNV; + ray_1.Direction_0 = tmp_direction; - ray_1.TMin_0 = _S4; - float _S5 = gl_RayTmaxNV; + float tmp_tmin = gl_RayTminNV; + ray_1.TMin_0 = tmp_tmin; - ray_1.TMax_0 = _S5; + float tmp_tmax = gl_RayTmaxNV; + ray_1.TMax_0 = tmp_tmax; - RayDesc_0 _S6 = ray_1; + RayDesc_0 tmp_ray = ray_1; - Sphere_0 _S7 = gSphere_0; + Sphere_0 tmp_sphere = U_0._data.gSphere_0; - float _S8; - SphereHitAttributes_0 _S9; - bool _S10 = rayIntersectsSphere_0(_S6, _S7, _S8, _S9); + float tmp_thit; + SphereHitAttributes_0 tmp_hitattrs; + bool tmp_dithit = rayIntersectsSphere_0(tmp_ray, tmp_sphere, tmp_thit, tmp_hitattrs); - float tHit_2 = _S8; - SphereHitAttributes_0 attrs_1 = _S9; + float tHit_2 = tmp_thit; + SphereHitAttributes_0 attrs_1 = tmp_hitattrs; - if(_S10) + if(tmp_dithit) { - bool _S11 = ReportHit_0(tHit_2, (uint((0))), attrs_1); + 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 512215a73..f65053ecf 100644 --- a/tests/vkray/raygen.slang.glsl +++ b/tests/vkray/raygen.slang.glsl @@ -1,10 +1,46 @@ //TEST_IGNORE_FILE: #version 460 +layout(row_major) uniform; + #extension GL_NV_ray_tracing : require #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_cmp _S21 +#define tmp_color _S22 +#define tmp_dot _S23 +#define tmp_sat _S24 +#define tmp_trace2_A _S25 +#define tmp_trace2_B _S26 +#define tmp_trace2_C _S27 +#define tmp_trace2_D _S28 +#define tmp_trace2_E _S29 +#define tmp_trace2_ray _S30 +#define tmp_trace2_payload _S31 +#define tmp_storeIdx _S32 + + layout(binding = 0) uniform texture2D samplerPosition_0; layout(binding = 2) uniform sampler sampler_0; layout(binding = 1) uniform texture2D samplerNormal_0; @@ -17,15 +53,20 @@ struct Light_0 #define NUM_LIGHTS 17 -layout(binding = 3) -layout(std140) uniform ubo_0 +struct Uniforms_0 { Light_0 light_0; vec4 viewPos_0; - layout(row_major) mat4x4 view_0; - layout(row_major) mat4x4 model_0; + mat4x4 view_0; + mat4x4 model_0; }; +layout(binding = 3) +layout(std140) uniform tmp_ubo +{ + Uniforms_0 _data; +} ubo_0; + layout(binding = 5) uniform accelerationStructureNV as_0; struct ShadowRay_0 @@ -79,8 +120,8 @@ void TraceRay_0( float saturate_0(float x_0) { - float _S1 = clamp(x_0, float(0), float(1)); - return _S1; + float tmp_saturate = clamp(x_0, float(0), float(1)); + return tmp_saturate; } void TraceRay_1( @@ -114,27 +155,28 @@ void main() { float atten_0; - uvec3 _S2 = gl_LaunchIDNV; - float _S3 = float(_S2.x) + 0.5; - uvec3 _S4 = gl_LaunchSizeNV; - float _S5 = _S3 / float(_S4.x); - uvec3 _S6 = gl_LaunchIDNV; - float _S7 = float(_S6.y) + 0.5; - uvec3 _S8 = gl_LaunchSizeNV; - float _S9 = _S7 / float(_S8.y); - vec2 inUV_0 = vec2(_S5, _S9); + uvec3 tmp_launchID_x = gl_LaunchIDNV; + float tmp_add_x = float(tmp_launchID_x.x) + 0.5; + uvec3 tmp_launchSize_x = gl_LaunchSizeNV; + float tmp_div_x = tmp_add_x / float(tmp_launchSize_x.x); + + uvec3 tmp_launchID_y = gl_LaunchIDNV; + float tmp_add_y = float(tmp_launchID_y.y) + 0.5; + uvec3 tmp_launchSize_y = gl_LaunchSizeNV; + float tmp_div_y = tmp_add_y / float(tmp_launchSize_y.y); + vec2 inUV_0 = vec2(tmp_div_x, tmp_div_y); - vec4 _S10 = texture(sampler2D(samplerPosition_0, sampler_0), inUV_0); - vec3 P_0 = _S10.xyz; + vec4 tmp_tex_pos = texture(sampler2D(samplerPosition_0, sampler_0), inUV_0); + vec3 P_0 = tmp_tex_pos.xyz; - vec4 _S11 = texture(sampler2D(samplerNormal_0, sampler_0), inUV_0); - vec3 N_0 = _S11.xyz * 2.0 - 1.0; + vec4 tmp_tex_nrm = texture(sampler2D(samplerNormal_0, sampler_0), inUV_0); + vec3 N_0 = tmp_tex_nrm.xyz * 2.0 - 1.0; - vec3 lightDelta_0 = light_0.position_0.xyz - P_0; + 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 _S12 = 1.0 / (lightDist_0 * lightDist_0); + float tmp_light_invDist = 1.0 / (lightDist_0 * lightDist_0); RayDesc_0 ray_0; ray_0.Origin_0 = P_0; @@ -144,47 +186,47 @@ void main() ShadowRay_0 shadowRay_0; shadowRay_0.hitDistance_0 = float(0); - const uint _S13 = uint(1); - const uint _S14 = uint(0xFF); - const uint _S15 = uint(0); - const uint _S16 = uint(0); - const uint _S17 = uint(2); - - RayDesc_0 _S18 = ray_0; - ShadowRay_0 _S19; - _S19 = shadowRay_0; - TraceRay_0(as_0, _S13, _S14, _S15, _S16, _S17, _S18, _S19); - shadowRay_0 = _S19; - - bool _S20 = shadowRay_0.hitDistance_0 < lightDist_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; + + bool tmp_cmp = shadowRay_0.hitDistance_0 < lightDist_0; ReflectionRay_0 reflectionRay_0; - if(_S20) + if(tmp_cmp) { atten_0 = (0.00000000000000000000); } else { - atten_0 = _S12; + atten_0 = tmp_light_invDist; } - vec3 _S21 = light_0.color_0.xyz; - float _S22 = dot(N_0, L_0); - float _S23 = saturate_0(_S22); - vec3 color_2 = (_S21 * _S23) * atten_0; - - const uint _S24 = uint(1); - const uint _S25 = uint(255); - const uint _S26 = uint(0); - const uint _S27 = uint(0); - const uint _S28 = uint(2); - RayDesc_0 _S29 = ray_0; - ReflectionRay_0 _S30; - _S30 = reflectionRay_0; - TraceRay_1(as_0, _S24, _S25, _S26, _S27, _S28, _S29, _S30); - - vec3 color_3 = color_2 + _S30.color_1; - - uvec3 _S31 = gl_LaunchIDNV; - imageStore(outputImage_0, ivec2(uvec2(ivec2(_S31.xy))), vec4(color_3, 1.0)); + 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_LaunchIDNV; + imageStore(outputImage_0, ivec2(uvec2(ivec2(tmp_storeIdx.xy))), vec4(color_3, 1.0)); return; } |
