Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
9.5 KiB

  1. /*
  2. ** Copyright 1995-2095, Silicon Graphics, Inc.
  3. ** All Rights Reserved.
  4. **
  5. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6. ** the contents of this file may not be disclosed to third parties, copied or
  7. ** duplicated in any form, in whole or in part, without the prior written
  8. ** permission of Silicon Graphics, Inc.
  9. **
  10. ** RESTRICTED RIGHTS LEGEND:
  11. ** Use, duplication or disclosure by the Government is subject to restrictions
  12. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15. ** rights reserved under the Copyright Laws of the United States.
  16. */
  17. /******************************************************************************
  18. Locale
  19. ******************************************************************************/
  20. #define __GLS_C_LOCALE_DECLARE \
  21. const GLubyte *const __locale = glsCSTR(setlocale(LC_NUMERIC, GLS_NONE)); \
  22. GLboolean __saveLocale = (GLboolean)(__locale[0] != 'C' || __locale[1])
  23. #define __GLS_C_LOCALE_BEGIN \
  24. if ( \
  25. __saveLocale && \
  26. __glsString_assign(&__GLS_CONTEXT->savedLocale, __locale) \
  27. ) { \
  28. setlocale(LC_NUMERIC, "C"); \
  29. } else { \
  30. __saveLocale = GL_FALSE; \
  31. }
  32. #define __GLS_C_LOCALE_END \
  33. if (__saveLocale) setlocale( \
  34. LC_NUMERIC, (const char *)__GLS_CONTEXT->savedLocale.head \
  35. )
  36. /******************************************************************************
  37. __GLSglrc
  38. ******************************************************************************/
  39. typedef struct {
  40. GLvoid *base;
  41. size_t byteCount;
  42. } __GLSglrcBuf;
  43. typedef struct __GLSglrc __GLSglrc;
  44. struct __GLSglrc {
  45. GLuint layer;
  46. GLuint readLayer;
  47. GLuint shareGLRC;
  48. __GLSglrcBuf feedbackBuf;
  49. __GLSglrcBuf selectBuf;
  50. #if __GL_EXT_vertex_array
  51. __GLSglrcBuf colorBuf;
  52. __GLSglrcBuf edgeFlagBuf;
  53. __GLSglrcBuf indexBuf;
  54. __GLSglrcBuf normalBuf;
  55. __GLSglrcBuf texCoordBuf;
  56. __GLSglrcBuf vertexBuf;
  57. #endif /* __GL_EXT_vertex_array */
  58. };
  59. extern void __glsGLRC_final(__GLSglrc *inoutGLRC);
  60. extern void __glsGLRC_init(__GLSglrc *outGLRC);
  61. /******************************************************************************
  62. __GLSlayer
  63. ******************************************************************************/
  64. typedef struct __GLSlayer __GLSlayer;
  65. struct __GLSlayer {
  66. GLfloat invisibleAspect;
  67. GLSenum displayFormat;
  68. GLint doubleBuffer;
  69. GLint invisible;
  70. GLint invisibleHeightPixels;
  71. GLint level;
  72. GLint stereo;
  73. GLint transparent;
  74. GLint indexBits;
  75. GLint redBits;
  76. GLint greenBits;
  77. GLint blueBits;
  78. GLint alphaBits;
  79. GLint depthBits;
  80. GLint stencilBits;
  81. GLint accumRedBits;
  82. GLint accumGreenBits;
  83. GLint accumBlueBits;
  84. GLint accumAlphaBits;
  85. GLint auxBuffers;
  86. #if __GL_SGIS_multisample
  87. GLint sampleBuffers;
  88. GLint samples;
  89. #endif /* __GL_SGIS_multisample */
  90. };
  91. extern void __glsLayer_init(__GLSlayer *outLayer);
  92. /******************************************************************************
  93. __GLSheader
  94. ******************************************************************************/
  95. typedef struct __GLSheader __GLSheader;
  96. struct __GLSheader {
  97. GLfloat aspect;
  98. GLfloat borderWidth;
  99. GLfloat contrastRatio;
  100. GLfloat heightMM;
  101. GLfloat borderColor[4];
  102. GLfloat gamma[4];
  103. GLfloat origin[2];
  104. GLfloat pageColor[4];
  105. GLfloat pageSize[2];
  106. GLfloat redPoint[2];
  107. GLfloat greenPoint[2];
  108. GLfloat bluePoint[2];
  109. GLfloat whitePoint[2];
  110. GLint frameCount;
  111. GLint glrcCount;
  112. __GLSglrc *glrcs;
  113. GLint heightPixels;
  114. GLint layerCount;
  115. GLint tileable;
  116. __GLSlayer *layers;
  117. GLint createTime[6];
  118. GLint modifyTime[6];
  119. __GLSstring extensions;
  120. __GLSstring author;
  121. __GLSstring description;
  122. __GLSstring notes;
  123. __GLSstring title;
  124. __GLSstring tools;
  125. __GLSstring version;
  126. };
  127. extern void __glsHeader_final(__GLSheader *inoutHeader);
  128. extern GLboolean __glsHeader_init(__GLSheader *outHeader);
  129. extern GLboolean __glsHeader_reset(__GLSheader *inoutHeader);
  130. /******************************************************************************
  131. __GLScontext
  132. ******************************************************************************/
  133. #if !__GLS_PLATFORM_WIN32
  134. // DrewB
  135. typedef void (*__GLSdecodeBinFunc)(GLubyte *inoutPtr);
  136. typedef void (*__GLSdecodeTextFunc)(__GLSreader *inoutReader);
  137. #else
  138. typedef void (*__GLSdecodeBinFunc)(struct __GLScontext *ctx,
  139. GLubyte *inoutPtr);
  140. typedef void (*__GLSdecodeTextFunc)(struct __GLScontext *ctx,
  141. __GLSreader *inoutReader);
  142. #endif
  143. typedef struct __GLScontextStream __GLScontextStream;
  144. typedef struct __GLSlistString __GLSlistString;
  145. typedef struct {
  146. GLint count;
  147. GLulong vals[__GLS_MAX_OUT_ARGS];
  148. } __GLSoutArgs;
  149. typedef struct __GLScontext {
  150. __GLS_LIST_ELEM;
  151. GLSenum abortMode;
  152. GLSenum blockType;
  153. GLint callNesting;
  154. GLint captureEntryCount;
  155. GLScaptureFunc captureEntryFunc;
  156. GLScaptureFunc captureExitFunc;
  157. GLubyte captureFlags[__GLS_OPCODE_COUNT];
  158. GLint captureNesting;
  159. GLSfunc commandFuncs[__GLS_OPCODE_COUNT];
  160. GLboolean contextCall;
  161. __GLSdict *contextStreamDict;
  162. __GLS_ITERLIST(__GLScontextStream) contextStreamList;
  163. GLboolean current;
  164. GLuint currentGLRC;
  165. GLvoid *dataPointer;
  166. FILE *defaultReadChannel;
  167. FILE *defaultWriteChannel;
  168. GLboolean deleted;
  169. GLSfunc dispatchAPI[__GLS_OPCODE_COUNT];
  170. GLSfunc dispatchCall[__GLS_OPCODE_COUNT];
  171. __GLSdecodeBinFunc dispatchDecode_bin[__GLS_OPCODE_COUNT];
  172. __GLSheader header;
  173. GLuint name;
  174. __GLSoutArgs outArgs;
  175. GLboolean pixelSetupGen;
  176. GLSreadFunc readFunc;
  177. __GLS_ITERLIST(__GLSlistString) readPrefixList;
  178. __GLSstring returnString;
  179. __GLSstring savedLocale;
  180. __GLSversion streamVersion;
  181. GLSwriteFunc unreadFunc;
  182. struct __GLSwriter *writer;
  183. struct __GLSwriter *writers[__GLS_MAX_CAPTURE_NESTING];
  184. GLSwriteFunc writeFunc;
  185. __GLSlistString *writePrefix;
  186. #if __GLS_PLATFORM_WIN32
  187. // DrewB
  188. GLboolean captureExecOverride;
  189. GLSfunc captureExec[__GLS_OPCODE_COUNT];
  190. #endif
  191. } __GLScontext;
  192. typedef __GLS_LIST(__GLScontext) __GLScontextList;
  193. extern GLvoid* __glsContext_allocFeedbackBuf(
  194. __GLScontext *inoutContext, size_t inByteCount
  195. );
  196. extern GLvoid* __glsContext_allocSelectBuf(
  197. __GLScontext *inoutContext, size_t inByteCount
  198. );
  199. #if __GL_EXT_vertex_array
  200. extern GLvoid* __glsContext_allocVertexArrayBuf(
  201. __GLScontext *inoutContext, GLSopcode inOpcode, size_t inByteCount
  202. );
  203. #endif /* __GL_EXT_vertex_array */
  204. extern __GLScontext* __glsContext_create(GLuint inName);
  205. extern __GLScontext* __glsContext_destroy(__GLScontext *inContext);
  206. extern void __glsContext_updateDispatchDecode_bin(__GLScontext *inoutContext);
  207. extern void __glsContext_updateDispatchTables(__GLScontext *inoutContext);
  208. /******************************************************************************
  209. __GLScontextStream
  210. ******************************************************************************/
  211. typedef struct __GLScontextStreamBlock __GLScontextStreamBlock;
  212. struct __GLScontextStream {
  213. __GLS_LIST_ELEM;
  214. __GLS_LIST(__GLScontextStreamBlock) blockList;
  215. GLint callCount;
  216. __GLSstring name;
  217. GLboolean deleted;
  218. };
  219. typedef __GLS_LIST_ITER(__GLScontextStreamBlock) __GLScontextStreamBlockIter;
  220. extern __GLScontextStream* __glsContextStream_create(const GLubyte *inName);
  221. extern __GLScontextStream* __glsContextStream_destroy(
  222. __GLScontextStream *inStream
  223. );
  224. extern __GLScontextStreamBlock* __glsContextStream_appendBlock(
  225. __GLScontextStream *inoutStream, size_t inBufSize
  226. );
  227. extern void __glsContextStream_call(__GLScontextStream *inoutStream);
  228. extern __GLScontextStreamBlock* __glsContextStream_firstBlock(
  229. __GLScontextStream *inoutStream
  230. );
  231. extern size_t __glsContextStream_getByteCount(__GLScontextStream *inoutStream);
  232. extern GLuint __glsContextStream_getCRC32(__GLScontextStream *inoutStream);
  233. extern __GLScontextStreamBlock* __glsContextStream_lastBlock(
  234. __GLScontextStream *inoutStream
  235. );
  236. extern void __glsContextStream_truncate(
  237. __GLScontextStream *inoutStream,
  238. __GLScontextStreamBlock *inBlock,
  239. size_t inOffset
  240. );
  241. #define __GLS_FULL_CONTEXT_STREAM_BLOCK 0.9f
  242. struct __GLScontextStreamBlock {
  243. __GLS_LIST_ELEM;
  244. GLubyte *buf;
  245. GLubyte *bufTail;
  246. GLubyte *writeTail;
  247. };
  248. extern __GLScontextStreamBlock* __glsContextStreamBlock_create(
  249. size_t inBufSize
  250. );
  251. extern __GLScontextStreamBlock* __glsContextStreamBlock_destroy(
  252. __GLScontextStreamBlock *inBlock
  253. );
  254. extern GLboolean __glsContextStreamBlock_addJump(
  255. __GLScontextStreamBlock *inoutBlock, GLubyte *inDest
  256. );
  257. extern GLboolean __glsContextStreamBlock_addPad(
  258. __GLScontextStreamBlock *inoutBlock
  259. );
  260. extern GLboolean __glsContextStreamBlock_hasJump(
  261. __GLScontextStreamBlock *inBlock
  262. );
  263. extern GLboolean __glsContextStreamBlock_removeJump(
  264. __GLScontextStreamBlock *inoutBlock
  265. );
  266. /******************************************************************************
  267. __GLSlistString
  268. ******************************************************************************/
  269. struct __GLSlistString {
  270. __GLS_LIST_ELEM;
  271. __GLSstring val;
  272. };
  273. extern GLboolean __glsListString_prefix(
  274. const __GLSlistString *inString,
  275. const GLubyte *inName,
  276. __GLSstring *outPath
  277. );
  278. extern __GLSlistString* __glsListString_create(const GLubyte *inVal);
  279. extern __GLSlistString* __glsListString_destroy(__GLSlistString *inString);