summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-09-21 12:06:08 -0600
committerBrian <[email protected]>2007-09-21 12:06:08 -0600
commitda45890818ab5ae94592208e3581b5c2febaa6b4 (patch)
tree4f6d9fa272e0b93213073f24913bc86899c8599f /src/mesa
parent46f606e9715145218331a04f0d1f66fb9f8531d6 (diff)
Fix up some point size breakage. Start on fogcoord too.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c62
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_token.h5
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c4
-rw-r--r--src/mesa/state_tracker/st_atom_vs.c10
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c3
6 files changed, 63 insertions, 25 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
{
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c
index 1e7886a4696..f8a1dc83cff 100644
--- a/src/mesa/state_tracker/st_atom_fs.c
+++ b/src/mesa/state_tracker/st_atom_fs.c
@@ -95,7 +95,9 @@ st_translate_fragment_shader(struct st_context *st,
interpMode[fs.num_inputs] = TGSI_INTERPOLATE_LINEAR;
break;
case FRAG_ATTRIB_FOGC:
- assert(0);
+ fs.input_semantic_name[fs.num_inputs] = TGSI_SEMANTIC_FOG;
+ fs.input_semantic_index[fs.num_inputs] = 0;
+ interpMode[fs.num_inputs] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c
index e4e9902e653..ae51e9764b1 100644
--- a/src/mesa/state_tracker/st_atom_vs.c
+++ b/src/mesa/state_tracker/st_atom_vs.c
@@ -91,6 +91,10 @@ st_translate_vertex_shader(struct st_context *st,
vs.input_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_COLOR;
vs.input_semantic_index[vs.num_inputs] = 1;
break;
+ case VERT_ATTRIB_FOG:
+ vs.input_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_FOG;
+ vs.input_semantic_index[vs.num_inputs] = 0;
+ break;
case VERT_ATTRIB_TEX0:
case VERT_ATTRIB_TEX1:
case VERT_ATTRIB_TEX2:
@@ -152,7 +156,13 @@ st_translate_vertex_shader(struct st_context *st,
vs.output_semantic_index[vs.num_outputs] = 1;
break;
case VERT_RESULT_FOGC:
+ vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_FOG;
+ vs.output_semantic_index[vs.num_outputs] = 0;
+ break;
case VERT_RESULT_PSIZ:
+ vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_PSIZE;
+ vs.output_semantic_index[vs.num_outputs] = 0;
+ break;
case VERT_RESULT_EDGE:
assert(0);
break;
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 56c98916edb..2311bddc655 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -265,6 +265,9 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4])
float *buf_map;
struct pipe_feedback_buffer fb_buf;
+ /** XXX TEMPORARILY DISABLE */
+ return;
+
st_validate_state(ctx->st);
/* setup vertex buffers */