summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bindings/glsl-parameter-blocks.slang.glsl21
-rw-r--r--tests/bugs/gh-941.slang.glsl24
-rw-r--r--tests/compute/texture-simpler.slang7
-rw-r--r--tests/cross-compile/non-uniform-indexing.slang.glsl16
-rw-r--r--tests/cross-compile/vk-texture-indexing.slang.glsl16
-rw-r--r--tests/expected-failure.txt6
-rw-r--r--tests/language-feature/1-vector.slang19
-rw-r--r--tests/language-feature/spirv-asm/truncate.slang62
-rw-r--r--tests/legalization/vec1.slang93
-rw-r--r--tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl87
-rw-r--r--tests/vkray/anyhit.slang.glsl14
-rw-r--r--tests/vkray/callable.slang.glsl27
-rw-r--r--tests/vkray/raygen.slang.glsl20
13 files changed, 222 insertions, 190 deletions
diff --git a/tests/bindings/glsl-parameter-blocks.slang.glsl b/tests/bindings/glsl-parameter-blocks.slang.glsl
index fbeddb905..c00ed8fe3 100644
--- a/tests/bindings/glsl-parameter-blocks.slang.glsl
+++ b/tests/bindings/glsl-parameter-blocks.slang.glsl
@@ -1,50 +1,31 @@
#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
{
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)));
-
-#line 14
- _S2 = gTest_0.a_0 + _S4;
-
-#line 14
+ _S2 = gTest_0.a_0 + (texture(sampler2D(gTest_t_0,gTest_s_0), (_S3)));
return;
}
diff --git a/tests/bugs/gh-941.slang.glsl b/tests/bugs/gh-941.slang.glsl
index 4330ece53..111cdb33c 100644
--- a/tests/bugs/gh-941.slang.glsl
+++ b/tests/bugs/gh-941.slang.glsl
@@ -1,9 +1,7 @@
-//TEST_IGNORE_FILE:
-
#version 450
-
#extension GL_EXT_nonuniform_qualifier : require
-
+layout(row_major) uniform;
+layout(row_major) buffer;
struct SLANG_ParameterGroup_C_0
{
vec2 uv_0;
@@ -11,15 +9,13 @@ struct SLANG_ParameterGroup_C_0
};
layout(binding = 2)
-layout(std140)
-uniform _S1
+layout(std140) uniform _S1
{
vec2 uv_0;
uint index_0;
-} C_0;
-
+}C_0;
layout(binding = 0)
-uniform texture2D t_0[];
+uniform texture2D t_0[];
layout(binding = 1)
uniform sampler s_0;
@@ -29,11 +25,7 @@ out vec4 _S2;
void main()
{
- vec4 _S3 = texture(
- sampler2D(
- t_0[C_0.index_0],
- s_0),
- C_0.uv_0);
- _S2 = _S3;
+ _S2 = (texture(sampler2D(t_0[C_0.index_0],s_0), (C_0.uv_0)));
return;
-} \ No newline at end of file
+}
+
diff --git a/tests/compute/texture-simpler.slang b/tests/compute/texture-simpler.slang
index ce4b76f77..18af1cd62 100644
--- a/tests/compute/texture-simpler.slang
+++ b/tests/compute/texture-simpler.slang
@@ -1,4 +1,9 @@
-//TEST(compute, vulkan):COMPARE_COMPUTE:-vk -compute -shaderobj -output-using-type
+//TEST(smoke,compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type
+//TEST(smoke,compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
+//TEST(smoke,compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj -output-using-type
+//TEST(smoke,compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -use-dxil -shaderobj -output-using-type
+//TEST(smoke,compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -render-feature hardware-device
+//TEST(smoke,compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type
//TEST_INPUT: Texture2D(size=4, content = one):name t2D
Texture2D<float> t2D;
diff --git a/tests/cross-compile/non-uniform-indexing.slang.glsl b/tests/cross-compile/non-uniform-indexing.slang.glsl
index 96abe6bac..07e8f9e38 100644
--- a/tests/cross-compile/non-uniform-indexing.slang.glsl
+++ b/tests/cross-compile/non-uniform-indexing.slang.glsl
@@ -1,10 +1,9 @@
-//TEST_IGNORE_FILE
#version 450
-
#extension GL_EXT_nonuniform_qualifier : require
-
+layout(row_major) uniform;
+layout(row_major) buffer;
layout(binding = 0)
-uniform texture2D t_0[10];
+uniform texture2D t_0[10];
layout(binding = 1)
uniform sampler s_0;
@@ -17,12 +16,7 @@ in vec3 _S2;
void main()
{
- vec4 _S3 = texture(
- sampler2D(
- t_0[nonuniformEXT(int(_S2.z))],
- s_0),
- _S2.xy);
-
- _S1 = _S3;
+ _S1 = (texture(sampler2D(t_0[nonuniformEXT(int(_S2.z))],s_0), (_S2.xy)));
return;
}
+
diff --git a/tests/cross-compile/vk-texture-indexing.slang.glsl b/tests/cross-compile/vk-texture-indexing.slang.glsl
index 73513c623..7fd768465 100644
--- a/tests/cross-compile/vk-texture-indexing.slang.glsl
+++ b/tests/cross-compile/vk-texture-indexing.slang.glsl
@@ -3,31 +3,23 @@
#extension GL_EXT_nonuniform_qualifier : require
layout(row_major) uniform;
layout(row_major) buffer;
-
layout(binding = 0)
uniform texture2D gParams_textures_0[10];
-
float fetchData_0(uvec2 coords_0, uint index_0)
{
- float _S1 = (texelFetch((gParams_textures_0[nonuniformEXT(index_0)]), ivec2((coords_0)), 0).x);
-
- return _S1;
+ return (texelFetch((gParams_textures_0[nonuniformEXT(index_0)]), ivec2((coords_0)), 0).x);
}
layout(location = 0)
-out vec4 _S2;
-
+out vec4 _S1;
flat layout(location = 0)
-in uvec3 _S3;
-
+in uvec3 _S2;
void main()
{
-
- _S2 = vec4(fetchData_0(_S3.xy, _S3.z));
-
+ _S1 = vec4(fetchData_0(_S2.xy, _S2.z));
return;
}
diff --git a/tests/expected-failure.txt b/tests/expected-failure.txt
index 3e158e2d1..df773a46b 100644
--- a/tests/expected-failure.txt
+++ b/tests/expected-failure.txt
@@ -2,13 +2,7 @@ tests/autodiff/global-param-hoisting.slang.1 (vk)
tests/bugs/buffer-swizzle-store.slang.1 (vk)
tests/bugs/gh-3075.slang.2 (vk)
tests/bugs/ray-query-in-generic.slang.1 (vk)
-tests/compute/half-rw-texture-convert.slang.4 (vk)
-tests/compute/half-rw-texture-convert2.slang.4 (vk)
tests/compute/ray-tracing-inline.slang.1 (vk)
-tests/compute/rw-texture-simple.slang.4 (vk)
-tests/compute/texture-sample-grad-offset-clamp.slang (vk)
-tests/compute/texture-simple.slang.4 (vk)
-tests/compute/texture-simpler.slang (vk)
tests/language-feature/constants/constexpr-loop.slang.1 (vk)
tests/optimization/func-resource-result/func-resource-result-complex.slang.1 (vk)
tests/type/texture-sampler/texture-sampler-2d.slang (vk)
diff --git a/tests/language-feature/1-vector.slang b/tests/language-feature/1-vector.slang
new file mode 100644
index 000000000..bb8cedf3c
--- /dev/null
+++ b/tests/language-feature/1-vector.slang
@@ -0,0 +1,19 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -use-dxil -shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj
+
+//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+// CHECK: 0
+// CHECK-NEXT: 1
+// CHECK-NEXT: 2
+// CHECK-NEXT: 3
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ vector<int,1> i = vector<int,1>(dispatchThreadID.x);
+ outputBuffer[i.x] = i.x;
+}
diff --git a/tests/language-feature/spirv-asm/truncate.slang b/tests/language-feature/spirv-asm/truncate.slang
new file mode 100644
index 000000000..9837890f5
--- /dev/null
+++ b/tests/language-feature/spirv-asm/truncate.slang
@@ -0,0 +1,62 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj -emit-spirv-directly -output-using-type
+
+//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+// CHECK: 8
+// CHECK-NEXT: 13
+// CHECK-NEXT: 18
+// CHECK-NEXT: 23
+
+//
+// This test tests the __truncate operator
+//
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int i = dispatchThreadID.x;
+ int n = outputBuffer[i];
+
+ int scalar = n;
+
+ // 1-vectors are not valid in SPIR-V
+ // vector<int, 1> vector1 = vector<int, 1>(n);
+
+ vector<int, 4> vector4 = n + vector<int, 4>(0,1,2,3);
+ //int expected = 0 + n + n + (n + (n+1) + (n+2));
+
+ int r = 0;
+ spirv_asm
+ {
+ // scalar to scalar
+ __truncate $$int %a1 $$int $scalar;
+ %r1 : $$int = OpIAdd %a1 $r;
+
+ // scalar to 1-vector
+ // __truncate $$vector<int,1> %a2 $$int $scalar;
+ // %x1 : $$int = OpCompositeExtract %a2 0;
+ // %r2 : $$int = OpIAdd %x1 %r1;
+ %r2 : $$int = OpCopyObject %r1;
+
+ // 1-vector to scalar
+ // __truncate $$int %a3 $$vector<int,1> $vector1;
+ // %r3 : $$int = OpIAdd %a3 %r2;
+ %r3 : $$int = OpCopyObject %r2;
+
+ // n-vector to scalar
+ __truncate $$int %a4 $$vector<int,4> $vector4;
+ %r4 : $$int = OpIAdd %a4 %r3;
+
+ // n-vector to m-vector
+ __truncate $$vector<int,3> %a5 $$vector<int,4> $vector4;
+ %x2 : $$int = OpCompositeExtract %a5 0;
+ %x3 : $$int = OpCompositeExtract %a5 1;
+ %x4 : $$int = OpCompositeExtract %a5 2;
+ %r5 : $$int = OpIAdd %x2 %r4;
+ %r6 : $$int = OpIAdd %x3 %r5;
+ %r7 : $$int = OpIAdd %x4 %r6;
+
+ OpStore &r %r7
+ };
+ outputBuffer[i] = r;
+}
diff --git a/tests/legalization/vec1.slang b/tests/legalization/vec1.slang
new file mode 100644
index 000000000..f3de085b0
--- /dev/null
+++ b/tests/legalization/vec1.slang
@@ -0,0 +1,93 @@
+//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj -output-using-type
+//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj -emit-spirv-directly -output-using-type
+
+// CHECK: 23
+// CHECK-NEXT: 23
+// CHECK-NEXT: 23
+// CHECK-NEXT: 23
+
+// This test tests that the 1-vector legalization works correctly.
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+// This struct helps test that nested access through 1-vectors works
+struct V
+{
+ // 1-vector of 1-vector
+ vector<vector<float, 1>, 1> oo;
+
+ // 1-vector of n-vector
+ vector<vector<float, 4>, 1> on;
+
+ // n-vector of 1-vector
+ vector<vector<float, 1>, 4> no;
+};
+
+vector<int, 1> get1Vec(int x)
+{
+ return x;
+}
+
+V getV()
+{
+ V v;
+
+ // Test swizzle store
+ v.oo.x.x = 1;
+
+ // Test assigning into subscript
+ v.on[0].wzyx = float4(4,3,2,1);
+
+ // Test assigning from vector
+ v.no.x = vector<float, 1>(1);
+
+ // Test assigning from scalar
+ v.no.y.x = 2;
+
+ // Test assigning from vector of vector
+ v.no.wz = vector<vector<float, 1>, 2>(3,4);
+
+ return v;
+}
+
+float sumV(V v)
+{
+ return v.oo[0][0]
+ + v.on.x.x
+ + v.on.x.y
+ + v.on.x.z
+ + v.on.x.w
+ // Test arithmetic
+ + (v.no.x + v.no.y + v.no.z + v.no.w).x;
+}
+
+float3 splat(vector<float, 1> v)
+{
+ // Test swizzle
+ return v.xxx;
+}
+
+// This function helps test that this legalization happens with generic length
+// vectors specialized to 1
+float triangle<let N : int>()
+{
+ vector<float, N> v;
+ for(int i = 0; i < N; ++i)
+ v[i] = i+1;
+
+ float ret = 0;
+ for(int i = 0; i < N; ++i)
+ ret += v[i];
+ return ret;
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ const V v = getV();
+ outputBuffer[dispatchThreadID.x]
+ = sumV(v)
+ + triangle<1>()
+ + splat(v.oo.x).z;
+}
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 7f734bf75..744ee2f44 100644
--- a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl
+++ b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl
@@ -3,18 +3,12 @@
#extension GL_NV_ray_tracing_motion_blur : require
layout(row_major) uniform;
layout(row_major) buffer;
-
-#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;
@@ -24,8 +18,6 @@ struct Light_0
vec4 color_0;
};
-
-#line 14
struct Uniforms_0
{
Light_0 light_0;
@@ -34,8 +26,6 @@ struct Uniforms_0
mat4x4 model_0;
};
-
-#line 21
layout(binding = 3)
layout(std140) uniform _S1
{
@@ -44,45 +34,31 @@ layout(std140) uniform _S1
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;
@@ -91,115 +67,60 @@ 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;
}
-
-#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;
}
-
-#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 P_0 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))).xyz;
+ vec3 N_0 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))).xyz * 2.0 - 1.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);
-
+ float _S4 = 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
+ atten_0 = _S4;
}
-
-#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/vkray/anyhit.slang.glsl b/tests/vkray/anyhit.slang.glsl
index 9d3584e1f..8255599b9 100644
--- a/tests/vkray/anyhit.slang.glsl
+++ b/tests/vkray/anyhit.slang.glsl
@@ -1,4 +1,3 @@
-// anyhit.slang.glsl
#version 460
#extension GL_EXT_ray_tracing : require
layout(row_major) uniform;
@@ -12,8 +11,7 @@ layout(binding = 0)
layout(std140) uniform _S1
{
int mode_0;
-} gParams_0;
-
+}gParams_0;
layout(binding = 1)
uniform texture2D gParams_alphaMap_0;
@@ -24,24 +22,21 @@ struct SphereHitAttributes_0
{
vec3 normal_0;
};
+
hitAttributeEXT SphereHitAttributes_0 _S2;
struct ShadowRay_0
{
vec4 hitDistance_0;
};
+
rayPayloadInEXT ShadowRay_0 _S3;
void main()
{
if(gParams_0.mode_0 != 0)
{
- float val_0 = textureLod(
- sampler2D(gParams_alphaMap_0, gParams_sampler_0),
- _S2.normal_0.xy,
- (0.0)).x;
-
- if(val_0 > 0.0)
+ if((textureLod(sampler2D(gParams_alphaMap_0,gParams_sampler_0), (_S2.normal_0.xy), (0.0)).x) > 0.0)
{
terminateRayEXT;;
}
@@ -50,7 +45,6 @@ void main()
ignoreIntersectionEXT;;
}
}
-
return;
}
diff --git a/tests/vkray/callable.slang.glsl b/tests/vkray/callable.slang.glsl
index dd99cc440..871ffcbb7 100644
--- a/tests/vkray/callable.slang.glsl
+++ b/tests/vkray/callable.slang.glsl
@@ -1,18 +1,12 @@
#version 460
-
-#if USE_NV_RT
-#extension GL_NV_ray_tracing : require
-#define callableDataInEXT callableDataInNV
-#define hitAttributeEXT hitAttributeNV
-#define ignoreIntersectionEXT ignoreIntersectionNV
-#define rayPayloadInEXT rayPayloadInNV
-#define terminateRayEXT terminateRayNV
-#else
#extension GL_EXT_ray_tracing : require
-#endif
+layout(row_major) uniform;
+layout(row_major) buffer;
+layout(binding = 0)
+uniform texture2D gAlbedoMap_0;
-layout(binding = 0) uniform texture2D gAlbedoMap_0;
-layout(binding = 1) uniform sampler gSampler_0;
+layout(binding = 1)
+uniform sampler gSampler_0;
struct MaterialPayload_0
{
@@ -24,12 +18,7 @@ callableDataInEXT MaterialPayload_0 _S1;
void main()
{
- vec4 _S2 = textureLod(
- sampler2D(gAlbedoMap_0,gSampler_0),
- _S1.uv_0,
- float(0));
-
- _S1.albedo_0 = _S2;
-
+ _S1.albedo_0 = (textureLod(sampler2D(gAlbedoMap_0,gSampler_0), (_S1.uv_0), (0.0)));
return;
}
+
diff --git a/tests/vkray/raygen.slang.glsl b/tests/vkray/raygen.slang.glsl
index 69dc74c53..80a63d5ad 100644
--- a/tests/vkray/raygen.slang.glsl
+++ b/tests/vkray/raygen.slang.glsl
@@ -10,6 +10,7 @@ uniform sampler sampler_0;
layout(binding = 1)
uniform texture2D samplerNormal_0;
+
struct Light_0
{
vec4 position_0;
@@ -95,23 +96,18 @@ void main()
uvec3 _S6 = ((gl_LaunchIDEXT));
float _S7 = float(_S6.y) + 0.5;
uvec3 _S8 = ((gl_LaunchSizeEXT));
-
vec2 inUV_0 = vec2(_S5, _S7 / float(_S8.y));
- vec4 _S9 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0)));
- vec3 P_0 = _S9.xyz;
- vec4 _S10 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0)));
- vec3 N_0 = _S10.xyz * 2.0 - 1.0;
-
+ vec3 P_0 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))).xyz;
+ vec3 N_0 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))).xyz * 2.0 - 1.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);
+ float _S9 = 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;
TraceRay_0(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, shadowRay_0);
@@ -122,14 +118,14 @@ void main()
}
else
{
- atten_0 = _S11;
+ atten_0 = _S9;
}
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);
vec3 color_3 = color_2 + reflectionRay_0.color_1;
- uvec3 _S12 = ((gl_LaunchIDEXT));
- imageStore((outputImage_0), ivec2((uvec2(ivec2(_S12.xy)))), vec4(color_3, 1.0));
+ uvec3 _S10 = ((gl_LaunchIDEXT));
+ imageStore((outputImage_0), ivec2((uvec2(ivec2(_S10.xy)))), vec4(color_3, 1.0));
return;
}
+