OSDN Git Service

Fix attribute location binding
authorAlexis Hetu <sugoi@google.com>
Tue, 5 Dec 2017 21:03:51 +0000 (16:03 -0500)
committerAlexis Hétu <sugoi@google.com>
Wed, 6 Dec 2017 16:34:07 +0000 (16:34 +0000)
commit23f54d74e1e613a0e90e79056e96cb8a339373a8
tree9f9751f2b08c18ace206e8159026d492cdcfb2af
parentc61f46b8f057aec5bffb87d4619b2994c0105857
Fix attribute location binding

- Attribute location aliasing was allowed prior to shader
  version 300, so location aliasing is now possible.
- Attribute binding refers to the linked location of attributes,
  so locations set using glBindAttribLocation() will only be
  returned by glGetAttribLocation() after the program is linked.
  Before that, it will return the location allocated during the
  previous glLinkProgram() call.

In order to do that, an extra map was added.
"linkedAttributeLocation" represents the attributes' location,
as a result of linking a program.
"attributeBinding" represents the attributes' future location,
when the next program linking occurs.

On top of that, the shader's version was not being passed down
from TranslatorASM to es2::Shader, or from es2::Shader to Program,
so this information also needed to be properly transferred.

Fixes all failures in:
dEQP-GLES3.functional.attribute_location*

Change-Id: I4ba7dc7c2f6d444e805cadeb5445f5ff371c3d95
Reviewed-on: https://swiftshader-review.googlesource.com/14568
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
src/OpenGL/compiler/OutputASM.h
src/OpenGL/libGLESv2/Program.cpp
src/OpenGL/libGLESv2/Program.h
src/OpenGL/libGLESv2/Shader.cpp