mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 19:20:12 +01:00
update comments, etc related to Read/DrawBuffer state
This commit is contained in:
parent
c5a5d12743
commit
c033ccc36d
2 changed files with 33 additions and 20 deletions
|
|
@ -479,9 +479,12 @@ set_color_output(GLcontext *ctx, GLuint output, GLenum buffer,
|
|||
/* not really needed, will be set later */
|
||||
fb->_NumColorDrawBuffers[output] = 0;
|
||||
|
||||
if (fb->Name == 0)
|
||||
/* Set traditional state var */
|
||||
if (fb->Name == 0) {
|
||||
/* Only set the per-context DrawBuffer state if we're currently
|
||||
* drawing to a window system framebuffer.
|
||||
*/
|
||||
ctx->Color.DrawBuffer[output] = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual)
|
|||
/* save the visual */
|
||||
fb->Visual = *visual;
|
||||
|
||||
/* Init glRead/DrawBuffer state */
|
||||
/* Init read/draw renderbuffer state */
|
||||
if (visual->doubleBufferMode) {
|
||||
fb->ColorDrawBuffer[0] = GL_BACK;
|
||||
fb->_ColorDrawBufferMask[0] = BUFFER_BIT_BACK_LEFT;
|
||||
|
|
@ -649,6 +649,22 @@ update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a gl_framebuffer's derived state.
|
||||
*
|
||||
* Specifically, update these framebuffer fields:
|
||||
* _ColorDrawBuffers
|
||||
* _NumColorDrawBuffers
|
||||
* _ColorReadBuffer
|
||||
* _DepthBuffer
|
||||
* _StencilBuffer
|
||||
*
|
||||
* If the framebuffer is user-created, make sure it's complete.
|
||||
*
|
||||
* The following functions (at least) can effect framebuffer state:
|
||||
* glReadBuffer, glDrawBuffer, glDrawBuffersARB, glFramebufferRenderbufferEXT,
|
||||
* glRenderbufferStorageEXT.
|
||||
*/
|
||||
static void
|
||||
update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
|
|
@ -660,8 +676,11 @@ update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||
_mesa_update_framebuffer_visual(fb);
|
||||
}
|
||||
|
||||
/* update_color_draw/read_buffers not needed for
|
||||
read/draw only fb, but shouldn't hurt ??? */
|
||||
/* Strictly speaking, we don't need to update the draw-state
|
||||
* if this FB is bound as ctx->ReadBuffer (and conversely, the
|
||||
* read-state if this FB is bound as ctx->DrawBuffer), but no
|
||||
* harm.
|
||||
*/
|
||||
update_color_draw_buffers(ctx, fb);
|
||||
update_color_read_buffer(ctx, fb);
|
||||
_mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
|
||||
|
|
@ -670,28 +689,19 @@ update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||
compute_depth_max(fb);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update state related to the current draw/read framebuffers.
|
||||
* Specifically, update these framebuffer fields:
|
||||
* _ColorDrawBuffers
|
||||
* _NumColorDrawBuffers
|
||||
* _ColorReadBuffer
|
||||
* _DepthBuffer
|
||||
* _StencilBuffer
|
||||
* If the current framebuffer is user-created, make sure it's complete.
|
||||
* The following functions can effect this state: glReadBuffer,
|
||||
* glDrawBuffer, glDrawBuffersARB, glFramebufferRenderbufferEXT,
|
||||
* glRenderbufferStorageEXT.
|
||||
*/
|
||||
void
|
||||
_mesa_update_framebuffer(GLcontext *ctx)
|
||||
{
|
||||
struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
struct gl_framebuffer *fbread = ctx->ReadBuffer;
|
||||
struct gl_framebuffer *drawFb = ctx->DrawBuffer;
|
||||
struct gl_framebuffer *readFb = ctx->ReadBuffer;
|
||||
|
||||
update_framebuffer(ctx, fb);
|
||||
if (fbread != fb)
|
||||
update_framebuffer(ctx, fbread);
|
||||
update_framebuffer(ctx, drawFb);
|
||||
if (readFb != drawFb)
|
||||
update_framebuffer(ctx, readFb);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue