summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_context.h7
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_draw.c8
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_texture.c34
3 files changed, 44 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_context.h b/src/gallium/drivers/freedreno/a4xx/fd4_context.h
index 87e69fa613a..384602a2e4f 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_context.h
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_context.h
@@ -76,12 +76,15 @@ struct fd4_context {
/* bitmask of sampler which needs coords clamped for vertex
* shader:
*/
- unsigned vsaturate_s, vsaturate_t, vsaturate_r;
+ uint16_t vsaturate_s, vsaturate_t, vsaturate_r;
/* bitmask of sampler which needs coords clamped for frag
* shader:
*/
- unsigned fsaturate_s, fsaturate_t, fsaturate_r;
+ uint16_t fsaturate_s, fsaturate_t, fsaturate_r;
+
+ /* bitmask of integer texture samplers */
+ uint16_t vinteger_s, finteger_s;
/* some state changes require a different shader variant. Keep
* track of this so we know when we need to re-emit shader state
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c
index 6c54f61cc66..ae407f753fe 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c
@@ -82,7 +82,8 @@ fixup_shader_state(struct fd_context *ctx, struct ir3_shader_key *key)
if (last_key->has_per_samp || key->has_per_samp) {
if ((last_key->vsaturate_s != key->vsaturate_s) ||
(last_key->vsaturate_t != key->vsaturate_t) ||
- (last_key->vsaturate_r != key->vsaturate_r))
+ (last_key->vsaturate_r != key->vsaturate_r) ||
+ (last_key->vinteger_s != key->vinteger_s))
ctx->prog.dirty |= FD_SHADER_DIRTY_VP;
if ((last_key->fsaturate_s != key->fsaturate_s) ||
@@ -121,13 +122,16 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
// TODO set .half_precision based on render target format,
// ie. float16 and smaller use half, float32 use full..
.half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF),
- .has_per_samp = fd4_ctx->fsaturate || fd4_ctx->vsaturate,
+ .has_per_samp = (fd4_ctx->fsaturate || fd4_ctx->vsaturate ||
+ fd4_ctx->vinteger_s || fd4_ctx->finteger_s),
.vsaturate_s = fd4_ctx->vsaturate_s,
.vsaturate_t = fd4_ctx->vsaturate_t,
.vsaturate_r = fd4_ctx->vsaturate_r,
.fsaturate_s = fd4_ctx->fsaturate_s,
.fsaturate_t = fd4_ctx->fsaturate_t,
.fsaturate_r = fd4_ctx->fsaturate_r,
+ .vinteger_s = fd4_ctx->vinteger_s,
+ .finteger_s = fd4_ctx->finteger_s,
},
.format = fd4_emit_format(pfb->cbufs[0]),
.pformat = pipe_surface_format(pfb->cbufs[0]),
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;
}