~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/swrast/s_triangle.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Mesa 3-D graphics library
3
 
 * Version:  6.5
 
3
 * Version:  6.5.2
4
4
 *
5
5
 * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
6
6
 *
163
163
 
164
164
#define RENDER_SPAN( span )                                             \
165
165
   GLuint i;                                                            \
 
166
   GLchan rgb[MAX_WIDTH][3];                                            \
166
167
   span.intTex[0] -= FIXED_HALF; /* off-by-one error? */                \
167
168
   span.intTex[1] -= FIXED_HALF;                                        \
168
169
   for (i = 0; i < span.end; i++) {                                     \
170
171
      GLint t = FixedToInt(span.intTex[1]) & tmask;                     \
171
172
      GLint pos = (t << twidth_log2) + s;                               \
172
173
      pos = pos + pos + pos;  /* multiply by 3 */                       \
173
 
      span.array->rgb[i][RCOMP] = texture[pos];                         \
174
 
      span.array->rgb[i][GCOMP] = texture[pos+1];                       \
175
 
      span.array->rgb[i][BCOMP] = texture[pos+2];                       \
 
174
      rgb[i][RCOMP] = texture[pos];                                     \
 
175
      rgb[i][GCOMP] = texture[pos+1];                                   \
 
176
      rgb[i][BCOMP] = texture[pos+2];                                   \
176
177
      span.intTex[0] += span.intTexStep[0];                             \
177
178
      span.intTex[1] += span.intTexStep[1];                             \
178
179
   }                                                                    \
179
 
   rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL);
 
180
   rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, NULL);
180
181
 
181
182
#include "s_tritemp.h"
182
183
 
214
215
 
215
216
#define RENDER_SPAN( span )                                             \
216
217
   GLuint i;                                                            \
 
218
   GLchan rgb[MAX_WIDTH][3];                                            \
217
219
   span.intTex[0] -= FIXED_HALF; /* off-by-one error? */                \
218
220
   span.intTex[1] -= FIXED_HALF;                                        \
219
221
   for (i = 0; i < span.end; i++) {                                     \
223
225
         GLint t = FixedToInt(span.intTex[1]) & tmask;                  \
224
226
         GLint pos = (t << twidth_log2) + s;                            \
225
227
         pos = pos + pos + pos;  /* multiply by 3 */                    \
226
 
         span.array->rgb[i][RCOMP] = texture[pos];                      \
227
 
         span.array->rgb[i][GCOMP] = texture[pos+1];                    \
228
 
         span.array->rgb[i][BCOMP] = texture[pos+2];                    \
 
228
         rgb[i][RCOMP] = texture[pos];                                  \
 
229
         rgb[i][GCOMP] = texture[pos+1];                                \
 
230
         rgb[i][BCOMP] = texture[pos+2];                                \
229
231
         zRow[i] = z;                                                   \
230
232
         span.array->mask[i] = 1;                                       \
231
233
      }                                                                 \
236
238
      span.intTex[1] += span.intTexStep[1];                             \
237
239
      span.z += span.zStep;                                             \
238
240
   }                                                                    \
239
 
   rb->PutRowRGB(ctx, rb, span.end, span.x, span.y,                     \
240
 
                 span.array->rgb, span.array->mask);
 
241
   rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, rgb, span.array->mask);
241
242
 
242
243
#include "s_tritemp.h"
243
244
 
278
279
 * texture env modes.
279
280
 */
280
281
static INLINE void
281
 
affine_span(GLcontext *ctx, struct sw_span *span,
 
282
affine_span(GLcontext *ctx, SWspan *span,
282
283
            struct affine_info *info)
283
284
{
284
285
   GLchan sample[4];  /* the filtered texture sample */
601
602
 
602
603
 
603
604
static INLINE void
604
 
fast_persp_span(GLcontext *ctx, struct sw_span *span,
 
605
fast_persp_span(GLcontext *ctx, SWspan *span,
605
606
                struct persp_info *info)
606
607
{
607
608
   GLchan sample[4];  /* the filtered texture sample */
1072
1073
         }
1073
1074
      }
1074
1075
 
1075
 
      if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Active ||
 
1076
      if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Enabled ||
1076
1077
          ctx->ATIFragmentShader._Enabled || ctx->ShaderObjects._FragmentShaderPresent) {
1077
1078
         /* Ugh, we do a _lot_ of tests to pick the best textured tri func */
1078
1079
         const struct gl_texture_object *texObj2D;
1088
1089
 
1089
1090
         /* First see if we can use an optimized 2-D texture function */
1090
1091
         if (ctx->Texture._EnabledCoordUnits == 0x1
1091
 
             && !ctx->FragmentProgram._Active
 
1092
             && !ctx->FragmentProgram._Enabled
1092
1093
             && !ctx->ATIFragmentShader._Enabled
1093
1094
             && !ctx->ShaderObjects._FragmentShaderPresent
1094
1095
             && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT