diff options
author | Marek Olšák <[email protected]> | 2020-03-08 18:47:56 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-19 23:24:08 +0000 |
commit | 98d11972334186b1b5ede148e32ac7758be56ce4 (patch) | |
tree | 853a3ac30e0a66125519411d1d9d86713509a7fb /src | |
parent | 3252041a7872c49e53bb02ffe8b079b5fc43f15e (diff) |
mesa: use vbo_attrib_tmp.h to generate display list vertex attrib functions
This removes about 1150 lines of code.
The diff is messy, but the new code really starts with save_Attr32bit and
below. Ignore false Eval/Material/Begin changes etc. Git can't figure out
what was really changed. I didn't change them.
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4123>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/dlist.c | 1481 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 10 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/vtxfmt.c | 2 |
4 files changed, 177 insertions, 1318 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f1aee16d587..0fe027f0afc 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5901,188 +5901,6 @@ save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value) } static void GLAPIENTRY -save_Attr1fNV(GLenum attr, GLfloat x) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2); - if (n) { - n[1].e = attr; - n[2].f = x; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 1; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib1fNV(ctx->Exec, (attr, x)); - } -} - -static void GLAPIENTRY -save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3); - if (n) { - n[1].e = attr; - n[2].f = x; - n[3].f = y; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 2; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y)); - } -} - -static void GLAPIENTRY -save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4); - if (n) { - n[1].e = attr; - n[2].f = x; - n[3].f = y; - n[4].f = z; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 3; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z)); - } -} - -static void GLAPIENTRY -save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5); - if (n) { - n[1].e = attr; - n[2].f = x; - n[3].f = y; - n[4].f = z; - n[5].f = w; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 4; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w)); - } -} - - -static void GLAPIENTRY -save_Attr1fARB(GLenum attr, GLfloat x) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2); - if (n) { - n[1].e = attr; - n[2].f = x; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 1; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib1fARB(ctx->Exec, (attr, x)); - } -} - -static void GLAPIENTRY -save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3); - if (n) { - n[1].e = attr; - n[2].f = x; - n[3].f = y; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 2; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y)); - } -} - -static void GLAPIENTRY -save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4); - if (n) { - n[1].e = attr; - n[2].f = x; - n[3].f = y; - n[4].f = z; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 3; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z)); - } -} - -static void GLAPIENTRY -save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5); - if (n) { - n[1].e = attr; - n[2].f = x; - n[3].f = y; - n[4].f = z; - n[5].f = w; - } - - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - ctx->ListState.ActiveAttribSize[attr] = 4; - ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); - - if (ctx->ExecuteFlag) { - CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w)); - } -} - - -static void GLAPIENTRY save_EvalCoord1f(GLfloat x) { GET_CURRENT_CONTEXT(ctx); @@ -6157,24 +5975,6 @@ save_EvalPoint2(GLint x, GLint y) } } -static void GLAPIENTRY -save_Indexf(GLfloat x) -{ - save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x); -} - -static void GLAPIENTRY -save_Indexfv(const GLfloat * v) -{ - save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]); -} - -static void GLAPIENTRY -save_EdgeFlag(GLboolean x) -{ - save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f); -} - /** * Compare 'count' elements of vectors 'a' and 'b'. @@ -6317,1122 +6117,6 @@ save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d) } } - -static void GLAPIENTRY -save_Vertex2f(GLfloat x, GLfloat y) -{ - save_Attr2fNV(VERT_ATTRIB_POS, x, y); -} - -static void GLAPIENTRY -save_Vertex2fv(const GLfloat * v) -{ - save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]); -} - -static void GLAPIENTRY -save_Vertex3f(GLfloat x, GLfloat y, GLfloat z) -{ - save_Attr3fNV(VERT_ATTRIB_POS, x, y, z); -} - -static void GLAPIENTRY -save_Vertex3fv(const GLfloat * v) -{ - save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w); -} - -static void GLAPIENTRY -save_Vertex4fv(const GLfloat * v) -{ - save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -save_TexCoord1f(GLfloat x) -{ - save_Attr1fNV(VERT_ATTRIB_TEX0, x); -} - -static void GLAPIENTRY -save_TexCoord1fv(const GLfloat * v) -{ - save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]); -} - -static void GLAPIENTRY -save_TexCoord2f(GLfloat x, GLfloat y) -{ - save_Attr2fNV(VERT_ATTRIB_TEX0, x, y); -} - -static void GLAPIENTRY -save_TexCoord2fv(const GLfloat * v) -{ - save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]); -} - -static void GLAPIENTRY -save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z) -{ - save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z); -} - -static void GLAPIENTRY -save_TexCoord3fv(const GLfloat * v) -{ - save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w); -} - -static void GLAPIENTRY -save_TexCoord4fv(const GLfloat * v) -{ - save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -save_Normal3f(GLfloat x, GLfloat y, GLfloat z) -{ - save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z); -} - -static void GLAPIENTRY -save_Normal3fv(const GLfloat * v) -{ - save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_FogCoordfEXT(GLfloat x) -{ - save_Attr1fNV(VERT_ATTRIB_FOG, x); -} - -static void GLAPIENTRY -save_FogCoordfvEXT(const GLfloat * v) -{ - save_Attr1fNV(VERT_ATTRIB_FOG, v[0]); -} - -static void GLAPIENTRY -save_Color3f(GLfloat x, GLfloat y, GLfloat z) -{ - save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z); -} - -static void GLAPIENTRY -save_Color3fv(const GLfloat * v) -{ - save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w); -} - -static void GLAPIENTRY -save_Color4fv(const GLfloat * v) -{ - save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z) -{ - save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z); -} - -static void GLAPIENTRY -save_SecondaryColor3fvEXT(const GLfloat * v) -{ - save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]); -} - - -/** - * Record a GL_INVALID_VALUE error when an invalid vertex attribute - * index is found. - */ -static void -index_error(void) -{ - GET_CURRENT_CONTEXT(ctx); - _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)"); -} - -#define ATTR1F( A, X ) save_Attr1fNV(A, X) -#define ATTR2F( A, X, Y ) save_Attr2fNV(A, X, Y) -#define ATTR3F( A, X, Y, Z ) save_Attr3fNV(A, X, Y, Z) -#define ATTR4F( A, X, Y, Z, W ) save_Attr4fNV(A, X, Y, Z, W) - -#define ATTR1FV( A, V ) save_Attr1fNV(A, V[0]) -#define ATTR2FV( A, V ) save_Attr2fNV(A, V[0], V[1]) -#define ATTR3FV( A, V ) save_Attr3fNV(A, V[0], V[0], V[2]) -#define ATTR4FV( A, V ) save_Attr4fNV(A, V[0], V[1], V[2], V[3]) - -#define ATTRUI10_1( A, UI ) ATTR1F( A, (UI) & 0x3ff) -#define ATTRUI10_2( A, UI ) ATTR2F( A, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff) -#define ATTRUI10_3( A, UI ) ATTR3F( A, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff) -#define ATTRUI10_4( A, UI ) ATTR4F( A, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, ((UI) >> 30) & 0x3 ) - -#define ATTRUI10N_1( A, UI ) ATTR1F( A, conv_ui10_to_norm_float((UI) & 0x3ff)) -#define ATTRUI10N_2( A, UI ) ATTR2F( A, \ - conv_ui10_to_norm_float((UI) & 0x3ff), \ - conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff)) -#define ATTRUI10N_3( A, UI ) ATTR3F( A, \ - conv_ui10_to_norm_float((UI) & 0x3ff), \ - conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \ - conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff)) -#define ATTRUI10N_4( A, UI ) ATTR4F( A, \ - conv_ui10_to_norm_float((UI) & 0x3ff), \ - conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \ - conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), \ - conv_ui2_to_norm_float(((UI) >> 30) & 0x3) ) - -#define ATTRI10_1( A, I10 ) ATTR1F( A, conv_i10_to_i((I10) & 0x3ff)) -#define ATTRI10_2( A, I10 ) ATTR2F( A, \ - conv_i10_to_i((I10) & 0x3ff), \ - conv_i10_to_i(((I10) >> 10) & 0x3ff)) -#define ATTRI10_3( A, I10 ) ATTR3F( A, \ - conv_i10_to_i((I10) & 0x3ff), \ - conv_i10_to_i(((I10) >> 10) & 0x3ff), \ - conv_i10_to_i(((I10) >> 20) & 0x3ff)) -#define ATTRI10_4( A, I10 ) ATTR4F( A, \ - conv_i10_to_i((I10) & 0x3ff), \ - conv_i10_to_i(((I10) >> 10) & 0x3ff), \ - conv_i10_to_i(((I10) >> 20) & 0x3ff), \ - conv_i2_to_i(((I10) >> 30) & 0x3)) - -#define ATTRI10N_1(ctx, A, I10) ATTR1F(A, conv_i10_to_norm_float(ctx, (I10) & 0x3ff)) -#define ATTRI10N_2(ctx, A, I10) ATTR2F(A, \ - conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \ - conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff)) -#define ATTRI10N_3(ctx, A, I10) ATTR3F(A, \ - conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \ - conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \ - conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff)) -#define ATTRI10N_4(ctx, A, I10) ATTR4F(A, \ - conv_i10_to_norm_float(ctx, (I10) & 0x3ff), \ - conv_i10_to_norm_float(ctx, ((I10) >> 10) & 0x3ff), \ - conv_i10_to_norm_float(ctx, ((I10) >> 20) & 0x3ff), \ - conv_i2_to_norm_float(ctx, ((I10) >> 30) & 0x3)) - -#define ATTR_UI(ctx, val, type, normalized, attr, arg) do { \ - if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \ - if (normalized) { \ - ATTRUI10N_##val((attr), (arg)); \ - } else { \ - ATTRUI10_##val((attr), (arg)); \ - } \ - } else if ((type) == GL_INT_2_10_10_10_REV) { \ - if (normalized) { \ - ATTRI10N_##val(ctx, (attr), (arg)); \ - } else { \ - ATTRI10_##val((attr), (arg)); \ - } \ - } else if ((type) == GL_UNSIGNED_INT_10F_11F_11F_REV) { \ - float res[4]; \ - res[3] = 1; \ - r11g11b10f_to_float3((arg), res); \ - ATTR##val##FV((attr), res); \ - } \ -} while(0) - -#define ATTR_UI_INDEX(ctx, val, type, normalized, index, arg) do { \ - if ((index) == 0 && _mesa_attr_zero_aliases_vertex(ctx)) { \ - ATTR_UI(ctx, val, (type), normalized, 0, (arg)); \ - } else if ((index) < MAX_VERTEX_GENERIC_ATTRIBS) { \ - ATTR_UI(ctx, val, (type), normalized, VERT_ATTRIB_GENERIC0 + (index), (arg)); \ - } else \ - index_error(); \ - } while(0) - -static void GLAPIENTRY -save_VertexP2ui(GLenum type, GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP2ui"); - ATTR_UI(ctx, 2, type, 0, VERT_ATTRIB_POS, value); -} - -static void GLAPIENTRY -save_VertexP2uiv(GLenum type, const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP2uiv"); - ATTR_UI(ctx, 2, type, 0, VERT_ATTRIB_POS, value[0]); -} - -static void GLAPIENTRY -save_VertexP3ui(GLenum type, GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP3ui"); - ATTR_UI(ctx, 3, type, 0, VERT_ATTRIB_POS, value); -} - -static void GLAPIENTRY -save_VertexP3uiv(GLenum type, const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP3uiv"); - ATTR_UI(ctx, 3, type, 0, VERT_ATTRIB_POS, value[0]); -} - -static void GLAPIENTRY -save_VertexP4ui(GLenum type, GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP4ui"); - ATTR_UI(ctx, 4, type, 0, VERT_ATTRIB_POS, value); -} - -static void GLAPIENTRY -save_VertexP4uiv(GLenum type, const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexP4uiv"); - ATTR_UI(ctx, 4, type, 0, VERT_ATTRIB_POS, value[0]); -} - -static void GLAPIENTRY -save_TexCoordP1ui(GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP1ui"); - ATTR_UI(ctx, 1, type, 0, VERT_ATTRIB_TEX0, coords); -} - -static void GLAPIENTRY -save_TexCoordP1uiv(GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP1uiv"); - ATTR_UI(ctx, 1, type, 0, VERT_ATTRIB_TEX0, coords[0]); -} - -static void GLAPIENTRY -save_TexCoordP2ui(GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP2ui"); - ATTR_UI(ctx, 2, type, 0, VERT_ATTRIB_TEX0, coords); -} - -static void GLAPIENTRY -save_TexCoordP2uiv(GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP2uiv"); - ATTR_UI(ctx, 2, type, 0, VERT_ATTRIB_TEX0, coords[0]); -} - -static void GLAPIENTRY -save_TexCoordP3ui(GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP3ui"); - ATTR_UI(ctx, 3, type, 0, VERT_ATTRIB_TEX0, coords); -} - -static void GLAPIENTRY -save_TexCoordP3uiv(GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP3uiv"); - ATTR_UI(ctx, 3, type, 0, VERT_ATTRIB_TEX0, coords[0]); -} - -static void GLAPIENTRY -save_TexCoordP4ui(GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP4ui"); - ATTR_UI(ctx, 4, type, 0, VERT_ATTRIB_TEX0, coords); -} - -static void GLAPIENTRY -save_TexCoordP4uiv(GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glTexCoordP4uiv"); - ATTR_UI(ctx, 4, type, 0, VERT_ATTRIB_TEX0, coords[0]); -} - -static void GLAPIENTRY -save_MultiTexCoordP1ui(GLenum target, GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP1ui"); - ATTR_UI(ctx, 1, type, 0, attr, coords); -} - -static void GLAPIENTRY -save_MultiTexCoordP1uiv(GLenum target, GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP1uiv"); - ATTR_UI(ctx, 1, type, 0, attr, coords[0]); -} - -static void GLAPIENTRY -save_MultiTexCoordP2ui(GLenum target, GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP2ui"); - ATTR_UI(ctx, 2, type, 0, attr, coords); -} - -static void GLAPIENTRY -save_MultiTexCoordP2uiv(GLenum target, GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP2uiv"); - ATTR_UI(ctx, 2, type, 0, attr, coords[0]); -} - -static void GLAPIENTRY -save_MultiTexCoordP3ui(GLenum target, GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP3ui"); - ATTR_UI(ctx, 3, type, 0, attr, coords); -} - -static void GLAPIENTRY -save_MultiTexCoordP3uiv(GLenum target, GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP3uiv"); - ATTR_UI(ctx, 3, type, 0, attr, coords[0]); -} - -static void GLAPIENTRY -save_MultiTexCoordP4ui(GLenum target, GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP4ui"); - ATTR_UI(ctx, 4, type, 0, attr, coords); -} - -static void GLAPIENTRY -save_MultiTexCoordP4uiv(GLenum target, GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glMultiTexCoordP4uiv"); - ATTR_UI(ctx, 4, type, 0, attr, coords[0]); -} - -static void GLAPIENTRY -save_NormalP3ui(GLenum type, GLuint coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glNormalP3ui"); - ATTR_UI(ctx, 3, type, 1, VERT_ATTRIB_NORMAL, coords); -} - -static void GLAPIENTRY -save_NormalP3uiv(GLenum type, const GLuint *coords) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glNormalP3uiv"); - ATTR_UI(ctx, 3, type, 1, VERT_ATTRIB_NORMAL, coords[0]); -} - -static void GLAPIENTRY -save_ColorP3ui(GLenum type, GLuint color) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP3ui"); - ATTR_UI(ctx, 3, type, 1, VERT_ATTRIB_COLOR0, color); -} - -static void GLAPIENTRY -save_ColorP3uiv(GLenum type, const GLuint *color) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP3uiv"); - ATTR_UI(ctx, 3, type, 1, VERT_ATTRIB_COLOR0, color[0]); -} - -static void GLAPIENTRY -save_ColorP4ui(GLenum type, GLuint color) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP4ui"); - ATTR_UI(ctx, 4, type, 1, VERT_ATTRIB_COLOR0, color); -} - -static void GLAPIENTRY -save_ColorP4uiv(GLenum type, const GLuint *color) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glColorP4uiv"); - ATTR_UI(ctx, 4, type, 1, VERT_ATTRIB_COLOR0, color[0]); -} - -static void GLAPIENTRY -save_SecondaryColorP3ui(GLenum type, GLuint color) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glSecondaryColorP3ui"); - ATTR_UI(ctx, 3, type, 1, VERT_ATTRIB_COLOR1, color); -} - -static void GLAPIENTRY -save_SecondaryColorP3uiv(GLenum type, const GLuint *color) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glSecondaryColorP3uiv"); - ATTR_UI(ctx, 3, type, 1, VERT_ATTRIB_COLOR1, color[0]); -} - -static void GLAPIENTRY -save_VertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, - GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1ui"); - ATTR_UI_INDEX(ctx, 1, type, normalized, index, value); -} - -static void GLAPIENTRY -save_VertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, - GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2ui"); - ATTR_UI_INDEX(ctx, 2, type, normalized, index, value); -} - -static void GLAPIENTRY -save_VertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, - GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3ui"); - ATTR_UI_INDEX(ctx, 3, type, normalized, index, value); -} - -static void GLAPIENTRY -save_VertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, - GLuint value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP4ui"); - ATTR_UI_INDEX(ctx, 4, type, normalized, index, value); -} - -static void GLAPIENTRY -save_VertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, - const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP1uiv"); - ATTR_UI_INDEX(ctx, 1, type, normalized, index, *value); -} - -static void GLAPIENTRY -save_VertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, - const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP2uiv"); - ATTR_UI_INDEX(ctx, 2, type, normalized, index, *value); -} - -static void GLAPIENTRY -save_VertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, - const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE_EXT(ctx, type, "glVertexAttribP3uiv"); - ATTR_UI_INDEX(ctx, 3, type, normalized, index, *value); -} - -static void GLAPIENTRY -save_VertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, - const GLuint *value) -{ - GET_CURRENT_CONTEXT(ctx); - ERROR_IF_NOT_PACKED_TYPE(ctx, type, "glVertexAttribP4uiv"); - ATTR_UI_INDEX(ctx, 4, type, normalized, index, *value); -} - - -/* Just call the respective ATTR for texcoord - */ -static void GLAPIENTRY -save_MultiTexCoord1f(GLenum target, GLfloat x) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr1fNV(attr, x); -} - -static void GLAPIENTRY -save_MultiTexCoord1fv(GLenum target, const GLfloat * v) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr1fNV(attr, v[0]); -} - -static void GLAPIENTRY -save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr2fNV(attr, x, y); -} - -static void GLAPIENTRY -save_MultiTexCoord2fv(GLenum target, const GLfloat * v) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr2fNV(attr, v[0], v[1]); -} - -static void GLAPIENTRY -save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr3fNV(attr, x, y, z); -} - -static void GLAPIENTRY -save_MultiTexCoord3fv(GLenum target, const GLfloat * v) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr3fNV(attr, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y, - GLfloat z, GLfloat w) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr4fNV(attr, x, y, z, w); -} - -static void GLAPIENTRY -save_MultiTexCoord4fv(GLenum target, const GLfloat * v) -{ - GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; - save_Attr4fNV(attr, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -save_VertexAttrib1fNV(GLuint index, GLfloat x) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr1fNV(index, x); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib1fvNV(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr1fNV(index, v[0]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr2fNV(index, x, y); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib2fvNV(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr2fNV(index, v[0], v[1]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr3fNV(index, x, y, z); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib3fvNV(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr3fNV(index, v[0], v[1], v[2]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, - GLfloat z, GLfloat w) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr4fNV(index, x, y, z, w); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib4fvNV(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr4fNV(index, v[0], v[1], v[2], v[3]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib1fARB(GLuint index, GLfloat x) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr1fARB(index, x); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib1fvARB(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr1fARB(index, v[0]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr2fARB(index, x, y); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib2fvARB(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr2fARB(index, v[0], v[1]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr3fARB(index, x, y, z); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib3fvARB(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr3fARB(index, v[0], v[1], v[2]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, - GLfloat w) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr4fARB(index, x, y, z, w); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_Attr4fARB(index, v[0], v[1], v[2], v[3]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttribL1d(GLuint index, GLdouble x) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_1D, 3); - if (n) { - n[1].ui = index; - ASSIGN_DOUBLE_TO_NODES(n, 2, x); - } - - ctx->ListState.ActiveAttribSize[index] = 1; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribL1d(ctx->Exec, (index, x)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribL1dv(GLuint index, const GLdouble *v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_VertexAttribL1d(index, v[0]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_2D, 5); - if (n) { - n[1].ui = index; - ASSIGN_DOUBLE_TO_NODES(n, 2, x); - ASSIGN_DOUBLE_TO_NODES(n, 4, y); - } - - ctx->ListState.ActiveAttribSize[index] = 2; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], - 2 * sizeof(GLdouble)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribL2d(ctx->Exec, (index, x, y)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribL2dv(GLuint index, const GLdouble *v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_VertexAttribL2d(index, v[0], v[1]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_3D, 7); - if (n) { - n[1].ui = index; - ASSIGN_DOUBLE_TO_NODES(n, 2, x); - ASSIGN_DOUBLE_TO_NODES(n, 4, y); - ASSIGN_DOUBLE_TO_NODES(n, 6, z); - } - - ctx->ListState.ActiveAttribSize[index] = 3; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], - 3 * sizeof(GLdouble)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribL3d(ctx->Exec, (index, x, y, z)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribL3dv(GLuint index, const GLdouble *v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_VertexAttribL3d(index, v[0], v[1], v[2]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, - GLdouble w) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_4D, 9); - if (n) { - n[1].ui = index; - ASSIGN_DOUBLE_TO_NODES(n, 2, x); - ASSIGN_DOUBLE_TO_NODES(n, 4, y); - ASSIGN_DOUBLE_TO_NODES(n, 6, z); - ASSIGN_DOUBLE_TO_NODES(n, 8, w); - } - - ctx->ListState.ActiveAttribSize[index] = 4; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], - 4 * sizeof(GLdouble)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribL4d(ctx->Exec, (index, x, y, z, w)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribL4dv(GLuint index, const GLdouble *v) -{ - if (index < MAX_VERTEX_GENERIC_ATTRIBS) - save_VertexAttribL4d(index, v[0], v[1], v[2], v[3]); - else - index_error(); -} - -static void GLAPIENTRY -save_VertexAttribI1i(GLuint index, GLint x) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_1I, 2); - if (n) { - n[1].ui = index; - n[2].i = x; - } - - ctx->ListState.ActiveAttribSize[index] = 1; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLint)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribI1iEXT(ctx->Exec, (index, x)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribI2i(GLuint index, GLint x, GLint y) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_2I, 3); - if (n) { - n[1].ui = index; - n[2].i = x; - n[3].i = y; - } - - ctx->ListState.ActiveAttribSize[index] = 1; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLint)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribI2iEXT(ctx->Exec, (index, x, y)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribI3i(GLuint index, GLint x, GLint y, GLint z) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_3I, 4); - if (n) { - n[1].ui = index; - n[2].i = x; - n[3].i = y; - n[4].i = z; - } - - ctx->ListState.ActiveAttribSize[index] = 1; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLint)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribI3iEXT(ctx->Exec, (index, x, y, z)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_3I, 5); - if (n) { - n[1].ui = index; - n[2].i = x; - n[3].i = y; - n[4].i = z; - n[5].i = w; - } - - ctx->ListState.ActiveAttribSize[index] = 1; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLint)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribI4iEXT(ctx->Exec, (index, x, y, z, w)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribI2iv(GLuint index, const GLint *v) -{ - save_VertexAttribI2i(index, v[0], v[1]); -} - -static void GLAPIENTRY -save_VertexAttribI3iv(GLuint index, const GLint *v) -{ - save_VertexAttribI3i(index, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_VertexAttribI4iv(GLuint index, const GLint *v) -{ - save_VertexAttribI4i(index, v[0], v[1], v[2], v[3]); -} - - - -static void GLAPIENTRY -save_VertexAttribI1ui(GLuint index, GLuint x) -{ - save_VertexAttribI1i(index, x); -} - -static void GLAPIENTRY -save_VertexAttribI2ui(GLuint index, GLuint x, GLuint y) -{ - save_VertexAttribI2i(index, x, y); -} - -static void GLAPIENTRY -save_VertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z) -{ - save_VertexAttribI3i(index, x, y, z); -} - -static void GLAPIENTRY -save_VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) -{ - save_VertexAttribI4i(index, x, y, z, w); -} - -static void GLAPIENTRY -save_VertexAttribI2uiv(GLuint index, const GLuint *v) -{ - save_VertexAttribI2i(index, v[0], v[1]); -} - -static void GLAPIENTRY -save_VertexAttribI3uiv(GLuint index, const GLuint *v) -{ - save_VertexAttribI3i(index, v[0], v[1], v[2]); -} - -static void GLAPIENTRY -save_VertexAttribI4uiv(GLuint index, const GLuint *v) -{ - save_VertexAttribI4i(index, v[0], v[1], v[2], v[3]); -} - -static void GLAPIENTRY -save_VertexAttribL1ui64ARB(GLuint index, GLuint64EXT x) -{ - GET_CURRENT_CONTEXT(ctx); - - if (index < MAX_VERTEX_GENERIC_ATTRIBS) { - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = alloc_instruction(ctx, OPCODE_ATTR_1UI64, 3); - if (n) { - n[1].ui = index; - ASSIGN_UINT64_TO_NODES(n, 2, x); - } - - ctx->ListState.ActiveAttribSize[index] = 1; - memcpy(ctx->ListState.CurrentAttrib[index], &n[2], sizeof(GLdouble)); - - if (ctx->ExecuteFlag) { - CALL_VertexAttribL1ui64ARB(ctx->Exec, (index, x)); - } - } else { - index_error(); - } -} - -static void GLAPIENTRY -save_VertexAttribL1ui64vARB(GLuint index, const GLuint64EXT *v) -{ - save_VertexAttribL1ui64ARB(index, v[0]); -} - - static void GLAPIENTRY save_PrimitiveRestartNV(void) { @@ -7658,6 +6342,171 @@ save_DispatchComputeIndirect(GLintptr indirect) "glDispatchComputeIndirect() during display list compile"); } +static void ALWAYS_INLINE +save_Attr32bit(struct gl_context *ctx, unsigned attr, unsigned size, + GLenum type, uint32_t x, uint32_t y, uint32_t z, uint32_t w) +{ + Node *n; + SAVE_FLUSH_VERTICES(ctx); + unsigned base_op; + unsigned index = attr; + + /* We don't care about GL_INT vs GL_UNSIGNED_INT. The idea is to get W=1 + * right for 3 or lower number of components, so only distinguish between + * FLOAT and INT. + */ + if (type == GL_FLOAT) { + if (attr >= VERT_ATTRIB_GENERIC0) { + base_op = OPCODE_ATTR_1F_ARB; + attr -= VERT_ATTRIB_GENERIC0; + } else { + base_op = OPCODE_ATTR_1F_NV; + } + } else { + base_op = OPCODE_ATTR_1I; + attr -= VERT_ATTRIB_GENERIC0; + } + + n = alloc_instruction(ctx, base_op + size - 1, 1 + size); + if (n) { + n[1].ui = attr; + n[2].ui = x; + if (size >= 2) n[3].ui = y; + if (size >= 3) n[4].ui = z; + if (size >= 4) n[5].ui = w; + } + + ctx->ListState.ActiveAttribSize[index] = size; + ASSIGN_4V(ctx->ListState.CurrentAttrib[index], x, y, z, w); + + if (ctx->ExecuteFlag) { + if (type == GL_FLOAT) { + if (base_op == OPCODE_ATTR_1F_NV) { + if (size == 4) + CALL_VertexAttrib4fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w))); + else if (size == 3) + CALL_VertexAttrib3fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z))); + else if (size == 2) + CALL_VertexAttrib2fNV(ctx->Exec, (attr, uif(x), uif(y))); + else + CALL_VertexAttrib1fNV(ctx->Exec, (attr, uif(x))); + } else { + if (size == 4) + CALL_VertexAttrib4fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w))); + else if (size == 3) + CALL_VertexAttrib3fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z))); + else if (size == 2) + CALL_VertexAttrib2fARB(ctx->Exec, (attr, uif(x), uif(y))); + else + CALL_VertexAttrib1fARB(ctx->Exec, (attr, uif(x))); + } + } else { + if (size == 4) + CALL_VertexAttribI4iEXT(ctx->Exec, (attr, x, y, z, w)); + else if (size == 3) + CALL_VertexAttribI3iEXT(ctx->Exec, (attr, x, y, z)); + else if (size == 2) + CALL_VertexAttribI2iEXT(ctx->Exec, (attr, x, y)); + else + CALL_VertexAttribI1iEXT(ctx->Exec, (attr, x)); + } + } +} + +static void ALWAYS_INLINE +save_Attr64bit(struct gl_context *ctx, unsigned attr, unsigned size, + GLenum type, uint64_t x, uint64_t y, uint64_t z, uint64_t w) +{ + Node *n; + SAVE_FLUSH_VERTICES(ctx); + unsigned base_op; + unsigned index = attr; + + if (type == GL_DOUBLE) { + base_op = OPCODE_ATTR_1D; + } else { + base_op = OPCODE_ATTR_1UI64; + assert(size == 1); + } + + attr -= VERT_ATTRIB_GENERIC0; + n = alloc_instruction(ctx, base_op + size - 1, 1 + size * 2); + if (n) { + n[1].ui = attr; + ASSIGN_UINT64_TO_NODES(n, 2, x); + if (size >= 2) ASSIGN_UINT64_TO_NODES(n, 4, y); + if (size >= 3) ASSIGN_UINT64_TO_NODES(n, 6, z); + if (size >= 4) ASSIGN_UINT64_TO_NODES(n, 8, w); + } + + ctx->ListState.ActiveAttribSize[index] = size; + memcpy(ctx->ListState.CurrentAttrib[index], &n[2], size * sizeof(uint64_t)); + + if (ctx->ExecuteFlag) { + uint64_t v[] = {x, y, z, w}; + if (type == GL_DOUBLE) { + if (size == 4) + CALL_VertexAttribL4dv(ctx->Exec, (attr, (GLdouble*)v)); + else if (size == 3) + CALL_VertexAttribL3dv(ctx->Exec, (attr, (GLdouble*)v)); + else if (size == 2) + CALL_VertexAttribL2dv(ctx->Exec, (attr, (GLdouble*)v)); + else + CALL_VertexAttribL1d(ctx->Exec, (attr, UINT64_AS_DOUBLE(x))); + } else { + CALL_VertexAttribL1ui64ARB(ctx->Exec, (attr, x)); + } + } +} + +/** + * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex? + * It depends on a few things, including whether we're inside or outside + * of glBegin/glEnd. + */ +static inline bool +is_vertex_position(const struct gl_context *ctx, GLuint index) +{ + return (index == 0 && + _mesa_attr_zero_aliases_vertex(ctx) && + _mesa_inside_dlist_begin_end(ctx)); +} + +/** + * This macro is used to implement all the glVertex, glColor, glTexCoord, + * glVertexAttrib, etc functions. + * \param A VBO_ATTRIB_x attribute index + * \param N attribute size (1..4) + * \param T type (GL_FLOAT, GL_DOUBLE, GL_INT, GL_UNSIGNED_INT) + * \param C cast type (uint32_t or uint64_t) + * \param V0, V1, v2, V3 attribute value + */ +#define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) \ +do { \ + if (sizeof(C) == 4) { \ + save_Attr32bit(ctx, A, N, T, V0, V1, V2, V3); \ + } else { \ + save_Attr64bit(ctx, A, N, T, V0, V1, V2, V3); \ + } \ +} while (0) + +#undef ERROR +#define ERROR(err) _mesa_error(ctx, err, __func__) +#define TAG(x) save_##x + +#define VBO_ATTRIB_POS VERT_ATTRIB_POS +#define VBO_ATTRIB_NORMAL VERT_ATTRIB_NORMAL +#define VBO_ATTRIB_COLOR0 VERT_ATTRIB_COLOR0 +#define VBO_ATTRIB_COLOR1 VERT_ATTRIB_COLOR1 +#define VBO_ATTRIB_FOG VERT_ATTRIB_FOG +#define VBO_ATTRIB_COLOR_INDEX VERT_ATTRIB_COLOR_INDEX +#define VBO_ATTRIB_EDGEFLAG VERT_ATTRIB_EDGEFLAG +#define VBO_ATTRIB_TEX0 VERT_ATTRIB_TEX0 +#define VBO_ATTRIB_GENERIC0 VERT_ATTRIB_GENERIC0 +#define VBO_ATTRIB_MAX VERT_ATTRIB_MAX + +#include "vbo/vbo_attrib_tmp.h" + static void GLAPIENTRY save_UseProgram(GLuint program) { diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 8b09e7b20e9..efdb0a09570 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -204,6 +204,16 @@ static inline uint64_t DOUBLE_AS_UINT64(double d) return tmp.u64; } +static inline double UINT64_AS_DOUBLE(uint64_t u) +{ + union { + double d; + uint64_t u64; + } tmp; + tmp.u64 = u; + return tmp.d; +} + /* First sign-extend x, then return uint32_t. */ #define INT_AS_UINT(x) ((uint32_t)((int32_t)(x))) #define FLOAT_AS_UINT(x) (FLOAT_AS_UNION(x).u) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c7889668f58..f267bb723ca 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4584,7 +4584,7 @@ struct gl_dlist_state GLvertexformat ListVtxfmt; GLubyte ActiveAttribSize[VERT_ATTRIB_MAX]; - GLfloat CurrentAttrib[VERT_ATTRIB_MAX][8]; + uint32_t CurrentAttrib[VERT_ATTRIB_MAX][8]; GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX]; GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4]; diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 3e96c7d2fba..f5ef0ac56c3 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -111,7 +111,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab, SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV); } - /* Originally for GL_NV_vertex_program, this is also used by dlist.c */ + /* Originally for GL_NV_vertex_program, this is now only used by dlist.c */ if (ctx->API == API_OPENGL_COMPAT) { SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV); |