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.

316 lines
9.7 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. #include "glslib.h"
  18. void __gls_capture_glMap1d(
  19. GLenum target,
  20. GLdouble u1,
  21. GLdouble u2,
  22. GLint stride,
  23. GLint order,
  24. const GLdouble *points
  25. ) {
  26. GLbitfield captureFlags;
  27. __GLScontext *const ctx = __GLS_CONTEXT;
  28. __GLSwriter *writer;
  29. extern GLint __glsEvalComputeK(GLenum inTarget);
  30. GLint k, pad;
  31. ++ctx->captureEntryCount;
  32. if (ctx->captureEntryFunc) ctx->captureEntryFunc(GLS_OP_glMap1d);
  33. captureFlags = ctx->captureFlags[GLS_OP_glMap1d];
  34. if (captureFlags & GLS_CAPTURE_EXECUTE_BIT) {
  35. __GLS_BEGIN_CAPTURE_EXEC(ctx, GLS_OP_glMap1d);
  36. glMap1d(target, u1, u2, stride, order, points);
  37. __GLS_END_CAPTURE_EXEC(ctx, GLS_OP_glMap1d);
  38. }
  39. if (!(captureFlags & GLS_CAPTURE_WRITE_BIT)) goto end;
  40. writer = ctx->writer;
  41. k = __glsEvalComputeK(target);
  42. if (stride >= k) {
  43. pad = stride - k;
  44. stride = k;
  45. } else {
  46. k = pad = 0;
  47. }
  48. if (!writer->padWordCount(writer, 0)) goto end;
  49. if (
  50. !writer->beginCommand(
  51. writer, GLS_OP_glMap1d, 28 + __GLS_MAX(k * order * 8, 0)
  52. )
  53. ) {
  54. goto end;
  55. }
  56. writer->putGLenum(writer, target);
  57. if (writer->type == GLS_TEXT) {
  58. writer->putGLdouble(writer, u1);
  59. writer->putGLdouble(writer, u2);
  60. writer->putGLint(writer, stride);
  61. writer->putGLint(writer, order);
  62. } else {
  63. writer->putGLint(writer, stride);
  64. writer->putGLint(writer, order);
  65. writer->putGLdouble(writer, u1);
  66. writer->putGLdouble(writer, u2);
  67. }
  68. if (pad) {
  69. writer->putGLdoublevs(
  70. writer, GL_FALSE, k, pad * 8, order, 0, 1, points
  71. );
  72. } else {
  73. writer->putGLdoublev(writer, k * order, points);
  74. }
  75. writer->endCommand(writer);
  76. end:
  77. if (ctx->captureExitFunc) ctx->captureExitFunc(GLS_OP_glMap1d);
  78. --ctx->captureEntryCount;
  79. }
  80. void __gls_capture_glMap1f(
  81. GLenum target,
  82. GLfloat u1,
  83. GLfloat u2,
  84. GLint stride,
  85. GLint order,
  86. const GLfloat *points
  87. ) {
  88. GLbitfield captureFlags;
  89. __GLScontext *const ctx = __GLS_CONTEXT;
  90. __GLSwriter *writer;
  91. extern GLint __glsEvalComputeK(GLenum inTarget);
  92. GLint k, pad;
  93. ++ctx->captureEntryCount;
  94. if (ctx->captureEntryFunc) ctx->captureEntryFunc(GLS_OP_glMap1f);
  95. captureFlags = ctx->captureFlags[GLS_OP_glMap1f];
  96. if (captureFlags & GLS_CAPTURE_EXECUTE_BIT) {
  97. __GLS_BEGIN_CAPTURE_EXEC(ctx, GLS_OP_glMap1f);
  98. glMap1f(target, u1, u2, stride, order, points);
  99. __GLS_END_CAPTURE_EXEC(ctx, GLS_OP_glMap1f);
  100. }
  101. if (!(captureFlags & GLS_CAPTURE_WRITE_BIT)) goto end;
  102. writer = ctx->writer;
  103. k = __glsEvalComputeK(target);
  104. if (stride >= k) {
  105. pad = stride - k;
  106. stride = k;
  107. } else {
  108. k = pad = 0;
  109. }
  110. if (
  111. !writer->beginCommand(
  112. writer, GLS_OP_glMap1f, 20 + __GLS_MAX(k * order * 4, 0)
  113. )
  114. ) {
  115. goto end;
  116. }
  117. writer->putGLenum(writer, target);
  118. if (writer->type == GLS_TEXT) {
  119. writer->putGLfloat(writer, u1);
  120. writer->putGLfloat(writer, u2);
  121. writer->putGLint(writer, stride);
  122. writer->putGLint(writer, order);
  123. } else {
  124. writer->putGLint(writer, stride);
  125. writer->putGLint(writer, order);
  126. writer->putGLfloat(writer, u1);
  127. writer->putGLfloat(writer, u2);
  128. }
  129. if (pad) {
  130. writer->putGLfloatvs(
  131. writer, GL_FALSE, k, pad * 4, order, 0, 1, points
  132. );
  133. } else {
  134. writer->putGLfloatv(writer, k * order, points);
  135. }
  136. writer->endCommand(writer);
  137. end:
  138. if (ctx->captureExitFunc) ctx->captureExitFunc(GLS_OP_glMap1f);
  139. --ctx->captureEntryCount;
  140. }
  141. void __gls_capture_glMap2d( \
  142. GLenum target,
  143. GLdouble u1,
  144. GLdouble u2,
  145. GLint ustride,
  146. GLint uorder,
  147. GLdouble v1,
  148. GLdouble v2,
  149. GLint vstride,
  150. GLint vorder,
  151. const GLdouble *points
  152. ) {
  153. GLbitfield captureFlags;
  154. __GLScontext *const ctx = __GLS_CONTEXT;
  155. __GLSwriter *writer;
  156. extern GLint __glsEvalComputeK(GLenum inTarget);
  157. GLint k, pad0, pad1;
  158. GLint *const order0 = (ustride >= vstride) ? &vorder : &uorder;
  159. GLint *const order1 = (ustride >= vstride) ? &uorder : &vorder;
  160. GLint *const stride0 = (ustride >= vstride) ? &vstride : &ustride;
  161. GLint *const stride1 = (ustride >= vstride) ? &ustride : &vstride;
  162. ++ctx->captureEntryCount;
  163. if (ctx->captureEntryFunc) ctx->captureEntryFunc(GLS_OP_glMap2d);
  164. captureFlags = ctx->captureFlags[GLS_OP_glMap2d];
  165. if (captureFlags & GLS_CAPTURE_EXECUTE_BIT) {
  166. __GLS_BEGIN_CAPTURE_EXEC(ctx, GLS_OP_glMap2d);
  167. glMap2d(
  168. target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points
  169. );
  170. __GLS_END_CAPTURE_EXEC(ctx, GLS_OP_glMap2d);
  171. }
  172. if (!(captureFlags & GLS_CAPTURE_WRITE_BIT)) goto end;
  173. writer = ctx->writer;
  174. k = __glsEvalComputeK(target);
  175. if (*stride0 >= k) {
  176. pad0 = *stride0 - k;
  177. pad1 = *stride1 - *order0 * k;
  178. *stride0 = k;
  179. *stride1 = *order0 * k;
  180. } else {
  181. k = pad0 = pad1 = 0;
  182. }
  183. if (!writer->padWordCount(writer, 0)) goto end;
  184. if (
  185. !writer->beginCommand(
  186. writer,
  187. GLS_OP_glMap2d,
  188. 52 + __GLS_MAX(k * vorder * uorder * 8, 0)
  189. )
  190. ) {
  191. goto end;
  192. }
  193. writer->putGLenum(writer, target);
  194. if (writer->type == GLS_TEXT) {
  195. writer->putGLdouble(writer, u1);
  196. writer->putGLdouble(writer, u2);
  197. writer->putGLint(writer, ustride);
  198. writer->putGLint(writer, uorder);
  199. writer->putGLdouble(writer, v1);
  200. writer->putGLdouble(writer, v2);
  201. writer->putGLint(writer, vstride);
  202. writer->putGLint(writer, vorder);
  203. } else {
  204. writer->putGLint(writer, ustride);
  205. writer->putGLint(writer, uorder);
  206. writer->putGLint(writer, vstride);
  207. writer->putGLint(writer, vorder);
  208. writer->putGLdouble(writer, u1);
  209. writer->putGLdouble(writer, u2);
  210. writer->putGLdouble(writer, v1);
  211. writer->putGLdouble(writer, v2);
  212. }
  213. if (pad1 || pad0) {
  214. writer->putGLdoublevs(
  215. writer, GL_FALSE, k, pad0 * 8, *order0, pad1 * 8, *order1, points
  216. );
  217. } else {
  218. writer->putGLdoublev(writer, k * vorder * uorder, points);
  219. }
  220. writer->endCommand(writer);
  221. end:
  222. if (ctx->captureExitFunc) ctx->captureExitFunc(GLS_OP_glMap2d);
  223. --ctx->captureEntryCount;
  224. }
  225. void __gls_capture_glMap2f( \
  226. GLenum target,
  227. GLfloat u1,
  228. GLfloat u2,
  229. GLint ustride,
  230. GLint uorder,
  231. GLfloat v1,
  232. GLfloat v2,
  233. GLint vstride,
  234. GLint vorder,
  235. const GLfloat *points
  236. ) {
  237. GLbitfield captureFlags;
  238. __GLScontext *const ctx = __GLS_CONTEXT;
  239. __GLSwriter *writer;
  240. extern GLint __glsEvalComputeK(GLenum inTarget);
  241. GLint k, pad0, pad1;
  242. GLint *const order0 = (ustride >= vstride) ? &vorder : &uorder;
  243. GLint *const order1 = (ustride >= vstride) ? &uorder : &vorder;
  244. GLint *const stride0 = (ustride >= vstride) ? &vstride : &ustride;
  245. GLint *const stride1 = (ustride >= vstride) ? &ustride : &vstride;
  246. ++ctx->captureEntryCount;
  247. if (ctx->captureEntryFunc) ctx->captureEntryFunc(GLS_OP_glMap2f);
  248. captureFlags = ctx->captureFlags[GLS_OP_glMap2f];
  249. if (captureFlags & GLS_CAPTURE_EXECUTE_BIT) {
  250. __GLS_BEGIN_CAPTURE_EXEC(ctx, GLS_OP_glMap2f);
  251. glMap2f(
  252. target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points
  253. );
  254. __GLS_END_CAPTURE_EXEC(ctx, GLS_OP_glMap2f);
  255. }
  256. if (!(captureFlags & GLS_CAPTURE_WRITE_BIT)) goto end;
  257. writer = ctx->writer;
  258. k = __glsEvalComputeK(target);
  259. if (*stride0 >= k) {
  260. pad0 = *stride0 - k;
  261. pad1 = *stride1 - *order0 * k;
  262. *stride0 = k;
  263. *stride1 = *order0 * k;
  264. } else {
  265. k = pad0 = pad1 = 0;
  266. }
  267. if (
  268. !writer->beginCommand(
  269. writer,
  270. GLS_OP_glMap2f,
  271. 36 + __GLS_MAX(k * vorder * uorder * 4, 0)
  272. )
  273. ) {
  274. goto end;
  275. }
  276. writer->putGLenum(writer, target);
  277. if (writer->type == GLS_TEXT) {
  278. writer->putGLfloat(writer, u1);
  279. writer->putGLfloat(writer, u2);
  280. writer->putGLint(writer, ustride);
  281. writer->putGLint(writer, uorder);
  282. writer->putGLfloat(writer, v1);
  283. writer->putGLfloat(writer, v2);
  284. writer->putGLint(writer, vstride);
  285. writer->putGLint(writer, vorder);
  286. } else {
  287. writer->putGLint(writer, ustride);
  288. writer->putGLint(writer, uorder);
  289. writer->putGLint(writer, vstride);
  290. writer->putGLint(writer, vorder);
  291. writer->putGLfloat(writer, u1);
  292. writer->putGLfloat(writer, u2);
  293. writer->putGLfloat(writer, v1);
  294. writer->putGLfloat(writer, v2);
  295. }
  296. if (pad0 || pad1) {
  297. writer->putGLfloatvs(
  298. writer, GL_FALSE, k, pad0 * 4, *order0, pad1 * 4, *order1, points
  299. );
  300. } else {
  301. writer->putGLfloatv(writer, k * vorder * uorder, points);
  302. }
  303. writer->endCommand(writer);
  304. end:
  305. if (ctx->captureExitFunc) ctx->captureExitFunc(GLS_OP_glMap2f);
  306. --ctx->captureEntryCount;
  307. }