summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-02-05 17:03:04 -0800
committerGitHub <noreply@github.com>2024-02-05 17:03:04 -0800
commita88a7db9b3c215be890d4a9da6414959f9f9a3c1 (patch)
treeb9a13dcda7177fb8918df5d5a02bdde191ee1bae /tests
parent71439f700b845e8d8336041c6d6824f01b7c9067 (diff)
Implement GLSL build-in functions related to texture (#3544)
* Implement GLSL texture related built-in functions Partially resolves #3362 This change implemented GLSL build-in functions described in the following sections of "OpenGL Spec" document. 8.9.1. Texture Query Functions 8.9.2. Texel Lookup Functions 8.9.4. Texture Gather Functions 8.9.5. Compatibility Profile Texture Functions About 200 functions are newly implemented. Most of the functions are calling the HLSL implementation so they are expected to work for all targets but they haven't been tested throughly yet. __TextureImpl got a new generic parameter, "isRectangle", to support sampler2DRect and sampler2DRectShadow. It is a sampler for rectangular texture with no mipmaps. For the reason, its "GetDimentions()" doesn't return mip information. The sampling needs to happen in an integer coordinate not in a normalized [0,1] range. but this hasn't been implemenented yet. Texture functions whose name include "Offset" takes an integer type parameter and those values are required to be a compile-time constant. However, our currentl implementation of slangc seems to make the values not-compile-time constant. As a workaround, the test case uses __LINE__ macro to use a unique numbers so that slangc wouldn't collect them into a runtime variable. I put "constexpr" on "offset" parameters as much as possible. But the issue was still reproduced when targetting SPIRV. Texture functions whose name include "Proj" are emulated by dividing the coordinate value with its last component. For that reason, they take one additional component for its coordinate value. As an example, following function takes two components for sampler1D, instead of one: vec4 textureProj(sampler1D sampler, vec2 p); All shadow samplers stores depth-compare-value at the last component. But sampler1DShadow take one extra component, which is vec3 not vec2. It is unclear what the reason is but the second component is unused in this case. Here is an example, float texture(sampler1DShadow sampler, vec3 p); samplerCubeArrayShadow takes five components for its coordinate and the depth-compare-value cannot be stored in the last component of the cooridnate. It is separated out as an independent parameter, float texture(samplerCubeArrayShadow sampler, vec4 p, float compare); TextureGather functions got some modifications. The existing implementation was calling textureGatherOffset[s] with the parameters in a wrong order. This mistake is corrected. * Bring back GatherCmpRed/Green/Blue/Alpha HLSL has GatherCmpRed/Green/Blue/Alpha functions and it was removed from my previous change by a mistake. This change brings them back. * Disabling two failing tests in intrinsic-texture The new test file, intrinsic-texture.slang, has five test settings and two of them are currently failing; they are targetting HLSL and CPP. This change disables them to avoid confusion. * Remove "isRectangle" parameter from __TextureInfo Partially resolves #3362 This commit has a few changes based on the feedback from the code reviews. 1. Remove "isRectangle" parameter from __TextureInfo, because "sampler2DRect" can be replaced with "sampler2D" that always uses lod level 0. All functions associated to "Rect" are also removed. 2. Enabled tests for "samplerBuffer". 3. Removed "__target_intrinsic(glsl)" from glsl.meta.slang, because we want to stay away from it in the future. 4. Some tests in intrinsic-texture.slang are disabled if the functions take constant offset values or take MultiSample samplers. --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/glsl-intrinsic/intrinsic-texture.slang462
1 files changed, 462 insertions, 0 deletions
diff --git a/tests/glsl-intrinsic/intrinsic-texture.slang b/tests/glsl-intrinsic/intrinsic-texture.slang
new file mode 100644
index 000000000..3b42be715
--- /dev/null
+++ b/tests/glsl-intrinsic/intrinsic-texture.slang
@@ -0,0 +1,462 @@
+#version 450 core
+#extension GL_EXT_texture_shadow_lod : enable
+
+//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
+//TEST:SIMPLE(filecheck=CHECK_CUDA): -allow-glsl -stage fragment -entry computeMain -target cuda
+
+// Disabling following targets because they are currently causing compile errors.
+//T-EST:SIMPLE(filecheck=CHECK_HLSL): -allow-glsl -stage fragment -entry computeMain -target hlsl
+//T-EST:SIMPLE(filecheck=CHECK_CPP): -allow-glsl -stage fragment -entry computeMain -target cpp
+
+// "Offset" family of texture functions in GLSL requires offset parameter to be a constant value.
+// It appears that slangc removes the constant-ness of constant values.
+//#define TEST_when_constexpr_works
+
+// 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;
+
+uniform sampler1DShadow uniform_sampler1DShadow;
+uniform sampler2DShadow uniform_sampler2DShadow;
+uniform samplerCubeShadow uniform_samplerCubeShadow;
+
+uniform sampler1DArrayShadow uniform_sampler1DArrayShadow;
+uniform sampler2DArrayShadow uniform_sampler2DArrayShadow;
+uniform sampler2DRectShadow uniform_sampler2DRectShadow;
+uniform samplerCubeArrayShadow uniform_samplerCubeArrayShadow;
+
+uniform sampler1D uniform_sampler1D;
+uniform sampler2D uniform_sampler2D;
+uniform sampler2DRect uniform_sampler2DRect;
+uniform sampler3D uniform_sampler3D;
+uniform samplerCube uniform_samplerCube;
+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;
+uniform isampler2DRect uniform_isampler2DRect;
+uniform isampler3D uniform_isampler3D;
+uniform isamplerCube uniform_isamplerCube;
+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;
+uniform usampler2DRect uniform_usampler2DRect;
+uniform usampler3D uniform_usampler3D;
+uniform usamplerCube uniform_usamplerCube;
+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 : __BuiltinArithmeticType, let N : int>
+bool textureFuncs( Sampler1D<vector<T,N>> gsampler1D
+ , Sampler2D<vector<T,N>> gsampler2D
+ , Sampler2DRect<vector<T,N>> gsampler2DRect
+ , Sampler3D<vector<T,N>> gsampler3D
+ , SamplerCube<vector<T,N>> gsamplerCube
+ , Sampler1DArray<vector<T,N>> gsampler1DArray
+ , Sampler2DArray<vector<T,N>> gsampler2DArray
+ , SamplerCubeArray<vector<T,N>> gsamplerCubeArray
+ , SamplerBuffer<vector<T,N>> gsamplerBuffer
+#if defined(TEST_when_multisampling_works)
+ , Sampler2DMS<vector<T,N>> gsampler2DMS
+ , Sampler2DMSArray<vector<T,N>> gsampler2DMSArray
+#endif // #if defined(TEST_when_multisampling_works)
+)
+{
+ typealias gvec4 = vector<T,4>;
+
+ constexpr ivec2 ivec2_0 = ivec2(0);
+
+ return true
+ // 8.9.1. Texture Query Functions
+ && int(0) == textureSize(gsampler1D, int(0))
+ && ivec2(0) == textureSize(gsampler2D, int(0))
+ && ivec3(0) == textureSize(gsampler3D, int(0))
+ && ivec2(0) == textureSize(gsamplerCube, int(0))
+ && int(0) == textureSize(uniform_sampler1DShadow, int(0))
+ && ivec2(0) == textureSize(uniform_sampler2DShadow, int(0))
+ && ivec2(0) == textureSize(uniform_samplerCubeShadow, int(0))
+ && ivec3(0) == textureSize(gsamplerCubeArray, int(0))
+ && ivec3(0) == textureSize(uniform_samplerCubeArrayShadow, int(0))
+ && ivec2(0) == textureSize(gsampler2DRect)
+ && ivec2(0) == textureSize(uniform_sampler2DRectShadow)
+ && ivec2(0) == textureSize(gsampler1DArray, int(0))
+ && ivec2(0) == textureSize(uniform_sampler1DArrayShadow, int(0))
+ && 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 // #if defined(TEST_when_multisampling_works)
+ && vec2(0) == textureQueryLod(gsampler1D, float(0))
+ && vec2(0) == textureQueryLod(gsampler2D, vec2(0))
+ && vec2(0) == textureQueryLod(gsampler3D, vec3(0))
+ && vec2(0) == textureQueryLod(gsamplerCube, vec3(0))
+ && vec2(0) == textureQueryLod(gsampler1DArray, float(0))
+ && vec2(0) == textureQueryLod(gsampler2DArray, vec2(0))
+ && vec2(0) == textureQueryLod(gsamplerCubeArray, vec3(0))
+ && vec2(0) == textureQueryLod(uniform_sampler1DShadow, float(0))
+ && vec2(0) == textureQueryLod(uniform_sampler2DShadow, vec2(0))
+ && vec2(0) == textureQueryLod(uniform_samplerCubeShadow, vec3(0))
+ && vec2(0) == textureQueryLod(uniform_sampler1DArrayShadow, float(0))
+ && vec2(0) == textureQueryLod(uniform_sampler2DArrayShadow, vec2(0))
+ && vec2(0) == textureQueryLod(uniform_samplerCubeArrayShadow, vec3(0))
+ && int(0) == textureQueryLevels(gsampler1D)
+ && int(0) == textureQueryLevels(gsampler2D)
+ && int(0) == textureQueryLevels(gsampler3D)
+ && int(0) == textureQueryLevels(gsamplerCube)
+ && int(0) == textureQueryLevels(gsampler1DArray)
+ && int(0) == textureQueryLevels(gsampler2DArray)
+ && int(0) == textureQueryLevels(gsamplerCubeArray)
+ && int(0) == textureQueryLevels(uniform_sampler1DShadow)
+ && int(0) == textureQueryLevels(uniform_sampler2DShadow)
+ && int(0) == textureQueryLevels(uniform_samplerCubeShadow)
+ && int(0) == textureQueryLevels(uniform_sampler1DArrayShadow)
+ && int(0) == textureQueryLevels(uniform_sampler2DArrayShadow)
+ && int(0) == textureQueryLevels(uniform_samplerCubeArrayShadow)
+#if defined(TEST_when_multisampling_works)
+ && int(0) == textureSamples(gsampler2DMS)
+ && int(0) == textureSamples(gsampler2DMSArray)
+#endif // #if defined(TEST_when_multisampling_works)
+
+ // 8.9.2. Texel Lookup Functions
+ && gvec4(T(0)) == texture(gsampler1D, float(0))
+ && gvec4(T(0)) == texture(gsampler1D, float(0), float(0))
+ && gvec4(T(0)) == texture(gsampler2D, vec2(0))
+ && gvec4(T(0)) == texture(gsampler2D, vec2(0), float(0))
+ && gvec4(T(0)) == texture(gsampler3D, vec3(0))
+ && gvec4(T(0)) == texture(gsampler3D, vec3(0), float(0))
+ && gvec4(T(0)) == texture(gsamplerCube, vec3(0) )
+ && gvec4(T(0)) == texture(gsamplerCube, vec3(0), float(0))
+ && float(0) == texture(uniform_sampler1DShadow, vec3(0))
+ && float(0) == texture(uniform_sampler1DShadow, vec3(0), float(0))
+ && float(0) == texture(uniform_sampler2DShadow, vec3(0))
+ && float(0) == texture(uniform_sampler2DShadow, vec3(0), float(0))
+ && float(0) == texture(uniform_samplerCubeShadow, vec4(0))
+ && float(0) == texture(uniform_samplerCubeShadow, vec4(0), float(0))
+ && gvec4(T(0)) == texture(gsampler2DArray, vec3(0))
+ && gvec4(T(0)) == texture(gsampler2DArray, vec3(0), float(0))
+ && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(0) )
+ && gvec4(T(0)) == texture(gsamplerCubeArray, vec4(0), float(0))
+ && gvec4(T(0)) == texture(gsampler1DArray, vec2(0))
+ && gvec4(T(0)) == texture(gsampler1DArray, vec2(0), float(0))
+ && float(0) == texture(uniform_sampler1DArrayShadow, vec3(0))
+ && float(0) == texture(uniform_sampler1DArrayShadow, vec3(0), float(0))
+ && float(0) == texture(uniform_sampler2DArrayShadow, vec4(0))
+ && gvec4(T(0)) == texture(gsampler2DRect, vec2(0))
+ && float(0) == texture(uniform_sampler2DRectShadow, vec3(0))
+ && float(0) == texture(uniform_samplerCubeArrayShadow, vec4(0), float(0))
+ && gvec4(T(0)) == textureProj(gsampler1D, vec2(0))
+ && gvec4(T(0)) == textureProj(gsampler1D, vec2(0), float(0))
+ && gvec4(T(0)) == textureProj(gsampler1D, vec4(0))
+ && gvec4(T(0)) == textureProj(gsampler1D, vec4(0), float(0))
+ && gvec4(T(0)) == textureProj(gsampler2D, vec3(0))
+ && gvec4(T(0)) == textureProj(gsampler2D, vec3(0), float(0))
+ && gvec4(T(0)) == textureProj(gsampler2D, vec4(0))
+ && gvec4(T(0)) == textureProj(gsampler2D, vec4(0), float(0))
+ && gvec4(T(0)) == textureProj(gsampler3D, vec4(0))
+ && gvec4(T(0)) == textureProj(gsampler3D, vec4(0), float(0))
+ && float(0) == textureProj(uniform_sampler1DShadow, vec4(0))
+ && float(0) == textureProj(uniform_sampler1DShadow, vec4(0), float(0))
+ && float(0) == textureProj(uniform_sampler2DShadow, vec4(0))
+ && float(0) == textureProj(uniform_sampler2DShadow, vec4(0), float(0))
+ && gvec4(T(0)) == textureProj(gsampler2DRect, vec3(0))
+ && gvec4(T(0)) == textureProj(gsampler2DRect, vec4(0))
+ && float(0) == textureProj(uniform_sampler2DRectShadow, vec4(0))
+ && gvec4(T(0)) == textureLod(gsampler1D, float(0), float(0))
+ && gvec4(T(0)) == textureLod(gsampler2D, vec2(0), float(0))
+ && gvec4(T(0)) == textureLod(gsampler3D, vec3(0), float(0))
+ && gvec4(T(0)) == textureLod(gsamplerCube, vec3(0), float(0))
+ && float(0) == textureLod(uniform_sampler2DShadow, vec3(0), float(0))
+ && float(0) == textureLod(uniform_sampler1DShadow, vec3(0), float(0))
+ && gvec4(T(0)) == textureLod(gsampler1DArray, vec2(0), float(0))
+ && float(0) == textureLod(uniform_sampler1DArrayShadow, vec3(0), float(0))
+ && gvec4(T(0)) == textureLod(gsampler2DArray, vec3(0), float(0))
+ && gvec4(T(0)) == textureLod(gsamplerCubeArray, vec4(0), float(0))
+ && gvec4(T(0)) == textureOffset(gsampler1D, float(0), __LINE__)
+ && gvec4(T(0)) == textureOffset(gsampler1D, float(0), __LINE__, float(0))
+ && gvec4(T(0)) == textureOffset(gsampler2D, vec2(0), { __LINE__ })
+ && gvec4(T(0)) == textureOffset(gsampler2D, vec2(0), { __LINE__ }, float(0))
+ && gvec4(T(0)) == textureOffset(gsampler3D, vec3(0), { __LINE__ })
+ && gvec4(T(0)) == textureOffset(gsampler3D, vec3(0), { __LINE__ }, float(0))
+ && 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__ })
+ && gvec4(T(0)) == texelFetch(gsampler1D, int(0), int(0))
+ && gvec4(T(0)) == texelFetch(gsampler2D, ivec2(0), int(0))
+ && gvec4(T(0)) == texelFetch(gsampler3D, ivec3(0), int(0))
+ && gvec4(T(0)) == texelFetch(gsampler2DRect, ivec2(0))
+ && gvec4(T(0)) == texelFetch(gsampler1DArray, ivec2(0), int(0))
+ && gvec4(T(0)) == texelFetch(gsampler2DArray, ivec3(0), int(0))
+ && gvec4(T(0)) == texelFetch(gsamplerBuffer, int(0))
+#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)) == 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__)
+ && gvec4(T(0)) == textureProjLod(gsampler1D, vec2(0), float(0))
+ && gvec4(T(0)) == textureProjLod(gsampler1D, vec4(0), float(0))
+ && gvec4(T(0)) == textureProjLod(gsampler2D, vec3(0), float(0))
+ && gvec4(T(0)) == textureProjLod(gsampler2D, vec4(0), float(0))
+ && gvec4(T(0)) == textureProjLod(gsampler3D, vec4(0), float(0))
+ && float(0) == textureProjLod(uniform_sampler1DShadow, vec4(0), float(0))
+ && float(0) == textureProjLod(uniform_sampler2DShadow, vec4(0), float(0))
+ && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec2(0), float(0), __LINE__)
+ && gvec4(T(0)) == textureProjLodOffset(gsampler1D, vec4(0), float(0), __LINE__)
+ && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec3(0), float(0), { __LINE__ })
+ && gvec4(T(0)) == textureProjLodOffset(gsampler2D, vec4(0), float(0), { __LINE__ })
+ && gvec4(T(0)) == textureProjLodOffset(gsampler3D, vec4(0), float(0), { __LINE__ })
+ && float(0) == textureProjLodOffset(uniform_sampler1DShadow, vec4(0), float(0), __LINE__)
+ && float(0) == textureProjLodOffset(uniform_sampler2DShadow, vec4(0), float(0), { __LINE__ })
+ && gvec4(T(0)) == textureGrad(gsampler1D, float(0), float(0), float(0))
+ && gvec4(T(0)) == textureGrad(gsampler2D, vec2(0), vec2(0), vec2(0))
+ && gvec4(T(0)) == textureGrad(gsampler3D, vec3(0), vec3(0), vec3(0))
+ && gvec4(T(0)) == textureGrad(gsamplerCube, vec3(0), vec3(0), vec3(0))
+ && gvec4(T(0)) == textureGrad(gsampler2DRect, vec2(0), vec2(0), vec2(0))
+ && float(0) == textureGrad(uniform_sampler2DRectShadow, vec3(0), vec2(0), vec2(0))
+ && float(0) == textureGrad(uniform_sampler1DShadow, vec3(0), float(0), float(0))
+ && gvec4(T(0)) == textureGrad(gsampler1DArray, vec2(0), float(0), float(0))
+ && gvec4(T(0)) == textureGrad(gsampler2DArray, vec3(0), vec2(0), vec2(0))
+ && float(0) == textureGrad(uniform_sampler1DArrayShadow, vec3(0), float(0), float(0))
+ && float(0) == textureGrad(uniform_sampler2DShadow, vec3(0), vec2(0), vec2(0))
+ && float(0) == textureGrad(uniform_samplerCubeShadow, vec4(0), vec3(0), vec3(0))
+ && float(0) == textureGrad(uniform_sampler2DArrayShadow, vec4(0), vec2(0), vec2(0))
+ && gvec4(T(0)) == textureGrad(gsamplerCubeArray, vec4(0), vec3(0), vec3(0))
+ && gvec4(T(0)) == textureGradOffset(gsampler1D, float(0), float(0), float(0), __LINE__)
+ && gvec4(T(0)) == textureGradOffset(gsampler2D, vec2(0), vec2(0), vec2(0), { __LINE__ })
+ && gvec4(T(0)) == textureGradOffset(gsampler3D, vec3(0), vec3(0), vec3(0), { __LINE__ })
+ && gvec4(T(0)) == textureGradOffset(gsampler2DRect, vec2(0), vec2(0), vec2(0), { __LINE__ })
+ && 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__ })
+ && gvec4(T(0)) == textureProjGrad(gsampler1D, vec2(0), float(0), float(0))
+ && gvec4(T(0)) == textureProjGrad(gsampler1D, vec4(0), float(0), float(0))
+ && gvec4(T(0)) == textureProjGrad(gsampler2D, vec3(0), vec2(0), vec2(0))
+ && gvec4(T(0)) == textureProjGrad(gsampler2D, vec4(0), vec2(0), vec2(0))
+ && gvec4(T(0)) == textureProjGrad(gsampler3D, vec4(0), vec3(0), vec3(0))
+ && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec3(0), vec2(0), vec2(0))
+ && gvec4(T(0)) == textureProjGrad(gsampler2DRect, vec4(0), vec2(0), vec2(0))
+ && float(0) == textureProjGrad(uniform_sampler2DRectShadow, vec4(0), vec2(0), vec2(0))
+ && float(0) == textureProjGrad(uniform_sampler1DShadow, vec4(0), float(0), float(0))
+ && float(0) == textureProjGrad(uniform_sampler2DShadow, vec4(0), vec2(0), vec2(0))
+ && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec2(0), float(0), float(0), __LINE__)
+ && gvec4(T(0)) == textureProjGradOffset(gsampler1D, vec4(0), float(0), float(0), __LINE__)
+ && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec3(0), vec2(0), vec2(0), { __LINE__ })
+ && gvec4(T(0)) == textureProjGradOffset(gsampler2D, vec4(0), vec2(0), vec2(0), { __LINE__ })
+ && gvec4(T(0)) == textureProjGradOffset(gsampler3D, vec4(0), vec3(0), vec3(0), { __LINE__ })
+ && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec3(0), vec2(0), vec2(0), { __LINE__ })
+ && gvec4(T(0)) == textureProjGradOffset(gsampler2DRect, vec4(0), vec2(0), vec2(0), { __LINE__ })
+ && float(0) == textureProjGradOffset(uniform_sampler2DRectShadow, vec4(0), vec2(0), vec2(0), { __LINE__ })
+ && float(0) == textureProjGradOffset(uniform_sampler1DShadow, vec4(0), float(0), float(0), __LINE__)
+ && float(0) == textureProjGradOffset(uniform_sampler2DShadow, vec4(0), vec2(0), vec2(0), { __LINE__ })
+
+ // 8.9.4. Texture Gather Functions
+ && gvec4(T(0)) == textureGather(gsampler2D, vec2(0))
+ && gvec4(T(0)) == textureGather(gsampler2D, vec2(0), int(0))
+ && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0))
+ && gvec4(T(0)) == textureGather(gsampler2DArray, vec3(0), int(0))
+ && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0))
+ && gvec4(T(0)) == textureGather(gsamplerCube, vec3(0), int(0))
+ && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0))
+ && gvec4(T(0)) == textureGather(gsamplerCubeArray, vec4(0), int(0))
+ && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0))
+ && gvec4(T(0)) == textureGather(gsampler2DRect, vec2(0), int(0))
+ && vec4(0) == textureGather(uniform_sampler2DShadow, vec2(0), float(0))
+ && vec4(0) == textureGather(uniform_sampler2DArrayShadow, vec3(0), float(0))
+ && vec4(0) == textureGather(uniform_samplerCubeShadow, vec3(0), float(0))
+ && vec4(0) == textureGather(uniform_samplerCubeArrayShadow, vec4(0), float(0))
+ && vec4(0) == textureGather(uniform_sampler2DRectShadow, vec2(0), float(0))
+ && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ })
+ && gvec4(T(0)) == textureGatherOffset(gsampler2D, vec2(0), { __LINE__ }, int(0))
+ && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ })
+ && gvec4(T(0)) == textureGatherOffset(gsampler2DArray, vec3(0), { __LINE__ }, int(0))
+ && 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__ })
+#if defined(TEST_when_constexpr_works)
+ && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }) // constexpr not working
+ && gvec4(T(0)) == textureGatherOffsets(gsampler2D, vec2(0), { __LINE__ }, int(0)) // constexpr not working
+ && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }) // constexpr not working
+ && gvec4(T(0)) == textureGatherOffsets(gsampler2DArray, vec3(0), { __LINE__ }, int(0)) // constexpr not working
+ && vec4(0) == textureGatherOffsets(uniform_sampler2DShadow, vec2(0), float(0), { __LINE__ }) // constexpr not working
+ && vec4(0) == textureGatherOffsets(uniform_sampler2DArrayShadow, vec3(0), float(0), { __LINE__ }) // constexpr not working
+ && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }) // constexpr not working
+ && gvec4(T(0)) == textureGatherOffsets(gsampler2DRect, vec2(0), { __LINE__ }, int(0)) // constexpr not working
+ && vec4(0) == textureGatherOffsets(uniform_sampler2DRectShadow, vec2(0), float(0), { __LINE__ }) // constexpr not working
+#endif // #if defined(TEST_when_constexpr_works)
+
+ // 8.9.5. Compatibility Profile Texture Functions
+ && vec4(0) == texture1D(uniform_sampler1D, float(0))
+ && vec4(0) == texture1D(uniform_sampler1D, float(0), float(0))
+ && vec4(0) == texture1DProj(uniform_sampler1D, vec2(0))
+ && vec4(0) == texture1DProj(uniform_sampler1D, vec2(0), float(0))
+ && vec4(0) == texture1DProj(uniform_sampler1D, vec4(0))
+ && vec4(0) == texture1DProj(uniform_sampler1D, vec4(0), float(0))
+ && vec4(0) == texture1DLod(uniform_sampler1D, float(0), float(0))
+ && vec4(0) == texture1DProjLod(uniform_sampler1D, vec2(0), float(0))
+ && vec4(0) == texture1DProjLod(uniform_sampler1D, vec4(0), float(0))
+ && vec4(0) == texture2D(uniform_sampler2D, vec2(0))
+ && vec4(0) == texture2D(uniform_sampler2D, vec2(0), float(0))
+ && vec4(0) == texture2DProj(uniform_sampler2D, vec3(0))
+ && vec4(0) == texture2DProj(uniform_sampler2D, vec3(0), float(0))
+ && vec4(0) == texture2DProj(uniform_sampler2D, vec4(0))
+ && vec4(0) == texture2DProj(uniform_sampler2D, vec4(0), float(0))
+ && vec4(0) == texture2DLod(uniform_sampler2D, vec2(0), float(0))
+ && vec4(0) == texture2DProjLod(uniform_sampler2D, vec3(0), float(0))
+ && vec4(0) == texture2DProjLod(uniform_sampler2D, vec4(0), float(0))
+ && vec4(0) == texture3D(uniform_sampler3D, vec3(0))
+ && vec4(0) == texture3D(uniform_sampler3D, vec3(0), float(0))
+ && vec4(0) == texture3DProj(uniform_sampler3D, vec4(0))
+ && vec4(0) == texture3DProj(uniform_sampler3D, vec4(0), float(0))
+ && vec4(0) == texture3DLod(uniform_sampler3D, vec3(0), float(0))
+ && vec4(0) == texture3DProjLod(uniform_sampler3D, vec4(0), float(0))
+ && vec4(0) == textureCube(uniform_samplerCube, vec3(0))
+ && vec4(0) == textureCube(uniform_samplerCube, vec3(0), float(0))
+ && vec4(0) == textureCubeLod(uniform_samplerCube, vec3(0), float(0))
+ && vec4(0) == shadow1D(uniform_sampler1DShadow, vec3(0))
+ && vec4(0) == shadow1D(uniform_sampler1DShadow, vec3(0), float(0))
+ && vec4(0) == shadow2D(uniform_sampler2DShadow, vec3(0))
+ && vec4(0) == shadow2D(uniform_sampler2DShadow, vec3(0), float(0))
+ && vec4(0) == shadow1DProj(uniform_sampler1DShadow, vec4(0))
+ && vec4(0) == shadow1DProj(uniform_sampler1DShadow, vec4(0), float(0))
+ && vec4(0) == shadow2DProj(uniform_sampler2DShadow, vec4(0))
+ && vec4(0) == shadow2DProj(uniform_sampler2DShadow, vec4(0), float(0))
+ && vec4(0) == shadow1DLod(uniform_sampler1DShadow, vec3(0), float(0))
+ && vec4(0) == shadow2DLod(uniform_sampler2DShadow, vec3(0), float(0))
+ && vec4(0) == shadow1DProjLod(uniform_sampler1DShadow, vec4(0), float(0))
+ && vec4(0) == shadow2DProjLod(uniform_sampler2DShadow, vec4(0), float(0))
+ ;
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ // CHECK_GLSL: void main(
+ // CHECK_SPV: OpEntryPoint
+ // CHECK_HLSL: void computeMain(
+ // CHECK_CUDA: void computeMain(
+ // CHECK_CPP: void _computeMain(
+
+ bool r = true
+ && textureFuncs(
+ uniform_sampler1D
+ , uniform_sampler2D
+ , uniform_sampler2DRect
+ , uniform_sampler3D
+ , uniform_samplerCube
+ , uniform_sampler1DArray
+ , uniform_sampler2DArray
+ , uniform_samplerCubeArray
+ , uniform_samplerBuffer
+#if defined(TEST_when_multisampling_works)
+ , uniform_sampler2DMS
+ , uniform_sampler2DMSArray
+#endif // #if defined(TEST_when_multisampling_works)
+ )
+ && textureFuncs(
+ uniform_isampler1D
+ , uniform_isampler2D
+ , uniform_isampler2DRect
+ , uniform_isampler3D
+ , uniform_isamplerCube
+ , uniform_isampler1DArray
+ , uniform_isampler2DArray
+ , uniform_isamplerCubeArray
+ , uniform_isamplerBuffer
+#if defined(TEST_when_multisampling_works)
+ , uniform_isampler2DMS
+ , uniform_isampler2DMSArray
+#endif // #if defined(TEST_when_multisampling_works)
+ )
+ && textureFuncs(
+ uniform_usampler1D
+ , uniform_usampler2D
+ , uniform_usampler2DRect
+ , uniform_usampler3D
+ , uniform_usamplerCube
+ , uniform_usampler1DArray
+ , 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);
+}
+