diff options
| author | Yong He <yonghe@outlook.com> | 2023-11-16 14:32:33 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-16 14:32:33 -0800 |
| commit | 4c78efd0c34442866f20e9d00bbb6908115c9a01 (patch) | |
| tree | 03ca8584847f0937a926f6b27386dcd982ed7780 /tests | |
| parent | 12f7237e4060388494c549623f4a640327b7ca08 (diff) | |
Unify stdlib `Texture` types into one generic type. (#3327)
* Unify Texture types in stdlib into 1 generic type.
* Fixes.
* Fix.
* Fixes.
* Fix reflection.
* Fix binding reflection.
* Add gather intrinsics.
* Fix gather intrinsics.
* Fix texture type toText.
* Fix intrinsic.
* fix cuda intrinsic.
* Fix project files.
* cleanup.
* Fix.
* Fix.
* Fix sampler feedback test.
* Fix getDimension intrinsics.
* Fix spirv sample image intrinsics.
* Fix test.
* Fix GLSL intrinsic.
* Cleanup.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/vk-image-write.slang | 5 | ||||
| -rw-r--r-- | tests/bugs/vk-image-write.slang.glsl | 3 | ||||
| -rw-r--r-- | tests/compute/half-texture.slang | 5 | ||||
| -rw-r--r-- | tests/compute/half-texture.slang.glsl | 26 | ||||
| -rw-r--r-- | tests/cross-compile/glsl-samplecmplevelzero.slang | 4 | ||||
| -rw-r--r-- | tests/cross-compile/glsl-texturegather.slang | 11 | ||||
| -rw-r--r-- | tests/cross-compile/image-load.slang | 8 | ||||
| -rw-r--r-- | tests/cross-compile/vk-texture-indexing.slang | 5 | ||||
| -rw-r--r-- | tests/glsl/basic-fragment-2.slang | 2 | ||||
| -rw-r--r-- | tests/glsl/flat-in.slang | 1 | ||||
| -rw-r--r-- | tests/glsl/matrix-mul.slang | 1 | ||||
| -rw-r--r-- | tests/glsl/out-builtin-block-redeclaration.slang | 1 | ||||
| -rw-r--r-- | tests/glsl/struct-construct.slang | 1 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected | 8 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/texture/gather-texture2darray.slang | 13 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/texture/texture-sample-count.slang | 16 |
16 files changed, 66 insertions, 44 deletions
diff --git a/tests/bugs/vk-image-write.slang b/tests/bugs/vk-image-write.slang index 10141384c..ce13ebf6a 100644 --- a/tests/bugs/vk-image-write.slang +++ b/tests/bugs/vk-image-write.slang @@ -1,4 +1,5 @@ -//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly +//TEST:SIMPLE(filecheck=CHECK): -profile ps_5_0 -entry main -target spirv-assembly +//TEST:SIMPLE(filecheck=CHECK): -profile ps_5_0 -entry main -target spirv-assembly -emit-spirv-directly // Ensure that we can lower to `imageStore` correctly. @@ -11,6 +12,8 @@ void writeColor(float3 v) float4 main() : SV_Target { + // CHECK: OpImageRead + // CHECK: OpImageWrite writeColor(float3(1.0)); return float4(0); } diff --git a/tests/bugs/vk-image-write.slang.glsl b/tests/bugs/vk-image-write.slang.glsl index 7b9bcebf9..7145c0e08 100644 --- a/tests/bugs/vk-image-write.slang.glsl +++ b/tests/bugs/vk-image-write.slang.glsl @@ -36,5 +36,4 @@ void main() writeColor_0(vec3(1.00000000000000000000)); _S7 = vec4(0); return; -} - +}
\ No newline at end of file diff --git a/tests/compute/half-texture.slang b/tests/compute/half-texture.slang index 6f131c568..c87f4359c 100644 --- a/tests/compute/half-texture.slang +++ b/tests/compute/half-texture.slang @@ -29,8 +29,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) half h = halfTexture[pos2]; half2 h2 = halfTexture2[pos2]; half4 h4 = halfTexture4[pos2]; -#endif - +#endif // Store a results halfTexture[pos] = h2.x + h2.y; halfTexture2[pos] = h4.xy; @@ -38,4 +37,4 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) int index = pos.x + pos.y * 4; outputBuffer[index] = index; -}
\ No newline at end of file +} diff --git a/tests/compute/half-texture.slang.glsl b/tests/compute/half-texture.slang.glsl index 16ff4d6e1..5e273234d 100644 --- a/tests/compute/half-texture.slang.glsl +++ b/tests/compute/half-texture.slang.glsl @@ -26,25 +26,23 @@ void main() { ivec2 pos_0 = ivec2(gl_GlobalInvocationID.xy); - int _S2 = pos_0.y; + int _S1 = pos_0.y; - int _S3 = pos_0.x; + int _S2 = pos_0.x; - uvec2 _S4 = uvec2(ivec2(3 - _S2, 3 - _S3)); + ivec2 _S3 = ivec2(uvec2(ivec2(3 - _S1, 3 - _S2))); - float16_t h_0 = (float16_t(imageLoad((halfTexture_0), ivec2((_S4))).x)); - f16vec2 h2_0 = (f16vec2(imageLoad((halfTexture2_0), ivec2((_S4))).xy)); - f16vec4 h4_0 = (f16vec4(imageLoad((halfTexture4_0), ivec2((_S4))))); + float16_t _S4 = (float16_t(imageLoad((halfTexture_0), (_S3)).x)); + f16vec2 _S5 = (f16vec2(imageLoad((halfTexture2_0), (_S3)).xy)); + f16vec4 _S6 = (f16vec4(imageLoad((halfTexture4_0), (_S3)))); + ivec2 _S7 = ivec2(uvec2(pos_0)); + imageStore((halfTexture_0), (_S7), f16vec4(_S5.x + _S5.y, float16_t(0), float16_t(0), float16_t(0))); + imageStore((halfTexture2_0), (_S7), f16vec4(_S6.xy, float16_t(0), float16_t(0))); + imageStore((halfTexture4_0), (_S7), f16vec4(_S5, _S4, _S4)); - uvec2 _S5 = uvec2(pos_0); - - imageStore((halfTexture_0), ivec2((_S5)), f16vec4(h2_0.x + h2_0.y, float16_t(0), float16_t(0), float16_t(0))); - imageStore((halfTexture2_0), ivec2((_S5)), f16vec4(h4_0.xy, float16_t(0), float16_t(0))); - imageStore((halfTexture4_0), ivec2((_S5)), f16vec4(h2_0, h_0, h_0)); - - int index_0 = _S3 + _S2 * 4; - ((outputBuffer_0)._data[(uint(index_0))]) = index_0; + int index_0 = _S2 + _S1 * 4; + outputBuffer_0._data[uint(index_0)] = index_0; return; } diff --git a/tests/cross-compile/glsl-samplecmplevelzero.slang b/tests/cross-compile/glsl-samplecmplevelzero.slang index 4bfd557cc..cd2ee54bd 100644 --- a/tests/cross-compile/glsl-samplecmplevelzero.slang +++ b/tests/cross-compile/glsl-samplecmplevelzero.slang @@ -1,7 +1,7 @@ //TEST:CROSS_COMPILE(filecheck=CHECK): -profile ps_5_0 -entry main -target glsl -// CHECK: float _S3 = (textureLod(sampler2DShadow(shadowMap_0,sampler_0), vec3((_S2), (0.0)), 0)); -// CHECK: float _S4 = (textureLodOffset(sampler2DShadow(shadowMap_0,sampler_0), vec3((_S2), (0.0)), 0, (ivec2(1, 1)))); +// CHECK: float _S3 = (textureLod(sampler2DShadow(shadowMap_0,sampler_0), (_S2), 0)); +// CHECK: float _S4 = (textureLodOffset(sampler2DShadow(shadowMap_0,sampler_0), (_S2), 0, (ivec2(1, 1)))); Texture2D shadowMap; SamplerComparisonState sampler; diff --git a/tests/cross-compile/glsl-texturegather.slang b/tests/cross-compile/glsl-texturegather.slang index 125cf6df1..1647faaac 100644 --- a/tests/cross-compile/glsl-texturegather.slang +++ b/tests/cross-compile/glsl-texturegather.slang @@ -1,9 +1,10 @@ -//TEST:CROSS_COMPILE(filecheck=CHECK): -profile ps_5_0 -entry main -target glsl +//TEST:SIMPLE(filecheck=CHECK): -stage fragment -entry main -target spirv -emit-spirv-directly +//TEST:SIMPLE(filecheck=CHECK): -stage fragment -entry main -target spirv -// CHECK: textureGather(sampler2DShadow(t_0,sc_0), (loc_0), (3.0)) -// CHECK: textureGatherOffset(sampler2DShadow(t_0,sc_0), (loc_0), (3.0), (off_0)) -// CHECK: textureGatherOffsets(sampler2DShadow(t_0,sc_0), (loc_0), (3.0), ivec2[]((off_0), (off_0), (off_0), (off_0))) -// CHECK: textureGatherOffsets(sampler2DShadow(t_0,sc_0), (loc_0), (3.0), ivec2[]((ivec2(6, 6)), (ivec2(7, 7)), (ivec2(8, 8)), (ivec2(9, 9)))) +// CHECK: OpImageDrefGather +// CHECK: OpImageDrefGather +// CHECK: OpImageDrefGather +// CHECK: OpImageDrefGather Texture2D t; SamplerState s; diff --git a/tests/cross-compile/image-load.slang b/tests/cross-compile/image-load.slang index dc80288e6..fa1430c38 100644 --- a/tests/cross-compile/image-load.slang +++ b/tests/cross-compile/image-load.slang @@ -4,7 +4,8 @@ // gets properly converted to a call to `imageLoad` // and not just `texelFetch` as it would for a `Texture*`. -//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage compute +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry main -stage compute -emit-spirv-directly +//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry main -stage compute struct Params { @@ -15,5 +16,8 @@ ParameterBlock<Params> gParams; void main(uint3 tid : SV_DispatchThreadID) { - float f = gParams.tex.Load(int3(int2(tid.xy), int(tid.z))); + // CHECK: OpImageRead + // CHECK: OpImageWrite + float f = gParams.tex.Load(int3(int2(tid.xy), int(tid.z))); + gParams.tex[tid] = f + 1.0; } diff --git a/tests/cross-compile/vk-texture-indexing.slang b/tests/cross-compile/vk-texture-indexing.slang index 9a086d5bd..ace0befd5 100644 --- a/tests/cross-compile/vk-texture-indexing.slang +++ b/tests/cross-compile/vk-texture-indexing.slang @@ -1,6 +1,7 @@ // vk-texture-indexing.slang -//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment +//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment +//TEST_DISABLED:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment -emit-spirv-directly struct Params { @@ -19,6 +20,8 @@ float4 main( uint3 uv : UV) : SV_Target { + // CHECK: OpDecorate %{{.*}} NonUniform + // CHECK: OpImageFetch float v = fetchData(uv.xy, uv.z); return v; } diff --git a/tests/glsl/basic-fragment-2.slang b/tests/glsl/basic-fragment-2.slang index c958b54b0..34a364152 100644 --- a/tests/glsl/basic-fragment-2.slang +++ b/tests/glsl/basic-fragment-2.slang @@ -1,5 +1,5 @@ //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage fragment -entry main -allow-glsl - +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage fragment -entry main -allow-glsl -emit-spirv-directly #version 450 core layout(location = 0) out mediump vec4 o_color; layout(location = 0) in highp vec2 v_texCoord; diff --git a/tests/glsl/flat-in.slang b/tests/glsl/flat-in.slang index 4ca68df37..3de50d7ee 100644 --- a/tests/glsl/flat-in.slang +++ b/tests/glsl/flat-in.slang @@ -1,3 +1,4 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage fragment -entry main -allow-glsl -emit-spirv-directly //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage fragment -entry main -allow-glsl #version 310 es diff --git a/tests/glsl/matrix-mul.slang b/tests/glsl/matrix-mul.slang index 6ac6613f2..c87c8ad18 100644 --- a/tests/glsl/matrix-mul.slang +++ b/tests/glsl/matrix-mul.slang @@ -1,3 +1,4 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl -emit-spirv-directly //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl #version 310 es layout(location = 0) in highp vec4 a_position; diff --git a/tests/glsl/out-builtin-block-redeclaration.slang b/tests/glsl/out-builtin-block-redeclaration.slang index 7a2bfc1c9..9e50c5c37 100644 --- a/tests/glsl/out-builtin-block-redeclaration.slang +++ b/tests/glsl/out-builtin-block-redeclaration.slang @@ -1,3 +1,4 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl -emit-spirv-directly //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl #version 450 core diff --git a/tests/glsl/struct-construct.slang b/tests/glsl/struct-construct.slang index a1538ed9b..747c9973c 100644 --- a/tests/glsl/struct-construct.slang +++ b/tests/glsl/struct-construct.slang @@ -1,3 +1,4 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl -emit-spirv-directly //TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl #version 310 es diff --git a/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected b/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected index 1d4dda6b0..3b04fe62a 100644 --- a/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected +++ b/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected @@ -11,7 +11,7 @@ standard output = { "kind": "resource", "baseShape": "texture2D", "feedback": true, - "access": "write", + "access": "feedback", "resultType": { "kind": "Feedback", "name": "SAMPLER_FEEDBACK_MIN_MIP" @@ -25,7 +25,7 @@ standard output = { "kind": "resource", "baseShape": "texture2D", "feedback": true, - "access": "write", + "access": "feedback", "resultType": { "kind": "Feedback", "name": "SAMPLER_FEEDBACK_MIP_REGION_USED" @@ -40,7 +40,7 @@ standard output = { "baseShape": "texture2D", "array": true, "feedback": true, - "access": "write", + "access": "feedback", "resultType": { "kind": "Feedback", "name": "SAMPLER_FEEDBACK_MIN_MIP" @@ -55,7 +55,7 @@ standard output = { "baseShape": "texture2D", "array": true, "feedback": true, - "access": "write", + "access": "feedback", "resultType": { "kind": "Feedback", "name": "SAMPLER_FEEDBACK_MIP_REGION_USED" diff --git a/tests/hlsl-intrinsic/texture/gather-texture2darray.slang b/tests/hlsl-intrinsic/texture/gather-texture2darray.slang index 49ce8e6a1..785305a22 100644 --- a/tests/hlsl-intrinsic/texture/gather-texture2darray.slang +++ b/tests/hlsl-intrinsic/texture/gather-texture2darray.slang @@ -1,10 +1,13 @@ // gather-texture2darray.slang -//TEST:CROSS_COMPILE: -target dxbc -profile sm_5_1 -entry main -stage compute +//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry main -stage compute -emit-spirv-directly +//TEST:SIMPLE(filecheck=DXIL): -target dxil -profile sm_6_1 -entry main -stage compute +//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry main -stage compute // Test gathering from a `Texture2DArray` Texture2DArray<uint> t; +Texture2DArray<float4> t1; SamplerState s; RWBuffer<uint4> b; @@ -12,5 +15,13 @@ RWBuffer<uint4> b; [numthreads(32, 1, 1)] void main(uint3 tid : SV_DispatchThreadID) { + // DXIL: @dx.op.textureGather.i32 + // DXIL: @dx.op.textureGather.f32 + + // SPIRV: OpImageGather + // SPIRV: OpImageGather + b[tid.x] = t.Gather(s, tid); + + b[tid.x] += uint4(t1.Gather(s, tid)); } diff --git a/tests/hlsl-intrinsic/texture/texture-sample-count.slang b/tests/hlsl-intrinsic/texture/texture-sample-count.slang index 59b82fc0b..0af7b92ba 100644 --- a/tests/hlsl-intrinsic/texture/texture-sample-count.slang +++ b/tests/hlsl-intrinsic/texture/texture-sample-count.slang @@ -1,15 +1,15 @@ //TEST:SIMPLE(filecheck=CHECK): -target hlsl -profile sm_6_6 -entry main -stage compute +//TEST:SIMPLE(filecheck=DXIL): -target dxil -profile sm_6_6 -entry main -stage compute -// Test that RWTexture2DMS accepts an optional sampleCount argument +// Test that Texture2DMS accepts an optional sampleCount argument // and the argument correctly appears in the output hlsl. -// CHECK: RWTexture2DMS<uint > t_0 : register(u0); -// CHECK: RWTexture2DMS<uint, 4 > tExplicit_0 : register(u1); -// CHECK: TextureCubeMS<float4, 3 > tCube_0 : register(t0); +// CHECK: Texture2DMS<uint > t_0 : register(t0); +// CHECK: Texture2DMS<uint, 4 > tExplicit_0 : register(t1); +// DXIL: main -RWTexture2DMS<uint> t; -RWTexture2DMS<uint, 4> tExplicit; -TextureCubeMS<float4, 3> tCube; +Texture2DMS<uint> t; +Texture2DMS<uint, 4> tExplicit; SamplerState s; RWBuffer<uint4> b; @@ -18,6 +18,6 @@ RWBuffer<uint4> b; [numthreads(32, 1, 1)] void main(uint3 tid : SV_DispatchThreadID) { - let v = t.Load(int2(0, 0), 1) + tExplicit.Load(int2(1,1),2) + int(tCube.Load(int3(0,0,0), 3).x); + let v = t.Load(int2(0, 0), 1) + tExplicit.Load(int2(1,1),2); b[tid.x] = v; } |
