summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c8
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c26
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c3
3 files changed, 25 insertions, 12 deletions
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 80df3b0506d..2916886610d 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -118,9 +118,10 @@ update_framebuffer_state( struct st_context *st )
update_renderbuffer_surface(st, strb);
}
- assert(strb->surface);
- framebuffer->cbufs[framebuffer->num_cbufs] = strb->surface;
- framebuffer->num_cbufs++;
+ if (strb->surface) {
+ framebuffer->cbufs[framebuffer->num_cbufs] = strb->surface;
+ framebuffer->num_cbufs++;
+ }
}
}
@@ -132,7 +133,6 @@ update_framebuffer_state( struct st_context *st )
update_renderbuffer_surface(st, strb);
}
- assert(strb->surface);
framebuffer->zsbuf = strb->surface;
}
else {
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 47ad3c2bc12..bc3055c3fdf 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -406,13 +406,17 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
+ if (!strb->surface)
+ return;
+
if (check_clear_color_with_quad( ctx, rb )) {
/* masking or scissoring */
clear_with_quad(ctx, GL_TRUE, GL_FALSE, GL_FALSE);
}
else {
/* clear whole buffer w/out masking */
- struct st_renderbuffer *strb = st_renderbuffer(rb);
uint clearValue;
/* NOTE: we always pass the clear color as PIPE_FORMAT_A8R8G8B8_UNORM
* at this time!
@@ -426,13 +430,16 @@ clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
+ if (!strb->surface)
+ return;
+
if (check_clear_depth_with_quad(ctx, rb)) {
/* scissoring or we have a combined depth/stencil buffer */
clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE);
}
else {
- struct st_renderbuffer *strb = st_renderbuffer(rb);
-
/* simple clear of whole buffer */
uint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear);
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
@@ -443,13 +450,16 @@ clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
+ if (!strb->surface)
+ return;
+
if (check_clear_stencil_with_quad(ctx, rb)) {
/* masking or scissoring or combined depth/stencil buffer */
clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE);
}
else {
- struct st_renderbuffer *strb = st_renderbuffer(rb);
-
/* simple clear of whole buffer */
GLuint clearValue = ctx->Stencil.Clear;
@@ -469,14 +479,16 @@ clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+
+ if (!strb->surface)
+ return;
if (check_clear_depth_stencil_with_quad(ctx, rb)) {
/* masking or scissoring */
clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_TRUE);
}
else {
- struct st_renderbuffer *strb = st_renderbuffer(rb);
-
/* clear whole buffer w/out masking */
GLuint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear);
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index ec8928f200d..6ee1777fb7a 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -289,7 +289,8 @@ st_notify_swapbuffers_complete(struct st_framebuffer *stfb)
for (i = 0; i < BUFFER_COUNT; i++) {
if (stfb->Base.Attachment[i].Renderbuffer) {
strb = st_renderbuffer(stfb->Base.Attachment[i].Renderbuffer);
- strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
+ if (strb->surface)
+ strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
}
}
}