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.

385 lines
6.8 KiB

  1. /*
  2. ** Copyright 1994, 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 "precomp.h"
  18. #pragma hdrstop
  19. #ifndef __GL_USEASMCODE
  20. /*
  21. ** this is a series of depth testers written in C
  22. */
  23. /*********************** non-masked writes ***********************/
  24. /*
  25. ** NEVER, no mask
  26. */
  27. GLboolean FASTCALL
  28. __glDT_NEVER( __GLzValue z, __GLzValue *zfb )
  29. {
  30. return GL_FALSE;
  31. }
  32. /*
  33. ** LEQUAL, no mask
  34. */
  35. GLboolean FASTCALL
  36. __glDT_LEQUAL( __GLzValue z, __GLzValue *zfb )
  37. {
  38. if( z <= *zfb ) {
  39. zfb[0] = z;
  40. return GL_TRUE;
  41. } else {
  42. return GL_FALSE;
  43. }
  44. }
  45. /*
  46. ** LESS, no mask
  47. */
  48. GLboolean FASTCALL
  49. __glDT_LESS( __GLzValue z, __GLzValue *zfb )
  50. {
  51. if( z < *zfb ) {
  52. zfb[0] = z;
  53. return GL_TRUE;
  54. } else {
  55. return GL_FALSE;
  56. }
  57. }
  58. /*
  59. ** EQUAL, no mask
  60. */
  61. GLboolean FASTCALL
  62. __glDT_EQUAL( __GLzValue z, __GLzValue *zfb )
  63. {
  64. if( z == *zfb ) {
  65. zfb[0] = z; /* why is this there? Who uses GL_EQUAL anyway? */
  66. return GL_TRUE;
  67. } else {
  68. return GL_FALSE;
  69. }
  70. }
  71. /*
  72. ** GREATER, no mask
  73. */
  74. GLboolean FASTCALL
  75. __glDT_GREATER( __GLzValue z, __GLzValue *zfb )
  76. {
  77. if( z > *zfb ) {
  78. zfb[0] = z;
  79. return GL_TRUE;
  80. } else {
  81. return GL_FALSE;
  82. }
  83. }
  84. /*
  85. ** NOTEQUAL, no mask
  86. */
  87. GLboolean FASTCALL
  88. __glDT_NOTEQUAL( __GLzValue z, __GLzValue *zfb )
  89. {
  90. if( z != *zfb ) {
  91. zfb[0] = z;
  92. return GL_TRUE;
  93. } else {
  94. return GL_FALSE;
  95. }
  96. }
  97. /*
  98. ** GEQUAL, no mask
  99. */
  100. GLboolean FASTCALL
  101. __glDT_GEQUAL( __GLzValue z, __GLzValue *zfb )
  102. {
  103. if( z >= *zfb ) {
  104. zfb[0] = z;
  105. return GL_TRUE;
  106. } else {
  107. return GL_FALSE;
  108. }
  109. }
  110. /*
  111. ** ALWAYS, no mask
  112. */
  113. GLboolean FASTCALL
  114. __glDT_ALWAYS( __GLzValue z, __GLzValue *zfb )
  115. {
  116. zfb[0] = z;
  117. return GL_TRUE;
  118. }
  119. /*********************** masked writes ***********************/
  120. /*
  121. ** LEQUAL, mask
  122. */
  123. GLboolean FASTCALL
  124. __glDT_LEQUAL_M( __GLzValue z, __GLzValue *zfb )
  125. {
  126. return (z <= *zfb);
  127. }
  128. /*
  129. ** LESS, mask
  130. */
  131. GLboolean FASTCALL
  132. __glDT_LESS_M( __GLzValue z, __GLzValue *zfb )
  133. {
  134. return (z < *zfb);
  135. }
  136. /*
  137. ** EQUAL, mask
  138. */
  139. GLboolean FASTCALL
  140. __glDT_EQUAL_M( __GLzValue z, __GLzValue *zfb )
  141. {
  142. return (z == *zfb);
  143. }
  144. /*
  145. ** GREATER, mask
  146. */
  147. GLboolean FASTCALL
  148. __glDT_GREATER_M( __GLzValue z, __GLzValue *zfb )
  149. {
  150. return (z > *zfb);
  151. }
  152. /*
  153. ** NOTEQUAL, mask
  154. */
  155. GLboolean FASTCALL
  156. __glDT_NOTEQUAL_M( __GLzValue z, __GLzValue *zfb )
  157. {
  158. return (z != *zfb);
  159. }
  160. /*
  161. ** GEQUAL, mask
  162. */
  163. GLboolean FASTCALL
  164. __glDT_GEQUAL_M( __GLzValue z, __GLzValue *zfb )
  165. {
  166. return (z >= *zfb);
  167. }
  168. /*
  169. ** ALWAYS, mask
  170. */
  171. GLboolean FASTCALL
  172. __glDT_ALWAYS_M( __GLzValue z, __GLzValue *zfb )
  173. {
  174. return GL_TRUE;
  175. }
  176. /*********************** 16-bit z versions ***********************/
  177. /*
  178. ** LEQUAL, no mask
  179. */
  180. GLboolean FASTCALL
  181. __glDT16_LEQUAL( __GLzValue z, __GLzValue *zfb )
  182. {
  183. #if 0
  184. if( (GLuint)z <= (GLuint)zbv ) {
  185. zfb[0] = z;
  186. return GL_TRUE;
  187. } else {
  188. return GL_FALSE;
  189. }
  190. #else
  191. __GLz16Value z16 = z >> Z16_SHIFT;
  192. if( z16 <= *((__GLz16Value *)zfb) ) {
  193. *((__GLz16Value *)zfb) = z16;
  194. return GL_TRUE;
  195. } else {
  196. return GL_FALSE;
  197. }
  198. #endif
  199. }
  200. /*
  201. ** LESS, no mask
  202. */
  203. GLboolean FASTCALL
  204. __glDT16_LESS( __GLzValue z, __GLzValue *zfb )
  205. {
  206. __GLz16Value z16 = z >> Z16_SHIFT;
  207. if( z16 < *((__GLz16Value *)zfb) ) {
  208. *((__GLz16Value *)zfb) = z16;
  209. return GL_TRUE;
  210. } else {
  211. return GL_FALSE;
  212. }
  213. }
  214. /*
  215. ** EQUAL, no mask
  216. */
  217. GLboolean FASTCALL
  218. __glDT16_EQUAL( __GLzValue z, __GLzValue *zfb )
  219. {
  220. __GLz16Value z16 = z >> Z16_SHIFT;
  221. if( z16 == *((__GLz16Value *)zfb) ) {
  222. *((__GLz16Value *)zfb) = z16;
  223. return GL_TRUE;
  224. } else {
  225. return GL_FALSE;
  226. }
  227. }
  228. /*
  229. ** GREATER, no mask
  230. */
  231. GLboolean FASTCALL
  232. __glDT16_GREATER( __GLzValue z, __GLzValue *zfb )
  233. {
  234. __GLz16Value z16 = z >> Z16_SHIFT;
  235. if( z16 > *((__GLz16Value *)zfb) ) {
  236. *((__GLz16Value *)zfb) = z16;
  237. return GL_TRUE;
  238. } else {
  239. return GL_FALSE;
  240. }
  241. }
  242. /*
  243. ** NOTEQUAL, no mask
  244. */
  245. GLboolean FASTCALL
  246. __glDT16_NOTEQUAL( __GLzValue z, __GLzValue *zfb )
  247. {
  248. __GLz16Value z16 = z >> Z16_SHIFT;
  249. if( z16 != *((__GLz16Value *)zfb) ) {
  250. *((__GLz16Value *)zfb) = z16;
  251. return GL_TRUE;
  252. } else {
  253. return GL_FALSE;
  254. }
  255. }
  256. /*
  257. ** GEQUAL, no mask
  258. */
  259. GLboolean FASTCALL
  260. __glDT16_GEQUAL( __GLzValue z, __GLzValue *zfb )
  261. {
  262. __GLz16Value z16 = z >> Z16_SHIFT;
  263. if( z16 >= *((__GLz16Value *)zfb) ) {
  264. *((__GLz16Value *)zfb) = z16;
  265. return GL_TRUE;
  266. } else {
  267. return GL_FALSE;
  268. }
  269. }
  270. /*
  271. ** ALWAYS, no mask
  272. */
  273. GLboolean FASTCALL
  274. __glDT16_ALWAYS( __GLzValue z, __GLzValue *zfb )
  275. {
  276. *((__GLz16Value *)zfb) = z >> Z16_SHIFT;
  277. return GL_TRUE;
  278. }
  279. /*********************** masked writes ***********************/
  280. /*
  281. ** LEQUAL, mask
  282. */
  283. GLboolean FASTCALL
  284. __glDT16_LEQUAL_M( __GLzValue z, __GLzValue *zfb )
  285. {
  286. return( (z >> Z16_SHIFT) <= *((__GLz16Value *)zfb) );
  287. }
  288. /*
  289. ** LESS, mask
  290. */
  291. GLboolean FASTCALL
  292. __glDT16_LESS_M( __GLzValue z, __GLzValue *zfb )
  293. {
  294. return( (z >> Z16_SHIFT) < *((__GLz16Value *)zfb) );
  295. }
  296. /*
  297. ** EQUAL, mask
  298. */
  299. GLboolean FASTCALL
  300. __glDT16_EQUAL_M( __GLzValue z, __GLzValue *zfb )
  301. {
  302. return( (z >> Z16_SHIFT) == *((__GLz16Value *)zfb) );
  303. }
  304. /*
  305. ** GREATER, mask
  306. */
  307. GLboolean FASTCALL
  308. __glDT16_GREATER_M( __GLzValue z, __GLzValue *zfb )
  309. {
  310. return( (z >> Z16_SHIFT) > *((__GLz16Value *)zfb) );
  311. }
  312. /*
  313. ** NOTEQUAL, mask
  314. */
  315. GLboolean FASTCALL
  316. __glDT16_NOTEQUAL_M( __GLzValue z, __GLzValue *zfb )
  317. {
  318. return( (z >> Z16_SHIFT) != *((__GLz16Value *)zfb) );
  319. }
  320. /*
  321. ** GEQUAL, mask
  322. */
  323. GLboolean FASTCALL
  324. __glDT16_GEQUAL_M( __GLzValue z, __GLzValue *zfb )
  325. {
  326. return( (z >> Z16_SHIFT) >= *((__GLz16Value *)zfb) );
  327. }
  328. /*
  329. ** ALWAYS, mask
  330. */
  331. GLboolean FASTCALL
  332. __glDT16_ALWAYS_M( __GLzValue z, __GLzValue *zfb )
  333. {
  334. return GL_TRUE;
  335. }
  336. #endif /* !__GL_USEASMCODE */