diff options
author | Greg Fischer <greg@lunarg.com> | 2021-04-19 12:03:05 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 12:03:05 -0600 |
commit | 60ce877de03ff03bb87fb9ef6b744ee33d076034 (patch) | |
tree | 5c8c92f1dcb1c9eb3e6e1fff3129d6aa918acf77 | |
parent | 842743722152b400a73289b282c7460b5e041014 (diff) | |
parent | 12f3eb8e3fdfb042afd7386c080b0ed548b359ef (diff) | |
download | glslang-60ce877de03ff03bb87fb9ef6b744ee33d076034.tar.gz |
Merge pull request #2609 from ZhiqianXia/Feature2
TextureOffset not support sampler2DArrayShadow sampler until 430.
-rw-r--r-- | Test/baseResults/textureoffset_sampler2darrayshadow.vert.out | 63 | ||||
-rw-r--r-- | Test/textureoffset_sampler2darrayshadow.vert | 11 | ||||
-rw-r--r-- | glslang/Include/Types.h | 1 | ||||
-rw-r--r-- | glslang/MachineIndependent/ParseHelper.cpp | 10 | ||||
-rw-r--r-- | gtests/AST.FromFile.cpp | 1 |
5 files changed, 86 insertions, 0 deletions
diff --git a/Test/baseResults/textureoffset_sampler2darrayshadow.vert.out b/Test/baseResults/textureoffset_sampler2darrayshadow.vert.out new file mode 100644 index 00000000..44d8e975 --- /dev/null +++ b/Test/baseResults/textureoffset_sampler2darrayshadow.vert.out @@ -0,0 +1,63 @@ +textureoffset_sampler2darrayshadow.vert +ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile +ERROR: 1 compilation errors. No code generated. + + +Shader version: 300 +ERROR: node is still EOpNull! +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 move second child to first child ( temp highp 4-component vector of float) +0:9 'gl_Position' ( gl_Position highp 4-component vector of float Position) +0:9 Construct vec4 ( temp highp 4-component vector of float) +0:9 textureOffset ( global mediump float) +0:9 's' ( uniform mediump sampler2DArrayShadow) +0:9 Constant: +0:9 0.000000 +0:9 0.000000 +0:9 0.000000 +0:9 0.000000 +0:9 Constant: +0:9 0 (const int) +0:9 0 (const int) +0:10 move second child to first child ( temp highp 4-component vector of float) +0:10 'gl_Position' ( gl_Position highp 4-component vector of float Position) +0:10 'dEQP_Position' ( in highp 4-component vector of float) +0:? Linker Objects +0:? 'dEQP_Position' ( in highp 4-component vector of float) +0:? 's' ( uniform mediump sampler2DArrayShadow) +0:? 'gl_VertexID' ( gl_VertexId highp int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) + + +Linked vertex stage: + + +Shader version: 300 +ERROR: node is still EOpNull! +0:7 Function Definition: main( ( global void) +0:7 Function Parameters: +0:9 Sequence +0:9 move second child to first child ( temp highp 4-component vector of float) +0:9 'gl_Position' ( gl_Position highp 4-component vector of float Position) +0:9 Construct vec4 ( temp highp 4-component vector of float) +0:9 textureOffset ( global mediump float) +0:9 's' ( uniform mediump sampler2DArrayShadow) +0:9 Constant: +0:9 0.000000 +0:9 0.000000 +0:9 0.000000 +0:9 0.000000 +0:9 Constant: +0:9 0 (const int) +0:9 0 (const int) +0:10 move second child to first child ( temp highp 4-component vector of float) +0:10 'gl_Position' ( gl_Position highp 4-component vector of float Position) +0:10 'dEQP_Position' ( in highp 4-component vector of float) +0:? Linker Objects +0:? 'dEQP_Position' ( in highp 4-component vector of float) +0:? 's' ( uniform mediump sampler2DArrayShadow) +0:? 'gl_VertexID' ( gl_VertexId highp int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) + diff --git a/Test/textureoffset_sampler2darrayshadow.vert b/Test/textureoffset_sampler2darrayshadow.vert new file mode 100644 index 00000000..6ce2dbc3 --- /dev/null +++ b/Test/textureoffset_sampler2darrayshadow.vert @@ -0,0 +1,11 @@ +#version 300 es
+precision mediump float;
+in highp vec4 dEQP_Position;
+
+uniform mediump sampler2DArrayShadow s;
+
+void main()
+{
+ gl_Position = vec4(textureOffset(s, vec4(0), ivec2(0)));
+ gl_Position = dEQP_Position;
+}
diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index a3815caa..149ba761 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -115,6 +115,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler, #endif bool is1D() const { return dim == Esd1D; } + bool is2D() const { return dim == Esd2D; } bool isBuffer() const { return dim == EsdBuffer; } bool isRect() const { return dim == EsdRect; } bool isSubpass() const { return dim == EsdSubpass; } diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 0f5f2b81..45c9362b 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2191,6 +2191,16 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan "[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"); } } + + if (callNode.getOp() == EOpTextureOffset) { + TSampler s = arg0->getType().getSampler(); + if (s.is2D() && s.isArrayed() && s.isShadow()) { + if (isEsProfile()) + error(loc, "TextureOffset does not support sampler2DArrayShadow : ", "sampler", "ES Profile"); + else if (version <= 420) + error(loc, "TextureOffset does not support sampler2DArrayShadow : ", "sampler", "version <= 420"); + } + } } break; diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 8885b291..77f0aafb 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -281,6 +281,7 @@ INSTANTIATE_TEST_SUITE_P( "terminate.frag", "terminate.vert", "negativeWorkGroupSize.comp", + "textureoffset_sampler2darrayshadow.vert", })), FileNameAsCustomTestSuffix ); |