From 3e131d7d74bfc2c34a772a627b8cf8743d074f27 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 08:13:31 -0800 Subject: [PATCH] r300-gallium: A handful of fixups. --- src/gallium/drivers/r300/r300_context.c | 2 ++ src/gallium/drivers/r300/r300_state_derived.c | 29 ++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 81ac6ffc0d0..a9811501435 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -97,6 +97,7 @@ static void r300_destroy_context(struct pipe_context* context) { draw_destroy(r300->draw); FREE(r300->blend_color_state); + FREE(r300->rs_block); FREE(r300->scissor_state); FREE(r300); } @@ -126,6 +127,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300)); r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state); + r300->rs_block = CALLOC_STRUCT(r300_rs_block); r300->scissor_state = CALLOC_STRUCT(r300_scissor_state); r300_init_flush_functions(r300); diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5bf4f24b7a8..548a840f25d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -83,6 +83,7 @@ static void r300_update_vertex_layout(struct r300_context* r300) break; case TGSI_SEMANTIC_FOG: fog = TRUE; + tab[i] = 6 + texs++; break; case TGSI_SEMANTIC_PSIZE: psize = TRUE; @@ -110,6 +111,11 @@ static void r300_update_vertex_layout(struct r300_context* r300) if (!pos) { debug_printf("r300: Forcing vertex position attribute emit...\n"); + /* Make room for the position attribute + * at the beginning of the tab. */ + for (i = 1; i < 16; i++) { + tab[i] = tab[i-1]; + } tab[0] = 0; } @@ -131,16 +137,17 @@ static void r300_update_vertex_layout(struct r300_context* r300) vinfo.hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); } - if (fog) { + for (i = 0; i < texs; i++) { draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); - vinfo.hwfmt[2] |= - (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << cols); + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); + vinfo.hwfmt[3] |= (4 << (3 * i)); } - for (i = 0; i < texs; i++) { + if (fog) { + i++; draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); vinfo.hwfmt[3] |= (4 << (3 * i)); } @@ -159,7 +166,15 @@ static void r300_update_vertex_layout(struct r300_context* r300) for (i = 0; i < vinfo.num_attribs; i++) { /* Make sure we have a proper destination for our attribute */ - if (tab[i] != -1) { + if (tab[i] == -1) { + debug_printf("attrib count: %d, fp input count: %d\n", + vinfo.num_attribs, info->num_inputs); + for (i = 0; i < vinfo.num_attribs; i++) { + debug_printf("attrib: offset %d, interp %d, size %d," + " tab %d\n", vinfo.attrib[i].src_index, + vinfo.attrib[i].interp_mode, vinfo.attrib[i].emit, + tab[i]); + } assert(0); } -- 2.30.2