diff options
author | Brian <[email protected]> | 2007-09-21 12:06:08 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-09-21 12:06:08 -0600 |
commit | da45890818ab5ae94592208e3581b5c2febaa6b4 (patch) | |
tree | 4f6d9fa272e0b93213073f24913bc86899c8599f /src/mesa/pipe | |
parent | 46f606e9715145218331a04f0d1f66fb9f8531d6 (diff) |
Fix up some point size breakage. Start on fogcoord too.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_prim_setup.c | 4 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_derived.c | 62 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_token.h | 5 |
3 files changed, 47 insertions, 24 deletions
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index f0f9cf54bd8..6d63cc94123 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -907,15 +907,13 @@ setup_point(struct draw_stage *stage, struct prim_header *prim) const struct vertex_header *v0 = prim->v[0]; const int sizeAttr = setup->softpipe->psize_slot; const float halfSize - = sizeAttr ? (0.5f * v0->data[sizeAttr][0]) + = sizeAttr > 0 ? (0.5f * v0->data[sizeAttr][0]) : (0.5f * setup->softpipe->rasterizer->point_size); const boolean round = setup->softpipe->rasterizer->point_smooth; const float x = v0->data[0][0]; /* Note: data[0] is always position */ const float y = v0->data[0][1]; unsigned slot, j; - assert(sizeAttr >= 0); - /* For points, all interpolants are constant-valued. * However, for point sprites, we'll need to setup texcoords appropriately. * XXX: which coefficients are the texcoords??? diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 0e78209e305..35ba32cd81c 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -43,6 +43,7 @@ */ static void calculate_vertex_layout( struct softpipe_context *softpipe ) { + const struct pipe_shader_state *vs = softpipe->vs; const struct pipe_shader_state *fs = softpipe->fs; const interp_mode colorInterp = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; @@ -58,47 +59,68 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) softpipe->need_z = FALSE; softpipe->need_w = FALSE; + if (fs->input_semantic_name[0] == TGSI_SEMANTIC_POSITION) { + /* Need Z if depth test is enabled or the fragment program uses the + * fragment position (XYZW). + */ + softpipe->need_z = TRUE; + softpipe->need_w = TRUE; + } + softpipe->psize_slot = -1; /* always emit vertex pos */ - /* TODO - Figure out if we need to do perspective divide, etc. */ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR); - for (i = 0; i < fs->num_inputs; i++) { - switch (fs->input_semantic_name[i]) { + /* + * XXX I think we need to reconcile the vertex shader outputs with + * the fragment shader inputs here to make sure the slots line up. + * Might just be getting lucky so far. + * Or maybe do that in the state tracker? + */ + + for (i = 0; i < vs->num_outputs; i++) { + switch (vs->output_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: - /* Need Z if depth test is enabled or the fragment program uses the - * fragment position (XYZW). + /* vertex programs always emit position, but might not be + * needed for fragment progs. */ - softpipe->need_z = TRUE; - softpipe->need_w = TRUE; + /* no-op */ break; + case TGSI_SEMANTIC_COLOR: if (fs->input_semantic_index[i] == 0) { - front0 = draw_emit_vertex_attr(vinfo, - FORMAT_4F, colorInterp); + front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp); + } + else { + assert(fs->input_semantic_index[i] == 1); + front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp); + } + break; + + case TGSI_SEMANTIC_BCOLOR: + if (fs->input_semantic_index[i] == 0) { + back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp); } else { assert(fs->input_semantic_index[i] == 1); - front1 = draw_emit_vertex_attr(vinfo, - FORMAT_4F, colorInterp); + back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp); } break; + case TGSI_SEMANTIC_FOG: - draw_emit_vertex_attr(vinfo, - FORMAT_1F, INTERP_PERSPECTIVE); + draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE); break; -#if 0 + case TGSI_SEMANTIC_PSIZE: /* XXX only emit if drawing points or front/back polygon mode * is point mode */ - draw_emit_vertex_attr(vinfo, - FORMAT_4F, INTERP_CONSTANT); - break; -#endif + draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT); softpipe->psize_slot = i; - /*case TGSI_SEMANTIC_TEXCOORD:*/ + break; + case TGSI_SEMANTIC_GENERIC: /* this includes texcoords and varying vars */ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE); @@ -112,6 +134,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) softpipe->nr_frag_attrs = vinfo->num_attribs; +#if 0 /* Additional attributes required for setup: Just twosided * lighting. Edgeflag is dealt with specially by setting bits in * the vertex header. @@ -124,6 +147,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) back1 = draw_emit_vertex_attr(vinfo, FORMAT_OMIT, colorInterp); } } +#endif /* If the attributes have changed, tell the draw module about * the new vertex layout. diff --git a/src/mesa/pipe/tgsi/exec/tgsi_token.h b/src/mesa/pipe/tgsi/exec/tgsi_token.h index e6f884c5cf7..1d99a50dde7 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_token.h +++ b/src/mesa/pipe/tgsi/exec/tgsi_token.h @@ -107,8 +107,9 @@ struct tgsi_declaration_interpolation #define TGSI_SEMANTIC_COLOR 1 #define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */ #define TGSI_SEMANTIC_FOG 3 -#define TGSI_SEMANTIC_GENERIC 4 -#define TGSI_SEMANTIC_COUNT 5 /**< number of semantic values */ +#define TGSI_SEMANTIC_PSIZE 4 +#define TGSI_SEMANTIC_GENERIC 5 +#define TGSI_SEMANTIC_COUNT 6 /**< number of semantic values */ struct tgsi_declaration_semantic { |