diff options
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_attrib_tmp.h | 32 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_exec_array.c | 12 |
2 files changed, 32 insertions, 12 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h index bbc020539..358d12d15 100644 --- a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h +++ b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h @@ -25,6 +25,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ +#include "util/u_format_r11g11b10f.h" + /* float */ #define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 ) #define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 ) @@ -205,6 +207,10 @@ static inline float conv_i2_to_norm_float(const struct gl_context *ctx, int i2) } else { \ ATTRI10_##val((attr), (arg)); \ } \ + } else if ((type) == GL_UNSIGNED_INT_10F_11F_11F_REV) { \ + float res[4]; \ + r11g11b10f_to_float3((arg), res); \ + ATTR##val##FV((attr), res); \ } else \ ERROR(GL_INVALID_VALUE); \ } while(0) @@ -835,12 +841,26 @@ TAG(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) ATTR4FV(index, v); } + #define ERROR_IF_NOT_PACKED_TYPE(ctx, type, func) \ if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV) { \ _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \ return; \ } +/* Extended version of ERROR_IF_NOT_PACKED_TYPE which also + * accepts GL_UNSIGNED_INT_10F_11F_11F_REV. + * + * Only used for VertexAttribP[123]ui[v]; VertexAttribP4* cannot use this type, + * and neither can legacy vertex attribs. + */ +#define ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, func) \ + if (type != GL_INT_2_10_10_10_REV && type != GL_UNSIGNED_INT_2_10_10_10_REV && \ + type != GL_UNSIGNED_INT_10F_11F_11F_REV) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "%s(type)", func); \ + return; \ + } + static void GLAPIENTRY TAG(VertexP2ui)(GLenum type, GLuint value) { @@ -1094,7 +1114,7 @@ TAG(VertexAttribP1ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) { GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP1ui"); + ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1ui"); ATTR_UI_INDEX(ctx, 1, type, normalized, index, value); } @@ -1103,7 +1123,7 @@ TAG(VertexAttribP2ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) { GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP2ui"); + ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2ui"); ATTR_UI_INDEX(ctx, 2, type, normalized, index, value); } @@ -1112,7 +1132,7 @@ TAG(VertexAttribP3ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) { GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP3ui"); + ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3ui"); ATTR_UI_INDEX(ctx, 3, type, normalized, index, value); } @@ -1130,7 +1150,7 @@ TAG(VertexAttribP1uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP1uiv"); + ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1uiv"); ATTR_UI_INDEX(ctx, 1, type, normalized, index, *value); } @@ -1139,7 +1159,7 @@ TAG(VertexAttribP2uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP2uiv"); + ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2uiv"); ATTR_UI_INDEX(ctx, 2, type, normalized, index, *value); } @@ -1148,7 +1168,7 @@ TAG(VertexAttribP3uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP3uiv"); + ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3uiv"); ATTR_UI_INDEX(ctx, 3, type, normalized, index, *value); } diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index f25a9dec3..d72382376 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -318,8 +318,8 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, } /* check element j of each enabled array */ - for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { - check_array_data(ctx, &arrayObj->VertexAttrib[k], k, j); + for (k = 0; k < Elements(arrayObj->_VertexAttrib); k++) { + check_array_data(ctx, &arrayObj->_VertexAttrib[k], k, j); } } @@ -327,8 +327,8 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj); } - for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { - unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]); + for (k = 0; k < Elements(arrayObj->_VertexAttrib); k++) { + unmap_array_buffer(ctx, &arrayObj->_VertexAttrib[k]); } } @@ -368,7 +368,7 @@ print_draw_arrays(struct gl_context *ctx, exec->array.inputs[i]->Size, stride, /*exec->array.inputs[i]->Enabled,*/ - arrayObj->VertexAttrib[VERT_ATTRIB_FF(i)].Enabled, + arrayObj->_VertexAttrib[VERT_ATTRIB_FF(i)].Enabled, exec->array.inputs[i]->Ptr, bufName); @@ -405,7 +405,7 @@ recalculate_input_bindings(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_client_array *vertexAttrib = ctx->Array.ArrayObj->VertexAttrib; + struct gl_client_array *vertexAttrib = ctx->Array.ArrayObj->_VertexAttrib; const struct gl_client_array **inputs = &exec->array.inputs[0]; GLbitfield64 const_inputs = 0x0; GLuint i; |