summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-07-12 17:10:59 -0400
committerMarek Olšák <[email protected]>2015-07-23 00:59:29 +0200
commitbda79139d4579b5105c45561401960a82bab2f7e (patch)
tree7711a14339ad0d799d1f782da65d2e281d1bb48f /src/mesa/state_tracker
parenta58a66fe8577940cf07530b6235a386950ae04f7 (diff)
st/mesa: handle constbufs/ubos for tessellation shaders
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom.c4
-rw-r--r--src/mesa/state_tracker/st_atom.h4
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c88
3 files changed, 95 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 1c3eb7ec45a..676b14c648d 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -66,9 +66,13 @@ static const struct st_tracked_state *atoms[] =
&st_update_msaa,
&st_update_sample_shading,
&st_update_vs_constants,
+ &st_update_tcs_constants,
+ &st_update_tes_constants,
&st_update_gs_constants,
&st_update_fs_constants,
&st_bind_vs_ubos,
+ &st_bind_tcs_ubos,
+ &st_bind_tes_ubos,
&st_bind_fs_ubos,
&st_bind_gs_ubos,
&st_update_pixel_transfer,
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index bec4a810406..655b4e76388 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -69,10 +69,14 @@ extern const struct st_tracked_state st_update_geometry_texture;
extern const struct st_tracked_state st_finalize_textures;
extern const struct st_tracked_state st_update_fs_constants;
extern const struct st_tracked_state st_update_gs_constants;
+extern const struct st_tracked_state st_update_tes_constants;
+extern const struct st_tracked_state st_update_tcs_constants;
extern const struct st_tracked_state st_update_vs_constants;
extern const struct st_tracked_state st_bind_fs_ubos;
extern const struct st_tracked_state st_bind_vs_ubos;
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;
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index a54e0d9dbf5..6affb4d84d5 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -59,7 +59,9 @@ void st_upload_constants( struct st_context *st,
{
assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_FRAGMENT ||
- shader_type == PIPE_SHADER_GEOMETRY);
+ shader_type == PIPE_SHADER_GEOMETRY ||
+ shader_type == PIPE_SHADER_TESS_CTRL ||
+ shader_type == PIPE_SHADER_TESS_EVAL);
/* update constants */
if (params && params->NumParameters) {
@@ -178,6 +180,50 @@ const struct st_tracked_state st_update_gs_constants = {
update_gs_constants /* update */
};
+/* Tessellation control shader:
+ */
+static void update_tcs_constants(struct st_context *st )
+{
+ struct st_tessctrl_program *tcp = st->tcp;
+ struct gl_program_parameter_list *params;
+
+ if (tcp) {
+ params = tcp->Base.Base.Parameters;
+ st_upload_constants( st, params, PIPE_SHADER_TESS_CTRL );
+ }
+}
+
+const struct st_tracked_state st_update_tcs_constants = {
+ "st_update_tcs_constants", /* name */
+ { /* dirty */
+ _NEW_PROGRAM_CONSTANTS, /* mesa */
+ ST_NEW_TESSCTRL_PROGRAM, /* st */
+ },
+ update_tcs_constants /* update */
+};
+
+/* Tessellation evaluation shader:
+ */
+static void update_tes_constants(struct st_context *st )
+{
+ struct st_tesseval_program *tep = st->tep;
+ struct gl_program_parameter_list *params;
+
+ if (tep) {
+ params = tep->Base.Base.Parameters;
+ st_upload_constants( st, params, PIPE_SHADER_TESS_EVAL );
+ }
+}
+
+const struct st_tracked_state st_update_tes_constants = {
+ "st_update_tes_constants", /* name */
+ { /* dirty */
+ _NEW_PROGRAM_CONSTANTS, /* mesa */
+ ST_NEW_TESSEVAL_PROGRAM, /* st */
+ },
+ update_tes_constants /* update */
+};
+
static void st_bind_ubos(struct st_context *st,
struct gl_shader *shader,
unsigned shader_type)
@@ -275,3 +321,43 @@ const struct st_tracked_state st_bind_gs_ubos = {
},
bind_gs_ubos
};
+
+static void bind_tcs_ubos(struct st_context *st)
+{
+ struct gl_shader_program *prog =
+ st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
+
+ if (!prog)
+ return;
+
+ st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL], PIPE_SHADER_TESS_CTRL);
+}
+
+const struct st_tracked_state st_bind_tcs_ubos = {
+ "st_bind_tcs_ubos",
+ {
+ 0,
+ ST_NEW_TESSCTRL_PROGRAM | ST_NEW_UNIFORM_BUFFER,
+ },
+ bind_tcs_ubos
+};
+
+static void bind_tes_ubos(struct st_context *st)
+{
+ struct gl_shader_program *prog =
+ st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
+
+ if (!prog)
+ return;
+
+ st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL], PIPE_SHADER_TESS_EVAL);
+}
+
+const struct st_tracked_state st_bind_tes_ubos = {
+ "st_bind_tes_ubos",
+ {
+ 0,
+ ST_NEW_TESSEVAL_PROGRAM | ST_NEW_UNIFORM_BUFFER,
+ },
+ bind_tes_ubos
+};