home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 2000 April & May / AMIGA_2000_04.iso / patches / mesa3.1 / mesa-3_1.lha / src / api.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-07  |  3.1 KB  |  119 lines

  1. /* $Id: api.h,v 1.2.2.1 1999/12/15 12:58:10 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.1
  6.  * 
  7.  * Copyright (C) 1999  Brian Paul   All Rights Reserved.
  8.  * 
  9.  * Permission is hereby granted, free of charge, to any person obtaining a
  10.  * copy of this software and associated documentation files (the "Software"),
  11.  * to deal in the Software without restriction, including without limitation
  12.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  13.  * and/or sell copies of the Software, and to permit persons to whom the
  14.  * Software is furnished to do so, subject to the following conditions:
  15.  * 
  16.  * The above copyright notice and this permission notice shall be included
  17.  * in all copies or substantial portions of the Software.
  18.  * 
  19.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  22.  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  23.  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24.  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  */
  26. /* $XFree86: xc/lib/GL/mesa/src/api.h,v 1.4 1999/06/27 14:07:26 dawes Exp $ */
  27.  
  28.  
  29.  
  30.  
  31. /*
  32.  * This header contains stuff only included by api1.c, api2.c and apiext.c 
  33.  * and cva.c and varray.c
  34.  */
  35.  
  36.  
  37. #ifndef API_H
  38. #define API_H
  39.  
  40.  
  41. #if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) && !defined(GLX_USE_DLOPEN)
  42. #define NEED_MESA_FUNCS_WRAPPED
  43. #include "mesa_api.h"
  44. #endif
  45.  
  46. /*
  47.  * Single/multiple thread context selection.
  48.  */
  49. #ifdef THREADS
  50.  
  51. /* Get the context associated with the calling thread */
  52. #define GET_CONTEXT    GLcontext *CC = gl_get_thread_context()
  53. #define GET_IMMEDIATE   struct immediate *IM = (gl_get_thread_context())->input;
  54.  
  55. #define SET_IMMEDIATE(ctx, im)                        \
  56. do {                                    \
  57.    ctx->input = im;                            \
  58. } while (0)
  59.  
  60. #else
  61.  
  62. /* CC is a global pointer for all threads in the address space */
  63. #define GET_CONTEXT
  64.  
  65. /* And so is VB */
  66. #define GET_IMMEDIATE struct immediate *IM = CURRENT_INPUT
  67.  
  68. #define SET_IMMEDIATE(ctx, im)                        \
  69. do {                                    \
  70.    ctx->input = im;                            \
  71.    CURRENT_INPUT = im;                            \
  72. } while (0)
  73.  
  74. #endif /* THREADS */
  75.  
  76.  
  77. /* Make sure there's a rendering context. KW: Only do this if compiled
  78.  * debug.
  79.  */
  80. #ifdef DEBUG
  81. #define CHECK_CONTEXT                            \
  82.    if (!CC) {                                \
  83.       if (getenv("MESA_DEBUG")) {                    \
  84.      fprintf(stderr,"Mesa user error: no rendering context.\n");    \
  85.       }                                    \
  86.       return;                                \
  87.    }
  88.  
  89. #define CHECK_CONTEXT_RETURN(R)                        \
  90.    if (!CC) {                                \
  91.       if (getenv("MESA_DEBUG")) {                    \
  92.          fprintf(stderr,"Mesa user error: no rendering context.\n");    \
  93.       }                                    \
  94.       return (R);                            \
  95.    }
  96. #else
  97. #define CHECK_CONTEXT
  98. #define CHECK_CONTEXT_RETURN(R)
  99. #endif
  100.  
  101.  
  102. #if !defined(CTX_ARG)
  103. #define CTX_ARG 
  104. #define CTX_VOID
  105. #define CTX_PRM
  106. #define CTX_VPRM
  107. #endif
  108.  
  109. /*
  110.  * An optimization in a few performance-critical functions.
  111.  */
  112. #ifndef XFree86Server        /* don't think we want this in DRI??? */
  113. #define SHORTCUT
  114. #endif
  115.  
  116.  
  117.  
  118. #endif
  119.