summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw/draw_vertex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/draw/draw_vertex.h')
-rw-r--r--src/mesa/pipe/draw/draw_vertex.h51
1 files changed, 37 insertions, 14 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h
index f696475510..391058af26 100644
--- a/src/mesa/pipe/draw/draw_vertex.h
+++ b/src/mesa/pipe/draw/draw_vertex.h
@@ -38,21 +38,34 @@
#define MAX_VERT_ATTRIBS 12 /* OK? */
-#define FORMAT_OMIT 0
-#define FORMAT_1F 1
-#define FORMAT_2F 2
-#define FORMAT_3F 3
-#define FORMAT_4F 4
-#define FORMAT_4F_VIEWPORT 4
-#define FORMAT_4UB 5
+
+struct draw_context;
+
+
+
+/**
+ * Vertex attribute format
+ */
+typedef enum {
+ FORMAT_OMIT,
+ FORMAT_1F,
+ FORMAT_2F,
+ FORMAT_3F,
+ FORMAT_4F,
+ FORMAT_4F_VIEWPORT,
+ FORMAT_4UB
+} attrib_format;
-enum interp_mode {
+/**
+ * Attribute interpolation mode
+ */
+typedef enum {
INTERP_NONE, /**< never interpolate vertex header info */
INTERP_CONSTANT,
INTERP_LINEAR,
INTERP_PERSPECTIVE
-};
+} interp_mode;
@@ -63,8 +76,8 @@ struct vertex_info
uint attr_mask; /**< mask of VF_ATTR_ bits */
uint slot_to_attrib[MAX_VERT_ATTRIBS];
uint attrib_to_slot[TGSI_ATTRIB_MAX];
- uint interp_mode[MAX_VERT_ATTRIBS];
- uint format[MAX_VERT_ATTRIBS]; /**< FORMAT_x */
+ interp_mode interp_mode[MAX_VERT_ATTRIBS];
+ attrib_format format[MAX_VERT_ATTRIBS]; /**< FORMAT_x */
uint size; /**< total vertex size in dwords */
};
@@ -75,10 +88,11 @@ struct vertex_info
* \return slot in which the attribute was added
*/
static INLINE uint
-draw_emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr, uint format,
- uint interp)
+draw_emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr,
+ attrib_format format, interp_mode interp)
{
const uint n = vinfo->num_attribs;
+ assert(n < MAX_VERT_ATTRIBS);
vinfo->attr_mask |= (1 << vfAttr);
vinfo->slot_to_attrib[n] = vfAttr;
vinfo->format[n] = format;
@@ -88,8 +102,17 @@ draw_emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr, uint format,
}
+extern void draw_set_vertex_attributes( struct draw_context *draw,
+ const uint *attrs,
+ const interp_mode *interps,
+ unsigned nr_attrs );
+
+extern void draw_set_twoside_attributes(struct draw_context *draw,
+ uint front0, uint back0,
+ uint front1, uint back1);
+
+extern void draw_compute_vertex_size(struct vertex_info *vinfo);
-struct draw_context;
extern int draw_vertex_cache_check_space( struct draw_context *draw,
unsigned nr_verts );