[Mesa-dev] [PATCH 13/14] st/mesa: set default tessellation levels
Marek Olšák
maraeo at gmail.com
Tue Jun 16 16:04:54 PDT 2015
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/Makefile.sources | 1 +
src/mesa/state_tracker/st_atom.c | 1 +
src/mesa/state_tracker/st_atom.h | 1 +
src/mesa/state_tracker/st_atom_tess.c | 59 +++++++++++++++++++++++++++++++++++
src/mesa/state_tracker/st_context.c | 1 +
src/mesa/state_tracker/st_context.h | 2 +-
6 files changed, 64 insertions(+), 1 deletion(-)
create mode 100644 src/mesa/state_tracker/st_atom_tess.c
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 83f500f..ed9848c 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -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 \
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index c97cd84..5fc1a77 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -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
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index bbfbd2d..5735ca6 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -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
index 0000000..f3aaaae
--- /dev/null
+++ b/src/mesa/state_tracker/st_atom_tess.c
@@ -0,0 +1,59 @@
+/**************************************************************************
+ *
+ * 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 at 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;
+
+ 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 */
+};
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index ef4ad1b..06280bc 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -308,6 +308,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,
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 3010727..8183412 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -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)
--
2.1.0
More information about the mesa-dev
mailing list