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.

1326 lines
35 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: genspan.c *
  3. * *
  4. * This module accelerates common spans. *
  5. * *
  6. * Created: 24-Feb-1994 *
  7. * Author: Otto Berkes [ottob] *
  8. * *
  9. * Copyright (c) 1994 Microsoft Corporation *
  10. \**************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. /*******************************************************/
  14. void FASTCALL __fastGenDeltaSpan(__GLcontext *gc, SPANREC *spanDelta)
  15. {
  16. GLuint modeflags = gc->polygon.shader.modeFlags;
  17. GENACCEL *pGenAccel = (GENACCEL *)(((__GLGENcontext *)gc)->pPrivateArea);
  18. if (modeflags & __GL_SHADE_RGB) {
  19. if ((modeflags & __GL_SHADE_TEXTURE) && (pGenAccel->texImage)) {
  20. if (modeflags & __GL_SHADE_SMOOTH) {
  21. pGenAccel->spanDelta.r = spanDelta->r;
  22. pGenAccel->spanDelta.g = spanDelta->g;
  23. pGenAccel->spanDelta.b = spanDelta->b;
  24. } else {
  25. pGenAccel->spanDelta.r = 0;
  26. pGenAccel->spanDelta.g = 0;
  27. pGenAccel->spanDelta.b = 0;
  28. }
  29. pGenAccel->spanDelta.s = spanDelta->s;
  30. pGenAccel->spanDelta.t = spanDelta->t;
  31. pGenAccel->__fastSpanFuncPtr = pGenAccel->__fastTexSpanFuncPtr;
  32. } else if (modeflags & __GL_SHADE_SMOOTH) {
  33. if ( ((spanDelta->r | spanDelta->g | spanDelta->b) == 0)
  34. && ((pGenAccel->flags & GEN_FASTZBUFFER) == 0)
  35. ) {
  36. pGenAccel->spanDelta.r = 0;
  37. pGenAccel->spanDelta.g = 0;
  38. pGenAccel->spanDelta.b = 0;
  39. pGenAccel->__fastSpanFuncPtr =
  40. pGenAccel->__fastFlatSpanFuncPtr;
  41. } else {
  42. pGenAccel->spanDelta.r = spanDelta->r;
  43. pGenAccel->spanDelta.g = spanDelta->g;
  44. pGenAccel->spanDelta.b = spanDelta->b;
  45. pGenAccel->__fastSpanFuncPtr =
  46. pGenAccel->__fastSmoothSpanFuncPtr;
  47. }
  48. } else {
  49. pGenAccel->__fastSpanFuncPtr = pGenAccel->__fastFlatSpanFuncPtr;
  50. }
  51. } else {
  52. if (modeflags & __GL_SHADE_SMOOTH) {
  53. if (spanDelta->r == 0) {
  54. pGenAccel->spanDelta.r = 0;
  55. pGenAccel->__fastSpanFuncPtr =
  56. pGenAccel->__fastFlatSpanFuncPtr;
  57. } else {
  58. pGenAccel->spanDelta.r = spanDelta->r;
  59. pGenAccel->__fastSpanFuncPtr =
  60. pGenAccel->__fastSmoothSpanFuncPtr;
  61. }
  62. } else {
  63. pGenAccel->__fastSpanFuncPtr = pGenAccel->__fastFlatSpanFuncPtr;
  64. }
  65. }
  66. #ifdef LATER
  67. pGenAccel->spanDelta.r = spanDelta->r;
  68. pGenAccel->spanDelta.g = spanDelta->g;
  69. pGenAccel->spanDelta.b = spanDelta->b;
  70. pGenAccel->spanDelta.s = spanDelta->s;
  71. pGenAccel->spanDelta.t = spanDelta->t;
  72. if ( modeflags & (__GL_SHADE_RGB | __GL_SHADE_TEXTURE | __GL_SHADE_SMOOTH) ==
  73. __GL_SHADE_RGB | __GL_SHADE_TEXTURE
  74. ) {
  75. pGenAccel->spanDelta.r = 0;
  76. pGenAccel->spanDelta.g = 0;
  77. pGenAccel->spanDelta.b = 0;
  78. } else
  79. if ( modeflags & (__GL_SHADE_RGB | __GL_SHADE_TEXTURE | __GL_SHADE_SMOOTH) ==
  80. __GL_SHADE_RGB | __GL_SHADE_SMOOTH
  81. ) {
  82. if ((spanDelta->r | spanDelta->g | spanDelta->b) == 0) {
  83. pGenAccel->__fastSpanFuncPtr =
  84. pGenAccel->__fastFlatSpanFuncPtr;
  85. } else {
  86. pGenAccel->__fastSpanFuncPtr =
  87. pGenAccel->__fastSmoothSpanFuncPtr;
  88. }
  89. }
  90. #endif
  91. }
  92. /*******************************************************/
  93. #define ZBUF_PROC(type, pass_cond) \
  94. GLboolean FASTCALL __fastGenDepthTestSpan##type(__GLcontext *gc)\
  95. {\
  96. register GLuint zAccum = gc->polygon.shader.frag.z;\
  97. register GLint zDelta = gc->polygon.shader.dzdx;\
  98. register GLuint *zbuf = gc->polygon.shader.zbuf;\
  99. register GLuint *pStipple = gc->polygon.shader.stipplePat;\
  100. register GLint cTotalPix = gc->polygon.shader.length;\
  101. register GLuint mask;\
  102. register GLint cPix;\
  103. register GLint zPasses = 0;\
  104. register GLuint maskBit;\
  105. \
  106. for (;cTotalPix > 0; cTotalPix-=32) {\
  107. mask = 0;\
  108. maskBit = 0x80000000;\
  109. cPix = cTotalPix;\
  110. if (cPix > 32)\
  111. cPix = 32;\
  112. \
  113. for (;cPix > 0; cPix --) {\
  114. if ((zAccum) pass_cond (*zbuf)) {\
  115. *zbuf = zAccum;\
  116. zPasses++;\
  117. mask |= maskBit;\
  118. }\
  119. *zbuf++;\
  120. zAccum += zDelta;\
  121. maskBit >>= 1;\
  122. }\
  123. \
  124. *pStipple++ = mask;\
  125. }\
  126. \
  127. if (zPasses == 0) {\
  128. gc->polygon.shader.done = TRUE;\
  129. return 1;\
  130. } else if (zPasses == gc->polygon.shader.length) {\
  131. return 0;\
  132. } else {\
  133. return 2;\
  134. }\
  135. }
  136. #define ZBUF16_PROC(type, pass_cond) \
  137. GLboolean FASTCALL __fastGenDepth16TestSpan##type(__GLcontext *gc)\
  138. {\
  139. register GLuint zAccum = gc->polygon.shader.frag.z;\
  140. register __GLz16Value z16Accum = (__GLz16Value) (zAccum >> Z16_SHIFT); \
  141. register GLint zDelta = gc->polygon.shader.dzdx;\
  142. register __GLz16Value *zbuf = (__GLz16Value *) (gc->polygon.shader.zbuf);\
  143. register GLuint *pStipple = gc->polygon.shader.stipplePat;\
  144. register GLint cTotalPix = gc->polygon.shader.length;\
  145. register GLuint mask;\
  146. register GLint cPix;\
  147. register GLint zPasses = 0;\
  148. register GLuint maskBit;\
  149. \
  150. for (;cTotalPix > 0; cTotalPix-=32) {\
  151. mask = 0;\
  152. maskBit = 0x80000000;\
  153. cPix = cTotalPix;\
  154. if (cPix > 32)\
  155. cPix = 32;\
  156. \
  157. for (;cPix > 0; cPix --) {\
  158. if (((__GLz16Value)(zAccum >> Z16_SHIFT)) pass_cond (*zbuf)) {\
  159. *zbuf = ((__GLz16Value)(zAccum >> Z16_SHIFT));\
  160. zPasses++;\
  161. mask |= maskBit;\
  162. }\
  163. *zbuf++;\
  164. zAccum += zDelta;\
  165. maskBit >>= 1;\
  166. }\
  167. \
  168. *pStipple++ = mask;\
  169. }\
  170. \
  171. if (zPasses == 0) {\
  172. gc->polygon.shader.done = TRUE;\
  173. return 1;\
  174. } else if (zPasses == gc->polygon.shader.length) {\
  175. return 0;\
  176. } else {\
  177. return 2;\
  178. }\
  179. }
  180. ZBUF_PROC(LT, <);
  181. ZBUF_PROC(EQ, ==);
  182. ZBUF_PROC(LE, <=);
  183. ZBUF_PROC(GT, >);
  184. ZBUF_PROC(NE, !=);
  185. ZBUF_PROC(GE, >=);
  186. ZBUF_PROC(ALWAYS, || TRUE ||);
  187. GLboolean FASTCALL __fastGenDepthTestSpanNEVER(__GLcontext *gc)
  188. {
  189. return FALSE;
  190. }
  191. ZBUF16_PROC(LT, <);
  192. ZBUF16_PROC(EQ, ==);
  193. ZBUF16_PROC(LE, <=);
  194. ZBUF16_PROC(GT, >);
  195. ZBUF16_PROC(NE, !=);
  196. ZBUF16_PROC(GE, >=);
  197. ZBUF16_PROC(ALWAYS, || TRUE ||);
  198. /*******************************************************/
  199. __GLspanFunc __fastDepthFuncs[] =
  200. {__fastGenDepthTestSpanNEVER,
  201. __fastGenDepthTestSpanLT,
  202. __fastGenDepthTestSpanEQ,
  203. __fastGenDepthTestSpanLE,
  204. __fastGenDepthTestSpanGT,
  205. __fastGenDepthTestSpanNE,
  206. __fastGenDepthTestSpanGE,
  207. __fastGenDepthTestSpanALWAYS
  208. };
  209. __GLspanFunc __fastDepth16Funcs[] =
  210. {__fastGenDepthTestSpanNEVER,
  211. __fastGenDepth16TestSpanLT,
  212. __fastGenDepth16TestSpanEQ,
  213. __fastGenDepth16TestSpanLE,
  214. __fastGenDepth16TestSpanGT,
  215. __fastGenDepth16TestSpanNE,
  216. __fastGenDepth16TestSpanGE,
  217. __fastGenDepth16TestSpanALWAYS
  218. };
  219. /*******************************************************/
  220. DWORD ditherShade[32] = {
  221. 0x0800,
  222. 0x8800,
  223. 0x2800,
  224. 0xa800,
  225. 0x0800,
  226. 0x8800,
  227. 0x2800,
  228. 0xa800,
  229. 0xc800,
  230. 0x4800,
  231. 0xe800,
  232. 0x6800,
  233. 0xc800,
  234. 0x4800,
  235. 0xe800,
  236. 0x6800,
  237. 0x3800,
  238. 0xb800,
  239. 0x1800,
  240. 0x9800,
  241. 0x3800,
  242. 0xb800,
  243. 0x1800,
  244. 0x9800,
  245. 0xf800,
  246. 0x7800,
  247. 0xd800,
  248. 0x5800,
  249. 0xf800,
  250. 0x7800,
  251. 0xd800,
  252. 0x5800,
  253. };
  254. DWORD ditherTexture[32] = {
  255. 0x08,
  256. 0x88,
  257. 0x28,
  258. 0xa8,
  259. 0x08,
  260. 0x88,
  261. 0x28,
  262. 0xa8,
  263. 0xc8,
  264. 0x48,
  265. 0xe8,
  266. 0x68,
  267. 0xc8,
  268. 0x48,
  269. 0xe8,
  270. 0x68,
  271. 0x38,
  272. 0xb8,
  273. 0x18,
  274. 0x98,
  275. 0x38,
  276. 0xb8,
  277. 0x18,
  278. 0x98,
  279. 0xf8,
  280. 0x78,
  281. 0xd8,
  282. 0x58,
  283. 0xf8,
  284. 0x78,
  285. 0xd8,
  286. 0x58,
  287. };
  288. static ULONG Dither_4x4[4] = {0xa8288808, 0x68e848c8, 0x9818b838, 0x58d878f8};
  289. /*******************************************************/
  290. #define STRCAT4R(s1, s2, s3, s4) s1 ## s2 ## s3 ## s4
  291. #define STRCAT4(s1, s2, s3, s4) STRCAT4R(s1, s2, s3, s4)
  292. #define STRCAT3R(s1, s2, s3) s1 ## s2 ## s3
  293. #define STRCAT3(s1, s2, s3) STRCAT3R(s1, s2, s3)
  294. #define STRCAT2R(s1, s2) s1 ## s2
  295. #define STRCAT2(s1, s2) STRCAT2R(s1, s2)
  296. /*******************************************************/
  297. //
  298. // create the generic span routine
  299. //
  300. #define GENERIC 1
  301. #define ZBUFFER 1
  302. #define RGBMODE 1
  303. #define SHADE 1
  304. #define DITHER 1
  305. #define TEXTURE 1
  306. #define BPP bpp
  307. #include "span.h"
  308. #undef GENERIC
  309. #define GENERIC 0
  310. /*******************************************************/
  311. //
  312. // now create the special case span routines
  313. //
  314. //
  315. // first modes that are dithered
  316. //
  317. #undef DITHER
  318. #define DITHER 1
  319. /*******************************************************/
  320. #undef COLORFORMAT
  321. #define COLORFORMAT 332
  322. #undef BPP
  323. #define BPP 8
  324. #undef RSHIFT
  325. #undef GSHIFT
  326. #undef BSHIFT
  327. #undef RBITS
  328. #undef GBITS
  329. #undef BBITS
  330. #define RSHIFT 0
  331. #define GSHIFT 3
  332. #define BSHIFT 6
  333. #define RBITS 3
  334. #define GBITS 3
  335. #define BBITS 2
  336. #include "spanset.h"
  337. /*******************************************************/
  338. #undef COLORFORMAT
  339. #define COLORFORMAT 555
  340. #undef BPP
  341. #define BPP 16
  342. #undef RSHIFT
  343. #undef GSHIFT
  344. #undef BSHIFT
  345. #undef RBITS
  346. #undef GBITS
  347. #undef BBITS
  348. #define RSHIFT 10
  349. #define GSHIFT 5
  350. #define BSHIFT 0
  351. #define RBITS 5
  352. #define GBITS 5
  353. #define BBITS 5
  354. #include "spanset.h"
  355. /*******************************************************/
  356. #undef COLORFORMAT
  357. #define COLORFORMAT 565
  358. #undef BPP
  359. #define BPP 16
  360. #undef RSHIFT
  361. #undef GSHIFT
  362. #undef BSHIFT
  363. #undef RBITS
  364. #undef GBITS
  365. #undef BBITS
  366. #define RSHIFT 11
  367. #define GSHIFT 5
  368. #define BSHIFT 0
  369. #define RBITS 5
  370. #define GBITS 6
  371. #define BBITS 5
  372. #include "spanset.h"
  373. /*******************************************************/
  374. //
  375. // undithered modes
  376. //
  377. #undef DITHER
  378. #define DITHER 0
  379. /*******************************************************/
  380. #undef COLORFORMAT
  381. #define COLORFORMAT 24
  382. #undef BPP
  383. #define BPP 24
  384. #undef RSHIFT
  385. #undef GSHIFT
  386. #undef BSHIFT
  387. #undef RBITS
  388. #undef GBITS
  389. #undef BBITS
  390. #define RSHIFT 16
  391. #define GSHIFT 8
  392. #define BSHIFT 0
  393. #define RBITS 8
  394. #define GBITS 8
  395. #define BBITS 8
  396. #include "spanset.h"
  397. /*******************************************************/
  398. #undef COLORFORMAT
  399. #define COLORFORMAT 32
  400. #undef BPP
  401. #define BPP 32
  402. #undef RSHIFT
  403. #undef GSHIFT
  404. #undef BSHIFT
  405. #undef RBITS
  406. #undef GBITS
  407. #undef BBITS
  408. #define RSHIFT 16
  409. #define GSHIFT 8
  410. #define BSHIFT 0
  411. #define RBITS 8
  412. #define GBITS 8
  413. #define BBITS 8
  414. #include "spanset.h"
  415. /*******************************************************/
  416. #ifndef _X86_
  417. //
  418. // Create span routines for perspective-corrected textures
  419. //
  420. #undef BPP
  421. #undef RSHIFT
  422. #undef GSHIFT
  423. #undef BSHIFT
  424. #undef RBITS
  425. #undef GBITS
  426. #undef BBITS
  427. #define RSHIFT 0
  428. #define GSHIFT 3
  429. #define BSHIFT 6
  430. #define RBITS 3
  431. #define GBITS 3
  432. #define BBITS 2
  433. #define BPP 8
  434. #define FAST_REPLACE 1
  435. #include "texspans.h"
  436. #undef FAST_REPLACE
  437. #define SKIP_FAST_REPLACE 1
  438. #define REPLACE 1
  439. #include "texspans.h"
  440. #undef REPLACE
  441. #undef SKIP_FAST_REPLACE
  442. #define FAST_REPLACE 1
  443. #define PALETTE_ONLY 1
  444. #include "texspans.h"
  445. #undef FAST_REPLACE
  446. #undef PALETTE_ONLY
  447. #define PALETTE_ENABLED 1
  448. #define FLAT_SHADING 1
  449. #include "texspans.h"
  450. #undef FLAT_SHADING
  451. #define SMOOTH_SHADING 1
  452. #include "texspans.h"
  453. #undef SMOOTH_SHADING
  454. #undef PALETTE_ENABLED
  455. #undef BPP
  456. #undef RSHIFT
  457. #undef GSHIFT
  458. #undef BSHIFT
  459. #undef RBITS
  460. #undef GBITS
  461. #undef BBITS
  462. #define RSHIFT 10
  463. #define GSHIFT 5
  464. #define BSHIFT 0
  465. #define RBITS 5
  466. #define GBITS 5
  467. #define BBITS 5
  468. #define BPP 16
  469. #define SKIP_FAST_REPLACE 1
  470. #define REPLACE 1
  471. #include "texspans.h"
  472. #undef REPLACE
  473. #undef SKIP_FAST_REPLACE
  474. #define SKIP_FAST_REPLACE 1 // only need routines for alpha modes, since
  475. #define FAST_REPLACE 1 // replace is identical otherwise with 565
  476. #define PALETTE_ONLY 1
  477. #include "texspans.h"
  478. #undef FAST_REPLACE
  479. #undef PALETTE_ONLY
  480. #undef SKIP_FAST_REPLACE
  481. #define PALETTE_ENABLED 1
  482. #define FLAT_SHADING 1
  483. #include "texspans.h"
  484. #undef FLAT_SHADING
  485. #define SMOOTH_SHADING 1
  486. #include "texspans.h"
  487. #undef SMOOTH_SHADING
  488. #undef PALETTE_ENABLED
  489. #undef BPP
  490. #undef RSHIFT
  491. #undef GSHIFT
  492. #undef BSHIFT
  493. #undef RBITS
  494. #undef GBITS
  495. #undef BBITS
  496. #define RSHIFT 11
  497. #define GSHIFT 5
  498. #define BSHIFT 0
  499. #define RBITS 5
  500. #define GBITS 6
  501. #define BBITS 5
  502. #define BPP 16
  503. #define FAST_REPLACE 1
  504. #include "texspans.h"
  505. #undef FAST_REPLACE
  506. #define SKIP_FAST_REPLACE 1
  507. #define REPLACE 1
  508. #include "texspans.h"
  509. #undef REPLACE
  510. #undef SKIP_FAST_REPLACE
  511. #define FAST_REPLACE 1
  512. #define PALETTE_ONLY 1
  513. #include "texspans.h"
  514. #undef FAST_REPLACE
  515. #undef PALETTE_ONLY
  516. #define PALETTE_ENABLED 1
  517. #define FLAT_SHADING 1
  518. #include "texspans.h"
  519. #undef FLAT_SHADING
  520. #define SMOOTH_SHADING 1
  521. #include "texspans.h"
  522. #undef SMOOTH_SHADING
  523. #undef PALETTE_ENABLED
  524. #undef BPP
  525. #undef RSHIFT
  526. #undef GSHIFT
  527. #undef BSHIFT
  528. #undef RBITS
  529. #undef GBITS
  530. #undef BBITS
  531. #define RSHIFT 16
  532. #define GSHIFT 8
  533. #define BSHIFT 0
  534. #define RBITS 8
  535. #define GBITS 8
  536. #define BBITS 8
  537. #define BPP 32
  538. #define REPLACE 1
  539. #include "texspans.h"
  540. #undef REPLACE
  541. #define REPLACE 1
  542. #define PALETTE_ONLY 1
  543. #include "texspans.h"
  544. #undef REPLACE
  545. #undef PALETTE_ONLY
  546. #define PALETTE_ENABLED 1
  547. #define FLAT_SHADING 1
  548. #include "texspans.h"
  549. #undef FLAT_SHADING
  550. #define SMOOTH_SHADING 1
  551. #include "texspans.h"
  552. #undef SMOOTH_SHADING
  553. #undef PALETTE_ENABLED
  554. #endif // _X86_
  555. /*******************************************************/
  556. //
  557. // finally color index and flat spans
  558. //
  559. #undef TEXTURE
  560. #undef SHADE
  561. #undef RSHIFT
  562. #undef GSHIFT
  563. #undef BSHIFT
  564. /*******************************************************/
  565. #undef COLORFORMAT
  566. #define COLORFORMAT 8
  567. #undef BPP
  568. #define BPP 8
  569. #include "spanci.h"
  570. /*******************************************************/
  571. #undef COLORFORMAT
  572. #define COLORFORMAT 16
  573. #undef BPP
  574. #define BPP 16
  575. #include "spanci.h"
  576. /*******************************************************/
  577. #undef COLORFORMAT
  578. #define COLORFORMAT 24
  579. #undef BPP
  580. #define BPP 24
  581. #include "spanci.h"
  582. /*******************************************************/
  583. #undef COLORFORMAT
  584. #define COLORFORMAT 32
  585. #undef BPP
  586. #define BPP 32
  587. #include "spanci.h"
  588. /*******************************************************/
  589. __genSpanFunc __fastGenRGBFlatFuncs[] =
  590. {
  591. __fastGenRGB24FlatSpan,
  592. __fastGenRGB32FlatSpan,
  593. __fastGenRGB8FlatSpan,
  594. __fastGenRGB16FlatSpan,
  595. __fastGenRGB16FlatSpan,
  596. __fastGenRGB24FlatSpan,
  597. __fastGenRGB32FlatSpan,
  598. __fastGenRGB8DithFlatSpan,
  599. __fastGenRGB16DithFlatSpan,
  600. __fastGenRGB16DithFlatSpan,
  601. __fastGenMaskRGB24FlatSpan,
  602. __fastGenMaskRGB32FlatSpan,
  603. __fastGenMaskRGB8FlatSpan,
  604. __fastGenMaskRGB16FlatSpan,
  605. __fastGenMaskRGB16FlatSpan,
  606. __fastGenMaskRGB24FlatSpan,
  607. __fastGenMaskRGB32FlatSpan,
  608. __fastGenMaskRGB8DithFlatSpan,
  609. __fastGenMaskRGB16DithFlatSpan,
  610. __fastGenMaskRGB16DithFlatSpan,
  611. };
  612. __genSpanFunc __fastGenCIFlatFuncs[] =
  613. {
  614. __fastGenCI24FlatSpan,
  615. __fastGenCI32FlatSpan,
  616. __fastGenCI8FlatSpan,
  617. __fastGenCI16FlatSpan,
  618. __fastGenCI16FlatSpan,
  619. __fastGenCI24DithFlatSpan,
  620. __fastGenCI32DithFlatSpan,
  621. __fastGenCI8DithFlatSpan,
  622. __fastGenCI16DithFlatSpan,
  623. __fastGenCI16DithFlatSpan,
  624. __fastGenMaskCI24FlatSpan,
  625. __fastGenMaskCI32FlatSpan,
  626. __fastGenMaskCI8FlatSpan,
  627. __fastGenMaskCI16FlatSpan,
  628. __fastGenMaskCI16FlatSpan,
  629. __fastGenMaskCI24DithFlatSpan,
  630. __fastGenMaskCI32DithFlatSpan,
  631. __fastGenMaskCI8DithFlatSpan,
  632. __fastGenMaskCI16DithFlatSpan,
  633. __fastGenMaskCI16DithFlatSpan,
  634. };
  635. __genSpanFunc __fastGenCIFuncs[] =
  636. {
  637. __fastGenCI24Span,
  638. __fastGenCI32Span,
  639. __fastGenCI8Span,
  640. __fastGenCI16Span,
  641. __fastGenCI16Span,
  642. __fastGenCI24DithSpan,
  643. __fastGenCI32DithSpan,
  644. __fastGenCI8DithSpan,
  645. __fastGenCI16DithSpan,
  646. __fastGenCI16DithSpan,
  647. __fastGenMaskCI24Span,
  648. __fastGenMaskCI32Span,
  649. __fastGenMaskCI8Span,
  650. __fastGenMaskCI16Span,
  651. __fastGenMaskCI16Span,
  652. __fastGenMaskCI24DithSpan,
  653. __fastGenMaskCI32DithSpan,
  654. __fastGenMaskCI8DithSpan,
  655. __fastGenMaskCI16DithSpan,
  656. __fastGenMaskCI16DithSpan,
  657. };
  658. __genSpanFunc __fastGenRGBFuncs[] =
  659. {
  660. __fastGenRGB24Span,
  661. __fastGenRGB32Span,
  662. __fastGenSpan,
  663. __fastGenSpan,
  664. __fastGenSpan,
  665. __fastGenRGB24Span,
  666. __fastGenRGB32Span,
  667. __fastGenRGB332DithSpan,
  668. __fastGenRGB555DithSpan,
  669. __fastGenRGB565DithSpan,
  670. __fastGenMaskRGB24Span,
  671. __fastGenMaskRGB32Span,
  672. __fastGenSpan,
  673. __fastGenSpan,
  674. __fastGenSpan,
  675. __fastGenMaskRGB24Span,
  676. __fastGenMaskRGB32Span,
  677. __fastGenMaskRGB332DithSpan,
  678. __fastGenMaskRGB555DithSpan,
  679. __fastGenMaskRGB565DithSpan,
  680. };
  681. __genSpanFunc __fastGenTexDecalFuncs[] =
  682. {
  683. __fastGenTexDecal24Span,
  684. __fastGenTexDecal32Span,
  685. __fastGenSpan,
  686. __fastGenSpan,
  687. __fastGenSpan,
  688. __fastGenTexDecal24Span,
  689. __fastGenTexDecal32Span,
  690. __fastGenTexDecal332DithSpan,
  691. __fastGenTexDecal555DithSpan,
  692. __fastGenTexDecal565DithSpan,
  693. __fastGenMaskTexDecal24Span,
  694. __fastGenMaskTexDecal32Span,
  695. __fastGenSpan,
  696. __fastGenSpan,
  697. __fastGenSpan,
  698. __fastGenMaskTexDecal24Span,
  699. __fastGenMaskTexDecal32Span,
  700. __fastGenMaskTexDecal332DithSpan,
  701. __fastGenMaskTexDecal555DithSpan,
  702. __fastGenMaskTexDecal565DithSpan,
  703. };
  704. __genSpanFunc __fastGenTexFuncs[] =
  705. {
  706. __fastGenTex24Span,
  707. __fastGenTex32Span,
  708. __fastGenSpan,
  709. __fastGenSpan,
  710. __fastGenSpan,
  711. __fastGenTex24Span,
  712. __fastGenTex32Span,
  713. __fastGenTex332DithSpan,
  714. __fastGenTex555DithSpan,
  715. __fastGenTex565DithSpan,
  716. __fastGenMaskTex24Span,
  717. __fastGenMaskTex32Span,
  718. __fastGenSpan,
  719. __fastGenSpan,
  720. __fastGenSpan,
  721. __fastGenMaskTex24Span,
  722. __fastGenMaskTex32Span,
  723. __fastGenMaskTex332DithSpan,
  724. __fastGenMaskTex555DithSpan,
  725. __fastGenMaskTex565DithSpan,
  726. };
  727. void FASTCALL __fastFastPerspReplace332(__GLGENcontext *gc);
  728. void FASTCALL __fastFastPerspReplaceZle332(__GLGENcontext *gc);
  729. void FASTCALL __fastFastPerspReplaceZlt332(__GLGENcontext *gc);
  730. // Note the the compressed 555 and 565 formats are equivalent, so
  731. // we'll just use the 565 version:
  732. void FASTCALL __fastFastPerspReplace565(__GLGENcontext *gc);
  733. void FASTCALL __fastFastPerspReplaceZle565(__GLGENcontext *gc);
  734. void FASTCALL __fastFastPerspReplaceZlt565(__GLGENcontext *gc);
  735. //----------------------------------------------------------------------
  736. void FASTCALL __fastPerspReplace332(__GLGENcontext *gc);
  737. void FASTCALL __fastPerspReplaceZle332(__GLGENcontext *gc);
  738. void FASTCALL __fastPerspReplaceZlt332(__GLGENcontext *gc);
  739. void FASTCALL __fastPerspReplaceAlpha332(__GLGENcontext *gc);
  740. void FASTCALL __fastPerspReplaceAlphaZle332(__GLGENcontext *gc);
  741. void FASTCALL __fastPerspReplaceAlphaZlt332(__GLGENcontext *gc);
  742. void FASTCALL __fastPerspReplace555(__GLGENcontext *gc);
  743. void FASTCALL __fastPerspReplaceZle555(__GLGENcontext *gc);
  744. void FASTCALL __fastPerspReplaceZlt555(__GLGENcontext *gc);
  745. void FASTCALL __fastPerspReplaceAlpha555(__GLGENcontext *gc);
  746. void FASTCALL __fastPerspReplaceAlphaZle555(__GLGENcontext *gc);
  747. void FASTCALL __fastPerspReplaceAlphaZlt555(__GLGENcontext *gc);
  748. void FASTCALL __fastPerspReplace565(__GLGENcontext *gc);
  749. void FASTCALL __fastPerspReplaceZle565(__GLGENcontext *gc);
  750. void FASTCALL __fastPerspReplaceZlt565(__GLGENcontext *gc);
  751. void FASTCALL __fastPerspReplaceAlpha565(__GLGENcontext *gc);
  752. void FASTCALL __fastPerspReplaceAlphaZle565(__GLGENcontext *gc);
  753. void FASTCALL __fastPerspReplaceAlphaZlt565(__GLGENcontext *gc);
  754. void FASTCALL __fastPerspReplace888(__GLGENcontext *gc);
  755. void FASTCALL __fastPerspReplaceZle888(__GLGENcontext *gc);
  756. void FASTCALL __fastPerspReplaceZlt888(__GLGENcontext *gc);
  757. void FASTCALL __fastPerspReplaceAlpha888(__GLGENcontext *gc);
  758. void FASTCALL __fastPerspReplaceAlphaZle888(__GLGENcontext *gc);
  759. void FASTCALL __fastPerspReplaceAlphaZlt888(__GLGENcontext *gc);
  760. //----------------------------------------------------------------------
  761. void FASTCALL __fastFastPerspPalReplace332(__GLGENcontext *gc);
  762. void FASTCALL __fastFastPerspPalReplaceZle332(__GLGENcontext *gc);
  763. void FASTCALL __fastFastPerspPalReplaceZlt332(__GLGENcontext *gc);
  764. void FASTCALL __fastFastPerspPalReplaceAlpha332(__GLGENcontext *gc);
  765. void FASTCALL __fastFastPerspPalReplaceAlphaZle332(__GLGENcontext *gc);
  766. void FASTCALL __fastFastPerspPalReplaceAlphaZlt332(__GLGENcontext *gc);
  767. // Note the the compressed 555 and 565 formats are equivalent, so
  768. // we'll just use the 565 version:
  769. void FASTCALL __fastFastPerspPalReplace565(__GLGENcontext *gc);
  770. void FASTCALL __fastFastPerspPalReplaceZle565(__GLGENcontext *gc);
  771. void FASTCALL __fastFastPerspPalReplaceZlt565(__GLGENcontext *gc);
  772. // With alpha, we have to provode pixel-format-specific code for 555 and
  773. // 565, since there is a potential read-modify-write for which we will
  774. // have to deal with the pixel format...
  775. void FASTCALL __fastFastPerspPalReplaceAlpha555(__GLGENcontext *gc);
  776. void FASTCALL __fastFastPerspPalReplaceAlphaZle555(__GLGENcontext *gc);
  777. void FASTCALL __fastFastPerspPalReplaceAlphaZlt555(__GLGENcontext *gc);
  778. void FASTCALL __fastFastPerspPalReplaceAlpha565(__GLGENcontext *gc);
  779. void FASTCALL __fastFastPerspPalReplaceAlphaZle565(__GLGENcontext *gc);
  780. void FASTCALL __fastFastPerspPalReplaceAlphaZlt565(__GLGENcontext *gc);
  781. void FASTCALL __fastPerspPalReplace332(__GLGENcontext *gc);
  782. void FASTCALL __fastPerspPalReplaceZle332(__GLGENcontext *gc);
  783. void FASTCALL __fastPerspPalReplaceZlt332(__GLGENcontext *gc);
  784. void FASTCALL __fastPerspPalReplaceAlpha332(__GLGENcontext *gc);
  785. void FASTCALL __fastPerspPalReplaceAlphaZle332(__GLGENcontext *gc);
  786. void FASTCALL __fastPerspPalReplaceAlphaZlt332(__GLGENcontext *gc);
  787. void FASTCALL __fastPerspPalReplace555(__GLGENcontext *gc);
  788. void FASTCALL __fastPerspPalReplaceZle555(__GLGENcontext *gc);
  789. void FASTCALL __fastPerspPalReplaceZlt555(__GLGENcontext *gc);
  790. void FASTCALL __fastPerspPalReplaceAlpha555(__GLGENcontext *gc);
  791. void FASTCALL __fastPerspPalReplaceAlphaZle555(__GLGENcontext *gc);
  792. void FASTCALL __fastPerspPalReplaceAlphaZlt555(__GLGENcontext *gc);
  793. void FASTCALL __fastPerspPalReplace565(__GLGENcontext *gc);
  794. void FASTCALL __fastPerspPalReplaceZle565(__GLGENcontext *gc);
  795. void FASTCALL __fastPerspPalReplaceZlt565(__GLGENcontext *gc);
  796. void FASTCALL __fastPerspPalReplaceAlpha565(__GLGENcontext *gc);
  797. void FASTCALL __fastPerspPalReplaceAlphaZle565(__GLGENcontext *gc);
  798. void FASTCALL __fastPerspPalReplaceAlphaZlt565(__GLGENcontext *gc);
  799. void FASTCALL __fastPerspPalReplace888(__GLGENcontext *gc);
  800. void FASTCALL __fastPerspPalReplaceZle888(__GLGENcontext *gc);
  801. void FASTCALL __fastPerspPalReplaceZlt888(__GLGENcontext *gc);
  802. void FASTCALL __fastPerspPalReplaceAlpha888(__GLGENcontext *gc);
  803. void FASTCALL __fastPerspPalReplaceAlphaZle888(__GLGENcontext *gc);
  804. void FASTCALL __fastPerspPalReplaceAlphaZlt888(__GLGENcontext *gc);
  805. //----------------------------------------------------------------------
  806. void FASTCALL __fastPerspFlat332(__GLGENcontext *gc);
  807. void FASTCALL __fastPerspFlatZle332(__GLGENcontext *gc);
  808. void FASTCALL __fastPerspFlatZlt332(__GLGENcontext *gc);
  809. void FASTCALL __fastPerspFlatAlpha332(__GLGENcontext *gc);
  810. void FASTCALL __fastPerspFlatAlphaZle332(__GLGENcontext *gc);
  811. void FASTCALL __fastPerspFlatAlphaZlt332(__GLGENcontext *gc);
  812. void FASTCALL __fastPerspFlat555(__GLGENcontext *gc);
  813. void FASTCALL __fastPerspFlatZle555(__GLGENcontext *gc);
  814. void FASTCALL __fastPerspFlatZlt555(__GLGENcontext *gc);
  815. void FASTCALL __fastPerspFlatAlpha555(__GLGENcontext *gc);
  816. void FASTCALL __fastPerspFlatAlphaZle555(__GLGENcontext *gc);
  817. void FASTCALL __fastPerspFlatAlphaZlt555(__GLGENcontext *gc);
  818. void FASTCALL __fastPerspFlat565(__GLGENcontext *gc);
  819. void FASTCALL __fastPerspFlatZle565(__GLGENcontext *gc);
  820. void FASTCALL __fastPerspFlatZlt565(__GLGENcontext *gc);
  821. void FASTCALL __fastPerspFlatAlpha565(__GLGENcontext *gc);
  822. void FASTCALL __fastPerspFlatAlphaZle565(__GLGENcontext *gc);
  823. void FASTCALL __fastPerspFlatAlphaZlt565(__GLGENcontext *gc);
  824. void FASTCALL __fastPerspFlat888(__GLGENcontext *gc);
  825. void FASTCALL __fastPerspFlatZle888(__GLGENcontext *gc);
  826. void FASTCALL __fastPerspFlatZlt888(__GLGENcontext *gc);
  827. void FASTCALL __fastPerspFlatAlpha888(__GLGENcontext *gc);
  828. void FASTCALL __fastPerspFlatAlphaZle888(__GLGENcontext *gc);
  829. void FASTCALL __fastPerspFlatAlphaZlt888(__GLGENcontext *gc);
  830. //----------------------------------------------------------------------
  831. void FASTCALL __fastPerspSmooth332(__GLGENcontext *gc);
  832. void FASTCALL __fastPerspSmoothZle332(__GLGENcontext *gc);
  833. void FASTCALL __fastPerspSmoothZlt332(__GLGENcontext *gc);
  834. void FASTCALL __fastPerspSmoothAlpha332(__GLGENcontext *gc);
  835. void FASTCALL __fastPerspSmoothAlphaZle332(__GLGENcontext *gc);
  836. void FASTCALL __fastPerspSmoothAlphaZlt332(__GLGENcontext *gc);
  837. void FASTCALL __fastPerspSmooth555(__GLGENcontext *gc);
  838. void FASTCALL __fastPerspSmoothZle555(__GLGENcontext *gc);
  839. void FASTCALL __fastPerspSmoothZlt555(__GLGENcontext *gc);
  840. void FASTCALL __fastPerspSmoothAlpha555(__GLGENcontext *gc);
  841. void FASTCALL __fastPerspSmoothAlphaZle555(__GLGENcontext *gc);
  842. void FASTCALL __fastPerspSmoothAlphaZlt555(__GLGENcontext *gc);
  843. void FASTCALL __fastPerspSmooth565(__GLGENcontext *gc);
  844. void FASTCALL __fastPerspSmoothZle565(__GLGENcontext *gc);
  845. void FASTCALL __fastPerspSmoothZlt565(__GLGENcontext *gc);
  846. void FASTCALL __fastPerspSmoothAlpha565(__GLGENcontext *gc);
  847. void FASTCALL __fastPerspSmoothAlphaZle565(__GLGENcontext *gc);
  848. void FASTCALL __fastPerspSmoothAlphaZlt565(__GLGENcontext *gc);
  849. void FASTCALL __fastPerspSmooth888(__GLGENcontext *gc);
  850. void FASTCALL __fastPerspSmoothZle888(__GLGENcontext *gc);
  851. void FASTCALL __fastPerspSmoothZlt888(__GLGENcontext *gc);
  852. void FASTCALL __fastPerspSmoothAlpha888(__GLGENcontext *gc);
  853. void FASTCALL __fastPerspSmoothAlphaZle888(__GLGENcontext *gc);
  854. void FASTCALL __fastPerspSmoothAlphaZlt888(__GLGENcontext *gc);
  855. __genSpanFunc __fastPerspTexReplaceFuncs[] = {
  856. __fastFastPerspReplace332,
  857. __fastFastPerspReplaceZle332,
  858. __fastFastPerspReplaceZlt332,
  859. __fastPerspReplaceAlpha332,
  860. __fastPerspReplaceAlphaZle332,
  861. __fastPerspReplaceAlphaZlt332,
  862. __fastFastPerspReplace565,
  863. __fastFastPerspReplaceZle565,
  864. __fastFastPerspReplaceZlt565,
  865. __fastPerspReplaceAlpha555,
  866. __fastPerspReplaceAlphaZle555,
  867. __fastPerspReplaceAlphaZlt555,
  868. __fastFastPerspReplace565,
  869. __fastFastPerspReplaceZle565,
  870. __fastFastPerspReplaceZlt565,
  871. __fastPerspReplaceAlpha565,
  872. __fastPerspReplaceAlphaZle565,
  873. __fastPerspReplaceAlphaZlt565,
  874. __fastPerspReplace888,
  875. __fastPerspReplaceZle888,
  876. __fastPerspReplaceZlt888,
  877. __fastPerspReplaceAlpha888,
  878. __fastPerspReplaceAlphaZle888,
  879. __fastPerspReplaceAlphaZlt888,
  880. };
  881. __genSpanFunc __fastPerspTexPalReplaceFuncs[] = {
  882. __fastFastPerspPalReplace332,
  883. __fastFastPerspPalReplaceZle332,
  884. __fastFastPerspPalReplaceZlt332,
  885. __fastFastPerspPalReplaceAlpha332,
  886. __fastFastPerspPalReplaceAlphaZle332,
  887. __fastFastPerspPalReplaceAlphaZlt332,
  888. __fastFastPerspPalReplace565,
  889. __fastFastPerspPalReplaceZle565,
  890. __fastFastPerspPalReplaceZlt565,
  891. __fastFastPerspPalReplaceAlpha555,
  892. __fastFastPerspPalReplaceAlphaZle555,
  893. __fastFastPerspPalReplaceAlphaZlt555,
  894. __fastFastPerspPalReplace565,
  895. __fastFastPerspPalReplaceZle565,
  896. __fastFastPerspPalReplaceZlt565,
  897. __fastFastPerspPalReplaceAlpha565,
  898. __fastFastPerspPalReplaceAlphaZle565,
  899. __fastFastPerspPalReplaceAlphaZlt565,
  900. __fastPerspPalReplace888,
  901. __fastPerspPalReplaceZle888,
  902. __fastPerspPalReplaceZlt888,
  903. __fastPerspPalReplaceAlpha888,
  904. __fastPerspPalReplaceAlphaZle888,
  905. __fastPerspPalReplaceAlphaZlt888,
  906. };
  907. __genSpanFunc __fastPerspTexFlatFuncs[] = {
  908. __fastPerspFlat332,
  909. __fastPerspFlatZle332,
  910. __fastPerspFlatZlt332,
  911. __fastPerspFlatAlpha332,
  912. __fastPerspFlatAlphaZle332,
  913. __fastPerspFlatAlphaZlt332,
  914. __fastPerspFlat555,
  915. __fastPerspFlatZle555,
  916. __fastPerspFlatZlt555,
  917. __fastPerspFlatAlpha555,
  918. __fastPerspFlatAlphaZle555,
  919. __fastPerspFlatAlphaZlt555,
  920. __fastPerspFlat565,
  921. __fastPerspFlatZle565,
  922. __fastPerspFlatZlt565,
  923. __fastPerspFlatAlpha565,
  924. __fastPerspFlatAlphaZle565,
  925. __fastPerspFlatAlphaZlt565,
  926. __fastPerspFlat888,
  927. __fastPerspFlatZle888,
  928. __fastPerspFlatZlt888,
  929. __fastPerspFlatAlpha888,
  930. __fastPerspFlatAlphaZle888,
  931. __fastPerspFlatAlphaZlt888,
  932. };
  933. __genSpanFunc __fastPerspTexSmoothFuncs[] = {
  934. __fastPerspSmooth332,
  935. __fastPerspSmoothZle332,
  936. __fastPerspSmoothZlt332,
  937. __fastPerspSmoothAlpha332,
  938. __fastPerspSmoothAlphaZle332,
  939. __fastPerspSmoothAlphaZlt332,
  940. __fastPerspSmooth555,
  941. __fastPerspSmoothZle555,
  942. __fastPerspSmoothZlt555,
  943. __fastPerspSmoothAlpha555,
  944. __fastPerspSmoothAlphaZle555,
  945. __fastPerspSmoothAlphaZlt555,
  946. __fastPerspSmooth565,
  947. __fastPerspSmoothZle565,
  948. __fastPerspSmoothZlt565,
  949. __fastPerspSmoothAlpha565,
  950. __fastPerspSmoothAlphaZle565,
  951. __fastPerspSmoothAlphaZlt565,
  952. __fastPerspSmooth888,
  953. __fastPerspSmoothZle888,
  954. __fastPerspSmoothZlt888,
  955. __fastPerspSmoothAlpha888,
  956. __fastPerspSmoothAlphaZle888,
  957. __fastPerspSmoothAlphaZlt888,
  958. };
  959. /*******************************************************/
  960. GLboolean FASTCALL __fastGenStippleLt32Span(__GLcontext *gc)
  961. {
  962. register GLuint zAccum = gc->polygon.shader.frag.z;
  963. register GLint zDelta = gc->polygon.shader.dzdx;
  964. register GLuint *zbuf = gc->polygon.shader.zbuf;
  965. register GLuint *pStipple = gc->polygon.shader.stipplePat;
  966. register GLint cTotalPix = gc->polygon.shader.length;
  967. register GLuint mask;
  968. register GLint cPix;
  969. register GLint zPasses = 0;
  970. register GLuint maskBit;
  971. __GLstippleWord stipple;
  972. GLint count;
  973. GLint shift;
  974. if (gc->constants.yInverted) {
  975. stipple = gc->polygon.stipple[(gc->constants.height -
  976. (gc->polygon.shader.frag.y - gc->constants.viewportYAdjust)-1)
  977. & (__GL_STIPPLE_BITS-1)];
  978. } else {
  979. stipple = gc->polygon.stipple[gc->polygon.shader.frag.y &
  980. (__GL_STIPPLE_BITS-1)];
  981. }
  982. shift = gc->polygon.shader.frag.x & (__GL_STIPPLE_BITS - 1);
  983. #ifdef __GL_STIPPLE_MSB
  984. stipple = (stipple << shift) | (stipple >> (__GL_STIPPLE_BITS - shift));
  985. #else
  986. stipple = (stipple >> shift) | (stipple << (__GL_STIPPLE_BITS - shift));
  987. #endif
  988. if (stipple == 0) {
  989. /* No point in continuing */
  990. return GL_FALSE;
  991. }
  992. for (;cTotalPix > 0; cTotalPix-=32) {
  993. mask = stipple;
  994. maskBit = 0x80000000;
  995. cPix = cTotalPix;
  996. if (cPix > 32)
  997. cPix = 32;
  998. for (;cPix > 0; cPix --)
  999. {
  1000. if (mask & maskBit)
  1001. {
  1002. if ((zAccum) < (*zbuf))
  1003. {
  1004. *zbuf = zAccum;
  1005. zPasses++;
  1006. }
  1007. else
  1008. {
  1009. mask &= ~maskBit;
  1010. }
  1011. }
  1012. zbuf++;
  1013. zAccum += zDelta;
  1014. maskBit >>= 1;
  1015. }
  1016. *pStipple++ = mask;
  1017. }
  1018. if (zPasses == 0) {
  1019. return GL_FALSE;
  1020. } else {
  1021. return GL_TRUE;
  1022. }
  1023. }
  1024. GLboolean FASTCALL __fastGenStippleLt16Span(__GLcontext *gc)
  1025. {
  1026. register GLuint zAccum = gc->polygon.shader.frag.z;
  1027. register __GLz16Value z16Accum = (__GLz16Value) (zAccum >> Z16_SHIFT);
  1028. register GLint zDelta = gc->polygon.shader.dzdx;
  1029. register __GLz16Value *zbuf = (__GLz16Value *) (gc->polygon.shader.zbuf);
  1030. register GLuint *pStipple = gc->polygon.shader.stipplePat;
  1031. register GLint cTotalPix = gc->polygon.shader.length;
  1032. register GLuint mask;
  1033. register GLint cPix;
  1034. register GLint zPasses = 0;
  1035. register GLuint maskBit;
  1036. __GLstippleWord stipple;
  1037. GLint count;
  1038. GLint shift;
  1039. if (gc->constants.yInverted) {
  1040. stipple = gc->polygon.stipple[(gc->constants.height -
  1041. (gc->polygon.shader.frag.y - gc->constants.viewportYAdjust)-1)
  1042. & (__GL_STIPPLE_BITS-1)];
  1043. } else {
  1044. stipple = gc->polygon.stipple[gc->polygon.shader.frag.y &
  1045. (__GL_STIPPLE_BITS-1)];
  1046. }
  1047. shift = gc->polygon.shader.frag.x & (__GL_STIPPLE_BITS - 1);
  1048. #ifdef __GL_STIPPLE_MSB
  1049. stipple = (stipple << shift) | (stipple >> (__GL_STIPPLE_BITS - shift));
  1050. #else
  1051. stipple = (stipple >> shift) | (stipple << (__GL_STIPPLE_BITS - shift));
  1052. #endif
  1053. if (stipple == 0) {
  1054. /* No point in continuing */
  1055. return GL_FALSE;
  1056. }
  1057. for (;cTotalPix > 0; cTotalPix-=32) {
  1058. mask = stipple;
  1059. maskBit = 0x80000000;
  1060. cPix = cTotalPix;
  1061. if (cPix > 32)
  1062. cPix = 32;
  1063. for (;cPix > 0; cPix --)
  1064. {
  1065. if (mask & maskBit)
  1066. {
  1067. if (((__GLz16Value)(zAccum >> Z16_SHIFT)) < (*zbuf))
  1068. {
  1069. *zbuf = ((__GLz16Value)(zAccum >> Z16_SHIFT));
  1070. zPasses++;
  1071. }
  1072. else
  1073. {
  1074. mask &= ~maskBit;
  1075. }
  1076. }
  1077. zbuf++;
  1078. zAccum += zDelta;
  1079. maskBit >>= 1;
  1080. }
  1081. *pStipple++ = mask;
  1082. }
  1083. if (zPasses == 0) {
  1084. return GL_FALSE;
  1085. } else {
  1086. return GL_TRUE;
  1087. }
  1088. }
  1089. GLboolean FASTCALL __fastGenStippleAnyDepthTestSpan(__GLcontext *gc)
  1090. {
  1091. // If the shader is done after this routine then
  1092. // the stipple pattern is all zeroes so we can
  1093. // skip the span
  1094. __glStippleSpan(gc);
  1095. if (gc->polygon.shader.done)
  1096. {
  1097. return GL_FALSE;
  1098. }
  1099. // If this returns true then all bits are off so
  1100. // we can skip the span
  1101. return !__glDepthTestStippledSpan(gc);
  1102. }