ShaderVariable: separate fields for staticUse and active
Thus far the compiler has used the "staticUse" flag to mark variables
that should have rather been marked "active", meaning that the code
may actually execute in a way that accesses the variable. There's a
clear definition for this use of the term "active" in the GLES 3.0.5
spec, section 2.12.6, and in GLES 3.1 section 7.3.1.
Having separate fields for recording static use and "activeness" of a
variable is the first step to fixing this.
According to the spec, usually only active resources should be
considered when checking use against max limits. Also, only active
uniforms get assigned a location. libANGLE code now correctly checks
the active flag rather than the static use flag in these cases.
The static use field still mirrors the active field for now, since
some code in Chromium also needs to be fixed to use the active field
correctly before the two can diverge.
After Chromium is fixed, we can fix ANGLE so that static use
information is recorded earlier during compilation and will accurately
reflect whether variables are statically used. Currently the compiler
only records variables once some static use may already have been
pruned from the AST.
BUG=angleproject:2262
TEST=angle_unittests, angle_end2end_tests
Change-Id: I025bb71361246ae00c911a1f8b66ec045f665f29
Reviewed-on: https://chromium-review.googlesource.com/970962
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 8e1abb9..a05b6f1 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -213,7 +213,7 @@
GLuint blockCount = 0;
for (const sh::InterfaceBlock &block : interfaceBlocks)
{
- if (block.staticUse || block.layout != sh::BLOCKLAYOUT_PACKED)
+ if (block.active || block.layout != sh::BLOCKLAYOUT_PACKED)
{
blockCount += (block.arraySize ? block.arraySize : 1);
if (blockCount > maxInterfaceBlocks)
@@ -646,7 +646,7 @@
bool IsActiveInterfaceBlock(const sh::InterfaceBlock &interfaceBlock)
{
// Only 'packed' blocks are allowed to be considered inactive.
- return interfaceBlock.staticUse || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED;
+ return interfaceBlock.active || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED;
}
// VariableLocation implementation.
@@ -2440,7 +2440,9 @@
}
}
- // We permit unmatched, unreferenced varyings
+ // We permit unmatched, unreferenced varyings. Note that this specifically depends on
+ // whether the input is statically used - a statically used input should fail this test even
+ // if it is not active. GLSL ES 3.00.6 section 4.3.10.
if (!matched && input.staticUse)
{
infoLog << GetShaderTypeString(consumingShader->getType()) << " varying " << input.name