summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-17 14:37:27 -0800
committerGitHub <noreply@github.com>2025-01-17 14:37:27 -0800
commitfc77070fdc9bfa599e8d66b21743778de3011e53 (patch)
treea9a0983bd704b0e760ae94d5330a74bc72f1154f
parent3ff257816fc8f376d9bee76378a690757f8b5377 (diff)
Refactor _Texture to constrain on texel types. (#6115)
* Refactor _Texture to constrain on texel types. * Fix tests. * Fix. * Disable glsl texture test because rhi can't run it correctly.
-rw-r--r--source/slang/glsl.meta.slang513
-rw-r--r--source/slang/hlsl.meta.slang298
-rw-r--r--source/slang/slang-check-inheritance.cpp4
-rw-r--r--source/slang/slang-emit-cpp.cpp5
-rw-r--r--source/slang/slang-ir-peephole.cpp2
-rw-r--r--tests/diagnostics/illegal-texel-type.slang7
-rw-r--r--tests/glsl-intrinsic/compute-derivative/intrinsic-derivative-function-in-compute.slang58
-rw-r--r--tests/glsl-intrinsic/intrinsic-texture.slang312
-rw-r--r--tests/language-feature/capability/intrinsic-texture-ignore-capability.slang384
-rw-r--r--tests/metal/texture-sampler-less.slang8
-rw-r--r--tests/metal/texture.slang139
-rw-r--r--tests/wgsl/texture-gather.slang86
-rw-r--r--tests/wgsl/texture-load.slang38
-rw-r--r--tests/wgsl/texture-sampler-less.slang115
-rw-r--r--tests/wgsl/texture-storage.slang41
-rw-r--r--tests/wgsl/texture.slang104
16 files changed, 1109 insertions, 1005 deletions
diff --git a/source/slang/glsl.meta.slang b/source/slang/glsl.meta.slang
index ba26b5d84..1b44c7825 100644
--- a/source/slang/glsl.meta.slang
+++ b/source/slang/glsl.meta.slang
@@ -1354,6 +1354,9 @@ public vector<bool,N> not(vector<bool,N> x)
return !x;
}
+__intrinsic_op(vectorReshape)
+vector<T,N> __vectorReshape2<T, let N : int, U>(U vin);
+
//
// Section 8.9.1. Texture Query Functions
//
@@ -1472,7 +1475,7 @@ public typealias sampler2DMSArray = Sampler2DMSArray<float4>;
public typealias isampler2DMSArray = Sampler2DMSArray<int4>;
public typealias usampler2DMSArray = Sampler2DMSArray<uint4>;
-__generic<T=float4, let sampleCount:int=0, let format:int=0>
+__generic<T:ITexelElement=float4, let sampleCount:int=0, let format:int=0>
public typealias Sampler2DRect = _Texture<T, __Shape2D, 0, 0, sampleCount, 0, 0, 1, format>;
public typealias sampler2DRect = Sampler2DRect<float4>;
public typealias isampler2DRect = Sampler2DRect<int4>;
@@ -1491,7 +1494,7 @@ public typealias sampler2DRectShadow = _Texture<
format
>;
-__generic<T, let format:int=0>
+__generic<T:ITexelElement, let format:int=0>
public typealias SamplerBuffer = _Texture<
T,
__ShapeBuffer,
@@ -1512,10 +1515,10 @@ public typealias usamplerBuffer = SamplerBuffer<uint4>;
// textureSize
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_size)]
-public int textureSize(Sampler1D<vector<T,N>> sampler, int lod)
+public int textureSize(Sampler1D<T> sampler, int lod)
{
int result;
int numberOfLevels;
@@ -1523,10 +1526,10 @@ public int textureSize(Sampler1D<vector<T,N>> sampler, int lod)
return result;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_size)]
-public ivec2 textureSize(Sampler2D<vector<T,N>> sampler, int lod)
+public ivec2 textureSize(Sampler2D<T> sampler, int lod)
{
vector<int,2> result;
int numberOfLevels;
@@ -1534,10 +1537,10 @@ public ivec2 textureSize(Sampler2D<vector<T,N>> sampler, int lod)
return result;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_size)]
-public ivec3 textureSize(Sampler3D<vector<T,N>> sampler, int lod)
+public ivec3 textureSize(Sampler3D<T> sampler, int lod)
{
vector<int,3> result;
int numberOfLevels;
@@ -1545,10 +1548,10 @@ public ivec3 textureSize(Sampler3D<vector<T,N>> sampler, int lod)
return result;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_size)]
-public ivec2 textureSize(SamplerCube<vector<T,N>> sampler, int lod)
+public ivec2 textureSize(SamplerCube<T> sampler, int lod)
{
vector<int,2> result;
int numberOfLevels;
@@ -1587,9 +1590,9 @@ public ivec2 textureSize(samplerCubeShadow sampler, int lod)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
-public ivec3 textureSize(SamplerCubeArray<vector<T,N>> sampler, int lod)
+public ivec3 textureSize(SamplerCubeArray<T> sampler, int lod)
{
vector<int,3> result;
int numberOfLevels;
@@ -1608,9 +1611,9 @@ public ivec3 textureSize(samplerCubeArrayShadow sampler, int lod)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
-public ivec2 textureSize(Sampler2DRect<vector<T,N>> sampler)
+public ivec2 textureSize(Sampler2DRect<T> sampler)
{
vector<int,2> result;
int numberOfLevels;
@@ -1629,9 +1632,9 @@ public ivec2 textureSize(sampler2DRectShadow sampler)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
-public ivec2 textureSize(Sampler1DArray<vector<T,N>> sampler, int lod)
+public ivec2 textureSize(Sampler1DArray<T> sampler, int lod)
{
vector<int,2> result;
int numberOfLevels;
@@ -1650,9 +1653,9 @@ public ivec2 textureSize(sampler1DArrayShadow sampler, int lod)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
-public ivec3 textureSize(Sampler2DArray<vector<T,N>> sampler, int lod)
+public ivec3 textureSize(Sampler2DArray<T> sampler, int lod)
{
vector<int,3> result;
int numberOfLevels;
@@ -1671,9 +1674,9 @@ public ivec3 textureSize(sampler2DArrayShadow sampler, int lod)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int, let format:int>
+__generic<T:ITexelElement, let format:int>
[ForceInline]
-public int textureSize(SamplerBuffer<vector<T,N>,format> sampler)
+public int textureSize(SamplerBuffer<T,format> sampler)
{
uint result;
sampler.GetDimensions(result);
@@ -1681,9 +1684,9 @@ public int textureSize(SamplerBuffer<vector<T,N>,format> sampler)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int, let sampleCount:int>
+__generic<T:ITexelElement, let sampleCount:int>
[ForceInline]
-public ivec2 textureSize(Sampler2DMS<vector<T,N>,sampleCount> sampler)
+public ivec2 textureSize(Sampler2DMS<T,sampleCount> sampler)
{
vector<int,2> result;
int sampleCount;
@@ -1693,9 +1696,9 @@ public ivec2 textureSize(Sampler2DMS<vector<T,N>,sampleCount> sampler)
}
[require(glsl_hlsl_spirv, texture_size)]
-__generic<T:__BuiltinArithmeticType, let N:int, let sampleCount:int>
+__generic<T:ITexelElement, let sampleCount:int>
[ForceInline]
-public ivec3 textureSize(Sampler2DMSArray<vector<T,N>,sampleCount> sampler)
+public ivec3 textureSize(Sampler2DMSArray<T,sampleCount> sampler)
{
vector<int,3> result;
int sampleCount;
@@ -1708,7 +1711,7 @@ public ivec3 textureSize(Sampler2DMSArray<vector<T,N>,sampleCount> sampler)
// textureQueryLod
// -------------------
-__generic<T, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_hlsl_metal_spirv, texture_querylod)]
public vec2 textureQueryLod(_Texture<
@@ -1741,7 +1744,7 @@ public vec2 textureQueryLod(_Texture<
}
}
-__generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_hlsl_metal_spirv, texture_querylod)]
public vec2 textureQueryLod(_Texture<
@@ -1778,10 +1781,10 @@ public vec2 textureQueryLod(_Texture<
// textureQueryLevels
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(Sampler1D<vector<T,N>> sampler)
+public int textureQueryLevels(Sampler1D<T> sampler)
{
int width;
int numberOfLevels;
@@ -1789,10 +1792,10 @@ public int textureQueryLevels(Sampler1D<vector<T,N>> sampler)
return numberOfLevels;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(Sampler2D<vector<T,N>> sampler)
+public int textureQueryLevels(Sampler2D<T> sampler)
{
vector<int,2> dim;
int numberOfLevels;
@@ -1800,10 +1803,10 @@ public int textureQueryLevels(Sampler2D<vector<T,N>> sampler)
return numberOfLevels;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(Sampler3D<vector<T,N>> sampler)
+public int textureQueryLevels(Sampler3D<T> sampler)
{
vector<int,3> dim;
int numberOfLevels;
@@ -1811,10 +1814,10 @@ public int textureQueryLevels(Sampler3D<vector<T,N>> sampler)
return numberOfLevels;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(SamplerCube<vector<T,N>> sampler)
+public int textureQueryLevels(SamplerCube<T> sampler)
{
vector<int,2> dim;
int numberOfLevels;
@@ -1822,10 +1825,10 @@ public int textureQueryLevels(SamplerCube<vector<T,N>> sampler)
return numberOfLevels;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(Sampler1DArray<vector<T,N>> sampler)
+public int textureQueryLevels(Sampler1DArray<T> sampler)
{
vector<int,2> dim;
int numberOfLevels;
@@ -1833,10 +1836,10 @@ public int textureQueryLevels(Sampler1DArray<vector<T,N>> sampler)
return numberOfLevels;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(Sampler2DArray<vector<T,N>> sampler)
+public int textureQueryLevels(Sampler2DArray<T> sampler)
{
vector<int,3> dim;
int numberOfLevels;
@@ -1844,10 +1847,10 @@ public int textureQueryLevels(Sampler2DArray<vector<T,N>> sampler)
return numberOfLevels;
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_metal_spirv, texture_querylevels)]
-public int textureQueryLevels(SamplerCubeArray<vector<T,N>> sampler)
+public int textureQueryLevels(SamplerCubeArray<T> sampler)
{
vector<int,3> dim;
int numberOfLevels;
@@ -1919,7 +1922,7 @@ public int textureQueryLevels(samplerCubeArrayShadow sampler)
// textureSamples
// -------------------
-__generic<T, let sampleCount:int>
+__generic<T:ITexelElement, let sampleCount:int>
[ForceInline]
[require(glsl_hlsl_spirv, image_samples)]
public int textureSamples(Sampler2DMS<T,sampleCount> sampler)
@@ -1931,7 +1934,7 @@ public int textureSamples(Sampler2DMS<T,sampleCount> sampler)
return sampleCount;
}
-__generic<T, let sampleCount:int>
+__generic<T:ITexelElement, let sampleCount:int>
[ForceInline]
[require(glsl_hlsl_spirv, image_samples)]
public int textureSamples(Sampler2DMSArray<T,sampleCount> sampler)
@@ -1951,27 +1954,27 @@ public int textureSamples(Sampler2DMSArray<T,sampleCount> sampler)
// texture
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> texture(Sampler1D<vector<T,N>> sampler, float p)
+public vector<T.Element,4> texture(Sampler1D<T> sampler, float p)
{
- return __vectorReshape<4>(sampler.Sample(p));
+ return __vectorReshape2<T.Element, 4>(sampler.Sample(p));
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> texture(Sampler1D<vector<T,N>> sampler, float p, constexpr float bias)
+public vector<T.Element,4> texture(Sampler1D<T> sampler, float p, constexpr float bias)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias));
+ return __vectorReshape2<T.Element, 4>(sampler.SampleBias(p, bias));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> texture(_Texture<
- vector<T,N>,
+public vector<T.Element,4> texture(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -1982,14 +1985,14 @@ public vector<T,4> texture(_Texture<
format
> sampler, vector<float,Shape.dimensions+isArray> p)
{
- return __vectorReshape<4>(sampler.Sample(p));
+ return __vectorReshape2<T.Element, 4>(sampler.Sample(p));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> texture(_Texture<
- vector<T,N>,
+public vector<T.Element,4> texture(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -2000,7 +2003,7 @@ public vector<T,4> texture(_Texture<
format
> sampler, vector<float,Shape.dimensions+isArray> p, constexpr float bias)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias));
+ return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias));
}
[ForceInline]
@@ -2137,170 +2140,170 @@ public float texture(samplerCubeArrayShadow sampler, vec4 p, float compare)
// textureProj
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec2 p)
+public vector<T.Element,4> textureProj(Sampler1D<T> sampler, vec2 p)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p
};
default:
return texture(sampler, p.x / p.y);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec2 p, float bias)
+public vector<T.Element,4> textureProj(Sampler1D<T> sampler, vec2 p, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
};
default:
return texture(sampler, p.x / p.y, bias);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec4 p)
+public vector<T.Element,4> textureProj(Sampler1D<T> sampler, vec4 p)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p
};
default:
return texture(sampler, p.x / p.w);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec4 p, float bias)
+public vector<T.Element,4> textureProj(Sampler1D<T> sampler, vec4 p, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
};
default:
return texture(sampler, p.x / p.w, bias);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec3 p)
+public vector<T.Element,4> textureProj(Sampler2D<T> sampler, vec3 p)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p
};
default:
return texture(sampler, p.xy / p.z);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec3 p, float bias)
+public vector<T.Element,4> textureProj(Sampler2D<T> sampler, vec3 p, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
};
default:
return texture(sampler, p.xy / p.z, bias);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec4 p)
+public vector<T.Element,4> textureProj(Sampler2D<T> sampler, vec4 p)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p
};
default:
return texture(sampler, p.xy / p.w);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec4 p, float bias)
+public vector<T.Element,4> textureProj(Sampler2D<T> sampler, vec4 p, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
};
default:
return texture(sampler, p.xy / p.w, bias);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler3D<vector<T,N>> sampler, vec4 p)
+public vector<T.Element,4> textureProj(Sampler3D<T> sampler, vec4 p)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p
};
default:
return texture(sampler, p.xyz / p.w);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProj(Sampler3D<vector<T,N>> sampler, vec4 p, float bias)
+public vector<T.Element,4> textureProj(Sampler3D<T> sampler, vec4 p, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProj";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias
};
default:
return texture(sampler, p.xyz / p.w, bias);
@@ -2395,19 +2398,19 @@ public float textureProj(sampler2DShadow sampler, vec4 p, float bias)
// textureLod
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureLod(Sampler1D<vector<T,N>> sampler, float p, float lod)
+public vector<T.Element,4> textureLod(Sampler1D<T> sampler, float p, float lod)
{
- return __vectorReshape<4>(sampler.SampleLevel(p, lod));
+ return __vectorReshape2<T.Element,4>(sampler.SampleLevel(p, lod));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureLod(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureLod(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -2418,7 +2421,7 @@ public vector<T,4> textureLod(_Texture<
format
> sampler, vector<float,Shape.dimensions+isArray> p, float lod)
{
- return __vectorReshape<4>(sampler.SampleLevel(p, lod));
+ return __vectorReshape2<T.Element,4>(sampler.SampleLevel(p, lod));
}
[ForceInline]
@@ -2501,28 +2504,28 @@ public float textureLod(sampler1DArrayShadow sampler, vec3 p, float lod)
// textureOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureOffset(Sampler1D<vector<T,N>> sampler, float p, constexpr int offset, float bias = 0.0)
+public vector<T.Element,4> textureOffset(Sampler1D<T> sampler, float p, constexpr int offset, float bias = 0.0)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias, offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureOffset(Sampler2D<vector<T,N>> sampler, vec2 p, constexpr ivec2 offset, float bias = 0.0)
+public vector<T.Element,4> textureOffset(Sampler2D<T> sampler, vec2 p, constexpr ivec2 offset, float bias = 0.0)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias, offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureOffset(Sampler3D<vector<T,N>> sampler, vec3 p, constexpr ivec3 offset, float bias = 0.0)
+public vector<T.Element,4> textureOffset(Sampler3D<T> sampler, vec3 p, constexpr ivec3 offset, float bias = 0.0)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias, offset));
}
[ForceInline]
@@ -2591,20 +2594,20 @@ public float textureOffset(sampler1DShadow sampler, vec3 p, constexpr int offset
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureOffset(Sampler1DArray<vector<T,N>> sampler, vec2 p, constexpr int offset, float bias = 0.0)
+public vector<T.Element,4> textureOffset(Sampler1DArray<T> sampler, vec2 p, constexpr int offset, float bias = 0.0)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias, offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureOffset(Sampler2DArray<vector<T,N>> sampler, vec3 p, constexpr ivec2 offset, float bias = 0.0)
+public vector<T.Element,4> textureOffset(Sampler2DArray<T> sampler, vec3 p, constexpr ivec2 offset, float bias = 0.0)
{
- return __vectorReshape<4>(sampler.SampleBias(p, bias, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleBias(p, bias, offset));
}
[ForceInline]
@@ -2662,19 +2665,19 @@ public float textureOffset(sampler2DArrayShadow sampler, vec4 p, constexpr ivec2
// texelFetch
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetch(Sampler1D<vector<T,N>> sampler, int p, int lod)
+public vector<T.Element,4> texelFetch(Sampler1D<T> sampler, int p, int lod)
{
- return __vectorReshape<4>(sampler.Load(int2(p, lod)));
+ return __vectorReshape2<T.Element,4>(sampler.Load(int2(p, lod)));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetch(_Texture<
- vector<T,N>,
+public vector<T.Element,4> texelFetch(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -2685,30 +2688,30 @@ public vector<T,4> texelFetch(_Texture<
format
> sampler, vector<int,Shape.dimensions+isArray> p, int lod)
{
- return __vectorReshape<4>(sampler.Load(__makeVector(p,lod)));
+ return __vectorReshape2<T.Element,4>(sampler.Load(__makeVector(p,lod)));
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetch(Sampler2DRect<vector<T,N>> sampler, ivec2 p)
+public vector<T.Element,4> texelFetch(Sampler2DRect<T> sampler, ivec2 p)
{
- return __vectorReshape<4>(sampler.Load(int3(p.xy,0)));
+ return __vectorReshape2<T.Element,4>(sampler.Load(int3(p.xy,0)));
}
-__generic<T:__BuiltinArithmeticType, let N:int, let format:int>
+__generic<T:ITexelElement, let format:int>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetch(SamplerBuffer<vector<T,N>,format> sampler, int p)
+public vector<T.Element,4> texelFetch(SamplerBuffer<T,format> sampler, int p)
{
- return __vectorReshape<4>(sampler.Load(p));
+ return __vectorReshape2<T.Element,4>(sampler.Load(p));
}
-__generic<T:__BuiltinArithmeticType, let N:int, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetch(_Texture<
- vector<T,N>,
+public vector<T.Element,4> texelFetch(_Texture<
+ T,
__Shape2D,
isArray,
1, // isMS
@@ -2724,7 +2727,7 @@ public vector<T,4> texelFetch(_Texture<
case glsl: __intrinsic_asm "texelFetch";
default:
// TODO: Need to apply lod
- return __vectorReshape<4>(sampler.Load(__makeVector(p, 0)));
+ return __vectorReshape2<T.Element,4>(sampler.Load(__makeVector(p, 0)));
}
}
@@ -2732,19 +2735,19 @@ public vector<T,4> texelFetch(_Texture<
// texelFetchOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetchOffset(Sampler1D<vector<T,N>> sampler, int p, int lod, constexpr int offset)
+public vector<T.Element,4> texelFetchOffset(Sampler1D<T> sampler, int p, int lod, constexpr int offset)
{
- return __vectorReshape<4>(sampler.Load(int2(p, lod), offset));
+ return __vectorReshape2<T.Element,4>(sampler.Load(int2(p, lod), offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetchOffset(_Texture<
- vector<T,N>,
+public vector<T.Element,4> texelFetchOffset(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -2755,59 +2758,59 @@ public vector<T,4> texelFetchOffset(_Texture<
format
> sampler, vector<int,Shape.dimensions+isArray> p, int lod, constexpr vector<int,Shape.planeDimensions> offset)
{
- return __vectorReshape<4>(sampler.Load(__makeVector(p,lod), offset));
+ return __vectorReshape2<T.Element,4>(sampler.Load(__makeVector(p,lod), offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)]
-public vector<T,4> texelFetchOffset(Sampler2DRect<vector<T,N>> sampler, ivec2 p, constexpr ivec2 offset)
+public vector<T.Element,4> texelFetchOffset(Sampler2DRect<T> sampler, ivec2 p, constexpr ivec2 offset)
{
- return __vectorReshape<4>(sampler.Load(__makeVector(p, 0), offset));
+ return __vectorReshape2<T.Element,4>(sampler.Load(__makeVector(p, 0), offset));
}
// -------------------
// textureProjOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec2 p, constexpr int offset)
+public vector<T.Element,4> textureProjOffset(Sampler1D<T> sampler, vec2 p, constexpr int offset)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProjOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset
};
default:
return textureOffset(sampler, p.x / p.y, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec2 p, constexpr int offset, float bias)
+public vector<T.Element,4> textureProjOffset(Sampler1D<T> sampler, vec2 p, constexpr int offset, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProjOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias|ConstOffset $bias $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias|ConstOffset $bias $offset
};
default:
return textureOffset(sampler, p.x / p.y, offset, bias);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, constexpr int offset)
+public vector<T.Element,4> textureProjOffset(Sampler1D<T> sampler, vec4 p, constexpr int offset)
{
__requireComputeDerivative();
__target_switch
@@ -2817,7 +2820,7 @@ public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, con
{
vec4 xw__ = p.xwww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xw__ ConstOffset $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $xw__ ConstOffset $offset
};
}
default:
@@ -2825,10 +2828,10 @@ public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, con
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, constexpr int offset, float bias)
+public vector<T.Element,4> textureProjOffset(Sampler1D<T> sampler, vec4 p, constexpr int offset, float bias)
{
__requireComputeDerivative();
__target_switch
@@ -2838,7 +2841,7 @@ public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, con
{
vec4 xw__ = p.xwww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xw__ Bias|ConstOffset $bias $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $xw__ Bias|ConstOffset $bias $offset
};
}
default:
@@ -2846,44 +2849,44 @@ public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, con
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec3 p, constexpr ivec2 offset)
+public vector<T.Element,4> textureProjOffset(Sampler2D<T> sampler, vec3 p, constexpr ivec2 offset)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProjOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset
};
default:
return textureOffset(sampler, p.xy / p.z, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec3 p, constexpr ivec2 offset, float bias)
+public vector<T.Element,4> textureProjOffset(Sampler2D<T> sampler, vec3 p, constexpr ivec2 offset, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProjOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias|ConstOffset $bias $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias|ConstOffset $bias $offset
};
default:
return textureOffset(sampler, p.xy / p.z, offset, bias);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, constexpr ivec2 offset)
+public vector<T.Element,4> textureProjOffset(Sampler2D<T> sampler, vec4 p, constexpr ivec2 offset)
{
__requireComputeDerivative();
__target_switch
@@ -2893,7 +2896,7 @@ public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, con
{
vec4 xyw__ = p.xyww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xyw__ ConstOffset $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $xyw__ ConstOffset $offset
};
}
default:
@@ -2901,10 +2904,10 @@ public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, con
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, constexpr ivec2 offset, float bias)
+public vector<T.Element,4> textureProjOffset(Sampler2D<T> sampler, vec4 p, constexpr ivec2 offset, float bias)
{
__requireComputeDerivative();
__target_switch
@@ -2914,7 +2917,7 @@ public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, con
{
vec4 xyw_ = p.xyww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xyw_ Bias|ConstOffset $bias $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $xyw_ Bias|ConstOffset $bias $offset
};
}
default:
@@ -2922,34 +2925,34 @@ public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, con
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler3D<vector<T,N>> sampler, vec4 p, constexpr ivec3 offset)
+public vector<T.Element,4> textureProjOffset(Sampler3D<T> sampler, vec4 p, constexpr ivec3 offset)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProjOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset
};
default:
return textureOffset(sampler, p.xyz / p.w, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjOffset(Sampler3D<vector<T,N>> sampler, vec4 p, constexpr ivec3 offset, float bias)
+public vector<T.Element,4> textureProjOffset(Sampler3D<T> sampler, vec4 p, constexpr ivec3 offset, float bias)
{
__requireComputeDerivative();
__target_switch
{
case glsl: __intrinsic_asm "textureProjOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias|ConstOffset $bias $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjImplicitLod $sampler $p Bias|ConstOffset $bias $offset
};
default:
return textureOffset(sampler, p.xyz / p.w, offset, bias);
@@ -3044,19 +3047,19 @@ public float textureProjOffset(sampler2DShadow sampler, vec4 p, constexpr ivec2
// textureLodOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0)]
-public vector<T,4> textureLodOffset(Sampler1D<vector<T,N>> sampler, float p, float lod, constexpr int offset)
+public vector<T.Element,4> textureLodOffset(Sampler1D<T> sampler, float p, float lod, constexpr int offset)
{
- return __vectorReshape<4>(sampler.SampleLevel(p, lod, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleLevel(p, lod, offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_0)]
-public vector<T,4> textureLodOffset(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureLodOffset(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -3067,7 +3070,7 @@ public vector<T,4> textureLodOffset(_Texture<
format
> sampler, vector<float,Shape.dimensions+isArray> p, float lod, constexpr vector<int,Shape.planeDimensions> offset)
{
- return __vectorReshape<4>(sampler.SampleLevel(p, lod, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleLevel(p, lod, offset));
}
[ForceInline]
@@ -3134,26 +3137,26 @@ public float textureLodOffset(sampler1DArrayShadow sampler, vec3 p, float lod, c
// textureProjLod
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLod(Sampler1D<vector<T,N>> sampler, vec2 p, float lod)
+public vector<T.Element,4> textureProjLod(Sampler1D<T> sampler, vec2 p, float lod)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjLod";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod
};
default:
return textureLod(sampler, p.x / p.y, lod);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLod(Sampler1D<vector<T,N>> sampler, vec4 p, float lod)
+public vector<T.Element,4> textureProjLod(Sampler1D<T> sampler, vec4 p, float lod)
{
__target_switch
{
@@ -3162,7 +3165,7 @@ public vector<T,4> textureProjLod(Sampler1D<vector<T,N>> sampler, vec4 p, float
{
vec4 xw__ = p.xwww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Lod $lod
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xw__ Lod $lod
};
}
default:
@@ -3170,26 +3173,26 @@ public vector<T,4> textureProjLod(Sampler1D<vector<T,N>> sampler, vec4 p, float
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLod(Sampler2D<vector<T,N>> sampler, vec3 p, float lod)
+public vector<T.Element,4> textureProjLod(Sampler2D<T> sampler, vec3 p, float lod)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjLod";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod
};
default:
return textureLod(sampler, p.xy / p.z, lod);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLod(Sampler2D<vector<T,N>> sampler, vec4 p, float lod)
+public vector<T.Element,4> textureProjLod(Sampler2D<T> sampler, vec4 p, float lod)
{
__target_switch
{
@@ -3198,7 +3201,7 @@ public vector<T,4> textureProjLod(Sampler2D<vector<T,N>> sampler, vec4 p, float
{
vec4 xyw_ = p.xyww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Lod $lod
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Lod $lod
};
}
default:
@@ -3206,16 +3209,16 @@ public vector<T,4> textureProjLod(Sampler2D<vector<T,N>> sampler, vec4 p, float
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLod(Sampler3D<vector<T,N>> sampler, vec4 p, float lod)
+public vector<T.Element,4> textureProjLod(Sampler3D<T> sampler, vec4 p, float lod)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjLod";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod
};
default:
return textureLod(sampler, p.xyz / p.w, lod);
@@ -3266,26 +3269,26 @@ public float textureProjLod(sampler2DShadow sampler, vec4 p, float lod)
// textureProjLodOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLodOffset(Sampler1D<vector<T,N>> sampler, vec2 p, float lod, constexpr int offset)
+public vector<T.Element,4> textureProjLodOffset(Sampler1D<T> sampler, vec2 p, float lod, constexpr int offset)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjLodOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset
};
default:
return textureLodOffset(sampler, p.x / p.y, lod, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLodOffset(Sampler1D<vector<T,N>> sampler, vec4 p, float lod, constexpr int offset)
+public vector<T.Element,4> textureProjLodOffset(Sampler1D<T> sampler, vec4 p, float lod, constexpr int offset)
{
__target_switch
{
@@ -3294,7 +3297,7 @@ public vector<T,4> textureProjLodOffset(Sampler1D<vector<T,N>> sampler, vec4 p,
{
vec4 xw__ = p.xwww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Lod|ConstOffset $lod $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xw__ Lod|ConstOffset $lod $offset
};
}
default:
@@ -3302,26 +3305,26 @@ public vector<T,4> textureProjLodOffset(Sampler1D<vector<T,N>> sampler, vec4 p,
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLodOffset(Sampler2D<vector<T,N>> sampler, vec3 p, float lod, constexpr ivec2 offset)
+public vector<T.Element,4> textureProjLodOffset(Sampler2D<T> sampler, vec3 p, float lod, constexpr ivec2 offset)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjLodOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset
};
default:
return textureLodOffset(sampler, p.xy / p.z, lod, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLodOffset(Sampler2D<vector<T,N>> sampler, vec4 p, float lod, constexpr ivec2 offset)
+public vector<T.Element,4> textureProjLodOffset(Sampler2D<T> sampler, vec4 p, float lod, constexpr ivec2 offset)
{
__target_switch
{
@@ -3330,7 +3333,7 @@ public vector<T,4> textureProjLodOffset(Sampler2D<vector<T,N>> sampler, vec4 p,
{
vec4 xyw_ = p.xyww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Lod|ConstOffset $lod $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Lod|ConstOffset $lod $offset
};
}
default:
@@ -3338,16 +3341,16 @@ public vector<T,4> textureProjLodOffset(Sampler2D<vector<T,N>> sampler, vec4 p,
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(glsl_hlsl_spirv, texture_sm_4_0_fragment)]
-public vector<T,4> textureProjLodOffset(Sampler3D<vector<T,N>> sampler, vec4 p, float lod, constexpr ivec3 offset)
+public vector<T.Element,4> textureProjLodOffset(Sampler3D<T> sampler, vec4 p, float lod, constexpr ivec3 offset)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjLodOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset
};
default:
return textureLodOffset(sampler, p.xyz / p.w, lod, offset);
@@ -3399,19 +3402,19 @@ public float textureProjLodOffset(sampler2DShadow sampler, vec4 p, float lod, co
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureGrad(Sampler1D<vector<T,N>> sampler, float p, float dPdx, float dPdy)
+public vector<T.Element,4> textureGrad(Sampler1D<T> sampler, float p, float dPdx, float dPdy)
{
- return __vectorReshape<4>(sampler.SampleGrad(p, dPdx, dPdy));
+ return __vectorReshape2<T.Element,4>(sampler.SampleGrad(p, dPdx, dPdy));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureGrad(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureGrad(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -3422,7 +3425,7 @@ public vector<T,4> textureGrad(_Texture<
format
> sampler, vector<float,Shape.dimensions+isArray> p, vector<float,Shape.dimensions> dPdx, vector<float,Shape.dimensions> dPdy)
{
- return __vectorReshape<4>(sampler.SampleGrad(p, dPdx, dPdy));
+ return __vectorReshape2<T.Element,4>(sampler.SampleGrad(p, dPdx, dPdy));
}
[ForceInline]
@@ -3514,19 +3517,19 @@ public float textureGrad(sampler2DArrayShadow sampler, vec4 p, vec2 dPdx, vec2 d
// textureGradOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureGradOffset(Sampler1D<vector<T,N>> sampler, float p, float dPdx, float dPdy, constexpr int offset)
+public vector<T.Element,4> textureGradOffset(Sampler1D<T> sampler, float p, float dPdx, float dPdy, constexpr int offset)
{
- return __vectorReshape<4>(sampler.SampleGrad(p, dPdx, dPdy, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleGrad(p, dPdx, dPdy, offset));
}
-__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
[ForceInline]
-public vector<T,4> textureGradOffset(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureGradOffset(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -3537,7 +3540,7 @@ public vector<T,4> textureGradOffset(_Texture<
format
> sampler, vector<float,Shape.dimensions+isArray> p, vector<float,Shape.dimensions> dPdx, vector<float,Shape.dimensions> dPdy, constexpr vector<int,Shape.dimensions> offset)
{
- return __vectorReshape<4>(sampler.SampleGrad(p, dPdx, dPdy, offset));
+ return __vectorReshape2<T.Element,4>(sampler.SampleGrad(p, dPdx, dPdy, offset));
}
[ForceInline]
@@ -3612,26 +3615,26 @@ public float textureGradOffset(sampler2DArrayShadow sampler, vec4 p, vec2 dPdx,
// textureProjGrad
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGrad(Sampler1D<vector<T,N>> sampler, vec2 p, float dPdx, float dPdy)
+public vector<T.Element,4> textureProjGrad(Sampler1D<T> sampler, vec2 p, float dPdx, float dPdy)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjGrad";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy
};
default:
return textureGrad(sampler, p.x / p.y, dPdx, dPdy);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGrad(Sampler1D<vector<T,N>> sampler, vec4 p, float dPdx, float dPdy)
+public vector<T.Element,4> textureProjGrad(Sampler1D<T> sampler, vec4 p, float dPdx, float dPdy)
{
__target_switch
{
@@ -3640,7 +3643,7 @@ public vector<T,4> textureProjGrad(Sampler1D<vector<T,N>> sampler, vec4 p, float
{
vec4 xw__ = p.xwww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Grad $dPdx $dPdy
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xw__ Grad $dPdx $dPdy
};
}
default:
@@ -3648,26 +3651,26 @@ public vector<T,4> textureProjGrad(Sampler1D<vector<T,N>> sampler, vec4 p, float
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGrad(Sampler2D<vector<T,N>> sampler, vec3 p, vec2 dPdx, vec2 dPdy)
+public vector<T.Element,4> textureProjGrad(Sampler2D<T> sampler, vec3 p, vec2 dPdx, vec2 dPdy)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjGrad";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy
};
default:
return textureGrad(sampler, p.xy / p.z, dPdx, dPdy);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGrad(Sampler2D<vector<T,N>> sampler, vec4 p, vec2 dPdx, vec2 dPdy)
+public vector<T.Element,4> textureProjGrad(Sampler2D<T> sampler, vec4 p, vec2 dPdx, vec2 dPdy)
{
__target_switch
{
@@ -3676,7 +3679,7 @@ public vector<T,4> textureProjGrad(Sampler2D<vector<T,N>> sampler, vec4 p, vec2
{
vec4 xyw_ = p.xyww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Grad $dPdx $dPdy
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Grad $dPdx $dPdy
};
}
default:
@@ -3684,16 +3687,16 @@ public vector<T,4> textureProjGrad(Sampler2D<vector<T,N>> sampler, vec4 p, vec2
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGrad(Sampler3D<vector<T,N>> sampler, vec4 p, vec3 dPdx, vec3 dPdy)
+public vector<T.Element,4> textureProjGrad(Sampler3D<T> sampler, vec4 p, vec3 dPdx, vec3 dPdy)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjGrad";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy
};
default:
return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy);
@@ -3744,26 +3747,26 @@ public float textureProjGrad(sampler2DShadow sampler, vec4 p, vec2 dPdx, vec2 dP
// textureProjGradOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGradOffset(Sampler1D<vector<T,N>> sampler, vec2 p, float dPdx, float dPdy, constexpr int offset)
+public vector<T.Element,4> textureProjGradOffset(Sampler1D<T> sampler, vec2 p, float dPdx, float dPdy, constexpr int offset)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjGradOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset
};
default:
return textureGradOffset(sampler, p.x / p.y, dPdx, dPdy, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGradOffset(Sampler1D<vector<T,N>> sampler, vec4 p, float dPdx, float dPdy, constexpr int offset)
+public vector<T.Element,4> textureProjGradOffset(Sampler1D<T> sampler, vec4 p, float dPdx, float dPdy, constexpr int offset)
{
__target_switch
{
@@ -3772,7 +3775,7 @@ public vector<T,4> textureProjGradOffset(Sampler1D<vector<T,N>> sampler, vec4 p,
{
vec4 xw__ = p.xwww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Grad|ConstOffset $dPdx $dPdy $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xw__ Grad|ConstOffset $dPdx $dPdy $offset
};
}
default:
@@ -3780,26 +3783,26 @@ public vector<T,4> textureProjGradOffset(Sampler1D<vector<T,N>> sampler, vec4 p,
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGradOffset(Sampler2D<vector<T,N>> sampler, vec3 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset)
+public vector<T.Element,4> textureProjGradOffset(Sampler2D<T> sampler, vec3 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjGradOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset
};
default:
return textureGradOffset(sampler, p.xy / p.z, dPdx, dPdy, offset);
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGradOffset(Sampler2D<vector<T,N>> sampler, vec4 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset)
+public vector<T.Element,4> textureProjGradOffset(Sampler2D<T> sampler, vec4 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset)
{
__target_switch
{
@@ -3808,7 +3811,7 @@ public vector<T,4> textureProjGradOffset(Sampler2D<vector<T,N>> sampler, vec4 p,
{
vec4 xyw_ = p.xyww;
return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Grad|ConstOffset $dPdx $dPdy $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Grad|ConstOffset $dPdx $dPdy $offset
};
}
default:
@@ -3816,16 +3819,16 @@ public vector<T,4> textureProjGradOffset(Sampler2D<vector<T,N>> sampler, vec4 p,
}
}
-__generic<T:__BuiltinArithmeticType, let N:int>
+__generic<T:ITexelElement>
[ForceInline]
[require(cpp_glsl_hlsl_spirv, texture_sm_4_1)]
-public vector<T,4> textureProjGradOffset(Sampler3D<vector<T,N>> sampler, vec4 p, vec3 dPdx, vec3 dPdy, constexpr ivec3 offset)
+public vector<T.Element,4> textureProjGradOffset(Sampler3D<T> sampler, vec4 p, vec3 dPdx, vec3 dPdy, constexpr ivec3 offset)
{
__target_switch
{
case glsl: __intrinsic_asm "textureProjGradOffset";
case spirv: return spirv_asm {
- result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset
+ result:$$vector<T.Element,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset
};
default:
return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset);
@@ -3880,11 +3883,11 @@ public float textureProjGradOffset(sampler2DShadow sampler, vec4 p, vec2 dPdx, v
// textureGather
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, Shape:__ITextureShape, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(glsl_hlsl_spirv, texture_gather)]
-public vector<T,4> textureGather(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureGather(_Texture<
+ T,
Shape,
isArray,
0, // isMS
@@ -3926,11 +3929,11 @@ public vec4 textureGather(_Texture<
// textureGatherOffset
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(glsl_hlsl_spirv, texture_gather)]
-public vector<T,4> textureGatherOffset(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureGatherOffset(_Texture<
+ T,
__Shape2D,
isArray,
0, // isMS
@@ -3972,11 +3975,11 @@ public vec4 textureGatherOffset(_Texture<
// textureGatherOffsets
// -------------------
-__generic<T:__BuiltinArithmeticType, let N:int, let isArray:int, let sampleCount:int, let format:int>
+__generic<T:ITexelElement, let isArray:int, let sampleCount:int, let format:int>
[ForceInline]
[require(glsl_hlsl_spirv, texture_gather)]
-public vector<T,4> textureGatherOffsets(_Texture<
- vector<T,N>,
+public vector<T.Element,4> textureGatherOffsets(_Texture<
+ T,
__Shape2D,
isArray,
0, // isMS
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index d620197f3..9d6a81f84 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -10,6 +10,7 @@ void __requireGLSLExtension(String extensionName);
/// Represents an interface for buffer data layout.
/// This interface is used as a base for defining specific data layouts for buffers.
[sealed]
+[builtin]
__magic_type(IBufferDataLayoutType)
interface IBufferDataLayout
{
@@ -513,6 +514,86 @@ __generic<T, let N:int>
vector<T,N+1> __makeVector(vector<T,N> vec, T scalar);
//@public:
+/// Represent types that can be used as texel element.
+[sealed]
+[builtin]
+interface ITexelElement
+{
+ associatedtype Element : __BuiltinArithmeticType;
+ static const int elementCount;
+ __init(Element x);
+}
+
+${{{
+// Scalar types that can be used as texel element.
+const char* texeElementScalarTypes[] = {
+ "half",
+ "float",
+ "int",
+ "uint",
+ "int8_t",
+ "int16_t",
+ "uint8_t",
+ "uint16_t"
+};
+for (auto elementType : texeElementScalarTypes)
+{
+}}}
+extension $(elementType) : ITexelElement
+{
+ typealias Element = $(elementType);
+ static const int elementCount = 1;
+ __intrinsic_op(0) __init(Element x);
+}
+extension<int N> vector<$(elementType), N> : ITexelElement
+{
+ typealias Element = $(elementType);
+ static const int elementCount = N;
+ __intrinsic_op($(kIROp_MakeVectorFromScalar)) __init(Element x);
+}
+${{{
+} // end for texelElementScalarTypes.
+}}}
+
+// Additional 64-bit types that can be used as texel element.
+extension double:ITexelElement
+{
+ typealias Element = double;
+ static const int elementCount = 1;
+ __intrinsic_op(0) __init(Element x);
+}
+extension double2:ITexelElement
+{
+ typealias Element = double;
+ static const int elementCount = 2;
+ __intrinsic_op($(kIROp_MakeVectorFromScalar)) __init(Element x);
+}
+extension uint64_t:ITexelElement
+{
+ typealias Element = uint64_t;
+ static const int elementCount = 1;
+ __intrinsic_op(0) __init(Element x);
+}
+extension int64_t:ITexelElement
+{
+ typealias Element = int64_t;
+ static const int elementCount = 1;
+ __intrinsic_op(0) __init(Element x);
+}
+extension vector<uint64_t,2>:ITexelElement
+{
+ typealias Element = uint64_t;
+ static const int elementCount = 2;
+ __intrinsic_op($(kIROp_MakeVectorFromScalar)) __init(Element x);
+}
+extension vector<int64_t,2>:ITexelElement
+{
+ typealias Element = int64_t;
+ static const int elementCount = 2;
+ __intrinsic_op($(kIROp_MakeVectorFromScalar)) __init(Element x);
+}
+
+//@public:
/// A parameterized type that represents all flavors of texture types supported by the Slang language.
/// Please note that this type is not intended to be used directly in user code, and not all combinations
/// of the generic arguments are valid.
@@ -591,7 +672,7 @@ vector<T,N+1> __makeVector(vector<T,N> vec, T scalar);
/// @category texture_types Texture types
__magic_type(TextureType)
__intrinsic_type($(kIROp_TextureType))
-struct _Texture<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
+struct _Texture<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
{
}
@@ -776,7 +857,7 @@ float __glsl_texture_level_offset_1d_shadow<TTexture, TCoord, TOffset>(TTexture
//@public:
-__generic<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let isShadow:int, let format:int>
extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
{
//@hidden:
@@ -1498,7 +1579,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,1,format>
// Non-combined texture types specific functions
-__generic<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
extension _Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,format>
{
typealias TextureCoord = vector<float, Shape.dimensions>;
@@ -1596,7 +1677,7 @@ extension _Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,0,format>
}
}
-__generic<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let isShadow:int, let format:int>
extension _Texture<T,Shape,isArray,isMS,sampleCount,0,isShadow,0,format>
{
[__readNone]
@@ -2720,7 +2801,7 @@ for (int isMS = 0; isMS <= 1; isMS++) {
TextureTypeInfo textureTypeInfo(kBaseTextureShapes[shapeIndex], isArray, isMS, 0, sb, path);
}}}}
-__generic<T, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
+__generic<T:ITexelElement, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
extension _Texture<T,$(shapeTypeName),$(isArray),$(isMS),sampleCount,access,isShadow,isCombined,format>
{
${{{{
@@ -2733,7 +2814,7 @@ ${{{{
}}}}
// Texture.GetSamplePosition(int s);
-__generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
extension _Texture<T,Shape,isArray,1,sampleCount,access,isShadow,isCombined,format>
{
[require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_1_vertex_fragment_geometry)]
@@ -2745,10 +2826,10 @@ Array<T,4> __makeArray<T>(T v0, T v1, T v2, T v3);
// Beginning of Texture Gather
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_metal_spirv_wgsl, texture_gather)]
-vector<TElement,4> __texture_gather(
+vector<T.Element,4> __texture_gather(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 0, format> texture,
SamplerState s,
vector<float, Shape.dimensions+isArray> location,
@@ -2781,7 +2862,7 @@ vector<TElement,4> __texture_gather(
case spirv:
return spirv_asm {
%sampledImage : __sampledImageType(texture) = OpSampledImage $texture $s;
- result:$$vector<TElement,4> = OpImageGather %sampledImage $location $component;
+ result:$$vector<T.Element,4> = OpImageGather %sampledImage $location $component;
};
case wgsl:
if (isShadow == 1)
@@ -2814,10 +2895,10 @@ vector<TElement,4> __texture_gather(
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gather(
+vector<T.Element,4> __texture_gather(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 1, format> sampler,
vector<float, Shape.dimensions+isArray> location,
int component)
@@ -2828,15 +2909,15 @@ vector<TElement,4> __texture_gather(
__intrinsic_asm "textureGather($0, $1, $2)";
case spirv:
return spirv_asm {
- result:$$vector<TElement,4> = OpImageGather $sampler $location $component;
+ result:$$vector<T.Element,4> = OpImageGather $sampler $location $component;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_metal_spirv_wgsl, texture_gather)]
-vector<TElement,4> __texture_gather_offset(
+vector<T.Element,4> __texture_gather_offset(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 0, format> texture,
SamplerState s,
vector<float, Shape.dimensions+isArray> location,
@@ -2862,7 +2943,7 @@ vector<TElement,4> __texture_gather_offset(
return spirv_asm {
OpCapability ImageGatherExtended;
%sampledImage : __sampledImageType(texture) = OpSampledImage $texture $s;
- result:$$vector<TElement,4> = OpImageGather %sampledImage $location $component Offset $offset;
+ result:$$vector<T.Element,4> = OpImageGather %sampledImage $location $component Offset $offset;
};
case wgsl:
if (isShadow == 1)
@@ -2895,10 +2976,10 @@ vector<TElement,4> __texture_gather_offset(
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gather_offset(
+vector<T.Element,4> __texture_gather_offset(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 1, format> sampler,
vector<float, Shape.dimensions+isArray> location,
constexpr vector<int, Shape.planeDimensions> offset,
@@ -2911,15 +2992,15 @@ vector<TElement,4> __texture_gather_offset(
case spirv:
return spirv_asm {
OpCapability ImageGatherExtended;
- result:$$vector<TElement,4> = OpImageGather $sampler $location $component Offset $offset;
+ result:$$vector<T.Element,4> = OpImageGather $sampler $location $component Offset $offset;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gather_offsets(
+vector<T.Element,4> __texture_gather_offsets(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 0, format> texture,
SamplerState s,
vector<float, Shape.dimensions+isArray> location,
@@ -2938,15 +3019,15 @@ vector<TElement,4> __texture_gather_offsets(
return spirv_asm {
OpCapability ImageGatherExtended;
%sampledImage : __sampledImageType(texture) = OpSampledImage $texture $s;
- result:$$vector<TElement,4> = OpImageGather %sampledImage $location $component ConstOffsets $offsets;
+ result:$$vector<T.Element,4> = OpImageGather %sampledImage $location $component ConstOffsets $offsets;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gather_offsets(
+vector<T.Element,4> __texture_gather_offsets(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 1, format> sampler,
vector<float, Shape.dimensions+isArray> location,
constexpr vector<int, Shape.planeDimensions> offset1,
@@ -2963,19 +3044,19 @@ vector<TElement,4> __texture_gather_offsets(
let offsets = __makeArray(offset1,offset2,offset3,offset4);
return spirv_asm {
OpCapability ImageGatherExtended;
- result:$$vector<TElement,4> = OpImageGather $sampler $location $component ConstOffsets $offsets;
+ result:$$vector<T.Element,4> = OpImageGather $sampler $location $component ConstOffsets $offsets;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_metal_spirv_wgsl, texture_gather)]
-vector<TElement,4> __texture_gatherCmp(
+vector<T.Element,4> __texture_gatherCmp(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 0, format> texture,
SamplerComparisonState s,
vector<float, Shape.dimensions+isArray> location,
- TElement compareValue)
+ T.Element compareValue)
{
__target_switch
{
@@ -2999,7 +3080,7 @@ vector<TElement,4> __texture_gatherCmp(
case spirv:
return spirv_asm {
%sampledImage : __sampledImageType(texture) = OpSampledImage $texture $s;
- result:$$vector<TElement,4> = OpImageDrefGather %sampledImage $location $compareValue;
+ result:$$vector<T.Element,4> = OpImageDrefGather %sampledImage $location $compareValue;
};
case wgsl:
static_assert(isShadow == 1, "WGSL supports textureGatherCompare only for depth textures.");
@@ -3018,13 +3099,13 @@ vector<TElement,4> __texture_gatherCmp(
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gatherCmp(
+vector<T.Element,4> __texture_gatherCmp(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 1, format> sampler,
vector<float, Shape.dimensions+isArray> location,
- TElement compareValue)
+ T.Element compareValue)
{
__target_switch
{
@@ -3032,19 +3113,19 @@ vector<TElement,4> __texture_gatherCmp(
__intrinsic_asm "textureGather($0, $1, $2)";
case spirv:
return spirv_asm {
- result:$$vector<TElement,4> = OpImageDrefGather $sampler $location $compareValue;
+ result:$$vector<T.Element,4> = OpImageDrefGather $sampler $location $compareValue;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_metal_spirv_wgsl, texture_gather)]
-vector<TElement,4> __texture_gatherCmp_offset(
+vector<T.Element,4> __texture_gatherCmp_offset(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 0, format> texture,
SamplerComparisonState s,
vector<float, Shape.dimensions+isArray> location,
- TElement compareValue,
+ T.Element compareValue,
constexpr vector<int, Shape.planeDimensions> offset)
{
__target_switch
@@ -3065,7 +3146,7 @@ vector<TElement,4> __texture_gatherCmp_offset(
case spirv:
return spirv_asm {
%sampledImage : __sampledImageType(texture) = OpSampledImage $texture $s;
- result:$$vector<TElement,4> = OpImageDrefGather %sampledImage $location $compareValue ConstOffset $offset;
+ result:$$vector<T.Element,4> = OpImageDrefGather %sampledImage $location $compareValue ConstOffset $offset;
};
case wgsl:
static_assert(isShadow == 1, "WGSL supports textureGatherCompare only for depth textures.");
@@ -3084,13 +3165,13 @@ vector<TElement,4> __texture_gatherCmp_offset(
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gatherCmp_offset(
+vector<T.Element,4> __texture_gatherCmp_offset(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 1, format> sampler,
vector<float, Shape.dimensions+isArray> location,
- TElement compareValue,
+ T.Element compareValue,
constexpr vector<int, Shape.planeDimensions> offset)
{
__target_switch
@@ -3099,19 +3180,19 @@ vector<TElement,4> __texture_gatherCmp_offset(
__intrinsic_asm "textureGatherOffset($0, $1, $2, $3)";
case spirv:
return spirv_asm {
- result:$$vector<TElement,4> = OpImageDrefGather $sampler $location $compareValue ConstOffset $offset;
+ result:$$vector<T.Element,4> = OpImageDrefGather $sampler $location $compareValue ConstOffset $offset;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gatherCmp_offsets(
+vector<T.Element,4> __texture_gatherCmp_offsets(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 0, format> texture,
SamplerComparisonState s,
vector<float, Shape.dimensions+isArray> location,
- TElement compareValue,
+ T.Element compareValue,
vector<int, Shape.planeDimensions> offset1,
vector<int, Shape.planeDimensions> offset2,
vector<int, Shape.planeDimensions> offset3,
@@ -3126,18 +3207,18 @@ vector<TElement,4> __texture_gatherCmp_offsets(
return spirv_asm {
OpCapability ImageGatherExtended;
%sampledImage : __sampledImageType(texture) = OpSampledImage $texture $s;
- result:$$vector<TElement,4> = OpImageDrefGather %sampledImage $location $compareValue ConstOffsets $offsets;
+ result:$$vector<T.Element,4> = OpImageDrefGather %sampledImage $location $compareValue ConstOffsets $offsets;
};
}
}
-__generic<TElement, T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let access:int, let isShadow:int, let format:int>
[ForceInline]
[require(glsl_spirv, texture_gather)]
-vector<TElement,4> __texture_gatherCmp_offsets(
+vector<T.Element,4> __texture_gatherCmp_offsets(
_Texture<T, Shape, isArray, 0, sampleCount, access, isShadow, 1, format> sampler,
vector<float, Shape.dimensions+isArray> location,
- TElement compareValue,
+ T.Element compareValue,
vector<int, Shape.planeDimensions> offset1,
vector<int, Shape.planeDimensions> offset2,
vector<int, Shape.planeDimensions> offset3,
@@ -3151,30 +3232,26 @@ vector<TElement,4> __texture_gatherCmp_offsets(
let offsets = __makeArray(offset1,offset2,offset3,offset4);
return spirv_asm {
OpCapability ImageGatherExtended;
- result:$$vector<TElement,4> = OpImageDrefGather $sampler $location $compareValue ConstOffsets $offsets;
+ result:$$vector<T.Element,4> = OpImageDrefGather $sampler $location $compareValue ConstOffsets $offsets;
};
}
}
${{{{
for (int isCombined = 0; isCombined < 2; isCombined++)
-for (int isScalarTexture = 0; isScalarTexture < 2; isScalarTexture++)
{
- const char* extSizeParam = isScalarTexture ? "" : ", let N:int";
- const char* extTexType = isScalarTexture ? "T" : "vector<T,N>";
-
}}}}
-// Gather for [TextureType = $(extTexType), isCombined = $(isCombined)]
+// Gather for [isCombined = $(isCombined)]
-__generic<T:__BuiltinArithmeticType $(extSizeParam), Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
-extension _Texture<$(extTexType),Shape,isArray,0,sampleCount,0,isShadow,$(isCombined),format>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
+extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,$(isCombined),format>
{
${{{{
for (int isShadow = 0; isShadow < 2; isShadow++)
for (auto componentId = 0; componentId < 5; componentId++)
{
const char* compareFunc = isShadow ? "Cmp" : "";
- const char* compareParam = isShadow ? ", T compareValue" : "";
+ const char* compareParam = isShadow ? ", T.Element compareValue" : "";
const char* compareArg = isShadow ? ", compareValue" : "";
// Some targets support the combined texture natively
@@ -3190,7 +3267,7 @@ ${{{{
}}}}
[ForceInline]
[require(glsl_hlsl_metal_spirv_wgsl, texture_gather)]
- vector<T,4> Gather$(compareFunc)$(componentFunc)(
+ vector<T.Element,4> Gather$(compareFunc)$(componentFunc)(
$(samplerParam)
vector<float, Shape.dimensions+isArray> location
$(compareParam))
@@ -3203,16 +3280,16 @@ ${{{{
case hlsl: __intrinsic_asm ".Gather$(compareFunc)$(componentFunc)";
case metal:
case wgsl:
- return __texture_gather$(compareFunc)<T>($(getTexture) $(getSampler), location $(compareArg) $(componentArg));
+ return __texture_gather$(compareFunc)($(getTexture) $(getSampler), location $(compareArg) $(componentArg));
case glsl:
case spirv:
- return __texture_gather$(compareFunc)<T>(this $(samplerArg), location $(compareArg) $(componentArg));
+ return __texture_gather$(compareFunc)(this $(samplerArg), location $(compareArg) $(componentArg));
}
}
[ForceInline]
[require(hlsl, texture_gather)]
- vector<T,4> Gather$(compareFunc)$(componentFunc)(
+ vector<T.Element,4> Gather$(compareFunc)$(componentFunc)(
$(samplerParam)
vector<float, Shape.dimensions+isArray> location
$(compareParam),
@@ -3229,7 +3306,7 @@ ${{{{
[ForceInline]
[require(glsl_hlsl_metal_spirv_wgsl, texture_gather)]
- vector<T,4> Gather$(compareFunc)$(componentFunc)(
+ vector<T.Element,4> Gather$(compareFunc)$(componentFunc)(
$(samplerParam)
vector<float, Shape.dimensions+isArray> location
$(compareParam),
@@ -3243,16 +3320,16 @@ ${{{{
case hlsl: __intrinsic_asm ".Gather$(compareFunc)$(componentFunc)";
case metal:
case wgsl:
- return __texture_gather$(compareFunc)_offset<T>($(getTexture) $(getSampler), location $(compareArg), offset $(componentArg));
+ return __texture_gather$(compareFunc)_offset($(getTexture) $(getSampler), location $(compareArg), offset $(componentArg));
case glsl:
case spirv:
- return __texture_gather$(compareFunc)_offset<T>(this $(samplerArg), location $(compareArg), offset $(componentArg));
+ return __texture_gather$(compareFunc)_offset(this $(samplerArg), location $(compareArg), offset $(componentArg));
}
}
[ForceInline]
[require(hlsl, texture_gather)]
- vector<T,4> Gather$(compareFunc)$(componentFunc)(
+ vector<T.Element,4> Gather$(compareFunc)$(componentFunc)(
$(samplerParam)
vector<float, Shape.dimensions+isArray> location
$(compareParam),
@@ -3270,7 +3347,7 @@ ${{{{
[ForceInline]
[require(glsl_hlsl_spirv, texture_gather)]
- vector<T,4> Gather$(compareFunc)$(componentFunc)(
+ vector<T.Element,4> Gather$(compareFunc)$(componentFunc)(
$(samplerParam)
vector<float, Shape.dimensions+isArray> location
$(compareParam),
@@ -3293,7 +3370,7 @@ ${{{{
[ForceInline]
[require(hlsl, texture_gather)]
- vector<T,4> Gather$(compareFunc)$(componentFunc)(
+ vector<T.Element,4> Gather$(compareFunc)$(componentFunc)(
$(samplerParam)
vector<float, Shape.dimensions+isArray> location
$(compareParam),
@@ -3315,7 +3392,7 @@ ${{{{
${{{{
} // for (componentId)
}}}}
-} // End of: Gather for [TextureType = $(extTexType), isCombined = $(isCombined)]
+} // End of: Gather for [isCombined = $(isCombined)]
${{{{
} // for (isScalarTexture)
@@ -3325,7 +3402,7 @@ ${{{{
// Load/Subscript for readonly, no MS textures
-__generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let isCombined:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let isCombined:int, let format:int>
extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
{
//@hidden:
@@ -3453,7 +3530,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
case $(SLANG_TEXTURE_3D):
__intrinsic_asm "textureLoad($0, ($1).xyz, ($1).w)$z";
}
- return T();
+ return __default<T>();
}
}
@@ -3555,7 +3632,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
// Texture Load/Subscript for readonly, MS textures
-__generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let isCombined:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let isCombined:int, let format:int>
extension _Texture<T,Shape,isArray,1,sampleCount,0,isShadow,isCombined,format>
{
//@hidden:
@@ -3746,7 +3823,7 @@ ${{{{
const char* glslIntrinsicMSOffset = "$cimageLoad($0, ($1)+($3), $2)$z";
}}}}
-__generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
extension _Texture<T,Shape,isArray,0,sampleCount,$(access),isShadow, 0,format>
{
${{{{
@@ -4081,7 +4158,7 @@ if (access == kCoreModule_ResourceAccessReadWrite) {
// RW MS textures.
-__generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int>
extension _Texture<T,Shape,isArray,1,sampleCount,$(access),isShadow, 0,format>
{
[__readNone]
@@ -4234,7 +4311,7 @@ ${{{{
}}}}
// Definitions to support the legacy texture .mips[][] operator.
-struct __TextureMip<T, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
+struct __TextureMip<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
{
_Texture<T, Shape, isArray, 0 /*isMS*/, 0 /*sampleCount*/, 0 /*access*/, 0 /*isShadow*/, isCombined, format> tex;
int mip;
@@ -4245,7 +4322,7 @@ struct __TextureMip<T, Shape : __ITextureShape, let isArray : int, let isCombine
}
}
-struct __TextureMips<T, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
+struct __TextureMips<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
{
_Texture<T, Shape, isArray, 0 /*isMS*/, 0 /*sampleCount*/, 0 /*access*/, 0 /*isShadow*/, isCombined, format> tex;
__subscript(int mip)->__TextureMip<T, Shape, isArray, isCombined, format>
@@ -4256,7 +4333,7 @@ struct __TextureMips<T, Shape : __ITextureShape, let isArray : int, let isCombin
}
//@hidden:
-__generic<T, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
+__generic<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
extension _Texture<T, Shape, isArray, 0 /*isMS*/, 0 /*sampleCount*/, 0 /*access*/, 0 /*isShadow*/, isCombined, format>
{
property __TextureMips<T, Shape, isArray, isCombined, format> mips
@@ -4267,7 +4344,7 @@ extension _Texture<T, Shape, isArray, 0 /*isMS*/, 0 /*sampleCount*/, 0 /*access*
}
// Definitions to support the .sample[][] operator.
-struct __TextureSample<T, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
+struct __TextureSample<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
{
_Texture<T, Shape, isArray, 1 /*isMS*/, 0 /*sampleCount*/, 0 /*access*/, 0 /*isShadow*/, isCombined, format> tex;
int sample;
@@ -4278,7 +4355,7 @@ struct __TextureSample<T, Shape : __ITextureShape, let isArray : int, let isComb
}
}
-struct __TextureSampleMS<T, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
+struct __TextureSampleMS<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
{
_Texture<T, Shape, isArray, 1 /*isMS*/, 0 /*sampleCount*/, 0 /*access*/, 0 /*isShadow*/, isCombined, format> tex;
__subscript(int sample)->__TextureSample<T, Shape, isArray, isCombined, format>
@@ -4288,7 +4365,7 @@ struct __TextureSampleMS<T, Shape : __ITextureShape, let isArray : int, let isCo
}
}
-__generic<T, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
+__generic<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isCombined : int, let format : int>
extension _Texture<T, Shape, isArray, 1 /*isMS*/, 0 /*sampleCount*/, 0 /*access*/, 0 /*isShadow*/, isCombined, format>
{
property __TextureSampleMS<T, Shape, isArray, isCombined, format> sample
@@ -4345,7 +4422,7 @@ ${{{{
/// @param format The storage format of the texture.
/// @see Please refer to `_Texture` for more information about texture types.
/// @category texture_types
-typealias $(accessPrefix[access])$(textureTypeName)$(shapeTypeNames[shape])$(msPostFix[isMS])$(arrayPostFix[isArray])<T=float4, let sampleCount:int=0, let format:int=0> = _Texture<T, __Shape$(shapeTypeNames[shape]), $(isArray), $(isMS), sampleCount, $(access), 0, $(isCombined), format>;
+typealias $(accessPrefix[access])$(textureTypeName)$(shapeTypeNames[shape])$(msPostFix[isMS])$(arrayPostFix[isArray])<T:ITexelElement=float4, let sampleCount:int=0, let format:int=0> = _Texture<T, __Shape$(shapeTypeNames[shape]), $(isArray), $(isMS), sampleCount, $(access), 0, $(isCombined), format>;
${{{{
}
}}}}
@@ -15633,7 +15710,7 @@ for (int aa = 0; aa < kBaseBufferAccessLevelCount; ++aa)
{
auto access = kBaseBufferAccessLevels[aa].access;
sb << "/// @category texture_types\n";
- sb << "__generic<T,let format:int=0>\n";
+ sb << "__generic<T:ITexelElement,let format:int=0>\n";
sb << "typealias ";
sb << kBaseBufferAccessLevels[aa].name;
sb << "Buffer = _Texture<T, __ShapeBuffer, 0, 0, 0, " << aa << ", 0, 0, format>;\n";
@@ -15648,7 +15725,7 @@ for (int aa = 0; aa < kBaseBufferAccessLevelCount; ++aa)
char const* requireToSet_onlyHLSL = (isReadOnly) ? "[require(hlsl, texture_sm_4_1)]" : "[require(hlsl, texture_sm_4_1_compute_fragment)]";
}}}}
-__generic<T, let format:int>
+__generic<T:ITexelElement, let format:int>
extension _Texture<T, __ShapeBuffer, 0, 0, 0, $(aa), 0, 0, format>
{
[__readNone]
@@ -16920,23 +16997,33 @@ interface __BuiltinSamplerFeedbackType {};
[sealed]
__magic_type(FeedbackType, $(int(FeedbackType::Kind::MinMip)))
__target_intrinsic(hlsl, SAMPLER_FEEDBACK_MIN_MIP)
-struct SAMPLER_FEEDBACK_MIN_MIP : __BuiltinSamplerFeedbackType {};
+struct SAMPLER_FEEDBACK_MIN_MIP : __BuiltinSamplerFeedbackType, ITexelElement {
+ typealias Element = float;
+ static const int elementCount = 1;
+ __intrinsic_op(0) __init(float x){}
+};
/// @category texture_types
[sealed]
__magic_type(FeedbackType, $(int(FeedbackType::Kind::MipRegionUsed)))
__target_intrinsic(hlsl, SAMPLER_FEEDBACK_MIP_REGION_USED)
-struct SAMPLER_FEEDBACK_MIP_REGION_USED : __BuiltinSamplerFeedbackType {};
+struct SAMPLER_FEEDBACK_MIP_REGION_USED : __BuiltinSamplerFeedbackType, ITexelElement
+{
+ typealias Element = float;
+ static const int elementCount = 1;
+ __intrinsic_op(0) __init(float x){}
+};
// All of these objects are write-only resources that point to a special kind of unordered access view meant for sampler feedback.
-__generic<T:__BuiltinSamplerFeedbackType>
-extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback), 0, 0, 0>
+extension<T> _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback), 0, 0, 0>
+ where T:ITexelElement
+ where T:__BuiltinSamplerFeedbackType
{
// With Clamp
[require(cpp_hlsl)]
- void WriteSamplerFeedback<S>(Texture2D<S> tex, SamplerState samp, float2 location, float clamp)
+ void WriteSamplerFeedback<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location, float clamp)
{
__target_switch
{
@@ -16946,7 +17033,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackBias<S>(Texture2D<S> tex, SamplerState samp, float2 location, float bias, float clamp)
+ void WriteSamplerFeedbackBias<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location, float bias, float clamp)
{
__target_switch
{
@@ -16956,7 +17043,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackGrad<S>(Texture2D<S> tex, SamplerState samp, float2 location, float2 ddx, float2 ddy, float clamp)
+ void WriteSamplerFeedbackGrad<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location, float2 ddx, float2 ddy, float clamp)
{
__target_switch
{
@@ -16968,7 +17055,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
// Level
[require(cpp_hlsl)]
- void WriteSamplerFeedbackLevel<S>(Texture2D<S> tex, SamplerState samp, float2 location, float lod)
+ void WriteSamplerFeedbackLevel<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location, float lod)
{
__target_switch
{
@@ -16980,7 +17067,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
// Without Clamp
[require(cpp_hlsl)]
- void WriteSamplerFeedback<S>(Texture2D<S> tex, SamplerState samp, float2 location)
+ void WriteSamplerFeedback<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location)
{
__target_switch
{
@@ -16990,7 +17077,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackBias<S>(Texture2D<S> tex, SamplerState samp, float2 location, float bias)
+ void WriteSamplerFeedbackBias<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location, float bias)
{
__target_switch
{
@@ -17000,7 +17087,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackGrad<S>(Texture2D<S> tex, SamplerState samp, float2 location, float2 ddx, float2 ddy)
+ void WriteSamplerFeedbackGrad<S:ITexelElement>(Texture2D<S> tex, SamplerState samp, float2 location, float2 ddx, float2 ddy)
{
__target_switch
{
@@ -17010,13 +17097,14 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
};
-__generic<T:__BuiltinSamplerFeedbackType>
-extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback), 0, 0, 0>
+extension<T> _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback), 0, 0, 0>
+ where T:__BuiltinSamplerFeedbackType
+ where T:ITexelElement
{
// With Clamp
[require(cpp_hlsl)]
- void WriteSamplerFeedback<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float clamp)
+ void WriteSamplerFeedback<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float clamp)
{
__target_switch
{
@@ -17026,7 +17114,7 @@ extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackBias<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float bias, float clamp)
+ void WriteSamplerFeedbackBias<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float bias, float clamp)
{
__target_switch
{
@@ -17036,7 +17124,7 @@ extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackGrad<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float3 ddx, float3 ddy, float clamp)
+ void WriteSamplerFeedbackGrad<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float3 ddx, float3 ddy, float clamp)
{
__target_switch
{
@@ -17048,7 +17136,7 @@ extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback),
// Level
[require(cpp_hlsl)]
- void WriteSamplerFeedbackLevel<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float lod)
+ void WriteSamplerFeedbackLevel<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float lod)
{
__target_switch
{
@@ -17060,7 +17148,7 @@ extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback),
// Without Clamp
[require(cpp_hlsl)]
- void WriteSamplerFeedback<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location)
+ void WriteSamplerFeedback<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location)
{
__target_switch
{
@@ -17070,7 +17158,7 @@ extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackBias<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float bias)
+ void WriteSamplerFeedbackBias<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float bias)
{
__target_switch
{
@@ -17080,7 +17168,7 @@ extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback),
}
[require(cpp_hlsl)]
- void WriteSamplerFeedbackGrad<S>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float3 ddx, float3 ddy)
+ void WriteSamplerFeedbackGrad<S:ITexelElement>(Texture2DArray<S> texArray, SamplerState samp, float3 location, float3 ddx, float3 ddy)
{
__target_switch
{
@@ -20025,10 +20113,10 @@ ${
// for any resource type.
}
-__intrinsic_op($(kIROp_GetRegisterSpace)) uint __getRegisterSpace<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>(_Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,isCombined,format> texture);
+__intrinsic_op($(kIROp_GetRegisterSpace)) uint __getRegisterSpace<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>(_Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,isCombined,format> texture);
__intrinsic_op($(kIROp_GetRegisterSpace)) uint __getRegisterSpace(SamplerState sampler);
-__intrinsic_op($(kIROp_GetRegisterIndex)) uint __getRegisterIndex<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>(_Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,isCombined,format> texture);
+__intrinsic_op($(kIROp_GetRegisterIndex)) uint __getRegisterIndex<T:ITexelElement, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>(_Texture<T,Shape,isArray,isMS,sampleCount,access,isShadow,isCombined,format> texture);
__intrinsic_op($(kIROp_GetRegisterIndex)) uint __getRegisterIndex(SamplerState sampler);
//@public:
@@ -20218,7 +20306,7 @@ ${
// further clutter the original type declarations.
}
-__generic<T, Shape: __ITextureShape, let sampleCount:int, let isShadow:int, let format:int>
+__generic<T:ITexelElement, Shape: __ITextureShape, let sampleCount:int, let isShadow:int, let format:int>
extension _Texture<T,Shape,0,0,sampleCount,0,isShadow,0,format>
{
${
@@ -21035,7 +21123,7 @@ enum __DynamicResourceKind
Sampler = 1
}
-__generic<T, Shape : __ITextureShape, let isArray : int, let isMS : int, let sampleCount : int, let access : int, let isShadow : int, let isCombined : int, let format : int>
+__generic<T:ITexelElement, Shape : __ITextureShape, let isArray : int, let isMS : int, let sampleCount : int, let access : int, let isShadow : int, let isCombined : int, let format : int>
extension _Texture<T, Shape, isArray, isMS, sampleCount, access, isShadow, isCombined, format> : __IDynamicResourceCastable<__DynamicResourceKind.General>
{
__intrinsic_op($(kIROp_CastDynamicResource))
diff --git a/source/slang/slang-check-inheritance.cpp b/source/slang/slang-check-inheritance.cpp
index f774aae38..7af2d2e81 100644
--- a/source/slang/slang-check-inheritance.cpp
+++ b/source/slang/slang-check-inheritance.cpp
@@ -1149,6 +1149,10 @@ InheritanceInfo SharedSemanticsContext::_calcInheritanceInfo(
info.facets = FacetList(directFacet);
return info;
}
+ else if (auto modifiedType = as<ModifiedType>(type))
+ {
+ return _calcInheritanceInfo(modifiedType->getBase(), circularityInfo);
+ }
else
{
// As a fallback, any type not covered by the above cases will
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index b0d1fbb4c..13a85e8ab 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -614,7 +614,10 @@ void CPPSourceEmitter::emitGlobalRTTISymbolPrefix()
void CPPSourceEmitter::emitWitnessTable(IRWitnessTable* witnessTable)
{
- auto interfaceType = cast<IRInterfaceType>(witnessTable->getConformanceType());
+ auto interfaceType = as<IRInterfaceType>(witnessTable->getConformanceType());
+
+ if (!interfaceType)
+ return;
// Ignore witness tables for builtin interface types.
if (isBuiltin(interfaceType))
diff --git a/source/slang/slang-ir-peephole.cpp b/source/slang/slang-ir-peephole.cpp
index 0a08c67ff..ced0b5eb0 100644
--- a/source/slang/slang-ir-peephole.cpp
+++ b/source/slang/slang-ir-peephole.cpp
@@ -829,6 +829,8 @@ struct PeepholeContext : InstPassBase
case kIROp_VectorReshape:
{
auto fromType = as<IRVectorType>(inst->getOperand(0)->getDataType());
+ if (!fromType)
+ break;
auto resultType = as<IRVectorType>(inst->getDataType());
if (!resultType)
{
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,