diff options
| author | Yong He <yonghe@outlook.com> | 2025-01-17 14:37:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-17 14:37:27 -0800 |
| commit | fc77070fdc9bfa599e8d66b21743778de3011e53 (patch) | |
| tree | a9a0983bd704b0e760ae94d5330a74bc72f1154f /tests | |
| parent | 3ff257816fc8f376d9bee76378a690757f8b5377 (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')
| -rw-r--r-- | tests/diagnostics/illegal-texel-type.slang | 7 | ||||
| -rw-r--r-- | tests/glsl-intrinsic/compute-derivative/intrinsic-derivative-function-in-compute.slang | 58 | ||||
| -rw-r--r-- | tests/glsl-intrinsic/intrinsic-texture.slang | 312 | ||||
| -rw-r--r-- | tests/language-feature/capability/intrinsic-texture-ignore-capability.slang | 384 | ||||
| -rw-r--r-- | tests/metal/texture-sampler-less.slang | 8 | ||||
| -rw-r--r-- | tests/metal/texture.slang | 139 | ||||
| -rw-r--r-- | tests/wgsl/texture-gather.slang | 86 | ||||
| -rw-r--r-- | tests/wgsl/texture-load.slang | 38 | ||||
| -rw-r--r-- | tests/wgsl/texture-sampler-less.slang | 115 | ||||
| -rw-r--r-- | tests/wgsl/texture-storage.slang | 41 | ||||
| -rw-r--r-- | tests/wgsl/texture.slang | 104 |
11 files changed, 648 insertions, 644 deletions
diff --git a/tests/diagnostics/illegal-texel-type.slang b/tests/diagnostics/illegal-texel-type.slang new file mode 100644 index 000000000..847f9ea18 --- /dev/null +++ b/tests/diagnostics/illegal-texel-type.slang @@ -0,0 +1,7 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv + +// CHECK: ([[# @LINE+1]]): error 38029 +Texture2D<float4x4> t1; + +// CHECK: ([[# @LINE+1]]): error 38029 +RWBuffer<Sampler1D> t2;
\ No newline at end of file diff --git a/tests/glsl-intrinsic/compute-derivative/intrinsic-derivative-function-in-compute.slang b/tests/glsl-intrinsic/compute-derivative/intrinsic-derivative-function-in-compute.slang index c5c2e36cc..1c9152969 100644 --- a/tests/glsl-intrinsic/compute-derivative/intrinsic-derivative-function-in-compute.slang +++ b/tests/glsl-intrinsic/compute-derivative/intrinsic-derivative-function-in-compute.slang @@ -49,10 +49,10 @@ buffer MyBlockName uniform sampler1D uniform_sampler1D; -__generic<T : __BuiltinFloatingPointType, let N : int> -bool textureFuncs(Sampler1D<vector<T,N>> gsampler1D) +__generic<T : ITexelElement> +bool textureFuncs(Sampler1D<T> gsampler1D) { - typealias gvec4 = vector<T,4>; + typealias gvec4 = vector<T.Element,4>; constexpr ivec2 ivec2_0 = ivec2(0); @@ -61,32 +61,32 @@ bool textureFuncs(Sampler1D<vector<T,N>> gsampler1D) && int(0) == textureSize(gsampler1D, int(0)) && vec2(0) == textureQueryLod(gsampler1D, float(0)) && int(0) == textureQueryLevels(gsampler1D) - && gvec4(T(0)) == texture(gsampler1D, float(0)) - && gvec4(T(0)) == texture(gsampler1D, float(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec2(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec2(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec4(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec4(0), float(0)) - && gvec4(T(0)) == textureLod(gsampler1D, float(0), float(0)) - && gvec4(T(0)) == textureOffset(gsampler1D, float(0), __LINE__) - && gvec4(T(0)) == textureOffset(gsampler1D, float(0), __LINE__, float(0)) - && gvec4(T(0)) == texelFetch(gsampler1D, int(0), int(0)) - && gvec4(T(0)) == texelFetchOffset(gsampler1D, int(0), int(0), __LINE__) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__, float(0)) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__,float(0)) - && gvec4(T(0)) == textureLodOffset(gsampler1D, float(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjLod(gsampler1D, vec2(0), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler1D, vec4(0), float(0)) - && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec2(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec4(0), float(0), __LINE__) - && gvec4(T(0)) == textureGrad(gsampler1D, float(0), float(0), float(0)) - && gvec4(T(0)) == textureGradOffset(gsampler1D, float(0), float(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjGrad(gsampler1D, vec2(0), float(0), float(0)) - && gvec4(T(0)) == textureProjGrad(gsampler1D, vec4(0), float(0), float(0)) - && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec2(0), float(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec4(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == texture(gsampler1D, float(0)) + && gvec4(T.Element(0)) == texture(gsampler1D, float(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec2(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec2(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec4(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler1D, float(0), float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler1D, float(0), __LINE__) + && gvec4(T.Element(0)) == textureOffset(gsampler1D, float(0), __LINE__, float(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler1D, int(0), int(0)) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1D, int(0), int(0), __LINE__) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__,float(0)) + && gvec4(T.Element(0)) == textureLodOffset(gsampler1D, float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjLod(gsampler1D, vec2(0), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler1D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler1D, vec2(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler1D, vec4(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureGrad(gsampler1D, float(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureGradOffset(gsampler1D, float(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjGrad(gsampler1D, vec2(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler1D, vec4(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler1D, vec2(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler1D, vec4(0), float(0), float(0), __LINE__) && vec4(0) == texture1D(uniform_sampler1D, float(0)) && vec4(0) == texture1D(uniform_sampler1D, float(0), float(0)) && vec4(0) == texture1DProj(uniform_sampler1D, vec2(0)) diff --git a/tests/glsl-intrinsic/intrinsic-texture.slang b/tests/glsl-intrinsic/intrinsic-texture.slang index c1e73e73d..7ad9fcf55 100644 --- a/tests/glsl-intrinsic/intrinsic-texture.slang +++ b/tests/glsl-intrinsic/intrinsic-texture.slang @@ -7,7 +7,7 @@ //TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage compute -entry computeMain -target cuda -DCUDA //TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage fragment -entry fragMain -target cuda -DCUDA -//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type -xslang -DSPIRV +//DISABLED_TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -output-using-type -xslang -DSPIRV // TODO: This test revealed a few problems for a path from GLSL to HLSL //T-EST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-dx12 -compute -entry computeMain -allow-glsl -use-dxil -output-using-type -profile cs_6_6 -xslang -DHLSL @@ -138,32 +138,32 @@ uniform usampler2DArray uniform_usampler2DArray; //TEST_INPUT: TextureSamplerCube(size=4, content = zero, arrayLength = 2):name uniform_usamplerCubeArray uniform usamplerCubeArray uniform_usamplerCubeArray; -//TEST_INPUT: TextureSampler1D(size=4, content = zero):name uniform_usamplerBuffer +//TEST_INPUT: Texture1D(size=4, content = zero):name uniform_usamplerBuffer uniform usamplerBuffer uniform_usamplerBuffer; -//TEST_INPUT: TextureSampler2D(size=4, content = zero):name uniform_usampler2DMS +//TEST_INPUT: Texture2D(size=4, content = zero):name uniform_usampler2DMS uniform usampler2DMS uniform_usampler2DMS; -//TEST_INPUT: TextureSampler2D(size=4, content = zero, arrayLength = 2):name uniform_usampler2DMSArray +//TEST_INPUT: Texture2D(size=4, content = zero, arrayLength = 2):name uniform_usampler2DMSArray uniform usampler2DMSArray uniform_usampler2DMSArray; -__generic<T : __BuiltinArithmeticType, let N:int> -bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D - , Sampler2D<vector<T,N>> gsampler2D - , Sampler2DRect<vector<T,N>> gsampler2DRect - , Sampler3D<vector<T,N>> gsampler3D - , SamplerCube<vector<T,N>> gsamplerCube - , Sampler1DArray<vector<T,N>> gsampler1DArray - , Sampler2DArray<vector<T,N>> gsampler2DArray - , SamplerCubeArray<vector<T,N>> gsamplerCubeArray - , SamplerBuffer<vector<T,N>> gsamplerBuffer - , Sampler2DMS<vector<T,N>> gsampler2DMS - , Sampler2DMSArray<vector<T,N>> gsampler2DMSArray +__generic<T : ITexelElement> +bool textureFuncs( Sampler1D<T> gsampler1D + , Sampler2D<T> gsampler2D + , Sampler2DRect<T> gsampler2DRect + , Sampler3D<T> gsampler3D + , SamplerCube<T> gsamplerCube + , Sampler1DArray<T> gsampler1DArray + , Sampler2DArray<T> gsampler2DArray + , SamplerCubeArray<T> gsamplerCubeArray + , SamplerBuffer<T> gsamplerBuffer + , Sampler2DMS<T> gsampler2DMS + , Sampler2DMSArray<T> gsampler2DMSArray , bool ignoreResult ) { // GLSL-LABEL: textureFuncs_0 - typealias gvec4 = vector<T,4>; + typealias gvec4 = vector<T.Element,4>; constexpr float coord = 0.5; @@ -171,8 +171,8 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D constexpr ivec3 offset3D = ivec3(3); constexpr ivec2 offsets[4] = { ivec2(1), ivec2(2), ivec2(3), ivec2(4) }; - bool ignoreResultF32 = ignoreResult && T is float; - bool ignoreResultI32 = ignoreResult && T is int32_t; + bool ignoreResultF32 = ignoreResult && T.Element is float; + bool ignoreResultI32 = ignoreResult && T.Element is int32_t; return true // 8.9.1. Texture Query Functions @@ -444,42 +444,42 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: texture({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsampler1D, float(coord)) + && gvec4(T.Element(0)) == texture(gsampler1D, float(coord)) // GLSL: texture({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsampler1D, float(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsampler1D, float(coord), float(0)) // GLSL: texture({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsampler2D, vec2(coord)) + && gvec4(T.Element(0)) == texture(gsampler2D, vec2(coord)) // GLSL: texture({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsampler2D, vec2(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsampler2D, vec2(coord), float(0)) // GLSL: texture({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsampler3D, vec3(coord)) + && gvec4(T.Element(0)) == texture(gsampler3D, vec3(coord)) // GLSL: texture({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsampler3D, vec3(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsampler3D, vec3(coord), float(0)) // GLSL: texture({{.*}}samplerCube // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsamplerCube, vec3(coord)) + && gvec4(T.Element(0)) == texture(gsamplerCube, vec3(coord)) // GLSL: texture({{.*}}samplerCube // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsamplerCube, vec3(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsamplerCube, vec3(coord), float(0)) // GLSL: texture({{.*}}sampler1DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow @@ -514,32 +514,32 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: texture({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsampler2DArray, vec3(coord)) + && gvec4(T.Element(0)) == texture(gsampler2DArray, vec3(coord)) // GLSL: texture({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsampler2DArray, vec3(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsampler2DArray, vec3(coord), float(0)) // GLSL: texture({{.*}}samplerCubeArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(coord)) + && gvec4(T.Element(0)) == texture(gsamplerCubeArray, vec4(coord)) // GLSL: texture({{.*}}samplerCubeArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsamplerCubeArray, vec4(coord), float(0)) // GLSL: texture({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsampler1DArray, vec2(coord)) + && gvec4(T.Element(0)) == texture(gsampler1DArray, vec2(coord)) // GLSL: texture({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == texture(gsampler1DArray, vec2(coord), float(0)) + && gvec4(T.Element(0)) == texture(gsampler1DArray, vec2(coord), float(0)) // GLSL: texture({{.*}}sampler1DArrayShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow @@ -559,7 +559,7 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: texture({{.*}}sampler2DRect // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] - && gvec4(T(0)) == texture(gsampler2DRect, vec2(coord)) + && gvec4(T.Element(0)) == texture(gsampler2DRect, vec2(coord)) // GLSL: texture({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -574,52 +574,52 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureProj({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] - && gvec4(T(0)) == textureProj(gsampler1D, vec2(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec2(coord)) // GLSL: textureProj({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == textureProj(gsampler1D, vec2(coord), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec2(coord), float(0)) // GLSL: textureProj({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] - && gvec4(T(0)) == textureProj(gsampler1D, vec4(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec4(coord)) // GLSL: textureProj({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == textureProj(gsampler1D, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec4(coord), float(0)) // GLSL: textureProj({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] - && gvec4(T(0)) == textureProj(gsampler2D, vec3(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec3(coord)) // GLSL: textureProj({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == textureProj(gsampler2D, vec3(coord), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec3(coord), float(0)) // GLSL: textureProj({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] - && gvec4(T(0)) == textureProj(gsampler2D, vec4(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec4(coord)) // GLSL: textureProj({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == textureProj(gsampler2D, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec4(coord), float(0)) // GLSL: textureProj({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] - && gvec4(T(0)) == textureProj(gsampler3D, vec4(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler3D, vec4(coord)) // GLSL: textureProj({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % - && gvec4(T(0)) == textureProj(gsampler3D, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler3D, vec4(coord), float(0)) // GLSL: textureProj({{.*}}sampler1DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow @@ -644,8 +644,8 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureProj({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] - && gvec4(T(0)) == textureProj(gsampler2DRect, vec3(coord)) - && gvec4(T(0)) == textureProj(gsampler2DRect, vec4(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler2DRect, vec3(coord)) + && gvec4(T.Element(0)) == textureProj(gsampler2DRect, vec4(coord)) // GLSL: textureProj({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -655,22 +655,22 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureLod({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsampler1D, float(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler1D, float(coord), float(0)) // GLSL: textureLod({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsampler2D, vec2(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler2D, vec2(coord), float(0)) // GLSL: textureLod({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsampler3D, vec3(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler3D, vec3(coord), float(0)) // GLSL: textureLod({{.*}}samplerCube // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsamplerCube, vec3(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsamplerCube, vec3(coord), float(0)) // GLSL: textureLod({{.*}}sampler2DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow @@ -685,7 +685,7 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureLod({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsampler1DArray, vec2(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler1DArray, vec2(coord), float(0)) // GLSL: textureLod({{.*}}sampler1DArrayShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow @@ -695,42 +695,42 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureLod({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsampler2DArray, vec3(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler2DArray, vec3(coord), float(0)) // GLSL: textureLod({{.*}}samplerCubeArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureLod(gsamplerCubeArray, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureLod(gsamplerCubeArray, vec4(coord), float(0)) // GLSL: textureOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}}ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler1D, float(coord), int(1)) + && gvec4(T.Element(0)) == textureOffset(gsampler1D, float(coord), int(1)) // GLSL: textureOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler1D, float(coord), int(0), float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler1D, float(coord), int(0), float(0)) // GLSL: textureOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}}ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler2D, vec2(coord), offset2D) + && gvec4(T.Element(0)) == textureOffset(gsampler2D, vec2(coord), offset2D) // GLSL: textureOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler2D, vec2(coord), offset2D, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler2D, vec2(coord), offset2D, float(0)) // GLSL: textureOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}}ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler3D, vec3(coord), offset3D) + && gvec4(T.Element(0)) == textureOffset(gsampler3D, vec3(coord), offset3D) // GLSL: textureOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler3D, vec3(coord), offset3D, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler3D, vec3(coord), offset3D, float(0)) // GLSL: textureOffset({{.*}}sampler2DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow @@ -745,7 +745,7 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureOffset({{.*}}sampler2DRect // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}}ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler2DRect, vec2(coord), offset2D) + && gvec4(T.Element(0)) == textureOffset(gsampler2DRect, vec2(coord), offset2D) // GLSL: textureOffset({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -765,22 +765,22 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureOffset({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}}ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler1DArray, vec2(coord), int(1)) + && gvec4(T.Element(0)) == textureOffset(gsampler1DArray, vec2(coord), int(1)) // GLSL: textureOffset({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler1DArray, vec2(coord), int(0), float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler1DArray, vec2(coord), int(0), float(0)) // GLSL: textureOffset({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}}ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler2DArray, vec3(coord), offset2D) + && gvec4(T.Element(0)) == textureOffset(gsampler2DArray, vec3(coord), offset2D) // GLSL: textureOffset({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureOffset(gsampler2DArray, vec3(coord), offset2D, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler2DArray, vec3(coord), offset2D, float(0)) // GLSL: textureOffset({{.*}}sampler1DArrayShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow @@ -801,146 +801,146 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler1D, int(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler1D, int(coord), int(0)) // GLSL: texelFetch({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler2D, ivec2(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2D, ivec2(coord), int(0)) // GLSL: texelFetch({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler3D, ivec3(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler3D, ivec3(coord), int(0)) // GLSL: texelFetch({{.*}}sampler2DRect // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]] - && gvec4(T(0)) == texelFetch(gsampler2DRect, ivec2(coord)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DRect, ivec2(coord)) // GLSL: texelFetch({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler1DArray, ivec2(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler1DArray, ivec2(coord), int(0)) // GLSL: texelFetch({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler2DArray, ivec3(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DArray, ivec3(coord), int(0)) // GLSL: imageLoad({{.*}}samplerBuffer // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerBuffer // SPIR: OpImageRead {{.*}}[[LOAD]] - && (gvec4(T(0)) == texelFetch(gsamplerBuffer, int(coord)) || ignoreResultF32) + && (gvec4(T.Element(0)) == texelFetch(gsamplerBuffer, int(coord)) || ignoreResultF32) // GLSL: texelFetch({{.*}}sampler2DMS // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DMS // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // S-PIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler2DMS, ivec2(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DMS, ivec2(coord), int(0)) // GLSL: texelFetch({{.*}}sampler2DMSArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DMSArray // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // S-PIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod % - && gvec4(T(0)) == texelFetch(gsampler2DMSArray, ivec3(coord), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DMSArray, ivec3(coord), int(0)) // GLSL: texelFetchOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == texelFetchOffset(gsampler1D, int(coord), int(0), int(0)) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1D, int(coord), int(0), int(0)) // GLSL: texelFetchOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == texelFetchOffset(gsampler2D, ivec2(coord), int(0), offset2D) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2D, ivec2(coord), int(0), offset2D) // GLSL: texelFetchOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == texelFetchOffset(gsampler3D, ivec3(coord), int(0), offset3D) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler3D, ivec3(coord), int(0), offset3D) // GLSL: texelFetchOffset({{.*}}sampler2DRect // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == texelFetchOffset(gsampler2DRect, ivec2(coord), offset2D) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2DRect, ivec2(coord), offset2D) // GLSL: texelFetchOffset({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == texelFetchOffset(gsampler1DArray, ivec2(coord), int(0), int(0)) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1DArray, ivec2(coord), int(0), int(0)) // GLSL: texelFetchOffset({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] // SPIR: OpImageFetch {{.*}}[[IMAGE]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == texelFetchOffset(gsampler2DArray, ivec3(coord), int(0), offset2D) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2DArray, ivec3(coord), int(0), offset2D) // GLSL: textureProjOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(coord), int(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec2(coord), int(0)) // GLSL: textureProjOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(coord), int(0), float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec2(coord), int(0), float(0)) // GLSL: textureProjOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(coord), int(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec4(coord), int(0)) // GLSL: textureProjOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(coord), int(0), float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec4(coord), int(0), float(0)) // GLSL: textureProjOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec3(coord), offset2D) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec3(coord), offset2D) // GLSL: textureProjOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec3(coord), offset2D, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec3(coord), offset2D, float(0)) // GLSL: textureProjOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec4(coord), offset2D) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec4(coord), offset2D) // GLSL: textureProjOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec4(coord), offset2D, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec4(coord), offset2D, float(0)) // GLSL: textureProjOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler3D, vec4(coord), offset3D) + && gvec4(T.Element(0)) == textureProjOffset(gsampler3D, vec4(coord), offset3D) // GLSL: textureProjOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler3D, vec4(coord), offset3D, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler3D, vec4(coord), offset3D, float(0)) // GLSL-COUNT-2: textureProjOffset({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureProjOffset(gsampler2DRect, vec3(coord), offset2D) - && gvec4(T(0)) == textureProjOffset(gsampler2DRect, vec4(coord), offset2D) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2DRect, vec3(coord), offset2D) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2DRect, vec4(coord), offset2D) // GLSL: textureProjOffset({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -970,17 +970,17 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureLodOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureLodOffset(gsampler1D, float(coord), float(0), 0) + && gvec4(T.Element(0)) == textureLodOffset(gsampler1D, float(coord), float(0), 0) // GLSL: textureLodOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureLodOffset(gsampler2D, vec2(coord), float(0), offset2D) + && gvec4(T.Element(0)) == textureLodOffset(gsampler2D, vec2(coord), float(0), offset2D) // GLSL: textureLodOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureLodOffset(gsampler3D, vec3(coord), float(0), offset3D) + && gvec4(T.Element(0)) == textureLodOffset(gsampler3D, vec3(coord), float(0), offset3D) // GLSL: textureLodOffset({{.*}}sampler1DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow @@ -995,12 +995,12 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureLodOffset({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureLodOffset(gsampler1DArray, vec2(coord), float(0), 0) + && gvec4(T.Element(0)) == textureLodOffset(gsampler1DArray, vec2(coord), float(0), 0) // GLSL: textureLodOffset({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureLodOffset(gsampler2DArray, vec3(coord), float(0), offset2D) + && gvec4(T.Element(0)) == textureLodOffset(gsampler2DArray, vec3(coord), float(0), offset2D) // GLSL: textureLodOffset({{.*}}sampler1DArrayShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow @@ -1010,19 +1010,19 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureProjLod({{.*}}sampler1D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureProjLod(gsampler1D, vec2(coord), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler1D, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler1D, vec2(coord), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler1D, vec4(coord), float(0)) // GLSL-COUNT-2: textureProjLod({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureProjLod(gsampler2D, vec3(coord), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler2D, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler2D, vec3(coord), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler2D, vec4(coord), float(0)) // GLSL: textureProjLod({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % - && gvec4(T(0)) == textureProjLod(gsampler3D, vec4(coord), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler3D, vec4(coord), float(0)) // GLSL: textureProjLod({{.*}}sampler1DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow @@ -1037,19 +1037,19 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureProjLodOffset({{.*}}sampler1D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec2(coord), float(0), 0) - && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec4(coord), float(0), 0) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler1D, vec2(coord), float(0), 0) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler1D, vec4(coord), float(0), 0) // GLSL-COUNT-2: textureProjLodOffset({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec3(coord), float(0), offset2D) - && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec4(coord), float(0), offset2D) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler2D, vec3(coord), float(0), offset2D) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler2D, vec4(coord), float(0), offset2D) // GLSL: textureProjLodOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % - && gvec4(T(0)) == textureProjLodOffset(gsampler3D, vec4(coord), float(0), offset3D) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler3D, vec4(coord), float(0), offset3D) // GLSL: textureProjLodOffset({{.*}}sampler1DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow @@ -1064,27 +1064,27 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureGrad({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsampler1D, float(coord), float(0), float(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler1D, float(coord), float(0), float(0)) // GLSL: textureGrad({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsampler2D, vec2(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler2D, vec2(coord), vec2(0), vec2(0)) // GLSL: textureGrad({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsampler3D, vec3(coord), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler3D, vec3(coord), vec3(0), vec3(0)) // GLSL: textureGrad({{.*}}samplerCube // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsamplerCube, vec3(coord), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureGrad(gsamplerCube, vec3(coord), vec3(0), vec3(0)) // GLSL: textureGrad({{.*}}sampler2DRect // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsampler2DRect, vec2(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler2DRect, vec2(coord), vec2(0), vec2(0)) // GLSL: textureGrad({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -1099,12 +1099,12 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureGrad({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsampler1DArray, vec2(coord), float(0), float(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler1DArray, vec2(coord), float(0), float(0)) // GLSL: textureGrad({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsampler2DArray, vec3(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler2DArray, vec3(coord), vec2(0), vec2(0)) // GLSL: textureGrad({{.*}}sampler1DArrayShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow @@ -1129,27 +1129,27 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureGrad({{.*}}samplerCubeArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureGrad(gsamplerCubeArray, vec4(coord), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureGrad(gsamplerCubeArray, vec4(coord), vec3(0), vec3(0)) // GLSL: textureGradOffset({{.*}}sampler1D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureGradOffset(gsampler1D, float(coord), float(0), float(0), 0) + && gvec4(T.Element(0)) == textureGradOffset(gsampler1D, float(coord), float(0), float(0), 0) // GLSL: textureGradOffset({{.*}}sampler2D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureGradOffset(gsampler2D, vec2(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureGradOffset(gsampler2D, vec2(coord), vec2(0), vec2(0), offset2D) // GLSL: textureGradOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureGradOffset(gsampler3D, vec3(coord), vec3(0), vec3(0), offset3D) + && gvec4(T.Element(0)) == textureGradOffset(gsampler3D, vec3(coord), vec3(0), vec3(0), offset3D) // GLSL: textureGradOffset({{.*}}sampler2DRect // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureGradOffset(gsampler2DRect, vec2(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureGradOffset(gsampler2DRect, vec2(coord), vec2(0), vec2(0), offset2D) // GLSL: textureGradOffset({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -1169,12 +1169,12 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL: textureGradOffset({{.*}}sampler2DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureGradOffset(gsampler2DArray, vec3(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureGradOffset(gsampler2DArray, vec3(coord), vec2(0), vec2(0), offset2D) // GLSL: textureGradOffset({{.*}}sampler1DArray // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureGradOffset(gsampler1DArray, vec2(coord), float(0), float(0), int(0)) + && gvec4(T.Element(0)) == textureGradOffset(gsampler1DArray, vec2(coord), float(0), float(0), int(0)) // GLSL: textureGradOffset({{.*}}sampler1DArrayShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow @@ -1189,25 +1189,25 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureProjGrad({{.*}}sampler1D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureProjGrad(gsampler1D, vec2(coord), float(0), float(0)) - && gvec4(T(0)) == textureProjGrad(gsampler1D, vec4(coord), float(0), float(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler1D, vec2(coord), float(0), float(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler1D, vec4(coord), float(0), float(0)) // GLSL-COUNT-2: textureProjGrad({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureProjGrad(gsampler2D, vec3(coord), vec2(0), vec2(0)) - && gvec4(T(0)) == textureProjGrad(gsampler2D, vec4(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2D, vec3(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2D, vec4(coord), vec2(0), vec2(0)) // GLSL: textureProjGrad({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureProjGrad(gsampler3D, vec4(coord), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler3D, vec4(coord), vec3(0), vec3(0)) // GLSL-COUNT-2: textureProjGrad({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % - && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec3(coord), vec2(0), vec2(0)) - && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec4(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2DRect, vec3(coord), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2DRect, vec4(coord), vec2(0), vec2(0)) // GLSL: textureProjGrad({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -1227,25 +1227,25 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureProjGradOffset({{.*}}sampler1D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec2(coord), float(0), float(0), 0) - && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec4(coord), float(0), float(0), 0) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler1D, vec2(coord), float(0), float(0), 0) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler1D, vec4(coord), float(0), float(0), 0) // GLSL-COUNT-2: textureProjGradOffset({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec3(coord), vec2(0), vec2(0), offset2D) - && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec4(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2D, vec3(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2D, vec4(coord), vec2(0), vec2(0), offset2D) // GLSL: textureProjGradOffset({{.*}}sampler3D // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureProjGradOffset(gsampler3D, vec4(coord), vec3(0), vec3(0), offset3D) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler3D, vec4(coord), vec3(0), vec3(0), offset3D) // GLSL-COUNT-2: textureProjGradOffset({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % - && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec3(coord), vec2(0), vec2(0), offset2D) - && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec4(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2DRect, vec3(coord), vec2(0), vec2(0), offset2D) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2DRect, vec4(coord), vec2(0), vec2(0), offset2D) // GLSL: textureProjGradOffset({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -1267,32 +1267,32 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureGather({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageGather {{.*}}[[LOAD]] - && gvec4(T(0)) == textureGather(gsampler2D, vec2(coord)) - && gvec4(T(0)) == textureGather(gsampler2D, vec2(coord), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2D, vec2(coord)) + && gvec4(T.Element(0)) == textureGather(gsampler2D, vec2(coord), int(0)) // GLSL-COUNT-2: textureGather({{.*}}sampler2DArray // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageGather {{.*}}[[LOAD]] - && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(coord)) - && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(coord), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DArray, vec3(coord)) + && gvec4(T.Element(0)) == textureGather(gsampler2DArray, vec3(coord), int(0)) // GLSL-COUNT-2: textureGather({{.*}}samplerCube // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube // SPIR: OpImageGather {{.*}}[[LOAD]] - && gvec4(T(0)) == textureGather(gsamplerCube, vec3(coord)) - && gvec4(T(0)) == textureGather(gsamplerCube, vec3(coord), int(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCube, vec3(coord)) + && gvec4(T.Element(0)) == textureGather(gsamplerCube, vec3(coord), int(0)) // GLSL-COUNT-2: textureGather({{.*}}samplerCubeArray // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray // SPIR: OpImageGather {{.*}}[[LOAD]] - && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(coord)) - && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(coord), int(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCubeArray, vec4(coord)) + && gvec4(T.Element(0)) == textureGather(gsamplerCubeArray, vec4(coord), int(0)) // GLSL-COUNT-2: textureGather({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageGather {{.*}}[[LOAD]] - && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(coord)) - && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(coord), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DRect, vec2(coord)) + && gvec4(T.Element(0)) == textureGather(gsampler2DRect, vec2(coord), int(0)) // GLSL: textureGather({{.*}}sampler2DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow @@ -1322,14 +1322,14 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureGatherOffset({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageGather {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(coord), offset2D) - && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(coord), offset2D, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2D, vec2(coord), offset2D) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2D, vec2(coord), offset2D, int(0)) // GLSL-COUNT-2: textureGatherOffset({{.*}}sampler2DArray // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageGather {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(coord), offset2D) - && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(coord), offset2D, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DArray, vec3(coord), offset2D) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DArray, vec3(coord), offset2D, int(0)) // GLSL: textureGatherOffset({{.*}}sampler2DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow @@ -1344,8 +1344,8 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureGatherOffset({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageGather {{.*}}[[LOAD]]{{.*}} ConstOffset % - && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(coord), offset2D) - && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(coord), offset2D, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DRect, vec2(coord), offset2D) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DRect, vec2(coord), offset2D, int(0)) // GLSL: textureGatherOffset({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow @@ -1355,14 +1355,14 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureGatherOffsets({{.*}}sampler2D // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D // SPIR: OpImageGather {{.*}}[[LOAD]]{{.*}} ConstOffsets % - && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(coord), offsets) - && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(coord), offsets, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2D, vec2(coord), offsets) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2D, vec2(coord), offsets, int(0)) // GLSL-COUNT-2: textureGatherOffsets({{.*}}sampler2DArray // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray // SPIR: OpImageGather {{.*}}[[LOAD]]{{.*}} ConstOffsets % - && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(coord), offsets) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(coord), offsets, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DArray, vec3(coord), offsets) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DArray, vec3(coord), offsets, int(0)) // GLSL: textureGatherOffsets({{.*}}sampler2DShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow @@ -1377,8 +1377,8 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D // GLSL-COUNT-2: textureGatherOffsets({{.*}}sampler2DRect // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect // SPIR: OpImageGather {{.*}}[[LOAD]]{{.*}} ConstOffsets % - && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(coord), offsets) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(coord), offsets, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DRect, vec2(coord), offsets) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DRect, vec2(coord), offsets, int(0)) // GLSL: textureGatherOffsets({{.*}}sampler2DRectShadow // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow diff --git a/tests/language-feature/capability/intrinsic-texture-ignore-capability.slang b/tests/language-feature/capability/intrinsic-texture-ignore-capability.slang index 148eff07a..dfdbb7083 100644 --- a/tests/language-feature/capability/intrinsic-texture-ignore-capability.slang +++ b/tests/language-feature/capability/intrinsic-texture-ignore-capability.slang @@ -50,19 +50,19 @@ uniform usampler2DArray uniform_usampler2DArray; uniform usamplerCubeArray uniform_usamplerCubeArray; uniform usamplerBuffer uniform_usamplerBuffer; -__generic<T : __BuiltinFloatingPointType, let N : int> -bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D - , Sampler2D<vector<T,N>> gsampler2D - , Sampler2DRect<vector<T,N>> gsampler2DRect - , Sampler3D<vector<T,N>> gsampler3D - , SamplerCube<vector<T,N>> gsamplerCube - , Sampler1DArray<vector<T,N>> gsampler1DArray - , Sampler2DArray<vector<T,N>> gsampler2DArray - , SamplerCubeArray<vector<T,N>> gsamplerCubeArray - , SamplerBuffer<vector<T,N>> gsamplerBuffer +__generic<T : ITexelElement> +bool textureFuncs( Sampler1D<T> gsampler1D + , Sampler2D<T> gsampler2D + , Sampler2DRect<T> gsampler2DRect + , Sampler3D<T> gsampler3D + , SamplerCube<T> gsamplerCube + , Sampler1DArray<T> gsampler1DArray + , Sampler2DArray<T> gsampler2DArray + , SamplerCubeArray<T> gsamplerCubeArray + , SamplerBuffer<T> gsamplerBuffer ) { - typealias gvec4 = vector<T,4>; + typealias gvec4 = vector<T.Element,4>; constexpr ivec2 ivec2_0 = ivec2(0); @@ -111,209 +111,209 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D && int(0) == textureQueryLevels(uniform_sampler2DArrayShadow) && int(0) == textureQueryLevels(uniform_samplerCubeArrayShadow) // 8.9.2. Texel Lookup Functions - && gvec4(T(0)) == texture(gsampler1D, float(0)) - && gvec4(T(0)) == texture(gsampler1D, float(0), float(0)) - && gvec4(T(0)) == texture(gsampler2D, vec2(0)) - && gvec4(T(0)) == texture(gsampler2D, vec2(0), float(0)) - && gvec4(T(0)) == texture(gsampler3D, vec3(0)) - && gvec4(T(0)) == texture(gsampler3D, vec3(0), float(0)) - && gvec4(T(0)) == texture(gsamplerCube, vec3(0) ) - && gvec4(T(0)) == texture(gsamplerCube, vec3(0), float(0)) + && gvec4(T.Element(0)) == texture(gsampler1D, float(0)) + && gvec4(T.Element(0)) == texture(gsampler1D, float(0), float(0)) + && gvec4(T.Element(0)) == texture(gsampler2D, vec2(0)) + && gvec4(T.Element(0)) == texture(gsampler2D, vec2(0), float(0)) + && gvec4(T.Element(0)) == texture(gsampler3D, vec3(0)) + && gvec4(T.Element(0)) == texture(gsampler3D, vec3(0), float(0)) + && gvec4(T.Element(0)) == texture(gsamplerCube, vec3(0) ) + && gvec4(T.Element(0)) == texture(gsamplerCube, vec3(0), float(0)) && float(0) == texture(uniform_sampler1DShadow, vec3(0)) && float(0) == texture(uniform_sampler1DShadow, vec3(0), float(0)) && float(0) == texture(uniform_sampler2DShadow, vec3(0)) && float(0) == texture(uniform_sampler2DShadow, vec3(0), float(0)) && float(0) == texture(uniform_samplerCubeShadow, vec4(0)) && float(0) == texture(uniform_samplerCubeShadow, vec4(0), float(0)) - && gvec4(T(0)) == texture(gsampler2DArray, vec3(0)) - && gvec4(T(0)) == texture(gsampler2DArray, vec3(0), float(0)) - && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(0) ) - && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(0), float(0)) - && gvec4(T(0)) == texture(gsampler1DArray, vec2(0)) - && gvec4(T(0)) == texture(gsampler1DArray, vec2(0), float(0)) + && gvec4(T.Element(0)) == texture(gsampler2DArray, vec3(0)) + && gvec4(T.Element(0)) == texture(gsampler2DArray, vec3(0), float(0)) + && gvec4(T.Element(0)) == texture(gsamplerCubeArray, vec4(0) ) + && gvec4(T.Element(0)) == texture(gsamplerCubeArray, vec4(0), float(0)) + && gvec4(T.Element(0)) == texture(gsampler1DArray, vec2(0)) + && gvec4(T.Element(0)) == texture(gsampler1DArray, vec2(0), float(0)) && float(0) == texture(uniform_sampler1DArrayShadow, vec3(0)) && float(0) == texture(uniform_sampler1DArrayShadow, vec3(0), float(0)) && float(0) == texture(uniform_sampler2DArrayShadow, vec4(0)) - && gvec4(T(0)) == texture(gsampler2DRect, vec2(0)) + && gvec4(T.Element(0)) == texture(gsampler2DRect, vec2(0)) && float(0) == texture(uniform_sampler2DRectShadow, vec3(0)) && float(0) == texture(uniform_samplerCubeArrayShadow, vec4(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec2(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec2(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec4(0)) - && gvec4(T(0)) == textureProj(gsampler1D, vec4(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler2D, vec3(0)) - && gvec4(T(0)) == textureProj(gsampler2D, vec3(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler2D, vec4(0)) - && gvec4(T(0)) == textureProj(gsampler2D, vec4(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler3D, vec4(0)) - && gvec4(T(0)) == textureProj(gsampler3D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec2(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec2(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec4(0)) + && gvec4(T.Element(0)) == textureProj(gsampler1D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec3(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec3(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec4(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProj(gsampler3D, vec4(0)) + && gvec4(T.Element(0)) == textureProj(gsampler3D, vec4(0), float(0)) && float(0) == textureProj(uniform_sampler1DShadow, vec4(0)) && float(0) == textureProj(uniform_sampler1DShadow, vec4(0), float(0)) && float(0) == textureProj(uniform_sampler2DShadow, vec4(0)) && float(0) == textureProj(uniform_sampler2DShadow, vec4(0), float(0)) - && gvec4(T(0)) == textureProj(gsampler2DRect, vec3(0)) - && gvec4(T(0)) == textureProj(gsampler2DRect, vec4(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2DRect, vec3(0)) + && gvec4(T.Element(0)) == textureProj(gsampler2DRect, vec4(0)) && float(0) == textureProj(uniform_sampler2DRectShadow, vec4(0)) - && gvec4(T(0)) == textureLod(gsampler1D, float(0), float(0)) - && gvec4(T(0)) == textureLod(gsampler2D, vec2(0), float(0)) - && gvec4(T(0)) == textureLod(gsampler3D, vec3(0), float(0)) - && gvec4(T(0)) == textureLod(gsamplerCube, vec3(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler1D, float(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler2D, vec2(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler3D, vec3(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsamplerCube, vec3(0), float(0)) && float(0) == textureLod(uniform_sampler2DShadow, vec3(0), float(0)) && float(0) == textureLod(uniform_sampler1DShadow, vec3(0), float(0)) - && gvec4(T(0)) == textureLod(gsampler1DArray, vec2(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler1DArray, vec2(0), float(0)) && float(0) == textureLod(uniform_sampler1DArrayShadow, vec3(0), float(0)) - && gvec4(T(0)) == textureLod(gsampler2DArray, vec3(0), float(0)) - && gvec4(T(0)) == textureLod(gsamplerCubeArray, vec4(0), float(0)) - && gvec4(T(0)) == textureOffset(gsampler1D, float(0), __LINE__) - && gvec4(T(0)) == textureOffset(gsampler1D, float(0), __LINE__, float(0)) - && gvec4(T(0)) == textureOffset(gsampler2D, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureOffset(gsampler2D, vec2(0), { __LINE__ }, float(0)) - && gvec4(T(0)) == textureOffset(gsampler3D, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureOffset(gsampler3D, vec3(0), { __LINE__ }, float(0)) + && gvec4(T.Element(0)) == textureLod(gsampler2DArray, vec3(0), float(0)) + && gvec4(T.Element(0)) == textureLod(gsamplerCubeArray, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler1D, float(0), __LINE__) + && gvec4(T.Element(0)) == textureOffset(gsampler1D, float(0), __LINE__, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler2D, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureOffset(gsampler2D, vec2(0), { __LINE__ }, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler3D, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureOffset(gsampler3D, vec3(0), { __LINE__ }, float(0)) && float(0) == textureOffset(uniform_sampler2DShadow, vec3(0), { __LINE__ }) && float(0) == textureOffset(uniform_sampler2DShadow, vec3(0), { __LINE__ }, float(0)) - && gvec4(T(0)) == textureOffset(gsampler2DRect, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureOffset(gsampler2DRect, vec2(0), { __LINE__ }) && float(0) == textureOffset(uniform_sampler2DRectShadow, vec3(0), { __LINE__ }) && float(0) == textureOffset(uniform_sampler1DShadow, vec3(0), __LINE__) && float(0) == textureOffset(uniform_sampler1DShadow, vec3(0), __LINE__, float(0)) - && gvec4(T(0)) == textureOffset(gsampler1DArray, vec2(0), __LINE__) - && gvec4(T(0)) == textureOffset(gsampler1DArray, vec2(0), __LINE__, float(0)) - && gvec4(T(0)) == textureOffset(gsampler2DArray, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureOffset(gsampler2DArray, vec3(0), { __LINE__ }, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler1DArray, vec2(0), __LINE__) + && gvec4(T.Element(0)) == textureOffset(gsampler1DArray, vec2(0), __LINE__, float(0)) + && gvec4(T.Element(0)) == textureOffset(gsampler2DArray, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureOffset(gsampler2DArray, vec3(0), { __LINE__ }, float(0)) && float(0) == textureOffset(uniform_sampler1DArrayShadow, vec3(0), __LINE__) && float(0) == textureOffset(uniform_sampler1DArrayShadow, vec3(0), __LINE__, float(0)) && float(0) == textureOffset(uniform_sampler2DArrayShadow, vec4(0), { __LINE__ }) - && gvec4(T(0)) == texelFetch(gsampler1D, int(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler2D, ivec2(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler3D, ivec3(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler2DRect, ivec2(0)) - && gvec4(T(0)) == texelFetch(gsampler1DArray, ivec2(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler2DArray, ivec3(0), int(0)) - && gvec4(T(0)) == texelFetch(gsamplerBuffer, int(0)) - && gvec4(T(0)) == texelFetchOffset(gsampler1D, int(0), int(0), __LINE__) - && gvec4(T(0)) == texelFetchOffset(gsampler2D, ivec2(0), int(0), { __LINE__ }) - && gvec4(T(0)) == texelFetchOffset(gsampler3D, ivec3(0), int(0), { __LINE__ }) - && gvec4(T(0)) == texelFetchOffset(gsampler2DRect, ivec2(0), { __LINE__ }) - && gvec4(T(0)) == texelFetchOffset(gsampler1DArray, ivec2(0), int(0), __LINE__) - && gvec4(T(0)) == texelFetchOffset(gsampler2DArray, ivec3(0), int(0), { __LINE__ }) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__, float(0)) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__) - && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__,float(0)) - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec3(0), { __LINE__ }, float(0)) - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec4(0), { __LINE__ }) - && gvec4(T(0)) == textureProjOffset(gsampler2D, vec4(0), { __LINE__ }, float(0)) - && gvec4(T(0)) == textureProjOffset(gsampler3D, vec4(0), { __LINE__ }) - && gvec4(T(0)) == textureProjOffset(gsampler3D, vec4(0), { __LINE__ }, float(0)) - && gvec4(T(0)) == textureProjOffset(gsampler2DRect, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureProjOffset(gsampler2DRect, vec4(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetch(gsampler1D, int(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2D, ivec2(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler3D, ivec3(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DRect, ivec2(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler1DArray, ivec2(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DArray, ivec3(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsamplerBuffer, int(0)) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1D, int(0), int(0), __LINE__) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2D, ivec2(0), int(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler3D, ivec3(0), int(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2DRect, ivec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1DArray, ivec2(0), int(0), __LINE__) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2DArray, ivec3(0), int(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec2(0), __LINE__, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__) + && gvec4(T.Element(0)) == textureProjOffset(gsampler1D, vec4(0), __LINE__,float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec3(0), { __LINE__ }, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec4(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2D, vec4(0), { __LINE__ }, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler3D, vec4(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjOffset(gsampler3D, vec4(0), { __LINE__ }, float(0)) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2DRect, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjOffset(gsampler2DRect, vec4(0), { __LINE__ }) && float(0) == textureProjOffset(uniform_sampler2DRectShadow, vec4(0), { __LINE__ }) && float(0) == textureProjOffset(uniform_sampler1DShadow, vec4(0), __LINE__) && float(0) == textureProjOffset(uniform_sampler1DShadow, vec4(0), __LINE__, float(0)) && float(0) == textureProjOffset(uniform_sampler2DShadow, vec4(0), { __LINE__ }) && float(0) == textureProjOffset(uniform_sampler2DShadow, vec4(0), { __LINE__ }, float(0)) - && gvec4(T(0)) == textureLodOffset(gsampler1D, float(0), float(0), __LINE__) - && gvec4(T(0)) == textureLodOffset(gsampler2D, vec2(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureLodOffset(gsampler3D, vec3(0), float(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureLodOffset(gsampler1D, float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureLodOffset(gsampler2D, vec2(0), float(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureLodOffset(gsampler3D, vec3(0), float(0), { __LINE__ }) && float(0) == textureLodOffset(uniform_sampler1DShadow, vec3(0), float(0), __LINE__) && float(1) == textureLodOffset(uniform_sampler2DShadow, vec3(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureLodOffset(gsampler1DArray, vec2(0), float(0), __LINE__) - && gvec4(T(0)) == textureLodOffset(gsampler2DArray, vec3(0), float(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureLodOffset(gsampler1DArray, vec2(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureLodOffset(gsampler2DArray, vec3(0), float(0), { __LINE__ }) && float(0) == textureLodOffset(uniform_sampler1DArrayShadow, vec3(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjLod(gsampler1D, vec2(0), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler1D, vec4(0), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler2D, vec3(0), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler2D, vec4(0), float(0)) - && gvec4(T(0)) == textureProjLod(gsampler3D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler1D, vec2(0), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler1D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler2D, vec3(0), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler2D, vec4(0), float(0)) + && gvec4(T.Element(0)) == textureProjLod(gsampler3D, vec4(0), float(0)) && float(0) == textureProjLod(uniform_sampler1DShadow, vec4(0), float(0)) && float(0) == textureProjLod(uniform_sampler2DShadow, vec4(0), float(0)) - && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec2(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec4(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec3(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec4(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureProjLodOffset(gsampler3D, vec4(0), float(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler1D, vec2(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler1D, vec4(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler2D, vec3(0), float(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler2D, vec4(0), float(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjLodOffset(gsampler3D, vec4(0), float(0), { __LINE__ }) && float(0) == textureProjLodOffset(uniform_sampler1DShadow, vec4(0), float(0), __LINE__) && float(0) == textureProjLodOffset(uniform_sampler2DShadow, vec4(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGrad(gsampler1D, float(0), float(0), float(0)) - && gvec4(T(0)) == textureGrad(gsampler2D, vec2(0), vec2(0), vec2(0)) - && gvec4(T(0)) == textureGrad(gsampler3D, vec3(0), vec3(0), vec3(0)) - && gvec4(T(0)) == textureGrad(gsamplerCube, vec3(0), vec3(0), vec3(0)) - && gvec4(T(0)) == textureGrad(gsampler2DRect, vec2(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler1D, float(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler2D, vec2(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler3D, vec3(0), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureGrad(gsamplerCube, vec3(0), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler2DRect, vec2(0), vec2(0), vec2(0)) && float(0) == textureGrad(uniform_sampler2DRectShadow, vec3(0), vec2(0), vec2(0)) && float(0) == textureGrad(uniform_sampler1DShadow, vec3(0), float(0), float(0)) - && gvec4(T(0)) == textureGrad(gsampler1DArray, vec2(0), float(0), float(0)) - && gvec4(T(0)) == textureGrad(gsampler2DArray, vec3(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler1DArray, vec2(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureGrad(gsampler2DArray, vec3(0), vec2(0), vec2(0)) && float(0) == textureGrad(uniform_sampler1DArrayShadow, vec3(0), float(0), float(0)) && float(0) == textureGrad(uniform_sampler2DShadow, vec3(0), vec2(0), vec2(0)) && float(0) == textureGrad(uniform_samplerCubeShadow, vec4(0), vec3(0), vec3(0)) && float(0) == textureGrad(uniform_sampler2DArrayShadow, vec4(0), vec2(0), vec2(0)) - && gvec4(T(0)) == textureGrad(gsamplerCubeArray, vec4(0), vec3(0), vec3(0)) - && gvec4(T(0)) == textureGradOffset(gsampler1D, float(0), float(0), float(0), __LINE__) - && gvec4(T(0)) == textureGradOffset(gsampler2D, vec2(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGradOffset(gsampler3D, vec3(0), vec3(0), vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureGradOffset(gsampler2DRect, vec2(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGrad(gsamplerCubeArray, vec4(0), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureGradOffset(gsampler1D, float(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureGradOffset(gsampler2D, vec2(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGradOffset(gsampler3D, vec3(0), vec3(0), vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGradOffset(gsampler2DRect, vec2(0), vec2(0), vec2(0), { __LINE__ }) && float(0) == textureGradOffset(uniform_sampler2DRectShadow, vec3(0), vec2(0), vec2(0), { __LINE__ }) && float(0) == textureGradOffset(uniform_sampler1DShadow, vec3(0), float(0), float(0), __LINE__) && float(0) == textureGradOffset(uniform_sampler2DShadow, vec3(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGradOffset(gsampler2DArray, vec3(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGradOffset(gsampler1DArray, vec2(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureGradOffset(gsampler2DArray, vec3(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGradOffset(gsampler1DArray, vec2(0), float(0), float(0), __LINE__) && float(0) == textureGradOffset(uniform_sampler1DArrayShadow, vec3(0), float(0), float(0), __LINE__) && float(0) == textureGradOffset(uniform_sampler2DArrayShadow, vec4(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureProjGrad(gsampler1D, vec2(0), float(0), float(0)) - && gvec4(T(0)) == textureProjGrad(gsampler1D, vec4(0), float(0), float(0)) - && gvec4(T(0)) == textureProjGrad(gsampler2D, vec3(0), vec2(0), vec2(0)) - && gvec4(T(0)) == textureProjGrad(gsampler2D, vec4(0), vec2(0), vec2(0)) - && gvec4(T(0)) == textureProjGrad(gsampler3D, vec4(0), vec3(0), vec3(0)) - && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec3(0), vec2(0), vec2(0)) - && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec4(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler1D, vec2(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler1D, vec4(0), float(0), float(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2D, vec3(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2D, vec4(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler3D, vec4(0), vec3(0), vec3(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2DRect, vec3(0), vec2(0), vec2(0)) + && gvec4(T.Element(0)) == textureProjGrad(gsampler2DRect, vec4(0), vec2(0), vec2(0)) && float(0) == textureProjGrad(uniform_sampler2DRectShadow, vec4(0), vec2(0), vec2(0)) && float(0) == textureProjGrad(uniform_sampler1DShadow, vec4(0), float(0), float(0)) && float(0) == textureProjGrad(uniform_sampler2DShadow, vec4(0), vec2(0), vec2(0)) - && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec2(0), float(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec4(0), float(0), float(0), __LINE__) - && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec3(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec4(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureProjGradOffset(gsampler3D, vec4(0), vec3(0), vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec3(0), vec2(0), vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec4(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler1D, vec2(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler1D, vec4(0), float(0), float(0), __LINE__) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2D, vec3(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2D, vec4(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler3D, vec4(0), vec3(0), vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2DRect, vec3(0), vec2(0), vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureProjGradOffset(gsampler2DRect, vec4(0), vec2(0), vec2(0), { __LINE__ }) && float(0) == textureProjGradOffset(uniform_sampler2DRectShadow, vec4(0), vec2(0), vec2(0), { __LINE__ }) && float(0) == textureProjGradOffset(uniform_sampler1DShadow, vec4(0), float(0), float(0), __LINE__) && float(0) == textureProjGradOffset(uniform_sampler2DShadow, vec4(0), vec2(0), vec2(0), { __LINE__ }) // 8.9.4. Texture Gather Functions - && gvec4(T(0)) == textureGather(gsampler2D, vec2(0)) - && gvec4(T(0)) == textureGather(gsampler2D, vec2(0), int(0)) - && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0)) - && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0), int(0)) - && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0)) - && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0), int(0)) - && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0)) - && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0), int(0)) - && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0)) - && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2D, vec2(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2D, vec2(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DArray, vec3(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DArray, vec3(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCube, vec3(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCube, vec3(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCubeArray, vec4(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCubeArray, vec4(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DRect, vec2(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DRect, vec2(0), int(0)) && vec4(0) == textureGather(uniform_sampler2DShadow, vec2(0), float(0)) && vec4(0) == textureGather(uniform_sampler2DArrayShadow, vec3(0), float(0)) && vec4(0) == textureGather(uniform_samplerCubeShadow, vec3(0), float(0)) && vec4(0) == textureGather(uniform_samplerCubeArrayShadow, vec4(0), float(0)) && vec4(0) == textureGather(uniform_sampler2DRectShadow, vec2(0), float(0)) - && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }, int(0)) - && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffset(uniform_sampler2DShadow, vec2(0), float(0), { __LINE__ }) && vec4(0) == textureGatherOffset(uniform_sampler2DArrayShadow, vec3(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffset(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }, int(0)) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffsets(uniform_sampler2DShadow, vec2(0), float(0), { __LINE__ }) && vec4(0) == textureGatherOffsets(uniform_sampler2DArrayShadow, vec3(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) // 8.9.5. Compatibility Profile Texture Functions @@ -359,19 +359,19 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D ; } -__generic<T : __BuiltinArithmeticType, let N : int> -bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D - , Sampler2D<vector<T, N>> gsampler2D - , Sampler2DRect<vector<T, N>> gsampler2DRect - , Sampler3D<vector<T, N>> gsampler3D - , SamplerCube<vector<T, N>> gsamplerCube - , Sampler1DArray<vector<T, N>> gsampler1DArray - , Sampler2DArray<vector<T, N>> gsampler2DArray - , SamplerCubeArray<vector<T, N>> gsamplerCubeArray - , SamplerBuffer<vector<T, N>> gsamplerBuffer +__generic<T : ITexelElement> +bool itextureFuncs(Sampler1D<T> gsampler1D + , Sampler2D<T> gsampler2D + , Sampler2DRect<T> gsampler2DRect + , Sampler3D<T> gsampler3D + , SamplerCube<T> gsamplerCube + , Sampler1DArray<T> gsampler1DArray + , Sampler2DArray<T> gsampler2DArray + , SamplerCubeArray<T> gsamplerCubeArray + , SamplerBuffer<T> gsamplerBuffer ) { - typealias gvec4 = vector<T, 4>; + typealias gvec4 = vector<T.Element, 4>; constexpr ivec2 ivec2_0 = ivec2(0); @@ -394,53 +394,53 @@ bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D && ivec3(0) == textureSize(uniform_sampler2DArrayShadow, int(0)) && int(0) == textureSize(gsamplerBuffer) - && gvec4(T(0)) == texelFetch(gsampler1D, int(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler2D, ivec2(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler3D, ivec3(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler2DRect, ivec2(0)) - && gvec4(T(0)) == texelFetch(gsampler1DArray, ivec2(0), int(0)) - && gvec4(T(0)) == texelFetch(gsampler2DArray, ivec3(0), int(0)) - && gvec4(T(0)) == texelFetch(gsamplerBuffer, int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler1D, int(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2D, ivec2(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler3D, ivec3(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DRect, ivec2(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler1DArray, ivec2(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsampler2DArray, ivec3(0), int(0)) + && gvec4(T.Element(0)) == texelFetch(gsamplerBuffer, int(0)) - && gvec4(T(0)) == texelFetchOffset(gsampler1D, int(0), int(0), __LINE__) - && gvec4(T(0)) == texelFetchOffset(gsampler2D, ivec2(0), int(0), { __LINE__ }) - && gvec4(T(0)) == texelFetchOffset(gsampler3D, ivec3(0), int(0), { __LINE__ }) - && gvec4(T(0)) == texelFetchOffset(gsampler2DRect, ivec2(0), { __LINE__ }) - && gvec4(T(0)) == texelFetchOffset(gsampler1DArray, ivec2(0), int(0), __LINE__) - && gvec4(T(0)) == texelFetchOffset(gsampler2DArray, ivec3(0), int(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1D, int(0), int(0), __LINE__) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2D, ivec2(0), int(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler3D, ivec3(0), int(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2DRect, ivec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler1DArray, ivec2(0), int(0), __LINE__) + && gvec4(T.Element(0)) == texelFetchOffset(gsampler2DArray, ivec3(0), int(0), { __LINE__ }) // 8.9.4. Texture Gather Functions - && gvec4(T(0)) == textureGather(gsampler2D, vec2(0)) - && gvec4(T(0)) == textureGather(gsampler2D, vec2(0), int(0)) - && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0)) - && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0), int(0)) - && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0)) - && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0), int(0)) - && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0)) - && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0), int(0)) - && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0)) - && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2D, vec2(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2D, vec2(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DArray, vec3(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DArray, vec3(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCube, vec3(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCube, vec3(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCubeArray, vec4(0)) + && gvec4(T.Element(0)) == textureGather(gsamplerCubeArray, vec4(0), int(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DRect, vec2(0)) + && gvec4(T.Element(0)) == textureGather(gsampler2DRect, vec2(0), int(0)) && vec4(0) == textureGather(uniform_sampler2DShadow, vec2(0), float(0)) && vec4(0) == textureGather(uniform_sampler2DArrayShadow, vec3(0), float(0)) && vec4(0) == textureGather(uniform_samplerCubeShadow, vec3(0), float(0)) && vec4(0) == textureGather(uniform_samplerCubeArrayShadow, vec4(0), float(0)) && vec4(0) == textureGather(uniform_sampler2DRectShadow, vec2(0), float(0)) - && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }, int(0)) - && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffset(uniform_sampler2DShadow, vec2(0), float(0), { __LINE__ }) && vec4(0) == textureGatherOffset(uniform_sampler2DArrayShadow, vec3(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffset(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffset(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }, int(0)) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffsets(uniform_sampler2DShadow, vec2(0), float(0), { __LINE__ }) && vec4(0) == textureGatherOffsets(uniform_sampler2DArrayShadow, vec3(0), float(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }) - && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }) + && gvec4(T.Element(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) ; } diff --git a/tests/metal/texture-sampler-less.slang b/tests/metal/texture-sampler-less.slang index a2631e90e..6a7646e9a 100644 --- a/tests/metal/texture-sampler-less.slang +++ b/tests/metal/texture-sampler-less.slang @@ -29,7 +29,7 @@ Sampler2DArray<float> t2DArray; SamplerCubeArray<float> tCubeArray; // Metal doc says "For depth texture types, T must be float." -__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, @@ -42,7 +42,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, @@ -55,7 +55,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, @@ -68,7 +68,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, diff --git a/tests/metal/texture.slang b/tests/metal/texture.slang index 816c168ff..12274edef 100644 --- a/tests/metal/texture.slang +++ b/tests/metal/texture.slang @@ -121,7 +121,7 @@ Texture2DArray<uint16_t4> t2DArray_u16; TextureCubeArray<uint16_t4> tCubeArray_u16; // Metal doc says "For depth texture types, T must be float." -__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, @@ -134,7 +134,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, @@ -147,7 +147,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, @@ -160,7 +160,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, @@ -188,20 +188,19 @@ SamplerState samplerState; 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 { // METAL-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; @@ -421,31 +420,31 @@ bool TEST_texture( // METAL: t1D{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_1d.v4f32( - && all(Tvn(T(0)) == t1D.Sample(samplerState, u)) + && all(Tvn(T.Element(0)) == t1D.Sample(samplerState, u)) // METAL: t2D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && all(Tvn(T(0)) == t2D.Sample(samplerState, float2(u, u))) + && all(Tvn(T.Element(0)) == t2D.Sample(samplerState, float2(u, u))) // METAL: t3D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && all(Tvn(T(0)) == t3D.Sample(samplerState, float3(u, u, u))) + && all(Tvn(T.Element(0)) == t3D.Sample(samplerState, float3(u, u, u))) // METAL: tCube{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_cube.v4f32( - && 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)))) // METAL: t1DArray{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_1d_array.v4f32( - && all(Tvn(T(0)) == t1DArray.Sample(samplerState, float2(u, 0))) + && all(Tvn(T.Element(0)) == t1DArray.Sample(samplerState, float2(u, 0))) // METAL: t2DArray{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && all(Tvn(T(0)) == t2DArray.Sample(samplerState, float3(u, u, 0))) + && all(Tvn(T.Element(0)) == t2DArray.Sample(samplerState, float3(u, u, 0))) // METAL: tCubeArray{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_cube_array.v4f32( - && 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 @@ -453,15 +452,15 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && 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))) // METAL: t3D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && 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))) // METAL: t2DArray{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && 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 @@ -469,15 +468,15 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample({{.*}} min_lod_clamp( // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && all(Tvn(T(0)) == t2D.Sample(samplerState, float2(u, u), int2(1, 1), float(1))) + && all(Tvn(T.Element(0)) == t2D.Sample(samplerState, float2(u, u), int2(1, 1), float(1))) // METAL: t3D{{.*}}.sample({{.*}} min_lod_clamp( // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && all(Tvn(T(0)) == t3D.Sample(samplerState, float3(u, u, u), int3(1, 1, 1), float(1))) + && all(Tvn(T.Element(0)) == t3D.Sample(samplerState, float3(u, u, u), int3(1, 1, 1), float(1))) // METAL: t2DArray{{.*}}.sample({{.*}} min_lod_clamp( // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && all(Tvn(T(0)) == t2DArray.Sample(samplerState, float3(u, u, 0), int2(1, 1), float(1))) + && all(Tvn(T.Element(0)) == t2DArray.Sample(samplerState, float3(u, u, 0), int2(1, 1), float(1))) // =============== // T SampleBias() @@ -487,23 +486,23 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && 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))) // METAL: t3D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && 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))) // METAL: tCube{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_cube.v4f32( - && 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))) // METAL: t2DArray{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && 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))) // METAL: tCubeArray{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_cube_array.v4f32( - && 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 @@ -511,15 +510,15 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && 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))) // METAL: t3D{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && 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))) // METAL: t2DArray{{.*}}.sample({{.*}} // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && 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() @@ -529,23 +528,23 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && all(Tvn(T(0)) == t2D.SampleLevel(samplerState, float2(u, u), 0)) + && all(Tvn(T.Element(0)) == t2D.SampleLevel(samplerState, float2(u, u), 0)) // METAL: t3D{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && 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)) // METAL: tCube{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_cube.v4f32( - && 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)) // METAL: t2DArray{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && 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)) // METAL: tCubeArray{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_cube_array.v4f32( - && 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 @@ -553,15 +552,15 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_2d.v4f32( - && 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))) // METAL: t3D{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_3d.v4f32( - && 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))) // METAL: t2DArray{{.*}}.sample({{.*}} level( // METALLIB: call {{.*}}.sample_texture_2d_array.v4f32( - && 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() @@ -650,29 +649,29 @@ bool TEST_texture( // METAL: t2D{{.*}}.gather( // METALLIB: call {{.*}}.gather_texture_2d.v4f32( - && all(Tv4(T(0)) == t2D.Gather(samplerState, float2(u, u))) + && all(Tv4(T.Element(0)) == t2D.Gather(samplerState, float2(u, u))) // METAL: tCube{{.*}}.gather( // METALLIB: call {{.*}}.gather_texture_cube.v4f32( - && 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)))) // METAL: t2DArray{{.*}}.gather( // METALLIB: call {{.*}}.gather_texture_2d_array.v4f32( - && all(Tv4(T(0)) == t2DArray.Gather(samplerState, float3(u, u, 0))) + && all(Tv4(T.Element(0)) == t2DArray.Gather(samplerState, float3(u, u, 0))) // METAL: tCubeArray{{.*}}.gather( // METALLIB: call {{.*}}.gather_texture_cube_array.v4f32( - && 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))) // Offset variant // METAL: t2D{{.*}}.gather( // METALLIB: call {{.*}}.gather_texture_2d.v4f32( - && all(Tv4(T(0)) == t2D.Gather(samplerState, float2(u2, u), int2(0, 0))) + && all(Tv4(T.Element(0)) == t2D.Gather(samplerState, float2(u2, u), int2(0, 0))) // METAL: t2DArray{{.*}}.gather( // METALLIB: call {{.*}}.gather_texture_2d_array.v4f32( - && all(Tv4(T(0)) == t2DArray.Gather(samplerState, float3(u2, u, 0), int2(0, 0))) + && all(Tv4(T.Element(0)) == t2DArray.Gather(samplerState, float3(u2, u, 0), int2(0, 0))) // ===================================== // T SampleGrad() @@ -682,33 +681,33 @@ bool TEST_texture( // METAL: t2D{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_2d_grad.v4f32( - && 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))) // METAL: t3D{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_3d_grad.v4f32( - && 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))) // METAL: tCube{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_cube_grad.v4f32( - && 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))) // METAL: t2DArray{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_2d_array_grad.v4f32( - && 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))) // Offset variant // METAL: t2D{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_2d_grad.v4f32( - && 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))) // METAL: t3D{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_3d_grad.v4f32( - && 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))) // METAL: t2DArray{{.*}}.sample( // METALLIB: call {{.*}}.sample_texture_2d_array_grad.v4f32( - && 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))) // =================== // T Load() @@ -716,23 +715,23 @@ bool TEST_texture( // METAL: t1D{{.*}}.read( // METALLIB: call {{.*}}.read_texture_1d.v4f32( - && all(Tvn(T(0)) == t1D.Load(int2(0, 0))) + && all(Tvn(T.Element(0)) == t1D.Load(int2(0, 0))) // METAL: t2D{{.*}}.read( // METALLIB: call {{.*}}.read_texture_2d.v4f32( - && all(Tvn(T(0)) == t2D.Load(int3(0, 0, 0))) + && all(Tvn(T.Element(0)) == t2D.Load(int3(0, 0, 0))) // METAL: t3D{{.*}}.read( // METALLIB: call {{.*}}.read_texture_3d.v4f32( - && all(Tvn(T(0)) == t3D.Load(int4(0, 0, 0, 0))) + && all(Tvn(T.Element(0)) == t3D.Load(int4(0, 0, 0, 0))) // METAL: t1DArray{{.*}}.read( // METALLIB: call {{.*}}.read_texture_1d_array.v4f32( - && all(Tvn(T(0)) == t1DArray.Load(int3(0, 0, 0))) + && all(Tvn(T.Element(0)) == t1DArray.Load(int3(0, 0, 0))) // METAL: t2DArray{{.*}}.read( // METALLIB: call {{.*}}.read_texture_2d_array.v4f32( - && all(Tvn(T(0)) == t2DArray.Load(int4(0, 0, 0, 0))) + && all(Tvn(T.Element(0)) == t2DArray.Load(int4(0, 0, 0, 0))) // Offset variant @@ -749,7 +748,7 @@ void computeMain() // HLSL: void computeMain( bool result = true - && TEST_texture<float, 3>( + && TEST_texture<float3>( t1D_f32v3, t2D_f32v3, t3D_f32v3, @@ -765,7 +764,7 @@ void computeMain() // - If T is uint, Tv is uint4. // - If T is short, Tv is short4. // - If T is ushort, Tv is ushort4." - && TEST_texture<float, 4>( + && TEST_texture<float4>( t1D_f32, t2D_f32, t3D_f32, @@ -774,7 +773,7 @@ void computeMain() t2DArray_f32, tCubeArray_f32) #if !defined(EXCLUDE_HALF_TYPE) - && TEST_texture<half, 4>( + && TEST_texture<half4>( t1D_f16, t2D_f16, t3D_f16, @@ -784,7 +783,7 @@ void computeMain() tCubeArray_f16) #endif #if !defined(EXCLUDE_INTEGER_TYPE) - && TEST_texture<int, 4>( + && TEST_texture<int4>( t1D_i32, t2D_i32, t3D_i32, @@ -792,7 +791,7 @@ void computeMain() t1DArray_i32, t2DArray_i32, tCubeArray_i32) - && TEST_texture<uint, 4>( + && TEST_texture<uint4>( t1D_u32, t2D_u32, t3D_u32, @@ -801,7 +800,7 @@ void computeMain() t2DArray_u32, tCubeArray_u32) #if !defined(EXCLUDE_SHORT_TYPE) - && TEST_texture<int16_t, 4>( + && TEST_texture<int16_t4>( t1D_i16, t2D_i16, t3D_i16, @@ -809,7 +808,7 @@ void computeMain() t1DArray_i16, t2DArray_i16, tCubeArray_i16) - && TEST_texture<uint16_t, 4>( + && TEST_texture<uint16_t4>( t1D_u16, t2D_u16, t3D_u16, 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, |
