st/mesa: add some _mesa_is_winsys_fbo() assertions

A few functions related to FBOs/renderbuffers should only be used with
window-system buffers, not user-created FBOs.  Assert for that.
Add additional comments.  No piglit regressions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Brian Paul 2017-04-10 21:11:55 -06:00
parent c36d224921
commit 46f49d6fdc
2 changed files with 9 additions and 2 deletions

View file

@ -739,6 +739,7 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
if ((fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT ||
fb->_ColorReadBufferIndex == BUFFER_FRONT_RIGHT) &&
fb->Attachment[fb->_ColorReadBufferIndex].Type == GL_NONE) {
assert(_mesa_is_winsys_fbo(fb));
/* add the buffer */
st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
_mesa_update_state(ctx);

View file

@ -270,7 +270,8 @@ st_framebuffer_update_attachments(struct st_framebuffer *stfb)
}
/**
* Add a renderbuffer to the framebuffer.
* Add a renderbuffer to the framebuffer. The framebuffer is one that
* corresponds to a window and is not a user-created FBO.
*/
static boolean
st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
@ -283,6 +284,8 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
if (!stfb->iface)
return FALSE;
assert(_mesa_is_winsys_fbo(&stfb->Base));
/* do not distinguish depth/stencil buffers */
if (idx == BUFFER_STENCIL)
idx = BUFFER_DEPTH;
@ -869,7 +872,8 @@ st_manager_validate_framebuffers(struct st_context *st)
}
/**
* Add a color renderbuffer on demand.
* Add a color renderbuffer on demand. The FBO must correspond to a window,
* not a user-created FBO.
*/
boolean
st_manager_add_color_renderbuffer(struct st_context *st,
@ -882,6 +886,8 @@ st_manager_add_color_renderbuffer(struct st_context *st,
if (!stfb)
return FALSE;
assert(_mesa_is_winsys_fbo(fb));
if (stfb->Base.Attachment[idx].Renderbuffer)
return TRUE;