diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-09-20 13:42:37 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-09-20 13:43:23 -0600 |
commit | 086734502a614e7778533018846ee66a66df9821 (patch) | |
tree | 80fc84b09af1915693bb6cf2c8596fb61a6cb1b4 /src/mesa/state_tracker | |
parent | 745f0cbe0528ac925096f5c1b85de7280fee7fbc (diff) |
Checkpoint: vertex attribute clean-up.
Remove/disable the attrib/slot mapping arrays in a few places.
Work in progress...
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_vs.c | 23 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_feedback.c | 10 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 12 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.h | 5 |
5 files changed, 31 insertions, 21 deletions
diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c index 9c2994fddf..2b8aef5c63 100644 --- a/src/mesa/state_tracker/st_atom_vs.c +++ b/src/mesa/state_tracker/st_atom_vs.c @@ -57,7 +57,6 @@ const struct cso_vertex_shader * st_translate_vertex_shader(struct st_context *st, struct st_vertex_program *stvp) { - GLuint outputMapping[PIPE_MAX_SHADER_INPUTS]; struct pipe_shader_state vs; const struct cso_vertex_shader *cso; GLuint i; @@ -83,6 +82,9 @@ st_translate_vertex_shader(struct st_context *st, case VERT_ATTRIB_COLOR1: vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_COLOR1; break; + case VERT_ATTRIB_TEX0: + vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_TEX0; + break; default: vs.input_semantics[vs.num_inputs] = TGSI_SEMANTIC_OTHER; } @@ -95,11 +97,8 @@ st_translate_vertex_shader(struct st_context *st, */ for (i = 0; i < VERT_RESULT_MAX; i++) { if (stvp->Base.Base.OutputsWritten & (1 << i)) { -#if 0 - stvp->output_to_index[i] = vs.num_outputs; - stvp->index_to_output[vs.num_outputs] = i; -#endif - outputMapping[i] = vs.num_outputs; + /* put this attrib in the next available slot */ + st->vertex_attrib_to_slot[i] = vs.num_outputs; switch (i) { case VERT_RESULT_HPOS: @@ -129,11 +128,7 @@ st_translate_vertex_shader(struct st_context *st, */ tgsi_mesa_compile_vp_program( &stvp->Base, stvp->input_to_index, -#if 0 - stvp->output_to_index, -#else - outputMapping, -#endif + st->vertex_attrib_to_slot, stvp->tokens, ST_FP_MAX_TOKENS ); #if 0 @@ -195,6 +190,12 @@ static void update_vs( struct st_context *st ) st->vp = stvp; st->state.vs = stvp->vs; +#if 0 + printf("###### bind vp tokens: %p %p num_inp=%u\n", + stvp, stvp->tokens, stvp->vs->state.num_inputs); + if (TGSI_DEBUG) + tgsi_dump( stvp->tokens, 0 ); +#endif st->pipe->bind_vs_state(st->pipe, st->state.vs->data); } } diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index bfc977daa4..5e63205088 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -491,7 +491,7 @@ clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) assert(strb->surface->format); -#if 01 +#if 0 if (ctx->Scissor.Enabled || (isDS && ctx->DrawBuffer->Visual.stencilBits > 0)) { /* scissoring or we have a combined depth/stencil buffer */ diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 8e8084fe59..e846463c4c 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -87,6 +87,7 @@ static void feedback_vertex(GLcontext *ctx, const struct draw_context *draw, const struct vertex_header *v) { + const struct st_context *st = ctx->st; GLfloat win[4]; const GLfloat *color, *texcoord; const GLfloat ci = 0; @@ -97,13 +98,18 @@ feedback_vertex(GLcontext *ctx, const struct draw_context *draw, win[2] = v->data[0][2]; win[3] = 1.0F / v->data[0][3]; - slot = draw->vertex_info.attrib_to_slot[TGSI_ATTRIB_COLOR0]; + /* XXX + * When we compute vertex layout, save info about position of the + * color and texcoord attribs to use here. + */ + + slot = st->vertex_attrib_to_slot[VERT_RESULT_COL0]; if (slot) color = v->data[slot]; else color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - slot = draw->vertex_info.attrib_to_slot[TGSI_ATTRIB_TEX0]; + slot = st->vertex_attrib_to_slot[VERT_RESULT_TEX0]; if (slot) texcoord = v->data[slot]; else diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 8a57227c84..55a857f46d 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -119,9 +119,17 @@ struct st_context GLfloat polygon_offset_scale; /* ?? */ - struct st_vertex_program *vp; - struct st_fragment_program *fp; + /** Mapping from VERT_ATTRIB_x to post-transformed vertex slot */ + GLuint vertex_attrib_to_slot[VERT_RESULT_MAX]; + struct st_vertex_program *vp; /**< Currently bound vertex program */ + struct st_fragment_program *fp; /**< Currently bound fragment program */ + + /** + * Buffer object which stores the ctx->Current.Attrib[] values. + * Used for vertex array drawing when we we need an attribute for + * which there's no enabled array. + */ struct pipe_buffer_handle *default_attrib_buffer; struct cso_cache *cache; diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 4f9ace3e6a..c21e27628e 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -71,11 +71,6 @@ struct st_vertex_program /** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */ GLuint index_to_input[MAX_VERTEX_PROGRAM_ATTRIBS]; -#if 0 - GLuint output_to_index[MAX_VERTEX_PROGRAM_ATTRIBS]; - GLuint index_to_output[MAX_VERTEX_PROGRAM_ATTRIBS]; -#endif - /** The program in TGSI format */ struct tgsi_token tokens[ST_FP_MAX_TOKENS]; GLboolean dirty; |