diff options
author | Anuj Phogat <[email protected]> | 2014-03-28 17:44:59 -0700 |
---|---|---|
committer | Anuj Phogat <[email protected]> | 2014-05-01 10:58:39 -0700 |
commit | 49c71050de1e0df451e29621558b4adfefb7e098 (patch) | |
tree | 74e3aa8852bc084d4ddb335100a9317c6b32291e /src/mesa/vbo | |
parent | dc75479b7a7b9207d9d7c9487085ad14fa5d26cc (diff) |
mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0
In OpenGL 3.1 attribute 0 becomes non-magic, just like in
OpenGL ES 2.0. Earlier versions of OpenGL used attribute 0
exclusively for vertex position.
V2: Add a utility function _mesa_attr_zero_aliases_vertex() in
varray.h
Fixes 4 Khronos OpenGL CTS failures:
glGetVertexAttrib
depth24_basic
depth24_precision
rgb8_rgba8_rgb
Cc: <[email protected]>
Signed-off-by: Anuj Phogat <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_attrib_tmp.h | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index a2ea6d0c833..ec66934fc4e 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -26,6 +26,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ #include "util/u_format_r11g11b10f.h" +#include "main/varray.h" /* float */ #define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 ) @@ -499,7 +500,7 @@ static void GLAPIENTRY TAG(VertexAttrib1fARB)(GLuint index, GLfloat x) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR1F(0, x); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1F(VBO_ATTRIB_GENERIC0 + index, x); @@ -511,7 +512,7 @@ static void GLAPIENTRY TAG(VertexAttrib1fvARB)(GLuint index, const GLfloat * v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR1FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -523,7 +524,7 @@ static void GLAPIENTRY TAG(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR2F(0, x, y); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y); @@ -535,7 +536,7 @@ static void GLAPIENTRY TAG(VertexAttrib2fvARB)(GLuint index, const GLfloat * v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR2FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -547,7 +548,7 @@ static void GLAPIENTRY TAG(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR3F(0, x, y, z); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z); @@ -559,7 +560,7 @@ static void GLAPIENTRY TAG(VertexAttrib3fvARB)(GLuint index, const GLfloat * v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR3FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -571,7 +572,7 @@ static void GLAPIENTRY TAG(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR4F(0, x, y, z, w); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); @@ -583,7 +584,7 @@ static void GLAPIENTRY TAG(VertexAttrib4fvARB)(GLuint index, const GLfloat * v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR4FV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v); @@ -600,7 +601,7 @@ static void GLAPIENTRY TAG(VertexAttribI1i)(GLuint index, GLint x) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR1I(0, x); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1I(VBO_ATTRIB_GENERIC0 + index, x); @@ -612,7 +613,7 @@ static void GLAPIENTRY TAG(VertexAttribI2i)(GLuint index, GLint x, GLint y) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR2I(0, x, y); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2I(VBO_ATTRIB_GENERIC0 + index, x, y); @@ -624,7 +625,7 @@ static void GLAPIENTRY TAG(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR3I(0, x, y, z); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3I(VBO_ATTRIB_GENERIC0 + index, x, y, z); @@ -636,7 +637,7 @@ static void GLAPIENTRY TAG(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR4I(0, x, y, z, w); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4I(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); @@ -648,7 +649,7 @@ static void GLAPIENTRY TAG(VertexAttribI2iv)(GLuint index, const GLint *v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR2IV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2IV(VBO_ATTRIB_GENERIC0 + index, v); @@ -660,7 +661,7 @@ static void GLAPIENTRY TAG(VertexAttribI3iv)(GLuint index, const GLint *v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR3IV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3IV(VBO_ATTRIB_GENERIC0 + index, v); @@ -672,7 +673,7 @@ static void GLAPIENTRY TAG(VertexAttribI4iv)(GLuint index, const GLint *v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR4IV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4IV(VBO_ATTRIB_GENERIC0 + index, v); @@ -689,7 +690,7 @@ static void GLAPIENTRY TAG(VertexAttribI1ui)(GLuint index, GLuint x) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR1UI(0, x); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1UI(VBO_ATTRIB_GENERIC0 + index, x); @@ -701,7 +702,7 @@ static void GLAPIENTRY TAG(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR2UI(0, x, y); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2UI(VBO_ATTRIB_GENERIC0 + index, x, y); @@ -713,7 +714,7 @@ static void GLAPIENTRY TAG(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR3UI(0, x, y, z); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3UI(VBO_ATTRIB_GENERIC0 + index, x, y, z); @@ -725,7 +726,7 @@ static void GLAPIENTRY TAG(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR4UI(0, x, y, z, w); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4UI(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); @@ -737,7 +738,7 @@ static void GLAPIENTRY TAG(VertexAttribI2uiv)(GLuint index, const GLuint *v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR2UIV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2UIV(VBO_ATTRIB_GENERIC0 + index, v); @@ -749,7 +750,7 @@ static void GLAPIENTRY TAG(VertexAttribI3uiv)(GLuint index, const GLuint *v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR3UIV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3UIV(VBO_ATTRIB_GENERIC0 + index, v); @@ -761,7 +762,7 @@ static void GLAPIENTRY TAG(VertexAttribI4uiv)(GLuint index, const GLuint *v) { GET_CURRENT_CONTEXT(ctx); - if (index == 0) + if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx)) ATTR4UIV(0, v); else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4UIV(VBO_ATTRIB_GENERIC0 + index, v); |