diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2024-05-17 18:10:35 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-17 18:10:35 -0700 |
| commit | 40360431dfac9ec122a0300471d42be9d265f452 (patch) | |
| tree | cd042b8de4a1c57fa54d70db2aed4c2c234a3cca | |
| parent | 0a5908dc9a0cde87dcb14176b9053c2fbaf31cfd (diff) | |
SPIR-V support for GLSL texture functions (#4184)
* SPIR-V support for GLSL texture functions
Closes #4147
This commit implements GLSL texture functions with SPIR-V intrinsics.
It also implements some of missing GLSL implementations.
- textureProj
- textureLod
- texelFetchOffset
- textureProjOffset
- textureLodOffset
- textureProjLod
- textureProjLodOffset
- textureGrad
- textureGradOffset
- textureProjGrad
- textureProjGradOffset
* Fix SPIR-V issues discovered while improving the test case.
* Add __requireComputeDerivative() whenever sampling
* Do not touch GetDimensions
| -rw-r--r-- | source/slang/glsl.meta.slang | 1303 | ||||
| -rw-r--r-- | tests/glsl-intrinsic/intrinsic-texture.slang | 1278 |
2 files changed, 2257 insertions, 324 deletions
diff --git a/source/slang/glsl.meta.slang b/source/slang/glsl.meta.slang index 881fabb52..729bf3822 100644 --- a/source/slang/glsl.meta.slang +++ b/source/slang/glsl.meta.slang @@ -1893,10 +1893,21 @@ public vec2 textureQueryLod(__TextureImpl< format > sampler, float p) { - return vec2( - sampler.CalculateLevelOfDetail(p), - sampler.CalculateLevelOfDetailUnclamped(p) - ); + __requireComputeDerivative(); + __target_switch + { + case glsl: + __intrinsic_asm "textureQueryLod"; + case spirv: + return spirv_asm { + result:$$float2 = OpImageQueryLod $sampler $p + }; + default: + return vec2( + sampler.CalculateLevelOfDetail(p), + sampler.CalculateLevelOfDetailUnclamped(p) + ); + } } __generic<T:IFloat, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let isShadow:int, let format:int> @@ -1913,10 +1924,21 @@ public vec2 textureQueryLod(__TextureImpl<T, format > sampler, vector<float,Shape.dimensions> p) { - return vec2( - sampler.CalculateLevelOfDetail(p), - sampler.CalculateLevelOfDetailUnclamped(p) - ); + __requireComputeDerivative(); + __target_switch + { + case glsl: + __intrinsic_asm "textureQueryLod"; + case spirv: + return spirv_asm { + result:$$float2 = OpImageQueryLod $sampler $p + }; + default: + return vec2( + sampler.CalculateLevelOfDetail(p), + sampler.CalculateLevelOfDetailUnclamped(p) + ); + } } // ------------------- @@ -2159,8 +2181,22 @@ public float texture(sampler1DShadow sampler, vec3 p) [require(glsl_hlsl_spirv, texture_shadowlod)] public float texture(sampler1DShadow sampler, vec3 p, float bias) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.x, p.z); + float location = p.x; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "texture"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias $bias; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue); + } } [ForceInline] @@ -2174,8 +2210,22 @@ public float texture(sampler2DShadow sampler, vec3 p) [require(glsl_hlsl_spirv, texture_shadowlod)] public float texture(sampler2DShadow sampler, vec3 p, float bias) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.xy, p.z); + vec2 location = p.xy; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "texture"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias $bias; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue); + } } [require(glsl_hlsl_spirv, texture_shadowlod_cube)] @@ -2189,8 +2239,22 @@ public float texture(samplerCubeShadow sampler, vec4 p) [ForceInline] public float texture(samplerCubeShadow sampler, vec4 p, float bias) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.xyz, p.w); + vec3 location = p.xyz; + float compareValue = p.w; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "texture"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias $bias; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue); + } } [ForceInline] @@ -2204,8 +2268,22 @@ public float texture(sampler1DArrayShadow sampler, vec3 p) [require(glsl_hlsl_spirv, texture_shadowlod)] public float texture(sampler1DArrayShadow sampler, vec3 p, float bias) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.xy, p.z); + vec2 location = p.xy; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "texture"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias $bias; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue); + } } [ForceInline] @@ -2231,7 +2309,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec2 p) { - return texture(sampler, p.x / p.y); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p + }; + default: + return texture(sampler, p.x / p.y); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2239,7 +2326,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec2 p, float bias) { - return texture(sampler, p.x / p.y, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias + }; + default: + return texture(sampler, p.x / p.y, bias); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2247,7 +2343,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec4 p) { - return texture(sampler, p.x / p.w); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p + }; + default: + return texture(sampler, p.x / p.w); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2255,7 +2360,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler1D<vector<T,N>> sampler, vec4 p, float bias) { - return texture(sampler, p.x / p.w, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias + }; + default: + return texture(sampler, p.x / p.w, bias); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2263,7 +2377,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec3 p) { - return texture(sampler, p.xy / p.z); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p + }; + default: + return texture(sampler, p.xy / p.z); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2271,7 +2394,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec3 p, float bias) { - return texture(sampler, p.xy / p.z, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias + }; + default: + return texture(sampler, p.xy / p.z, bias); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2279,7 +2411,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec4 p) { - return texture(sampler, p.xy / p.w); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p + }; + default: + return texture(sampler, p.xy / p.w); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2287,7 +2428,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler2D<vector<T,N>> sampler, vec4 p, float bias) { - return texture(sampler, p.xy / p.w, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias + }; + default: + return texture(sampler, p.xy / p.w, bias); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2295,7 +2445,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler3D<vector<T,N>> sampler, vec4 p) { - return texture(sampler, p.xyz / p.w); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p + }; + default: + return texture(sampler, p.xyz / p.w); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2303,35 +2462,100 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProj(Sampler3D<vector<T,N>> sampler, vec4 p, float bias) { - return texture(sampler, p.xyz / p.w, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p Bias $bias + }; + default: + return texture(sampler, p.xyz / p.w, bias); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProj(sampler1DShadow sampler, vec4 p) { - return texture(sampler, p.xyz / p.w); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xw__ $compareValue + }; + } + default: + return texture(sampler, p.xyz / p.w); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProj(sampler1DShadow sampler, vec4 p, float bias) { - return texture(sampler, p.xyz / p.w, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xw__ $compareValue Bias $bias + }; + } + default: + return texture(sampler, p.xyz / p.w, bias); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProj(sampler2DShadow sampler, vec4 p) { - return texture(sampler, p.xyz / p.w); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xyw_ $compareValue + }; + } + default: + return texture(sampler, p.xyz / p.w); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProj(sampler2DShadow sampler, vec4 p, float bias) { - return texture(sampler, p.xyz / p.w, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProj"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xyw_ $compareValue Bias $bias + }; + } + default: + return texture(sampler, p.xyz / p.w, bias); + } } // ------------------- @@ -2368,24 +2592,60 @@ public vector<T,4> textureLod(__TextureImpl< [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureLod(sampler2DShadow sampler, vec3 p, float lod) { - // TODO: Need to apply lod - return sampler.SampleCmp(p.xy, p.z); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureLod"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Lod $lod + }; + } + default: + return sampler.SampleCmp(p.xy, p.z); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureLod(sampler1DShadow sampler, vec3 p, float lod) { - // TODO: Need to apply lod - return sampler.SampleCmp(p.x, p.z); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureLod"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Lod $lod + }; + } + default: + return sampler.SampleCmp(p.x, p.z); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureLod(sampler1DArrayShadow sampler, vec3 p, float lod) { - // TODO: Need to apply lod - return sampler.SampleCmp(p.xy, p.z); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureLod"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Lod $lod + }; + } + default: + return sampler.SampleCmp(p.xy, p.z); + } } // ------------------- @@ -2420,16 +2680,66 @@ public vector<T,4> textureOffset(Sampler3D<vector<T,N>> sampler, vec3 p, constex [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureOffset(sampler2DShadow sampler, vec3 p, constexpr ivec2 offset, float bias = 0.0) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.xy, p.z, offset); + vec2 location = p.xy; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureOffset"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias|ConstOffset $bias $offset; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue, offset); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] -public float textureOffset(sampler1DShadow sampler, vec3 p, constexpr int offset, float bias = 0.0) +public float textureOffset(sampler1DShadow sampler, vec3 p, constexpr int offset) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.x, p.z, offset); + float location = p.x; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureOffset"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue ConstOffset $offset; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue, offset); + } +} + +[ForceInline] +[require(glsl_hlsl_spirv, texture_shadowlod)] +public float textureOffset(sampler1DShadow sampler, vec3 p, constexpr int offset, float bias) +{ + float location = p.x; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureOffset"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias|ConstOffset $bias $offset; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2450,10 +2760,46 @@ public vector<T,4> textureOffset(Sampler2DArray<vector<T,N>> sampler, vec3 p, co [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] -public float textureOffset(sampler1DArrayShadow sampler, vec3 p, constexpr int offset, float bias = 0.0) +public float textureOffset(sampler1DArrayShadow sampler, vec3 p, constexpr int offset) { - // TODO: Need to apply bias - return sampler.SampleCmp(p.xy, p.z, vector<int,1>(offset)); + vec2 location = p.xy; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureOffset"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue ConstOffset $offset; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue, vector<int,1>(offset)); + } +} + +[ForceInline] +[require(glsl_hlsl_spirv, texture_shadowlod)] +public float textureOffset(sampler1DArrayShadow sampler, vec3 p, constexpr int offset, float bias) +{ + vec2 location = p.xy; + float compareValue = p.z; + + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureOffset"; + case spirv: + return spirv_asm + { + result:$$float = OpImageSampleDrefImplicitLod $sampler $location $compareValue Bias|ConstOffset $bias $offset; + }; + default: + // TODO: Need to apply bias + return sampler.SampleCmp(location, compareValue, vector<int,1>(offset)); + } } [ForceInline] @@ -2524,7 +2870,13 @@ public vector<T,4> texelFetch(__TextureImpl< format > sampler, vector<int,2+isArray> p, int lod) { - return __vectorReshape<4>(sampler.Load(p, lod)); + __target_switch + { + case glsl: __intrinsic_asm "texelFetch"; + default: + // TODO: Need to apply lod + return __vectorReshape<4>(sampler.Load(__makeVector(p, 0))); + } } // ------------------- @@ -2536,43 +2888,25 @@ __generic<T:__BuiltinArithmeticType, let N:int> [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) { - return texelFetch(sampler, p + offset, lod); + return __vectorReshape<4>(sampler.Load(int2(p, lod), offset)); } -__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let sampleCount:int, let format:int> -[ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_samplerless)] -public vector<T,4> texelFetchOffset(__TextureImpl< - vector<T,N>, - Shape, - 0, // isArray - 0, // isMS - sampleCount, - 0, // access - 0, // isShadow - 1, // isCombined - format - > sampler, vector<int,Shape.dimensions> p, int lod, constexpr vector<int,Shape.dimensions> offset) -{ - return texelFetch(sampler, p + offset, lod); -} - -__generic<T:__BuiltinArithmeticType, let N:int, Shape:__ITextureShape, let sampleCount:int, let format:int> +__generic<T:__BuiltinArithmeticType, let N:int, 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(__TextureImpl< vector<T,N>, Shape, - 1, // isArray + isArray, 0, // isMS sampleCount, 0, // access 0, // isShadow 1, // isCombined format - > sampler, vector<int,Shape.dimensions+1> p, int lod, constexpr vector<int,Shape.dimensions> offset) + > sampler, vector<int,Shape.dimensions+isArray> p, int lod, constexpr vector<int,Shape.planeDimensions> offset) { - return texelFetch(sampler, p + __makeVector(offset,0), lod); + return __vectorReshape<4>(sampler.Load(__makeVector(p,lod), offset)); } __generic<T:__BuiltinArithmeticType, let N:int> @@ -2580,7 +2914,7 @@ __generic<T:__BuiltinArithmeticType, let N:int> [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) { - return texelFetch(sampler, p + offset); + return __vectorReshape<4>(sampler.Load(__makeVector(p, 0), offset)); } // ------------------- @@ -2590,55 +2924,271 @@ public vector<T,4> texelFetchOffset(Sampler2DRect<vector<T,N>> sampler, ivec2 p, __generic<T:__BuiltinFloatingPointType, let N:int> [ForceInline] [require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] -public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec2 p, constexpr int offset, float bias = 0.0) +public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec2 p, constexpr int offset) { - return textureOffset(sampler, p.x / p.y, offset, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset + }; + default: + return textureOffset(sampler, p.x / p.y, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> [ForceInline] [require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] -public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, constexpr int offset, float bias = 0.0) +public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec2 p, constexpr int offset, float bias) { - return textureOffset(sampler, p.x / p.w, offset, 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 + }; + default: + return textureOffset(sampler, p.x / p.y, offset, bias); + } } __generic<T:__BuiltinFloatingPointType, let N:int> [ForceInline] [require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] -public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec3 p, constexpr ivec2 offset, float bias = 0.0) +public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, constexpr int offset) { - return textureOffset(sampler, p.xy / p.z, offset, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xw__ ConstOffset $offset + }; + } + default: + return textureOffset(sampler, p.x / p.w, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> [ForceInline] [require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] -public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, constexpr ivec2 offset, float bias = 0.0) +public vector<T,4> textureProjOffset(Sampler1D<vector<T,N>> sampler, vec4 p, constexpr int offset, float bias) { - return textureOffset(sampler, p.xy / p.w, offset, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xw__ Bias|ConstOffset $bias $offset + }; + } + default: + return textureOffset(sampler, p.x / p.w, offset, bias); + } } __generic<T:__BuiltinFloatingPointType, let N:int> [ForceInline] [require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] -public vector<T,4> textureProjOffset(Sampler3D<vector<T,N>> sampler, vec4 p, constexpr ivec3 offset, float bias = 0.0) +public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec3 p, constexpr ivec2 offset) { - return textureOffset(sampler, p.xyz / p.w, offset, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $p ConstOffset $offset + }; + default: + return textureOffset(sampler, p.xy / p.z, offset); + } +} + +__generic<T:__BuiltinFloatingPointType, let N:int> +[ForceInline] +[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] +public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> 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 + }; + default: + return textureOffset(sampler, p.xy / p.z, offset, bias); + } +} + +__generic<T:__BuiltinFloatingPointType, let N:int> +[ForceInline] +[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] +public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, constexpr ivec2 offset) +{ + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + vec4 xyw__ = p.xyww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xyw__ ConstOffset $offset + }; + } + default: + return textureOffset(sampler, p.xy / p.w, offset); + } +} + +__generic<T:__BuiltinFloatingPointType, let N:int> +[ForceInline] +[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] +public vector<T,4> textureProjOffset(Sampler2D<vector<T,N>> sampler, vec4 p, constexpr ivec2 offset, float bias) +{ + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjImplicitLod $sampler $xyw_ Bias|ConstOffset $bias $offset + }; + } + default: + return textureOffset(sampler, p.xy / p.w, offset, bias); + } +} + +__generic<T:__BuiltinFloatingPointType, let N:int> +[ForceInline] +[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] +public vector<T,4> textureProjOffset(Sampler3D<vector<T,N>> 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 + }; + default: + return textureOffset(sampler, p.xyz / p.w, offset); + } +} + +__generic<T:__BuiltinFloatingPointType, let N:int> +[ForceInline] +[require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] +public vector<T,4> textureProjOffset(Sampler3D<vector<T,N>> 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 + }; + default: + return textureOffset(sampler, p.xyz / p.w, offset, bias); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] -public float textureProjOffset(sampler1DShadow sampler, vec4 p, constexpr int offset, float bias = 0.0) +public float textureProjOffset(sampler1DShadow sampler, vec4 p, constexpr int offset) { - return textureOffset(sampler, p.xyz / p.w, offset, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xw__ $compareValue ConstOffset $offset + }; + } + default: + return textureOffset(sampler, p.xyz / p.w, offset); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] -public float textureProjOffset(sampler2DShadow sampler, vec4 p, constexpr ivec2 offset, float bias = 0.0) +public float textureProjOffset(sampler1DShadow sampler, vec4 p, constexpr int offset, float bias) { - return textureOffset(sampler, p.xyz / p.w, offset, bias); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xw__ $compareValue Bias|ConstOffset $bias $offset + }; + } + default: + return textureOffset(sampler, p.xyz / p.w, offset, bias); + } +} + +[ForceInline] +[require(glsl_hlsl_spirv, texture_shadowlod)] +public float textureProjOffset(sampler2DShadow sampler, vec4 p, constexpr ivec2 offset) +{ + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xyw_ $compareValue ConstOffset $offset + }; + } + default: + return textureOffset(sampler, p.xyz / p.w, offset); + } +} + +[ForceInline] +[require(glsl_hlsl_spirv, texture_shadowlod)] +public float textureProjOffset(sampler2DShadow sampler, vec4 p, constexpr ivec2 offset, float bias) +{ + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefImplicitLod $sampler $xyw_ $compareValue Bias|ConstOffset $bias $offset + }; + } + default: + return textureOffset(sampler, p.xyz / p.w, offset, bias); + } } // ------------------- @@ -2675,24 +3225,63 @@ public vector<T,4> textureLodOffset(__TextureImpl< [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureLodOffset(sampler1DShadow sampler, vec3 p, float lod, constexpr int offset) { - // TODO: Need to apply lod - return sampler.SampleCmpLevelZero(p.x, p.z, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureLodOffset"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Lod|ConstOffset $lod $offset + }; + } + default: + // TODO: Need to apply lod + return sampler.SampleCmpLevelZero(p.x, p.z, offset); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureLodOffset(sampler2DShadow sampler, vec3 p, float lod, constexpr ivec2 offset) { - // TODO: Need to apply lod - return sampler.SampleCmpLevelZero(p.xy, p.z, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureLodOffset"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Lod|ConstOffset $lod $offset + }; + } + default: + // TODO: Need to apply lod + return sampler.SampleCmpLevelZero(p.xy, p.z, offset); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureLodOffset(sampler1DArrayShadow sampler, vec3 p, float lod, constexpr int offset) { - // TODO: Need to apply lod - return sampler.SampleCmpLevelZero(p.xy, p.z, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureLodOffset"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Lod|ConstOffset $lod $offset + }; + } + default: + // TODO: Need to apply lod + return sampler.SampleCmpLevelZero(p.xy, p.z, offset); + } } // ------------------- @@ -2704,7 +3293,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLod(Sampler1D<vector<T,N>> sampler, vec2 p, float lod) { - return textureLod(sampler, p.x / p.y, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod + }; + default: + return textureLod(sampler, p.x / p.y, lod); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2712,7 +3310,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLod(Sampler1D<vector<T,N>> sampler, vec4 p, float lod) { - return textureLod(sampler, p.x / p.w, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: + { + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Lod $lod + }; + } + default: + return textureLod(sampler, p.x / p.w, lod); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2720,7 +3331,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLod(Sampler2D<vector<T,N>> sampler, vec3 p, float lod) { - return textureLod(sampler, p.xy / p.z, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod + }; + default: + return textureLod(sampler, p.xy / p.z, lod); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2728,7 +3348,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLod(Sampler2D<vector<T,N>> sampler, vec4 p, float lod) { - return textureLod(sampler, p.xy / p.w, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: + { + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Lod $lod + }; + } + default: + return textureLod(sampler, p.xy / p.w, lod); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2736,21 +3369,58 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(cpp_cuda_glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLod(Sampler3D<vector<T,N>> sampler, vec4 p, float lod) { - return textureLod(sampler, p.xyz / p.w, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod $lod + }; + default: + return textureLod(sampler, p.xyz / p.w, lod); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProjLod(sampler1DShadow sampler, vec4 p, float lod) { - return textureLod(sampler, p.xyz / p.w, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xw__ $compareValue Lod $lod + }; + } + default: + return textureLod(sampler, p.xyz / p.w, lod); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProjLod(sampler2DShadow sampler, vec4 p, float lod) { - return textureLod(sampler, p.xyz / p.w, lod); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLod"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xyw_ $compareValue Lod $lod + }; + } + default: + return textureLod(sampler, p.xyz / p.w, lod); + } } // ------------------- @@ -2762,7 +3432,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLodOffset(Sampler1D<vector<T,N>> sampler, vec2 p, float lod, constexpr int offset) { - return textureLodOffset(sampler, p.x / p.y, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset + }; + default: + return textureLodOffset(sampler, p.x / p.y, lod, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2770,7 +3449,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLodOffset(Sampler1D<vector<T,N>> sampler, vec4 p, float lod, constexpr int offset) { - return textureLodOffset(sampler, p.x / p.w, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: + { + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Lod|ConstOffset $lod $offset + }; + } + default: + return textureLodOffset(sampler, p.x / p.w, lod, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2778,7 +3470,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLodOffset(Sampler2D<vector<T,N>> sampler, vec3 p, float lod, constexpr ivec2 offset) { - return textureLodOffset(sampler, p.xy / p.z, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset + }; + default: + return textureLodOffset(sampler, p.xy / p.z, lod, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2786,7 +3487,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLodOffset(Sampler2D<vector<T,N>> sampler, vec4 p, float lod, constexpr ivec2 offset) { - return textureLodOffset(sampler, p.xy / p.w, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: + { + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Lod|ConstOffset $lod $offset + }; + } + default: + return textureLodOffset(sampler, p.xy / p.w, lod, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2794,21 +3508,58 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [require(glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vector<T,4> textureProjLodOffset(Sampler3D<vector<T,N>> sampler, vec4 p, float lod, constexpr ivec3 offset) { - return textureLodOffset(sampler, p.xyz / p.w, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Lod|ConstOffset $lod $offset + }; + default: + return textureLodOffset(sampler, p.xyz / p.w, lod, offset); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProjLodOffset(sampler1DShadow sampler, vec4 p, float lod, constexpr int offset) { - return textureLodOffset(sampler, p.xyz / p.w, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xw__ $compareValue Lod|ConstOffset $lod $offset + }; + } + default: + return textureLodOffset(sampler, p.xyz / p.w, lod, offset); + } } [ForceInline] [require(glsl_hlsl_spirv, texture_shadowlod)] public float textureProjLodOffset(sampler2DShadow sampler, vec4 p, float lod, constexpr ivec2 offset) { - return textureLodOffset(sampler, p.xyz / p.w, lod, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjLodOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xyw_ $compareValue Lod|ConstOffset $lod $offset + }; + } + default: + return textureLodOffset(sampler, p.xyz / p.w, lod, offset); + } } // ------------------- @@ -2843,43 +3594,93 @@ public vector<T,4> textureGrad(__TextureImpl< } [ForceInline] -[require(cpp_cuda_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGrad(sampler1DShadow sampler, vec3 p, float dPdx, float dPdy) { - // TODO: Not implemented - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGrad"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad $dPdx $dPdy + }; + } + } } [ForceInline] -[require(cpp_cuda_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGrad(sampler1DArrayShadow sampler, vec3 p, float dPdx, float dPdy) { - // TODO: Not implemented - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGrad"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad $dPdx $dPdy + }; + } + } } [ForceInline] -[require(cpp_cuda_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGrad(sampler2DShadow sampler, vec3 p, vec2 dPdx, vec2 dPdy) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGrad"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad $dPdx $dPdy + }; + } + } } [ForceInline] -[require(cpp_cuda_glsl_hlsl_spirv, texture_shadowlod_cube)] +[require(glsl_spirv, texture_shadowlod_cube)] public float textureGrad(samplerCubeShadow sampler, vec4 p, vec3 dPdx, vec3 dPdy) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGrad"; + case spirv: + { + float compareValue = p.w; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad $dPdx $dPdy + }; + } + } } [ForceInline] -[require(cpp_cuda_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGrad(sampler2DArrayShadow sampler, vec4 p, vec2 dPdx, vec2 dPdy) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGrad"; + case spirv: + { + float compareValue = p.w; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad $dPdx $dPdy + }; + } + } } // ------------------- @@ -2913,35 +3714,75 @@ public vector<T,4> textureGradOffset(__TextureImpl< } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGradOffset(sampler1DShadow sampler, vec3 p, float dPdx, float dPdy, constexpr int offset) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGradOffset"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad|ConstOffset $dPdx $dPdy $offset + }; + } + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGradOffset(sampler2DShadow sampler, vec3 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGradOffset"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad|ConstOffset $dPdx $dPdy $offset + }; + } + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGradOffset(sampler1DArrayShadow sampler, vec3 p, float dPdx, float dPdy, constexpr int offset) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGradOffset"; + case spirv: + { + float compareValue = p.z; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad|ConstOffset $dPdx $dPdy $offset + }; + } + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureGradOffset(sampler2DArrayShadow sampler, vec4 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset) { - // TODO: Not implemented on HLSL side yet. - return 0; + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureGradOffset"; + case spirv: + { + float compareValue = p.w; + return spirv_asm { + result:$$float = OpImageSampleDrefExplicitLod $sampler $p $compareValue Grad|ConstOffset $dPdx $dPdy $offset + }; + } + } } // ------------------- @@ -2953,7 +3794,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGrad(sampler, p.x / p.y, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy + }; + default: + return textureGrad(sampler, p.x / p.y, dPdx, dPdy); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2961,7 +3811,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGrad(sampler, p.x / p.w, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: + { + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Grad $dPdx $dPdy + }; + } + default: + return textureGrad(sampler, p.x / p.w, dPdx, dPdy); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2969,7 +3832,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGrad(sampler, p.xy / p.z, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy + }; + default: + return textureGrad(sampler, p.xy / p.z, dPdx, dPdy); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2977,7 +3849,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGrad(sampler, p.xy / p.w, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: + { + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Grad $dPdx $dPdy + }; + } + default: + return textureGrad(sampler, p.xy / p.w, dPdx, dPdy); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -2985,21 +3870,58 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad $dPdx $dPdy + }; + default: + return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy); + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureProjGrad(sampler1DShadow sampler, vec4 p, float dPdx, float dPdy) { - return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xw__ $compareValue Grad $dPdx $dPdy + }; + } + default: + return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy); + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureProjGrad(sampler2DShadow sampler, vec4 p, vec2 dPdx, vec2 dPdy) { - return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGrad"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xyw_ $compareValue Grad $dPdx $dPdy + }; + } + default: + return textureGrad(sampler, p.xyz / p.w, dPdx, dPdy); + } } // ------------------- @@ -3011,7 +3933,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGradOffset(sampler, p.x / p.y, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset + }; + default: + return textureGradOffset(sampler, p.x / p.y, dPdx, dPdy, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -3019,7 +3950,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGradOffset(sampler, p.x / p.w, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: + { + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xw__ Grad|ConstOffset $dPdx $dPdy $offset + }; + } + default: + return textureGradOffset(sampler, p.x / p.w, dPdx, dPdy, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -3027,7 +3971,16 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGradOffset(sampler, p.xy / p.z, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset + }; + default: + return textureGradOffset(sampler, p.xy / p.z, dPdx, dPdy, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -3035,7 +3988,20 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGradOffset(sampler, p.xy / p.w, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: + { + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $xyw_ Grad|ConstOffset $dPdx $dPdy $offset + }; + } + default: + return textureGradOffset(sampler, p.xy / p.w, dPdx, dPdy, offset); + } } __generic<T:__BuiltinFloatingPointType, let N:int> @@ -3043,21 +4009,58 @@ __generic<T:__BuiltinFloatingPointType, let N:int> [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) { - return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: return spirv_asm { + result:$$vector<T,4> = OpImageSampleProjExplicitLod $sampler $p Grad|ConstOffset $dPdx $dPdy $offset + }; + default: + return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset); + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureProjGradOffset(sampler1DShadow sampler, vec4 p, float dPdx, float dPdy, constexpr int offset) { - return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xw__ = p.xwww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xw__ $compareValue Grad|ConstOffset $dPdx $dPdy $offset + }; + } + default: + return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset); + } } [ForceInline] -[require(cpp_glsl_hlsl_spirv, texture_shadowlod)] +[require(glsl_spirv, texture_shadowlod)] public float textureProjGradOffset(sampler2DShadow sampler, vec4 p, vec2 dPdx, vec2 dPdy, constexpr ivec2 offset) { - return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset); + __requireComputeDerivative(); + __target_switch + { + case glsl: __intrinsic_asm "textureProjGradOffset"; + case spirv: + { + float compareValue = p.z; + vec4 xyw_ = p.xyww; + return spirv_asm { + result:$$float = OpImageSampleProjDrefExplicitLod $sampler $xyw_ $compareValue Grad|ConstOffset $dPdx $dPdy $offset + }; + } + default: + return textureGradOffset(sampler, p.xyz / p.w, dPdx, dPdy, offset); + } } // @@ -3205,6 +4208,10 @@ public vec4 textureGatherOffsets(__TextureImpl< // // Section 8.9.5. Compatibility Profile Texture Functions // +// Note: the following functions exist for GLSL but not for SPIR-V. +// If we use `case glsl: __intrinsic_asm "XXX";`, it will cause an +// error when we try to translate the GLSL to SPIR-V. +// So we cannot use them. [require(cpp_glsl_hlsl_spirv, texture_sm_4_1_fragment)] public vec4 texture1D(sampler1D sampler, float coord) diff --git a/tests/glsl-intrinsic/intrinsic-texture.slang b/tests/glsl-intrinsic/intrinsic-texture.slang index a136ca1da..5e79ef2c0 100644 --- a/tests/glsl-intrinsic/intrinsic-texture.slang +++ b/tests/glsl-intrinsic/intrinsic-texture.slang @@ -1,25 +1,15 @@ #version 450 core #extension GL_EXT_texture_shadow_lod : enable -//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl -DCOMPUTE -//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage fragment -entry computeMain -target glsl -//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage fragment -entry computeMain -target spirv -emit-spirv-via-glsl -//TEST:SIMPLE(filecheck=CHECK_SPV_DIRECT): -allow-glsl -stage compute -entry computeMain -target spirv -DCOMPUTE -//TEST:SIMPLE(filecheck=CHECK_SPV_DIRECT): -allow-glsl -stage fragment -entry computeMain -target spirv -//TEST:SIMPLE(filecheck=CHECK_CUDA): -allow-glsl -stage compute -entry computeMain -target cuda -DCOMPUTE -//TEST:SIMPLE(filecheck=CHECK_CUDA): -allow-glsl -stage fragment -entry computeMain -target cuda - -// Disabling following targets because they are currently causing compile errors. -//DISABLE_TEST:SIMPLE(filecheck=CHECK_HLSL): -allow-glsl -stage compute -entry computeMain -target hlsl -DCOMPUTE -//DISABLE_TEST:SIMPLE(filecheck=CHECK_CPP): -allow-glsl -stage compute -entry computeMain -target cpp -DCOMPUTE - -// It appears that CUDA doesn't have implementations for multisampling samplers. -// When targetting glsl and spirv, the DEBUG build of slangc encounters issues with "Array" variant -// of multisampling samplers: sampler2DMSArray, isampler2DMSArray and usampler2DMSArray. -//#define TEST_when_multisampling_works - -//RWStructuredBuffer<float> outputBuffer; -//layout(location = 0) out vec4 o_color; +//TEST:SIMPLE(filecheck=HLSL): -allow-glsl -stage compute -entry computeMain -target hlsl -DCOMPUTE +//TEST:SIMPLE(filecheck=HLSL): -allow-glsl -stage fragment -entry computeMain -target hlsl +//TEST:SIMPLE(filecheck=GLSL): -allow-glsl -stage compute -entry computeMain -target glsl -DCOMPUTE +//TEST:SIMPLE(filecheck=GLSL): -allow-glsl -stage fragment -entry computeMain -target glsl +//TEST:SIMPLE(filecheck=SPIR): -allow-glsl -stage fragment -entry computeMain -target spirv -emit-spirv-via-glsl +//TEST:SIMPLE(filecheck=SPIR): -allow-glsl -stage compute -entry computeMain -target spirv -DCOMPUTE +//TEST:SIMPLE(filecheck=SPIR): -allow-glsl -stage fragment -entry computeMain -target spirv +//TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage compute -entry computeMain -target cuda -DCOMPUTE +//TEST:SIMPLE(filecheck=CUDA): -allow-glsl -stage fragment -entry computeMain -target cuda buffer MyBlockName { @@ -44,10 +34,8 @@ uniform sampler1DArray uniform_sampler1DArray; uniform sampler2DArray uniform_sampler2DArray; uniform samplerCubeArray uniform_samplerCubeArray; uniform samplerBuffer uniform_samplerBuffer; -#if defined(TEST_when_multisampling_works) uniform sampler2DMS uniform_sampler2DMS; uniform sampler2DMSArray uniform_sampler2DMSArray; -#endif // #if defined(TEST_when_multisampling_works) uniform isampler1D uniform_isampler1D; uniform isampler2D uniform_isampler2D; @@ -58,10 +46,8 @@ uniform isampler1DArray uniform_isampler1DArray; uniform isampler2DArray uniform_isampler2DArray; uniform isamplerCubeArray uniform_isamplerCubeArray; uniform isamplerBuffer uniform_isamplerBuffer; -#if defined(TEST_when_multisampling_works) uniform isampler2DMS uniform_isampler2DMS; uniform isampler2DMSArray uniform_isampler2DMSArray; -#endif // #if defined(TEST_when_multisampling_works) uniform usampler1D uniform_usampler1D; uniform usampler2D uniform_usampler2D; @@ -72,10 +58,8 @@ uniform usampler1DArray uniform_usampler1DArray; uniform usampler2DArray uniform_usampler2DArray; uniform usamplerCubeArray uniform_usamplerCubeArray; uniform usamplerBuffer uniform_usamplerBuffer; -#if defined(TEST_when_multisampling_works) uniform usampler2DMS uniform_usampler2DMS; uniform usampler2DMSArray uniform_usampler2DMSArray; -#endif // #if defined(TEST_when_multisampling_works) __generic<T : __BuiltinFloatingPointType, let N : int> bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D @@ -87,280 +71,1234 @@ bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D , Sampler2DArray<vector<T,N>> gsampler2DArray , SamplerCubeArray<vector<T,N>> gsamplerCubeArray , SamplerBuffer<vector<T,N>> gsamplerBuffer -#if defined(TEST_when_multisampling_works) , Sampler2DMS<vector<T,N>> gsampler2DMS , Sampler2DMSArray<vector<T,N>> gsampler2DMSArray -#endif // #if defined(TEST_when_multisampling_works) ) { + // GLSL-LABEL: textureFuncs_0 typealias gvec4 = vector<T,4>; - constexpr ivec2 ivec2_0 = ivec2(0); + constexpr ivec2 offset2D = ivec2(0); + constexpr ivec3 offset3D = ivec3(0); + constexpr ivec2 offsets[4] = { ivec2(0), ivec2(0), ivec2(0), ivec2(0) }; return true // 8.9.1. Texture Query Functions + + // GLSL: textureSize({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && int(0) == textureSize(gsampler1D, int(0)) + + // GLSL: textureSize({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(gsampler2D, int(0)) + + // GLSL: textureSize({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec3(0) == textureSize(gsampler3D, int(0)) + + // GLSL: textureSize({{.*}}samplerCube + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(gsamplerCube, int(0)) + + // GLSL: textureSize({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && int(0) == textureSize(uniform_sampler1DShadow, int(0)) + + // GLSL: textureSize({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(uniform_sampler2DShadow, int(0)) + + // GLSL: textureSize({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(uniform_samplerCubeShadow, int(0)) + + // GLSL: textureSize({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec3(0) == textureSize(gsamplerCubeArray, int(0)) + + // GLSL: textureSize({{.*}}samplerCubeArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArrayShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec3(0) == textureSize(uniform_samplerCubeArrayShadow, int(0)) + + // GLSL: textureSize({{.*}}sampler2DRect + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(gsampler2DRect) + + // GLSL: textureSize({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(uniform_sampler2DRectShadow) + + // GLSL: textureSize({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(gsampler1DArray, int(0)) + + // GLSL: textureSize({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(uniform_sampler1DArrayShadow, int(0)) + + // GLSL: textureSize({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec3(0) == textureSize(gsampler2DArray, int(0)) + + // GLSL: textureSize({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec3(0) == textureSize(uniform_sampler2DArrayShadow, int(0)) + + // GLSL: imageSize({{.*}}samplerBuffer + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerBuffer + // SPIR: OpImageQuerySize{{.*}}[[LOAD]] && int(0) == textureSize(gsamplerBuffer) -#if defined(TEST_when_multisampling_works) + + // GLSL: textureSize({{.*}}sampler2DMS + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DMS + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec2(0) == textureSize(gsampler2DMS) + + // GLSL: textureSize({{.*}}sampler2DMSArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DMSArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySize{{.*}}[[IMAGE]] && ivec3(0) == textureSize(gsampler2DMSArray) -#endif // #if defined(TEST_when_multisampling_works) + + // GLSL: textureQueryLod({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsampler1D, float(0)) + + // GLSL: textureQueryLod({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsampler2D, vec2(0)) + + // GLSL: textureQueryLod({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsampler3D, vec3(0)) + + // GLSL: textureQueryLod({{.*}}samplerCube + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsamplerCube, vec3(0)) + + // GLSL: textureQueryLod({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsampler1DArray, float(0)) + + // GLSL: textureQueryLod({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsampler2DArray, vec2(0)) + + // GLSL: textureQueryLod({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(gsamplerCubeArray, vec3(0)) + + // GLSL: textureQueryLod({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(uniform_sampler1DShadow, float(0)) + + // GLSL: textureQueryLod({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(uniform_sampler2DShadow, vec2(0)) + + // GLSL: textureQueryLod({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(uniform_samplerCubeShadow, vec3(0)) + + // GLSL: textureQueryLod({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(uniform_sampler1DArrayShadow, float(0)) + + // GLSL: textureQueryLod({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(uniform_sampler2DArrayShadow, vec2(0)) + + // GLSL: textureQueryLod({{.*}}samplerCubeArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArrayShadow + // SPIR: OpImageQueryLod{{.*}}[[LOAD]] && vec2(0) == textureQueryLod(uniform_samplerCubeArrayShadow, vec3(0)) + + // GLSL: textureQueryLevels({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsampler1D) + + // GLSL: textureQueryLevels({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsampler2D) + + // GLSL: textureQueryLevels({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsampler3D) + + // GLSL: textureQueryLevels({{.*}}samplerCube + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsamplerCube) + + // GLSL: textureQueryLevels({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsampler1DArray) + + // GLSL: textureQueryLevels({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsampler2DArray) + + // GLSL: textureQueryLevels({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(gsamplerCubeArray) + + // GLSL: textureQueryLevels({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(uniform_sampler1DShadow) + + // GLSL: textureQueryLevels({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(uniform_sampler2DShadow) + + // GLSL: textureQueryLevels({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(uniform_samplerCubeShadow) + + // GLSL: textureQueryLevels({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(uniform_sampler1DArrayShadow) + + // GLSL: textureQueryLevels({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(uniform_sampler2DArrayShadow) + + // GLSL: textureQueryLevels({{.*}}samplerCubeArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArrayShadow + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQueryLevels{{.*}}[[IMAGE]] && int(0) == textureQueryLevels(uniform_samplerCubeArrayShadow) -#if defined(TEST_when_multisampling_works) + + // GLSL: textureSamples({{.*}}sampler2DMS + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DMS + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySamples{{.*}}[[IMAGE]] && int(0) == textureSamples(gsampler2DMS) + + // GLSL: textureSamples({{.*}}sampler2DMSArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DMSArray + // SPIR: [[IMAGE:%[1-9][0-9]*]] = OpImage{{.*}}[[LOAD]] + // SPIR: OpImageQuerySamples{{.*}}[[IMAGE]] && int(0) == textureSamples(gsampler2DMSArray) -#endif // #if defined(TEST_when_multisampling_works) // 8.9.2. Texel Lookup Functions + + // GLSL: texture({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsampler1D, float(0)) + + // GLSL: texture({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsampler1D, float(0), float(0)) + + // GLSL: texture({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsampler2D, vec2(0)) + + // GLSL: texture({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsampler2D, vec2(0), float(0)) + + // GLSL: texture({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsampler3D, vec3(0)) + + // GLSL: texture({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsampler3D, vec3(0), float(0)) + + // GLSL: texture({{.*}}samplerCube + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsamplerCube, vec3(0) ) + + // GLSL: texture({{.*}}samplerCube + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsamplerCube, vec3(0), float(0)) + + // GLSL: texture({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_sampler1DShadow, vec3(0)) + + // GLSL: texture({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && float(0) == texture(uniform_sampler1DShadow, vec3(0), float(0)) + + // GLSL: texture({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_sampler2DShadow, vec3(0)) + + // GLSL: texture({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && float(0) == texture(uniform_sampler2DShadow, vec3(0), float(0)) + + // GLSL: texture({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_samplerCubeShadow, vec4(0)) + + // GLSL: texture({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && float(0) == texture(uniform_samplerCubeShadow, vec4(0), float(0)) + + // GLSL: texture({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsampler2DArray, vec3(0)) + + // GLSL: texture({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsampler2DArray, vec3(0), float(0)) + + // GLSL: texture({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(0) ) + + // GLSL: texture({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(0), float(0)) + + // GLSL: texture({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsampler1DArray, vec2(0)) + + // GLSL: texture({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == texture(gsampler1DArray, vec2(0), float(0)) + + // GLSL: texture({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_sampler1DArrayShadow, vec3(0)) + + // GLSL: texture({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]]{{.*}} Bias % && float(0) == texture(uniform_sampler1DArrayShadow, vec3(0), float(0)) + + // GLSL: texture({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_sampler2DArrayShadow, vec4(0)) + + // GLSL: texture({{.*}}sampler2DRect + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect + // SPIR: OpImageSampleImplicitLod{{.*}}[[LOAD]] && gvec4(T(0)) == texture(gsampler2DRect, vec2(0)) + + // GLSL: texture({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_sampler2DRectShadow, vec3(0)) + + // GLSL: texture({{.*}}samplerCubeArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArrayShadow + // SPIR: OpImageSampleDrefImplicitLod{{.*}}[[LOAD]] && float(0) == texture(uniform_samplerCubeArrayShadow, vec4(0), float(0)) + + // GLSL: textureProj({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] && gvec4(T(0)) == textureProj(gsampler1D, vec2(0)) + + // GLSL: textureProj({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == textureProj(gsampler1D, vec2(0), float(0)) + + // GLSL: textureProj({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] && gvec4(T(0)) == textureProj(gsampler1D, vec4(0)) + + // GLSL: textureProj({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == textureProj(gsampler1D, vec4(0), float(0)) + + // GLSL: textureProj({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] && gvec4(T(0)) == textureProj(gsampler2D, vec3(0)) + + // GLSL: textureProj({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == textureProj(gsampler2D, vec3(0), float(0)) + + // GLSL: textureProj({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] && gvec4(T(0)) == textureProj(gsampler2D, vec4(0)) + + // GLSL: textureProj({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == textureProj(gsampler2D, vec4(0), float(0)) + + // GLSL: textureProj({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] && gvec4(T(0)) == textureProj(gsampler3D, vec4(0)) + + // GLSL: textureProj({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && gvec4(T(0)) == textureProj(gsampler3D, vec4(0), float(0)) + + // GLSL: textureProj({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]] && float(0) == textureProj(uniform_sampler1DShadow, vec4(0)) + + // GLSL: textureProj({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && float(0) == textureProj(uniform_sampler1DShadow, vec4(0), float(0)) + + // GLSL: textureProj({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]] && float(0) == textureProj(uniform_sampler2DShadow, vec4(0)) + + // GLSL: textureProj({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias % && float(0) == textureProj(uniform_sampler2DShadow, vec4(0), float(0)) + + // GLSL-COUNT-2: textureProj({{.*}}sampler2DRect + // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]] && gvec4(T(0)) == textureProj(gsampler2DRect, vec3(0)) && gvec4(T(0)) == textureProj(gsampler2DRect, vec4(0)) + + // GLSL: textureProj({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]] && float(0) == textureProj(uniform_sampler2DRectShadow, vec4(0)) + + // GLSL: textureLod({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureLod(gsampler1D, float(0), float(0)) + + // GLSL: textureLod({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureLod(gsampler2D, vec2(0), float(0)) + + // GLSL: textureLod({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureLod(gsampler3D, vec3(0), float(0)) + + // GLSL: textureLod({{.*}}samplerCube + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCube + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureLod(gsamplerCube, vec3(0), float(0)) + + // GLSL: textureLod({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && float(0) == textureLod(uniform_sampler2DShadow, vec3(0), float(0)) + + // GLSL: textureLod({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && float(0) == textureLod(uniform_sampler1DShadow, vec3(0), float(0)) + + // GLSL: textureLod({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureLod(gsampler1DArray, vec2(0), float(0)) + + // GLSL: textureLod({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && float(0) == textureLod(uniform_sampler1DArrayShadow, vec3(0), float(0)) + + // GLSL: textureLod({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureLod(gsampler2DArray, vec3(0), float(0)) + + // GLSL: textureLod({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && 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)) - && 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__ }) - && 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)) - && 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__ }) + + // GLSL: textureOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // S-PIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler1D, float(0), int(0)) + + // GLSL: textureOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler1D, float(0), int(0), float(0)) + + // GLSL: textureOffset({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // S-PIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler2D, vec2(0), offset2D) + + // GLSL: textureOffset({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler2D, vec2(0), offset2D, float(0)) + + // GLSL: textureOffset({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // S-PIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler3D, vec3(0), offset3D) + + // GLSL: textureOffset({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler3D, vec3(0), offset3D, float(0)) + + // GLSL: textureOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // S-PIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureOffset(uniform_sampler2DShadow, vec3(0), offset2D) + + // GLSL: textureOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && float(0) == textureOffset(uniform_sampler2DShadow, vec3(0), offset2D, float(0)) + + // GLSL: textureOffset({{.*}}sampler2DRect + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRect + // S-PIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler2DRect, vec2(0), offset2D) + + // GLSL: textureOffset({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // S-PIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureOffset(uniform_sampler2DRectShadow, vec3(0), offset2D) + + // GLSL: textureOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureOffset(uniform_sampler1DShadow, vec3(0), int(0)) + + // GLSL: textureOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && float(0) == textureOffset(uniform_sampler1DShadow, vec3(0), int(0), float(0)) + + // GLSL: textureOffset({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // S-PIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler1DArray, vec2(0), int(0)) + + // GLSL: textureOffset({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler1DArray, vec2(0), int(0), float(0)) + + // GLSL: textureOffset({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // S-PIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler2DArray, vec3(0), offset2D) + + // GLSL: textureOffset({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: OpImageSampleImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureOffset(gsampler2DArray, vec3(0), offset2D, float(0)) + + // GLSL: textureOffset({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureOffset(uniform_sampler1DArrayShadow, vec3(0), int(0)) + + // GLSL: textureOffset({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && float(0) == textureOffset(uniform_sampler1DArrayShadow, vec3(0), int(0), float(0)) + + // GLSL: textureOffset({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageSampleDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureOffset(uniform_sampler2DArrayShadow, vec4(0), offset2D) + + // GLSL: texelFetch({{.*}}sampler1D + // 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(0), 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(0), 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(0), 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(0)) + + // 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(0), 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(0), int(0)) + + // GLSL: imageLoad({{.*}}samplerBuffer + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerBuffer + // SPIR: OpImageRead {{.*}}[[LOAD]] && gvec4(T(0)) == texelFetch(gsamplerBuffer, int(0)) -#if defined(TEST_when_multisampling_works) + + // 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(0), 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(0), int(0)) -#endif // #if defined(TEST_when_multisampling_works) - && 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__ }) - && 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__ }) - && 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__ }) - && float(0) == textureLodOffset(uniform_sampler1DArrayShadow, vec3(0), float(0), __LINE__) + + // 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(0), 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(0), 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(0), 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(0), 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(0), 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(0), int(0), offset2D) + + // GLSL: textureProjOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(0), int(0)) + + // GLSL: textureProjOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler1D, vec2(0), 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(0), int(0)) + + // GLSL: textureProjOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler1D, vec4(0), 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(0), offset2D) + + // GLSL: textureProjOffset({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler2D, vec3(0), offset2D, float(0)) + + // GLSL: textureProjOffset({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler2D, vec4(0), offset2D) + + // GLSL: textureProjOffset({{.*}}sampler2D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler2D, vec4(0), offset2D, float(0)) + + // GLSL: textureProjOffset({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler3D, vec4(0), offset3D) + + // GLSL: textureProjOffset({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleProjImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && gvec4(T(0)) == textureProjOffset(gsampler3D, vec4(0), 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(0), offset2D) + && gvec4(T(0)) == textureProjOffset(gsampler2DRect, vec4(0), offset2D) + + // GLSL: textureProjOffset({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureProjOffset(uniform_sampler2DRectShadow, vec4(0), offset2D) + + // GLSL: textureProjOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureProjOffset(uniform_sampler1DShadow, vec4(0), int(0)) + + // GLSL: textureProjOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && float(0) == textureProjOffset(uniform_sampler1DShadow, vec4(0), int(0), float(0)) + + // GLSL: textureProjOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} ConstOffset % + && float(0) == textureProjOffset(uniform_sampler2DShadow, vec4(0), offset2D) + + // GLSL: textureProjOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefImplicitLod {{.*}}[[LOAD]]{{.*}} Bias|ConstOffset % + && float(0) == textureProjOffset(uniform_sampler2DShadow, vec4(0), offset2D, float(0)) + + // GLSL: textureLodOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && gvec4(T(0)) == textureLodOffset(gsampler1D, float(0), 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(0), 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(0), float(0), offset3D) + + // GLSL: textureLodOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && float(0) == textureLodOffset(uniform_sampler1DShadow, vec3(0), float(0), 0) + + // GLSL: textureLodOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && float(1) == textureLodOffset(uniform_sampler2DShadow, vec3(0), float(0), offset2D) + + // GLSL: textureLodOffset({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && gvec4(T(0)) == textureLodOffset(gsampler1DArray, vec2(0), 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(0), float(0), offset2D) + + // GLSL: textureLodOffset({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && float(0) == textureLodOffset(uniform_sampler1DArrayShadow, vec3(0), float(0), int(0)) + + // 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(0), float(0)) && gvec4(T(0)) == textureProjLod(gsampler1D, vec4(0), 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(0), float(0)) && gvec4(T(0)) == textureProjLod(gsampler2D, vec4(0), float(0)) + + // GLSL: textureProjLod({{.*}}sampler3D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler3D + // SPIR: OpImageSampleProjExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && gvec4(T(0)) == textureProjLod(gsampler3D, vec4(0), float(0)) + + // GLSL: textureProjLod({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && float(0) == textureProjLod(uniform_sampler1DShadow, vec4(0), float(0)) + + // GLSL: textureProjLod({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod % && 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__ }) - && float(0) == textureProjLodOffset(uniform_sampler1DShadow, vec4(0), float(0), __LINE__) - && float(0) == textureProjLodOffset(uniform_sampler2DShadow, vec4(0), float(0), { __LINE__ }) + + // 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(0), float(0), 0) + && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec4(0), 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(0), float(0), offset2D) + && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec4(0), 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(0), float(0), offset3D) + + // GLSL: textureProjLodOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && float(0) == textureProjLodOffset(uniform_sampler1DShadow, vec4(0), float(0), int(0)) + + // GLSL: textureProjLodOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Lod|ConstOffset % + && float(0) == textureProjLodOffset(uniform_sampler2DShadow, vec4(0), float(0), offset2D) + + // GLSL: textureGrad({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && gvec4(T(0)) == textureGrad(gsampler1D, float(0), 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(0), 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(0), 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(0), 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(0), vec2(0), vec2(0)) + + // GLSL: textureGrad({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureGrad(uniform_sampler2DRectShadow, vec3(0), vec2(0), vec2(0)) + + // GLSL: textureGrad({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureGrad(uniform_sampler1DShadow, vec3(0), float(0), float(0)) + + // GLSL: textureGrad({{.*}}sampler1DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && gvec4(T(0)) == textureGrad(gsampler1DArray, vec2(0), 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(0), vec2(0), vec2(0)) + + // GLSL: textureGrad({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureGrad(uniform_sampler1DArrayShadow, vec3(0), float(0), float(0)) + + // GLSL: textureGrad({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureGrad(uniform_sampler2DShadow, vec3(0), vec2(0), vec2(0)) + + // GLSL: textureGrad({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureGrad(uniform_samplerCubeShadow, vec4(0), vec3(0), vec3(0)) + + // GLSL: textureGrad({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureGrad(uniform_sampler2DArrayShadow, vec4(0), vec2(0), vec2(0)) + + // GLSL: textureGrad({{.*}}samplerCubeArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && 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__ }) - && 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__) - && float(0) == textureGradOffset(uniform_sampler1DArrayShadow, vec3(0), float(0), float(0), __LINE__) - && float(0) == textureGradOffset(uniform_sampler2DArrayShadow, vec4(0), vec2(0), vec2(0), { __LINE__ }) + + // GLSL: textureGradOffset({{.*}}sampler1D + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1D + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && gvec4(T(0)) == textureGradOffset(gsampler1D, float(0), 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(0), 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(0), 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(0), vec2(0), vec2(0), offset2D) + + // GLSL: textureGradOffset({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureGradOffset(uniform_sampler2DRectShadow, vec3(0), vec2(0), vec2(0), offset2D) + + // GLSL: textureGradOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureGradOffset(uniform_sampler1DShadow, vec3(0), float(0), float(0), int(0)) + + // GLSL: textureGradOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureGradOffset(uniform_sampler2DShadow, vec3(0), vec2(0), vec2(0), offset2D) + + // GLSL: textureGradOffset({{.*}}sampler2DArray + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArray + // SPIR: OpImageSampleExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && gvec4(T(0)) == textureGradOffset(gsampler2DArray, vec3(0), 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(0), float(0), float(0), int(0)) + + // GLSL: textureGradOffset({{.*}}sampler1DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DArrayShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureGradOffset(uniform_sampler1DArrayShadow, vec3(0), float(0), float(0), int(0)) + + // GLSL: textureGradOffset({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageSampleDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureGradOffset(uniform_sampler2DArrayShadow, vec4(0), vec2(0), vec2(0), offset2D) + + // 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(0), float(0), float(0)) && gvec4(T(0)) == textureProjGrad(gsampler1D, vec4(0), 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(0), vec2(0), vec2(0)) && gvec4(T(0)) == textureProjGrad(gsampler2D, vec4(0), 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(0), 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(0), vec2(0), vec2(0)) && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec4(0), vec2(0), vec2(0)) + + // GLSL: textureProjGrad({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureProjGrad(uniform_sampler2DRectShadow, vec4(0), vec2(0), vec2(0)) + + // GLSL: textureProjGrad({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && float(0) == textureProjGrad(uniform_sampler1DShadow, vec4(0), float(0), float(0)) + + // GLSL: textureProjGrad({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad % && 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__ }) - && 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__ }) + + // 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(0), float(0), float(0), 0) + && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec4(0), 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(0), vec2(0), vec2(0), offset2D) + && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec4(0), 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(0), 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(0), vec2(0), vec2(0), offset2D) + && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec4(0), vec2(0), vec2(0), offset2D) + + // GLSL: textureProjGradOffset({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureProjGradOffset(uniform_sampler2DRectShadow, vec4(0), vec2(0), vec2(0), offset2D) + + // GLSL: textureProjGradOffset({{.*}}sampler1DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler1DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureProjGradOffset(uniform_sampler1DShadow, vec4(0), float(0), float(0), int(0)) + + // GLSL: textureProjGradOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageSampleProjDrefExplicitLod {{.*}}[[LOAD]]{{.*}} Grad|ConstOffset % + && float(0) == textureProjGradOffset(uniform_sampler2DShadow, vec4(0), vec2(0), vec2(0), offset2D) // 8.9.4. Texture Gather Functions + + // GLSL-COUNT-2: textureGather({{.*}}sampler2D + // SPIR-COUNT-2: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2D + // SPIR: OpImageGather {{.*}}[[LOAD]] && gvec4(T(0)) == textureGather(gsampler2D, vec2(0)) && gvec4(T(0)) == textureGather(gsampler2D, vec2(0), 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(0)) && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0), 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(0)) && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0), 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(0)) && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0), 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(0)) && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0), int(0)) + + // GLSL: textureGather({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]] && vec4(0) == textureGather(uniform_sampler2DShadow, vec2(0), float(0)) + + // GLSL: textureGather({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]] && vec4(0) == textureGather(uniform_sampler2DArrayShadow, vec3(0), float(0)) + + // GLSL: textureGather({{.*}}samplerCubeShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]] && vec4(0) == textureGather(uniform_samplerCubeShadow, vec3(0), float(0)) + + // GLSL: textureGather({{.*}}samplerCubeArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}samplerCubeArrayShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]] && vec4(0) == textureGather(uniform_samplerCubeArrayShadow, vec4(0), float(0)) + + // GLSL: textureGather({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]] && 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)) - && 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)) - && 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)) - && 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)) - && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) + + // 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(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), 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(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), offset2D, int(0)) + + // GLSL: textureGatherOffset({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]]{{.*}} ConstOffset % + && vec4(0) == textureGatherOffset(uniform_sampler2DShadow, vec2(0), float(0), offset2D) + + // GLSL: textureGatherOffset({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]]{{.*}} ConstOffset % + && vec4(0) == textureGatherOffset(uniform_sampler2DArrayShadow, vec3(0), float(0), offset2D) + + // 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(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), offset2D, int(0)) + + // GLSL: textureGatherOffset({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]]{{.*}} ConstOffset % + && vec4(0) == textureGatherOffset(uniform_sampler2DRectShadow, vec2(0), float(0), offset2D) + + // 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(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), 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(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), offsets, int(0)) + + // GLSL: textureGatherOffsets({{.*}}sampler2DShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]]{{.*}} ConstOffsets % + && vec4(0) == textureGatherOffsets(uniform_sampler2DShadow, vec2(0), float(0), offsets) + + // GLSL: textureGatherOffsets({{.*}}sampler2DArrayShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DArrayShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]]{{.*}} ConstOffsets % + && vec4(0) == textureGatherOffsets(uniform_sampler2DArrayShadow, vec3(0), float(0), offsets) + + // 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(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), offsets, int(0)) + + // GLSL: textureGatherOffsets({{.*}}sampler2DRectShadow + // SPIR: [[LOAD:%[1-9][0-9]*]] = OpLoad{{.*}}sampler2DRectShadow + // SPIR: OpImageDrefGather {{.*}}[[LOAD]]{{.*}} ConstOffsets % + && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), offsets) // 8.9.5. Compatibility Profile Texture Functions + // Compatibility functions work for GLSL but not for SPIR-V. + // We cannot test the SPIR-V asm here for these functions. + // We also cannot test GLSL source for them because we don't directly + // call them. If we do, the spirv-via-glsl path cannot work. + && vec4(0) == texture1D(uniform_sampler1D, float(0)) && vec4(0) == texture1D(uniform_sampler1D, float(0), float(0)) && vec4(0) == texture1DProj(uniform_sampler1D, vec2(0)) @@ -413,15 +1351,16 @@ bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D , Sampler2DArray<vector<T, N>> gsampler2DArray , SamplerCubeArray<vector<T, N>> gsamplerCubeArray , SamplerBuffer<vector<T, N>> gsamplerBuffer -#if defined(TEST_when_multisampling_works) , Sampler2DMS<vector<T, N>> gsampler2DMS , Sampler2DMSArray<vector<T, N>> gsampler2DMSArray -#endif // #if defined(TEST_when_multisampling_works) ) { + // GLSL-LABEL: itextureFuncs_0 typealias gvec4 = vector<T, 4>; - constexpr ivec2 ivec2_0 = ivec2(0); + constexpr ivec2 offset2D = ivec2(0); + constexpr ivec3 offset3D = ivec3(0); + constexpr ivec2 offsets[4] = { ivec2(0), ivec2(0), ivec2(0), ivec2(0) }; return true // 8.9.1. Texture Query Functions @@ -441,10 +1380,8 @@ bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D && ivec3(0) == textureSize(gsampler2DArray, int(0)) && ivec3(0) == textureSize(uniform_sampler2DArrayShadow, int(0)) && int(0) == textureSize(gsamplerBuffer) -#if defined(TEST_when_multisampling_works) && ivec2(0) == textureSize(gsampler2DMS) && ivec3(0) == textureSize(gsampler2DMSArray) -#endif && 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)) @@ -452,16 +1389,15 @@ bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D && 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)) -#if defined(TEST_when_multisampling_works) && gvec4(T(0)) == texelFetch(gsampler2DMS, ivec2(0), int(0)) && gvec4(T(0)) == texelFetch(gsampler2DMSArray, ivec3(0), int(0)) -#endif // #if defined(TEST_when_multisampling_works) - && 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)) == texelFetchOffset(gsampler1D, int(0), int(0), 0) + && gvec4(T(0)) == texelFetchOffset(gsampler2D, ivec2(0), int(0), offset2D) + && gvec4(T(0)) == texelFetchOffset(gsampler3D, ivec3(0), int(0), offset3D) + && gvec4(T(0)) == texelFetchOffset(gsampler2DRect, ivec2(0), offset2D) + && gvec4(T(0)) == texelFetchOffset(gsampler1DArray, ivec2(0), int(0), int(0)) + && gvec4(T(0)) == texelFetchOffset(gsampler2DArray, ivec3(0), int(0), offset2D) + // 8.9.4. Texture Gather Functions && gvec4(T(0)) == textureGather(gsampler2D, vec2(0)) && gvec4(T(0)) == textureGather(gsampler2D, vec2(0), int(0)) @@ -478,24 +1414,24 @@ bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D && 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)) - && 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)) - && 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)) - && 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)) - && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) + && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), offset2D, int(0)) + && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), offset2D, int(0)) + && vec4(0) == textureGatherOffset(uniform_sampler2DShadow, vec2(0), float(0), offset2D) + && vec4(0) == textureGatherOffset(uniform_sampler2DArrayShadow, vec3(0), float(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), offset2D) + && gvec4(T(0)) == textureGatherOffset(gsampler2DRect, vec2(0), offset2D, int(0)) + && vec4(0) == textureGatherOffset(uniform_sampler2DRectShadow, vec2(0), float(0), offset2D) + && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), offsets, int(0)) + && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), offsets, int(0)) + && vec4(0) == textureGatherOffsets(uniform_sampler2DShadow, vec2(0), float(0), offsets) + && vec4(0) == textureGatherOffsets(uniform_sampler2DArrayShadow, vec3(0), float(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), offsets) + && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), offsets, int(0)) + && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), offsets) ; } @@ -504,12 +1440,11 @@ bool itextureFuncs(Sampler1D<vector<T, N>> gsampler1D #endif void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { - // CHECK_GLSL: void main( - // CHECK_SPV: OpEntryPoint - // CHECK_SPV_DIRECT: OpEntryPoint - // CHECK_HLSL: void computeMain( - // CHECK_CUDA: void computeMain( - // CHECK_CPP: void _computeMain( + // GLSL: void main( + // GLSL_SPIRV: OpEntryPoint + // HLSL: void computeMain( + // CUDA: void computeMain( + // CPP: void _computeMain( outputBuffer.result = true && textureFuncs( @@ -522,10 +1457,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) , uniform_sampler2DArray , uniform_samplerCubeArray , uniform_samplerBuffer -#if defined(TEST_when_multisampling_works) , uniform_sampler2DMS , uniform_sampler2DMSArray -#endif // #if defined(TEST_when_multisampling_works) ) && itextureFuncs( uniform_isampler1D @@ -537,10 +1470,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) , uniform_isampler2DArray , uniform_isamplerCubeArray , uniform_isamplerBuffer -#if defined(TEST_when_multisampling_works) , uniform_isampler2DMS , uniform_isampler2DMSArray -#endif // #if defined(TEST_when_multisampling_works) ) && itextureFuncs( uniform_usampler1D @@ -552,13 +1483,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) , uniform_usampler2DArray , uniform_usamplerCubeArray , uniform_usamplerBuffer -#if defined(TEST_when_multisampling_works) , uniform_usampler2DMS , uniform_usampler2DMSArray -#endif // #if defined(TEST_when_multisampling_works) ); - - //outputBuffer[0] = float(r); - //o_color[0] = float(r); } |
