aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2015-03-02 18:44:00 +0100
committerFredrik Höglund <[email protected]>2015-05-08 15:31:03 +0200
commitf0030b0f1fd6f8c7790e28e65ead3af6c3bab3eb (patch)
tree79d67748c61a4844f875390217869f1a564ba9e1 /src/mesa/main/varray.c
parentfa350eadfbe892c21be30d945fa6d61f09541cae (diff)
mesa: Implement VertexArrayAttrib[I|L]Format
Reviewed-by: Laura Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 4b506ea39c4..6d617caa021 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1876,6 +1876,85 @@ _mesa_VertexAttribLFormat(GLuint attribIndex, GLint size, GLenum type,
}
+static void
+vertex_array_attrib_format(GLuint vaobj, GLuint attribIndex, GLint size,
+ GLenum type, GLboolean normalized,
+ GLboolean integer, GLboolean doubles,
+ GLbitfield legalTypes, GLsizei maxSize,
+ GLuint relativeOffset, const char *func)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_vertex_array_object *vao;
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ /* The ARB_direct_state_access spec says:
+ *
+ * "An INVALID_OPERATION error is generated by VertexArrayAttrib*Format
+ * if <vaobj> is not [compatibility profile: zero or] the name of an
+ * existing vertex array object."
+ */
+ vao = _mesa_lookup_vao_err(ctx, vaobj, func);
+ if (!vao)
+ return;
+
+ /* The ARB_vertex_attrib_binding spec says:
+ *
+ * "The error INVALID_VALUE is generated if index is greater than or equal
+ * to the value of MAX_VERTEX_ATTRIBS."
+ */
+ if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(attribindex=%u > GL_MAX_VERTEX_ATTRIBS)",
+ func, attribIndex);
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, 0);
+
+ update_array_format(ctx, func, vao,
+ VERT_ATTRIB_GENERIC(attribIndex),
+ legalTypes, 1, maxSize, size, type, normalized,
+ integer, doubles, relativeOffset);
+}
+
+
+void GLAPIENTRY
+_mesa_VertexArrayAttribFormat(GLuint vaobj, GLuint attribIndex, GLint size,
+ GLenum type, GLboolean normalized,
+ GLuint relativeOffset)
+{
+ vertex_array_attrib_format(vaobj, attribIndex, size, type, normalized,
+ GL_FALSE, GL_FALSE, ATTRIB_FORMAT_TYPES_MASK,
+ BGRA_OR_4, relativeOffset,
+ "glVertexArrayAttribFormat");
+}
+
+
+void GLAPIENTRY
+_mesa_VertexArrayAttribIFormat(GLuint vaobj, GLuint attribIndex,
+ GLint size, GLenum type,
+ GLuint relativeOffset)
+{
+ vertex_array_attrib_format(vaobj, attribIndex, size, type, GL_FALSE,
+ GL_TRUE, GL_FALSE, ATTRIB_IFORMAT_TYPES_MASK,
+ 4, relativeOffset,
+ "glVertexArrayAttribIFormat");
+}
+
+
+void GLAPIENTRY
+_mesa_VertexArrayAttribLFormat(GLuint vaobj, GLuint attribIndex,
+ GLint size, GLenum type,
+ GLuint relativeOffset)
+{
+ vertex_array_attrib_format(vaobj, attribIndex, size, type, GL_FALSE,
+ GL_FALSE, GL_TRUE, ATTRIB_LFORMAT_TYPES_MASK,
+ 4, relativeOffset,
+ "glVertexArrayAttribLFormat");
+}
+
+
void GLAPIENTRY
_mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
{