aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-22 13:05:53 -0400
committerRob Clark <[email protected]>2015-04-22 13:20:28 -0400
commit13527df143be1ca6e2f69bf4728f69efaebb3b13 (patch)
tree68733b911437aea29dcd1f8c438489701c88cf8a /src/gallium/drivers/freedreno/a4xx/fd4_texture.c
parent48a651e98ce764a9dae3d4dfd6e18044414be18b (diff)
freedreno/a4xx: wire up integer texture sampling
Similar to a3xx, the compiler needs to know the return type of the sam, etc, instructions. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx/fd4_texture.c')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_texture.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
index 6ba25d0816d..ff1ff8f0d34 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
@@ -205,11 +205,43 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
return &so->base;
}
+static void
+fd4_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+ unsigned start, unsigned nr, struct pipe_sampler_view **views)
+{
+ struct fd_context *ctx = fd_context(pctx);
+ struct fd4_context *fd4_ctx = fd4_context(ctx);
+ struct fd_texture_stateobj *tex;
+ uint16_t integer_s = 0, *ptr;
+ int i;
+
+ fd_set_sampler_views(pctx, shader, start, nr, views);
+
+ switch (shader) {
+ case PIPE_SHADER_FRAGMENT:
+ tex = &ctx->fragtex;
+ ptr = &fd4_ctx->finteger_s;
+ break;
+ case PIPE_SHADER_VERTEX:
+ tex = &ctx->verttex;
+ ptr = &fd4_ctx->vinteger_s;
+ break;
+ default:
+ return;
+ }
+
+ for (i = 0; i < tex->num_textures; i++)
+ if (util_format_is_pure_integer(tex->textures[i]->format))
+ integer_s |= 1 << i;
+
+ *ptr = integer_s;
+}
+
void
fd4_texture_init(struct pipe_context *pctx)
{
pctx->create_sampler_state = fd4_sampler_state_create;
pctx->bind_sampler_states = fd_sampler_states_bind;
pctx->create_sampler_view = fd4_sampler_view_create;
- pctx->set_sampler_views = fd_set_sampler_views;
+ pctx->set_sampler_views = fd4_set_sampler_views;
}