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/draw | |
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/draw')
-rw-r--r-- | src/mesa/pipe/draw/draw_arrays.c | 9 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_clip.c | 4 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_flatshade.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 3 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_twoside.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex.h | 83 |
6 files changed, 20 insertions, 95 deletions
diff --git a/src/mesa/pipe/draw/draw_arrays.c b/src/mesa/pipe/draw/draw_arrays.c index 784eb3f2e6c..f6bf174dc0b 100644 --- a/src/mesa/pipe/draw/draw_arrays.c +++ b/src/mesa/pipe/draw/draw_arrays.c @@ -78,6 +78,7 @@ emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr, uint format) vinfo->slot_to_attrib[n] = vfAttr; if (n >= 2) { /* the first two slots are the vertex header & clippos */ + assert(vfAttr < Elements(vinfo->attrib_to_slot)); vinfo->attrib_to_slot[vfAttr] = n - 2; } /*printf("Vertex slot %d = vfattrib %d\n", n, vfAttr);*/ @@ -128,16 +129,16 @@ draw_set_vertex_attributes( struct draw_context *draw, struct vertex_info *vinfo = &draw->vertex_info; unsigned i; - assert(slot_to_vf_attr[0] == VF_ATTRIB_POS); + assert(slot_to_vf_attr[0] == TGSI_ATTRIB_POS); memset(vinfo, 0, sizeof(*vinfo)); /* * First three attribs are always the same: header, clip pos, winpos */ - emit_vertex_attr(vinfo, VF_ATTRIB_VERTEX_HEADER, FORMAT_1F); - emit_vertex_attr(vinfo, VF_ATTRIB_CLIP_POS, FORMAT_4F); - emit_vertex_attr(vinfo, VF_ATTRIB_POS, FORMAT_4F_VIEWPORT); + emit_vertex_attr(vinfo, TGSI_ATTRIB_VERTEX_HEADER, FORMAT_1F); + emit_vertex_attr(vinfo, TGSI_ATTRIB_CLIP_POS, FORMAT_4F); + emit_vertex_attr(vinfo, TGSI_ATTRIB_POS, FORMAT_4F_VIEWPORT); /* * Remaining attribs (color, texcoords, etc) diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index 1c2491d2c6a..f46f4e3de62 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -380,8 +380,8 @@ static void clip_begin( struct draw_stage *stage ) /* sanity checks. If these fail, review the clip/interp code! */ assert(stage->draw->vertex_info.num_attribs >= 3); - assert(stage->draw->vertex_info.slot_to_attrib[0] == VF_ATTRIB_VERTEX_HEADER); - assert(stage->draw->vertex_info.slot_to_attrib[1] == VF_ATTRIB_CLIP_POS); + assert(stage->draw->vertex_info.slot_to_attrib[0] == TGSI_ATTRIB_VERTEX_HEADER); + assert(stage->draw->vertex_info.slot_to_attrib[1] == TGSI_ATTRIB_CLIP_POS); /* Hacky bitmask to use when we hit CLIP_USER_BIT: */ diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index 34588c83b69..d8db1f748cc 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -72,10 +72,10 @@ static INLINE void copy_colors( struct draw_stage *stage, const struct flatshade_stage *flatshade = flatshade_stage(stage); const unsigned *lookup = flatshade->lookup; - copy_attr( lookup[VF_ATTRIB_COLOR0], dst, src ); - copy_attr( lookup[VF_ATTRIB_COLOR1], dst, src ); - copy_attr( lookup[VF_ATTRIB_BFC0], dst, src ); - copy_attr( lookup[VF_ATTRIB_BFC1], dst, src ); + copy_attr( lookup[TGSI_ATTRIB_COLOR0], dst, src ); + copy_attr( lookup[TGSI_ATTRIB_COLOR1], dst, src ); + copy_attr( lookup[TGSI_ATTRIB_BFC0], dst, src ); + copy_attr( lookup[TGSI_ATTRIB_BFC1], dst, src ); } diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 531bb2e2542..c5d4c62f71f 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -61,7 +61,8 @@ struct vertex_header { float data[][4]; /* Note variable size */ }; -#define MAX_VERTEX_SIZE ((2 + FRAG_ATTRIB_MAX) * 4 * sizeof(float)) +/* XXX This is too large */ +#define MAX_VERTEX_SIZE ((2 + TGSI_ATTRIB_MAX) * 4 * sizeof(float)) diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c index 822cadd61fe..4fd87786f84 100644 --- a/src/mesa/pipe/draw/draw_twoside.c +++ b/src/mesa/pipe/draw/draw_twoside.c @@ -79,12 +79,12 @@ static struct vertex_header *copy_bfc( struct twoside_stage *twoside, { struct vertex_header *tmp = dup_vert( &twoside->stage, v, idx ); - copy_color( twoside->lookup[VF_ATTRIB_COLOR0], - twoside->lookup[VF_ATTRIB_BFC0], + copy_color( twoside->lookup[TGSI_ATTRIB_COLOR0], + twoside->lookup[TGSI_ATTRIB_BFC0], tmp ); - copy_color( twoside->lookup[VF_ATTRIB_COLOR1], - twoside->lookup[VF_ATTRIB_BFC1], + copy_color( twoside->lookup[TGSI_ATTRIB_COLOR1], + twoside->lookup[TGSI_ATTRIB_BFC1], tmp ); return tmp; diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h index 3262431487e..0e15ea89a2f 100644 --- a/src/mesa/pipe/draw/draw_vertex.h +++ b/src/mesa/pipe/draw/draw_vertex.h @@ -33,84 +33,7 @@ #ifndef DRAW_VERTEX_H #define DRAW_VERTEX_H - -/*** - *** XXX There's a lot of legacy tokens here that'll eventually go away. - *** (at least we don't include vf/vf.h anymore) - ***/ - - -enum { - VF_ATTRIB_POS = 0, - VF_ATTRIB_WEIGHT = 1, - VF_ATTRIB_NORMAL = 2, - VF_ATTRIB_COLOR0 = 3, - VF_ATTRIB_COLOR1 = 4, - VF_ATTRIB_FOG = 5, - VF_ATTRIB_COLOR_INDEX = 6, - VF_ATTRIB_EDGEFLAG = 7, - VF_ATTRIB_TEX0 = 8, - VF_ATTRIB_TEX1 = 9, - VF_ATTRIB_TEX2 = 10, - VF_ATTRIB_TEX3 = 11, - VF_ATTRIB_TEX4 = 12, - VF_ATTRIB_TEX5 = 13, - VF_ATTRIB_TEX6 = 14, - VF_ATTRIB_TEX7 = 15, - VF_ATTRIB_VAR0 = 16, - VF_ATTRIB_VAR1 = 17, - VF_ATTRIB_VAR2 = 18, - VF_ATTRIB_VAR3 = 19, - VF_ATTRIB_VAR4 = 20, - VF_ATTRIB_VAR5 = 21, - VF_ATTRIB_VAR6 = 22, - VF_ATTRIB_VAR7 = 23, - VF_ATTRIB_POINTSIZE = 24, - VF_ATTRIB_BFC0 = 25, - VF_ATTRIB_BFC1 = 26, - VF_ATTRIB_CLIP_POS = 27, - VF_ATTRIB_VERTEX_HEADER = 28, - VF_ATTRIB_MAX = 29 -}; - -#define MAX_VARYING 8 -enum -{ - FRAG_ATTRIB_WPOS = 0, - FRAG_ATTRIB_COL0 = 1, - FRAG_ATTRIB_COL1 = 2, - FRAG_ATTRIB_FOGC = 3, - FRAG_ATTRIB_TEX0 = 4, - FRAG_ATTRIB_TEX1 = 5, - FRAG_ATTRIB_TEX2 = 6, - FRAG_ATTRIB_TEX3 = 7, - FRAG_ATTRIB_TEX4 = 8, - FRAG_ATTRIB_TEX5 = 9, - FRAG_ATTRIB_TEX6 = 10, - FRAG_ATTRIB_TEX7 = 11, - FRAG_ATTRIB_VAR0 = 12, /**< shader varying */ - FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING) -}; - -#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) -#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) -#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) -#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) -#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) - - - -#define MAX_DRAW_BUFFERS 4 - -enum -{ - FRAG_RESULT_COLR = 0, - FRAG_RESULT_COLH = 1, - FRAG_RESULT_DEPR = 2, - FRAG_RESULT_DATA0 = 3, - FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) -}; - +#include "pipe/tgsi/core/tgsi_attribs.h" #define MAX_VERT_ATTRIBS 12 /* OK? */ @@ -127,10 +50,10 @@ enum struct vertex_info { uint num_attribs; - uint hwfmt[2]; /**< hardware format info for this format */ + uint hwfmt[4]; /**< hardware format info for this format */ uint attr_mask; /**< mask of VF_ATTR_ bits */ uint slot_to_attrib[MAX_VERT_ATTRIBS]; - uint attrib_to_slot[VF_ATTRIB_MAX]; + uint attrib_to_slot[TGSI_ATTRIB_MAX]; uint interp_mode[MAX_VERT_ATTRIBS]; uint format[MAX_VERT_ATTRIBS]; /**< FORMAT_x */ uint size; /**< total vertex size in dwords */ |