diff options
| author | Yong He <yonghe@outlook.com> | 2023-05-02 20:29:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-02 20:29:38 -0700 |
| commit | d52376a65f37fcbbb67428b917fd3819436b6dfb (patch) | |
| tree | da25b3c9a00bd003b1970b4a6c4eb38eccf62aa1 /tests | |
| parent | 55291b0bf6d729fcbaf75a01926da7da8975b8e9 (diff) | |
Various dxc/fxc compatibility fixes. (#2863)
* Various dxc/fxc compatibility fixes.
* Cleanup.
* Fix test cases.
* Fix comments.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
23 files changed, 342 insertions, 99 deletions
diff --git a/tests/bindings/glsl-parameter-blocks.slang.glsl b/tests/bindings/glsl-parameter-blocks.slang.glsl index 03e4e8774..fbeddb905 100644 --- a/tests/bindings/glsl-parameter-blocks.slang.glsl +++ b/tests/bindings/glsl-parameter-blocks.slang.glsl @@ -1,31 +1,50 @@ #version 450 layout(row_major) uniform; layout(row_major) buffer; + +#line 3 "tests/bindings/glsl-parameter-blocks.slang" struct Test_0 { vec4 a_0; }; + +#line 7 layout(binding = 0) layout(std140) uniform _S1 { - Test_0 _data; -} gTest_0; + vec4 a_0; +}gTest_0; + +#line 3 layout(binding = 1) uniform texture2D gTest_t_0; + +#line 1237 "core.meta.slang" layout(binding = 2) uniform sampler gTest_s_0; + +#line 89 "core" layout(location = 0) out vec4 _S2; + +#line 902 "core.meta.slang" layout(location = 0) in vec2 _S3; + +#line 12 "tests/bindings/glsl-parameter-blocks.slang" void main() { vec4 _S4 = (texture(sampler2D(gTest_t_0,gTest_s_0), (_S3))); - _S2 = gTest_0._data.a_0 + _S4; + +#line 14 + _S2 = gTest_0.a_0 + _S4; + +#line 14 return; } + diff --git a/tests/bugs/gh-941.slang.glsl b/tests/bugs/gh-941.slang.glsl index d3c29820d..4330ece53 100644 --- a/tests/bugs/gh-941.slang.glsl +++ b/tests/bugs/gh-941.slang.glsl @@ -14,7 +14,8 @@ layout(binding = 2) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; + vec2 uv_0; + uint index_0; } C_0; layout(binding = 0) @@ -30,9 +31,9 @@ void main() { vec4 _S3 = texture( sampler2D( - t_0[C_0._data.index_0], + t_0[C_0.index_0], s_0), - C_0._data.uv_0); + C_0.uv_0); _S2 = _S3; return; }
\ No newline at end of file diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl index 4ff86f36e..62990033e 100644 --- a/tests/cross-compile/array-of-buffers.slang.glsl +++ b/tests/cross-compile/array-of-buffers.slang.glsl @@ -9,7 +9,7 @@ struct SLANG_ParameterGroup_C_0 layout(binding = 0) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; + uint index_0; } C_0; struct S_0 { @@ -19,7 +19,7 @@ struct S_0 layout(binding = 1) layout(std140) uniform _S2 { - S_0 _data; + vec4 f_0; } cb_0[3]; layout(std430, binding = 2) readonly buffer _S3 { S_0 _data[]; @@ -36,9 +36,9 @@ out vec4 _S6; void main() { - S_0 _S7 = ((sb1_0[C_0._data.index_0])._data[(C_0._data.index_0)]); - vec4 _S8 = cb_0[C_0._data.index_0]._data.f_0 + _S7.f_0; - uint _S9 = ((bb_0[C_0._data.index_0])._data[(int(C_0._data.index_0 * 4U))/4]); - _S6 = _S8 + ((sb2_0[C_0._data.index_0])._data[(C_0._data.index_0)]) + vec4(float(_S9)); + S_0 _S7 = ((sb1_0[C_0.index_0])._data[(C_0.index_0)]); + vec4 _S8 = cb_0[C_0.index_0].f_0 + _S7.f_0; + uint _S9 = ((bb_0[C_0.index_0])._data[(int(C_0.index_0 * 4U))/4]); + _S6 = _S8 + ((sb2_0[C_0.index_0])._data[(C_0.index_0)]) + vec4(float(_S9)); return; } diff --git a/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl b/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl index 0ff895179..acf0a6fe9 100644 --- a/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl +++ b/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl @@ -11,13 +11,13 @@ struct P_0 layout(binding = 0) layout(std140) uniform _S1 { - P_0 _data; + vec4 param_0; } pblock_0; layout(location = 0) out vec4 _S2; void main() { - _S2 = pblock_0._data.param_0; + _S2 = pblock_0.param_0; return; }
\ No newline at end of file diff --git a/tests/cross-compile/half-conversion.slang.glsl b/tests/cross-compile/half-conversion.slang.glsl index fb51809b4..b062f67b4 100644 --- a/tests/cross-compile/half-conversion.slang.glsl +++ b/tests/cross-compile/half-conversion.slang.glsl @@ -9,7 +9,7 @@ struct SLANG_ParameterGroup_C_0 layout(binding = 0) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; + uvec4 u_0; } C_0; vec4 f16tof32_0(uvec4 value_0) { @@ -35,6 +35,6 @@ out vec4 _S2; void main() { - _S2 = f16tof32_0(C_0._data.u_0); + _S2 = f16tof32_0(C_0.u_0); return; } diff --git a/tests/cross-compile/texture-load.slang.glsl b/tests/cross-compile/texture-load.slang.glsl index bb4514bad..d9145cdbf 100644 --- a/tests/cross-compile/texture-load.slang.glsl +++ b/tests/cross-compile/texture-load.slang.glsl @@ -17,7 +17,7 @@ layout(binding = 2) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; + ivec2 pos_0; } C_0; layout(binding = 0) @@ -30,7 +30,7 @@ uniform image2D outputTexture_0; layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in; void main() { - ivec3 _S2 = ivec3(C_0._data.pos_0, 0); + ivec3 _S2 = ivec3(C_0.pos_0, 0); vec2 tmp_0 = texelFetch( inputTexture_0, @@ -39,7 +39,7 @@ void main() imageStore( outputTexture_0, - ivec2(uvec2(C_0._data.pos_0)), + ivec2(uvec2(C_0.pos_0)), vec4(tmp_0, float(0), float(0))); return; diff --git a/tests/cross-compile/unknown-image-format.slang.glsl b/tests/cross-compile/unknown-image-format.slang.glsl index 5ccc30767..e541a8b17 100644 --- a/tests/cross-compile/unknown-image-format.slang.glsl +++ b/tests/cross-compile/unknown-image-format.slang.glsl @@ -14,7 +14,7 @@ struct SLANG_ParameterGroup_C_0 layout(binding = 2) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; + uvec2 index_0; } C_0; layout(binding = 0) @@ -44,22 +44,22 @@ out vec4 _S2; void main() { - float _S3 = (imageLoad((gNoFormat_0), ivec2((C_0._data.index_0))).x); + float _S3 = (imageLoad((gNoFormat_0), ivec2((C_0.index_0))).x); vec4 _S4 = vec4(_S3); - float _S5 = (imageLoad((gExplicitFormat_0), ivec2((C_0._data.index_0))).x); + float _S5 = (imageLoad((gExplicitFormat_0), ivec2((C_0.index_0))).x); vec4 result_0 = _S4 + _S5; - vec4 _S6 = (imageLoad((gBlock_noFormat_0), ivec2((C_0._data.index_0)))); + vec4 _S6 = (imageLoad((gBlock_noFormat_0), ivec2((C_0.index_0)))); vec4 result_1 = result_0 + _S6; - vec4 _S7 = (imageLoad((gBlock_explicitFormat_0), ivec2((C_0._data.index_0)))); + vec4 _S7 = (imageLoad((gBlock_explicitFormat_0), ivec2((C_0.index_0)))); vec4 result_2 = result_1 + _S7; - vec4 _S8 = (imageLoad((entryPointParams_noFormat_0), ivec2((C_0._data.index_0)))); + vec4 _S8 = (imageLoad((entryPointParams_noFormat_0), ivec2((C_0.index_0)))); vec4 result_3 = result_2 + _S8; - vec4 _S9 = (imageLoad((entryPointParams_explicitFormat_0), ivec2((C_0._data.index_0)))); + vec4 _S9 = (imageLoad((entryPointParams_explicitFormat_0), ivec2((C_0.index_0)))); _S2 = result_3 + _S9; return; diff --git a/tests/cross-compile/vector-comparison.slang.glsl b/tests/cross-compile/vector-comparison.slang.glsl index 3e6f7b9c2..f7c28203e 100644 --- a/tests/cross-compile/vector-comparison.slang.glsl +++ b/tests/cross-compile/vector-comparison.slang.glsl @@ -10,7 +10,8 @@ struct Param_0 layout(binding = 0) layout(std140) uniform _S1 { - Param_0 _data; + vec4 a_0; + vec4 b_0; } params_0; layout(location = 0) out vec4 _S2; @@ -20,6 +21,6 @@ void main() const vec4 _S3 = vec4(2.0); const vec4 _S4 = vec4(3.0); - _S2 = mix(_S4, _S3, (equal(params_0._data.a_0,params_0._data.b_0))) + mix(_S4, _S3, (lessThan(params_0._data.a_0,params_0._data.b_0))) + mix(_S4, _S3, (greaterThan(params_0._data.a_0,params_0._data.b_0))) + mix(_S4, _S3, (lessThanEqual(params_0._data.a_0,params_0._data.b_0))) + mix(_S4, _S3, (greaterThanEqual(params_0._data.a_0,params_0._data.b_0))) + mix(_S4, _S3, (notEqual(params_0._data.a_0,params_0._data.b_0))); + _S2 = mix(_S4, _S3, (equal(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (lessThan(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (greaterThan(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (lessThanEqual(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (greaterThanEqual(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (notEqual(params_0.a_0,params_0.b_0))); return; } diff --git a/tests/cross-compile/vk-push-constant-set.slang.glsl b/tests/cross-compile/vk-push-constant-set.slang.glsl index 189b14caf..7a2ce4db0 100644 --- a/tests/cross-compile/vk-push-constant-set.slang.glsl +++ b/tests/cross-compile/vk-push-constant-set.slang.glsl @@ -9,13 +9,13 @@ struct S_0 layout(push_constant) layout(std140) uniform _S1 { - S_0 _data; + vec4 v_0; } x_0; layout(binding = 0, set = 0) layout(std140) uniform _S2 { - S_0 _data; + vec4 v_0; } y_0; layout(location = 0) @@ -23,6 +23,6 @@ out vec4 _S3; void main() { - _S3 = x_0._data.v_0 + y_0._data.v_0; + _S3 = x_0.v_0 + y_0.v_0; return; } diff --git a/tests/diagnostics/packoffset.slang b/tests/diagnostics/packoffset.slang deleted file mode 100644 index b5669c410..000000000 --- a/tests/diagnostics/packoffset.slang +++ /dev/null @@ -1,11 +0,0 @@ -// packoffset.slang -//DIAGNOSTIC_TEST:SIMPLE:-target hlsl - -// use of `packoffset` (not supported): -cbuffer B -{ - float4 x : packoffset(c0); -} - -void main() -{}
\ No newline at end of file diff --git a/tests/diagnostics/packoffset.slang.expected b/tests/diagnostics/packoffset.slang.expected deleted file mode 100644 index 701457fe7..000000000 --- a/tests/diagnostics/packoffset.slang.expected +++ /dev/null @@ -1,8 +0,0 @@ -result code = -1 -standard error = { -tests/diagnostics/packoffset.slang(7): error 39012: explicit 'packoffset' bindings are not yet supported in Slang - float4 x : packoffset(c0); - ^~~~~~~~~~ -} -standard output = { -} diff --git a/tests/diagnostics/register-bindings.slang b/tests/diagnostics/register-bindings.slang index 263329bf6..5c78cb10b 100644 --- a/tests/diagnostics/register-bindings.slang +++ b/tests/diagnostics/register-bindings.slang @@ -15,8 +15,6 @@ SamplerState c : register(s0, s1); // No space index given after `space`: SamplerState d : register(s2, space); -// use of a component mask (not supported): -Texture2D e : register(t3.x); void main() {}
\ No newline at end of file diff --git a/tests/diagnostics/register-bindings.slang.expected b/tests/diagnostics/register-bindings.slang.expected index e71f58b13..74e9917d3 100644 --- a/tests/diagnostics/register-bindings.slang.expected +++ b/tests/diagnostics/register-bindings.slang.expected @@ -12,9 +12,6 @@ SamplerState c : register(s0, s1); tests/diagnostics/register-bindings.slang(16): error 39010: expected a register space index after 'space' SamplerState d : register(s2, space); ^~~~~ -tests/diagnostics/register-bindings.slang(19): error 39011: explicit register component masks are not yet supported in Slang -Texture2D e : register(t3.x); - ^ } standard output = { } diff --git a/tests/hlsl/packoffset.slang b/tests/hlsl/packoffset.slang new file mode 100644 index 000000000..94273d8d7 --- /dev/null +++ b/tests/hlsl/packoffset.slang @@ -0,0 +1,33 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -profile cs_5_0 -entry computeMain -line-directive-mode none +//TEST:SIMPLE(filecheck=GLSL): -target glsl -profile glsl_450 -stage compute -entry computeMain -line-directive-mode none + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +//TEST_INPUT:set Constants.v0={1.0,2.0,3.0,4.0} +//TEST_INPUT:set Constants.v1={5.0,6.0,7.0} +//TEST_INPUT:set Constants.v2=8.0 + +cbuffer Constants +{ + float4 v0 : packoffset(c0); + float3 v1 : packoffset(c1); + float v2 : packoffset(c1.w); +}; +// HLSL: cbuffer +// HLSL: { +// HLSL: {{.*}} : packoffset(c0); +// HLSL: {{.*}} : packoffset(c1); +// HLSL: {{.*}} : packoffset(c1.w); +// HLSL: } +// GLSL: layout(offset = 0) +// GLSL: layout(offset = 16) +// GLSL: layout(offset = 28) + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + outputBuffer[dispatchThreadID.x] = v2; +} diff --git a/tests/hlsl/packoffset.slang.expected.txt b/tests/hlsl/packoffset.slang.expected.txt new file mode 100644 index 000000000..56eb1d1d6 --- /dev/null +++ b/tests/hlsl/packoffset.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +8.000000 +0.000000 +0.000000 +0.000000 diff --git a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl index ec635a083..7f734bf75 100644 --- a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl +++ b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl @@ -3,38 +3,29 @@ #extension GL_NV_ray_tracing_motion_blur : require layout(row_major) uniform; layout(row_major) buffer; -struct ReflectionRay_0 -{ - float color_1; -}; - -layout(location = 0) -rayPayloadEXT -ReflectionRay_0 p_0; - -struct ShadowRay_0 -{ - float hitDistance_0; -}; - -layout(location = 1) -rayPayloadEXT -ShadowRay_0 p_1; +#line 5 "tests/nv-extensions/nv-ray-tracing-motion-blur.slang" layout(binding = 0) uniform texture2D samplerPosition_0; + +#line 7 layout(binding = 2) uniform sampler sampler_0; + +#line 6 layout(binding = 1) uniform texture2D samplerNormal_0; + struct Light_0 { vec4 position_0; vec4 color_0; }; + +#line 14 struct Uniforms_0 { Light_0 light_0; @@ -43,11 +34,55 @@ struct Uniforms_0 mat4x4 model_0; }; + +#line 21 layout(binding = 3) layout(std140) uniform _S1 { - Uniforms_0 _data; -} ubo_0; + Light_0 light_0; + vec4 viewPos_0; + mat4x4 view_0; + mat4x4 model_0; +}ubo_0; + +#line 26 +layout(binding = 5) +uniform accelerationStructureEXT as_0; + + +#line 24 +layout(rgba32f) +layout(binding = 4) +uniform image2D outputImage_0; + + +#line 33 +struct ReflectionRay_0 +{ + float color_1; +}; + + +#line 5218 "hlsl.meta.slang" +layout(location = 0) +rayPayloadEXT +ReflectionRay_0 p_0; + + +#line 28 "tests/nv-extensions/nv-ray-tracing-motion-blur.slang" +struct ShadowRay_0 +{ + float hitDistance_0; +}; + + +#line 5286 "hlsl.meta.slang" +layout(location = 1) +rayPayloadEXT +ShadowRay_0 p_1; + + +#line 5079 struct RayDesc_0 { vec3 Origin_0; @@ -56,73 +91,116 @@ struct RayDesc_0 float TMax_0; }; + +#line 5243 void TraceMotionRay_0(accelerationStructureEXT AccelerationStructure_0, uint RayFlags_0, uint InstanceInclusionMask_0, uint RayContributionToHitGroupIndex_0, uint MultiplierForGeometryContributionToHitGroupIndex_0, uint MissShaderIndex_0, RayDesc_0 Ray_0, float CurrentTime_0, inout ShadowRay_0 Payload_0) { + +#line 5288 p_1 = Payload_0; traceRayMotionNV(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, CurrentTime_0, (1)); + +#line 5302 Payload_0 = p_1; return; } -layout(binding = 5) -uniform accelerationStructureEXT as_0; +#line 3527 float saturate_0(float x_0) { return clamp(x_0, 0.0, 1.0); } + +#line 5168 void TraceRay_0(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) { + +#line 5220 p_0 = 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, (0)); + +#line 5233 Payload_1 = p_0; return; } -layout(rgba32f) -layout(binding = 4) -uniform image2D outputImage_0; +#line 38 "tests/nv-extensions/nv-ray-tracing-motion-blur.slang" void main() { uvec3 _S2 = ((gl_LaunchIDEXT)); + +#line 40 ivec2 launchID_0 = ivec2(_S2.xy); uvec3 _S3 = ((gl_LaunchSizeEXT)); + +#line 41 ivec2 launchSize_0 = ivec2(_S3.xy); + vec2 inUV_0 = vec2((float(launchID_0.x) + 0.5) / float(launchSize_0.x), (float(launchID_0.y) + 0.5) / float(launchSize_0.y)); + +#line 48 vec4 _S4 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))); + +#line 48 vec3 P_0 = _S4.xyz; vec4 _S5 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); + +#line 49 vec3 N_0 = _S5.xyz * 2.0 - 1.0; - vec3 lightDelta_0 = ubo_0._data.light_0.position_0.xyz - P_0; + + vec3 lightDelta_0 = ubo_0.light_0.position_0.xyz - P_0; float lightDist_0 = length(lightDelta_0); vec3 L_0 = normalize(lightDelta_0); float _S6 = 1.0 / (lightDist_0 * lightDist_0); + RayDesc_0 ray_0; ray_0.Origin_0 = P_0; ray_0.TMin_0 = 0.00000099999999747524; ray_0.Direction_0 = lightDelta_0; ray_0.TMax_0 = lightDist_0; + ShadowRay_0 shadowRay_0; shadowRay_0.hitDistance_0 = 0.0; + + TraceMotionRay_0(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, 1.0, shadowRay_0); + +#line 69 float atten_0; + +#line 87 if(shadowRay_0.hitDistance_0 < lightDist_0) { + +#line 87 atten_0 = 0.0; + +#line 87 } else { + +#line 87 atten_0 = _S6; + +#line 87 } - vec3 color_2 = ubo_0._data.light_0.color_0.xyz * saturate_0(dot(N_0, L_0)) * atten_0; + +#line 93 + vec3 color_2 = ubo_0.light_0.color_0.xyz * saturate_0(dot(N_0, L_0)) * atten_0; + ReflectionRay_0 reflectionRay_0; TraceRay_0(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, reflectionRay_0); + +#line 117 imageStore((outputImage_0), ivec2((uvec2(launchID_0))), vec4(color_2 + reflectionRay_0.color_1, 1.0)); return; } + diff --git a/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl b/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl index 166d19537..bb605a14a 100644 --- a/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl +++ b/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl @@ -3,6 +3,8 @@ #extension GL_EXT_ray_query : require layout(row_major) uniform; layout(row_major) buffer; + +#line 89 "tests/pipeline/ray-tracing/trace-ray-inline.slang" struct SLANG_ParameterGroup_C_0 { vec3 origin_0; @@ -14,151 +16,276 @@ struct SLANG_ParameterGroup_C_0 uint shouldStopAtFirstHit_0; }; + +#line 89 layout(binding = 1) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; -} C_0; + vec3 origin_0; + float tMin_0; + vec3 direction_0; + float tMax_0; + uint rayFlags_0; + uint instanceMask_0; + uint shouldStopAtFirstHit_0; +}C_0; + +#line 12 layout(binding = 0) uniform accelerationStructureEXT myAccelerationStructure_0; + +#line 59 struct MyProceduralHitAttrs_0 { int value_0; }; + +#line 81 bool myProceduralIntersection_0(inout float tHit_0, inout MyProceduralHitAttrs_0 hitAttrs_0) { return true; } + +#line 26 struct MyRayPayload_0 { int value_1; }; + +#line 69 bool myProceduralAnyHit_0(inout MyRayPayload_0 payload_0) { return true; } + +#line 51 bool myTriangleAnyHit_0(inout MyRayPayload_0 payload_1) { return true; } + +#line 40 void myTriangleClosestHit_0(inout MyRayPayload_0 payload_2) { payload_2.value_1 = 1; return; } + +#line 65 void myProceduralClosestHit_0(inout MyRayPayload_0 payload_3, MyProceduralHitAttrs_0 attrs_0) { payload_3.value_1 = attrs_0.value_0; return; } + +#line 33 void myMiss_0(inout MyRayPayload_0 payload_4) { payload_4.value_1 = 0; return; } + +#line 103 layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void main() { + rayQueryEXT query_0; + MyRayPayload_0 payload_5; + +#line 110 payload_5.value_1 = -1; - rayQueryInitializeEXT((query_0), (myAccelerationStructure_0), (C_0._data.rayFlags_0 | 512), (C_0._data.instanceMask_0), (C_0._data.origin_0), (C_0._data.tMin_0), (C_0._data.direction_0), (C_0._data.tMax_0)); + + rayQueryInitializeEXT((query_0), (myAccelerationStructure_0), (C_0.rayFlags_0 | 512), (C_0.instanceMask_0), (C_0.origin_0), (C_0.tMin_0), (C_0.direction_0), (C_0.tMax_0)); + +#line 112 MyProceduralHitAttrs_0 committedProceduralAttrs_0; + +#line 112 for(;;) { + +#line 121 bool _S2 = rayQueryProceedEXT(query_0); + +#line 121 if(!_S2) { + +#line 121 break; } uint _S3 = (rayQueryGetIntersectionTypeEXT((query_0), false)); + +#line 123 MyProceduralHitAttrs_0 committedProceduralAttrs_1; + +#line 123 switch(_S3) { case 1U: { MyProceduralHitAttrs_0 candidateProceduralAttrs_0; + +#line 127 candidateProceduralAttrs_0.value_0 = 0; float tHit_1 = 0.0; bool _S4 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0); + +#line 129 if(_S4) { bool _S5 = myProceduralAnyHit_0(payload_5); + +#line 131 if(_S5) { rayQueryGenerateIntersectionEXT(query_0, tHit_1); MyProceduralHitAttrs_0 _S6 = candidateProceduralAttrs_0; - if(C_0._data.shouldStopAtFirstHit_0 != 0U) + if(C_0.shouldStopAtFirstHit_0 != 0U) { + +#line 136 rayQueryTerminateEXT(query_0); + +#line 135 } + else + { + +#line 135 + } + +#line 135 committedProceduralAttrs_1 = _S6; + +#line 135 } else { + +#line 135 committedProceduralAttrs_1 = committedProceduralAttrs_0; + +#line 135 } + +#line 135 } else { + +#line 135 committedProceduralAttrs_1 = committedProceduralAttrs_0; + +#line 135 } + +#line 135 break; } case 0U: { + +#line 144 bool _S7 = myTriangleAnyHit_0(payload_5); + +#line 144 if(_S7) { rayQueryConfirmIntersectionEXT(query_0); - if(C_0._data.shouldStopAtFirstHit_0 != 0U) + if(C_0.shouldStopAtFirstHit_0 != 0U) { + +#line 148 rayQueryTerminateEXT(query_0); + +#line 147 } + else + { + +#line 147 + } + +#line 144 } + else + { + +#line 144 + } + +#line 144 committedProceduralAttrs_1 = committedProceduralAttrs_0; + +#line 144 break; } default: { + +#line 144 committedProceduralAttrs_1 = committedProceduralAttrs_0; + +#line 144 break; } } + +#line 119 committedProceduralAttrs_0 = committedProceduralAttrs_1; + +#line 119 } + +#line 158 uint _S8 = (rayQueryGetIntersectionTypeEXT((query_0), true)); + +#line 158 switch(_S8) { case 1U: { + +#line 161 myTriangleClosestHit_0(payload_5); break; } case 2U: { + +#line 165 myProceduralClosestHit_0(payload_5, committedProceduralAttrs_0); break; } case 0U: { + +#line 169 myMiss_0(payload_5); break; } default: { + +#line 170 break; } } + +#line 172 return; } + diff --git a/tests/vkray/anyhit.slang.glsl b/tests/vkray/anyhit.slang.glsl index 345dd6624..9d3584e1f 100644 --- a/tests/vkray/anyhit.slang.glsl +++ b/tests/vkray/anyhit.slang.glsl @@ -11,7 +11,7 @@ struct Params_0 layout(binding = 0) layout(std140) uniform _S1 { - Params_0 _data; + int mode_0; } gParams_0; layout(binding = 1) @@ -34,7 +34,7 @@ rayPayloadInEXT ShadowRay_0 _S3; void main() { - if(gParams_0._data.mode_0 != 0) + if(gParams_0.mode_0 != 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 885c78dfa..a42e6eaf3 100644 --- a/tests/vkray/callable-caller.slang.glsl +++ b/tests/vkray/callable-caller.slang.glsl @@ -20,7 +20,7 @@ struct SLANG_ParameterGroup_C_0 layout(binding = 0) layout(std140) uniform _S1 { - SLANG_ParameterGroup_C_0 _data; + uint shaderIndex_0; } C_0; void CallShader_0(uint shaderIndex_1, inout MaterialPayload_0 payload_0) { @@ -42,7 +42,7 @@ void main() vec2 _S3 = vec2(_S2.xy); uvec3 _S4 = ((gl_LaunchSizeNV)); payload_1.uv_0 = _S3 / vec2(_S4.xy); - CallShader_0(C_0._data.shaderIndex_0, payload_1); + CallShader_0(C_0.shaderIndex_0, payload_1); uvec3 _S5 = ((gl_LaunchIDNV)); imageStore((gImage_0), ivec2((_S5.xy)), payload_1.albedo_0); return; diff --git a/tests/vkray/closesthit.slang.glsl b/tests/vkray/closesthit.slang.glsl index b5daef909..6094b3a3d 100644 --- a/tests/vkray/closesthit.slang.glsl +++ b/tests/vkray/closesthit.slang.glsl @@ -23,7 +23,7 @@ struct SLANG_ParameterGroup_ShaderRecord_0 layout(shaderRecordNV) buffer tmp_shaderrecord { - SLANG_ParameterGroup_ShaderRecord_0 _data; + uint shaderRecordID_0; } ShaderRecord_0; layout(std430, binding = 0) readonly buffer tmp_colors @@ -59,7 +59,7 @@ void main() uint tmp_add_1 = tmp_add_0 + tmp_primid; uint tmp_hitkind = gl_HitKindNV; - vec4 color_1 = colors_0._data[tmp_add_1 + tmp_hitkind + ShaderRecord_0._data.shaderRecordID_0]; + vec4 color_1 = colors_0._data[tmp_add_1 + tmp_hitkind + ShaderRecord_0.shaderRecordID_0]; float tmp_hitt = gl_RayTmaxNV; float tmp_tmin = gl_RayTminNV; diff --git a/tests/vkray/entry-point-params.slang.glsl b/tests/vkray/entry-point-params.slang.glsl index f4531ea84..00d2ba630 100644 --- a/tests/vkray/entry-point-params.slang.glsl +++ b/tests/vkray/entry-point-params.slang.glsl @@ -27,12 +27,12 @@ struct EntryPointParams_0 layout(shaderRecordEXT) buffer _S2 { - EntryPointParams_0 _data; + float value_0; } _S3; void main() { uvec3 _S4 = gl_LaunchIDEXT; - buffer_0._data[_S4.x] = _S3._data.value_0; + buffer_0._data[_S4.x] = _S3.value_0; return; } diff --git a/tests/vkray/intersection.slang.glsl b/tests/vkray/intersection.slang.glsl index ac95432dd..1a08401af 100644 --- a/tests/vkray/intersection.slang.glsl +++ b/tests/vkray/intersection.slang.glsl @@ -17,7 +17,7 @@ struct SLANG_ParameterGroup_U_0 layout(binding = 0) layout(std140) uniform _S1 { - SLANG_ParameterGroup_U_0 _data; + Sphere_0 gSphere_0; } U_0; struct RayDesc_0 { @@ -62,7 +62,7 @@ void main() 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); + bool _S7 = rayIntersectsSphere_0(ray_1, U_0.gSphere_0, tHit_2, attrs_1); if(_S7) { bool _S8 = ReportHit_0(tHit_2, uint(0), attrs_1); diff --git a/tests/vkray/raygen.slang.glsl b/tests/vkray/raygen.slang.glsl index 8bc9356a2..28bd5956b 100644 --- a/tests/vkray/raygen.slang.glsl +++ b/tests/vkray/raygen.slang.glsl @@ -45,7 +45,10 @@ struct Uniforms_0 layout(binding = 3) layout(std140) uniform _S1 { - Uniforms_0 _data; + Light_0 light_0; + vec4 viewPos_0; + mat4x4 view_0; + mat4x4 model_0; } ubo_0; struct RayDesc_0 { @@ -99,7 +102,7 @@ void main() vec4 _S10 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); vec3 N_0 = _S10.xyz * 2.0 - 1.0; - vec3 lightDelta_0 = ubo_0._data.light_0.position_0.xyz - P_0; + vec3 lightDelta_0 = ubo_0.light_0.position_0.xyz - P_0; float lightDist_0 = length(lightDelta_0); vec3 L_0 = normalize(lightDelta_0); float _S11 = 1.0 / (lightDist_0 * lightDist_0); @@ -121,7 +124,7 @@ void main() { atten_0 = _S11; } - vec3 color_2 = ubo_0._data.light_0.color_0.xyz * saturate_0(dot(N_0, L_0)) * atten_0; + vec3 color_2 = ubo_0.light_0.color_0.xyz * saturate_0(dot(N_0, L_0)) * atten_0; ReflectionRay_0 reflectionRay_0; TraceRay_1(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, reflectionRay_0); |
