Commit 4671bcf0 by Tim Van Patten Committed by Commit Bot

Fix program interface queries for arrays and built-ins

Program interface queries for arrays should return an invalid index value for indices with leading zeroes. Program interface queries should return invalid locations for built-in variables. Bug: angleproject:3596 Test: KHR-GLES31.core.program_interface_query.* Change-Id: I484ab6e21dbe0c8a984e135ac947c4583a3fbfa2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2159646Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarTobin Ehlis <tobine@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
parent 913f4f42
...@@ -947,6 +947,13 @@ unsigned int ParseArrayIndex(const std::string &name, size_t *nameLengthWithoutA ...@@ -947,6 +947,13 @@ unsigned int ParseArrayIndex(const std::string &name, size_t *nameLengthWithoutA
indexIsValidDecimalNumber = false; indexIsValidDecimalNumber = false;
break; break;
} }
// Leading zeroes are invalid
if ((i == (open + 1)) && (name[i] == '0') && (name[i + 1] != ']'))
{
indexIsValidDecimalNumber = false;
break;
}
} }
if (indexIsValidDecimalNumber) if (indexIsValidDecimalNumber)
{ {
......
...@@ -2176,6 +2176,11 @@ GLuint Program::getOutputResourceMaxNameSize() const ...@@ -2176,6 +2176,11 @@ GLuint Program::getOutputResourceMaxNameSize() const
GLuint Program::getResourceLocation(const GLchar *name, const sh::ShaderVariable &variable) const GLuint Program::getResourceLocation(const GLchar *name, const sh::ShaderVariable &variable) const
{ {
if (variable.isBuiltIn())
{
return GL_INVALID_INDEX;
}
GLint location = variable.location; GLint location = variable.location;
if (variable.isArray()) if (variable.isArray())
{ {
......
...@@ -676,7 +676,7 @@ GLint GetInputResourceProperty(const Program *program, GLuint index, GLenum prop ...@@ -676,7 +676,7 @@ GLint GetInputResourceProperty(const Program *program, GLuint index, GLenum prop
return clampCast<GLint>(program->getInputResourceName(index).size() + 1u); return clampCast<GLint>(program->getInputResourceName(index).size() + 1u);
case GL_LOCATION: case GL_LOCATION:
return variable.location; return variable.isBuiltIn() ? GL_INVALID_INDEX : variable.location;
// The query is targeted at the set of active input variables used by the first shader stage // The query is targeted at the set of active input variables used by the first shader stage
// of program. If program contains multiple shader stages then input variables from any // of program. If program contains multiple shader stages then input variables from any
......
...@@ -39,9 +39,6 @@ ...@@ -39,9 +39,6 @@
// Separate shader objects: // Separate shader objects:
3570 VULKAN : KHR-GLES31.core.sepshaderobjs.StateInteraction = SKIP 3570 VULKAN : KHR-GLES31.core.sepshaderobjs.StateInteraction = SKIP
// Program interface query.
3596 VULKAN : KHR-GLES31.core.program_interface_query.* = FAIL
// Image related failures // Image related failures
4315 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-memory-order-vsfs = FAIL 4315 VULKAN : KHR-GLES31.core.shader_image_load_store.advanced-memory-order-vsfs = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment