char *name;
} DGL_extension;
+#ifndef __MINGW32__
+/* XXX why is this here?
+ * It should probaby be somewhere in src/mesa/drivers/windows/
+ */
+#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
+# define WGL_FONT_LINES 0
+# define WGL_FONT_POLYGONS 1
+#ifndef _GNU_H_WINDOWS32_FUNCTIONS
+# ifdef UNICODE
+# define wglUseFontBitmaps wglUseFontBitmapsW
+# define wglUseFontOutlines wglUseFontOutlinesW
+# else
+# define wglUseFontBitmaps wglUseFontBitmapsA
+# define wglUseFontOutlines wglUseFontOutlinesA
+# endif /* !UNICODE */
+#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
+typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
+typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
+typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
+#if !defined(GLX_USE_MESA)
+#include <GL/mesa_wgl.h>
+#endif
+#endif
+#endif /* !__MINGW32__ */
+
/*------------------------- Function Prototypes ---------------------------*/
#ifdef __cplusplus
{
unsigned * i;
- i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums),
+ i = (unsigned *)_mesa_bsearch( & nr, reduced_enums, Elements(reduced_enums),
sizeof(reduced_enums[0]), (cfunc) compar_nr );
if ( i != NULL ) {
enum_elt * f = NULL;
if ( symbol != NULL ) {
- f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums),
+ f = (enum_elt *)_mesa_bsearch( symbol, all_enums, Elements(all_enums),
sizeof( enum_elt ), (cfunc) compar_name );
}
#endif /* WIN32 / CYGWIN bracket */
-#ifndef __MINGW32__
-/* XXX why is this here?
- * It should probaby be somewhere in src/mesa/drivers/windows/
- */
-#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP)
-# define WGL_FONT_LINES 0
-# define WGL_FONT_POLYGONS 1
-#ifndef _GNU_H_WINDOWS32_FUNCTIONS
-# ifdef UNICODE
-# define wglUseFontBitmaps wglUseFontBitmapsW
-# define wglUseFontOutlines wglUseFontOutlinesW
-# else
-# define wglUseFontBitmaps wglUseFontBitmapsA
-# define wglUseFontOutlines wglUseFontOutlinesA
-# endif /* !UNICODE */
-#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
-typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
-typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
-typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
-#if !defined(GLX_USE_MESA)
-#include <GL/mesa_wgl.h>
-#endif
-#endif
-#endif /* !__MINGW32__ */
-
-
/*
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
* Do not use them unless absolutely necessary!
#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
#define CAPI _cdecl
#endif
-#include <GL/internal/glcore.h>
/* This is a macro on IRIX */
# define __builtin_expect(x, y) x
#endif
-/* Windows does not have the ffs() function */
-#if defined(_WIN32) && !defined(__MINGW32__)
-int INLINE ffs(int value)
-{
- int bit;
- if (value == 0)
- return 0;
- for (bit=1; !(value & 1); bit++)
- value >>= 1;
- return bit;
-}
-#endif
-
-
/* The __FUNCTION__ gcc variable is generally only used for debugging.
* If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
* Don't define it if using a newer Windows compiler.
* \todo Functions still needed:
* - scanf
* - qsort
- * - bsearch
* - rand and RAND_MAX
*
* \note When compiled into a XFree86 module these functions wrap around
}
+/* Windows does not have the ffs() function */
+#if defined(_WIN32) && !defined(__MINGW32__)
+int INLINE ffs(int value)
+{
+ int bit;
+ if (value == 0)
+ return 0;
+ for (bit=1; !(value & 1); bit++)
+ value >>= 1;
+ return bit;
+}
+#endif
+
+
+/**
+ * Wrapper around either ffs() or xf86ffs().
+ */
+int
+_mesa_ffs(int i)
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86ffs(i);
+#else
+ return ffs(i);
+#endif
+}
+
+
/**
* Return number of bits set in given GLuint.
*/
/*@}*/
+/**********************************************************************/
+/** \name Sort & Search */
+/*@{*/
+
+/**
+ * Wrapper for bsearch().
+ */
+void *
+_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *) )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86bsearch(key, base, nmemb, size, compar);
+#else
+ return bsearch(key, base, nmemb, size, compar);
+#endif
+}
+
+/*@}*/
+
+
/**********************************************************************/
/** \name Environment vars */
/*@{*/
#endif
}
+/** Wrapper around either vsprintf() or xf86vsprintf() */
+int
+_mesa_vsprintf( char *str, const char *fmt, va_list args )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ return xf86vsprintf( str, fmt, args );
+#else
+ return vsprintf( str, fmt, args );
+#endif
+}
+
/*@}*/
/*@}*/
+/**********************************************************************/
+/** \name Exit */
+/*@{*/
+
+/**
+ * Wrapper for exit().
+ */
+void
+_mesa_exit( int status )
+{
+#if defined(XFree86LOADER) && defined(IN_MODULE)
+ xf86exit(status);
+#else
+ exit(status);
+#endif
+}
+
+/*@}*/
+
+
/**********************************************************************/
/** \name Default Imports Wrapper */
/*@{*/
/* XXX some of the stuff in glheader.h should be moved into this file.
*/
#include "glheader.h"
+#include <GL/internal/glcore.h>
#ifdef __cplusplus
*** CEILF: ceiling of float
*** FLOORF: floor of float
*** FABSF: absolute value of float
+ *** LOGF: the natural logarithm (base e) of the value
+ *** EXPF: raise e to the value
*** LDEXPF: multiply value by an integral power of two
*** FREXPF: extract mantissa and exponent from value
***/
#define CEILF(x) ((GLfloat) xf86ceil(x))
#define FLOORF(x) ((GLfloat) xf86floor(x))
#define FABSF(x) ((GLfloat) xf86fabs(x))
+#define LOGF(x) ((GLfloat) xf86log(x))
+#define EXPF(x) ((GLfloat) xf86exp(x))
#define LDEXPF(x,y) ((GLfloat) xf86ldexp(x,y))
#define FREXPF(x,y) ((GLfloat) xf86frexp(x,y))
#elif defined(__gnu_linux__)
#define CEILF(x) ceilf(x)
#define FLOORF(x) floorf(x)
#define FABSF(x) fabsf(x)
+#define LOGF(x) logf(x)
+#define EXPF(x) expf(x)
#define LDEXPF(x,y) ldexpf(x,y)
#define FREXPF(x,y) frexpf(x,y)
#else
#define CEILF(x) ((GLfloat) ceil(x))
#define FLOORF(x) ((GLfloat) floor(x))
#define FABSF(x) ((GLfloat) fabs(x))
+#define LOGF(x) ((GLfloat) log(x))
+#define EXPF(x) ((GLfloat) exp(x))
#define LDEXPF(x,y) ((GLfloat) ldexp(x,y))
#define FREXPF(x,y) ((GLfloat) frexp(x,y))
#endif
extern float
_mesa_log2(float x);
+extern int
+_mesa_ffs(int i);
+
extern unsigned int
_mesa_bitcount(unsigned int n);
_mesa_half_to_float(GLhalfARB h);
+extern void *
+_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *) );
+
extern char *
_mesa_getenv( const char *var );
extern void
_mesa_printf( const char *fmtString, ... );
+extern int
+_mesa_vsprintf( char *str, const char *fmt, va_list args );
+
extern void
_mesa_warning( __GLcontext *gc, const char *fmtString, ... );
extern void
_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... );
+extern void
+_mesa_exit( int status );
+
extern void
_mesa_init_default_imports( __GLimports *imports, void *driverCtx );
#include "glheader.h"
+#include <GL/internal/glcore.h> /* GLimports/GLexports/GLcontextModes */
#include "config.h" /* Hardwired parameters */
#include "glapitable.h"
#include "glthread.h"
/* First try and reuse temps which have been used already:
*/
- bit = ffs( ~p->temp_in_use & p->alu_temps );
+ bit = _mesa_ffs( ~p->temp_in_use & p->alu_temps );
/* Then any unused temporary:
*/
if (!bit)
- bit = ffs( ~p->temp_in_use );
+ bit = _mesa_ffs( ~p->temp_in_use );
if (!bit) {
_mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
- exit(1);
+ _mesa_exit(1);
}
if (bit > p->program->Base.NumTemporaries)
* ~p->temps_output isn't necessary, but will keep it there for
* now:
*/
- bit = ffs( ~p->temp_in_use & ~p->alu_temps & ~p->temps_output );
+ bit = _mesa_ffs( ~p->temp_in_use & ~p->alu_temps & ~p->temps_output );
/* Then any unused temporary:
*/
if (!bit)
- bit = ffs( ~p->temp_in_use );
+ bit = _mesa_ffs( ~p->temp_in_use );
if (!bit) {
_mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
- exit(1);
+ _mesa_exit(1);
}
if (bit > p->program->Base.NumTemporaries)
/* Hmmm, don't know how we could test the precalculated
* length case...
*/
- scale = 1.0 / sqrt( len );
+ scale = 1.0 / SQRTF( len );
SCALE_SCALAR_3V( out[i], scale, t );
} else {
out[i][0] = out[i][1] = out[i][2] = 0;
case VAR:
break;
default:
- abort();
+ _mesa_exit(1);
}
}
}
ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 );
for ( j = 0 ; j < 3 ; j++ )
s[i][j] = rnd();
- length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) );
+ length[i] = 1 / SQRTF( LEN_SQUARED_3FV( s[i] ) );
}
source->data = (GLfloat(*)[4]) s;
if ( first_time ) {
first_time = 0;
- mesa_profile = getenv( "MESA_PROFILE" );
+ mesa_profile = _mesa_getenv( "MESA_PROFILE" );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( first_time ) {
first_time = 0;
- mesa_profile = getenv( "MESA_PROFILE" );
+ mesa_profile = _mesa_getenv( "MESA_PROFILE" );
}
#ifdef RUN_DEBUG_BENCHMARK
r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0;
/* choose pivot - or die */
- if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2);
- if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1);
- if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0);
+ if (FABSF(r3[0])>FABSF(r2[0])) SWAP_ROWS(r3, r2);
+ if (FABSF(r2[0])>FABSF(r1[0])) SWAP_ROWS(r2, r1);
+ if (FABSF(r1[0])>FABSF(r0[0])) SWAP_ROWS(r1, r0);
if (0.0 == r0[0]) return GL_FALSE;
/* eliminate first variable */
if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; }
/* choose pivot - or die */
- if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2);
- if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1);
+ if (FABSF(r3[1])>FABSF(r2[1])) SWAP_ROWS(r3, r2);
+ if (FABSF(r2[1])>FABSF(r1[1])) SWAP_ROWS(r2, r1);
if (0.0 == r1[1]) return GL_FALSE;
/* eliminate second variable */
s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; }
/* choose pivot - or die */
- if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2);
+ if (FABSF(r3[2])>FABSF(r2[2])) SWAP_ROWS(r3, r2);
if (0.0 == r2[2]) return GL_FALSE;
/* eliminate third variable */
m[2] *= x; m[6] *= y; m[10] *= z;
m[3] *= x; m[7] *= y; m[11] *= z;
- if (fabs(x - y) < 1e-8 && fabs(x - z) < 1e-8)
+ if (FABSF(x - y) < 1e-8 && FABSF(x - z) < 1e-8)
mat->flags |= MAT_FLAG_UNIFORM_SCALE;
else
mat->flags |= MAT_FLAG_GENERAL_SCALE;
while (extensions < end)
{
- const GLubyte *name_end = (const GLubyte *) strchr ((const char *) extensions, ' ');
+ const GLubyte *name_end = (const GLubyte *) _mesa_strstr ((const char *) extensions, " ");
if (name_end == NULL)
name_end = end;
if (name_end - extensions == ext_len && _mesa_strncmp ((const char *) ext,
strz[len] = '\0';
#if DEBUG_PARSING
- printf ("Checking Grammar!\n");
+ fprintf (stderr, "Checking Grammar!\n");
#endif
/* do a fast check on program string - initial production buffer is 4K */
err = grammar_fast_check (arbprogram_syn_id, strz, &parsed, &parsed_len, 0x1000);
_mesa_error (ctx, GL_INVALID_OPERATION, "glProgramStringARB(syntax error)");
/* useful for debugging */
- if (0) {
+#if DEBUG_PARSING
+ do {
int line, col;
char *s;
- printf("Program: %s\n", (char *) strz);
- printf("Error Pos: %d\n", ctx->Program.ErrorPos);
+ fprintf(stderr, "Program: %s\n", (char *) strz);
+ fprintf(stderr, "Error Pos: %d\n", ctx->Program.ErrorPos);
s = (char *) _mesa_find_line_column(strz, strz+ctx->Program.ErrorPos, &line, &col);
- printf("line %d col %d: %s\n", line, col, s);
- }
+ fprintf(stderr, "line %d col %d: %s\n", line, col, s);
+ } while (0)
+#endif
grammar_destroy (arbprogram_syn_id);
return 1;
}
#if DEBUG_PARSING
- printf ("Destroying grammer dict [parse retval: %d]\n", err);
+ fprintf (stderr, "Destroying grammer dict [parse retval: %d]\n", err);
#endif
grammar_destroy (arbprogram_syn_id);
_mesa_free (parsed);
#if DEBUG_PARSING
- printf ("_mesa_parse_arb_program() done\n");
+ fprintf (stderr, "_mesa_parse_arb_program() done\n");
#endif
return err;
}
{
GLfloat t[4], q[4], floor_t0;
fetch_vector1( &inst->SrcReg[0], state, t );
- floor_t0 = (float) floor(t[0]);
+ floor_t0 = FLOORF(t[0]);
if (floor_t0 > FLT_MAX_EXP) {
SET_POS_INFINITY(q[0]);
SET_POS_INFINITY(q[2]);
{
GLfloat t[4], q[4], abs_t0;
fetch_vector1( &inst->SrcReg[0], state, t );
- abs_t0 = (GLfloat) fabs(t[0]);
+ abs_t0 = FABSF(t[0]);
if (abs_t0 != 0.0F) {
/* Since we really can't handle infinite values on VMS
* like other OSes we'll use __MAXFLOAT to represent
}
else {
int exponent;
- double mantissa = frexp(t[0], &exponent);
+ GLfloat mantissa = FREXPF(t[0], &exponent);
q[0] = (GLfloat) (exponent - 1);
q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */
q[2] = (GLfloat) (q[0] + LOG2(q[1]));
{
GLfloat t[4];
fetch_vector4( &inst->SrcReg[0], state, t );
- state->AddressReg[0] = (GLint) floor(t[0]);
+ state->AddressReg[0] = (GLint) FLOORF(t[0]);
}
break;
case VP_OPCODE_DPH:
char buf[1024];
va_start (va, msg);
- _mesa_sprintf (buf, msg, va);
+ _mesa_vsprintf (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);
- _mesa_sprintf (buf, msg, va);
+ _mesa_vsprintf (buf, msg, va);
if (slang_info_log_message (log, "warning", buf))
return 1;
slang_info_log_memory (log);
slang_info_log_memory (C->L);
return 0;
}
- C->I += strlen ((const char *) C->I) + 1;
+ C->I += _mesa_strlen ((const char *) C->I) + 1;
return 1;
}
return 0;
}
- whole = (char *) (slang_alloc_malloc ((strlen (integral) + strlen (fractional) + strlen (
- exponent) + 3) * sizeof (char)));
+ whole = (char *) (slang_alloc_malloc ((_mesa_strlen (integral) +
+ _mesa_strlen (fractional) + _mesa_strlen (exponent) + 3) *
+ sizeof (char)));
if (whole == NULL)
{
slang_alloc_free (exponent);
slang_string_concat (whole, "E");
slang_string_concat (whole, exponent);
- *number = (float) (atof (whole));
+ *number = (float) (_mesa_strtod(whole, (char **)NULL));
slang_alloc_free (whole);
slang_alloc_free (exponent);
xxx_prolog (&file, (**parsed_func_ret).address);
_slang_execute (&file);
slang_assembly_file_destruct (&file);
-exit (0);
+_mesa_exit (0);
}
}
return 1;
#include "slang_storage.h"\r
#include "slang_execute.h"\r
\r
+#define DEBUG_SLANG\r
+\r
+#ifdef DEBUG_SLANG\r
static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i)\r
{\r
fprintf (f, "%.5u:\t", i);\r
\r
fclose (f);\r
}\r
+#endif\r
\r
int _slang_execute (const slang_assembly_file *file)\r
{\r
slang_machine mach;\r
+#ifdef DEBUG_SLANG\r
FILE *f;\r
+#endif\r
\r
mach.ip = 0;\r
mach.sp = SLANG_MACHINE_STACK_SIZE;\r
static_assert(sizeof (GLuint) == 4);\r
/*static_assert(sizeof (GLuint *) == 4);*/\r
\r
+#ifdef DEBUG_SLANG\r
dump (file);\r
+#endif\r
\r
+#ifdef DEBUG_SLANG\r
f = fopen ("~mesa-slang-assembly-execution.txt", "w");\r
+#endif\r
\r
while (!mach.exit)\r
{\r
slang_assembly *a = file->code + mach.ip;\r
+#ifdef DEBUG_SLANG\r
if (f != NULL)\r
{\r
unsigned int i;\r
fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]);\r
fflush (f);\r
}\r
+#endif\r
mach.ip++;\r
\r
switch (a->type)\r
}\r
}\r
\r
+#ifdef DEBUG_SLANG\r
if (f != NULL)\r
fclose (f);\r
+#endif\r
\r
return 0;\r
}\r
if (rho2 == 0.0F)
return 0.0;
else
- return (GLfloat) (log(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */
+ return (GLfloat) (LOGF(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */
}
return CLAMP(f, 0.0F, 1.0F);
case GL_EXP:
d = ctx->Fog.Density;
- f = (GLfloat) exp(-d * z);
+ f = EXPF(-d * z);
f = CLAMP(f, 0.0F, 1.0F);
return f;
case GL_EXP2:
d = ctx->Fog.Density;
- f = (GLfloat) exp(-(d * d * z * z));
+ f = EXPF(-(d * d * z * z));
f = CLAMP(f, 0.0F, 1.0F);
return f;
default:
GLuint i;
for (i = 0; i < span->end; i++) {
GLfloat f, oneMinusF;
- f = (GLfloat) exp(density * FABSF(fogCoord) / w);
+ f = EXPF(density * FABSF(fogCoord) / w);
f = CLAMP(f, 0.0F, 1.0F);
oneMinusF = 1.0F - f;
rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog);
if (tmp < FLT_MIN_10_EXP)
tmp = FLT_MIN_10_EXP;
#endif
- f = (GLfloat) exp(tmp);
+ f = EXPF(tmp);
f = CLAMP(f, 0.0F, 1.0F);
oneMinusF = 1.0F - f;
rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog);
GLfloat w = haveW ? span->w : 1.0F;
GLuint i;
for (i = 0; i < span->end; i++) {
- GLfloat f = (GLfloat) exp(density * fogCoord / w);
+ GLfloat f = EXPF(density * fogCoord / w);
f = CLAMP(f, 0.0F, 1.0F);
index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex);
fogCoord += fogStep;
if (tmp < FLT_MIN_10_EXP)
tmp = FLT_MIN_10_EXP;
#endif
- f = (GLfloat) exp(tmp);
+ f = EXPF(tmp);
f = CLAMP(f, 0.0F, 1.0F);
index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex);
fogCoord += fogStep;
result[0] = 1.0F;
result[1] = a[0];
/* XXX we could probably just use pow() here */
- result[2] = (a[0] > 0.0F) ? (GLfloat) exp(a[3] * log(a[1])) : 0.0F;
+ result[2] = (a[0] > 0.0F) ? EXPF(a[3] * LOGF(a[1])) : 0.0F;
result[3] = 1.0F;
store_vector4( inst, machine, result );
}
} \
break; \
case GL_MIRROR_CLAMP_EXT: \
- U = (GLfloat) fabs(S); \
+ U = FABSF(S); \
if (U >= 1.0F) \
U = (GLfloat) SIZE; \
else \
I1 = I0 + 1; \
break; \
case GL_MIRROR_CLAMP_TO_EDGE_EXT: \
- U = (GLfloat) fabs(S); \
+ U = FABSF(S); \
if (U >= 1.0F) \
U = (GLfloat) SIZE; \
else \
{ \
const GLfloat min = -1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
- U = (GLfloat) fabs(S); \
+ U = FABSF(S); \
if (U <= min) \
U = min * SIZE; \
else if (U >= max) \
{ \
/* s limited to [0,1] */ \
/* i limited to [0,size-1] */ \
- const GLfloat u = (GLfloat) fabs(S); \
+ const GLfloat u = FABSF(S); \
if (u <= 0.0F) \
I = 0; \
else if (u >= 1.0F) \
/* i limited to [0, size-1] */ \
const GLfloat min = 1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
- const GLfloat u = (GLfloat) fabs(S); \
+ const GLfloat u = FABSF(S); \
if (u < min) \
I = 0; \
else if (u > max) \
/* i limited to [0, size-1] */ \
const GLfloat min = -1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
- const GLfloat u = (GLfloat) fabs(S); \
+ const GLfloat u = FABSF(S); \
if (u < min) \
I = -1; \
else if (u > max) \
*/
static GLfloat ApproxLog2(GLfloat t)
{
- return (GLfloat) (log(t) * 1.442695F);
+ return (GLfloat) (LOGF(t) * 1.442695F);
}
static GLfloat ApproxExp2(GLfloat t)
GLfloat f = 0.0F;
GLint i = 0;
for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) {
- exp_table[i] = (GLfloat) exp(-f);
+ exp_table[i] = EXPF(-f);
}
inited = 1;
}
static INLINE void insert_3f_xyw_err( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in )
{
(void) a; (void) v; (void) in;
- abort();
+ _mesa_exit(1);
}
static INLINE void insert_3f_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in )
static struct ureg get_temp( struct tnl_program *p )
{
- int bit = ffs( ~p->temp_in_use );
+ int bit = _mesa_ffs( ~p->temp_in_use );
if (!bit) {
- fprintf(stderr, "%s: out of temporaries\n", __FILE__);
- exit(1);
+ _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__);
+ _mesa_exit(1);
}
p->temp_in_use |= 1<<(bit-1);
GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter;
GLuint attr, i;
- if (0) fprintf(stderr, "_tnl_vb_bind_vtx(): %d verts %d vertsize\n",
+#undef DEBUG_VTX
+
+#ifdef DEBUG_VTX
+ fprintf(stderr, "_tnl_vb_bind_vtx(): %d verts %d vertsize\n",
count, tnl->vtx.vertex_size);
+#endif
/* Setup constant data in the VB.
#include "t_vtx_api.h"
#include "simple_list.h"
-
#if defined(USE_X86_ASM) && !defined(HAVE_NONSTANDARD_GLAPIENTRY)
#define EXTERN( FUNC ) \
+#undef DEBUG_VTX
+
+#ifdef DEBUG_VTX
+#define FIXUP_PRINTF( offset, NEWVAL ) \
+ fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL))
+#define FIXUPREL_PRINTF( offset, NEWVAL, CODE ) \
+ fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL) - ((int)(CODE)+offset) - 4)
+#else
+#define FIXUP_PRINTF( offset, NEWVAL )
+#define FIXUPREL_PRINTF( offset, NEWVAL, CODE )
+#endif
+
#define FIXUP( CODE, KNOWN_OFFSET, CHECKVAL, NEWVAL ) \
do { \
GLint subst = 0x10101010 + CHECKVAL; \
if (DONT_KNOW_OFFSETS) { \
while (*(int *)(CODE+offset) != subst) offset++; \
*(int *)(CODE+offset) = (int)(NEWVAL); \
- if (0) fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL)); \
+ FIXUP_PRINTF(offset, NEWVAL); \
offset += 4; \
} \
else { \
if (DONT_KNOW_OFFSETS) { \
while (*(int *)(CODE+offset) != subst) offset++; \
*(int *)(CODE+offset) = (int)(NEWVAL) - ((int)(CODE)+offset) - 4; \
- if (0) fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL) - ((int)(CODE)+offset) - 4); \
+ FIXUPREL_PRINTF(offset, NEWVAL, CODE); \
offset += 4; \
} \
else { \
-/* $Id: x86-64.c,v 1.1 2005/05/07 16:59:59 brianp Exp $ */
+/* $Id: x86-64.c,v 1.2 2005/09/19 20:12:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
#endif
if ( debug ) {
- fprintf( stderr, "%s", msg );
+ _mesa_debug( NULL, "%s", msg );
}
}
#endif
}
#endif
if ( debug ) {
- fprintf( stderr, "%s", msg );
+ _mesa_debug( NULL, "%s", msg );
}
}