summaryrefslogtreecommitdiff
path: root/tests/wgsl
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-17 14:37:27 -0800
committerGitHub <noreply@github.com>2025-01-17 14:37:27 -0800
commitfc77070fdc9bfa599e8d66b21743778de3011e53 (patch)
treea9a0983bd704b0e760ae94d5330a74bc72f1154f /tests/wgsl
parent3ff257816fc8f376d9bee76378a690757f8b5377 (diff)
Refactor _Texture to constrain on texel types. (#6115)
* Refactor _Texture to constrain on texel types. * Fix tests. * Fix. * Disable glsl texture test because rhi can't run it correctly.
Diffstat (limited to 'tests/wgsl')
-rw-r--r--tests/wgsl/texture-gather.slang86
-rw-r--r--tests/wgsl/texture-load.slang38
-rw-r--r--tests/wgsl/texture-sampler-less.slang115
-rw-r--r--tests/wgsl/texture-storage.slang41
-rw-r--r--tests/wgsl/texture.slang104
5 files changed, 191 insertions, 193 deletions
diff --git a/tests/wgsl/texture-gather.slang b/tests/wgsl/texture-gather.slang
index b77ec9f8f..d0772994e 100644
--- a/tests/wgsl/texture-gather.slang
+++ b/tests/wgsl/texture-gather.slang
@@ -135,15 +135,15 @@ SamplerState samplerState;
SamplerComparisonState depthSampler;
-__generic<T:__BuiltinArithmeticType, let N:int>
-bool TEST_textureGather(
- Texture2D<vector<T,N>> t2D,
- TextureCube<vector<T,N>> tCube,
- Texture2DArray<vector<T,N>> t2DArray,
- TextureCubeArray<vector<T,N>> tCubeArray)
+bool TEST_textureGather<T>(
+ Texture2D<T> t2D,
+ TextureCube<T> tCube,
+ Texture2DArray<T> t2DArray,
+ TextureCubeArray<T> tCubeArray)
+ where T:IArithmetic,ITexelElement
{
// WGSL-LABEL: TEST_textureGather
- typealias Tv4 = vector<T,4>;
+ typealias Tv4 = vector<T.Element,4>;
float u = 0;
float u2 = 0.5;
@@ -155,90 +155,90 @@ bool TEST_textureGather(
// ==================================
// WGSL-COUNT-2: textureGather({{.*}}0{{.*}}t2D
- && all(Tv4(T(0)) == t2D.Gather(samplerState, float2(u, u)))
- && all(Tv4(T(0)) == t2D.Gather(samplerState, float2(u2, u), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2D.Gather(samplerState, float2(u, u)))
+ && all(Tv4(T.Element(0)) == t2D.Gather(samplerState, float2(u2, u), int2(0,0)))
// WGSL: textureGather({{.*}}0{{.*}}tCube
- && all(Tv4(T(0)) == tCube.Gather(samplerState, normalize(float3(u, 1 - u, u))))
+ && all(Tv4(T.Element(0)) == tCube.Gather(samplerState, normalize(float3(u, 1 - u, u))))
// WGSL-COUNT-2: textureGather({{.*}}0{{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.Gather(samplerState, float3(u, u, 0)))
- && all(Tv4(T(0)) == t2DArray.Gather(samplerState, float3(u2, u, 0), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2DArray.Gather(samplerState, float3(u, u, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.Gather(samplerState, float3(u2, u, 0), int2(0,0)))
// WGSL: textureGather({{.*}}0{{.*}}tCubeArray
- && all(Tv4(T(0)) == tCubeArray.Gather(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tv4(T.Element(0)) == tCubeArray.Gather(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
// ==================================
// vector<T,4> GatherRed()
// ==================================
// WGSL-COUNT-2: textureGather({{.*}}0{{.*}}t2D
- && all(Tv4(T(0)) == t2D.GatherRed(samplerState, float2(u, u)))
- && all(Tv4(T(0)) == t2D.GatherRed(samplerState, float2(u2, u), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2D.GatherRed(samplerState, float2(u, u)))
+ && all(Tv4(T.Element(0)) == t2D.GatherRed(samplerState, float2(u2, u), int2(0,0)))
// WGSL: textureGather({{.*}}0{{.*}}tCube
- && all(Tv4(T(0)) == tCube.GatherRed(samplerState, normalize(float3(u, 1 - u, u))))
+ && all(Tv4(T.Element(0)) == tCube.GatherRed(samplerState, normalize(float3(u, 1 - u, u))))
// WGSL-COUNT-2: textureGather({{.*}}0{{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.GatherRed(samplerState, float3(u, u, 0)))
- && all(Tv4(T(0)) == t2DArray.GatherRed(samplerState, float3(u2, u, 0), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherRed(samplerState, float3(u, u, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherRed(samplerState, float3(u2, u, 0), int2(0,0)))
// WGSL: textureGather({{.*}}0{{.*}}tCubeArray
- && all(Tv4(T(0)) == tCubeArray.GatherRed(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tv4(T.Element(0)) == tCubeArray.GatherRed(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
// ==================================
// vector<T,4> GatherGreen()
// ==================================
// WGSL-COUNT-2: textureGather({{.*}}1{{.*}}t2D
- && all(Tv4(T(0)) == t2D.GatherGreen(samplerState, float2(u, u)))
- && all(Tv4(T(0)) == t2D.GatherGreen(samplerState, float2(u2, u), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2D.GatherGreen(samplerState, float2(u, u)))
+ && all(Tv4(T.Element(0)) == t2D.GatherGreen(samplerState, float2(u2, u), int2(0,0)))
// WGSL: textureGather({{.*}}1{{.*}}tCube
- && all(Tv4(T(0)) == tCube.GatherGreen(samplerState, normalize(float3(u, 1 - u, u))))
+ && all(Tv4(T.Element(0)) == tCube.GatherGreen(samplerState, normalize(float3(u, 1 - u, u))))
// WGSL-COUNT-2: textureGather({{.*}}1{{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.GatherGreen(samplerState, float3(u, u, 0)))
- && all(Tv4(T(0)) == t2DArray.GatherGreen(samplerState, float3(u2, u, 0), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherGreen(samplerState, float3(u, u, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherGreen(samplerState, float3(u2, u, 0), int2(0,0)))
// WGSL: textureGather({{.*}}1{{.*}}tCubeArray
- && all(Tv4(T(0)) == tCubeArray.GatherGreen(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tv4(T.Element(0)) == tCubeArray.GatherGreen(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
// ==================================
// vector<T,4> GatherBlue()
// ==================================
// WGSL-COUNT-2: textureGather({{.*}}2{{.*}}t2D
- && all(Tv4(T(0)) == t2D.GatherBlue(samplerState, float2(u, u)))
- && all(Tv4(T(0)) == t2D.GatherBlue(samplerState, float2(u2, u), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2D.GatherBlue(samplerState, float2(u, u)))
+ && all(Tv4(T.Element(0)) == t2D.GatherBlue(samplerState, float2(u2, u), int2(0,0)))
// WGSL: textureGather({{.*}}2{{.*}}tCube
- && all(Tv4(T(0)) == tCube.GatherBlue(samplerState, normalize(float3(u, 1 - u, u))))
+ && all(Tv4(T.Element(0)) == tCube.GatherBlue(samplerState, normalize(float3(u, 1 - u, u))))
// WGSL-COUNT-2: textureGather({{.*}}2{{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.GatherBlue(samplerState, float3(u, u, 0)))
- && all(Tv4(T(0)) == t2DArray.GatherBlue(samplerState, float3(u2, u, 0), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherBlue(samplerState, float3(u, u, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherBlue(samplerState, float3(u2, u, 0), int2(0,0)))
// WGSL: textureGather({{.*}}2{{.*}}tCubeArray
- && all(Tv4(T(0)) == tCubeArray.GatherBlue(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tv4(T.Element(0)) == tCubeArray.GatherBlue(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
// ==================================
// vector<T,4> GatherAlpha()
// ==================================
// WGSL-COUNT-2: textureGather({{.*}}3{{.*}}t2D
- && all(Tv4(T(0)) == t2D.GatherAlpha(samplerState, float2(u, u)))
- && all(Tv4(T(0)) == t2D.GatherAlpha(samplerState, float2(u2, u), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2D.GatherAlpha(samplerState, float2(u, u)))
+ && all(Tv4(T.Element(0)) == t2D.GatherAlpha(samplerState, float2(u2, u), int2(0,0)))
// WGSL: textureGather({{.*}}3{{.*}}tCube
- && all(Tv4(T(0)) == tCube.GatherAlpha(samplerState, normalize(float3(u, 1 - u, u))))
+ && all(Tv4(T.Element(0)) == tCube.GatherAlpha(samplerState, normalize(float3(u, 1 - u, u))))
// WGSL-COUNT-2: textureGather({{.*}}3{{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.GatherAlpha(samplerState, float3(u, u, 0)))
- && all(Tv4(T(0)) == t2DArray.GatherAlpha(samplerState, float3(u2, u, 0), int2(0,0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherAlpha(samplerState, float3(u, u, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.GatherAlpha(samplerState, float3(u2, u, 0), int2(0,0)))
// WGSL: textureGather({{.*}}3{{.*}}tCubeArray
- && all(Tv4(T(0)) == tCubeArray.GatherAlpha(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tv4(T.Element(0)) == tCubeArray.GatherAlpha(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
;
}
@@ -318,12 +318,12 @@ bool TEST_textureGather_depth()
void fragMain()
{
bool result = true
- && TEST_textureGather<float, 3>(t2D_f32v3, tCube_f32v3, t2DArray_f32v3, tCubeArray_f32v3)
- && TEST_textureGather<float, 4>(t2D_f32v4, tCube_f32v4, t2DArray_f32v4, tCubeArray_f32v4)
- && TEST_textureGather<int32_t, 3>(t2D_i32v3, tCube_i32v3, t2DArray_i32v3, tCubeArray_i32v3)
- && TEST_textureGather<int32_t, 4>(t2D_i32v4, tCube_i32v4, t2DArray_i32v4, tCubeArray_i32v4)
- && TEST_textureGather<uint32_t, 3>(t2D_u32v3, tCube_u32v3, t2DArray_u32v3, tCubeArray_u32v3)
- && TEST_textureGather<uint32_t, 4>(t2D_u32v4, tCube_u32v4, t2DArray_u32v4, tCubeArray_u32v4)
+ && TEST_textureGather<float3>(t2D_f32v3, tCube_f32v3, t2DArray_f32v3, tCubeArray_f32v3)
+ && TEST_textureGather<float4>(t2D_f32v4, tCube_f32v4, t2DArray_f32v4, tCubeArray_f32v4)
+ && TEST_textureGather<int32_t3>(t2D_i32v3, tCube_i32v3, t2DArray_i32v3, tCubeArray_i32v3)
+ && TEST_textureGather<int32_t4>(t2D_i32v4, tCube_i32v4, t2DArray_i32v4, tCubeArray_i32v4)
+ && TEST_textureGather<uint32_t3>(t2D_u32v3, tCube_u32v3, t2DArray_u32v3, tCubeArray_u32v3)
+ && TEST_textureGather<uint32_t4>(t2D_u32v4, tCube_u32v4, t2DArray_u32v4, tCubeArray_u32v4)
&& TEST_textureGather_depth()
;
diff --git a/tests/wgsl/texture-load.slang b/tests/wgsl/texture-load.slang
index 3e69ac5cf..9be7cd2eb 100644
--- a/tests/wgsl/texture-load.slang
+++ b/tests/wgsl/texture-load.slang
@@ -127,16 +127,16 @@ Depth2DMS d2DMS;
Depth2DArray d2DArray;
-__generic<T:__BuiltinArithmeticType, let N:int>
-bool TEST_textureLoad(
- Texture1D<vector<T,N>> t1D,
- Texture2D<vector<T,N>> t2D,
- Texture3D<vector<T,N>> t3D,
- Texture2DMS<vector<T,N>> t2DMS,
- Texture2DArray<vector<T,N>> t2DArray)
+bool TEST_textureLoad<T>(
+ Texture1D<T> t1D,
+ Texture2D<T> t2D,
+ Texture3D<T> t3D,
+ Texture2DMS<T> t2DMS,
+ Texture2DArray<T> t2DArray)
+ where T : ITexelElement, IArithmetic
{
// WGSL-LABEL: TEST_textureLoad
- typealias Tvn = vector<T,N>;
+ typealias Tvn = T;
return true
// ===================
@@ -145,19 +145,19 @@ bool TEST_textureLoad(
// ===================
// WGSL: textureLoad({{\(*}}t1D
- && all(Tvn(T(0)) == t1D.Load(int2(0, 0)))
+ && all(Tvn(T.Element(0)) == t1D.Load(int2(0, 0)))
// WGSL: textureLoad({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.Load(int3(0, 0, 0)))
+ && all(Tvn(T.Element(0)) == t2D.Load(int3(0, 0, 0)))
// WGSL: textureLoad({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.Load(int4(0, 0, 0, 0)))
+ && all(Tvn(T.Element(0)) == t3D.Load(int4(0, 0, 0, 0)))
// WGSL: textureLoad({{\(*}}t2DMS
- && all(Tvn(T(0)) == t2DMS.Load(int3(0, 0, 0)))
+ && all(Tvn(T.Element(0)) == t2DMS.Load(int3(0, 0, 0)))
// WGSL: textureLoad({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.Load(int4(0, 0, 0, 0)))
+ && all(Tvn(T.Element(0)) == t2DArray.Load(int4(0, 0, 0, 0)))
;
}
@@ -185,12 +185,12 @@ bool TEST_textureLoad_depth()
void fragMain()
{
bool result = true
- && TEST_textureLoad<float, 3>(t1D_f32v3, t2D_f32v3, t3D_f32v3, t2DMS_f32v3, t2DArray_f32v3)
- && TEST_textureLoad<float, 4>(t1D_f32v4, t2D_f32v4, t3D_f32v4, t2DMS_f32v4, t2DArray_f32v4)
- && TEST_textureLoad<int32_t, 3>(t1D_i32v3, t2D_i32v3, t3D_i32v3, t2DMS_i32v3, t2DArray_i32v3)
- && TEST_textureLoad<int32_t, 4>(t1D_i32v4, t2D_i32v4, t3D_i32v4, t2DMS_i32v4, t2DArray_i32v4)
- && TEST_textureLoad<uint32_t, 3>(t1D_u32v3, t2D_u32v3, t3D_u32v3, t2DMS_u32v3, t2DArray_u32v3)
- && TEST_textureLoad<uint32_t, 4>(t1D_u32v4, t2D_u32v4, t3D_u32v4, t2DMS_u32v4, t2DArray_u32v4)
+ && TEST_textureLoad<float3>(t1D_f32v3, t2D_f32v3, t3D_f32v3, t2DMS_f32v3, t2DArray_f32v3)
+ && TEST_textureLoad<float4>(t1D_f32v4, t2D_f32v4, t3D_f32v4, t2DMS_f32v4, t2DArray_f32v4)
+ && TEST_textureLoad<int32_t3>(t1D_i32v3, t2D_i32v3, t3D_i32v3, t2DMS_i32v3, t2DArray_i32v3)
+ && TEST_textureLoad<int32_t4>(t1D_i32v4, t2D_i32v4, t3D_i32v4, t2DMS_i32v4, t2DArray_i32v4)
+ && TEST_textureLoad<uint32_t3>(t1D_u32v3, t2D_u32v3, t3D_u32v3, t2DMS_u32v3, t2DArray_u32v3)
+ && TEST_textureLoad<uint32_t4>(t1D_u32v4, t2D_u32v4, t3D_u32v4, t2DMS_u32v4, t2DArray_u32v4)
&& TEST_textureLoad_depth()
;
diff --git a/tests/wgsl/texture-sampler-less.slang b/tests/wgsl/texture-sampler-less.slang
index 249803526..7868a9bcf 100644
--- a/tests/wgsl/texture-sampler-less.slang
+++ b/tests/wgsl/texture-sampler-less.slang
@@ -43,7 +43,7 @@ Sampler2DArray<float4> t2DArray_f32v4;
//TEST_INPUT: TextureSamplerCube(size=4, content = zero, arrayLength=2):name tCubeArray_f32v4
SamplerCubeArray<float4> tCubeArray_f32v4;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias CombinedDepth2d = _Texture<
T,
__Shape2D,
@@ -56,7 +56,7 @@ typealias CombinedDepth2d = _Texture<
format
>;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias CombinedDepth2d_array = _Texture<
T,
__Shape2D,
@@ -69,7 +69,7 @@ typealias CombinedDepth2d_array = _Texture<
format
>;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias CombinedDepthcube = _Texture<
T,
__ShapeCube,
@@ -82,7 +82,7 @@ typealias CombinedDepthcube = _Texture<
format
>;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias CombinedDepthcube_array = _Texture<
T,
__ShapeCube,
@@ -108,20 +108,19 @@ CombinedDepthcube_array<float> dCubeArray;
RWStructuredBuffer<int> outputBuffer;
-__generic<T:__BuiltinArithmeticType, let N:int>
-bool TEST_texture(
- Sampler1D<vector<T,N>> t1D,
- Sampler2D<vector<T,N>> t2D,
- Sampler3D<vector<T,N>> t3D,
- SamplerCube<vector<T,N>> tCube,
- Sampler1DArray<vector<T,N>> t1DArray,
- Sampler2DArray<vector<T,N>> t2DArray,
- SamplerCubeArray<vector<T,N>> tCubeArray
-)
+bool TEST_texture<T>(
+ Sampler1D<T> t1D,
+ Sampler2D<T> t2D,
+ Sampler3D<T> t3D,
+ SamplerCube<T> tCube,
+ Sampler1DArray<T> t1DArray,
+ Sampler2DArray<T> t2DArray,
+ SamplerCubeArray<T> tCubeArray
+) where T:ITexelElement,IArithmetic
{
// WGSL-LABEL: TEST_texture
- typealias Tvn = vector<T,N>;
- typealias Tv4 = vector<T,4>;
+ typealias Tvn = T;
+ typealias Tv4 = vector<T.Element,4>;
float u = 0;
float u2 = 0.5;
@@ -145,41 +144,41 @@ bool TEST_texture(
// ===========
// WGSL: textureSample({{\(*}}t1D
- && all(Tvn(T(0)) == t1D.Sample(u))
+ && all(Tvn(T.Element(0)) == t1D.Sample(u))
// WGSL: textureSample({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.Sample(float2(u, u)))
+ && all(Tvn(T.Element(0)) == t2D.Sample(float2(u, u)))
// WGSL: textureSample({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.Sample(float3(u, u, u)))
+ && all(Tvn(T.Element(0)) == t3D.Sample(float3(u, u, u)))
// WGSL: textureSample({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.Sample(normalize(float3(u, 1 - u, u))))
+ && all(Tvn(T.Element(0)) == tCube.Sample(normalize(float3(u, 1 - u, u))))
// WGSL doesn't support textureSample for 1d_array and 3d_array; only 2d and cube
// WGSL: textureSample({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.Sample(float3(u, u, 0)))
+ && all(Tvn(T.Element(0)) == t2DArray.Sample(float3(u, u, 0)))
// WGSL: textureSample({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.Sample(float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tvn(T.Element(0)) == tCubeArray.Sample(float4(normalize(float3(u, 1 - u, u)), 0)))
#if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// Offset variant
// WGSL: textureSample({{\(*}}t1D
- && all(Tvn(T(0)) == t1D.Sample(u, 1))
+ && all(Tvn(T.Element(0)) == t1D.Sample(u, 1))
// WGSL: textureSample({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.Sample(float2(u, u), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2D.Sample(float2(u, u), int2(1, 1)))
// WGSL: textureSample({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.Sample(float3(u, u, u), int3(1, 1, 1)))
+ && all(Tvn(T.Element(0)) == t3D.Sample(float3(u, u, u), int3(1, 1, 1)))
// WGSL doesn't support offset variant for cube and cube_array
// WGSL: textureSample({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.Sample(float3(u, u, 0), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2DArray.Sample(float3(u, u, 0), int2(1, 1)))
#endif // #if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// ===============
@@ -190,31 +189,31 @@ bool TEST_texture(
// WGSL doesn't support Bias for 1D texture
// WGSL: textureSampleBias({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleBias(float2(u, u), float(-1)))
+ && all(Tvn(T.Element(0)) == t2D.SampleBias(float2(u, u), float(-1)))
// WGSL: textureSampleBias({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleBias(float3(u, u, u), float(-1)))
+ && all(Tvn(T.Element(0)) == t3D.SampleBias(float3(u, u, u), float(-1)))
// WGSL: textureSampleBias({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.SampleBias(normalize(float3(u, 1 - u, u)), float(-1)))
+ && all(Tvn(T.Element(0)) == tCube.SampleBias(normalize(float3(u, 1 - u, u)), float(-1)))
// WGSL: textureSampleBias({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleBias(float3(u, u, 0), float(-1)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleBias(float3(u, u, 0), float(-1)))
// WGSL: textureSampleBias({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.SampleBias(float4(normalize(float3(u, 1 - u, u)), 0), float(-1)))
+ && all(Tvn(T.Element(0)) == tCubeArray.SampleBias(float4(normalize(float3(u, 1 - u, u)), 0), float(-1)))
#if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// Offset variant
// W-GSL: textureSampleBias({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleBias(float2(u, u), float(-1), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2D.SampleBias(float2(u, u), float(-1), int2(1, 1)))
// W-GSL: textureSampleBias({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleBias(float3(u, u, u), float(-1), int3(1, 1, 1)))
+ && all(Tvn(T.Element(0)) == t3D.SampleBias(float3(u, u, u), float(-1), int3(1, 1, 1)))
// W-GSL: textureSampleBias({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleBias(float3(u, u, 0), float(-1), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleBias(float3(u, u, 0), float(-1), int2(1, 1)))
#endif // #if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// ===================================
@@ -225,31 +224,31 @@ bool TEST_texture(
// WGSL doesn't support textureSampleLevel for 1D texture
// WGSL: textureSampleLevel({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleLevel(float2(u, u), 0))
+ && all(Tvn(T.Element(0)) == t2D.SampleLevel(float2(u, u), 0))
// WGSL: textureSampleLevel({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleLevel(float3(u, u, u), 0))
+ && all(Tvn(T.Element(0)) == t3D.SampleLevel(float3(u, u, u), 0))
// WGSL: textureSampleLevel({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.SampleLevel(normalize(float3(u, 1 - u, u)), 0))
+ && all(Tvn(T.Element(0)) == tCube.SampleLevel(normalize(float3(u, 1 - u, u)), 0))
// WGSL: textureSampleLevel({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleLevel(float3(u, u, 0), 0))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleLevel(float3(u, u, 0), 0))
// WGSL: textureSampleLevel({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.SampleLevel(float4(normalize(float3(u, 1 - u, u)), 0), 0))
+ && all(Tvn(T.Element(0)) == tCubeArray.SampleLevel(float4(normalize(float3(u, 1 - u, u)), 0), 0))
#if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// Offset variant
// W-GSL: textureSampleLevel({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleLevel(float2(u, u), 0, int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2D.SampleLevel(float2(u, u), 0, int2(1, 1)))
// W-GSL: textureSampleLevel({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleLevel(float3(u, u, u), 0, int3(1, 1, 1)))
+ && all(Tvn(T.Element(0)) == t3D.SampleLevel(float3(u, u, u), 0, int3(1, 1, 1)))
// W-GSL: textureSampleLevel({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleLevel(float3(u, u, 0), 0, int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleLevel(float3(u, u, 0), 0, int2(1, 1)))
#endif // #if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// ==================
@@ -312,25 +311,25 @@ bool TEST_texture(
// ==================================
// WGSL: textureGather({{.*}}t2D
- && all(Tv4(T(0)) == t2D.Gather(float2(u, u)))
+ && all(Tv4(T.Element(0)) == t2D.Gather(float2(u, u)))
// WGSL: textureGather({{.*}}tCube
- && all(Tv4(T(0)) == tCube.Gather(normalize(float3(u, 1 - u, u))))
+ && all(Tv4(T.Element(0)) == tCube.Gather(normalize(float3(u, 1 - u, u))))
// WGSL: textureGather({{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.Gather(float3(u, u, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.Gather(float3(u, u, 0)))
// WGSL: textureGather({{.*}}tCubeArray
- && all(Tv4(T(0)) == tCubeArray.Gather(float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tv4(T.Element(0)) == tCubeArray.Gather(float4(normalize(float3(u, 1 - u, u)), 0)))
#if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// Offset variant
// W-GSL: textureGather({{.*}}t2D
- && all(Tv4(T(0)) == t2D.Gather(float2(u2, u), int2(0, 0)))
+ && all(Tv4(T.Element(0)) == t2D.Gather(float2(u2, u), int2(0, 0)))
// W-GSL: textureGather({{.*}}t2DArray
- && all(Tv4(T(0)) == t2DArray.Gather(float3(u2, u, 0), int2(0, 0)))
+ && all(Tv4(T.Element(0)) == t2DArray.Gather(float3(u2, u, 0), int2(0, 0)))
#endif // #if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// =====================================
@@ -341,31 +340,31 @@ bool TEST_texture(
// WGSL doesn't support textureSampleGrad for 1D textures
// WGSL: textureSampleGrad({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleGrad(float2(u, u), float2(ddx, ddx), float2(ddy, ddy)))
+ && all(Tvn(T.Element(0)) == t2D.SampleGrad(float2(u, u), float2(ddx, ddx), float2(ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleGrad(float3(u, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
+ && all(Tvn(T.Element(0)) == t3D.SampleGrad(float3(u, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.SampleGrad(normalize(float3(u, 1 - u, u)), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
+ && all(Tvn(T.Element(0)) == tCube.SampleGrad(normalize(float3(u, 1 - u, u)), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleGrad(float3(u, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleGrad(float3(u, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.SampleGrad(float4(normalize(float3(u, 1 - u, u)), 0), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
+ && all(Tvn(T.Element(0)) == tCubeArray.SampleGrad(float4(normalize(float3(u, 1 - u, u)), 0), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
#if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
// Offset variant
// W-GSL: textureSampleGrad({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleGrad(float2(u2, u), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
+ && all(Tvn(T.Element(0)) == t2D.SampleGrad(float2(u2, u), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
// W-GSL: textureSampleGrad({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleGrad(float3(u2, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy), int3(0, 0, 0)))
+ && all(Tvn(T.Element(0)) == t3D.SampleGrad(float3(u2, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy), int3(0, 0, 0)))
// W-GSL: textureSampleGrad({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleGrad(float3(u2, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleGrad(float3(u2, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
#endif // #if TEST_WHEN_CONSTEXPR_WORKS_FOR_OFFSET
;
@@ -375,7 +374,7 @@ bool TEST_texture(
void fragMain()
{
bool result = true
- && TEST_texture<float, 3>(
+ && TEST_texture<float3>(
t1D_f32v3,
t2D_f32v3,
t3D_f32v3,
@@ -383,7 +382,7 @@ void fragMain()
t1DArray_f32v3,
t2DArray_f32v3,
tCubeArray_f32v3)
- && TEST_texture<float, 4>(
+ && TEST_texture<float4>(
t1D_f32v4,
t2D_f32v4,
t3D_f32v4,
diff --git a/tests/wgsl/texture-storage.slang b/tests/wgsl/texture-storage.slang
index 84921870b..1109dbfb1 100644
--- a/tests/wgsl/texture-storage.slang
+++ b/tests/wgsl/texture-storage.slang
@@ -73,15 +73,16 @@ RWStructuredBuffer<int> outputBuffer;
[format("rgba16ui")] RWTexture2DArray<uint4> w2DArray_u32v4;
-__generic<T:__BuiltinArithmeticType, let N:int, let sampleIndex:int, let format:int>
+__generic<T, let sampleIndex:int, let format:int>
[ForceInline] // Workaround for a WGSL requirement that `texture_storage_Xd` must always be a global variable
bool TEST_textureStorage_StoreLoad(
- RWTexture1D<vector<T,N>, sampleIndex, format> w1D,
- RWTexture2D<vector<T,N>, sampleIndex, format> w2D,
- RWTexture3D<vector<T,N>, sampleIndex, format> w3D,
- RWTexture2DArray<vector<T,N>, sampleIndex, format> w2DArray)
+ RWTexture1D<T, sampleIndex, format> w1D,
+ RWTexture2D<T, sampleIndex, format> w2D,
+ RWTexture3D<T, sampleIndex, format> w3D,
+ RWTexture2DArray<T, sampleIndex, format> w2DArray)
+ where T:ITexelElement, IArithmetic
{
- typealias Tvn = vector<T,N>;
+ typealias Tvn = T;
// ===================
// o[i] = v;
@@ -90,16 +91,16 @@ bool TEST_textureStorage_StoreLoad(
// TODO: store before load
// WGSL: textureStore({{\(*}}w1D
- w1D[0] = Tvn(T(1));
+ w1D[0] = Tvn(T.Element(1));
// WGSL: textureStore({{\(*}}w2D
- w2D[0] = Tvn(T(1));
+ w2D[0] = Tvn(T.Element(1));
// WGSL: textureStore({{\(*}}w3D
- w3D[0] = Tvn(T(1));
+ w3D[0] = Tvn(T.Element(1));
// WGSL: textureStore({{\(*}}w2DArray
- w2DArray[0] = Tvn(T(1));
+ w2DArray[0] = Tvn(T.Element(1));
return true
// ===================
@@ -108,28 +109,28 @@ bool TEST_textureStorage_StoreLoad(
// ===================
// WGSL: textureLoad({{\(*}}w1D
- && all(Tvn(T(0)) == w1D.Load(0))
+ && all(Tvn(T.Element(0)) == w1D.Load(0))
// WGSL: textureLoad({{\(*}}w2D
- && all(Tvn(T(0)) == w2D.Load(int2(0, 0)))
+ && all(Tvn(T.Element(0)) == w2D.Load(int2(0, 0)))
// WGSL: textureLoad({{\(*}}w3D
- && all(Tvn(T(0)) == w3D.Load(int3(0, 0, 0)))
+ && all(Tvn(T.Element(0)) == w3D.Load(int3(0, 0, 0)))
// WGSL: textureLoad({{\(*}}w2DArray
- && all(Tvn(T(0)) == w2DArray.Load(int3(0, 0, 0)))
+ && all(Tvn(T.Element(0)) == w2DArray.Load(int3(0, 0, 0)))
;
}
void fragMain()
{
bool result = true
- && TEST_textureStorage_StoreLoad<float, 2>(w1D_f32v2, w2D_f32v2, w3D_f32v2, w2DArray_f32v2)
- && TEST_textureStorage_StoreLoad<float, 4>(w1D_f32v4, w2D_f32v4, w3D_f32v4, w2DArray_f32v4)
- && TEST_textureStorage_StoreLoad<int32_t, 2>(w1D_i32v2, w2D_i32v2, w3D_i32v2, w2DArray_i32v2)
- && TEST_textureStorage_StoreLoad<int32_t, 4>(w1D_i32v4, w2D_i32v4, w3D_i32v4, w2DArray_i32v4)
- && TEST_textureStorage_StoreLoad<uint32_t, 2>(w1D_u32v2, w2D_u32v2, w3D_u32v2, w2DArray_u32v2)
- && TEST_textureStorage_StoreLoad<uint32_t, 4>(w1D_u32v4, w2D_u32v4, w3D_u32v4, w2DArray_u32v4)
+ && TEST_textureStorage_StoreLoad<float2>(w1D_f32v2, w2D_f32v2, w3D_f32v2, w2DArray_f32v2)
+ && TEST_textureStorage_StoreLoad<float4>(w1D_f32v4, w2D_f32v4, w3D_f32v4, w2DArray_f32v4)
+ && TEST_textureStorage_StoreLoad<int32_t2>(w1D_i32v2, w2D_i32v2, w3D_i32v2, w2DArray_i32v2)
+ && TEST_textureStorage_StoreLoad<int32_t4>(w1D_i32v4, w2D_i32v4, w3D_i32v4, w2DArray_i32v4)
+ && TEST_textureStorage_StoreLoad<uint32_t2>(w1D_u32v2, w2D_u32v2, w3D_u32v2, w2DArray_u32v2)
+ && TEST_textureStorage_StoreLoad<uint32_t4>(w1D_u32v4, w2D_u32v4, w3D_u32v4, w2DArray_u32v4)
;
outputBuffer[0] = int(result);
diff --git a/tests/wgsl/texture.slang b/tests/wgsl/texture.slang
index be098c9ca..1a14fec32 100644
--- a/tests/wgsl/texture.slang
+++ b/tests/wgsl/texture.slang
@@ -35,7 +35,7 @@ Texture2DArray<float4> t2DArray_f32v4;
//TEST_INPUT: TextureCube(size=4, content = zero, arrayLength=2):name tCubeArray_f32v4
TextureCubeArray<float4> tCubeArray_f32v4;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias depth2d = _Texture<
T,
__Shape2D,
@@ -48,7 +48,7 @@ typealias depth2d = _Texture<
format
>;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias depth2d_array = _Texture<
T,
__Shape2D,
@@ -61,7 +61,7 @@ typealias depth2d_array = _Texture<
format
>;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias depthcube = _Texture<
T,
__ShapeCube,
@@ -74,7 +74,7 @@ typealias depthcube = _Texture<
format
>;
-__generic<T : __BuiltinType, let sampleCount:int=0, let format:int=0>
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
typealias depthcube_array = _Texture<
T,
__ShapeCube,
@@ -101,21 +101,19 @@ SamplerState samplerState;
//TEST_INPUT: Sampler:name shadowSampler
SamplerComparisonState shadowSampler;
-
-__generic<T:__BuiltinArithmeticType, let N:int>
-bool TEST_texture(
- Texture1D<vector<T,N>> t1D,
- Texture2D<vector<T,N>> t2D,
- Texture3D<vector<T,N>> t3D,
- TextureCube<vector<T,N>> tCube,
- Texture1DArray<vector<T,N>> t1DArray,
- Texture2DArray<vector<T,N>> t2DArray,
- TextureCubeArray<vector<T,N>> tCubeArray
-)
+bool TEST_texture<T>(
+ Texture1D<T> t1D,
+ Texture2D<T> t2D,
+ Texture3D<T> t3D,
+ TextureCube<T> tCube,
+ Texture1DArray<T> t1DArray,
+ Texture2DArray<T> t2DArray,
+ TextureCubeArray<T> tCubeArray
+) where T:ITexelElement, IArithmetic
{
// WGSL-LABEL: TEST_texture
- typealias Tvn = vector<T,N>;
- typealias Tv4 = vector<T,4>;
+ typealias Tvn = T;
+ typealias Tv4 = vector<T.Element,4>;
float u = 0;
float u2 = 0.5;
@@ -185,40 +183,40 @@ bool TEST_texture(
// ===========
// WGSL: textureSample({{\(*}}t1D
- && all(Tvn(T(0)) == t1D.Sample(samplerState, u))
+ && all(Tvn(T.Element(0)) == t1D.Sample(samplerState, u))
// WGSL: textureSample({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.Sample(samplerState, float2(u, u)))
+ && all(Tvn(T.Element(0)) == t2D.Sample(samplerState, float2(u, u)))
// WGSL: textureSample({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.Sample(samplerState, float3(u, u, u)))
+ && all(Tvn(T.Element(0)) == t3D.Sample(samplerState, float3(u, u, u)))
// WGSL: textureSample({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.Sample(samplerState, normalize(float3(u, 1 - u, u))))
+ && all(Tvn(T.Element(0)) == tCube.Sample(samplerState, normalize(float3(u, 1 - u, u))))
// WGSL doesn't support textureSample for 1d_array and 3d_array; only 2d and cube
// WGSL: textureSample({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.Sample(samplerState, float3(u, u, 0)))
+ && all(Tvn(T.Element(0)) == t2DArray.Sample(samplerState, float3(u, u, 0)))
// WGSL: textureSample({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.Sample(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
+ && all(Tvn(T.Element(0)) == tCubeArray.Sample(samplerState, float4(normalize(float3(u, 1 - u, u)), 0)))
// Offset variant
// WGSL: textureSample({{\(*}}t1D
- && all(Tvn(T(0)) == t1D.Sample(samplerState, u, 1))
+ && all(Tvn(T.Element(0)) == t1D.Sample(samplerState, u, 1))
// WGSL: textureSample({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.Sample(samplerState, float2(u, u), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2D.Sample(samplerState, float2(u, u), int2(1, 1)))
// WGSL: textureSample({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.Sample(samplerState, float3(u, u, u), int3(1, 1, 1)))
+ && all(Tvn(T.Element(0)) == t3D.Sample(samplerState, float3(u, u, u), int3(1, 1, 1)))
// WGSL doesn't support offset variant for cube and cube_array
// WGSL: textureSample({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.Sample(samplerState, float3(u, u, 0), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2DArray.Sample(samplerState, float3(u, u, 0), int2(1, 1)))
// Clamp variant
// WGSL doesn't support clamp variants for `textureSample()`
@@ -231,30 +229,30 @@ bool TEST_texture(
// WGSL doesn't support Bias for 1D texture
// WGSL: textureSampleBias({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleBias(samplerState, float2(u, u), float(-1)))
+ && all(Tvn(T.Element(0)) == t2D.SampleBias(samplerState, float2(u, u), float(-1)))
// WGSL: textureSampleBias({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleBias(samplerState, float3(u, u, u), float(-1)))
+ && all(Tvn(T.Element(0)) == t3D.SampleBias(samplerState, float3(u, u, u), float(-1)))
// WGSL: textureSampleBias({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.SampleBias(samplerState, normalize(float3(u, 1 - u, u)), float(-1)))
+ && all(Tvn(T.Element(0)) == tCube.SampleBias(samplerState, normalize(float3(u, 1 - u, u)), float(-1)))
// WGSL: textureSampleBias({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleBias(samplerState, float3(u, u, 0), float(-1)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleBias(samplerState, float3(u, u, 0), float(-1)))
// WGSL: textureSampleBias({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.SampleBias(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), float(-1)))
+ && all(Tvn(T.Element(0)) == tCubeArray.SampleBias(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), float(-1)))
// Offset variant
// WGSL: textureSampleBias({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleBias(samplerState, float2(u, u), float(-1), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2D.SampleBias(samplerState, float2(u, u), float(-1), int2(1, 1)))
// WGSL: textureSampleBias({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleBias(samplerState, float3(u, u, u), float(-1), int3(1, 1, 1)))
+ && all(Tvn(T.Element(0)) == t3D.SampleBias(samplerState, float3(u, u, u), float(-1), int3(1, 1, 1)))
// WGSL: textureSampleBias({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleBias(samplerState, float3(u, u, 0), float(-1), int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleBias(samplerState, float3(u, u, 0), float(-1), int2(1, 1)))
// ===================================
// T SampleLevel()
@@ -264,30 +262,30 @@ bool TEST_texture(
// WGSL doesn't support textureSampleLevel for 1D texture
// WGSL: textureSampleLevel({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleLevel(samplerState, float2(u, u), 0))
+ && all(Tvn(T.Element(0)) == t2D.SampleLevel(samplerState, float2(u, u), 0))
// WGSL: textureSampleLevel({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleLevel(samplerState, float3(u, u, u), 0))
+ && all(Tvn(T.Element(0)) == t3D.SampleLevel(samplerState, float3(u, u, u), 0))
// WGSL: textureSampleLevel({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.SampleLevel(samplerState, normalize(float3(u, 1 - u, u)), 0))
+ && all(Tvn(T.Element(0)) == tCube.SampleLevel(samplerState, normalize(float3(u, 1 - u, u)), 0))
// WGSL: textureSampleLevel({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0))
// WGSL: textureSampleLevel({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.SampleLevel(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), 0))
+ && all(Tvn(T.Element(0)) == tCubeArray.SampleLevel(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), 0))
// Offset variant
// WGSL: textureSampleLevel({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleLevel(samplerState, float2(u, u), 0, int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2D.SampleLevel(samplerState, float2(u, u), 0, int2(1, 1)))
// WGSL: textureSampleLevel({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleLevel(samplerState, float3(u, u, u), 0, int3(1, 1, 1)))
+ && all(Tvn(T.Element(0)) == t3D.SampleLevel(samplerState, float3(u, u, u), 0, int3(1, 1, 1)))
// WGSL: textureSampleLevel({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0, int2(1, 1)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0, int2(1, 1)))
// ==================
// float SampleCmp()
@@ -349,30 +347,30 @@ bool TEST_texture(
// WGSL doesn't support textureSampleGrad for 1D textures
// WGSL: textureSampleGrad({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleGrad(samplerState, float2(u, u), float2(ddx, ddx), float2(ddy, ddy)))
+ && all(Tvn(T.Element(0)) == t2D.SampleGrad(samplerState, float2(u, u), float2(ddx, ddx), float2(ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleGrad(samplerState, float3(u, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
+ && all(Tvn(T.Element(0)) == t3D.SampleGrad(samplerState, float3(u, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}tCube
- && all(Tvn(T(0)) == tCube.SampleGrad(samplerState, normalize(float3(u, 1 - u, u)), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
+ && all(Tvn(T.Element(0)) == tCube.SampleGrad(samplerState, normalize(float3(u, 1 - u, u)), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleGrad(samplerState, float3(u, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleGrad(samplerState, float3(u, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy)))
// WGSL: textureSampleGrad({{\(*}}tCubeArray
- && all(Tvn(T(0)) == tCubeArray.SampleGrad(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
+ && all(Tvn(T.Element(0)) == tCubeArray.SampleGrad(samplerState, float4(normalize(float3(u, 1 - u, u)), 0), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy)))
// Offset variant
// WGSL: textureSampleGrad({{\(*}}t2D
- && all(Tvn(T(0)) == t2D.SampleGrad(samplerState, float2(u2, u), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
+ && all(Tvn(T.Element(0)) == t2D.SampleGrad(samplerState, float2(u2, u), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
// WGSL: textureSampleGrad({{\(*}}t3D
- && all(Tvn(T(0)) == t3D.SampleGrad(samplerState, float3(u2, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy), int3(0, 0, 0)))
+ && all(Tvn(T.Element(0)) == t3D.SampleGrad(samplerState, float3(u2, u, u), float3(ddx, ddx, ddx), float3(ddy, ddy, ddy), int3(0, 0, 0)))
// WGSL: textureSampleGrad({{\(*}}t2DArray
- && all(Tvn(T(0)) == t2DArray.SampleGrad(samplerState, float3(u2, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
+ && all(Tvn(T.Element(0)) == t2DArray.SampleGrad(samplerState, float3(u2, u, 0.0f), float2(ddx, ddx), float2(ddy, ddy), int2(0, 0)))
;
return result;
@@ -381,7 +379,7 @@ bool TEST_texture(
void fragMain()
{
bool result = true
- && TEST_texture<float, 3>(
+ && TEST_texture<float3>(
t1D_f32v3,
t2D_f32v3,
t3D_f32v3,
@@ -389,7 +387,7 @@ void fragMain()
t1DArray_f32v3,
t2DArray_f32v3,
tCubeArray_f32v3)
- && TEST_texture<float, 4>(
+ && TEST_texture<float4>(
t1D_f32v4,
t2D_f32v4,
t3D_f32v4,