summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-30 11:08:03 -0600
committerBrian <[email protected]>2007-08-30 14:43:08 -0600
commit2d187672b7e38fcd8f6caa93f35dceb6fa11aa7f (patch)
tree69a88187c5f2e8585100554bc283a74f08850360
parente62b9241d288da7d9bed28fb85ea17bbb617aa28 (diff)
Sketch out per-vertex point size.
The code is all in place, but mostly disabled for now: In t_vp_build.c, write the VERT_RESULT_PSIZE register In sp_state_derived.c, need to emit vertex point size if drawing points. In setup_point() use the point size from the vertex.
-rw-r--r--src/mesa/pipe/draw/draw_twoside.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c13
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c6
-rw-r--r--src/mesa/tnl/t_vp_build.c14
4 files changed, 31 insertions, 4 deletions
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c
index 5a7697d5f81..a05eea41fc2 100644
--- a/src/mesa/pipe/draw/draw_twoside.c
+++ b/src/mesa/pipe/draw/draw_twoside.c
@@ -36,7 +36,7 @@
struct twoside_stage {
struct draw_stage stage;
float sign; /**< +1 or -1 */
- const unsigned *lookup;
+ const unsigned *lookup; /**< vertex attribute positions */
};
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index c2a5a7907dd..a7e1c9e017a 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -79,6 +79,8 @@ struct setup_stage {
float oneoverarea;
+ const unsigned *lookup; /**< vertex attribute positions */
+
struct tgsi_interp_coef coef[TGSI_ATTRIB_MAX];
struct quad_header quad;
@@ -884,10 +886,13 @@ static void
setup_point(struct draw_stage *stage, struct prim_header *prim)
{
struct setup_stage *setup = setup_stage( stage );
- /*XXX this should be a vertex attrib! */
- const float halfSize = 0.5f * setup->softpipe->setup.point_size;
- const boolean round = setup->softpipe->setup.point_smooth;
const struct vertex_header *v0 = prim->v[0];
+
+ const int sizeAttr = setup->lookup[TGSI_ATTRIB_POINTSIZE];
+ const float halfSize
+ = sizeAttr ? (0.5f * v0->data[sizeAttr][0])
+ : (0.5f * setup->softpipe->setup.point_size);
+ const boolean round = setup->softpipe->setup.point_smooth;
const float x = v0->data[TGSI_ATTRIB_POS][0];
const float y = v0->data[TGSI_ATTRIB_POS][1];
unsigned slot, j;
@@ -1072,5 +1077,7 @@ struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe )
setup->quad.coef = setup->coef;
+ setup->lookup = softpipe->draw->vertex_info.attrib_to_slot;
+
return &setup->stage;
}
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index b0d79eeddaf..3bbe9c9fd9d 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -102,6 +102,12 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
emit_vertex_attr(vinfo, TGSI_ATTRIB_FOG, FORMAT_1F, INTERP_PERSPECTIVE);
}
+ /* point size */
+#if 0
+ /* XXX only emit if drawing points or front/back polygon mode is point mode */
+ emit_vertex_attr(vinfo, TGSI_ATTRIB_POINTSIZE, FORMAT_4F, INTERP_CONSTANT);
+#endif
+
/* texcoords and varying vars */
for (i = TGSI_ATTRIB_TEX0; i < TGSI_ATTRIB_VAR7; i++) {
if (inputsRead & (1 << i)) {
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index eb5e176895e..f923b8e1326 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -1364,6 +1364,16 @@ static void build_pointsize( struct tnl_program *p )
release_temp(p, ut);
}
+/**
+ * Emit constant point size.
+ */
+static void constant_pointsize( struct tnl_program *p )
+{
+ struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
+ struct ureg out = register_output(p, VERT_RESULT_PSIZ);
+ emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, state_size);
+}
+
static void build_tnl_program( struct tnl_program *p )
{ /* Emit the program, starting with modelviewproject:
*/
@@ -1392,6 +1402,10 @@ static void build_tnl_program( struct tnl_program *p )
if (p->state->point_attenuated)
build_pointsize(p);
+#if 0
+ else
+ constant_pointsize(p);
+#endif
/* Finish up:
*/