summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv/r128/r128_vb.h
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r128/r128_vb.h')
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_vb.h150
1 files changed, 150 insertions, 0 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h
new file mode 100644
index 000000000..4f7c11d7f
--- /dev/null
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h
@@ -0,0 +1,150 @@
+/* $XFree86$ */
+/**************************************************************************
+
+Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
+ Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ */
+
+#ifndef _R128_VB_H_
+#define _R128_VB_H_
+
+#ifdef GLX_DIRECT_RENDERING
+
+#define USE_RHW2 0
+
+/* FIXME: This is endian-specific */
+typedef struct {
+ GLubyte b;
+ GLubyte g;
+ GLubyte r;
+ GLubyte a;
+} r128Color;
+
+typedef struct {
+ GLfloat x, y, z; /* Coordinates in screen space */
+ GLfloat rhw; /* Reciprocal homogeneous w */
+ r128Color dif_argb; /* Diffuse color */
+ r128Color spec_frgb; /* Specular color (alpha is fog) */
+ GLfloat tu0, tv0; /* Texture 0 coordinates */
+ GLfloat tu1, tv1; /* Texture 1 coordinates */
+#if USE_RHW2
+ GLfloat rhw2; /* Reciprocal homogeneous w */
+#endif
+} r128_vertex;
+
+#if USE_RHW2
+/* Format of vertices in r128_vertex struct */
+#define R128_FULL_VERTEX_FORMAT \
+ R128_CCE_VC_FRMT_RHW | \
+ R128_CCE_VC_FRMT_DIFFUSE_ARGB | \
+ R128_CCE_VC_FRMT_SPEC_FRGB | \
+ R128_CCE_VC_FRMT_S_T | \
+ R128_CCE_VC_FRMT_S2_T2 | \
+ R128_CCE_VC_FRMT_RHW2
+
+/* Send a single vertex to the ring buffer */
+#define R128CCE_SEND_VERTEX(v) \
+ do { \
+ R128CCEF((v)->x); \
+ R128CCEF((v)->y); \
+ R128CCEF((v)->z); \
+ R128CCEF((v)->rhw); \
+ R128CCE(*(int *)&(v)->dif_argb); \
+ R128CCE(*(int *)&(v)->spec_frgb); \
+ R128CCEF((v)->tu0); \
+ R128CCEF((v)->tv0); \
+ R128CCEF((v)->tu1); \
+ R128CCEF((v)->tv1); \
+ R128CCEF((v)->rhw2); \
+ } while (0)
+
+#else /* !USE_RHW2 */
+
+/* Format of vertices in r128_vertex struct */
+#define R128_FULL_VERTEX_FORMAT \
+ R128_CCE_VC_FRMT_RHW | \
+ R128_CCE_VC_FRMT_DIFFUSE_ARGB | \
+ R128_CCE_VC_FRMT_SPEC_FRGB | \
+ R128_CCE_VC_FRMT_S_T | \
+ R128_CCE_VC_FRMT_S2_T2
+
+/* Send a single vertex to the ring buffer */
+#define R128CCE_SEND_VERTEX(v) \
+ do { \
+ R128CCEF((v)->x); \
+ R128CCEF((v)->y); \
+ R128CCEF((v)->z); \
+ R128CCEF((v)->rhw); \
+ R128CCE(*(int *)&(v)->dif_argb); \
+ R128CCE(*(int *)&(v)->spec_frgb); \
+ R128CCEF((v)->tu0); \
+ R128CCEF((v)->tv0); \
+ R128CCEF((v)->tu1); \
+ R128CCEF((v)->tv1); \
+ } while (0)
+#endif
+
+/* FIXME: We currently only have assembly for 16-stride vertices */
+typedef union {
+ r128_vertex v;
+ float f[16];
+} r128Vertex, *r128VertexPtr;
+
+/* Vertex buffer for use when on the fast path */
+typedef struct {
+ GLuint size; /* Number of vertices in store */
+ void *vert_store; /* Storage for vertex buffer */
+ r128VertexPtr verts; /* Aligned start of verts in storage */
+ int last_vert; /* Index of last vertex used */
+ GLvector1ui clipped_elements; /* List of clipped elements */
+} *r128VertexBufferPtr;
+
+#define R128_DRIVER_DATA(vb) ((r128VertexBufferPtr)((vb)->driver_data))
+
+#define R128_SPEC_BIT 0x01
+#define R128_FOG_BIT 0x02
+#define R128_ALPHA_BIT 0x04 /* GL_BLEND, not used */
+#define R128_TEX1_BIT 0x08
+#define R128_TEX0_BIT 0x10
+#define R128_RGBA_BIT 0x20
+#define R128_WIN_BIT 0x40
+
+extern void r128SetupInit(void);
+extern void r128ChooseRasterSetupFunc(GLcontext *ctx);
+extern void r128CheckPartialRasterSetup(GLcontext *ctx,
+ struct gl_pipeline_stage *s);
+extern void r128PartialRasterSetup(struct vertex_buffer *VB);
+extern void r128DoRasterSetup(struct vertex_buffer *VB);
+extern void r128ResizeVB(struct vertex_buffer *VB, GLuint size);
+extern void r128DDRegisterVB(struct vertex_buffer *VB);
+extern void r128DDUnregisterVB(struct vertex_buffer *VB);
+
+#endif
+#endif /* _R128_VB_H_ */