ES31: Implement gl_in in Geometry Shader
This patch intends to implement geometry shader built-in interface
block instance gl_in defined in GL_OES_geometry_shader.
1. Add the definition of gl_in and its interface block gl_PerVertex
into the symbol table.
2. Support gl_Position as a member of gl_in.
3. Set the array size of gl_in when a valid input primitive type is
known.
4. Add check that it should be a compile error to index gl_in or
call length() on gl_in without a valid input primitive declaration.
This patch also adds unit tests to cover all these new features.
BUG=angleproject:1941
TEST=angle_unittests
Change-Id: I8da20c943b29c9ce904834625b396aab6302e1e1
Reviewed-on: https://chromium-review.googlesource.com/605059
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index ef8141f..8ef6285 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -475,8 +475,8 @@
{
ASSERT(!variablesCollected);
CollectVariables(root, &attributes, &outputVariables, &uniforms, &inputVaryings,
- &outputVaryings, &uniformBlocks, &shaderStorageBlocks, hashFunction,
- &symbolTable, shaderVersion, extensionBehavior);
+ &outputVaryings, &uniformBlocks, &shaderStorageBlocks, &inBlocks,
+ hashFunction, &symbolTable, shaderVersion, extensionBehavior);
collectInterfaceBlocks();
variablesCollected = true;
if (compileOptions & SH_USE_UNUSED_STANDARD_SHARED_BLOCKS)
@@ -751,10 +751,11 @@
void TCompiler::collectInterfaceBlocks()
{
ASSERT(interfaceBlocks.empty());
- interfaceBlocks.reserve(uniformBlocks.size() + shaderStorageBlocks.size());
+ interfaceBlocks.reserve(uniformBlocks.size() + shaderStorageBlocks.size() + inBlocks.size());
interfaceBlocks.insert(interfaceBlocks.end(), uniformBlocks.begin(), uniformBlocks.end());
interfaceBlocks.insert(interfaceBlocks.end(), shaderStorageBlocks.begin(),
shaderStorageBlocks.end());
+ interfaceBlocks.insert(interfaceBlocks.end(), inBlocks.begin(), inBlocks.end());
}
void TCompiler::clearResults()
@@ -773,6 +774,7 @@
interfaceBlocks.clear();
uniformBlocks.clear();
shaderStorageBlocks.clear();
+ inBlocks.clear();
variablesCollected = false;
mGLPositionInitialized = false;