Store shader interface variables as per query spec
GLES 3.1 section 7.3.1.1 specifies how active variable entries should
be generated and how active variables are named. The specs for program
interface variable queries are built on top of this section.
ANGLE has already followed this spec for the most part for generating
variable lists in ProgramState, but now we also follow the naming spec
for arrays and include [0] at the end of the stored name.
This will make implementing arrays of arrays more straightforward.
Most logic for variable queries will just keep working as is when
arrays of arrays are added instead of needing more complex logic for
handling array indexing.
BUG=angleproject:2125
TEST=angle_end2end_tests
Change-Id: I3acd14253153e10bc312114b0303065da2efb506
Reviewed-on: https://chromium-review.googlesource.com/739826
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/queryutils.cpp b/src/libANGLE/queryutils.cpp
index 7270276..80667d9 100644
--- a/src/libANGLE/queryutils.cpp
+++ b/src/libANGLE/queryutils.cpp
@@ -453,15 +453,8 @@
case GL_NAME_LENGTH:
{
- size_t length = var.name.size();
- if (var.isArray())
- {
- // Counts "[0]".
- length += 3;
- }
// ES31 spec p84: This counts the terminating null char.
- ++length;
- return clampCast<GLint>(length);
+ return clampCast<GLint>(var.name.size() + 1u);
}
case GL_LOCATION:
@@ -1471,7 +1464,7 @@
return program->getFragDataLocation(name);
case GL_UNIFORM:
- return program->getState().getUniformLocation(name);
+ return program->getUniformLocation(name);
default:
UNREACHABLE();