summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-20 11:07:00 -0700
committerBrian Paul <[email protected]>2012-02-24 08:03:08 -0700
commit47d88ef204b42a9220c6be3e98c92df9c9aa0860 (patch)
treedb21898e4a2d49e47f05593547babf4776c233c6
parentb5d096ac1ac075380d597133a484446afaa3571b (diff)
swrast: define, use SWRAST_MAX_WIDTH/HEIGHT
We'll get rid of MAX_WIDTH, MAX_HEIGHT soon.
-rw-r--r--src/mesa/swrast/s_aalinetemp.h2
-rw-r--r--src/mesa/swrast/s_aatritemp.h2
-rw-r--r--src/mesa/swrast/s_bitmap.c2
-rw-r--r--src/mesa/swrast/s_blend.c2
-rw-r--r--src/mesa/swrast/s_context.c20
-rw-r--r--src/mesa/swrast/s_copypix.c2
-rw-r--r--src/mesa/swrast/s_drawpix.c14
-rw-r--r--src/mesa/swrast/s_lines.c2
-rw-r--r--src/mesa/swrast/s_logic.c2
-rw-r--r--src/mesa/swrast/s_masking.c2
-rw-r--r--src/mesa/swrast/s_points.c6
-rw-r--r--src/mesa/swrast/s_span.c2
-rw-r--r--src/mesa/swrast/s_span.h21
-rw-r--r--src/mesa/swrast/s_texcombine.c8
-rw-r--r--src/mesa/swrast/s_zoom.c6
-rw-r--r--src/mesa/swrast/swrast.h8
16 files changed, 55 insertions, 46 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index ba9f8abb9c3..a517fb69732 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -91,7 +91,7 @@ NAME(plot)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy)
ATTRIB_LOOP_END
#endif
- if (line->span.end == MAX_WIDTH) {
+ if (line->span.end == SWRAST_MAX_WIDTH) {
_swrast_write_rgba_span(ctx, &(line->span));
line->span.end = 0; /* reset counter */
}
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 77b3ae6ec7a..9cdb35fd29d 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -196,7 +196,7 @@
span.array = SWRAST_CONTEXT(ctx)->SpanArrays + omp_get_thread_num();
#endif
/* skip over fragments with zero coverage */
- while (startX < MAX_WIDTH) {
+ while (startX < SWRAST_MAX_WIDTH) {
coverage = compute_coveragef(pMin, pMid, pMax, startX, iy);
if (coverage > 0.0F)
break;
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 18f1c1866bf..3a279291392 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -123,7 +123,7 @@ _swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py,
src++;
}
- if (count + width >= MAX_WIDTH || row + 1 == height) {
+ if (count + width >= SWRAST_MAX_WIDTH || row + 1 == height) {
/* flush the span */
span.end = count;
_swrast_write_rgba_span(ctx, &span);
diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c
index cd6e6f03602..54fffbb45a8 100644
--- a/src/mesa/swrast/s_blend.c
+++ b/src/mesa/swrast/s_blend.c
@@ -998,7 +998,7 @@ _swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *s
SWcontext *swrast = SWRAST_CONTEXT(ctx);
void *rbPixels;
- ASSERT(span->end <= MAX_WIDTH);
+ ASSERT(span->end <= SWRAST_MAX_WIDTH);
ASSERT(span->arrayMask & SPAN_RGBA);
ASSERT(!ctx->Color.ColorLogicOpEnabled);
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 49aa1d78884..d00a6a7ead6 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -726,13 +726,13 @@ _swrast_CreateContext( struct gl_context *ctx )
const GLuint maxThreads = 1;
#endif
- assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
- assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
+ assert(ctx->Const.MaxViewportWidth <= SWRAST_MAX_WIDTH);
+ assert(ctx->Const.MaxViewportHeight <= SWRAST_MAX_WIDTH);
- /* make sure largest texture image is <= MAX_WIDTH in size */
- assert((1 << (ctx->Const.MaxTextureLevels - 1)) <= MAX_WIDTH);
- assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= MAX_WIDTH);
- assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= MAX_WIDTH);
+ /* make sure largest texture image is <= SWRAST_MAX_WIDTH in size */
+ assert((1 << (ctx->Const.MaxTextureLevels - 1)) <= SWRAST_MAX_WIDTH);
+ assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= SWRAST_MAX_WIDTH);
+ assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= SWRAST_MAX_WIDTH);
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_CreateContext\n");
@@ -798,10 +798,10 @@ _swrast_CreateContext( struct gl_context *ctx )
ctx->swrast_context = swrast;
- swrast->stencil_temp.buf1 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf2 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf3 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte));
- swrast->stencil_temp.buf4 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf1 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf2 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf3 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+ swrast->stencil_temp.buf4 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
if (!swrast->stencil_temp.buf1 ||
!swrast->stencil_temp.buf2 ||
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 780f5fae0a7..cf419c328d6 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -158,7 +158,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
p = NULL;
}
- ASSERT(width < MAX_WIDTH);
+ ASSERT(width < SWRAST_MAX_WIDTH);
for (row = 0; row < height; row++, sy += stepy, dy += stepy) {
GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0];
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index cff0bb37e72..1fa64c37829 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -319,7 +319,7 @@ draw_depth_pixels( struct gl_context *ctx, GLint x, GLint y,
&& ctx->DrawBuffer->Visual.depthBits == 16
&& !scaleOrBias
&& !zoom
- && width <= MAX_WIDTH
+ && width <= SWRAST_MAX_WIDTH
&& !unpack->SwapBytes) {
/* Special case: directly write 16-bit depth values */
GLint row;
@@ -339,7 +339,7 @@ draw_depth_pixels( struct gl_context *ctx, GLint x, GLint y,
else if (type == GL_UNSIGNED_INT
&& !scaleOrBias
&& !zoom
- && width <= MAX_WIDTH
+ && width <= SWRAST_MAX_WIDTH
&& !unpack->SwapBytes) {
/* Special case: shift 32-bit values down to Visual.depthBits */
const GLint shift = 32 - ctx->DrawBuffer->Visual.depthBits;
@@ -367,11 +367,11 @@ draw_depth_pixels( struct gl_context *ctx, GLint x, GLint y,
const GLuint depthMax = ctx->DrawBuffer->_DepthMax;
GLint skipPixels = 0;
- /* in case width > MAX_WIDTH do the copy in chunks */
+ /* in case width > SWRAST_MAX_WIDTH do the copy in chunks */
while (skipPixels < width) {
- const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH);
+ const GLint spanWidth = MIN2(width - skipPixels, SWRAST_MAX_WIDTH);
GLint row;
- ASSERT(span.end <= MAX_WIDTH);
+ ASSERT(span.end <= SWRAST_MAX_WIDTH);
for (row = 0; row < height; row++) {
const GLvoid *zSrc = _mesa_image_address2d(unpack,
pixels, width, height,
@@ -453,9 +453,9 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
/* use span array for temp color storage */
GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0];
- /* if the span is wider than MAX_WIDTH we have to do it in chunks */
+ /* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */
while (skipPixels < width) {
- const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH);
+ const GLint spanWidth = MIN2(width - skipPixels, SWRAST_MAX_WIDTH);
const GLubyte *source
= (const GLubyte *) _mesa_image_address2d(unpack, pixels,
width, height, format,
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index ee997b08a7b..2078be43b44 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -67,7 +67,7 @@ draw_wide_line( struct gl_context *ctx, SWspan *span, GLboolean xMajor )
ctx->Const.MaxLineWidth);
GLint start;
- ASSERT(span->end < MAX_WIDTH);
+ ASSERT(span->end < SWRAST_MAX_WIDTH);
if (width & 1)
start = width / 2;
diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c
index e908a0efeb0..8791630a43b 100644
--- a/src/mesa/swrast/s_logic.c
+++ b/src/mesa/swrast/s_logic.c
@@ -193,7 +193,7 @@ _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
{
void *rbPixels;
- ASSERT(span->end < MAX_WIDTH);
+ ASSERT(span->end < SWRAST_MAX_WIDTH);
ASSERT(span->arrayMask & SPAN_RGBA);
rbPixels = _swrast_get_dest_rgba(ctx, rb, span);
diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c
index 2d962ebc5c3..4f262fa976b 100644
--- a/src/mesa/swrast/s_masking.c
+++ b/src/mesa/swrast/s_masking.c
@@ -46,7 +46,7 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
const GLuint n = span->end;
void *rbPixels;
- ASSERT(n < MAX_WIDTH);
+ ASSERT(n < SWRAST_MAX_WIDTH);
ASSERT(span->arrayMask & SPAN_RGBA);
rbPixels = _swrast_get_dest_rgba(ctx, rb, span);
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 11b7ef7b1f8..acbdb2d42dd 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -439,7 +439,7 @@ large_point(struct gl_context *ctx, const SWvertex *vert)
span.end++;
}
}
- assert(span.end <= MAX_WIDTH);
+ assert(span.end <= SWRAST_MAX_WIDTH);
_swrast_write_rgba_span(ctx, &span);
}
}
@@ -475,7 +475,7 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert)
span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
/* check if we need to flush */
- if (span->end >= MAX_WIDTH ||
+ if (span->end >= SWRAST_MAX_WIDTH ||
(swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT)) ||
span->facing != swrast->PointLineFacing) {
if (span->end > 0) {
@@ -504,7 +504,7 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert)
span->array->z[count] = (GLint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F);
span->end = count + 1;
- ASSERT(span->end <= MAX_WIDTH);
+ ASSERT(span->end <= SWRAST_MAX_WIDTH);
}
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 5cdb8ed23c8..627ef1136aa 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1164,7 +1164,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
return;
}
- ASSERT(span->end <= MAX_WIDTH);
+ ASSERT(span->end <= SWRAST_MAX_WIDTH);
/* Depth bounds test */
if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index ff0fe6cd94c..0763c7161b9 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -32,6 +32,7 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "swrast/s_chan.h"
+#include "swrast/swrast.h"
struct gl_context;
@@ -71,24 +72,24 @@ typedef struct sw_span_arrays
/* XXX someday look at transposing first two indexes for better memory
* access pattern.
*/
- GLfloat attribs[FRAG_ATTRIB_MAX][MAX_WIDTH][4];
+ GLfloat attribs[FRAG_ATTRIB_MAX][SWRAST_MAX_WIDTH][4];
/** This mask indicates which fragments are alive or culled */
- GLubyte mask[MAX_WIDTH];
+ GLubyte mask[SWRAST_MAX_WIDTH];
GLenum ChanType; /**< Color channel type, GL_UNSIGNED_BYTE, GL_FLOAT */
/** Attribute arrays that don't fit into attribs[] array above */
/*@{*/
- GLubyte rgba8[MAX_WIDTH][4];
- GLushort rgba16[MAX_WIDTH][4];
+ GLubyte rgba8[SWRAST_MAX_WIDTH][4];
+ GLushort rgba16[SWRAST_MAX_WIDTH][4];
GLchan (*rgba)[4]; /** either == rgba8 or rgba16 */
- GLint x[MAX_WIDTH]; /**< fragment X coords */
- GLint y[MAX_WIDTH]; /**< fragment Y coords */
- GLuint z[MAX_WIDTH]; /**< fragment Z coords */
- GLuint index[MAX_WIDTH]; /**< Color indexes */
- GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH]; /**< Texture LOD */
- GLfloat coverage[MAX_WIDTH]; /**< Fragment coverage for AA/smoothing */
+ GLint x[SWRAST_MAX_WIDTH]; /**< fragment X coords */
+ GLint y[SWRAST_MAX_WIDTH]; /**< fragment Y coords */
+ GLuint z[SWRAST_MAX_WIDTH]; /**< fragment Z coords */
+ GLuint index[SWRAST_MAX_WIDTH]; /**< Color indexes */
+ GLfloat lambda[MAX_TEXTURE_COORD_UNITS][SWRAST_MAX_WIDTH]; /**< Texture LOD */
+ GLfloat coverage[SWRAST_MAX_WIDTH]; /**< Fragment coverage for AA/smoothing */
/*@}*/
} SWspanarrays;
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 1fce5c56562..8fbf988b415 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -49,9 +49,9 @@ static inline float4_array
get_texel_array(SWcontext *swrast, GLuint unit)
{
#ifdef _OPENMP
- return (float4_array) (swrast->TexelBuffer + unit * MAX_WIDTH * 4 * omp_get_num_threads() + (MAX_WIDTH * 4 * omp_get_thread_num()));
+ return (float4_array) (swrast->TexelBuffer + unit * SWRAST_MAX_WIDTH * 4 * omp_get_num_threads() + (SWRAST_MAX_WIDTH * 4 * omp_get_thread_num()));
#else
- return (float4_array) (swrast->TexelBuffer + unit * MAX_WIDTH * 4);
+ return (float4_array) (swrast->TexelBuffer + unit * SWRAST_MAX_WIDTH * 4);
#endif
}
@@ -611,7 +611,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
*/
swrast->TexelBuffer =
(GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits * maxThreads *
- MAX_WIDTH * 4 * sizeof(GLfloat));
+ SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat));
if (!swrast->TexelBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
return;
@@ -625,7 +625,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
return;
}
- ASSERT(span->end <= MAX_WIDTH);
+ ASSERT(span->end <= SWRAST_MAX_WIDTH);
/*
* Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 3a0e0b626d1..768bbbafd9b 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -150,7 +150,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
zoomedWidth = x1 - x0;
ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= MAX_WIDTH);
+ ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
/* no pixel arrays! must be horizontal spans. */
ASSERT((span->arrayMask & SPAN_XY) == 0);
@@ -373,7 +373,7 @@ _swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY
zoomedWidth = x1 - x0;
ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= MAX_WIDTH);
+ ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
zoomedVals = (GLubyte *) malloc(zoomedWidth * sizeof(GLubyte));
if (!zoomedVals)
@@ -418,7 +418,7 @@ _swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
zoomedWidth = x1 - x0;
ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= MAX_WIDTH);
+ ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
zoomedVals = (GLuint *) malloc(zoomedWidth * sizeof(GLuint));
if (!zoomedVals)
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index ad19eeeccd8..15b07ed0d55 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -35,6 +35,14 @@
#include "main/mtypes.h"
#include "swrast/s_chan.h"
+
+/**
+ * Max image/surface/texture size.
+ */
+#define SWRAST_MAX_WIDTH 16384
+#define SWRAST_MAX_HEIGHT 16384
+
+
/**
* \struct SWvertex
* \brief Data-structure to handle vertices in the software rasterizer.