gallium/tgsi: add helper tgsi_get_interp_mode
[mesa.git] / src / mesa / state_tracker / st_context.c
index 4f7fd24274122fee2f9945fff7538fb68cfb31b7..6c8ba9dd73254cae75d24573b58e2e141a293e31 100644 (file)
@@ -29,6 +29,7 @@
 #include "main/accum.h"
 #include "main/api_exec.h"
 #include "main/context.h"
+#include "main/debug_output.h"
 #include "main/glthread.h"
 #include "main/samplerobj.h"
 #include "main/shaderobj.h"
@@ -219,13 +220,6 @@ st_invalidate_state(struct gl_context *ctx)
 
       if (new_state & _NEW_FOG)
          st->dirty |= ST_NEW_FS_STATE;
-
-      if (new_state & _NEW_FRAG_CLAMP) {
-         if (st->clamp_frag_color_in_shader)
-            st->dirty |= ST_NEW_FS_STATE;
-         else
-            st->dirty |= ST_NEW_RASTERIZER;
-      }
    }
 
    if (new_state & (_NEW_LIGHT |
@@ -542,6 +536,12 @@ st_init_driver_flags(struct st_context *st)
    f->NewClipControl = ST_NEW_VIEWPORT | ST_NEW_RASTERIZER;
    f->NewClipPlane = ST_NEW_CLIP_STATE;
 
+   if (st->clamp_frag_color_in_shader) {
+      f->NewFragClamp = ST_NEW_FS_STATE;
+   } else {
+      f->NewFragClamp = ST_NEW_RASTERIZER;
+   }
+
    if (st->clamp_frag_depth_in_shader) {
       f->NewClipControl |= ST_NEW_VS_STATE | ST_NEW_GS_STATE |
                            ST_NEW_TES_STATE;
@@ -553,7 +553,7 @@ st_init_driver_flags(struct st_context *st)
    }
 
    if (st->lower_ucp)
-      f->NewClipPlaneEnable = ST_NEW_VS_STATE;
+      f->NewClipPlaneEnable = ST_NEW_VS_STATE | ST_NEW_GS_STATE;
    else
       f->NewClipPlaneEnable = ST_NEW_RASTERIZER;
 
@@ -722,10 +722,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
    assert(!ctx->Extensions.OES_geometry_shader || !st->lower_point_size);
    assert(!ctx->Extensions.ARB_tessellation_shader || !st->lower_point_size);
 
-   /* FIXME: add support for geometry and tessellation shaders for
-    * lower_ucp
-    */
-   assert(!ctx->Extensions.OES_geometry_shader || !st->lower_ucp);
+   /* FIXME: add support for tessellation shaders for lower_ucp */
    assert(!ctx->Extensions.ARB_tessellation_shader || !st->lower_ucp);
 
    if (st_have_perfmon(st)) {
@@ -808,7 +805,8 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
    st->shader_has_one_variant[MESA_SHADER_GEOMETRY] =
          st->has_shareable_shaders &&
          !st->clamp_frag_depth_in_shader &&
-         !st->clamp_vert_color_in_shader;
+         !st->clamp_vert_color_in_shader &&
+         !st->lower_ucp;
    st->shader_has_one_variant[MESA_SHADER_COMPUTE] = st->has_shareable_shaders;
 
    st->bitmap.cache.empty = true;
@@ -1104,13 +1102,19 @@ st_destroy_context(struct st_context *st)
 
    st_destroy_program_variants(st);
 
-   _mesa_free_context_data(ctx);
+   /* Do not release debug_output yet because it might be in use by other threads.
+    * These threads will be terminated by _mesa_free_context_data and
+    * st_destroy_context_priv.
+    */
+   _mesa_free_context_data(ctx, false);
 
    /* This will free the st_context too, so 'st' must not be accessed
     * afterwards. */
    st_destroy_context_priv(st, true);
    st = NULL;
 
+   _mesa_destroy_debug_output(ctx);
+
    free(ctx);
 
    if (save_ctx == ctx) {