summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-07-12 17:15:51 -0400
committerMarek Olšák <[email protected]>2015-07-23 00:59:29 +0200
commit40bc1c32d2fb42207ea860053045fa49e45d80b9 (patch)
tree26972274186dc0852b6537e83a930715f546551d /src
parentbda79139d4579b5105c45561401960a82bab2f7e (diff)
st/mesa: add texture updates for tessellation programs
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_atom.c2
-rw-r--r--src/mesa/state_tracker/st_atom.h2
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c16
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c52
4 files changed, 72 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 676b14c648d..c97cd84da60 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -61,6 +61,8 @@ static const struct st_tracked_state *atoms[] =
&st_update_vertex_texture,
&st_update_fragment_texture,
&st_update_geometry_texture,
+ &st_update_tessctrl_texture,
+ &st_update_tesseval_texture,
&st_update_sampler, /* depends on update_*_texture for swizzle */
&st_update_framebuffer,
&st_update_msaa,
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index 655b4e76388..bbfbd2d3f9f 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -66,6 +66,8 @@ extern const struct st_tracked_state st_update_sampler;
extern const struct st_tracked_state st_update_fragment_texture;
extern const struct st_tracked_state st_update_vertex_texture;
extern const struct st_tracked_state st_update_geometry_texture;
+extern const struct st_tracked_state st_update_tessctrl_texture;
+extern const struct st_tracked_state st_update_tesseval_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;
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 4ab82bc9acb..4252c27962e 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -305,6 +305,22 @@ update_samplers(struct st_context *st)
st->state.samplers[PIPE_SHADER_GEOMETRY],
&st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
}
+ if (ctx->TessCtrlProgram._Current) {
+ update_shader_samplers(st,
+ PIPE_SHADER_TESS_CTRL,
+ &ctx->TessCtrlProgram._Current->Base,
+ ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits,
+ st->state.samplers[PIPE_SHADER_TESS_CTRL],
+ &st->state.num_samplers[PIPE_SHADER_TESS_CTRL]);
+ }
+ if (ctx->TessEvalProgram._Current) {
+ update_shader_samplers(st,
+ PIPE_SHADER_TESS_EVAL,
+ &ctx->TessEvalProgram._Current->Base,
+ ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
+ st->state.samplers[PIPE_SHADER_TESS_EVAL],
+ &st->state.num_samplers[PIPE_SHADER_TESS_EVAL]);
+ }
}
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 04ba86448fc..ba3cf9beeb4 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -474,6 +474,38 @@ update_geometry_textures(struct st_context *st)
}
+static void
+update_tessctrl_textures(struct st_context *st)
+{
+ const struct gl_context *ctx = st->ctx;
+
+ if (ctx->TessCtrlProgram._Current) {
+ update_textures(st,
+ PIPE_SHADER_TESS_CTRL,
+ &ctx->TessCtrlProgram._Current->Base,
+ ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits,
+ st->state.sampler_views[PIPE_SHADER_TESS_CTRL],
+ &st->state.num_sampler_views[PIPE_SHADER_TESS_CTRL]);
+ }
+}
+
+
+static void
+update_tesseval_textures(struct st_context *st)
+{
+ const struct gl_context *ctx = st->ctx;
+
+ if (ctx->TessEvalProgram._Current) {
+ update_textures(st,
+ PIPE_SHADER_TESS_EVAL,
+ &ctx->TessEvalProgram._Current->Base,
+ ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
+ st->state.sampler_views[PIPE_SHADER_TESS_EVAL],
+ &st->state.num_sampler_views[PIPE_SHADER_TESS_EVAL]);
+ }
+}
+
+
const struct st_tracked_state st_update_fragment_texture = {
"st_update_texture", /* name */
{ /* dirty */
@@ -504,6 +536,26 @@ const struct st_tracked_state st_update_geometry_texture = {
};
+const struct st_tracked_state st_update_tessctrl_texture = {
+ "st_update_tessctrl_texture", /* name */
+ { /* dirty */
+ _NEW_TEXTURE, /* mesa */
+ ST_NEW_TESSCTRL_PROGRAM, /* st */
+ },
+ update_tessctrl_textures /* update */
+};
+
+
+const struct st_tracked_state st_update_tesseval_texture = {
+ "st_update_tesseval_texture", /* name */
+ { /* dirty */
+ _NEW_TEXTURE, /* mesa */
+ ST_NEW_TESSEVAL_PROGRAM, /* st */
+ },
+ update_tesseval_textures /* update */
+};
+
+
static void
finalize_textures(struct st_context *st)