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.

180 lines
6.1 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: zippy.h
  3. *
  4. * included by zippy.c
  5. *
  6. * 28-Oct-1994 mikeke Created
  7. *
  8. * Copyright (c) 1994 Microsoft Corporation
  9. \**************************************************************************/
  10. /*
  11. ** Copyright 1991, 1992, 1993, Silicon Graphics, Inc.
  12. ** All Rights Reserved.
  13. **
  14. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  15. ** the contents of this file may not be disclosed to third parties, copied or
  16. ** duplicated in any form, in whole or in part, without the prior written
  17. ** permission of Silicon Graphics, Inc.
  18. **
  19. ** RESTRICTED RIGHTS LEGEND:
  20. ** Use, duplication or disclosure by the Government is subject to restrictions
  21. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  22. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  23. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  24. ** rights reserved under the Copyright Laws of the United States.
  25. */
  26. void FASTCALL
  27. #if ZBUFFER
  28. __ZippyFSTZ
  29. #else
  30. #if TEXTURE
  31. #if SHADE
  32. __ZippyFSTRGBTex
  33. #else
  34. __ZippyFSTTex
  35. #endif
  36. #else
  37. #if SHADE
  38. __ZippyFSTRGB
  39. #else
  40. __ZippyFSTCI
  41. #endif
  42. #endif
  43. #endif
  44. (__GLcontext *gc, GLint iyBottom, GLint iyTop)
  45. {
  46. int scansize;
  47. //
  48. // this function assumes all this stuff
  49. //
  50. ASSERTOPENGL((gc->drawBuffer->buf.flags & DIB_FORMAT) != 0,
  51. "Zippy target must have DIB format\n");
  52. ASSERTOPENGL((gc->drawBuffer->buf.flags & NO_CLIP) != 0,
  53. "Zippy doesn't support per-pixel clipping\n");
  54. ASSERTOPENGL(gc->state.raster.drawBuffer != GL_FRONT_AND_BACK,
  55. "Zippy only handles one draw buffer\n");
  56. ASSERTOPENGL(gc->transform.reasonableViewport,
  57. "Zippy requires reasonableViewport\n");
  58. ASSERTOPENGL(gc->transform.clipY0 <= iyBottom,
  59. "Zippy requires unclipped area\n");
  60. ASSERTOPENGL(iyTop <= gc->transform.clipY1,
  61. "Zippy requires unclipped area\n");
  62. //
  63. // setup zbuffer
  64. //
  65. #if (ZBUFFER)
  66. if( gc->modes.depthBits == 32 ) {
  67. gc->polygon.shader.zbuf = (__GLzValue *)
  68. ((GLubyte *)gc->polygon.shader.zbuf+
  69. (gc->polygon.shader.ixLeft << 2));
  70. } else {
  71. gc->polygon.shader.zbuf = (__GLzValue *)
  72. ((GLubyte *)gc->polygon.shader.zbuf+
  73. (gc->polygon.shader.ixLeft << 1));
  74. }
  75. #endif
  76. //
  77. // render the spans
  78. //
  79. scansize = gc->polygon.shader.cfb->buf.outerWidth;
  80. gc->polygon.shader.frag.x = gc->polygon.shader.ixLeft;
  81. for (gc->polygon.shader.frag.y = iyBottom;
  82. gc->polygon.shader.frag.y != iyTop;) {
  83. GLint spanWidth = gc->polygon.shader.ixRight - gc->polygon.shader.frag.x;
  84. if (spanWidth > 0) {
  85. gc->polygon.shader.length = spanWidth;
  86. (GENACCEL(gc).__fastSpanFuncPtr)((__GLGENcontext *)gc);
  87. }
  88. if ((++gc->polygon.shader.frag.y == iyTop) &&
  89. (gc->polygon.shader.modeFlags & __GL_SHADE_LAST_SUBTRI))
  90. return;
  91. GENACCEL(gc).pPix += scansize;
  92. gc->polygon.shader.ixRightFrac += gc->polygon.shader.dxRightFrac;
  93. if (gc->polygon.shader.ixRightFrac < 0) {
  94. /*
  95. * Carry/Borrow'd. Use large step
  96. */
  97. gc->polygon.shader.ixRight += gc->polygon.shader.dxRightBig;
  98. gc->polygon.shader.ixRightFrac &= ~0x80000000;
  99. } else {
  100. gc->polygon.shader.ixRight += gc->polygon.shader.dxRightLittle;
  101. }
  102. gc->polygon.shader.ixLeftFrac += gc->polygon.shader.dxLeftFrac;
  103. if (gc->polygon.shader.ixLeftFrac < 0) {
  104. /*
  105. * Carry/Borrow'd. Use large step
  106. */
  107. gc->polygon.shader.frag.x += gc->polygon.shader.dxLeftBig;
  108. gc->polygon.shader.ixLeftFrac &= ~0x80000000;
  109. #if SHADE
  110. GENACCEL(gc).spanValue.r += *((GLint *)&gc->polygon.shader.rBig);
  111. GENACCEL(gc).spanValue.g += *((GLint *)&gc->polygon.shader.gBig);
  112. GENACCEL(gc).spanValue.b += *((GLint *)&gc->polygon.shader.bBig);
  113. #endif
  114. #if TEXTURE
  115. #if SHADE
  116. GENACCEL(gc).spanValue.a += *((GLint *)&gc->polygon.shader.aBig);
  117. #endif
  118. GENACCEL(gc).spanValue.s += *((GLint *)&gc->polygon.shader.sBig);
  119. GENACCEL(gc).spanValue.t += *((GLint *)&gc->polygon.shader.tBig);
  120. gc->polygon.shader.frag.qw += gc->polygon.shader.qwBig;
  121. #endif
  122. #if !(SHADE) && !(TEXTURE)
  123. GENACCEL(gc).spanValue.r += *((GLint *)&gc->polygon.shader.rBig);
  124. #endif
  125. #if ZBUFFER
  126. gc->polygon.shader.frag.z += gc->polygon.shader.zBig;
  127. gc->polygon.shader.zbuf =
  128. (__GLzValue*)((GLubyte*)gc->polygon.shader.zbuf +
  129. gc->polygon.shader.zbufBig);
  130. #endif
  131. } else {
  132. /*
  133. * Use small step
  134. */
  135. gc->polygon.shader.frag.x += gc->polygon.shader.dxLeftLittle;
  136. #if SHADE
  137. GENACCEL(gc).spanValue.r += *((GLint *)&gc->polygon.shader.rLittle);
  138. GENACCEL(gc).spanValue.g += *((GLint *)&gc->polygon.shader.gLittle);
  139. GENACCEL(gc).spanValue.b += *((GLint *)&gc->polygon.shader.bLittle);
  140. #endif
  141. #if TEXTURE
  142. #if SHADE
  143. GENACCEL(gc).spanValue.a += *((GLint *)&gc->polygon.shader.aLittle);
  144. #endif
  145. GENACCEL(gc).spanValue.s += *((GLint *)&gc->polygon.shader.sLittle);
  146. GENACCEL(gc).spanValue.t += *((GLint *)&gc->polygon.shader.tLittle);
  147. gc->polygon.shader.frag.qw += gc->polygon.shader.qwLittle;
  148. #endif
  149. #if !(SHADE) && !(TEXTURE)
  150. GENACCEL(gc).spanValue.r += *((GLint *)&gc->polygon.shader.rLittle);
  151. #endif
  152. #if ZBUFFER
  153. gc->polygon.shader.frag.z += gc->polygon.shader.zLittle;
  154. gc->polygon.shader.zbuf =
  155. (__GLzValue*)((GLubyte*)gc->polygon.shader.zbuf +
  156. gc->polygon.shader.zbufLittle);
  157. #endif
  158. }
  159. }
  160. gc->polygon.shader.ixLeft = gc->polygon.shader.frag.x;
  161. }