To build with mesa, need -DMESA in makefile/config file.
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
- -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN
+ -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN \
+ -DMESA
X11_INCLUDES = -I/usr/X11R6/include
CONFIG_NAME = linux-dri-debug
OPT_FLAGS = -O0 -g
-ARCH_FLAGS = -DDEBUG
+ARCH_FLAGS = -DDEBUG -DMESA
# Helpful to reduce the amount of stuff that gets built sometimes:
#DRI_DIRS = i915tex i915
*/
-#include "main/macros.h"
+#include "pipe/p_util.h"
#include "draw_private.h"
+#ifndef IS_NEGATIVE
+#define IS_NEGATIVE(X) ((X) < 0.0)
+#endif
+
+#ifndef DIFFERENT_SIGNS
+#define DIFFERENT_SIGNS(x, y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
+#endif
+
+#ifndef MAX_CLIPPED_VERTICES
+#define MAX_CLIPPED_VERTICES ((2 * (6 + PIPE_MAX_CLIP_PLANES))+1)
+#endif
+
struct clipper {
struct draw_stage stage; /**< base class */
- GLuint active_user_planes;
- GLfloat (*plane)[4];
+ unsigned active_user_planes;
+ float (*plane)[4];
};
/* All attributes are float[4], so this is easy:
*/
-static void interp_attr( GLfloat *fdst,
- GLfloat t,
- const GLfloat *fin,
- const GLfloat *fout )
+static void interp_attr( float *fdst,
+ float t,
+ const float *fin,
+ const float *fout )
{
fdst[0] = LINTERP( t, fout[0], fin[0] );
fdst[1] = LINTERP( t, fout[1], fin[1] );
*/
static void interp( const struct clipper *clip,
struct vertex_header *dst,
- GLfloat t,
+ float t,
const struct vertex_header *out,
const struct vertex_header *in )
{
- const GLuint nr_attrs = clip->stage.draw->nr_attrs;
- GLuint j;
+ const unsigned nr_attrs = clip->stage.draw->nr_attrs;
+ unsigned j;
/* Vertex header.
*/
/* Do the projective divide and insert window coordinates:
*/
{
- const GLfloat *pos = dst->clip;
- const GLfloat *scale = clip->stage.draw->viewport.scale;
- const GLfloat *trans = clip->stage.draw->viewport.translate;
- const GLfloat oow = 1.0 / pos[3];
+ const float *pos = dst->clip;
+ const float *scale = clip->stage.draw->viewport.scale;
+ const float *trans = clip->stage.draw->viewport.translate;
+ const float oow = 1.0 / pos[3];
dst->data[0][0] = pos[0] * oow * scale[0] + trans[0];
dst->data[0][1] = pos[1] * oow * scale[1] + trans[1];
#define CLIP_CULL_BIT 0x80
-static INLINE GLfloat dot4( const GLfloat *a,
- const GLfloat *b )
+static INLINE float dot4( const float *a,
+ const float *b )
{
- GLfloat result = (a[0]*b[0] +
+ float result = (a[0]*b[0] +
a[1]*b[1] +
a[2]*b[2] +
a[3]*b[3]);
static INLINE void do_tri( struct draw_stage *next,
struct prim_header *header )
{
- GLuint i;
+ unsigned i;
for (i = 0; i < 3; i++) {
- GLfloat *ndc = header->v[i]->data[0];
+ float *ndc = header->v[i]->data[0];
_mesa_printf("ndc %f %f %f\n", ndc[0], ndc[1], ndc[2]);
assert(ndc[0] >= -1 && ndc[0] <= 641);
assert(ndc[1] >= 30 && ndc[1] <= 481);
static void emit_poly( struct draw_stage *stage,
struct vertex_header **inlist,
- GLuint n )
+ unsigned n )
{
struct prim_header header;
- GLuint i;
+ unsigned i;
for (i = 2; i < n; i++) {
header.v[0] = inlist[0];
header.v[2] = inlist[i];
{
- GLuint tmp0 = header.v[0]->edgeflag;
- GLuint tmp2 = header.v[2]->edgeflag;
+ unsigned tmp0 = header.v[0]->edgeflag;
+ unsigned tmp2 = header.v[2]->edgeflag;
if (i != 2) header.v[0]->edgeflag = 0;
if (i != n-1) header.v[2]->edgeflag = 0;
#if 0
static void emit_poly( struct draw_stage *stage )
{
- GLuint i;
+ unsigned i;
for (i = 2; i < n; i++) {
header->v[0] = inlist[0];
static void
do_clip_tri( struct draw_stage *stage,
struct prim_header *header,
- GLuint clipmask )
+ unsigned clipmask )
{
struct clipper *clipper = clipper_stage( stage );
struct vertex_header *a[MAX_CLIPPED_VERTICES];
struct vertex_header *b[MAX_CLIPPED_VERTICES];
struct vertex_header **inlist = a;
struct vertex_header **outlist = b;
- GLuint tmpnr = 0;
- GLuint n = 3;
- GLuint i;
+ unsigned tmpnr = 0;
+ unsigned n = 3;
+ unsigned i;
inlist[0] = header->v[0];
inlist[1] = header->v[1];
}
while (clipmask && n >= 3) {
- GLuint plane_idx = ffs(clipmask)-1;
- const GLfloat *plane = clipper->plane[plane_idx];
+ unsigned plane_idx = ffs(clipmask)-1;
+ const float *plane = clipper->plane[plane_idx];
struct vertex_header *vert_prev = inlist[0];
- GLfloat dp_prev = dot4( vert_prev->clip, plane );
- GLuint outcount = 0;
+ float dp_prev = dot4( vert_prev->clip, plane );
+ unsigned outcount = 0;
clipmask &= ~(1<<plane_idx);
for (i = 1; i <= n; i++) {
struct vertex_header *vert = inlist[i];
- GLfloat dp = dot4( vert->clip, plane );
+ float dp = dot4( vert->clip, plane );
if (!IS_NEGATIVE(dp_prev)) {
outlist[outcount++] = vert_prev;
/* Going out of bounds. Avoid division by zero as we
* know dp != dp_prev from DIFFERENT_SIGNS, above.
*/
- GLfloat t = dp / (dp - dp_prev);
+ float t = dp / (dp - dp_prev);
interp( clipper, new_vert, t, vert, vert_prev );
/* Force edgeflag true in this case:
} else {
/* Coming back in.
*/
- GLfloat t = dp_prev / (dp_prev - dp);
+ float t = dp_prev / (dp_prev - dp);
interp( clipper, new_vert, t, vert_prev, vert );
/* Copy starting vert's edgeflag:
static void
do_clip_line( struct draw_stage *stage,
struct prim_header *header,
- GLuint clipmask )
+ unsigned clipmask )
{
const struct clipper *clipper = clipper_stage( stage );
struct vertex_header *v0 = header->v[0];
struct vertex_header *v1 = header->v[1];
- const GLfloat *pos0 = v0->clip;
- const GLfloat *pos1 = v1->clip;
- GLfloat t0 = 0;
- GLfloat t1 = 0;
+ const float *pos0 = v0->clip;
+ const float *pos1 = v1->clip;
+ float t0 = 0;
+ float t1 = 0;
struct prim_header newprim;
/* XXX: Note stupid hack to deal with tnl's 8-bit clipmask. Remove
}
while (clipmask) {
- const GLuint plane_idx = ffs(clipmask)-1;
- const GLfloat *plane = clipper->plane[plane_idx];
- const GLfloat dp0 = dot4( pos0, plane );
- const GLfloat dp1 = dot4( pos1, plane );
+ const unsigned plane_idx = ffs(clipmask)-1;
+ const float *plane = clipper->plane[plane_idx];
+ const float dp0 = dot4( pos0, plane );
+ const float dp1 = dot4( pos1, plane );
if (dp1 < 0) {
- GLfloat t = dp1 / (dp1 - dp0);
+ float t = dp1 / (dp1 - dp0);
t1 = MAX2(t1, t);
}
if (dp0 < 0) {
- GLfloat t = dp0 / (dp0 - dp1);
+ float t = dp0 / (dp0 - dp1);
t0 = MAX2(t0, t);
}
static void clip_begin( struct draw_stage *stage )
{
struct clipper *clipper = clipper_stage(stage);
- GLuint nr = stage->draw->nr_planes;
+ unsigned nr = stage->draw->nr_planes;
/* sanity checks. If these fail, review the clip/interp code! */
assert(stage->draw->nr_attrs >= 3);
clip_line( struct draw_stage *stage,
struct prim_header *header )
{
- GLuint clipmask = (header->v[0]->clipmask |
+ unsigned clipmask = (header->v[0]->clipmask |
header->v[1]->clipmask);
if (clipmask == 0) {
clip_tri( struct draw_stage *stage,
struct prim_header *header )
{
- GLuint clipmask = (header->v[0]->clipmask |
+ unsigned clipmask = (header->v[0]->clipmask |
header->v[1]->clipmask |
header->v[2]->clipmask);
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "macros.h"
+#ifdef MESA
+#include "main/macros.h"
+#else
+#include "pipe/p_util.h"
+#endif
#include "draw_context.h"
#include "draw_private.h"
-
struct draw_context *draw_create( void )
{
struct draw_context *draw = CALLOC_STRUCT( draw_context );
ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */
draw->nr_planes = 6;
+#ifdef MESA
draw->vf = vf_create( GL_TRUE );
+#endif
/* Statically allocate maximum sized vertices for the cache - could be cleverer...
*/
void draw_destroy( struct draw_context *draw )
{
- if (draw->header.storage)
+#ifdef MESA
+ if (draw->header.storage) {
ALIGN_FREE( draw->header.storage );
+ }
vf_destroy( draw->vf );
+#endif
free( draw->vcache.vertex[0] ); /* Frees all the vertices. */
free( draw );
{
draw->viewport = *viewport; /* struct copy */
+#ifdef MESA
vf_set_vp_scale_translate( draw->vf, viewport->scale, viewport->translate );
+#endif
/* Using tnl/ and vf/ modules is temporary while getting started.
* Full pipe will have vertex shader, vertex fetch of its own.
#define DRAW_CONTEXT_H
-#include "main/glheader.h"
#include "pipe/p_state.h"
struct draw_stage *stage );
void draw_set_vertex_attributes( struct draw_context *draw,
- const GLuint *attrs,
- GLuint nr_attrs );
+ const unsigned *attrs,
+ unsigned nr_attrs );
/* XXX temporary */
void draw_set_vertex_attributes2( struct draw_context *draw,
- const GLuint *attrs,
- GLuint nr_attrs );
+ const unsigned *attrs,
+ unsigned nr_attrs );
void draw_set_vertex_array_info(struct draw_context *draw,
const struct pipe_vertex_buffer *buffers,
struct vertex_buffer *VB );
void draw_vertices(struct draw_context *draw,
- GLuint mode,
- GLuint numVertex, const GLfloat *verts,
- GLuint numAttribs, const GLuint attribs[]);
+ unsigned mode,
+ unsigned numVertex, const float *verts,
+ unsigned numAttribs, const unsigned attribs[]);
#endif /* DRAW_CONTEXT_H */
*/
-#include "main/imports.h"
+#include "pipe/p_util.h"
#include "pipe/p_defines.h"
#include "draw_private.h"
struct cull_stage {
struct draw_stage stage;
- GLuint winding; /**< which winding(s) to cull (one of PIPE_WINDING_x) */
+ unsigned winding; /**< which winding(s) to cull (one of PIPE_WINDING_x) */
};
struct prim_header *header )
{
/* Window coords: */
- const GLfloat *v0 = header->v[0]->data[0];
- const GLfloat *v1 = header->v[1]->data[0];
- const GLfloat *v2 = header->v[2]->data[0];
+ const float *v0 = header->v[0]->data[0];
+ const float *v1 = header->v[1]->data[0];
+ const float *v2 = header->v[2]->data[0];
/* edge vectors e = v0 - v2, f = v1 - v2 */
- GLfloat ex = v0[0] - v2[0];
- GLfloat ey = v0[1] - v2[1];
- GLfloat fx = v1[0] - v2[0];
- GLfloat fy = v1[1] - v2[1];
+ const float ex = v0[0] - v2[0];
+ const float ey = v0[1] - v2[1];
+ const float fx = v1[0] - v2[0];
+ const float fy = v1[1] - v2[1];
/* det = cross(e,f).z */
header->det = ex * fy - ey * fx;
/* if (det < 0 then Z points toward camera and triangle is
* counter-clockwise winding.
*/
- GLuint winding = (header->det < 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW;
+ unsigned winding = (header->det < 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW;
if ((winding & cull_stage(stage)->winding) == 0) {
/* triangle is not culled, pass to next stage */
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/imports.h"
+#include "pipe/p_util.h"
#include "draw_private.h"
struct flatshade_stage {
struct draw_stage stage;
- const GLuint *lookup;
+ const unsigned *lookup;
};
-static INLINE void copy_attr( GLuint attr,
+static INLINE void copy_attr( unsigned attr,
struct vertex_header *dst,
const struct vertex_header *src )
{
const struct vertex_header *src )
{
const struct flatshade_stage *flatshade = flatshade_stage(stage);
- const GLuint *lookup = flatshade->lookup;
+ const unsigned *lookup = flatshade->lookup;
copy_attr( lookup[VF_ATTRIB_COLOR0], dst, src );
copy_attr( lookup[VF_ATTRIB_COLOR1], dst, src );
* \author Brian Paul
*/
-#include "main/imports.h"
-#include "main/macros.h"
+#include "pipe/p_util.h"
#include "draw_private.h"
struct offset_stage {
struct draw_stage stage;
- GLfloat scale;
- GLfloat units;
+ float scale;
+ float units;
};
static void offset_begin( struct draw_stage *stage )
{
struct offset_stage *offset = offset_stage(stage);
- GLfloat mrd = 1.0 / 65535.0; /* XXX this depends on depthbuffer bits! */
+ float mrd = 1.0 / 65535.0; /* XXX this depends on depthbuffer bits! */
offset->units = stage->draw->setup.offset_units * mrd;
offset->scale = stage->draw->setup.offset_scale;
struct prim_header *header )
{
struct offset_stage *offset = offset_stage(stage);
- GLfloat inv_det = 1.0 / header->det;
+ float inv_det = 1.0 / header->det;
/* Window coords:
*/
- GLfloat *v0 = header->v[0]->data[0];
- GLfloat *v1 = header->v[1]->data[0];
- GLfloat *v2 = header->v[2]->data[0];
+ float *v0 = header->v[0]->data[0];
+ float *v1 = header->v[1]->data[0];
+ float *v2 = header->v[2]->data[0];
/* edge vectors e = v0 - v2, f = v1 - v2 */
- GLfloat ex = v0[0] - v2[0];
- GLfloat ey = v0[1] - v2[1];
- GLfloat ez = v0[2] - v2[2];
- GLfloat fx = v1[0] - v2[0];
- GLfloat fy = v1[1] - v2[1];
- GLfloat fz = v1[2] - v2[2];
+ float ex = v0[0] - v2[0];
+ float ey = v0[1] - v2[1];
+ float ez = v0[2] - v2[2];
+ float fx = v1[0] - v2[0];
+ float fy = v1[1] - v2[1];
+ float fz = v1[2] - v2[2];
/* (a,b) = cross(e,f).xy */
- GLfloat a = ey*fz - ez*fy;
- GLfloat b = ez*fx - ex*fz;
+ float a = ey*fz - ez*fy;
+ float b = ez*fx - ex*fz;
- GLfloat dzdx = FABSF(a * inv_det);
- GLfloat dzdy = FABSF(b * inv_det);
+ float dzdx = FABSF(a * inv_det);
+ float dzdy = FABSF(b * inv_det);
- GLfloat zoffset = offset->units + MAX2(dzdx, dzdy) * offset->scale;
+ float zoffset = offset->units + MAX2(dzdx, dzdy) * offset->scale;
/*
* Note: we're applying the offset and clamping per-vertex.
* Keith Whitwell <keith@tungstengraphics.com>
*/
+#include "pipe/p_util.h"
#include "draw_private.h"
#include "draw_context.h"
#include "draw_prim.h"
static struct vertex_header *get_ushort_elt_vertex( struct draw_context *draw,
unsigned i )
{
- const GLushort *elts = (const GLushort *)draw->elts;
+ const ushort *elts = (const ushort *)draw->elts;
return get_vertex( draw, elts[i] );
}
static struct vertex_header *get_ubyte_elt_vertex( struct draw_context *draw,
unsigned i )
{
- const GLubyte *elts = (const GLubyte *)draw->elts;
+ const ubyte *elts = (const ubyte *)draw->elts;
return get_vertex( draw, elts[i] );
}
/**
* Allocate space for temporary post-transform vertices, such as for clipping.
*/
-void draw_alloc_tmps( struct draw_stage *stage, GLuint nr )
+void draw_alloc_tmps( struct draw_stage *stage, unsigned nr )
{
stage->nr_tmps = nr;
if (nr) {
- GLubyte *store = (GLubyte *) malloc(MAX_VERTEX_SIZE * nr);
- GLuint i;
+ ubyte *store = (ubyte *) malloc(MAX_VERTEX_SIZE * nr);
+ unsigned i;
stage->tmp = (struct vertex_header **) malloc(sizeof(struct vertex_header *) * nr);
#define DRAW_PRIVATE_H
-#include "main/glheader.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
+#ifdef MESA
#include "vf/vf.h"
+#else
+/* XXX these are temporary */
+struct vf_attr_map {
+ unsigned attrib;
+ unsigned format;
+ unsigned offset;
+};
+#define VF_ATTRIB_POS 0
+#define VF_ATTRIB_COLOR0 3
+#define VF_ATTRIB_COLOR1 4
+#define VF_ATTRIB_BFC0 25
+#define VF_ATTRIB_BFC1 26
+
+#define VF_ATTRIB_CLIP_POS 27
+#define VF_ATTRIB_VERTEX_HEADER 28
+#define VF_ATTRIB_MAX 29
+#define EMIT_1F 0
+#define EMIT_4F 3
+#define EMIT_4F_VIEWPORT 6
+#define FRAG_ATTRIB_MAX 13
+#endif
/**
/* Misc for draw_vb.c (XXX temporary)
*/
+#ifdef MESA
GLvector4f header;
+#endif
ubyte *verts;
boolean in_vb;
struct vertex_fetch *vf;
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/imports.h"
+#include "pipe/p_util.h"
#include "pipe/p_defines.h"
#include "draw_private.h"
struct twoside_stage {
struct draw_stage stage;
- GLfloat sign; /**< +1 or -1 */
- const GLuint *lookup;
+ float sign; /**< +1 or -1 */
+ const unsigned *lookup;
};
}
-static INLINE void copy_color( GLuint attr_dst,
- GLuint attr_src,
+static INLINE void copy_color( unsigned attr_dst,
+ unsigned attr_src,
struct vertex_header *v )
{
if (attr_dst && attr_src) {
static struct vertex_header *copy_bfc( struct twoside_stage *twoside,
const struct vertex_header *v,
- GLuint idx )
+ unsigned idx )
{
struct vertex_header *tmp = dup_vert( &twoside->stage, v, idx );
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/imports.h"
+#include "pipe/p_util.h"
#include "pipe/p_defines.h"
#include "draw_private.h"
* legal values: PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE,
* and PIPE_POLYGON_MODE_POINT,
*/
- GLuint mode[2];
+ unsigned mode[2];
};
struct prim_header *header )
{
struct unfilled_stage *unfilled = unfilled_stage(stage);
- GLuint mode = unfilled->mode[header->det < 0.0];
+ unsigned mode = unfilled->mode[header->det < 0.0];
switch (mode) {
case PIPE_POLYGON_MODE_FILL:
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "macros.h"
-
+#ifdef MESA
+#include "main/imports.h"
+#include "main/macros.h"
#include "tnl/t_context.h"
#include "vf/vf.h"
+#else
+#define VF_
+#include "pipe/p_util.h"
+
+#endif /*MESA*/
+
#include "draw_private.h"
#include "draw_context.h"
* Allocate storage for post-transformation vertices.
*/
static void
-draw_allocate_vertices( struct draw_context *draw, GLuint nr_vertices )
+draw_allocate_vertices( struct draw_context *draw, unsigned nr_vertices )
{
assert(draw->vertex_size > 0);
draw->nr_vertices = nr_vertices;
- draw->verts = (GLubyte *) malloc( nr_vertices * draw->vertex_size );
+ draw->verts = (ubyte *) malloc( nr_vertices * draw->vertex_size );
draw_invalidate_vcache( draw );
}
* Note: this must match struct vertex_header's layout (I think).
*/
struct header_dword {
- GLuint clipmask:12;
- GLuint edgeflag:1;
- GLuint pad:19;
+ unsigned clipmask:12;
+ unsigned edgeflag:1;
+ unsigned pad:19;
};
+#ifdef MESA
static void
build_vertex_headers( struct draw_context *draw,
struct vertex_buffer *VB )
{
if (draw->header.storage == NULL) {
- draw->header.stride = sizeof(GLfloat);
+ draw->header.stride = sizeof(float);
draw->header.size = 1;
- draw->header.storage = ALIGN_MALLOC( VB->Size * sizeof(GLfloat), 32 );
+ draw->header.storage = ALIGN_MALLOC( VB->Size * sizeof(float), 32 );
draw->header.data = draw->header.storage;
draw->header.count = 0;
draw->header.flags = VEC_SIZE_1 | VEC_MALLOC;
*/
{
- GLuint i;
+ unsigned i;
struct header_dword *header = (struct header_dword *)draw->header.storage;
/* yes its a hack
*/
- assert(sizeof(*header) == sizeof(GLfloat));
+ assert(sizeof(*header) == sizeof(float));
draw->header.count = VB->Count;
VB->AttribPtr[VF_ATTRIB_VERTEX_HEADER] = &draw->header;
}
+#endif /*MESA*/
+#ifdef MESA
/**
* This is a hack & will all go away.
*/
void draw_vb(struct draw_context *draw,
struct vertex_buffer *VB )
{
- GLuint i;
+ unsigned i;
VB->AttribPtr[VF_ATTRIB_POS] = VB->NdcPtr;
VB->AttribPtr[VF_ATTRIB_BFC0] = VB->ColorPtr[1];
vf_emit_vertices( draw->vf, VB->Count, draw->verts );
if (VB->Elts)
- draw_set_element_buffer(draw, sizeof(GLuint), VB->Elts);
+ draw_set_element_buffer(draw, sizeof(unsigned), VB->Elts);
else
draw_set_element_buffer(draw, 0, NULL);
for (i = 0; i < VB->PrimitiveCount; i++) {
const GLenum mode = VB->Primitive[i].mode;
- const GLuint start = VB->Primitive[i].start;
- GLuint length, first, incr;
+ const unsigned start = VB->Primitive[i].start;
+ unsigned length, first, incr;
/* Trim the primitive down to a legal size.
*/
draw->in_vb = 0;
draw->elts = NULL;
}
+#endif /*MESA*/
/**
* XXX Temporary mechanism to draw simple vertex arrays.
- * All attribs are GLfloat[4]. Arrays are interleaved, in GL-speak.
+ * All attribs are float[4]. Arrays are interleaved, in GL-speak.
*/
void
draw_vertices(struct draw_context *draw,
- GLuint mode,
- GLuint numVerts, const GLfloat *vertices,
- GLuint numAttrs, const GLuint attribs[])
+ unsigned mode,
+ unsigned numVerts, const float *vertices,
+ unsigned numAttrs, const unsigned attribs[])
{
- /*GLuint first, incr;*/
- GLuint i, j;
+ /*unsigned first, incr;*/
+ unsigned i, j;
- assert(mode <= GL_POLYGON);
+ assert(mode <= PIPE_PRIM_POLYGON);
draw->vs_flush = vs_flush;
draw->vertex_size
- = sizeof(struct vertex_header) + numAttrs * 4 * sizeof(GLfloat);
+ = sizeof(struct vertex_header) + numAttrs * 4 * sizeof(float);
/* no element/index buffer */
* (and number of attributes)
*/
void draw_set_vertex_attributes( struct draw_context *draw,
- const GLuint *slot_to_vf_attr,
- GLuint nr_attrs )
+ const unsigned *slot_to_vf_attr,
+ unsigned nr_attrs )
{
- GLuint i;
+ unsigned i;
memset(draw->vf_attr_to_slot, 0, sizeof(draw->vf_attr_to_slot));
draw->nr_attrs = 0;
EMIT_ATTR(slot_to_vf_attr[i], EMIT_4F);
/* tell the vertex format module how to construct vertices for us */
+#if MESA
draw->vertex_size = vf_set_vertex_attributes( draw->vf, draw->attrs,
draw->nr_attrs, 0 );
+#endif
}
} while (0)
+#define COPY_4FV( DST, SRC ) COPY_4V(DST, SRC)
+
+
+#define ASSIGN_4V( DST, V0, V1, V2, V3 ) \
+do { \
+ (DST)[0] = (V0); \
+ (DST)[1] = (V1); \
+ (DST)[2] = (V2); \
+ (DST)[3] = (V3); \
+} while (0)
+
+
static INLINE int ifloor(float f)
{
int ai, bi;
}
+/** XXX remove these? */
+#define MAX_TEXTURE_LEVELS 11
+#define MAX_TEXTURE_RECT_SIZE 2048
+#define MAX_3D_TEXTURE_LEVELS 8
+
static void
softpipe_max_texture_size(struct pipe_context *pipe, unsigned textureType,
unsigned *maxWidth, unsigned *maxHeight,
#include "pipe/draw/draw_private.h"
#include "pipe/p_util.h"
+#ifndef MESA
+#define FRAG_ATTRIB_WPOS 0
+#define FRAG_ATTRIB_MAX 13
+#endif
+
/**
* Triangle edge info
/* Call into the new draw code to handle the VB:
*/
st->pipe->draw_vb( st->pipe, VB );
-
+
/* Finished
*/
return GL_FALSE;