aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_fbo.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_fbo.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 637f7ee98..780148487 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -544,6 +544,12 @@ st_validate_attachment(struct gl_context *ctx,
gl_format texFormat;
GLboolean valid;
+ /* Sanity check: we must be binding the surface as a (color) render target
+ * or depth/stencil target.
+ */
+ assert(bindings == PIPE_BIND_RENDER_TARGET ||
+ bindings == PIPE_BIND_DEPTH_STENCIL);
+
/* Only validate texture attachments for now, since
* st_renderbuffer_alloc_storage makes sure that
* the format is supported.
@@ -700,7 +706,8 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
(void) buffer;
/* add the renderbuffer on demand */
- st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
+ if (fb->_ColorReadBufferIndex >= 0)
+ st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
}