draw: add support for num_samples + sample_stride to the image paths
[mesa.git] / src / mesa / state_tracker / st_manager.c
index a504ace5dffc9df58fd7dc0a57161b10b8894b45..cc1572bcc316aa1f2a15e4bf128f967290182f64 100644 (file)
@@ -62,6 +62,7 @@
 #include "util/u_atomic.h"
 #include "util/u_surface.h"
 #include "util/list.h"
+#include "util/u_memory.h"
 
 struct hash_table;
 struct st_manager_private
@@ -661,8 +662,12 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
    if (flags & ST_FLUSH_FENCE_FD)
       pipe_flags |= PIPE_FLUSH_FENCE_FD;
 
+   /* If both the bitmap cache is dirty and there are unflushed vertices,
+    * it means that glBitmap was called first and then glBegin.
+    */
+   st_flush_bitmap_cache(st);
    FLUSH_VERTICES(st->ctx, 0);
-   FLUSH_CURRENT(st->ctx, 0);
+
    /* Notify the caller that we're ready to flush */
    if (before_flush_cb)
       before_flush_cb(args);
@@ -688,19 +693,6 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
       st->gfx_shaders_may_be_dirty = true;
 }
 
-static void
-st_context_flush_resource(struct st_context_iface *stctxi,
-                          struct pipe_resource *resource)
-{
-   struct st_context *st = (struct st_context *) stctxi;
-   struct pipe_context *pipe = st->pipe;
-
-   FLUSH_VERTICES(st->ctx, 0);
-   FLUSH_CURRENT(st->ctx, 0);
-
-   pipe->flush_resource(pipe, resource);
-}
-
 static bool
 st_context_teximage(struct st_context_iface *stctxi,
                     enum st_texture_type tex_type,
@@ -836,8 +828,8 @@ st_start_thread(struct st_context_iface *stctxi)
     * If glthread is disabled, st_draw.c re-pins driver threads regularly
     * based on the location of the app thread.
     */
-   struct glthread_state *glthread = st->ctx->GLThread;
-   if (glthread && st->pipe->set_context_param) {
+   struct glthread_state *glthread = &st->ctx->GLThread;
+   if (glthread->enabled && st->pipe->set_context_param) {
       util_pin_driver_threads_to_random_L3(st->pipe, &glthread->queue.threads[0]);
    }
 }
@@ -902,6 +894,8 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
       return NULL;
    }
 
+   _mesa_initialize();
+
    /* Create a hash table for the framebuffer interface objects
     * if it has not been created for this st manager.
     */
@@ -990,12 +984,13 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
       }
    }
 
+   st->can_scissor_clear = !!st->pipe->screen->get_param(st->pipe->screen, PIPE_CAP_CLEAR_SCISSORED);
+
    st->invalidate_on_gl_viewport =
       smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
 
    st->iface.destroy = st_context_destroy;
    st->iface.flush = st_context_flush;
-   st->iface.flush_resource = st_context_flush_resource;
    st->iface.teximage = st_context_teximage;
    st->iface.copy = st_context_copy;
    st->iface.share = st_context_share;