diff options
author | Marek Olšák <[email protected]> | 2015-02-21 22:37:47 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-02-24 21:21:04 +0100 |
commit | b039302fb7b6ae5041ae77e14c6b18f34e70f28b (patch) | |
tree | 934b7e2ce9d5d5394ffbb2c916a8ced3fa1eb0dd /src/mesa/state_tracker | |
parent | 002aa7502245805def2fd9bb1bc83284019757fe (diff) |
st/mesa: cleanup st_geometry_program structure
It's full of unused variables and variables only used
in st_translate_geometry_program.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_program.c | 10 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 82 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.h | 18 |
3 files changed, 36 insertions, 74 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index faff9c4bd66..aa301d8308b 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -143,11 +143,6 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) if (stgp->glsl_to_tgsi) free_glsl_to_tgsi_visitor(stgp->glsl_to_tgsi); - - if (stgp->tgsi.tokens) { - st_free_tokens((void *) stgp->tgsi.tokens); - stgp->tgsi.tokens = NULL; - } } break; case GL_FRAGMENT_PROGRAM_ARB: @@ -207,11 +202,6 @@ st_program_string_notify( struct gl_context *ctx, st_release_gp_variants(st, stgp); - if (stgp->tgsi.tokens) { - st_free_tokens((void *) stgp->tgsi.tokens); - stgp->tgsi.tokens = NULL; - } - if (st->gp == stgp) st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM; } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 10a5f2900da..d6e0d1b3c16 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -870,12 +870,14 @@ st_translate_geometry_program(struct st_context *st, struct pipe_context *pipe = st->pipe; GLuint attr; GLbitfield64 inputsRead; - GLuint vslot = 0; uint gs_num_inputs = 0; uint gs_builtin_inputs = 0; uint gs_array_offset = 0; + ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; + ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; + ubyte gs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; ubyte gs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; uint gs_num_outputs = 0; @@ -883,6 +885,7 @@ st_translate_geometry_program(struct st_context *st, GLint i; GLuint maxSlot = 0; struct ureg_program *ureg; + struct pipe_shader_state state = {0}; struct st_gp_variant *gpv; @@ -900,9 +903,6 @@ st_translate_geometry_program(struct st_context *st, return NULL; } - /* which vertex output goes to the first geometry input */ - vslot = 0; - memset(inputMapping, 0, sizeof(inputMapping)); memset(outputMapping, 0, sizeof(outputMapping)); @@ -918,11 +918,6 @@ st_translate_geometry_program(struct st_context *st, inputMapping[attr] = slot; - stgp->input_map[slot + gs_array_offset] = vslot - gs_builtin_inputs; - stgp->input_to_index[attr] = vslot; - stgp->index_to_input[vslot] = attr; - ++vslot; - if (attr != VARYING_SLOT_PRIMITIVE_ID) { gs_array_offset += 2; } else @@ -935,40 +930,40 @@ st_translate_geometry_program(struct st_context *st, switch (attr) { case VARYING_SLOT_PRIMITIVE_ID: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_POS: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_COL0: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_COL1: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - stgp->input_semantic_index[slot] = 1; + input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + input_semantic_index[slot] = 1; break; case VARYING_SLOT_FOGC: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_FOG; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_CLIP_VERTEX: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_CLIP_DIST0: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_CLIP_DIST1: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; - stgp->input_semantic_index[slot] = 1; + input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; + input_semantic_index[slot] = 1; break; case VARYING_SLOT_PSIZ: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; - stgp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; + input_semantic_index[slot] = 0; break; case VARYING_SLOT_TEX0: case VARYING_SLOT_TEX1: @@ -979,16 +974,16 @@ st_translate_geometry_program(struct st_context *st, case VARYING_SLOT_TEX6: case VARYING_SLOT_TEX7: if (st->needs_texcoord_semantic) { - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD; - stgp->input_semantic_index[slot] = attr - VARYING_SLOT_TEX0; + input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD; + input_semantic_index[slot] = attr - VARYING_SLOT_TEX0; break; } /* fall through */ case VARYING_SLOT_VAR0: default: assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX); - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stgp->input_semantic_index[slot] = + input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + input_semantic_index[slot] = st_get_generic_varying_index(st, attr); break; } @@ -1120,12 +1115,6 @@ st_translate_geometry_program(struct st_context *st, } #endif - /* free old shader state, if any */ - if (stgp->tgsi.tokens) { - st_free_tokens(stgp->tgsi.tokens); - stgp->tgsi.tokens = NULL; - } - ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, stgp->Base.InputType); ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, stgp->Base.OutputType); ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, @@ -1141,8 +1130,8 @@ st_translate_geometry_program(struct st_context *st, /* inputs */ gs_num_inputs, inputMapping, - stgp->input_semantic_name, - stgp->input_semantic_index, + input_semantic_name, + input_semantic_index, NULL, NULL, /* outputs */ @@ -1160,8 +1149,8 @@ st_translate_geometry_program(struct st_context *st, /* inputs */ gs_num_inputs, inputMapping, - stgp->input_semantic_name, - stgp->input_semantic_index, + input_semantic_name, + input_semantic_index, NULL, /* outputs */ gs_num_outputs, @@ -1171,14 +1160,13 @@ st_translate_geometry_program(struct st_context *st, FALSE, FALSE); - stgp->num_inputs = gs_num_inputs; - stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); + state.tokens = ureg_get_tokens( ureg, NULL ); ureg_destroy( ureg ); if (stgp->glsl_to_tgsi) { st_translate_stream_output_info(stgp->glsl_to_tgsi, outputMapping, - &stgp->tgsi.stream_output); + &state.stream_output); } if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { @@ -1187,13 +1175,15 @@ st_translate_geometry_program(struct st_context *st, } if (ST_DEBUG & DEBUG_TGSI) { - tgsi_dump(stgp->tgsi.tokens, 0); + tgsi_dump(state.tokens, 0); debug_printf("\n"); } /* fill in new variant */ - gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi); + gpv->driver_shader = pipe->create_gs_state(pipe, &state); gpv->key = *key; + + st_free_tokens(state.tokens); return gpv; } diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 870d0d57a86..e1511edb713 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -203,24 +203,6 @@ struct st_geometry_program struct gl_geometry_program Base; /**< The Mesa geometry program */ struct glsl_to_tgsi_visitor* glsl_to_tgsi; - /** map GP input back to VP output */ - GLuint input_map[PIPE_MAX_SHADER_INPUTS]; - - /** maps a Mesa VARYING_SLOT_x to a packed TGSI input index */ - GLuint input_to_index[VARYING_SLOT_MAX]; - /** maps a TGSI input index back to a Mesa VARYING_SLOT_x */ - GLuint index_to_input[PIPE_MAX_SHADER_INPUTS]; - - GLuint num_inputs; - - GLuint input_to_slot[VARYING_SLOT_MAX]; /**< Maps VARYING_SLOT_x to slot */ - GLuint num_input_slots; - - ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; - ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; - - struct pipe_shader_state tgsi; - struct st_gp_variant *variants; }; |