From: Guillaume Charifi Date: Fri, 5 Jan 2018 16:49:39 +0000 (+0100) Subject: st/mesa: Factorize duplicate code in st_update_framebuffer_state() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56bfcd50f7f49d9c5119cd1297064b4d62a0d964;p=mesa.git st/mesa: Factorize duplicate code in st_update_framebuffer_state() Signed-off-by: Guillaume Charifi Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- 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 */