summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-01-29 09:34:09 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-01-29 09:34:09 +0900
commitf3d0882c0218612a91a6feac91d23b34f6447d8e (patch)
tree88516311877b0aa789412b2d65b2925ba7cf07ac /src/mesa/pipe/draw
parent1e2d6b1b82aaa8bc57535e56c5e6eac9387e22e6 (diff)
gallium: Remove direct dependencies to mesa internals.
_mesa_exec_free is still being called. More invasive refactoring is necessary to clean it out.
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_vf.c20
-rw-r--r--src/mesa/pipe/draw/draw_vf.h52
-rw-r--r--src/mesa/pipe/draw/draw_vf_generic.c9
-rw-r--r--src/mesa/pipe/draw/draw_vf_sse.c14
4 files changed, 31 insertions, 64 deletions
diff --git a/src/mesa/pipe/draw/draw_vf.c b/src/mesa/pipe/draw/draw_vf.c
index deedfc7bc7..d36f6293b1 100644
--- a/src/mesa/pipe/draw/draw_vf.c
+++ b/src/mesa/pipe/draw/draw_vf.c
@@ -25,17 +25,20 @@
* Keith Whitwell <keithw@tungstengraphics.com>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
#include "pipe/p_compiler.h"
+#include "pipe/p_util.h"
#include "draw_vf.h"
+
#define DBG 0
+/* TODO: remove this */
+extern void
+_mesa_exec_free( void *addr );
+
static boolean match_fastpath( struct draw_vertex_fetch *vf,
const struct draw_vf_fastpath *fp)
@@ -88,7 +91,7 @@ void draw_vf_register_fastpath( struct draw_vertex_fetch *vf,
fastpath->match_strides = match_strides;
fastpath->func = vf->emit;
fastpath->attr = (struct draw_vf_attr_type *)
- _mesa_malloc(vf->attr_count * sizeof(fastpath->attr[0]));
+ MALLOC(vf->attr_count * sizeof(fastpath->attr[0]));
for (i = 0; i < vf->attr_count; i++) {
fastpath->attr[i].format = vf->attr[i].format;
@@ -156,7 +159,7 @@ unsigned draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
unsigned offset = 0;
unsigned i, j;
- assert(nr < DRAW_VF_ATTRIB_MAX);
+ assert(nr < PIPE_ATTRIB_MAX);
memset(vf->lookup, 0, sizeof(vf->lookup));
@@ -200,7 +203,7 @@ unsigned draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
-
+#if 0
/* Set attribute pointers, adjusted for start position:
*/
void draw_vf_set_sources( struct draw_vertex_fetch *vf,
@@ -223,6 +226,7 @@ void draw_vf_set_sources( struct draw_vertex_fetch *vf,
a[j].inputptr = ((uint8_t *)vptr->data) + start * vptr->stride;
}
}
+#endif
/* Set attribute pointers, adjusted for start position:
@@ -260,7 +264,7 @@ struct draw_vertex_fetch *draw_vf_create( void )
struct draw_vertex_fetch *vf = CALLOC_STRUCT(draw_vertex_fetch);
unsigned i;
- for (i = 0; i < DRAW_VF_ATTRIB_MAX; i++)
+ for (i = 0; i < PIPE_ATTRIB_MAX; i++)
vf->attr[i].vf = vf;
vf->identity[0] = 0.0;
@@ -271,7 +275,7 @@ struct draw_vertex_fetch *draw_vf_create( void )
vf->codegen_emit = NULL;
#ifdef USE_SSE_ASM
- if (!_mesa_getenv("MESA_NO_CODEGEN"))
+ if (!GETENV("MESA_NO_CODEGEN"))
vf->codegen_emit = draw_vf_generate_sse_emit;
#endif
diff --git a/src/mesa/pipe/draw/draw_vf.h b/src/mesa/pipe/draw/draw_vf.h
index c6a8fe0d53..7d90f35b0f 100644
--- a/src/mesa/pipe/draw/draw_vf.h
+++ b/src/mesa/pipe/draw/draw_vf.h
@@ -29,44 +29,11 @@
#define DRAW_VF_H
-#include "math/m_vector.h"
-
#include "pipe/p_compiler.h"
-#include "draw_vertex.h"
+#include "pipe/p_state.h"
+#include "draw_vertex.h"
-enum {
- DRAW_VF_ATTRIB_POS = 0,
- DRAW_VF_ATTRIB_WEIGHT = 1,
- DRAW_VF_ATTRIB_NORMAL = 2,
- DRAW_VF_ATTRIB_COLOR0 = 3,
- DRAW_VF_ATTRIB_COLOR1 = 4,
- DRAW_VF_ATTRIB_FOG = 5,
- DRAW_VF_ATTRIB_COLOR_INDEX = 6,
- DRAW_VF_ATTRIB_EDGEFLAG = 7,
- DRAW_VF_ATTRIB_TEX0 = 8,
- DRAW_VF_ATTRIB_TEX1 = 9,
- DRAW_VF_ATTRIB_TEX2 = 10,
- DRAW_VF_ATTRIB_TEX3 = 11,
- DRAW_VF_ATTRIB_TEX4 = 12,
- DRAW_VF_ATTRIB_TEX5 = 13,
- DRAW_VF_ATTRIB_TEX6 = 14,
- DRAW_VF_ATTRIB_TEX7 = 15,
- DRAW_VF_ATTRIB_VAR0 = 16,
- DRAW_VF_ATTRIB_VAR1 = 17,
- DRAW_VF_ATTRIB_VAR2 = 18,
- DRAW_VF_ATTRIB_VAR3 = 19,
- DRAW_VF_ATTRIB_VAR4 = 20,
- DRAW_VF_ATTRIB_VAR5 = 21,
- DRAW_VF_ATTRIB_VAR6 = 22,
- DRAW_VF_ATTRIB_VAR7 = 23,
- DRAW_VF_ATTRIB_POINTSIZE = 24,
- DRAW_VF_ATTRIB_BFC0 = 25,
- DRAW_VF_ATTRIB_BFC1 = 26,
- DRAW_VF_ATTRIB_CLIP_POS = 27,
- DRAW_VF_ATTRIB_VERTEX_HEADER = 28,
- DRAW_VF_ATTRIB_MAX = 29
-};
enum draw_vf_attr_format {
DRAW_EMIT_1F,
@@ -101,10 +68,12 @@ draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
unsigned nr,
unsigned vertex_stride );
+#if 0
void
draw_vf_set_sources( struct draw_vertex_fetch *vf,
GLvector4f * const attrib[],
- unsigned start );
+ unsigned start );
+#endif
void
draw_vf_set_data( struct draw_vertex_fetch *vf,
@@ -115,13 +84,6 @@ draw_vf_emit_vertices( struct draw_vertex_fetch *vf,
unsigned count,
void *dest );
-void
-draw_vf_get_attr( struct draw_vertex_fetch *vf,
- const void *vertex,
- GLenum attr,
- const float *dflt,
- float *dest );
-
struct draw_vertex_fetch *
draw_vf_create( void );
@@ -174,11 +136,11 @@ struct draw_vf_attr
struct draw_vertex_fetch
{
- struct draw_vf_attr attr[DRAW_VF_ATTRIB_MAX];
+ struct draw_vf_attr attr[PIPE_ATTRIB_MAX];
unsigned attr_count;
unsigned vertex_stride;
- struct draw_vf_attr *lookup[DRAW_VF_ATTRIB_MAX];
+ struct draw_vf_attr *lookup[PIPE_ATTRIB_MAX];
draw_vf_emit_func emit;
diff --git a/src/mesa/pipe/draw/draw_vf_generic.c b/src/mesa/pipe/draw/draw_vf_generic.c
index 343428d26c..a16eb456b7 100644
--- a/src/mesa/pipe/draw/draw_vf_generic.c
+++ b/src/mesa/pipe/draw/draw_vf_generic.c
@@ -26,12 +26,13 @@
* Keith Whitwell <keithw@tungstengraphics.com>
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
+
+#include <assert.h>
+
#include "simple_list.h"
#include "pipe/p_compiler.h"
+#include "pipe/p_util.h"
#include "draw_vf.h"
@@ -94,7 +95,7 @@ static INLINE void insert_3f_xyw_4( const struct draw_vf_attr *a, uint8_t *v, co
static INLINE void insert_3f_xyw_err( const struct draw_vf_attr *a, uint8_t *v, const float *in )
{
(void) a; (void) v; (void) in;
- _mesa_exit(1);
+ assert(0);
}
static INLINE void insert_3f_3( const struct draw_vf_attr *a, uint8_t *v, const float *in )
diff --git a/src/mesa/pipe/draw/draw_vf_sse.c b/src/mesa/pipe/draw/draw_vf_sse.c
index 066d6c0b7b..4036ded1d8 100644
--- a/src/mesa/pipe/draw/draw_vf_sse.c
+++ b/src/mesa/pipe/draw/draw_vf_sse.c
@@ -25,15 +25,14 @@
* Keith Whitwell <keithw@tungstengraphics.com>
*/
-#include "glheader.h"
-#include "colormac.h"
+
#include "simple_list.h"
-#include "enums.h"
#include "pipe/p_compiler.h"
#include "draw_vf.h"
+
#if defined(USE_SSE_ASM)
#include "x86/rtasm/x86sse.h"
@@ -450,7 +449,8 @@ static boolean build_vertex_emit( struct x86_program *p )
update_src_ptr(p, srcECX, vfESI, a);
}
else {
- _mesa_printf("Can't emit 1ub %x %x %d\n", a->vertoffset, a[-1].vertoffset, a[-1].vertattrsize );
+ fprintf(stderr, "Can't emit 1ub %x %x %d\n",
+ a->vertoffset, a[-1].vertoffset, a[-1].vertattrsize );
return FALSE;
}
break;
@@ -495,7 +495,7 @@ static boolean build_vertex_emit( struct x86_program *p )
j++; /* NOTE: two attrs consumed */
}
else {
- _mesa_printf("Can't emit 3ub\n");
+ fprintf(stderr, "Can't emit 3ub\n");
}
return FALSE; /* add this later */
break;
@@ -528,7 +528,7 @@ static boolean build_vertex_emit( struct x86_program *p )
update_src_ptr(p, srcECX, vfESI, a);
break;
default:
- _mesa_printf("unknown a[%d].format %d\n", j, a->format);
+ fprintf(stderr, "unknown a[%d].format %d\n", j, a->format);
return FALSE; /* catch any new opcodes */
}
@@ -577,7 +577,7 @@ void draw_vf_generate_sse_emit( struct draw_vertex_fetch *vf )
return;
}
- _mesa_memset(&p, 0, sizeof(p));
+ memset(&p, 0, sizeof(p));
p.vf = vf;
p.inputs_safe = 0; /* for now */