summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-10 14:59:05 -0700
committerGitHub <noreply@github.com>2023-08-10 14:59:05 -0700
commit756fdb450739c9ac9aaf54a8d7a4def7408975ca (patch)
treecb226dc510584e455430b6e8d2ab791a0e686c07 /tests
parent38b0af3537f5d8412f0d69e39e38c5603ff62c15 (diff)
Fix `Texture2D.Load()` with offset. (#3094)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-3085.slang29
-rw-r--r--tests/bugs/texture-array-samplecmplevelzero.slang23
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/bugs/gh-3085.slang b/tests/bugs/gh-3085.slang
new file mode 100644
index 000000000..9250d501d
--- /dev/null
+++ b/tests/bugs/gh-3085.slang
@@ -0,0 +1,29 @@
+//TEST:SIMPLE(filecheck=CHECK): -entry MainCs -stage compute -profile glsl_450 -target spirv
+//CHECK: EntryPoint
+
+RWTexture2D<float4> g_Test;
+
+Texture2D<float4> g_inoutColorReadonly;
+
+[ForceInline] float3 LoadSourceColor(uint2 pixelPos, constexpr int2 offset, int sampleIndex)
+{
+ float3 color = g_inoutColorReadonly.Load(int3(pixelPos, 0), offset).rgb;
+
+ return color;
+}
+
+[numthreads(16, 16, 1)]
+void MainCs(uint3 groupID: SV_GroupID, uint3 groupThreadID: SV_GroupThreadID)
+{
+
+ uint2 pixelPos = groupID.xy * int2((16 - 2), (16 - 2)) + groupThreadID.xy - int2(1, 1);
+ float3 color = LoadSourceColor(pixelPos, int2(0, 0), 0).rgb;
+
+ // Note this also doesn't work
+ //[unroll]
+ // for ( int i = 0; i < 3; i++ )
+ //{
+ // color+= LoadSourceColor ( pixelPos , int2 ( i%3 , i/3 ) , msaaSampleIndex ) . rgb ;
+ //}
+ g_Test[int2(pixelPos.x / 2, pixelPos.y + 0)] = float4(color, 1.0);
+} \ No newline at end of file
diff --git a/tests/bugs/texture-array-samplecmplevelzero.slang b/tests/bugs/texture-array-samplecmplevelzero.slang
new file mode 100644
index 000000000..6176f74dc
--- /dev/null
+++ b/tests/bugs/texture-array-samplecmplevelzero.slang
@@ -0,0 +1,23 @@
+//TEST_DISABLED:SIMPLE(filecheck=CHECK): -entry MainPs -stage fragment -profile glsl_450 -target spirv
+//CHECK: EntryPoint
+
+SamplerComparisonState g_tSFMShadowDepthTexture_sampler;
+Texture2DArray g_tSFMShadowDepthTexture;
+
+struct PS_INPUT
+{
+ float3 vTexCoord : TEXCOORD0;
+};
+
+struct PS_OUTPUT
+{
+ float4 vColor : SV_Target0;
+};
+
+PS_OUTPUT MainPs ( PS_INPUT i )
+{
+ PS_OUTPUT o;
+ float flDepth = 0.5;
+ o.vColor = g_tSFMShadowDepthTexture.SampleCmpLevelZero ( g_tSFMShadowDepthTexture_sampler, i.vTexCoord.xyz, flDepth ).rrrr;
+ return o;
+} \ No newline at end of file