ReactOS  r76032
s_span.c
Go to the documentation of this file.
1 /*
2  * Mesa 3-D graphics library
3  * Version: 7.5
4  *
5  * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6  * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
33 #include <precomp.h>
34 
40 void
42 {
43  GLchan r, g, b, a;
44  /* Z*/
45  {
46  const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
47  if (ctx->DrawBuffer->Visual.depthBits <= 16)
48  span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F);
49  else {
50  GLfloat tmpf = ctx->Current.RasterPos[2] * depthMax;
51  tmpf = MIN2(tmpf, depthMax);
52  span->z = (GLint)tmpf;
53  }
54  span->zStep = 0;
55  span->interpMask |= SPAN_Z;
56  }
57 
58  /* W (for perspective correction) */
59  span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0;
60  span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0;
61  span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
62 
63  /* primary color, or color index */
64  UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]);
65  UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]);
66  UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]);
67  UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]);
68 #if CHAN_TYPE == GL_FLOAT
69  span->red = r;
70  span->green = g;
71  span->blue = b;
72  span->alpha = a;
73 #else
74  span->red = IntToFixed(r);
75  span->green = IntToFixed(g);
76  span->blue = IntToFixed(b);
77  span->alpha = IntToFixed(a);
78 #endif
79  span->redStep = 0;
80  span->greenStep = 0;
81  span->blueStep = 0;
82  span->alphaStep = 0;
83  span->interpMask |= SPAN_RGBA;
84 
85  COPY_4V(span->attrStart[FRAG_ATTRIB_COL], ctx->Current.RasterColor);
86  ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL], 0.0, 0.0, 0.0, 0.0);
87  ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL], 0.0, 0.0, 0.0, 0.0);
88 
89  /* fog */
90  {
91  const SWcontext *swrast = SWRAST_CONTEXT(ctx);
92  GLfloat fogVal; /* a coord or a blend factor */
93  if (swrast->_PreferPixelFog) {
94  /* fog blend factors will be computed from fog coordinates per pixel */
95  fogVal = ctx->Current.RasterDistance;
96  }
97  else {
98  /* fog blend factor should be computed from fogcoord now */
99  fogVal = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
100  }
101  span->attrStart[FRAG_ATTRIB_FOGC][0] = fogVal;
102  span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
103  span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
104  }
105 
106  /* texcoords */
107  {
108  const GLuint attr = FRAG_ATTRIB_TEX;
109  const GLfloat *tc = ctx->Current.RasterTexCoords;
110  if (tc[3] > 0.0F) {
111  /* use (s/q, t/q, r/q, 1) */
112  span->attrStart[attr][0] = tc[0] / tc[3];
113  span->attrStart[attr][1] = tc[1] / tc[3];
114  span->attrStart[attr][2] = tc[2] / tc[3];
115  span->attrStart[attr][3] = 1.0;
116  }
117  else {
118  ASSIGN_4V(span->attrStart[attr], 0.0F, 0.0F, 0.0F, 1.0F);
119  }
120  ASSIGN_4V(span->attrStepX[attr], 0.0F, 0.0F, 0.0F, 0.0F);
121  ASSIGN_4V(span->attrStepY[attr], 0.0F, 0.0F, 0.0F, 0.0F);
122  }
123 }
124 
125 
132 static inline void
134  GLbitfield64 attrMask)
135 {
136  const SWcontext *swrast = SWRAST_CONTEXT(ctx);
137 
138  /*
139  * Don't overwrite existing array values, such as colors that may have
140  * been produced by glDraw/CopyPixels.
141  */
142  attrMask &= ~span->arrayAttribs;
143 
145  if (attrMask & BITFIELD64_BIT(attr)) {
146  const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3];
147  GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3];
148  const GLfloat dv0dx = span->attrStepX[attr][0];
149  const GLfloat dv1dx = span->attrStepX[attr][1];
150  const GLfloat dv2dx = span->attrStepX[attr][2];
151  const GLfloat dv3dx = span->attrStepX[attr][3];
152  GLfloat v0 = span->attrStart[attr][0] + span->leftClip * dv0dx;
153  GLfloat v1 = span->attrStart[attr][1] + span->leftClip * dv1dx;
154  GLfloat v2 = span->attrStart[attr][2] + span->leftClip * dv2dx;
155  GLfloat v3 = span->attrStart[attr][3] + span->leftClip * dv3dx;
156  GLuint k;
157  for (k = 0; k < span->end; k++) {
158  const GLfloat invW = 1.0f / w;
159  span->array->attribs[attr][k][0] = v0 * invW;
160  span->array->attribs[attr][k][1] = v1 * invW;
161  span->array->attribs[attr][k][2] = v2 * invW;
162  span->array->attribs[attr][k][3] = v3 * invW;
163  v0 += dv0dx;
164  v1 += dv1dx;
165  v2 += dv2dx;
166  v3 += dv3dx;
167  w += dwdx;
168  }
169  ASSERT((span->arrayAttribs & BITFIELD64_BIT(attr)) == 0);
170  span->arrayAttribs |= BITFIELD64_BIT(attr);
171  }
173 }
174 
175 
180 static inline void
182 {
183 #if CHAN_BITS != 32
184  const GLuint n = span->end;
185  GLuint i;
186 
187  ASSERT(!(span->arrayMask & SPAN_RGBA));
188 #endif
189 
190  switch (span->array->ChanType) {
191 #if CHAN_BITS != 32
192  case GL_UNSIGNED_BYTE:
193  {
194  GLubyte (*rgba)[4] = span->array->rgba8;
195  if (span->interpMask & SPAN_FLAT) {
196  GLubyte color[4];
197  color[RCOMP] = FixedToInt(span->red);
198  color[GCOMP] = FixedToInt(span->green);
199  color[BCOMP] = FixedToInt(span->blue);
200  color[ACOMP] = FixedToInt(span->alpha);
201  for (i = 0; i < n; i++) {
202  COPY_4UBV(rgba[i], color);
203  }
204  }
205  else {
206  GLfixed r = span->red;
207  GLfixed g = span->green;
208  GLfixed b = span->blue;
209  GLfixed a = span->alpha;
210  GLint dr = span->redStep;
211  GLint dg = span->greenStep;
212  GLint db = span->blueStep;
213  GLint da = span->alphaStep;
214  for (i = 0; i < n; i++) {
215  rgba[i][RCOMP] = FixedToChan(r);
216  rgba[i][GCOMP] = FixedToChan(g);
217  rgba[i][BCOMP] = FixedToChan(b);
218  rgba[i][ACOMP] = FixedToChan(a);
219  r += dr;
220  g += dg;
221  b += db;
222  a += da;
223  }
224  }
225  }
226  break;
227  case GL_UNSIGNED_SHORT:
228  {
229  GLushort (*rgba)[4] = span->array->rgba16;
230  if (span->interpMask & SPAN_FLAT) {
231  GLushort color[4];
232  color[RCOMP] = FixedToInt(span->red);
233  color[GCOMP] = FixedToInt(span->green);
234  color[BCOMP] = FixedToInt(span->blue);
235  color[ACOMP] = FixedToInt(span->alpha);
236  for (i = 0; i < n; i++) {
237  COPY_4V(rgba[i], color);
238  }
239  }
240  else {
241  GLushort (*rgba)[4] = span->array->rgba16;
242  GLfixed r, g, b, a;
243  GLint dr, dg, db, da;
244  r = span->red;
245  g = span->green;
246  b = span->blue;
247  a = span->alpha;
248  dr = span->redStep;
249  dg = span->greenStep;
250  db = span->blueStep;
251  da = span->alphaStep;
252  for (i = 0; i < n; i++) {
253  rgba[i][RCOMP] = FixedToChan(r);
254  rgba[i][GCOMP] = FixedToChan(g);
255  rgba[i][BCOMP] = FixedToChan(b);
256  rgba[i][ACOMP] = FixedToChan(a);
257  r += dr;
258  g += dg;
259  b += db;
260  a += da;
261  }
262  }
263  }
264  break;
265 #endif
266  case GL_FLOAT:
268  break;
269  default:
270  _mesa_problem(ctx, "bad datatype 0x%x in interpolate_int_colors",
271  span->array->ChanType);
272  }
273  span->arrayMask |= SPAN_RGBA;
274 }
275 
279 void
281 {
282  const GLuint n = span->end;
283  GLuint i;
284 
285  ASSERT(!(span->arrayMask & SPAN_Z));
286 
287  if (ctx->DrawBuffer->Visual.depthBits <= 16) {
288  GLfixed zval = span->z;
289  GLuint *z = span->array->z;
290  for (i = 0; i < n; i++) {
291  z[i] = FixedToInt(zval);
292  zval += span->zStep;
293  }
294  }
295  else {
296  /* Deep Z buffer, no fixed->int shift */
297  GLuint zval = span->z;
298  GLuint *z = span->array->z;
299  for (i = 0; i < n; i++) {
300  z[i] = zval;
301  zval += span->zStep;
302  }
303  }
304  span->interpMask &= ~SPAN_Z;
305  span->arrayMask |= SPAN_Z;
306 }
307 
308 
313 GLfloat
315  GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
316  GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
317 {
318  GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ);
319  GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ);
320  GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ);
321  GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ);
322  GLfloat x = SQRTF(dudx * dudx + dvdx * dvdx);
323  GLfloat y = SQRTF(dudy * dudy + dvdy * dvdy);
324  GLfloat rho = MAX2(x, y);
325  GLfloat lambda = LOG2(rho);
326  return lambda;
327 }
328 
329 
334 #if 0
335 GLfloat
336 _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
337  GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
338  GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
339 {
340  GLfloat dsdx2 = (s + dsdx) / (q + dqdx) - s * invQ;
341  GLfloat dtdx2 = (t + dtdx) / (q + dqdx) - t * invQ;
342  GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ;
343  GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ;
344  GLfloat maxU, maxV, rho, lambda;
345  dsdx2 = FABSF(dsdx2);
346  dsdy2 = FABSF(dsdy2);
347  dtdx2 = FABSF(dtdx2);
348  dtdy2 = FABSF(dtdy2);
349  maxU = MAX2(dsdx2, dsdy2) * texW;
350  maxV = MAX2(dtdx2, dtdy2) * texH;
351  rho = MAX2(maxU, maxV);
352  lambda = LOG2(rho);
353  return lambda;
354 }
355 #endif
356 
357 
369 static void
371 {
372  if (ctx->Texture._EnabledCoord) {
373  const GLuint attr = FRAG_ATTRIB_TEX;
374  const struct gl_texture_object *obj = ctx->Texture.Unit._Current;
375  GLfloat texW, texH;
376  GLboolean needLambda;
377  GLfloat (*texcoord)[4] = span->array->attribs[attr];
378  GLfloat *lambda = span->array->lambda;
379  const GLfloat dsdx = span->attrStepX[attr][0];
380  const GLfloat dsdy = span->attrStepY[attr][0];
381  const GLfloat dtdx = span->attrStepX[attr][1];
382  const GLfloat dtdy = span->attrStepY[attr][1];
383  const GLfloat drdx = span->attrStepX[attr][2];
384  const GLfloat dqdx = span->attrStepX[attr][3];
385  const GLfloat dqdy = span->attrStepY[attr][3];
386  GLfloat s = span->attrStart[attr][0] + span->leftClip * dsdx;
387  GLfloat t = span->attrStart[attr][1] + span->leftClip * dtdx;
388  GLfloat r = span->attrStart[attr][2] + span->leftClip * drdx;
389  GLfloat q = span->attrStart[attr][3] + span->leftClip * dqdx;
390 
391  if (obj) {
392  const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel];
393  const struct swrast_texture_image *swImg =
395 
396  needLambda = (obj->Sampler.MinFilter != obj->Sampler.MagFilter);
397  /* LOD is calculated directly in the ansiotropic filter, we can
398  * skip the normal lambda function as the result is ignored.
399  */
400  if (obj->Sampler.MaxAnisotropy > 1.0 &&
401  obj->Sampler.MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
402  needLambda = GL_FALSE;
403  }
404  texW = swImg->WidthScale;
405  texH = swImg->HeightScale;
406  }
407  else {
408  /* using a fragment program */
409  texW = 1.0;
410  texH = 1.0;
411  needLambda = GL_FALSE;
412  }
413 
414  if (needLambda) {
415  GLuint i;
416  for (i = 0; i < span->end; i++) {
417  const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
418  texcoord[i][0] = s * invQ;
419  texcoord[i][1] = t * invQ;
420  texcoord[i][2] = r * invQ;
421  texcoord[i][3] = q;
422  lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy,
423  dqdx, dqdy, texW, texH,
424  s, t, q, invQ);
425  s += dsdx;
426  t += dtdx;
427  r += drdx;
428  q += dqdx;
429  }
430  span->arrayMask |= SPAN_LAMBDA;
431  }
432  else {
433  GLuint i;
434  if (dqdx == 0.0F) {
435  /* Ortho projection or polygon's parallel to window X axis */
436  const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
437  for (i = 0; i < span->end; i++) {
438  texcoord[i][0] = s * invQ;
439  texcoord[i][1] = t * invQ;
440  texcoord[i][2] = r * invQ;
441  texcoord[i][3] = q;
442  lambda[i] = 0.0;
443  s += dsdx;
444  t += dtdx;
445  r += drdx;
446  }
447  }
448  else {
449  for (i = 0; i < span->end; i++) {
450  const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
451  texcoord[i][0] = s * invQ;
452  texcoord[i][1] = t * invQ;
453  texcoord[i][2] = r * invQ;
454  texcoord[i][3] = q;
455  lambda[i] = 0.0;
456  s += dsdx;
457  t += dtdx;
458  r += drdx;
459  q += dqdx;
460  }
461  }
462  } /* lambda */
463  } /* if */
464 }
465 
469 static inline void
471 {
472  GLubyte *mask = span->array->mask;
473 
474  ASSERT(ctx->Polygon.StippleFlag);
475 
476  if (span->arrayMask & SPAN_XY) {
477  /* arrays of x/y pixel coords */
478  GLuint i;
479  for (i = 0; i < span->end; i++) {
480  const GLint col = span->array->x[i] % 32;
481  const GLint row = span->array->y[i] % 32;
482  const GLuint stipple = ctx->PolygonStipple[row];
483  if (((1 << col) & stipple) == 0) {
484  mask[i] = 0;
485  }
486  }
487  }
488  else {
489  /* horizontal span of pixels */
490  const GLuint highBit = 1 << 31;
491  const GLuint stipple = ctx->PolygonStipple[span->y % 32];
492  GLuint i, m = highBit >> (GLuint) (span->x % 32);
493  for (i = 0; i < span->end; i++) {
494  if ((m & stipple) == 0) {
495  mask[i] = 0;
496  }
497  m = m >> 1;
498  if (m == 0) {
499  m = highBit;
500  }
501  }
502  }
503  span->writeAll = GL_FALSE;
504 }
505 
506 
514 static inline GLuint
515 clip_span( struct gl_context *ctx, SWspan *span )
516 {
517  const GLint xmin = ctx->DrawBuffer->_Xmin;
518  const GLint xmax = ctx->DrawBuffer->_Xmax;
519  const GLint ymin = ctx->DrawBuffer->_Ymin;
520  const GLint ymax = ctx->DrawBuffer->_Ymax;
521 
522  span->leftClip = 0;
523 
524  if (span->arrayMask & SPAN_XY) {
525  /* arrays of x/y pixel coords */
526  const GLint *x = span->array->x;
527  const GLint *y = span->array->y;
528  const GLint n = span->end;
529  GLubyte *mask = span->array->mask;
530  GLint i;
531  GLuint passed = 0;
532  if (span->arrayMask & SPAN_MASK) {
533  /* note: using & intead of && to reduce branches */
534  for (i = 0; i < n; i++) {
535  mask[i] &= (x[i] >= xmin) & (x[i] < xmax)
536  & (y[i] >= ymin) & (y[i] < ymax);
537  passed += mask[i];
538  }
539  }
540  else {
541  /* note: using & intead of && to reduce branches */
542  for (i = 0; i < n; i++) {
543  mask[i] = (x[i] >= xmin) & (x[i] < xmax)
544  & (y[i] >= ymin) & (y[i] < ymax);
545  passed += mask[i];
546  }
547  }
548  return passed > 0;
549  }
550  else {
551  /* horizontal span of pixels */
552  const GLint x = span->x;
553  const GLint y = span->y;
554  GLint n = span->end;
555 
556  /* Trivial rejection tests */
557  if (y < ymin || y >= ymax || x + n <= xmin || x >= xmax) {
558  span->end = 0;
559  return GL_FALSE; /* all pixels clipped */
560  }
561 
562  /* Clip to right */
563  if (x + n > xmax) {
564  ASSERT(x < xmax);
565  n = span->end = xmax - x;
566  }
567 
568  /* Clip to the left */
569  if (x < xmin) {
570  const GLint leftClip = xmin - x;
571  GLuint i;
572 
573  ASSERT(leftClip > 0);
574  ASSERT(x + n > xmin);
575 
576  /* Clip 'leftClip' pixels from the left side.
577  * The span->leftClip field will be applied when we interpolate
578  * fragment attributes.
579  * For arrays of values, shift them left.
580  */
581  for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
582  if (span->interpMask & (1 << i)) {
583  GLuint j;
584  for (j = 0; j < 4; j++) {
585  span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
586  }
587  }
588  }
589 
590  span->red += leftClip * span->redStep;
591  span->green += leftClip * span->greenStep;
592  span->blue += leftClip * span->blueStep;
593  span->alpha += leftClip * span->alphaStep;
594  span->index += leftClip * span->indexStep;
595  span->z += leftClip * span->zStep;
596  span->intTex[0] += leftClip * span->intTexStep[0];
597  span->intTex[1] += leftClip * span->intTexStep[1];
598 
599 #define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
600  memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
601 
602  for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
603  if (span->arrayAttribs & (1 << i)) {
604  /* shift array elements left by 'leftClip' */
605  SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
606  }
607  }
608 
609  SHIFT_ARRAY(span->array->mask, leftClip, n - leftClip);
610  SHIFT_ARRAY(span->array->rgba8, leftClip, n - leftClip);
611  SHIFT_ARRAY(span->array->rgba16, leftClip, n - leftClip);
612  SHIFT_ARRAY(span->array->x, leftClip, n - leftClip);
613  SHIFT_ARRAY(span->array->y, leftClip, n - leftClip);
614  SHIFT_ARRAY(span->array->z, leftClip, n - leftClip);
615  SHIFT_ARRAY(span->array->index, leftClip, n - leftClip);
616  SHIFT_ARRAY(span->array->lambda, leftClip, n - leftClip);
617  SHIFT_ARRAY(span->array->coverage, leftClip, n - leftClip);
618 
619 #undef SHIFT_ARRAY
620 
621  span->leftClip = leftClip;
622  span->x = xmin;
623  span->end -= leftClip;
624  span->writeAll = GL_FALSE;
625  }
626 
627  ASSERT(span->x >= xmin);
628  ASSERT(span->x + span->end <= xmax);
629  ASSERT(span->y >= ymin);
630  ASSERT(span->y < ymax);
631 
632  return GL_TRUE; /* some pixels visible */
633  }
634 }
635 
636 
640 static inline void
642 {
643  const GLfloat *coverage = span->array->coverage;
644  GLuint i;
645  if (span->array->ChanType == GL_UNSIGNED_BYTE) {
646  GLubyte (*rgba)[4] = span->array->rgba8;
647  for (i = 0; i < span->end; i++) {
648  const GLfloat a = rgba[i][ACOMP] * coverage[i];
649  rgba[i][ACOMP] = (GLubyte) CLAMP(a, 0.0, 255.0);
650  ASSERT(coverage[i] >= 0.0);
651  ASSERT(coverage[i] <= 1.0);
652  }
653  }
654  else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
655  GLushort (*rgba)[4] = span->array->rgba16;
656  for (i = 0; i < span->end; i++) {
657  const GLfloat a = rgba[i][ACOMP] * coverage[i];
658  rgba[i][ACOMP] = (GLushort) CLAMP(a, 0.0, 65535.0);
659  }
660  }
661  else {
662  GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
663  for (i = 0; i < span->end; i++) {
664  rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i];
665  /* clamp later */
666  }
667  }
668 }
669 
676 static inline void
678 {
679  GLvoid *src, *dst;
680 
681  if (output > 0 || span->array->ChanType == GL_FLOAT) {
682  src = span->array->attribs[FRAG_ATTRIB_COL + output];
683  span->array->ChanType = GL_FLOAT;
684  }
685  else if (span->array->ChanType == GL_UNSIGNED_BYTE) {
686  src = span->array->rgba8;
687  }
688  else {
690  src = span->array->rgba16;
691  }
692 
693  if (newType == GL_UNSIGNED_BYTE) {
694  dst = span->array->rgba8;
695  }
696  else if (newType == GL_UNSIGNED_SHORT) {
697  dst = span->array->rgba16;
698  }
699  else {
700  dst = span->array->attribs[FRAG_ATTRIB_COL];
701  }
702 
703  _mesa_convert_colors(span->array->ChanType, src,
704  newType, dst,
705  span->end, span->array->mask);
706 
707  span->array->ChanType = newType;
708  span->array->rgba = dst;
709 }
710 
711 
712 
716 static inline void
718 {
719  if (ctx->Texture._EnabledCoord) {
720  /* conventional texturing */
721 
722 #if CHAN_BITS == 32
723  if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
724  interpolate_int_colors(ctx, span);
725  }
726 #else
727  if (!(span->arrayMask & SPAN_RGBA))
728  interpolate_int_colors(ctx, span);
729 #endif
730  if (!(span->arrayAttribs & FRAG_BIT_TEX))
731  interpolate_texcoords(ctx, span);
732 
733  _swrast_texture_span(ctx, span);
734  }
735 }
736 
737 
739 static void
740 put_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
741  GLenum datatype,
742  GLuint count, const GLint x[], const GLint y[],
743  const void *values, const GLubyte *mask)
744 {
745  gl_pack_ubyte_rgba_func pack_ubyte;
746  gl_pack_float_rgba_func pack_float;
747  GLuint i;
748 
749  if (datatype == GL_UNSIGNED_BYTE)
750  pack_ubyte = _mesa_get_pack_ubyte_rgba_function(rb->Format);
751  else
752  pack_float = _mesa_get_pack_float_rgba_function(rb->Format);
753 
754  for (i = 0; i < count; i++) {
755  if (mask[i]) {
756  GLubyte *dst = _swrast_pixel_address(rb, x[i], y[i]);
757 
758  if (datatype == GL_UNSIGNED_BYTE) {
759  pack_ubyte((const GLubyte *) values + 4 * i, dst);
760  }
761  else {
762  assert(datatype == GL_FLOAT);
763  pack_float((const GLfloat *) values + 4 * i, dst);
764  }
765  }
766  }
767 }
768 
769 
771 void
773  GLenum datatype,
775  const void *values, const GLubyte *mask)
776 {
777  GLubyte *dst = _swrast_pixel_address(rb, x, y);
778 
779  if (!mask) {
780  if (datatype == GL_UNSIGNED_BYTE) {
782  (const GLubyte (*)[4]) values, dst);
783  }
784  else {
785  assert(datatype == GL_FLOAT);
787  (const GLfloat (*)[4]) values, dst);
788  }
789  }
790  else {
792  GLuint i, runLen, runStart;
793  /* We can't pass a 'mask' array to the _mesa_pack_rgba_row() functions
794  * so look for runs where mask=1...
795  */
796  runLen = runStart = 0;
797  for (i = 0; i < count; i++) {
798  if (mask[i]) {
799  if (runLen == 0)
800  runStart = i;
801  runLen++;
802  }
803 
804  if (!mask[i] || i == count - 1) {
805  /* might be the end of a run of pixels */
806  if (runLen > 0) {
807  if (datatype == GL_UNSIGNED_BYTE) {
808  _mesa_pack_ubyte_rgba_row(rb->Format, runLen,
809  (const GLubyte (*)[4]) values + runStart,
810  dst + runStart * bpp);
811  }
812  else {
813  assert(datatype == GL_FLOAT);
814  _mesa_pack_float_rgba_row(rb->Format, runLen,
815  (const GLfloat (*)[4]) values + runStart,
816  dst + runStart * bpp);
817  }
818  runLen = 0;
819  }
820  }
821  }
822  }
823 }
824 
825 
826 
834 void
836 {
837  const SWcontext *swrast = SWRAST_CONTEXT(ctx);
838  const GLuint colorMask = *((GLuint *)ctx->Color.ColorMask);
839  const GLbitfield origInterpMask = span->interpMask;
840  const GLbitfield origArrayMask = span->arrayMask;
841  const GLbitfield64 origArrayAttribs = span->arrayAttribs;
842  const GLenum origChanType = span->array->ChanType;
843  void * const origRgba = span->array->rgba;
844  const GLboolean texture = ctx->Texture._EnabledCoord;
845  struct gl_framebuffer *fb = ctx->DrawBuffer;
846 
847  /*
848  printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__,
849  span->interpMask, span->arrayMask);
850  */
851 
852  ASSERT(span->primitive == GL_POINT ||
853  span->primitive == GL_LINE ||
854  span->primitive == GL_POLYGON ||
855  span->primitive == GL_BITMAP);
856 
857  /* Fragment write masks */
858  if (span->arrayMask & SPAN_MASK) {
859  /* mask was initialized by caller, probably glBitmap */
860  span->writeAll = GL_FALSE;
861  }
862  else {
863  memset(span->array->mask, 1, span->end);
864  span->writeAll = GL_TRUE;
865  }
866 
867  /* Clip to window/scissor box */
868  if (!clip_span(ctx, span)) {
869  return;
870  }
871 
872  ASSERT(span->end <= MAX_WIDTH);
873 
874  /* Depth bounds test */
875  if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
876  if (!_swrast_depth_bounds_test(ctx, span)) {
877  return;
878  }
879  }
880 
881 #ifdef DEBUG
882  /* Make sure all fragments are within window bounds */
883  if (span->arrayMask & SPAN_XY) {
884  /* array of pixel locations */
885  GLuint i;
886  for (i = 0; i < span->end; i++) {
887  if (span->array->mask[i]) {
888  assert(span->array->x[i] >= fb->_Xmin);
889  assert(span->array->x[i] < fb->_Xmax);
890  assert(span->array->y[i] >= fb->_Ymin);
891  assert(span->array->y[i] < fb->_Ymax);
892  }
893  }
894  }
895 #endif
896 
897  /* Polygon Stippling */
898  if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) {
899  stipple_polygon_span(ctx, span);
900  }
901 
902  /* This is the normal place to compute the fragment color/Z
903  * from texturing or shading.
904  */
905  if (texture && !swrast->_DeferredTexture) {
906  shade_texture_span(ctx, span);
907  }
908 
909  /* Do the alpha test */
910  if (ctx->Color.AlphaEnabled) {
911  if (!_swrast_alpha_test(ctx, span)) {
912  /* all fragments failed test */
913  goto end;
914  }
915  }
916 
917  /* Stencil and Z testing */
918  if (ctx->Stencil._Enabled || ctx->Depth.Test) {
919  if (!(span->arrayMask & SPAN_Z))
920  _swrast_span_interpolate_z(ctx, span);
921 
922  if (ctx->Stencil._Enabled) {
923  /* Combined Z/stencil tests */
924  if (!_swrast_stencil_and_ztest_span(ctx, span)) {
925  /* all fragments failed test */
926  goto end;
927  }
928  }
929  else if (fb->Visual.depthBits > 0) {
930  /* Just regular depth testing */
931  ASSERT(ctx->Depth.Test);
932  ASSERT(span->arrayMask & SPAN_Z);
933  if (!_swrast_depth_test_span(ctx, span)) {
934  /* all fragments failed test */
935  goto end;
936  }
937  }
938  }
939 
940  /* We had to wait until now to check for glColorMask(0,0,0,0) because of
941  * the occlusion test.
942  */
943  if (colorMask == 0) {
944  /* no colors to write */
945  goto end;
946  }
947 
948  /* If we were able to defer fragment color computation to now, there's
949  * a good chance that many fragments will have already been killed by
950  * Z/stencil testing.
951  */
952  if (texture && swrast->_DeferredTexture) {
953  shade_texture_span(ctx, span);
954  }
955 
956 #if CHAN_BITS == 32
957  if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
958  interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
959  }
960 #else
961  if ((span->arrayMask & SPAN_RGBA) == 0) {
962  interpolate_int_colors(ctx, span);
963  }
964 #endif
965 
966  ASSERT(span->arrayMask & SPAN_RGBA);
967 
968  /* Fog */
969  if (swrast->_FogEnabled) {
970  _swrast_fog_rgba_span(ctx, span);
971  }
972 
973  /* Antialias coverage application */
974  if (span->arrayMask & SPAN_COVERAGE) {
975  apply_aa_coverage(span);
976  }
977 
978  /*
979  * Write to renderbuffers.
980  * Depending on glDrawBuffer() state and the which color outputs are
981  * written by the fragment shader, we may either replicate one color to
982  * all renderbuffers or write a different color to each renderbuffer.
983  * multiFragOutputs=TRUE for the later case.
984  */
985  {
986  struct gl_renderbuffer *rb = fb->_ColorDrawBuffer;
987 
988  /* color[fragOutput] will be written to buffer */
989 
990  if (rb) {
991  struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
992  GLenum colorType = srb->ColorType;
993 
994  assert(colorType == GL_UNSIGNED_BYTE ||
995  colorType == GL_FLOAT);
996 
997  /* set span->array->rgba to colors for renderbuffer's datatype */
998  if (span->array->ChanType != colorType) {
999  convert_color_type(span, colorType, 0);
1000  }
1001  else {
1002  if (span->array->ChanType == GL_UNSIGNED_BYTE) {
1003  span->array->rgba = span->array->rgba8;
1004  }
1005  else {
1006  span->array->rgba = (void *)span->array->attribs[FRAG_ATTRIB_COL];
1007  }
1008  }
1009 
1010 
1011  ASSERT(rb->_BaseFormat == GL_RGBA ||
1012  rb->_BaseFormat == GL_RGB ||
1013  rb->_BaseFormat == GL_RED ||
1014  rb->_BaseFormat == GL_RG ||
1015  rb->_BaseFormat == GL_ALPHA);
1016 
1017  if (ctx->Color.ColorLogicOpEnabled) {
1018  _swrast_logicop_rgba_span(ctx, rb, span);
1019  }
1020  else if (ctx->Color.BlendEnabled) {
1021  _swrast_blend_span(ctx, rb, span);
1022  }
1023 
1024  if (colorMask != 0xffffffff) {
1025  _swrast_mask_rgba_span(ctx, rb, span);
1026  }
1027 
1028  if (span->arrayMask & SPAN_XY) {
1029  /* array of pixel coords */
1030  put_values(ctx, rb,
1031  span->array->ChanType, span->end,
1032  span->array->x, span->array->y,
1033  span->array->rgba, span->array->mask);
1034  }
1035  else {
1036  /* horizontal run of pixels */
1037  _swrast_put_row(ctx, rb,
1038  span->array->ChanType,
1039  span->end, span->x, span->y,
1040  span->array->rgba,
1041  span->writeAll ? NULL: span->array->mask);
1042  }
1043 
1044  } /* if rb */
1045  }
1046 
1047 end:
1048  /* restore these values before returning */
1049  span->interpMask = origInterpMask;
1050  span->arrayMask = origArrayMask;
1051  span->arrayAttribs = origArrayAttribs;
1052  span->array->ChanType = origChanType;
1053  span->array->rgba = origRgba;
1054 }
1055 
1056 
1062 void
1064  GLuint n, GLint x, GLint y,
1065  GLvoid *rgba)
1066 {
1067  struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
1068  GLenum dstType = GL_FLOAT;
1069  const GLint bufWidth = (GLint) rb->Width;
1070  const GLint bufHeight = (GLint) rb->Height;
1071 
1072  if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) {
1073  /* completely above, below, or right */
1074  /* XXX maybe leave rgba values undefined? */
1075  memset(rgba, 0, 4 * n * sizeof(GLchan));
1076  }
1077  else {
1078  GLint skip, length;
1079  GLubyte *src;
1080 
1081  if (x < 0) {
1082  /* left edge clipping */
1083  skip = -x;
1084  length = (GLint) n - skip;
1085  if (length < 0) {
1086  /* completely left of window */
1087  return;
1088  }
1089  if (length > bufWidth) {
1090  length = bufWidth;
1091  }
1092  }
1093  else if ((GLint) (x + n) > bufWidth) {
1094  /* right edge clipping */
1095  skip = 0;
1096  length = bufWidth - x;
1097  if (length < 0) {
1098  /* completely to right of window */
1099  return;
1100  }
1101  }
1102  else {
1103  /* no clipping */
1104  skip = 0;
1105  length = (GLint) n;
1106  }
1107 
1108  ASSERT(rb);
1109  ASSERT(rb->_BaseFormat == GL_RGBA ||
1110  rb->_BaseFormat == GL_RGB ||
1111  rb->_BaseFormat == GL_RG ||
1112  rb->_BaseFormat == GL_RED ||
1113  rb->_BaseFormat == GL_LUMINANCE ||
1114  rb->_BaseFormat == GL_INTENSITY ||
1116  rb->_BaseFormat == GL_ALPHA);
1117 
1118  assert(srb->Map);
1119 
1120  src = _swrast_pixel_address(rb, x + skip, y);
1121 
1122  if (dstType == GL_UNSIGNED_BYTE) {
1123  _mesa_unpack_ubyte_rgba_row(rb->Format, length, src,
1124  (GLubyte (*)[4]) rgba + skip);
1125  }
1126  else if (dstType == GL_FLOAT) {
1127  _mesa_unpack_rgba_row(rb->Format, length, src,
1128  (GLfloat (*)[4]) rgba + skip);
1129  }
1130  else {
1131  _mesa_problem(ctx, "unexpected type in _swrast_read_rgba_span()");
1132  }
1133  }
1134 }
1135 
1136 
1141 static void
1142 get_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
1143  GLuint count, const GLint x[], const GLint y[],
1144  void *values, GLenum type)
1145 {
1146  GLuint i;
1147 
1148  for (i = 0; i < count; i++) {
1149  if (x[i] >= 0 && y[i] >= 0 &&
1150  x[i] < (GLint) rb->Width && y[i] < (GLint) rb->Height) {
1151  /* inside */
1152  const GLubyte *src = _swrast_pixel_address(rb, x[i], y[i]);
1153 
1154  if (type == GL_UNSIGNED_BYTE) {
1155  _mesa_unpack_ubyte_rgba_row(rb->Format, 1, src,
1156  (GLubyte (*)[4]) values + i);
1157  }
1158  else if (type == GL_FLOAT) {
1159  _mesa_unpack_rgba_row(rb->Format, 1, src,
1160  (GLfloat (*)[4]) values + i);
1161  }
1162  else {
1163  _mesa_problem(ctx, "unexpected type in get_values()");
1164  }
1165  }
1166  }
1167 }
1168 
1169 
1174 static void
1175 get_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
1176  GLuint count, GLint x, GLint y,
1178 {
1179  GLint skip = 0;
1180  GLubyte *src;
1181 
1182  if (y < 0 || y >= (GLint) rb->Height)
1183  return; /* above or below */
1184 
1185  if (x + (GLint) count <= 0 || x >= (GLint) rb->Width)
1186  return; /* entirely left or right */
1187 
1188  if (x + count > rb->Width) {
1189  /* right clip */
1190  GLint clip = x + count - rb->Width;
1191  count -= clip;
1192  }
1193 
1194  if (x < 0) {
1195  /* left clip */
1196  skip = -x;
1197  x = 0;
1198  count -= skip;
1199  }
1200 
1201  src = _swrast_pixel_address(rb, x, y);
1202 
1203  if (type == GL_UNSIGNED_BYTE) {
1204  _mesa_unpack_ubyte_rgba_row(rb->Format, count, src,
1205  (GLubyte (*)[4]) values + skip);
1206  }
1207  else if (type == GL_FLOAT) {
1208  _mesa_unpack_rgba_row(rb->Format, count, src,
1209  (GLfloat (*)[4]) values + skip);
1210  }
1211  else {
1212  _mesa_problem(ctx, "unexpected type in get_row()");
1213  }
1214 }
1215 
1216 
1222 void *
1224  SWspan *span)
1225 {
1226  void *rbPixels;
1227 
1228  /* Point rbPixels to a temporary space */
1229  rbPixels = span->array->attribs[FRAG_ATTRIB_MAX - 1];
1230 
1231  /* Get destination values from renderbuffer */
1232  if (span->arrayMask & SPAN_XY) {
1233  get_values(ctx, rb, span->end, span->array->x, span->array->y,
1234  rbPixels, span->array->ChanType);
1235  }
1236  else {
1237  get_row(ctx, rb, span->end, span->x, span->y,
1238  rbPixels, span->array->ChanType);
1239  }
1240 
1241  return rbPixels;
1242 }
GLfixed zStep
Definition: s_span.h:146
static void shade_texture_span(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:717
#define GL_UNSIGNED_SHORT
Definition: gl.h:180
GLfixed redStep
Definition: s_span.h:141
GLfixed red
Definition: s_span.h:141
#define FRAG_BIT_COL
Definition: mtypes.h:155
GLfixed indexStep
Definition: s_span.h:145
#define RCOMP
Definition: internal.h:77
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
GLfixed index
Definition: s_span.h:145
GLfloat _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
Definition: s_span.c:314
#define GL_RED
Definition: gl.h:480
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
#define MAX_WIDTH
Definition: config.h:118
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define GL_BITMAP
Definition: gl.h:497
#define FRAG_BIT_TEX
Definition: mtypes.h:157
void _mesa_convert_colors(GLenum srcType, const GLvoid *src, GLenum dstType, GLvoid *dst, GLuint count, const GLubyte mask[])
Definition: image.c:1315
static void interpolate_active_attribs(struct gl_context *ctx, SWspan *span, GLbitfield64 attrMask)
Definition: s_span.c:133
#define BCOMP
Definition: internal.h:79
GLuint z[MAX_WIDTH]
Definition: s_span.h:88
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GL_RG
Definition: glext.h:1817
#define ATTRIB_LOOP_BEGIN
Definition: s_context.h:429
#define GL_FALSE
Definition: gl.h:173
GLfixed intTexStep[2]
Definition: s_span.h:147
GLfloat attribs[FRAG_ATTRIB_MAX][MAX_WIDTH][4]
Definition: s_span.h:74
#define GL_ALPHA
Definition: gl.h:483
void _swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum datatype, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask)
Definition: s_span.c:772
struct gl_polygon_attrib Polygon
Definition: mtypes.h:1829
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLfloat v0
Definition: glext.h:6061
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
#define FABSF(x)
Definition: imports.h:280
GLint _Ymax
Definition: mtypes.h:1403
GLbitfield interpMask
Definition: s_span.h:129
GLint x[MAX_WIDTH]
Definition: s_span.h:86
GLfixed intTex[2]
Definition: s_span.h:147
GLdouble GLdouble t
Definition: gl.h:2047
int GLfixed
Definition: glheader.h:84
static void get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values, GLenum type)
Definition: s_span.c:1142
#define GL_FLOAT
Definition: gl.h:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
static void convert_color_type(SWspan *span, GLenum newType, GLuint output)
Definition: s_span.c:677
struct gl_current_attrib Current
Definition: mtypes.h:1818
GLboolean _FogEnabled
Definition: s_context.h:212
GLenum ChanType
Definition: s_span.h:79
gl_format Format
Definition: mtypes.h:1351
#define IntToFixed(I)
Definition: s_context.h:400
GLuint GLuint end
Definition: gl.h:1545
void _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span)
Definition: s_logic.c:182
GLfloat attrStepY[FRAG_ATTRIB_MAX][4]
Definition: s_span.h:134
GLfloat attrStart[FRAG_ATTRIB_MAX][4]
Definition: s_span.h:132
static SWcontext * SWRAST_CONTEXT(struct gl_context *ctx)
Definition: s_context.h:310
struct gl_texture_image * Image[MAX_FACES][MAX_TEXTURE_LEVELS]
Definition: mtypes.h:971
GLint _mesa_get_format_bytes(gl_format format)
Definition: formats.c:786
GLenum _BaseFormat
Definition: mtypes.h:1349
#define BITFIELD64_BIT(b)
Definition: mtypes.h:57
static void stipple_polygon_span(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:470
#define FloatToFixed(X)
Definition: s_context.h:398
GLint _Ymin
Definition: mtypes.h:1403
GLfloat attrStepX[FRAG_ATTRIB_MAX][4]
Definition: s_span.h:133
void _swrast_fog_rgba_span(const struct gl_context *ctx, SWspan *span)
Definition: s_fog.c:125
gl_pack_ubyte_rgba_func _mesa_get_pack_ubyte_rgba_function(gl_format format)
Definition: format_pack.c:855
GLboolean _PreferPixelFog
Definition: s_context.h:210
GLuint n
Definition: s_context.h:57
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
GLenum primitive
Definition: s_span.h:123
GLint _Xmin
Definition: mtypes.h:1402
struct gl_framebuffer * DrawBuffer
Definition: mtypes.h:1765
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GLenum GLint GLuint mask
Definition: glext.h:6028
static struct swrast_renderbuffer * swrast_renderbuffer(struct gl_renderbuffer *img)
Definition: s_context.h:181
GLfloat coverage[MAX_WIDTH]
Definition: s_span.h:91
#define MAX2(A, B)
Definition: macros.h:627
void(* gl_pack_float_rgba_func)(const GLfloat src[4], void *dst)
Definition: format_pack.h:36
GLuint color
Definition: glext.h:6243
#define a
Definition: ke_i.h:78
#define CLAMP(f, min, max)
Definition: tif_color.c:179
unsigned char GLboolean
Definition: gl.h:151
GLint _swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
Definition: s_alpha.c:86
#define GL_LINE
Definition: gl.h:266
void _swrast_span_interpolate_z(const struct gl_context *ctx, SWspan *span)
Definition: s_span.c:280
#define F(i)
Definition: internal.h:87
GLdouble GLdouble z
Definition: glext.h:5874
const GLfloat * tc
Definition: glext.h:8925
smooth NULL
Definition: ftsmooth.c:557
static void interpolate_int_colors(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:181
GLboolean writeAll
Definition: s_span.h:120
#define LOG2(x)
Definition: imports.h:203
#define ACOMP
Definition: internal.h:80
#define FixedToInt(X)
Definition: s_context.h:401
void _mesa_pack_float_rgba_row(gl_format format, GLuint n, const GLfloat src[][4], void *dst)
Definition: format_pack.c:1072
GLfixed green
Definition: s_span.h:142
GLbitfield arrayMask
Definition: s_span.h:153
struct gl_colorbuffer_attrib Color
Definition: mtypes.h:1817
gl_pack_float_rgba_func _mesa_get_pack_float_rgba_function(gl_format format)
Definition: format_pack.c:931
void _mesa_problem(const struct gl_context *ctx, const char *fmtString,...)
Definition: imports.c:798
GLfixed alpha
Definition: s_span.h:144
#define b
Definition: ke_i.h:79
GLfixed blue
Definition: s_span.h:143
float GLfloat
Definition: gl.h:161
void(* gl_pack_ubyte_rgba_func)(const GLubyte src[4], void *dst)
Definition: format_pack.h:33
#define ASSIGN_4V(V, V0, V1, V2, V3)
Definition: macros.h:345
GLint x
Definition: s_span.h:111
struct gl_texture_attrib Texture
Definition: mtypes.h:1833
void _mesa_unpack_rgba_row(gl_format format, GLuint n, const void *src, GLfloat dst[][4])
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLfloat _swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
Definition: s_fog.c:31
GLushort rgba16[MAX_WIDTH][4]
Definition: s_span.h:84
#define SPAN_RGBA
Definition: s_span.h:50
void _swrast_write_rgba_span(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:835
void _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:41
static GLubyte * _swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y)
Definition: s_context.h:442
GLint BaseLevel
Definition: mtypes.h:962
GLint GLvoid * img
Definition: gl.h:1956
GLenum GLuint texture
Definition: glext.h:6295
#define GL_LUMINANCE_ALPHA
Definition: gl.h:485
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
GLbitfield64 arrayAttribs
Definition: s_span.h:156
GLboolean _swrast_depth_bounds_test(struct gl_context *ctx, SWspan *span)
Definition: s_depth.c:349
unsigned short GLushort
Definition: gl.h:158
#define GL_POINT
Definition: gl.h:265
void swrast
Definition: s_aatritemp.h:63
#define GCOMP
Definition: internal.h:78
GLuint index[MAX_WIDTH]
Definition: s_span.h:89
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void apply_aa_coverage(SWspan *span)
Definition: s_span.c:641
Definition: cookie.c:158
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
static const struct swrast_texture_image * swrast_texture_image_const(const struct gl_texture_image *img)
Definition: s_context.h:154
#define COPY_4UBV(DST, SRC)
Definition: fxt1.c:53
void _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span)
Definition: s_masking.c:35
#define GL_RGB
Definition: gl.h:502
__u8 attr
Definition: mkdosfs.c:359
struct gl_sampler_object Sampler
Definition: mtypes.h:959
GLfixed greenStep
Definition: s_span.h:142
void _mesa_unpack_ubyte_rgba_row(gl_format format, GLuint n, const void *src, GLubyte dst[][4])
void _swrast_read_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLvoid *rgba)
Definition: s_span.c:1063
GLfixed blueStep
Definition: s_span.h:143
GLdouble s
Definition: gl.h:2039
#define ATTRIB_LOOP_END
Definition: s_context.h:435
GLubyte mask[MAX_WIDTH]
Definition: s_span.h:77
GLfixed z
Definition: s_span.h:146
GLuint Width
Definition: mtypes.h:1345
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
GLchan(* rgba)[4]
Definition: s_span.h:85
#define SPAN_MASK
Definition: s_span.h:54
void * _swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span)
Definition: s_span.c:1223
void _swrast_texture_span(struct gl_context *ctx, SWspan *span)
Definition: s_texcombine.c:540
#define SPAN_FLAT
Definition: s_span.h:52
#define SPAN_COVERAGE
Definition: s_span.h:56
unsigned char GLubyte
Definition: gl.h:157
GLfloat lambda[MAX_WIDTH]
Definition: s_span.h:90
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLuint PolygonStipple[32]
Definition: mtypes.h:1830
static GLuint clip_span(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:515
#define GL_LUMINANCE
Definition: gl.h:484
const GLfloat * m
Definition: glext.h:10848
GLuint Height
Definition: mtypes.h:1345
struct gl_depthbuffer_attrib Depth
Definition: mtypes.h:1819
#define FixedToChan(X)
Definition: s_context.h:418
unsigned int GLuint
Definition: gl.h:159
static void put_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum datatype, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask)
Definition: s_span.c:740
struct gl_renderbuffer * _ColorDrawBuffer
Definition: mtypes.h:1428
GLboolean _swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span)
Definition: s_stencil.c:336
#define GL_TRUE
Definition: gl.h:174
#define skip(...)
Definition: CString.cpp:57
struct gl_stencil_attrib Stencil
Definition: mtypes.h:1832
SWspanarrays * array
Definition: s_span.h:164
GLint y
Definition: s_span.h:111
static void interpolate_texcoords(struct gl_context *ctx, SWspan *span)
Definition: s_span.c:370
GLuint const GLubyte GLvoid const GLvoid * dst
Definition: s_context.h:57
#define GL_LINEAR_MIPMAP_LINEAR
Definition: gl.h:670
unsigned int GLbitfield
Definition: gl.h:152
#define GL_POLYGON
Definition: gl.h:199
#define SPAN_XY
Definition: s_span.h:53
GLint y[MAX_WIDTH]
Definition: s_span.h:87
static void get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, GLvoid *values, GLenum type)
Definition: s_span.c:1175
#define SPAN_Z
Definition: s_span.h:51
struct gl_config Visual
Definition: mtypes.h:1394
GLint _Xmax
Definition: mtypes.h:1402
#define MIN2(A, B)
Definition: macros.h:624
DWORD bpp
Definition: surface.c:174
#define GL_RGBA
Definition: gl.h:503
Per-context state that's private to the software rasterizer module.
Definition: s_context.h:192
GLuint _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
Definition: s_depth.c:221
GLenum GLenum GLvoid GLvoid GLvoid * span
Definition: glext.h:5664
void _swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span)
Definition: s_blend.c:660
#define SQRTF(X)
Definition: imports.h:105
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint leftClip
Definition: s_span.h:117
GLuint64 GLbitfield64
Definition: mtypes.h:54
GLuint end
Definition: s_span.h:114
GLboolean _DeferredTexture
Definition: s_context.h:213
INT INT y
Definition: msvc.h:62
#define memset(x, y, z)
Definition: compat.h:39
#define SHIFT_ARRAY(ARRAY, SHIFT, LEN)
GLfloat GLfloat v1
Definition: glext.h:6062
#define SPAN_LAMBDA
Definition: s_span.h:55
#define GL_INTENSITY
Definition: gl.h:747
int k
Definition: mpi.c:3369
GLubyte rgba8[MAX_WIDTH][4]
Definition: s_span.h:83
void _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, const GLubyte src[][4], void *dst)
Definition: format_pack.c:1103
#define COPY_4V(DST, SRC)
Definition: macros.h:210
const GLint const GLsizei GLint
Definition: dispatch.h:5271
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:76
INT x
Definition: msvc.h:62
GLfixed alphaStep
Definition: s_span.h:144