From 56bfcd50f7f49d9c5119cd1297064b4d62a0d964 Mon Sep 17 00:00:00 2001 From: Guillaume Charifi Date: Fri, 5 Jan 2018 17:49:39 +0100 Subject: [PATCH] st/mesa: Factorize duplicate code in st_update_framebuffer_state() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Guillaume Charifi Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- src/mesa/state_tracker/st_atom_framebuffer.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index a29f5b35a85..3ef3ff34a97 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -172,6 +172,9 @@ st_update_framebuffer_state( struct st_context *st ) * Depth/Stencil renderbuffer/surface. */ strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer); + if (!strb) + strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer); + if (strb) { if (strb->is_rtt) { /* rendering to a GL texture, may have to update surface */ @@ -180,19 +183,8 @@ st_update_framebuffer_state( struct st_context *st ) framebuffer.zsbuf = strb->surface; update_framebuffer_size(&framebuffer, strb->surface); } - else { - strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer); - if (strb) { - if (strb->is_rtt) { - /* rendering to a GL texture, may have to update surface */ - st_update_renderbuffer_surface(st, strb); - } - framebuffer.zsbuf = strb->surface; - update_framebuffer_size(&framebuffer, strb->surface); - } - else - framebuffer.zsbuf = NULL; - } + else + framebuffer.zsbuf = NULL; #ifdef DEBUG /* Make sure the resource binding flags were set properly */ -- 2.30.2