diff options
author | Timothy Arceri <[email protected]> | 2016-11-17 10:52:28 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-17 12:53:12 +1100 |
commit | c3df65c123c6392b0b116900395a89fd3dbb9b85 (patch) | |
tree | 2b7c4a89aff0ccbbfb7f9fec4e0b0459858b58bb /src/mesa/program/program_parse.y | |
parent | d6bdb3a86293da2164e9355f0262ef83afeece7f (diff) |
st/mesa/r200/i915/i965: move ARB program fields into a union
It's common for games to compile 2000 programs or more so at
32bits x 2000 programs x 22 fields x 2 (at least) stages
This should give us something like 352 kilobytes in savings
once we add some more glsl only fields.
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/mesa/program/program_parse.y')
-rw-r--r-- | src/mesa/program/program_parse.y | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index e861340a023..f3adea6677c 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -348,7 +348,7 @@ statement: instruction ';' state->inst_tail = $1; $1->next = NULL; - state->prog->NumInstructions++; + state->prog->arb.NumInstructions++; } } | namingStatement ';' @@ -357,12 +357,12 @@ statement: instruction ';' instruction: ALU_instruction { $$ = $1; - state->prog->NumAluInstructions++; + state->prog->arb.NumAluInstructions++; } | TexInstruction { $$ = $1; - state->prog->NumTexInstructions++; + state->prog->arb.NumTexInstructions++; } ; @@ -785,7 +785,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ $$.Base.File = $1->param_binding_type; if ($3.Base.RelAddr) { - state->prog->IndirectRegisterFiles |= (1 << $$.Base.File); + state->prog->arb.IndirectRegisterFiles |= (1 << $$.Base.File); $1->param_accessed_indirectly = 1; $$.Base.RelAddr = 1; @@ -2247,18 +2247,19 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, switch (t) { case at_temp: - if (state->prog->NumTemporaries >= state->limits->MaxTemps) { + if (state->prog->arb.NumTemporaries >= state->limits->MaxTemps) { yyerror(locp, state, "too many temporaries declared"); free(s); return NULL; } - s->temp_binding = state->prog->NumTemporaries; - state->prog->NumTemporaries++; + s->temp_binding = state->prog->arb.NumTemporaries; + state->prog->arb.NumTemporaries++; break; case at_address: - if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) { + if (state->prog->arb.NumAddressRegs >= + state->limits->MaxAddressRegs) { yyerror(locp, state, "too many address registers declared"); free(s); return NULL; @@ -2266,7 +2267,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, /* FINISHME: Add support for multiple address registers. */ - state->prog->NumAddressRegs++; + state->prog->arb.NumAddressRegs++; break; default: @@ -2564,43 +2565,43 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st /* Add one instruction to store the "END" instruction. */ - state->prog->Instructions = + state->prog->arb.Instructions = rzalloc_array(state->mem_ctx, struct prog_instruction, - state->prog->NumInstructions + 1); + state->prog->arb.NumInstructions + 1); - if (state->prog->Instructions == NULL) { + if (state->prog->arb.Instructions == NULL) { goto error; } inst = state->inst_head; - for (i = 0; i < state->prog->NumInstructions; i++) { + for (i = 0; i < state->prog->arb.NumInstructions; i++) { struct asm_instruction *const temp = inst->next; - state->prog->Instructions[i] = inst->Base; + state->prog->arb.Instructions[i] = inst->Base; inst = temp; } /* Finally, tag on an OPCODE_END instruction */ { - const GLuint numInst = state->prog->NumInstructions; - _mesa_init_instructions(state->prog->Instructions + numInst, 1); - state->prog->Instructions[numInst].Opcode = OPCODE_END; + const GLuint numInst = state->prog->arb.NumInstructions; + _mesa_init_instructions(state->prog->arb.Instructions + numInst, 1); + state->prog->arb.Instructions[numInst].Opcode = OPCODE_END; } - state->prog->NumInstructions++; + state->prog->arb.NumInstructions++; - state->prog->NumParameters = state->prog->Parameters->NumParameters; - state->prog->NumAttributes = + state->prog->arb.NumParameters = state->prog->Parameters->NumParameters; + state->prog->arb.NumAttributes = _mesa_bitcount_64(state->prog->info.inputs_read); /* * Initialize native counts to logical counts. The device driver may * change them if program is translated into a hardware program. */ - state->prog->NumNativeInstructions = state->prog->NumInstructions; - state->prog->NumNativeTemporaries = state->prog->NumTemporaries; - state->prog->NumNativeParameters = state->prog->NumParameters; - state->prog->NumNativeAttributes = state->prog->NumAttributes; - state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs; + state->prog->arb.NumNativeInstructions = state->prog->arb.NumInstructions; + state->prog->arb.NumNativeTemporaries = state->prog->arb.NumTemporaries; + state->prog->arb.NumNativeParameters = state->prog->arb.NumParameters; + state->prog->arb.NumNativeAttributes = state->prog->arb.NumAttributes; + state->prog->arb.NumNativeAddressRegs = state->prog->arb.NumAddressRegs; result = GL_TRUE; |