home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / src / AOS / amigamesa.i.in < prev    next >
Text File  |  1999-09-23  |  9KB  |  296 lines

  1. #ifndef    AMIGAMESAint_I
  2. #define    AMIGAMESAint_I
  3.  
  4. /*
  5.  * $Id: $
  6.  */
  7.  
  8. /*
  9.  * Mesa 3-D graphics library
  10.  * Version:  3.1
  11.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  12.  *
  13.  * This library is free software; you can redistribute it and/or
  14.  * modify it under the terms of the GNU Library General Public
  15.  * License as published by the Free Software Foundation; either
  16.  * version 2 of the License, or (at your option) any later version.
  17.  *
  18.  * This library is distributed in the hope that it will be useful,
  19.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21.  * Library General Public License for more details.
  22.  *
  23.  * You should have received a copy of the GNU Library General Public
  24.  * License along with this library; if not, write to the Free
  25.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26.  */
  27.  
  28. #define    NO_CONTEXT_LIBRARIES        /* do not pass library-bases over contexts */
  29. #define    REPLACE_ALLOC            /* replace malloc/calloc/free with pool-functions */
  30. //#define    PREVENT_LUT        /* use real calculation instead of LUTs */
  31.  
  32. /************************************************************************
  33.  *
  34.  * basic os-dependent
  35.  */
  36.  
  37. #if 0
  38. /*
  39.  * A is the blitmask (temporary memory passed to Blt#? as TempA)
  40.  * B is the source-bitmap
  41.  * C is the destination bitmap
  42.  */
  43.  
  44. #define    LOGIC_CLEAR    
  45. #define    LOGIC_SET    
  46. #define    LOGIC_COPY    (ABC | ABNC)
  47. #define    LOGIC_COPY_INV    (ANBC | ANBNC)
  48. #define    LOGIC_NOOP    
  49. #define    LOGIC_INV    
  50. #define    LOGIC_AND    (ABC)
  51. #define    LOGIC_NAND    (ANBC)
  52. #define    LOGIC_OR    (ABC | ANBC | ABNC) | (NABC | NANBC | NABNC)
  53. #define    LOGIC_NOR    (ANBC | ABC | ANBNC) | (NANBC | NABC | NANBNC)
  54. #define    LOGIC_XOR    (ANBC | ABNC) | (NANBC | NABNC)
  55. #define    LOGIC_XNOR    (ABC | ANBNC) | (NABC | NANBNC)
  56. #endif
  57.  
  58. /************************************************************************
  59.  *
  60.  * inlines
  61.  */
  62.  
  63. /************************************************************************
  64.  *
  65.  * MESA_AOS kernel structures
  66.  */
  67.  
  68. #define    AOS_KERNEL
  69.  
  70. /*****************************************************************************
  71.  *
  72.  * private palette-definitions
  73.  */
  74. #define    PALETTE_DEFS
  75. #include "AOS/palettes.i"
  76. #undef    PALETTE_DEFS
  77.  
  78. /*****************************************************************************
  79.  *
  80.  * private visual
  81.  */
  82. #define    amigamesa_visual_context    %d
  83. #define    amigamesa_visual_gl_visual    %d
  84. #define    amigamesa_visual_flags        %d
  85. #define    amigamesa_visual_depth        %d
  86.  
  87. #define    VISUAL_DOUBLEBUFFER    (1 << 0)            /* double buffered? */
  88. #define    VISUAL_STEREO        (1 << 1)            /* stereo mode? */
  89. #define    VISUAL_RGBMODE        (1 << 2)            /* RGB mode?  */
  90. #define    VISUAL_ALPHACHANNEL    (1 << 3)            /* Alphacolor? */
  91.  
  92. #define    VISUAL_AUTORGB        (1 << 8)            /* autodetect RGB mode? */
  93.  
  94. /*****************************************************************************
  95.  *
  96.  * private buffer
  97.  *
  98.  * TODO: check for size compatibility of buffer vs. context if AMA_Buffer!!!
  99.  */
  100. #define    amigamesa_buffer_context        %d
  101. #define    amigamesa_buffer_gl_buffer        %d
  102. #define    amigamesa_buffer_attachedWindowID    %d
  103.  
  104. /*****************************************************************************
  105.  *
  106.  * private context
  107.  */
  108. #define    amigamesa_context_gl_ctx    %d
  109. #define    amigamesa_context_gl_share    %d
  110.  
  111. #define    amigamesa_context_visual    %d
  112. #define    amigamesa_context_buffer    %d
  113.  
  114. #define    amigamesa_context_mempool    %d
  115.  
  116. #define    amigamesa_context_lastAction    %d
  117.  
  118. #define    amigamesa_context_flags        %d
  119.  
  120. #define    RESOURCE_VISUAL        (1 <<  0)            /* contexts visual is it's own */
  121. #define    RESOURCE_BUFFER        (1 <<  1)            /* contexts buffer is it's own */
  122.  
  123. #define    PALETTE_CACHE        (1 <<  8)            /* try to cache pens for speedup pen-determination */
  124. #define    PALETTE_DITHER        (1 <<  9)            /* dither all values before GetPen */
  125.  
  126. #define    amigamesa_context_pixel        %d
  127. #define    amigamesa_context_clearpixel    %d
  128.  
  129. #define    amigamesa_context_window    %d
  130. #define    amigamesa_context_rp        %d
  131. #define    amigamesa_context_Screen    %d
  132.  
  133. #define    amigamesa_context_front_rp    %d
  134. #define    amigamesa_context_back_rp    %d
  135. #define    amigamesa_context_tmpras    %d
  136. #define    amigamesa_context_temprp    %d
  137. #define    amigamesa_context_BackArray    %d
  138. #define    amigamesa_context_imageline    %d
  139.  
  140. #define    amigamesa_context_depth        %d
  141.  
  142. #define    amigamesa_context_width        %d
  143. #define    amigamesa_context_height    %d
  144. #define    amigamesa_context_left        %d
  145. #define    amigamesa_context_bottom    %d
  146. #define    amigamesa_context_right        %d
  147. #define    amigamesa_context_top        %d
  148. #define    amigamesa_context_RealWidth    %d
  149. #define    amigamesa_context_RealHeight    %d
  150. #define    amigamesa_context_FixedWidth    %d
  151. #define    amigamesa_context_FixedHeight    %d
  152.  
  153. #define    amigamesa_context_FixedX    %d
  154. #define    amigamesa_context_FixedY    %d
  155. #define    amigamesa_context_FixedXY    %d
  156. #define    amigamesa_context_FixedXYdb    %d
  157.  
  158. #define    amigamesa_context_trueColor    %d
  159. #define    amigamesa_context_PaletteCols    %d
  160. #define    amigamesa_context_Palette    %d
  161. #define    amigamesa_context_MatchErrors    %d
  162. #define    amigamesa_context_penCache    %d
  163. #define    amigamesa_context_ItoP        %d
  164. #define    amigamesa_context_PtoI        %d
  165.  
  166. #define    amigamesa_context_InitDD    %d
  167. #define    amigamesa_context_Dispose    %d
  168. #define    amigamesa_context_SwapBuffer    %d
  169.  
  170. #define    NO_CONTEXT_LIBRARIES
  171. #ifndef    NO_CONTEXT_LIBRARIES
  172.   /* speeds up inlines needn't to restore a4 as they get the library-bases
  173.    * out of the context not a4! */
  174. #define    amigamesa_context_aSysBase    %d
  175. #define    amigamesa_context_aDOSBase    %d
  176. #define    amigamesa_context_aGfxBase    %d
  177. #define    amigamesa_context_aUtilityBase    %d
  178. #define    amigamesa_context_aCyberGfxBase    %d
  179. #ifndef    NO_CONTEXT_AVAILABLE
  180. #define    SysBase        (amesa + amigamesa_context_aSysBase)
  181. #define    DOSBase        (amesa + amigamesa_context_aDOSBase)
  182. #define    GfxBase        (amesa + amigamesa_context_aGfxBase)
  183. #define    UtilityBase    (amesa + amigamesa_context_aUtilityBase)
  184. #define    CyberGfxBase    (amesa + amigamesa_context_aCyberGfxBase)
  185. #endif
  186. #endif
  187. };
  188.  
  189. /* set a flag */
  190. #define    SetF(field, flag)    ((field) |= (flag))
  191. /* clear a flag */
  192. #define    ClrF(field, flag)    ((field) &= ~(flag))
  193. /* swap a flag */
  194. #define    SwpF(field, flag)    ((field) ^= (flag))
  195. /* test a flag */
  196. #define    TstF(field, flag)    ((field) & (flag))
  197.  
  198. /* convert a flag to a boolean */
  199. #define    FtoB(field, flag)    (TstF(field, flag) ? GL_TRUE : GL_FALSE)
  200.  
  201. /*****************************************************************************
  202.  *
  203.  * private externals
  204.  */
  205.  
  206. //#define    TRYTEST    1
  207. #define    presets_trueColor    %d
  208. #define    presets_tryCached    %d
  209. #define    presets_tryTest        %d
  210. #define    presets_Dither        %d
  211.  
  212. /*****************************************************************************
  213.  *
  214.  * includes
  215.  */
  216.  
  217. /*****************************************************************************
  218.  *
  219.  * private palette-prototypes
  220.  */
  221. #define    PALETTE_PROTOS
  222. #include "AOS/palettes.i"
  223. #undef    PALETTE_PROTOS
  224.  
  225. /*****************************************************************************
  226.  *
  227.  * Note that you'll usually have to flip Y coordinates since Mesa's
  228.  * window coordinates start at the bottom and increase upward.  Most
  229.  * window system's Y-axis increases downward
  230.  *
  231.  * See dd.h for more device driver info.
  232.  * See the other device driver implementations for ideas.
  233.  */
  234. #define    LayerWidth(l)        (l->bounds.MaxX - l->bounds.MinX + 1)
  235. #define    LayerHeight(l)        (l->bounds.MaxY - l->bounds.MinY + 1)
  236. #define    natFixedMask(width)    (((width) + 15) & 0xFFFFFFF0)    /* 16byte aligned */
  237. #define    cybFixedMask(width)    (((width) +  3) & 0xFFFFFFFC)    /*  4byte aligned */
  238. #ifdef    PREVENT_LUT
  239. #define FIXx(x)            (amesa->left + (x))
  240. #define FIXy(y)            (amesa->FixedHeight - amesa->bottom - (y))
  241. #define FIXxy(x,y)        (amesa->FixedWidth * FIXy(y) + FIXx(x))
  242. #define    dbPenGet(am)        ((GLubyte *)((am)->BackArray))
  243. #define    dbPen(db, x, y)        (((GLubyte *)(db)) + FIXxy((x), (y)))
  244. #define    dbRGBAGet(am)        ((GLuint *)((am)->BackArray))
  245. #define    dbRGBA(db, x, y)    (((GLuint *)(db)) + FIXxy((x), (y)))
  246. #else
  247. #define FIXx(x)            (amesa->FixedX + (x))
  248. #define FIXy(y)            (amesa->FixedY - (y))
  249. #define FIXxy(x,y)        (amesa->FixedXY[(y)] + (x))
  250. #define    dbPenGet(am)        ((GLubyte *)((am)->FixedXYdb))    /*  (GLubyte **) */
  251. #define    dbPen(db, x, y)        (((GLubyte **)(db))[(y)] + (x))    /* *(GLubyte **) */
  252. #define    dbRGBAGet(am)        ((GLuint *)((am)->FixedXYdb))    /*  (GLuint **) */
  253. #define    dbRGBA(db, x, y)    (((GLuint **)(db))[(y)] + (x))    /* *(GLuint **) */
  254. #endif
  255.  
  256. /*****************************************************************************
  257.  *
  258.  * ???
  259.  */
  260.  
  261. #define MAX_POLYGON 300
  262.  
  263. /*****************************************************************************
  264.  *
  265.  * debugging output
  266.  */
  267. /* deactive debugging-output only on request */
  268. #if !defined(NDEBUG) && !defined(NODEBUG)
  269. extern LONG debugOutput;
  270. #include <stdio.h>
  271. #define DEBUGOUT(level,str,args...) ({    \
  272.   if(debugOutput >= level) {        \
  273.  /* Printf(str,"gl  : "); */        \
  274.  /* Printf(str,##args);    */        \
  275.     fprintf(stderr,"gl  : ");        \
  276.     fprintf(stderr,str,##args);        \
  277.     fflush(stderr);            \
  278.   }                    \
  279. })
  280. #else
  281. #define DEBUGOUT(level,str,args...) ({})
  282. #define    DEBUGOUT_REMOVED
  283. #endif
  284.  
  285. #include <stdio.h>
  286. #define Error(str,args...) ({        \
  287. /*Printf("Fatal error: "); */        \
  288. /*Printf(str,##args); */        \
  289.   fprintf(stderr,"Fatal error: ");    \
  290.   fprintf(stderr,str,##args);        \
  291.   fflush(stderr);            \
  292.   abort();                \
  293. })
  294.  
  295. #endif
  296.