From: Marek Olšák Date: Wed, 15 Nov 2017 22:24:56 +0000 (+0100) Subject: mesa: remove unused vertex attrib WEIGHT X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43abaf2ad0c1c42e56e47732395cc98912a050e8;p=mesa.git mesa: remove unused vertex attrib WEIGHT We don't support ARB_vertex_blend. Note that the attribute aliasing check for ARB_vertex_program had to be rewritten. vbo_context: 20344 -> 20008 bytes gl_context: 74672 -> 74616 bytes Reviewed-by: Ian Romanick --- diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index b2ca80b49c2..2179c475abd 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -91,7 +91,6 @@ gl_vert_attrib_name(gl_vert_attrib attrib) { static const char *names[] = { ENUM(VERT_ATTRIB_POS), - ENUM(VERT_ATTRIB_WEIGHT), ENUM(VERT_ATTRIB_NORMAL), ENUM(VERT_ATTRIB_COLOR0), ENUM(VERT_ATTRIB_COLOR1), diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 17b236e3895..af4008c6179 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -75,7 +75,6 @@ const char *_mesa_shader_stage_to_abbrev(unsigned stage); typedef enum { VERT_ATTRIB_POS, - VERT_ATTRIB_WEIGHT, VERT_ATTRIB_NORMAL, VERT_ATTRIB_COLOR0, VERT_ATTRIB_COLOR1, @@ -141,7 +140,6 @@ const char *gl_vert_attrib_name(gl_vert_attrib attrib); */ /*@{*/ #define VERT_BIT_POS BITFIELD64_BIT(VERT_ATTRIB_POS) -#define VERT_BIT_WEIGHT BITFIELD64_BIT(VERT_ATTRIB_WEIGHT) #define VERT_BIT_NORMAL BITFIELD64_BIT(VERT_ATTRIB_NORMAL) #define VERT_BIT_COLOR0 BITFIELD64_BIT(VERT_ATTRIB_COLOR0) #define VERT_BIT_COLOR1 BITFIELD64_BIT(VERT_ATTRIB_COLOR1) diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 60f851be56c..a3d45cf7369 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -102,9 +102,7 @@ void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev ) } break; case 1: - assert(attrib == VERT_ATTRIB_WEIGHT); - emitsize = (VB->AttribPtr[attrib]->size); - vfmt0 |= emitsize << R200_VTX_WEIGHT_COUNT_SHIFT; + unreachable("r200: vertex weight attrib unsupported"); break; case 2: assert(attrib == VERT_ATTRIB_NORMAL); diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index bb8550332b3..c3606b50ff0 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -498,11 +498,6 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2 free_inputs &= ~(1 << 0); array_count++; } - if (mesa_vp->info.inputs_read & VERT_BIT_WEIGHT) { - vp->inputs[VERT_ATTRIB_WEIGHT] = 12; - vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT; - array_count++; - } if (mesa_vp->info.inputs_read & VERT_BIT_NORMAL) { vp->inputs[VERT_ATTRIB_NORMAL] = 1; vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL; diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 88a5702f412..18d6d8008c1 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -277,9 +277,6 @@ _mesa_initialize_vao(struct gl_context *ctx, /* Init the individual arrays */ for (i = 0; i < ARRAY_SIZE(vao->VertexAttrib); i++) { switch (i) { - case VERT_ATTRIB_WEIGHT: - init_array(ctx, vao, VERT_ATTRIB_WEIGHT, 1, GL_FLOAT); - break; case VERT_ATTRIB_NORMAL: init_array(ctx, vao, VERT_ATTRIB_NORMAL, 3, GL_FLOAT); break; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 25dd59ae2c1..3fa9f69f883 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -436,7 +436,6 @@ _mesa_init_current(struct gl_context *ctx) } /* redo special cases: */ - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 4f85d14c41d..9462510f3ad 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -89,7 +89,6 @@ arb_input_attrib_string(GLuint index, GLenum progType) */ static const char *const vertAttribs[] = { "vertex.position", - "vertex.weight", "vertex.normal", "vertex.color.primary", "vertex.color.secondary", diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l index dee66cbf30a..2e168b83bdb 100644 --- a/src/mesa/program/program_lexer.l +++ b/src/mesa/program/program_lexer.l @@ -289,7 +289,6 @@ result { return RESULT; } {dot}texture { return TEXTURE; } {dot}transpose { return TRANSPOSE; } {dot}attrib { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } -{dot}weight { return_token_or_DOT(require_ARB_vp, WEIGHT); } texture { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } 1D { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index f3adea6677c..1bc5f515494 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -186,7 +186,6 @@ static struct asm_instruction *asm_instruction_copy_ctor( %token TEX_SHADOW1D TEX_SHADOW2D TEX_SHADOWRECT %token TEX_ARRAY1D TEX_ARRAY2D TEX_ARRAYSHADOW1D TEX_ARRAYSHADOW2D %token VERTEX VTXATTRIB -%token WEIGHT %token IDENTIFIER USED_IDENTIFIER %type string @@ -1007,10 +1006,6 @@ vtxAttribItem: POSITION { $$ = VERT_ATTRIB_POS; } - | WEIGHT vtxOptWeightNum - { - $$ = VERT_ATTRIB_WEIGHT; - } | NORMAL { $$ = VERT_ATTRIB_NORMAL; @@ -1049,7 +1044,6 @@ vtxAttribNum: INTEGER } ; -vtxOptWeightNum: | '[' vtxWeightNum ']'; vtxWeightNum: INTEGER; fragAttribItem: POSITION @@ -2219,8 +2213,29 @@ int validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state) { const GLbitfield64 inputs = state->prog->info.inputs_read | state->InputsBound; + GLbitfield ff_inputs = 0; - if (((inputs & VERT_BIT_FF_ALL) & (inputs >> VERT_ATTRIB_GENERIC0)) != 0) { + /* Since Mesa internal attribute indices are different from + * how NV_vertex_program defines attribute aliasing, we have to construct + * a separate usage mask based on how the aliasing is defined. + * + * Note that attribute aliasing is optional if NV_vertex_program is + * unsupported. + */ + if (inputs & VERT_BIT_POS) + ff_inputs |= 1 << 0; + if (inputs & VERT_BIT_NORMAL) + ff_inputs |= 1 << 2; + if (inputs & VERT_BIT_COLOR0) + ff_inputs |= 1 << 3; + if (inputs & VERT_BIT_COLOR1) + ff_inputs |= 1 << 4; + if (inputs & VERT_BIT_FOG) + ff_inputs |= 1 << 5; + + ff_inputs |= ((inputs & VERT_BIT_TEX_ALL) >> VERT_ATTRIB_TEX0) << 8; + + if ((ff_inputs & (inputs >> VERT_ATTRIB_GENERIC0)) != 0) { yyerror(locp, state, "illegal use of generic attribute and name attribute"); return 0; } diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 67a87f26af5..ced2857fc97 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -77,7 +77,6 @@ */ enum { _TNL_ATTRIB_POS, - _TNL_ATTRIB_WEIGHT, _TNL_ATTRIB_NORMAL, _TNL_ATTRIB_COLOR0, _TNL_ATTRIB_COLOR1, @@ -150,7 +149,7 @@ enum { /** * Handy attribute ranges: */ -#define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT +#define _TNL_FIRST_PROG _TNL_ATTRIB_NORMAL #define _TNL_LAST_PROG _TNL_ATTRIB_TEX7 #define _TNL_FIRST_TEX _TNL_ATTRIB_TEX0 diff --git a/src/mesa/vbo/vbo_attrib.h b/src/mesa/vbo/vbo_attrib.h index 560c82623ba..f4a3a66cfbf 100644 --- a/src/mesa/vbo/vbo_attrib.h +++ b/src/mesa/vbo/vbo_attrib.h @@ -45,7 +45,6 @@ */ enum { VBO_ATTRIB_POS, - VBO_ATTRIB_WEIGHT, VBO_ATTRIB_NORMAL, VBO_ATTRIB_COLOR0, VBO_ATTRIB_COLOR1,