gallium: Remove direct dependencies to mesa internals.

_mesa_exec_free is still being called. More invasive refactoring is necessary to clean it out.
This commit is contained in:
José Fonseca
2008-01-29 09:34:09 +09:00
parent 1e2d6b1b82
commit f3d0882c02
4 changed files with 31 additions and 64 deletions

View File

@@ -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

View File

@@ -29,45 +29,12 @@
#define DRAW_VF_H
#include "math/m_vector.h"
#include "pipe/p_compiler.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,
DRAW_EMIT_2F,
@@ -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;

View File

@@ -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 )

View File

@@ -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 */