gallium + mesa/st: Add PIPE_CAP_NIR_ATOMICS_AS_DEREF and use it
[mesa.git] / src / mesa / state_tracker / st_atom_framebuffer.c
index 3ef3ff34a97c64057c8e4ab45fa39fafad436818..fea537c406d70fbe31ad4cb39dd18d92bccaab3c 100644 (file)
 #include "st_cb_bitmap.h"
 #include "st_cb_fbo.h"
 #include "st_texture.h"
+#include "st_util.h"
 #include "pipe/p_context.h"
 #include "cso_cache/cso_context.h"
 #include "util/u_math.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "main/framebuffer.h"
 
@@ -95,7 +96,7 @@ framebuffer_quantize_num_samples(struct st_context *st, unsigned num_samples)
        * drivers callback must be adjusted for this.
        */
       if (screen->is_format_supported(screen, PIPE_FORMAT_NONE,
-                                      PIPE_TEXTURE_2D, msaa_mode,
+                                      PIPE_TEXTURE_2D, msaa_mode, msaa_mode,
                                       PIPE_BIND_RENDER_TARGET))
          quantized_samples = msaa_mode;
    }
@@ -145,7 +146,7 @@ st_update_framebuffer_state( struct st_context *st )
 
       if (strb) {
          if (strb->is_rtt || (strb->texture &&
-             _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB)) {
+             _mesa_is_format_srgb(strb->Base.Format))) {
             /* rendering to a GL texture, may have to update surface */
             st_update_renderbuffer_surface(st, strb);
          }
@@ -181,12 +182,13 @@ st_update_framebuffer_state( struct st_context *st )
          st_update_renderbuffer_surface(st, strb);
       }
       framebuffer.zsbuf = strb->surface;
-      update_framebuffer_size(&framebuffer, strb->surface);
+      if (strb->surface)
+         update_framebuffer_size(&framebuffer, strb->surface);
    }
    else
       framebuffer.zsbuf = NULL;
 
-#ifdef DEBUG
+#ifndef NDEBUG
    /* Make sure the resource binding flags were set properly */
    for (i = 0; i < framebuffer.nr_cbufs; i++) {
       assert(!framebuffer.cbufs[i] ||