* - glFinish
* - glIsEnabled
* - glGet*
- *
+ *
* Functions which cause errors if called while compiling a display list:
* - glNewList
*/
/**
* How many nodes to allocate at a time.
- *
+ *
* \note Reduced now that we hold vertices etc. elsewhere.
*/
#define BLOCK_SIZE 256
/**
- * Number of nodes of storage needed for each instruction.
+ * Number of nodes of storage needed for each instruction.
* Sizes for dynamically allocated opcodes are stored in the context struct.
*/
static GLuint InstSize[ OPCODE_END_OF_LIST+1 ];
}
-static void
+static void
save_CopyPixels( GLint x, GLint y,
GLsizei width, GLsizei height, GLenum type )
{
static void save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
GLint vn, GLdouble v1, GLdouble v2 )
{
- save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
+ save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
vn, (GLfloat) v1, (GLfloat) v2);
}
static void save_RasterPos4dv(const GLdouble *v)
{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
(GLfloat) v[2], (GLfloat) v[3]);
}
static void save_RasterPos4iv(const GLint *v)
{
- save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
+ save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
(GLfloat) v[2], (GLfloat) v[3]);
}
static void save_WindowPos4dvMESA(const GLdouble *v)
{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
(GLfloat) v[2], (GLfloat) v[3]);
}
static void save_WindowPos4ivMESA(const GLint *v)
{
- save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
+ save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
(GLfloat) v[2], (GLfloat) v[3]);
}
/* execute the display list, and restore the CompileFlag. */
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glCallList %d\n", list);
+ _mesa_debug(ctx, "glCallList %d\n", list);
if (list == 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
GLboolean save_compile_flag;
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glCallLists %d\n", n);
+ _mesa_debug(ctx, "glCallLists %d\n", n);
switch (type) {
case GL_BYTE:
ctx->Exec->DisableClientState( cap );
}
-static void exec_EdgeFlagPointer(GLsizei stride, const void *vptr)
+static void exec_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr)
{
GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0);
_mesa_lookup_enum_by_nr(n[1].ui));
break;
case OPCODE_MAP1:
- _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
+ _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
_mesa_lookup_enum_by_nr(n[1].ui),
n[2].f, n[3].f, n[4].i, n[5].i);
break;
case OPCODE_MAP2:
- _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
+ _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
_mesa_lookup_enum_by_nr(n[1].ui),
n[2].f, n[3].f, n[4].f, n[5].f,
n[6].i, n[7].i, n[8].i, n[9].i);
n[1].i, n[2].f, n[3].f);
break;
case OPCODE_MAPGRID2:
- _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
+ _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
n[1].i, n[2].f, n[3].f,
n[4].i, n[5].f, n[6].f);
break;
/**
* \file glheader.h
* Top-most include file.
- *
+ *
* This is the top-most include file of the Mesa sources.
* It includes gl.h and all system headers which are needed.
* Other Mesa source files should \e not directly include any system
* allows system-dependent hacks/workarounds to be collected in one place.
*
* \note Actually, a lot of system-dependent stuff is now in imports.[ch].
- *
+ *
* If you touch this file, everything gets recompiled!
*
* This file should be included before any other header in the .c files.
# define INLINE __inline
#elif defined(__ICL)
# define INLINE __inline
+#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
+# define INLINE __inline
#else
# define INLINE
#endif
/*
* Provide a reasonable replacement for __FUNCTION__ when using
- * non-GNU C compilers.
+ * non-GNU C compilers. Watcom C/C++ 11.0 and later provide this also.
*/
-#if !defined(__GNUC__)
+#if !defined(__GNUC__) && !(defined(__WATCOMC__) && (__WATCOMC__ >= 1100))
#define STRINGIZE(x) #x
#define STRINGIZE_EVAL(x) STRINGIZE(x)
#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__)
/**
* \file imports.h
* Standard C library function wrappers.
- *
+ *
* This file provides wrappers for all the standard C library functions
* like malloc(), free(), printf(), getenv(), etc.
*/
/**********************************************************************/
/** \name [Pseudo] static array declaration.
- *
- * MACs and BeOS don't support static larger than 32kb, so ...
+ *
+ * MACs and BeOS don't support static larger than 32kb, so ...
*/
/*@{*/
-/**
+/**
* \def DEFARRAY
- * Define a [static] unidimensional array
+ * Define a [static] unidimensional array
*/
-/**
+/**
* \def DEFMARRAY
- * Define a [static] bi-dimensional array
+ * Define a [static] bi-dimensional array
*/
-/**
+/**
* \def DEFMNARRAY
- * Define a [static] tri-dimensional array
+ * Define a [static] tri-dimensional array
*/
/**
* specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC and implement
* _ext_mesa_alloc_pixelbuffer() _ext_mesa_free_pixelbuffer() in your
* application.
- *
+ *
* \author
* Contributed by Gerk Huisma (gerk@five-d.demon.nl).
*/
/*@{*/
-/**
+/**
* \def MESA_PBUFFER_ALLOC
* Allocate a pixel buffer.
*/
-/**
+/**
* \def MESA_PBUFFER_FREE
* Free a pixel buffer.
*/
#define MAX_GLUINT 0xffffffff
#ifndef M_PI
-#define M_PI (3.1415926536)
+#define M_PI (3.1415926536)
#endif
/* Degrees to radians conversion: */
/***
*** USE_IEEE: Determine if we're using IEEE floating point
***/
-#if defined(__i386__) || defined(__sparc__) || defined(__s390x__) || \
- defined(__powerpc__) || \
+#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
+ defined(__s390x__) || defined(__powerpc__) || \
( defined(__alpha__) && ( defined(__IEEE_FLOAT) || !defined(VMS) ) )
#define USE_IEEE
#define IEEE_ONE 0x3f800000
/***
*** SQRTF: single-precision square root
***/
-#if defined(__WATCOMC__) && defined(USE_X86_ASM)
-float asm_sqrt (float x);
-#pragma aux asm_sqrt = \
- "fsqrt" \
- parm [8087] \
- value [8087] \
- modify exact [];
-# define SQRTF(X) asm_sqrt(X)
-#elif 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
+#if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
# define SQRTF(X) _mesa_sqrtf(X)
#elif defined(XFree86LOADER) && defined(IN_MODULE)
# define SQRTF(X) (float) xf86sqrt((float) (X))
#define IS_INF_OR_NAN(x) (!isfinite(x))
#else
#define IS_INF_OR_NAN(x) (!finite(x))
-#endif
+#endif
/***
#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__)
static INLINE int iround(float f)
{
- int r;
- __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
- return r;
+ int r;
+ __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
+ return r;
}
#define IROUND(x) iround(x)
#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
#ifndef FIST_MAGIC
#define FIST_MAGIC ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0))
#endif
-inline int iround(float x)
+static INLINE int iround(float x)
{
double dtemp = FIST_MAGIC + x;
return ((*(int *)&dtemp) - 0x80000000);
__asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \
} while (0)
-#elif defined(__WATCOMC__) && !defined(NO_FAST_MATH)
-void _wacom_start_fast_math(unsigned short *x);
-#pragma aux _wacom_start_fast_math = \
- "fstcw word ptr [esi]" \
- "or word ptr [esi], 0x3f" \
- "fldcw word ptr [esi]" \
- parm [esi] \
- modify exact [];
-void _wacom_end_fast_math(unsigned short *x);
-#pragma aux _wacom_end_fast_math = \
- "fldcw word ptr [esi]" \
- parm [esi] \
- modify exact [];
-#define START_FAST_MATH(x) _wacom_start_fast_math(& x)
-#define END_FAST_MATH(x) _wacom_end_fast_math(& x)
+#elif defined(__WATCOMC__) && defined(__386__)
+#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */
+#define FAST_X86_FPU 0x003f /* See GCC comments above */
+void _watcom_start_fast_math(unsigned short *x,unsigned short *mask);
+#pragma aux _watcom_start_fast_math = \
+ "fnstcw word ptr [eax]" \
+ "fldcw word ptr [ecx]" \
+ parm [eax ecx] \
+ modify exact [];
+void _watcom_end_fast_math(unsigned short *x);
+#pragma aux _watcom_end_fast_math = \
+ "fnclex" \
+ "fldcw word ptr [eax]" \
+ parm [eax] \
+ modify exact [];
+#if defined(NO_FAST_MATH)
+#define START_FAST_MATH(x) \
+do { \
+ static GLushort mask = DEFAULT_X86_FPU; \
+ _watcom_start_fast_math(&x,&mask); \
+} while (0)
+#else
+#define START_FAST_MATH(x) \
+do { \
+ static GLushort mask = FAST_X86_FPU; \
+ _watcom_start_fast_math(&x,&mask); \
+} while (0)
+#endif
+#define END_FAST_MATH(x) _watcom_end_fast_math(&x)
#else
#define START_FAST_MATH(x) x = 0
#define END_FAST_MATH(x) (void)(x)
}
static void TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type,
- const void *indices )
+ const GLvoid *indices )
{
PRE_LOOPBACK( DrawElements );
_glapi_Dispatch->DrawElements( mode, count, type, indices );
static void TAG(DrawRangeElements)( GLenum mode, GLuint start,
GLuint end, GLsizei count,
- GLenum type, const void *indices )
+ GLenum type, const GLvoid *indices )
{
PRE_LOOPBACK( DrawRangeElements );
_glapi_Dispatch->DrawRangeElements( mode, start, end, count, type, indices );