diff options
author | Brian <[email protected]> | 2007-08-23 17:00:47 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-23 17:00:47 -0600 |
commit | d8b16d416de95daa4f0ede9b839bdbf0fa6bf1b1 (patch) | |
tree | 9ee52ee42b11661ab89eb66474d49bf600a8e777 /src/mesa/pipe/softpipe | |
parent | 83547d1dca7281ffe03424d12316b26bb07b89c9 (diff) |
Checkpoint: new vertex/fragment attribute naming
Replace VF_ATTRIB_x with TGSI_ATTRIB_x
When converting mesa programs to TGSI programs, also convert the InputsRead
and OutputsWritten to a mask of TGSI_ATTRIB_ bits.
Still need to do conversion for vertex programs...
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_prim_setup.c | 17 | ||||
-rwxr-xr-x | src/mesa/pipe/softpipe/sp_quad_fs.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_derived.c | 72 |
3 files changed, 46 insertions, 46 deletions
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index f779deac280..e8ed548cf04 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -40,10 +40,7 @@ #include "pipe/draw/draw_private.h" #include "pipe/p_util.h" - -/** XXX remove */ -#define FRAG_ATTRIB_WPOS 0 -#define FRAG_ATTRIB_MAX 13 +#include "pipe/draw/draw_vertex.h" /** @@ -82,7 +79,7 @@ struct setup_stage { float oneoverarea; - struct tgsi_interp_coef coef[FRAG_ATTRIB_MAX]; + struct tgsi_interp_coef coef[TGSI_ATTRIB_MAX]; struct quad_header quad; struct { @@ -369,7 +366,7 @@ static void const_coeff( struct setup_stage *setup, unsigned slot, unsigned i ) { - assert(slot < FRAG_ATTRIB_MAX); + assert(slot < TGSI_ATTRIB_MAX); assert(i <= 3); setup->coef[slot].dadx[i] = 0; @@ -394,7 +391,7 @@ static void tri_linear_coeff( struct setup_stage *setup, float a = setup->ebot.dy * majda - botda * setup->emaj.dy; float b = setup->emaj.dx * botda - majda * setup->ebot.dx; - assert(slot < FRAG_ATTRIB_MAX); + assert(slot < TGSI_ATTRIB_MAX); assert(i <= 3); setup->coef[slot].dadx[i] = a * setup->oneoverarea; @@ -445,7 +442,7 @@ static void tri_persp_coeff( struct setup_stage *setup, float a = setup->ebot.dy * majda - botda * setup->emaj.dy; float b = setup->emaj.dx * botda - majda * setup->ebot.dx; - assert(slot < FRAG_ATTRIB_MAX); + assert(slot < TGSI_ATTRIB_MAX); assert(i <= 3); setup->coef[slot].dadx[i] = a * setup->oneoverarea; @@ -891,8 +888,8 @@ setup_point(struct draw_stage *stage, struct prim_header *prim) 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 float x = v0->data[FRAG_ATTRIB_WPOS][0]; - const float y = v0->data[FRAG_ATTRIB_WPOS][1]; + const float x = v0->data[TGSI_ATTRIB_POS][0]; + const float y = v0->data[TGSI_ATTRIB_POS][1]; unsigned slot, j; /* For points, all interpolants are constant-valued. diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 8a419c9ac78..8d41e094656 100755 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -34,6 +34,7 @@ #include "pipe/p_util.h" #include "pipe/p_defines.h" +#include "pipe/tgsi/core/tgsi_attribs.h" #include "sp_context.h" #include "sp_headers.h" @@ -138,7 +139,7 @@ shade_quad( /* store result color */ memcpy( quad->outputs.color, - &machine.Outputs[1].xyzw[0].f[0], + &machine.Outputs[TGSI_ATTRIB_COLOR0].xyzw[0].f[0], sizeof( quad->outputs.color ) ); #if 0 diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index af230111dce..5c119ec8cd7 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -33,41 +33,43 @@ #include "sp_context.h" #include "sp_state.h" +#include "pipe/tgsi/core/tgsi_attribs.h" -#define EMIT_ATTR( VF_ATTR, FRAG_ATTR, INTERP ) \ + +#define EMIT_ATTR( ATTR, FRAG_ATTR, INTERP ) \ do { \ - slot_to_vf_attr[softpipe->nr_attrs] = VF_ATTR; \ - softpipe->vf_attr_to_slot[VF_ATTR] = softpipe->nr_attrs; \ + slot_to_vf_attr[softpipe->nr_attrs] = ATTR; \ + softpipe->vf_attr_to_slot[ATTR] = softpipe->nr_attrs; \ softpipe->fp_attr_to_slot[FRAG_ATTR] = softpipe->nr_attrs; \ softpipe->interp[softpipe->nr_attrs] = INTERP; \ softpipe->nr_attrs++; \ - attr_mask |= (1 << (VF_ATTR)); \ + attr_mask |= (1 << (ATTR)); \ } while (0) static const unsigned frag_to_vf[PIPE_ATTRIB_MAX] = { - VF_ATTRIB_POS, - VF_ATTRIB_COLOR0, - VF_ATTRIB_COLOR1, - VF_ATTRIB_FOG, - VF_ATTRIB_TEX0, - VF_ATTRIB_TEX1, - VF_ATTRIB_TEX2, - VF_ATTRIB_TEX3, - VF_ATTRIB_TEX4, - VF_ATTRIB_TEX5, - VF_ATTRIB_TEX6, - VF_ATTRIB_TEX7, - VF_ATTRIB_VAR0, - VF_ATTRIB_VAR1, - VF_ATTRIB_VAR2, - VF_ATTRIB_VAR3, - VF_ATTRIB_VAR4, - VF_ATTRIB_VAR5, - VF_ATTRIB_VAR6, - VF_ATTRIB_VAR7, + TGSI_ATTRIB_POS, + TGSI_ATTRIB_COLOR0, + TGSI_ATTRIB_COLOR1, + TGSI_ATTRIB_FOG, + TGSI_ATTRIB_TEX0, + TGSI_ATTRIB_TEX1, + TGSI_ATTRIB_TEX2, + TGSI_ATTRIB_TEX3, + TGSI_ATTRIB_TEX4, + TGSI_ATTRIB_TEX5, + TGSI_ATTRIB_TEX6, + TGSI_ATTRIB_TEX7, + TGSI_ATTRIB_VAR0, + TGSI_ATTRIB_VAR1, + TGSI_ATTRIB_VAR2, + TGSI_ATTRIB_VAR3, + TGSI_ATTRIB_VAR4, + TGSI_ATTRIB_VAR5, + TGSI_ATTRIB_VAR6, + TGSI_ATTRIB_VAR7, }; @@ -79,7 +81,7 @@ static const unsigned frag_to_vf[PIPE_ATTRIB_MAX] = static void calculate_vertex_layout( struct softpipe_context *softpipe ) { const unsigned inputsRead = softpipe->fs.inputs_read; - unsigned slot_to_vf_attr[VF_ATTRIB_MAX]; + unsigned slot_to_vf_attr[TGSI_ATTRIB_MAX]; unsigned attr_mask = 0x0; unsigned i; @@ -87,7 +89,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) * fragment position (XYZW). */ if (softpipe->depth_test.enabled || - (inputsRead & (1 << FRAG_ATTRIB_WPOS))) + (inputsRead & (1 << TGSI_ATTRIB_POS))) softpipe->need_z = TRUE; else softpipe->need_z = FALSE; @@ -95,7 +97,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) /* Need W if we do any perspective-corrected interpolation or the * fragment program uses the fragment position. */ - if (inputsRead & (1 << FRAG_ATTRIB_WPOS)) + if (inputsRead & (1 << TGSI_ATTRIB_POS)) softpipe->need_w = TRUE; else softpipe->need_w = FALSE; @@ -109,24 +111,24 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) /* TODO - Figure out if we need to do perspective divide, etc. */ - EMIT_ATTR(VF_ATTRIB_POS, FRAG_ATTRIB_WPOS, INTERP_LINEAR); + EMIT_ATTR(TGSI_ATTRIB_POS, TGSI_ATTRIB_POS, INTERP_LINEAR); /* Pull in the rest of the attributes. They are all in float4 * format. Future optimizations could be to keep some attributes * as fixed point or ubyte format. */ - for (i = 1; i < FRAG_ATTRIB_TEX0; i++) { + for (i = 1; i < TGSI_ATTRIB_TEX0; i++) { if (inputsRead & (1 << i)) { assert(i < sizeof(frag_to_vf) / sizeof(frag_to_vf[0])); if (softpipe->setup.flatshade - && (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)) + && (i == TGSI_ATTRIB_COLOR0 || i == TGSI_ATTRIB_COLOR1)) EMIT_ATTR(frag_to_vf[i], i, INTERP_CONSTANT); else EMIT_ATTR(frag_to_vf[i], i, INTERP_LINEAR); } } - for (i = FRAG_ATTRIB_TEX0; i < FRAG_ATTRIB_MAX; i++) { + for (i = TGSI_ATTRIB_TEX0; i < TGSI_ATTRIB_MAX; i++) { if (inputsRead & (1 << i)) { assert(i < sizeof(frag_to_vf) / sizeof(frag_to_vf[0])); EMIT_ATTR(frag_to_vf[i], i, INTERP_PERSPECTIVE); @@ -141,12 +143,12 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) * the vertex header. */ if (softpipe->setup.light_twoside) { - if (inputsRead & FRAG_BIT_COL0) { - EMIT_ATTR(VF_ATTRIB_BFC0, FRAG_ATTRIB_MAX, 0); /* XXX: mark as discarded after setup */ + if (inputsRead & (1 << TGSI_ATTRIB_COLOR0)) { + EMIT_ATTR(TGSI_ATTRIB_BFC0, TGSI_ATTRIB_MAX, 0); /* XXX: mark as discarded after setup */ } - if (inputsRead & FRAG_BIT_COL1) { - EMIT_ATTR(VF_ATTRIB_BFC1, FRAG_ATTRIB_MAX, 0); /* XXX: discard after setup */ + if (inputsRead & (1 << TGSI_ATTRIB_COLOR1)) { + EMIT_ATTR(TGSI_ATTRIB_BFC1, TGSI_ATTRIB_MAX, 0); /* XXX: discard after setup */ } } |