Program: Fixed unreferenced Samplers.
The calculation for unreferenced was incorrect - it checked the 'used'
flag of the uniform location, but if samplers started at index zero,
all the unused uniforms were to be considered valid samplers. Instead,
initialize the uniform index to INVALID_INDEX.
This bug was uncovered after doing work on the Texture dirty bits.
BUG=angleproject:1387
Change-Id: I5e404e367caed38368bcc0e581699ae2c911bcc9
Reviewed-on: https://chromium-review.googlesource.com/655930
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index fc39b40..0c5ad19 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -266,7 +266,8 @@
{
}
-VariableLocation::VariableLocation() : name(), element(0), index(0), used(false), ignored(false)
+VariableLocation::VariableLocation()
+ : name(), element(0), index(GL_INVALID_INDEX), used(false), ignored(false)
{
}
diff --git a/src/libANGLE/Program.h b/src/libANGLE/Program.h
index e3e20bd..34601f9 100644
--- a/src/libANGLE/Program.h
+++ b/src/libANGLE/Program.h
@@ -142,7 +142,9 @@
unsigned int element;
unsigned int index;
- // If this is a valid uniform location
+ // If used is false, it means this location is only used to fill an empty space in an array,
+ // and there is no corresponding uniform variable for this location. It can also mean the
+ // uniform was optimized out by the implementation.
bool used;
// If this location was bound to an unreferenced uniform. Setting data on this uniform is a