summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a2xx
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-09-29 14:55:38 -0400
committerRob Clark <[email protected]>2014-09-29 18:30:42 -0400
commita6746d11247cdd6f795c7e857019c3a4bd71e26a (patch)
tree81240f50c3c792b098e23d49bc5e1ee2f4e8b9e4 /src/gallium/drivers/freedreno/a2xx
parent7e20c09d4ac22012a9d2697fb83e6815edb5a64d (diff)
freedreno: move bind_sampler_states to per-generation
Keep the existing function as a common helper. But this lets us move an a2xx specific hack out of common code. And the PIPE_TEX_WRAP_CLAMP emulation will require an a3xx specific hack. So rather than piling on hacks, split this out. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a2xx')
-rw-r--r--src/gallium/drivers/freedreno/a2xx/fd2_texture.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
index 870694c2a15..e5e1f35b9c7 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
@@ -101,6 +101,25 @@ fd2_sampler_state_create(struct pipe_context *pctx,
return so;
}
+static void
+fd2_sampler_states_bind(struct pipe_context *pctx,
+ unsigned shader, unsigned start,
+ unsigned nr, void **hwcso)
+{
+ if (shader == PIPE_SHADER_FRAGMENT) {
+ struct fd_context *ctx = fd_context(pctx);
+
+ /* on a2xx, since there is a flat address space for textures/samplers,
+ * a change in # of fragment textures/samplers will trigger patching and
+ * re-emitting the vertex shader:
+ */
+ if (nr != ctx->fragtex.num_samplers)
+ ctx->dirty |= FD_DIRTY_TEXSTATE;
+ }
+
+ fd_sampler_states_bind(pctx, shader, start, nr, hwcso);
+}
+
static struct pipe_sampler_view *
fd2_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
const struct pipe_sampler_view *cso)
@@ -154,5 +173,6 @@ void
fd2_texture_init(struct pipe_context *pctx)
{
pctx->create_sampler_state = fd2_sampler_state_create;
+ pctx->bind_sampler_states = fd2_sampler_states_bind;
pctx->create_sampler_view = fd2_sampler_view_create;
}