diff options
author | Brian <[email protected]> | 2008-01-06 10:43:20 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2008-01-06 10:43:20 -0700 |
commit | ff73c783cc47361ff0dd819c82d067b4b85870dd (patch) | |
tree | 07706ff913e0db3164ab62eba430938f72efae85 /src/mesa/drivers | |
parent | 9f6022d0567dc1288888212d7128acc48795b306 (diff) |
Simplify ctx->_NumColorDrawBuffers, _ColorDrawBuffers and fix bug 13835.
These fields are no longer indexed by shader output. Now, we just have
a simple array of renderbuffer pointers.
If the shader writes to gl_FragData[i], send those colors to the N
_ColorDrawBuffers. Otherwise, replicate the single gl_FragColor (or
the fixed-function color) to the N _ColorDrawBuffers.
A few more changes and simplifications can follow from this...
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fallback.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_sf_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffers.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_span.c | 27 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_driver.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_fbo.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_pixel.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_span.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_line.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 4 |
13 files changed, 40 insertions, 47 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c index 4bcc9af2b60..d1ca11dec4f 100644 --- a/src/mesa/drivers/dri/i915/intel_state.c +++ b/src/mesa/drivers/dri/i915/intel_state.c @@ -234,7 +234,7 @@ intelCalcViewport(GLcontext * ctx) if (ctx->DrawBuffer->Name) { /* User created FBO */ struct intel_renderbuffer *irb - = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]); + = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]); if (irb && !irb->RenderToTexture) { /* y=0=top */ yScale = -1.0; diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index 3c4c60a3eab..58aeeb4228c 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -62,12 +62,9 @@ static GLboolean do_check_fallback(struct brw_context *brw) /* We can only handle a single draw buffer at the moment, and only as the * first color buffer. */ - for (i = 0; i < MAX_DRAW_BUFFERS; i++) { - if (fb->_NumColorDrawBuffers[i] > (i == 0 ? 1 : 0)) { - DBG("FALLBACK: draw buffer %d: 0x%08x\n", - i, ctx->DrawBuffer->_ColorDrawBufferMask[i]); - return GL_TRUE; - } + if (fb->_NumColorDrawBuffers > 1) { + DBG("FALLBACK: multiple color draw buffers\n"); + return GL_TRUE; } /* _NEW_RENDERMODE diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 05c64909495..f083e3148b1 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -43,7 +43,7 @@ static void upload_sf_vp(struct brw_context *brw) const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; struct brw_sf_viewport sfv; struct intel_renderbuffer *irb = - intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]); + intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]); GLfloat y_scale, y_bias; memset(&sfv, 0, sizeof(sfv)); diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 78ffa3c1f84..c654474200b 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -102,7 +102,7 @@ struct intel_region * intel_drawbuf_region(struct intel_context *intel) { struct intel_renderbuffer *irbColor = - intel_renderbuffer(intel->ctx.DrawBuffer->_ColorDrawBuffers[0][0]); + intel_renderbuffer(intel->ctx.DrawBuffer->_ColorDrawBuffers[0]); if (irbColor) return irbColor->region; else @@ -931,7 +931,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) /* * How many color buffers are we drawing into? */ - if (fb->_NumColorDrawBuffers[0] != 1) { + if (fb->_NumColorDrawBuffers != 1) { /* writing to 0 or 2 or 4 color buffers */ /*_mesa_debug(ctx, "Software rendering\n");*/ FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE); @@ -967,7 +967,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) /* drawing to user-created FBO */ struct intel_renderbuffer *irb; intelSetRenderbufferClipRects(intel); - irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]); + irb = intel_renderbuffer(fb->_ColorDrawBuffers[0]); colorRegion = (irb && irb->region) ? irb->region : NULL; } } diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 9ce4a184fd4..298e453c428 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -186,21 +186,18 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map) struct intel_renderbuffer *irb; /* color draw buffers */ - for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { - for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers[i]; j++) { - struct gl_renderbuffer *rb = - ctx->DrawBuffer->_ColorDrawBuffers[i][j]; - irb = intel_renderbuffer(rb); - if (irb) { - /* this is a user-created intel_renderbuffer */ - if (irb->region) { - if (map) - intel_region_map(intel, irb->region); - else - intel_region_unmap(intel, irb->region); - irb->pfMap = irb->region->map; - irb->pfPitch = irb->region->pitch; - } + for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers; j++) { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[j]; + irb = intel_renderbuffer(rb); + if (irb) { + /* this is a user-created intel_renderbuffer */ + if (irb->region) { + if (map) + intel_region_map(intel, irb->region); + else + intel_region_unmap(intel, irb->region); + irb->pfMap = irb->region->map; + irb->pfPitch = irb->region->pitch; } } } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 8b76779002b..1135817fe9a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -149,12 +149,12 @@ static void nouveauClear( GLcontext *ctx, GLbitfield mask ) clear_value = PACK_COLOR_8888(c[3],c[0],c[1],c[2]); if (ctx->DrawBuffer) { - /* FIXME: find correct color buffer, instead of [0][0] */ - if (ctx->DrawBuffer->_ColorDrawBuffers[0][0]) { - color_bits = ctx->DrawBuffer->_ColorDrawBuffers[0][0]->RedBits; - color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0][0]->GreenBits; - color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0][0]->BlueBits; - color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0][0]->AlphaBits; + /* FIXME: find correct color buffer, instead of [0] */ + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + color_bits = ctx->DrawBuffer->_ColorDrawBuffers[0]->RedBits; + color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0]->GreenBits; + color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0]->BlueBits; + color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0]->AlphaBits; } } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index cc3da8b9bde..23525509d14 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -177,8 +177,7 @@ nouveau_window_moved(GLcontext * ctx) nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); nouveau_renderbuffer_t *nrb; - nrb = (nouveau_renderbuffer_t *) - ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + nrb = (nouveau_renderbuffer_t *) ctx->DrawBuffer->_ColorDrawBuffers[0]; if (!nrb) return; @@ -204,7 +203,7 @@ nouveau_build_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) _mesa_update_framebuffer(ctx); _mesa_update_draw_buffer_bounds(ctx); - color[0] = (nouveau_renderbuffer_t *) fb->_ColorDrawBuffers[0][0]; + color[0] = (nouveau_renderbuffer_t *) fb->_ColorDrawBuffers[0]; if (fb->_DepthBuffer && fb->_DepthBuffer->Wrapped) depth = (nouveau_renderbuffer_t *) fb->_DepthBuffer->Wrapped; else diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index e476afa5d82..f1e92d7a7a9 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -813,7 +813,7 @@ static void r128UpdateWindow( GLcontext *ctx ) r128ContextPtr rmesa = R128_CONTEXT(ctx); int x = rmesa->driDrawable->x; int y = rmesa->driDrawable->y; - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; driRenderbuffer *drb = (driRenderbuffer *) rb; rmesa->setup.window_xy_offset = (((y & 0xFFF) << R128_WINDOW_Y_SHIFT) | diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index 2f5aab0744b..db8ceeabe03 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -294,7 +294,7 @@ static void do_draw_pix( GLcontext *ctx, r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; drm_clip_rect_t *box = dPriv->pClipRects; - struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0][0]; + struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0]; driRenderbuffer *drb = (driRenderbuffer *) rb; int nbox = dPriv->numClipRects; int i; @@ -388,7 +388,7 @@ r200TryDrawPixels( GLcontext *ctx, fprintf(stderr, "%s\n", __FUNCTION__); /* check that we're drawing to exactly one color buffer */ - if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1) + if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) return GL_FALSE; switch (format) { diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c index fe427bdcdec..ff2eb011225 100644 --- a/src/mesa/drivers/dri/r200/r200_span.c +++ b/src/mesa/drivers/dri/r200/r200_span.c @@ -255,7 +255,7 @@ static void r200SpanRenderStart( GLcontext *ctx ) { int p; driRenderbuffer *drb = - (driRenderbuffer *) ctx->WinSysDrawBuffer->_ColorDrawBuffers[0][0]; + (driRenderbuffer *) ctx->WinSysDrawBuffer->_ColorDrawBuffers[0]; volatile int *buf = (volatile int *)(rmesa->dri.screen->pFB + drb->offset); p = *buf; diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 4c8bf5f656d..e7d41401f9a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -435,7 +435,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, const GLvoid *pixels ) { const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); if (swrast->NewState) @@ -544,7 +544,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, const GLvoid *pixels ) { struct xmesa_renderbuffer *xrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); const XMesaContext xmesa = XMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; @@ -654,7 +654,7 @@ xmesa_CopyPixels( GLcontext *ctx, struct xmesa_renderbuffer *srcXrb = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); struct xmesa_renderbuffer *dstXrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); ASSERT(dpy); ASSERT(gc); diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index deeae5019c4..7109c439157 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -121,7 +121,7 @@ void xmesa_choose_point( GLcontext *ctx ) #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped) /* @@ -598,7 +598,7 @@ get_line_func(GLcontext *ctx) if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; if (xmbuf->swAlpha) return (swrast_line_func) NULL; - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); if (xrb->ximage && swrast->_RasterMask==DEPTH_BIT @@ -661,7 +661,7 @@ get_line_func(GLcontext *ctx) } #ifndef XFree86Server - if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1 + if (ctx->DrawBuffer->_NumColorDrawBuffers == 1 && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT && swrast->_RasterMask == LOGIC_OP_BIT && ctx->Color.LogicOp == GL_XOR diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 95c6d7c1d20..a3978abdd07 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -45,7 +45,7 @@ #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped) /**********************************************************************/ @@ -1479,7 +1479,7 @@ get_triangle_func(GLcontext *ctx) if (xmbuf->swAlpha) return (swrast_tri_func) NULL; - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH |