st/mesa: Factorize duplicate code in st_update_framebuffer_state()
authorGuillaume Charifi <guillaume.charifi@sfr.fr>
Fri, 5 Jan 2018 16:49:39 +0000 (17:49 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 20 Feb 2018 19:54:49 +0000 (20:54 +0100)
Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_atom_framebuffer.c

index a29f5b35a85f32dc8dbab96336b2e4f5dc416d13..3ef3ff34a97c64057c8e4ab45fa39fafad436818 100644 (file)
@@ -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 */