st/mesa: set default tessellation levels
authorMarek Olšák <marek.olsak@amd.com>
Mon, 18 May 2015 10:49:10 +0000 (12:49 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Jul 2015 22:59:30 +0000 (00:59 +0200)
src/mesa/Makefile.sources
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom.h
src/mesa/state_tracker/st_atom_tess.c [new file with mode: 0644]
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index 83f500fbf20dc0b2dbc520049b5ec24f5763df77..ed9848c5454dfa6ab976d915f92903b6d3e667b0 100644 (file)
@@ -407,6 +407,7 @@ STATETRACKER_FILES = \
        state_tracker/st_atom_shader.c \
        state_tracker/st_atom_shader.h \
        state_tracker/st_atom_stipple.c \
+       state_tracker/st_atom_tess.c \
        state_tracker/st_atom_texture.c \
        state_tracker/st_atom_viewport.c \
        state_tracker/st_cache.h \
index c97cd84da606fb19cf828c5cc1d55ede8c6d5ade..5fc1a77ce60b8eb7f0aed7de082655aa2aefe930 100644 (file)
@@ -78,6 +78,7 @@ static const struct st_tracked_state *atoms[] =
    &st_bind_fs_ubos,
    &st_bind_gs_ubos,
    &st_update_pixel_transfer,
+   &st_update_tess,
 
    /* this must be done after the vertex program update */
    &st_update_array
index bbfbd2d3f9feb7270461e54f314e51cef442841f..5735ca6930d93f85d19bff85175deae192f2d32b 100644 (file)
@@ -80,6 +80,7 @@ extern const struct st_tracked_state st_bind_gs_ubos;
 extern const struct st_tracked_state st_bind_tcs_ubos;
 extern const struct st_tracked_state st_bind_tes_ubos;
 extern const struct st_tracked_state st_update_pixel_transfer;
+extern const struct st_tracked_state st_update_tess;
 
 
 GLuint st_compare_func_to_pipe(GLenum func);
diff --git a/src/mesa/state_tracker/st_atom_tess.c b/src/mesa/state_tracker/st_atom_tess.c
new file mode 100644 (file)
index 0000000..8e6287a
--- /dev/null
@@ -0,0 +1,62 @@
+/**************************************************************************
+ * 
+ * Copyright 2015 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/*
+ * Authors:
+ *   Marek Olšák <maraeo@gmail.com>
+ */
+
+
+#include "main/macros.h"
+#include "st_context.h"
+#include "pipe/p_context.h"
+#include "st_atom.h"
+
+
+static void
+update_tess(struct st_context *st)
+{
+   const struct gl_context *ctx = st->ctx;
+   struct pipe_context *pipe = st->pipe;
+
+   if (!pipe->set_tess_state)
+      return;
+
+   pipe->set_tess_state(pipe,
+                        ctx->TessCtrlProgram.patch_default_outer_level,
+                        ctx->TessCtrlProgram.patch_default_inner_level);
+}
+
+
+const struct st_tracked_state st_update_tess = {
+   "update_tess",              /* name */
+   {                           /* dirty */
+      0,                       /* mesa */
+      ST_NEW_TESS_STATE,       /* st */
+   },
+   update_tess                  /* update */
+};
index 0c80fa1179d14d7de92abc3da0b1165c08f3603a..44244a1e720f72d7d2dc7cadb7e8f0f9844f8a60 100644 (file)
@@ -313,6 +313,7 @@ static void st_init_driver_flags(struct gl_driver_flags *f)
    f->NewArray = ST_NEW_VERTEX_ARRAYS;
    f->NewRasterizerDiscard = ST_NEW_RASTERIZER;
    f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER;
+   f->NewDefaultTessLevels = ST_NEW_TESS_STATE;
 }
 
 struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
index 301072742cf9b0ce92626a449e1fb58bd57fce2b..8183412ceabfd2d6b375ff96da37110f8a0b47d6 100644 (file)
@@ -53,7 +53,7 @@ struct u_upload_mgr;
 #define ST_NEW_FRAGMENT_PROGRAM        (1 << 1)
 #define ST_NEW_VERTEX_PROGRAM          (1 << 2)
 #define ST_NEW_FRAMEBUFFER             (1 << 3)
-/* gap, re-use it */
+#define ST_NEW_TESS_STATE              (1 << 4)
 #define ST_NEW_GEOMETRY_PROGRAM        (1 << 5)
 #define ST_NEW_VERTEX_ARRAYS           (1 << 6)
 #define ST_NEW_RASTERIZER              (1 << 7)