#endif
}
+/** Wrapper around either memcmp() or xf86memcmp() */
+int
+_mesa_memcmp( const void *s1, const void *s2, size_t n )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86memcmp( s1, s2, n );
+#elif defined(SUNOS4)
+ return memcmp( (char *) s1, (char *) s2, (int) n );
+#else
+ return memcmp(s1, s2, n);
+#endif
+}
+
/*@}*/
extern void
_mesa_bzero( void *dst, size_t n );
+extern int
+_mesa_memcmp( const void *s1, const void *s2, size_t n );
extern double
_mesa_sin(double a);
} hist[N_TEXELS];
GLint lenh = 0;
- memset(hist, 0, sizeof(hist));
+ _mesa_memset(hist, 0, sizeof(hist));
for (k = 0; k < n; k++) {
GLint l;
if (comps == 3) {
/* make the whole block opaque */
- memset(input, -1, sizeof(input));
+ _mesa_memset(input, -1, sizeof(input));
}
/* 8 texels each line */
GLuint nr = p->program->Base.NumInstructions++;
struct fp_instruction *inst = &p->program->Instructions[nr];
- memset(inst, 0, sizeof(*inst));
+ _mesa_memset(inst, 0, sizeof(*inst));
inst->Opcode = op;
emit_arg( &inst->SrcReg[0], src0 );
emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0,
two, src[0], neg1);
- if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0)
+ if (_mesa_memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0)
tmp1 = tmp0;
else
emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0,
emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
emit_arith( &p, FP_OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
}
- else if (memcmp(&cf, &out, sizeof(cf)) != 0) {
+ else if (_mesa_memcmp(&cf, &out, sizeof(cf)) != 0) {
/* Will wind up in here if no texture enabled or a couple of
* other scenarios (GL_REPLACE for instance).
*/
struct texenvprog_cache *c;
for (c = cache; c; c = c->next) {
- if (c->hash == hash && memcmp(c->key, key, keysize) == 0)
+ if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0)
return c->data;
}
/* Always need the base level image */
if (!t->Image[0][baseLevel]) {
char s[100];
- sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL",
+ _mesa_sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL",
(void *) t, t->Name, baseLevel);
incomplete(t, s);
t->Complete = GL_FALSE;
GLfloat m[16];
GLboolean optimized;
- s = (GLfloat) sin( angle * DEG2RAD );
- c = (GLfloat) cos( angle * DEG2RAD );
+ s = (GLfloat) _mesa_sin( angle * DEG2RAD );
+ c = (GLfloat) _mesa_cos( angle * DEG2RAD );
MEMCPY(m, Identity, sizeof(GLfloat)*16);
optimized = GL_FALSE;
/*struct var_cache *first = va;*/
while (va) {
- if (!strcmp ( (const char*) name, (const char*) va->name)) {
+ if (!_mesa_strcmp ( (const char*) name, (const char*) va->name)) {
if (va->type == vt_alias)
return va->alias_binding;
return va;
}
if (src->File == PROGRAM_NAMED_PARAM) {
if (program->Parameters->Parameters[src->Index].Type == CONSTANT) {
- printf("{%g, %g, %g, %g}",
+ _mesa_printf("{%g, %g, %g, %g}",
program->Parameters->ParameterValues[src->Index][0],
program->Parameters->ParameterValues[src->Index][1],
program->Parameters->ParameterValues[src->Index][2],
else {
ASSERT(program->Parameters->Parameters[src->Index].Type
== NAMED_PARAMETER);
- printf("%s", program->Parameters->Parameters[src->Index].Name);
+ _mesa_printf("%s", program->Parameters->Parameters[src->Index].Name);
}
}
else if (src->File == PROGRAM_OUTPUT) {
for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) {
const char *name = _mesa_nv_vertex_input_register_name(i);
char number[10];
- sprintf(number, "%d", i);
+ _mesa_sprintf(number, "%d", i);
if (_mesa_strncmp(reg + 2, name, 4) == 0 ||
_mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) {
COPY_4V(v, ctx->VertexProgram.Inputs[i]);
char buf[1024];
va_start (va, msg);
- vsprintf (buf, msg, va);
+ _mesa_sprintf (buf, msg, va);
if (slang_info_log_message (log, "error", buf))
return 1;
slang_info_log_memory (log);
char buf[1024];
va_start (va, msg);
- vsprintf (buf, msg, va);
+ _mesa_sprintf (buf, msg, va);
if (slang_info_log_message (log, "warning", buf))
return 1;
slang_info_log_memory (log);
char filename[256];\r
\r
counter++;\r
- sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter);\r
+ _mesa_sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter);\r
f = fopen (filename, "w");\r
if (f == NULL)\r
return;\r
{
GLfloat a[4], result[4];
fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
- result[0] = (GLfloat)cos(a[0]);
- result[1] = (GLfloat)sin(a[0]);
+ result[0] = (GLfloat)_mesa_cos(a[0]);
+ result[1] = (GLfloat)_mesa_sin(a[0]);
result[2] = 0.0; /* undefined! */
result[3] = 0.0; /* undefined! */
store_vector4( inst, machine, result );
return GL_FALSE;
}
- if (getenv("MESA_CODEGEN"))
+ if (_mesa_getenv("MESA_CODEGEN"))
tnl->AllowCodegen = GL_TRUE;
/* Initialize the VB.
/* Initialize cp. Note that ctx and VB aren't used in compilation
* so we don't have to worry about statechanges:
*/
- memset(&cp, 0, sizeof(cp));
+ _mesa_memset(&cp, 0, sizeof(cp));
cp.csr = p->instructions;
/* Compile instructions:
{
struct compilation cp;
- memset(&cp, 0, sizeof(cp));
+ _mesa_memset(&cp, 0, sizeof(cp));
cp.p = p;
cp.have_sse2 = 1;
return;
}
- memset(&p, 0, sizeof(p));
+ _mesa_memset(&p, 0, sizeof(p));
p.ctx = ctx;
p.inputs_safe = 0; /* for now */
struct tnl_cache *c;
for (c = cache; c; c = c->next) {
- if (c->hash == hash && memcmp(c->key, key, keysize) == 0)
+ if (c->hash == hash && _mesa_memcmp(c->key, key, keysize) == 0)
return c->data;
}
_mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt );
- memcpy( tnl->vtx.tabfv, choose, sizeof(choose) );
+ _mesa_memcpy( tnl->vtx.tabfv, choose, sizeof(choose) );
for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++)
tnl->vtx.attrsz[i] = 0;
insert_at_head( &CACHE, dfn ); \
dfn->key = KEY; \
dfn->code = ALIGN_MALLOC( end - start, 16 ); \
- memcpy (dfn->code, start, end - start)
+ _mesa_memcpy (dfn->code, start, end - start)
const char *end = WARP##_end; \
int offset = 0; \
code = ALIGN_MALLOC( end - start, 16 ); \
- memcpy (code, start, end - start); \
+ _mesa_memcpy (code, start, end - start); \
FIXUP(code, 0, 0, (int)&(TNL_CONTEXT(ctx)->vtx.tabfv[ATTR][SIZE-1]));\
*(void **)&vfmt->FUNC = code; \
} while (0)
const char *end = _tnl_x86_choose_fv_end;
int offset = 0;
code = ALIGN_MALLOC( end - start, 16 );
- memcpy (code, start, end - start);
+ _mesa_memcpy (code, start, end - start);
FIXUP(code, 0, 0, attr);
FIXUP(code, 0, 1, size + 1);
FIXUPREL(code, 0, 2, do_choose);
#if defined(USE_X86_ASM)
+#include "imports.h"
#include "x86sse.h"
#define DISASSEM 0
void x86_init_func( struct x86_function *p )
{
- p->store = malloc(1024);
+ p->store = _mesa_malloc(1024);
p->csr = p->store;
}
void x86_release_func( struct x86_function *p )
{
- free(p->store);
+ _mesa_free(p->store);
}