We'll get rid of MAX_WIDTH, MAX_HEIGHT soon.
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 */
}
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;
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);
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);
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");
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 ||
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];
&& 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;
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;
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,
/* 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,
ctx->Const.MaxLineWidth);
GLint start;
- ASSERT(span->end < MAX_WIDTH);
+ ASSERT(span->end < SWRAST_MAX_WIDTH);
if (width & 1)
start = width / 2;
{
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);
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);
span.end++;
}
}
- assert(span.end <= MAX_WIDTH);
+ assert(span.end <= SWRAST_MAX_WIDTH);
_swrast_write_rgba_span(ctx, &span);
}
}
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) {
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);
}
return;
}
- ASSERT(span->end <= MAX_WIDTH);
+ ASSERT(span->end <= SWRAST_MAX_WIDTH);
/* Depth bounds test */
if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
#include "main/glheader.h"
#include "main/mtypes.h"
#include "swrast/s_chan.h"
+#include "swrast/swrast.h"
struct gl_context;
/* 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;
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
}
*/
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;
return;
}
- ASSERT(span->end <= MAX_WIDTH);
+ ASSERT(span->end <= SWRAST_MAX_WIDTH);
/*
* Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
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);
zoomedWidth = x1 - x0;
ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= MAX_WIDTH);
+ ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
zoomedVals = (GLubyte *) malloc(zoomedWidth * sizeof(GLubyte));
if (!zoomedVals)
zoomedWidth = x1 - x0;
ASSERT(zoomedWidth > 0);
- ASSERT(zoomedWidth <= MAX_WIDTH);
+ ASSERT(zoomedWidth <= SWRAST_MAX_WIDTH);
zoomedVals = (GLuint *) malloc(zoomedWidth * sizeof(GLuint));
if (!zoomedVals)
#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.