/* * $Id$ * * $Date$ * $Revision$ * * (C) 1999 by Hyperion * All rights reserved * * This file is part of the MiniGL library project * See the file Licence.txt for more details * */ #ifndef __MINIGL_COMPILER_H #define __MINIGL_COMPILER_H #define __NOGLOBALIFACE__ extern struct Library *Warp3DBase; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mgl/config.h" extern struct ExecIFace *IExec; extern struct DOSIFace *IDOS; extern struct Library *UtilityBase; extern struct UtilityIFace *IUtility; extern struct Library *IntuitionBase; extern struct IntuitionIFace *IIntuition; extern struct Library *GfxBase; extern struct GraphicsIFace *IGraphics; extern struct Library *Warp3DBase; extern struct Warp3DIFace *IWarp3D; extern struct Library *P96Base; extern struct P96IFace *IP96; extern struct Device *TimerBase; extern struct TimerIFace *ITimer; extern inline float fast_fabs(float x) { float abs_x; __asm volatile ("fabs %0,%1" : "=f" (abs_x) : "f" (x)); return abs_x; } #if MGL_USE_EXACT_SQRT extern inline float fast_sqrt(float x) { return (float)sqrt((double)x); } extern inline float fast_reciprocal_sqrt(float x) { return (float)(1.0 / sqrt((double)x)); } #else extern inline float fast_sqrt(float number) //InvSqrt(x) code { float x = 0.5f * number; float y; __asm volatile ("frsqrte %0,%1" : "=f" (y) : "f" (number)); y = y * (1.5f - (x * y * y)); return y * number; } extern inline float fast_reciprocal_sqrt(float number) { float y; __asm volatile ("frsqrte %0,%1" : "=f" (y) : "f" (number)); y = y + 0.5f * y * (1.0f - (number * y * y)); return y; } #endif #ifndef UNUSED #if defined(__GNUC__) #define UNUSED __attribute__ ((unused)) #else #define UNUSED #endif #endif #ifndef GLNDEBUG #warning "Debug output enabled" #define GLASSERT(c) if (!(c)) dprintf("Assertion failed %s\n", # c); #define dprintf(format, args...)((struct ExecIFace *)((*(struct ExecBase **)4)->MainInterface))->DebugPrintF("[%s] " format, __PRETTY_FUNCTION__ , ## args) #define kprintf(format, args...)((struct ExecIFace *)((*(struct ExecBase **)4)->MainInterface))->DebugPrintF(format, ## args) #else #define GLASSERT(c) #define dprintf(x, args...) #define kprintf(x, args...) #endif #ifndef GL_NOERRORCHECK #define GLFlagError(context,c,err) \ while ((c)) {\ kprintf("FlagError in %s:%ld, error = %s\n", __PRETTY_FUNCTION__, __LINE__, #err);\ context->CurrentError = err;\ return;\ } #define GLFlagError2(context,c,err,ret) \ while ((c)) {\ kprintf("FlagError in %s:%ld, error = %s\n", __PRETTY_FUNCTION__, __LINE__, #err);\ context->CurrentError = err;\ return ret;\ } #else #define GLFlagError(context,c,err) #define GLFlagError2(context,c,err,ret) #endif #ifndef GET_INSTANCE #define GET_INSTANCE(self) \ (GLcontext)((uint32)self - self->Data.NegativeSize) #endif #include "GL/gl.h" #include "GL/glext.h" #include "mgl/matrix.h" #endif