Leaked source code of windows server 2003
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.

290 lines
7.3 KiB

  1. /*
  2. ** Copyright 1991, 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. ** $Revision: 1.13 $
  18. ** $Date: 1993/05/14 09:00:53 $
  19. */
  20. #include "precomp.h"
  21. #pragma hdrstop
  22. /*
  23. ** Store fragment proc.
  24. ** alpha test on, stencil test on, depth test on
  25. */
  26. void FASTCALL __glDoStore_ASD(__GLcolorBuffer *cfb, const __GLfragment *frag)
  27. {
  28. __GLcontext *gc;
  29. GLint x, y;
  30. gc = cfb->buf.gc;
  31. x = frag->x;
  32. y = frag->y;
  33. /* Pixel ownership, scissor */
  34. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  35. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  36. return;
  37. }
  38. if (!gc->alphaTestFuncTable[(GLint) (frag->color.a *
  39. gc->constants.alphaTableConv)]) {
  40. /* alpha test failed */
  41. return;
  42. }
  43. if (!(*gc->stencilBuffer.testFunc)(&gc->stencilBuffer, x, y)) {
  44. /* stencil test failed */
  45. (*gc->stencilBuffer.failOp)(&gc->stencilBuffer, x, y);
  46. return;
  47. }
  48. if (!(*gc->depthBuffer.store)(&gc->depthBuffer, x, y, frag->z)) {
  49. /* depth buffer test failed */
  50. (*gc->stencilBuffer.passDepthFailOp)(&gc->stencilBuffer, x, y);
  51. return;
  52. }
  53. (*gc->stencilBuffer.depthPassOp)(&gc->stencilBuffer, x, y);
  54. (*gc->procs.cfbStore)( cfb, frag );
  55. }
  56. /*
  57. ** Store fragment proc.
  58. ** alpha test on, stencil test on, depth test off
  59. */
  60. void FASTCALL __glDoStore_AS(__GLcolorBuffer *cfb, const __GLfragment *frag)
  61. {
  62. __GLcontext *gc;
  63. GLint x, y;
  64. gc = cfb->buf.gc;
  65. x = frag->x;
  66. y = frag->y;
  67. /* Pixel ownership, scissor */
  68. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  69. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  70. return;
  71. }
  72. if (!gc->alphaTestFuncTable[(GLint) (frag->color.a *
  73. gc->constants.alphaTableConv)]) {
  74. /* alpha test failed */
  75. return;
  76. }
  77. if (!(*gc->stencilBuffer.testFunc)(&gc->stencilBuffer, x, y)) {
  78. /* stencil test failed */
  79. (*gc->stencilBuffer.failOp)(&gc->stencilBuffer, x, y);
  80. return;
  81. }
  82. (*gc->stencilBuffer.depthPassOp)(&gc->stencilBuffer, x, y);
  83. (*gc->procs.cfbStore)( cfb, frag );
  84. }
  85. /*
  86. ** Store fragment proc.
  87. ** alpha test on, stencil test off, depth test on
  88. */
  89. void FASTCALL __glDoStore_AD(__GLcolorBuffer *cfb, const __GLfragment *frag)
  90. {
  91. __GLcontext *gc;
  92. GLint x, y;
  93. gc = cfb->buf.gc;
  94. x = frag->x;
  95. y = frag->y;
  96. /* Pixel ownership, scissor */
  97. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  98. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  99. return;
  100. }
  101. if (!gc->alphaTestFuncTable[(GLint) (frag->color.a *
  102. gc->constants.alphaTableConv)]) {
  103. /* alpha test failed */
  104. return;
  105. }
  106. if (!(*gc->depthBuffer.store)(&gc->depthBuffer, x, y, frag->z)) {
  107. /* depth buffer test failed */
  108. return;
  109. }
  110. (*gc->procs.cfbStore)( cfb, frag );
  111. }
  112. /*
  113. ** Store fragment proc.
  114. ** alpha test off, stencil test on, depth test on
  115. */
  116. void FASTCALL __glDoStore_SD(__GLcolorBuffer *cfb, const __GLfragment *frag)
  117. {
  118. __GLcontext *gc;
  119. GLint x, y;
  120. gc = cfb->buf.gc;
  121. x = frag->x;
  122. y = frag->y;
  123. /* Pixel ownership, scissor */
  124. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  125. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  126. return;
  127. }
  128. if (!(*gc->stencilBuffer.testFunc)(&gc->stencilBuffer, x, y)) {
  129. /* stencil test failed */
  130. (*gc->stencilBuffer.failOp)(&gc->stencilBuffer, x, y);
  131. return;
  132. }
  133. if (!(*gc->depthBuffer.store)(&gc->depthBuffer, x, y, frag->z)) {
  134. /* depth buffer test failed */
  135. (*gc->stencilBuffer.passDepthFailOp)(&gc->stencilBuffer, x, y);
  136. return;
  137. }
  138. (*gc->stencilBuffer.depthPassOp)(&gc->stencilBuffer, x, y);
  139. (*gc->procs.cfbStore)( cfb, frag );
  140. }
  141. /*
  142. ** Store fragment proc.
  143. ** alpha test on, stencil test off, depth test off
  144. */
  145. void FASTCALL __glDoStore_A(__GLcolorBuffer *cfb, const __GLfragment *frag)
  146. {
  147. __GLcontext *gc;
  148. GLint x, y;
  149. gc = cfb->buf.gc;
  150. x = frag->x;
  151. y = frag->y;
  152. /* Pixel ownership, scissor */
  153. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  154. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  155. return;
  156. }
  157. if (!gc->alphaTestFuncTable[(GLint) (frag->color.a *
  158. gc->constants.alphaTableConv)]) {
  159. /* alpha test failed */
  160. return;
  161. }
  162. (*gc->procs.cfbStore)( cfb, frag );
  163. }
  164. /*
  165. ** Store fragment proc.
  166. ** alpha test off, stencil test on, depth test off, draw to current buffer
  167. */
  168. void FASTCALL __glDoStore_S(__GLcolorBuffer *cfb, const __GLfragment *frag)
  169. {
  170. __GLcontext *gc;
  171. GLint x, y;
  172. gc = cfb->buf.gc;
  173. x = frag->x;
  174. y = frag->y;
  175. /* Pixel ownership, scissor */
  176. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  177. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  178. return;
  179. }
  180. if (!(*gc->stencilBuffer.testFunc)(&gc->stencilBuffer, x, y)) {
  181. /* stencil test failed */
  182. (*gc->stencilBuffer.failOp)(&gc->stencilBuffer, x, y);
  183. return;
  184. }
  185. (*gc->stencilBuffer.depthPassOp)(&gc->stencilBuffer, x, y);
  186. (*gc->procs.cfbStore)( cfb, frag );
  187. }
  188. /*
  189. ** Store fragment proc.
  190. ** alpha test off, stencil test off, depth test on
  191. */
  192. void FASTCALL __glDoStore_D(__GLcolorBuffer *cfb, const __GLfragment *frag)
  193. {
  194. __GLcontext *gc;
  195. GLint x, y;
  196. gc = cfb->buf.gc;
  197. x = frag->x;
  198. y = frag->y;
  199. /* Pixel ownership, scissor */
  200. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  201. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  202. return;
  203. }
  204. if (!(*gc->depthBuffer.store)(&gc->depthBuffer, x, y, frag->z)) {
  205. /* depth buffer test failed */
  206. return;
  207. }
  208. (*gc->procs.cfbStore)( cfb, frag );
  209. }
  210. /*
  211. ** Store fragment proc.
  212. ** alpha test off, stencil test off, depth test off, draw to current buffer
  213. */
  214. void FASTCALL __glDoStore(__GLcolorBuffer *cfb, const __GLfragment *frag)
  215. {
  216. __GLcontext *gc;
  217. GLint x, y;
  218. gc = cfb->buf.gc;
  219. x = frag->x;
  220. y = frag->y;
  221. /* Pixel ownership, scissor */
  222. if (x < gc->transform.clipX0 || y < gc->transform.clipY0 ||
  223. x >= gc->transform.clipX1 || y >= gc->transform.clipY1) {
  224. return;
  225. }
  226. (*gc->procs.cfbStore)( cfb, frag );
  227. }
  228. /************************************************************************/
  229. void FASTCALL __glDoNullStore(__GLcolorBuffer *cfb, const __GLfragment *frag)
  230. {
  231. }
  232. void FASTCALL __glDoDoubleStore(__GLcolorBuffer *cfb, const __GLfragment *frag)
  233. {
  234. __GLcontext * gc = cfb->buf.gc;
  235. cfb = gc->front;
  236. cfb->store( cfb, frag );
  237. cfb = gc->back;
  238. cfb->store( cfb, frag );
  239. }