X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_accum.c;h=88d107a17dad3e8bb1ff70a41a9e4b62721b9810;hb=9b66305b8d41a470faac8f8de7dfd99330801385;hp=1d1cdf23d1f8dff986724c290e293de37655a0bd;hpb=0397b2bb41b0f337af2949a15bcd7d0e7e8a7dc1;p=mesa.git diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c index 1d1cdf23d1f..88d107a17da 100644 --- a/src/mesa/swrast/s_accum.c +++ b/src/mesa/swrast/s_accum.c @@ -27,7 +27,6 @@ #include "main/context.h" #include "main/macros.h" #include "main/imports.h" -#include "fbobject.h" #include "s_accum.h" #include "s_context.h" @@ -38,7 +37,7 @@ /* XXX this would have to change for accum buffers with more or less * than 16 bits per color channel. */ -#define ACCUM_SCALE16 32767.0 +#define ACCUM_SCALE16 32767.0F /* @@ -79,7 +78,7 @@ * representing the range[-1, 1]. */ static void -rescale_accum( GLcontext *ctx ) +rescale_accum( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb @@ -126,16 +125,12 @@ rescale_accum( GLcontext *ctx ) * Clear the accumulation Buffer. */ void -_swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) +_swrast_clear_accum_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint x, y, width, height; - if (ctx->Visual.accumRedBits == 0) { - /* No accumulation buffer! Not an error. */ - return; - } - + /* No accumulation buffer! Not an error. */ if (!rb || !rb->Data) return; @@ -184,7 +179,7 @@ _swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) static void -accum_add(GLcontext *ctx, GLfloat value, +accum_add(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -227,7 +222,7 @@ accum_add(GLcontext *ctx, GLfloat value, static void -accum_mult(GLcontext *ctx, GLfloat mult, +accum_mult(struct gl_context *ctx, GLfloat mult, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -270,7 +265,7 @@ accum_mult(GLcontext *ctx, GLfloat mult, static void -accum_accum(GLcontext *ctx, GLfloat value, +accum_accum(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -346,7 +341,7 @@ accum_accum(GLcontext *ctx, GLfloat value, static void -accum_load(GLcontext *ctx, GLfloat value, +accum_load(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -428,7 +423,7 @@ accum_load(GLcontext *ctx, GLfloat value, static void -accum_return(GLcontext *ctx, GLfloat value, +accum_return(struct gl_context *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -436,10 +431,6 @@ accum_return(GLcontext *ctx, GLfloat value, struct gl_renderbuffer *accumRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer; const GLboolean directAccess = (accumRb->GetPointer(ctx, accumRb, 0, 0) != NULL); - const GLboolean masking = (!ctx->Color.ColorMask[RCOMP] || - !ctx->Color.ColorMask[GCOMP] || - !ctx->Color.ColorMask[BCOMP] || - !ctx->Color.ColorMask[ACOMP]); static GLchan multTable[32768]; static GLfloat prevMult = 0.0; @@ -527,8 +518,12 @@ accum_return(GLcontext *ctx, GLfloat value, /* store colors */ for (buffer = 0; buffer < fb->_NumColorDrawBuffers; buffer++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buffer]; + const GLboolean masking = (!ctx->Color.ColorMask[buffer][RCOMP] || + !ctx->Color.ColorMask[buffer][GCOMP] || + !ctx->Color.ColorMask[buffer][BCOMP] || + !ctx->Color.ColorMask[buffer][ACOMP]); if (masking) { - _swrast_mask_rgba_span(ctx, rb, &span); + _swrast_mask_rgba_span(ctx, rb, &span, buffer); } rb->PutRow(ctx, rb, width, xpos, ypos + i, span.array->rgba, NULL); } @@ -545,12 +540,12 @@ accum_return(GLcontext *ctx, GLfloat value, * Software fallback for glAccum. */ void -_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value) +_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint xpos, ypos, width, height; - if (SWRAST_CONTEXT(ctx)->NewState) + if (swrast->NewState) _swrast_validate_derived( ctx ); if (!ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer) { @@ -558,9 +553,9 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value) return; } - RENDER_START(swrast, ctx); + swrast_render_start(ctx); - /* Compute region after calling RENDER_START so that we know the + /* Compute region after calling swrast_render_start() so that we know the * drawbuffer's size/bounds are up to date. */ xpos = ctx->DrawBuffer->_Xmin; @@ -595,5 +590,5 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value) break; } - RENDER_FINISH(swrast, ctx); + swrast_render_finish(ctx); }