From 0f008082b184072159e5aedc7fc103efba8740ed Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 8 Jun 2015 14:23:49 -0400 Subject: [PATCH] freedreno: remove int sampler shader variants We get this information from NIR (which gets it from sview decl in tgsi when translating from tgsi), so no need to maintain shader variants for this. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a3xx/fd3_context.h | 3 -- src/gallium/drivers/freedreno/a3xx/fd3_draw.c | 11 ++----- src/gallium/drivers/freedreno/a3xx/fd3_texture.c | 35 +--------------------- src/gallium/drivers/freedreno/a4xx/fd4_context.h | 3 -- src/gallium/drivers/freedreno/a4xx/fd4_draw.c | 8 ++--- src/gallium/drivers/freedreno/a4xx/fd4_texture.c | 34 +-------------------- .../drivers/freedreno/ir3/ir3_compiler_nir.c | 13 -------- src/gallium/drivers/freedreno/ir3/ir3_shader.h | 4 --- 8 files changed, 7 insertions(+), 104 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_context.h b/src/gallium/drivers/freedreno/a3xx/fd3_context.h index 4e3f521..77e4605 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_context.h +++ b/src/gallium/drivers/freedreno/a3xx/fd3_context.h @@ -105,9 +105,6 @@ struct fd3_context { */ unsigned 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 * due to variant change. See fixup_shader_state() diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c index b522cf8..b5838b5 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c @@ -104,14 +104,12 @@ 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->vinteger_s != key->vinteger_s)) + (last_key->vsaturate_r != key->vsaturate_r)) ctx->prog.dirty |= FD_SHADER_DIRTY_VP; if ((last_key->fsaturate_s != key->fsaturate_s) || (last_key->fsaturate_t != key->fsaturate_t) || - (last_key->fsaturate_r != key->fsaturate_r) || - (last_key->finteger_s != key->finteger_s)) + (last_key->fsaturate_r != key->fsaturate_r)) ctx->prog.dirty |= FD_SHADER_DIRTY_FP; } @@ -140,16 +138,13 @@ fd3_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 = (fd3_ctx->fsaturate || fd3_ctx->vsaturate || - fd3_ctx->vinteger_s || fd3_ctx->finteger_s), + .has_per_samp = (fd3_ctx->fsaturate || fd3_ctx->vsaturate), .vsaturate_s = fd3_ctx->vsaturate_s, .vsaturate_t = fd3_ctx->vsaturate_t, .vsaturate_r = fd3_ctx->vsaturate_r, .fsaturate_s = fd3_ctx->fsaturate_s, .fsaturate_t = fd3_ctx->fsaturate_t, .fsaturate_r = fd3_ctx->fsaturate_r, - .vinteger_s = fd3_ctx->vinteger_s, - .finteger_s = fd3_ctx->finteger_s, }, .rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade, .sprite_coord_enable = ctx->rasterizer ? ctx->rasterizer->sprite_coord_enable : 0, diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c index 6f44ee3..a278bf5 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c @@ -263,44 +263,11 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, return &so->base; } -static void -fd3_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 fd3_context *fd3_ctx = fd3_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 = &fd3_ctx->finteger_s; - break; - case PIPE_SHADER_VERTEX: - tex = &ctx->verttex; - ptr = &fd3_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 fd3_texture_init(struct pipe_context *pctx) { pctx->create_sampler_state = fd3_sampler_state_create; pctx->bind_sampler_states = fd3_sampler_states_bind; pctx->create_sampler_view = fd3_sampler_view_create; - pctx->set_sampler_views = fd3_set_sampler_views; + pctx->set_sampler_views = fd_set_sampler_views; } diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_context.h b/src/gallium/drivers/freedreno/a4xx/fd4_context.h index 384602a..53e1bf6 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_context.h +++ b/src/gallium/drivers/freedreno/a4xx/fd4_context.h @@ -83,9 +83,6 @@ struct fd4_context { */ 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 * due to variant change. See fixup_shader_state() diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c index ae407f7..de5a306 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c @@ -82,8 +82,7 @@ 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->vinteger_s != key->vinteger_s)) + (last_key->vsaturate_r != key->vsaturate_r)) ctx->prog.dirty |= FD_SHADER_DIRTY_VP; if ((last_key->fsaturate_s != key->fsaturate_s) || @@ -122,16 +121,13 @@ 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 || - fd4_ctx->vinteger_s || fd4_ctx->finteger_s), + .has_per_samp = (fd4_ctx->fsaturate || fd4_ctx->vsaturate), .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 ff1ff8f..6ba25d0 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c @@ -205,43 +205,11 @@ 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 = fd4_set_sampler_views; + pctx->set_sampler_views = fd_set_sampler_views; } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 4165e2d..5c215a5 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -57,9 +57,6 @@ struct ir3_compile { struct ir3 *ir; struct ir3_shader_variant *so; - /* bitmask of which samplers are integer: */ - uint16_t integer_s; - struct ir3_block *block; /* the current block */ struct ir3_block *in_block; /* block created for shader inputs */ @@ -234,16 +231,6 @@ compile_init(struct ir3_compiler *compiler, ctx->levels_add_one = true; } - switch (so->type) { - case SHADER_FRAGMENT: - case SHADER_COMPUTE: - ctx->integer_s = so->key.finteger_s; - break; - case SHADER_VERTEX: - ctx->integer_s = so->key.vinteger_s; - break; - } - ctx->compiler = compiler; ctx->ir = so->ir; ctx->so = so; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index 8141c56..9f1b076 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -86,10 +86,6 @@ struct ir3_shader_key { * shader: */ uint16_t fsaturate_s, fsaturate_t, fsaturate_r; - - /* bitmask of sampler which produces integer outputs: - */ - uint16_t vinteger_s, finteger_s; }; static inline bool -- 2.7.4