mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
swrast: define, use SWRAST_MAX_WIDTH/HEIGHT
We'll get rid of MAX_WIDTH, MAX_HEIGHT soon.
This commit is contained in:
parent
b5d096ac1a
commit
47d88ef204
16 changed files with 55 additions and 46 deletions
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue