mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
mesa: test DrawBuffer, not ReadBuffer in _mesa_dest_buffer_exists()
Also, update comments.
This commit is contained in:
parent
2dec62405f
commit
94504be63a
1 changed files with 12 additions and 10 deletions
|
|
@ -817,7 +817,7 @@ _mesa_update_framebuffer(GLcontext *ctx)
|
|||
|
||||
/**
|
||||
* Check if the renderbuffer for a read operation (glReadPixels, glCopyPixels,
|
||||
* glCopyTex[Sub]Image, etc. exists.
|
||||
* glCopyTex[Sub]Image, etc) exists.
|
||||
* \param format a basic image format such as GL_RGB, GL_RGBA, GL_ALPHA,
|
||||
* GL_DEPTH_COMPONENT, etc. or GL_COLOR, GL_DEPTH, GL_STENCIL.
|
||||
* \return GL_TRUE if buffer exists, GL_FALSE otherwise
|
||||
|
|
@ -825,8 +825,10 @@ _mesa_update_framebuffer(GLcontext *ctx)
|
|||
GLboolean
|
||||
_mesa_source_buffer_exists(GLcontext *ctx, GLenum format)
|
||||
{
|
||||
const struct gl_renderbuffer_attachment *att
|
||||
= ctx->ReadBuffer->Attachment;
|
||||
const struct gl_renderbuffer_attachment *att = ctx->ReadBuffer->Attachment;
|
||||
|
||||
/* state validation should have already been done */
|
||||
ASSERT(ctx->NewState == 0x0);
|
||||
|
||||
if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
return GL_FALSE;
|
||||
|
|
@ -850,10 +852,8 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format)
|
|||
if (ctx->ReadBuffer->_ColorReadBuffer == NULL) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
/* XXX enable this post 6.5 release:
|
||||
ASSERT(ctx->ReadBuffer->_ColorReadBuffer->RedBits > 0 ||
|
||||
ctx->ReadBuffer->_ColorReadBuffer->IndexBits > 0);
|
||||
*/
|
||||
break;
|
||||
case GL_DEPTH:
|
||||
case GL_DEPTH_COMPONENT:
|
||||
|
|
@ -891,13 +891,15 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format)
|
|||
|
||||
/**
|
||||
* As above, but for drawing operations.
|
||||
* XXX code do some code merging w/ above function.
|
||||
* XXX could do some code merging w/ above function.
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
|
||||
{
|
||||
const struct gl_renderbuffer_attachment *att
|
||||
= ctx->ReadBuffer->Attachment;
|
||||
const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment;
|
||||
|
||||
/* state validation should have already been done */
|
||||
ASSERT(ctx->NewState == 0x0);
|
||||
|
||||
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
return GL_FALSE;
|
||||
|
|
@ -918,7 +920,7 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
|
|||
case GL_BGRA:
|
||||
case GL_ABGR_EXT:
|
||||
case GL_COLOR_INDEX:
|
||||
/* nothing special */
|
||||
/* Nothing special since GL_DRAW_BUFFER could be GL_NONE. */
|
||||
/* Could assert that colorbuffer has RedBits > 0 */
|
||||
break;
|
||||
case GL_DEPTH:
|
||||
|
|
@ -945,7 +947,7 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
|
|||
break;
|
||||
default:
|
||||
_mesa_problem(ctx,
|
||||
"Unexpected format 0x%x in _mesa_source_buffer_exists",
|
||||
"Unexpected format 0x%x in _mesa_dest_buffer_exists",
|
||||
format);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue