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

« back to all changes in this revision

Viewing changes to src/mesa/swrast/s_context.h

  • 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
 *
49
49
 
50
50
/**
51
51
 * \defgroup SpanFlags SPAN_XXX-flags
52
 
 * Bitmasks to indicate which span_arrays need to be computed
 
52
 * Bitmasks to indicate which sw_span_arrays need to be computed
53
53
 * (sw_span::interpMask) or have already been filled in (sw_span::arrayMask)
54
54
 */
55
55
/*@{*/
69
69
#define SPAN_VARYING     0x2000
70
70
/*@}*/
71
71
 
 
72
#if 0
 
73
/* alternate arrangement for code below */
 
74
struct arrays2 {
 
75
   union {
 
76
      GLubyte  sz1[MAX_WIDTH][4]; /* primary color */
 
77
      GLushort sz2[MAX_WIDTH][4];
 
78
      GLfloat  sz4[MAX_WIDTH][4];
 
79
   } rgba;
 
80
   union {
 
81
      GLubyte  sz1[MAX_WIDTH][4]; /* specular color and temp storage */
 
82
      GLushort sz2[MAX_WIDTH][4];
 
83
      GLfloat  sz4[MAX_WIDTH][4];
 
84
   } spec;
 
85
};
 
86
#endif
 
87
 
72
88
 
73
89
/**
74
 
 * \struct span_arrays 
 
90
 * \sw_span_arrays 
75
91
 * \brief Arrays of fragment values.
76
92
 *
77
93
 * These will either be computed from the x/xStep values above or
78
94
 * filled in by glDraw/CopyPixels, etc.
79
95
 * These arrays are separated out of sw_span to conserve memory.
80
96
 */
81
 
struct span_arrays {
82
 
   /* XXX the next three fields could go into a union */
83
 
   GLchan  rgb[MAX_WIDTH][3];
84
 
   GLchan  rgba[MAX_WIDTH][4];
 
97
typedef struct sw_span_arrays {
 
98
   GLenum ChanType; /**< Color channel type, GL_UNSIGNED_BYTE, GL_FLOAT */
 
99
   union {
 
100
      struct {
 
101
         GLubyte rgba[MAX_WIDTH][4]; /**< primary color */
 
102
         GLubyte spec[MAX_WIDTH][4]; /**< specular color and temp storage */
 
103
      } sz1;
 
104
      struct {
 
105
         GLushort rgba[MAX_WIDTH][4];
 
106
         GLushort spec[MAX_WIDTH][4];
 
107
      } sz2;
 
108
      struct {
 
109
         GLfloat rgba[MAX_WIDTH][4];
 
110
         GLfloat spec[MAX_WIDTH][4];
 
111
      } sz4;
 
112
   } color;
 
113
   /** XXX these are temporary fields, pointing into above color arrays */
 
114
   GLchan (*rgba)[4];
 
115
   GLchan (*spec)[4];
 
116
 
85
117
   GLuint  index[MAX_WIDTH];
86
 
   GLchan  spec[MAX_WIDTH][4]; /* specular color */
87
118
   GLint   x[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
88
119
   GLint   y[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
89
120
   GLuint  z[MAX_WIDTH];
95
126
 
96
127
   /** This mask indicates which fragments are alive or culled */
97
128
   GLubyte mask[MAX_WIDTH];
98
 
};
 
129
} SWspanarrays;
99
130
 
100
131
 
101
132
/**
102
 
 * \struct sw_span
 
133
 * \SWspan
103
134
 * \brief Contains data for either a horizontal line or a set of
104
135
 * pixels that are passed through a pipeline of functions before being
105
136
 * drawn.
120
151
 * stream of these structures which would be consumed by one or more
121
152
 * span-processing threads which could run in parallel.
122
153
 */
123
 
struct sw_span {
 
154
typedef struct sw_span {
124
155
   GLint x, y;
125
156
 
126
157
   /** Only need to process pixels between start <= i < end */
197
228
    * a lot of memory.  The span_arrays struct is about 400KB while the
198
229
    * sw_span struct is only about 512 bytes.
199
230
    */
200
 
   struct span_arrays *array;
201
 
};
 
231
   SWspanarrays *array;
 
232
} SWspan;
 
233
 
202
234
 
203
235
 
204
236
#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK)   \
220
252
 
221
253
typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n,
222
254
                                    const GLubyte mask[],
223
 
                                    GLchan src[][4], CONST GLchan dst[][4] );
 
255
                                    GLvoid *src, const GLvoid *dst,
 
256
                                    GLenum chanType);
224
257
 
225
258
typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *);
226
259
 
272
305
 
273
306
/**
274
307
 * \struct SWcontext
275
 
 * \brief SWContext?
 
308
 * \brief  Per-context state that's private to the software rasterizer module.
276
309
 */
277
310
typedef struct
278
311
{
293
326
   GLfloat _BackfaceSign;
294
327
   GLboolean _PreferPixelFog;    /* Compute fog blend factor per fragment? */
295
328
   GLboolean _AnyTextureCombine;
296
 
   GLchan _FogColor[3];
297
329
   GLboolean _FogEnabled;
298
330
   GLenum _FogMode;  /* either GL_FOG_MODE or fragment program's fog mode */
299
331
 
356
388
    * this object is big and causes problems when allocated on the stack
357
389
    * on some systems.
358
390
    */
359
 
   struct span_arrays *SpanArrays;
 
391
   SWspanarrays *SpanArrays;
360
392
 
361
393
   /**
362
394
    * Used to buffer N GL_POINTS, instead of rendering one by one.
363
395
    */
364
 
   struct sw_span PointSpan;
 
396
   SWspan PointSpan;
365
397
 
366
398
   /** Internal hooks, kept up to date by the same mechanism as above.
367
399
    */
400
432
 
401
433
 
402
434
 
 
435
/**
 
436
 * Size of an RGBA pixel, in bytes, for given datatype.
 
437
 */
 
438
#define RGBA_PIXEL_SIZE(TYPE)                                     \
 
439
         ((TYPE == GL_UNSIGNED_BYTE) ? 4 * sizeof(GLubyte) :      \
 
440
          ((TYPE == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort)     \
 
441
           : 4 * sizeof(GLfloat)))
 
442
 
 
443
 
 
444
 
403
445
/*
404
446
 * XXX these macros are just bandages for now in order to make
405
447
 * CHAN_BITS==32 compile cleanly.