mesa: Fix NetBSD compiler macro.
[mesa.git] / src / mesa / main / context.c
index 5a8f0ff191e0ac7e58d452545df0e8dec7b75476..2b8becb806d942a0846e695ed15f9e049ec5d091 100644 (file)
@@ -77,7 +77,7 @@
 
 
 #include "glheader.h"
-#include "imports.h"
+
 #include "accum.h"
 #include "api_exec.h"
 #include "api_loopback.h"
 #include "compiler/glsl/builtin_functions.h"
 #include "compiler/glsl/glsl_parser_extras.h"
 #include <stdbool.h>
+#include "util/u_memory.h"
 
 
 #ifndef MESA_VERBOSE
@@ -181,7 +182,7 @@ _mesa_notifySwapBuffers(struct gl_context *ctx)
 {
    if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS)
       _mesa_debug(ctx, "SwapBuffers\n");
-   FLUSH_CURRENT( ctx, 0 );
+   FLUSH_VERTICES(ctx, 0);
    if (ctx->Driver.Flush) {
       ctx->Driver.Flush(ctx);
    }
@@ -367,15 +368,15 @@ one_time_fini(void)
  *
  * \sa _math_init().
  */
-static void
-one_time_init( struct gl_context *ctx )
+void
+_mesa_initialize(void)
 {
-   static GLbitfield api_init_mask = 0x0;
+   static bool initialized;
 
    mtx_lock(&OneTimeLock);
 
    /* truly one-time init */
-   if (!api_init_mask) {
+   if (!initialized) {
       GLuint i;
 
       STATIC_ASSERT(sizeof(GLbyte) == 1);
@@ -387,7 +388,7 @@ one_time_init( struct gl_context *ctx )
 
       _mesa_locale_init();
 
-      _mesa_one_time_init_extension_overrides(ctx);
+      _mesa_one_time_init_extension_overrides();
 
       _mesa_get_cpu_features();
 
@@ -399,7 +400,7 @@ one_time_init( struct gl_context *ctx )
 
 #if defined(DEBUG)
       if (MESA_VERBOSE != 0) {
-         _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n");
+         _mesa_debug(NULL, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n");
       }
 #endif
 
@@ -407,14 +408,11 @@ one_time_init( struct gl_context *ctx )
        * unecessary creation/destruction of glsl types.
        */
       glsl_type_singleton_init_or_ref();
-   }
 
-   /* per-API one-time init */
-   if (!(api_init_mask & (1 << ctx->API))) {
       _mesa_init_remap_table();
    }
 
-   api_init_mask |= 1 << ctx->API;
+   initialized = true;
 
    mtx_unlock(&OneTimeLock);
 }
@@ -754,6 +752,8 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
    consts->ConservativeRasterDilateRange[0] = 0.0;
    consts->ConservativeRasterDilateRange[1] = 0.0;
    consts->ConservativeRasterDilateGranularity = 0.0;
+
+   consts->glBeginEndBufferSize = 512 * 1024;
 }
 
 
@@ -1204,7 +1204,7 @@ _mesa_initialize_context(struct gl_context *ctx,
    _mesa_override_gl_version(ctx);
 
    /* misc one-time initializations */
-   one_time_init(ctx);
+   _mesa_initialize();
 
    /* Plug in driver functions and context pointer here.
     * This is important because when we call alloc_shared_state() below
@@ -1318,7 +1318,7 @@ fail:
  * \sa _mesa_initialize_context() and init_attrib_groups().
  */
 void
-_mesa_free_context_data(struct gl_context *ctx, bool destroy_compiler_types)
+_mesa_free_context_data(struct gl_context *ctx)
 {
    if (!_mesa_get_current_context()){
       /* No current context, but we may need one in order to delete
@@ -1421,7 +1421,7 @@ void
 _mesa_destroy_context( struct gl_context *ctx )
 {
    if (ctx) {
-      _mesa_free_context_data(ctx, true);
+      _mesa_free_context_data(ctx);
       free( (void *) ctx );
    }
 }
@@ -1763,6 +1763,7 @@ _mesa_make_current( struct gl_context *newCtx,
              * changed since the last time this FBO was bound).
              */
             _mesa_update_draw_buffers(newCtx);
+            _mesa_update_allow_draw_out_of_order(newCtx);
          }
          if (!newCtx->ReadBuffer || _mesa_is_winsys_fbo(newCtx->ReadBuffer)) {
             _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
@@ -1874,7 +1875,6 @@ void
 _mesa_flush(struct gl_context *ctx)
 {
    FLUSH_VERTICES( ctx, 0 );
-   FLUSH_CURRENT( ctx, 0 );
    if (ctx->Driver.Flush) {
       ctx->Driver.Flush(ctx);
    }
@@ -1895,7 +1895,6 @@ _mesa_Finish(void)
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    FLUSH_VERTICES(ctx, 0);
-   FLUSH_CURRENT(ctx, 0);
 
    if (ctx->Driver.Finish) {
       ctx->Driver.Finish(ctx);