summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-11-29 19:24:35 -0500
committerIlia Mirkin <[email protected]>2014-11-30 13:04:28 -0500
commit82104c19f304a0e953172ad61d149640f0512fa0 (patch)
tree7a4349d42e6050bee3e8579e423b93266ba8d7b8 /src/gallium/drivers/freedreno/ir3
parent8e336ef55bacae58fc099a8b8a4b7d3d007c4434 (diff)
freedreno/a3xx: enable sampling from integer textures
We need to produce a u32 destination type on integer sampling instructions, so keep that in a shader key set based on the currently-bound textures. Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler.c8
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index da72c5c33f7..6cc21acaf3f 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -53,6 +53,7 @@ struct ir3_compile_context {
bool free_tokens;
struct ir3 *ir;
struct ir3_shader_variant *so;
+ uint16_t integer_s;
struct ir3_block *block;
struct ir3_instruction *current_instr;
@@ -159,11 +160,13 @@ compile_init(struct ir3_compile_context *ctx, struct ir3_shader_variant *so,
lconfig.saturate_s = so->key.fsaturate_s;
lconfig.saturate_t = so->key.fsaturate_t;
lconfig.saturate_r = so->key.fsaturate_r;
+ ctx->integer_s = so->key.finteger_s;
break;
case SHADER_VERTEX:
lconfig.saturate_s = so->key.vsaturate_s;
lconfig.saturate_t = so->key.vsaturate_t;
lconfig.saturate_r = so->key.vsaturate_r;
+ ctx->integer_s = so->key.vinteger_s;
break;
}
@@ -1345,7 +1348,10 @@ trans_samp(const struct instr_translater *t,
}
instr = instr_create(ctx, 5, t->opc);
- instr->cat5.type = get_ftype(ctx);
+ if (ctx->integer_s & (1 << samp->Index))
+ instr->cat5.type = get_utype(ctx);
+ else
+ instr->cat5.type = get_ftype(ctx);
instr->cat5.samp = samp->Index;
instr->cat5.tex = samp->Index;
instr->flags |= tinf.flags;
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
index f70886e2d3b..89442cec128 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
@@ -91,6 +91,9 @@ struct ir3_shader_key {
*/
uint16_t fsaturate_s, fsaturate_t, fsaturate_r;
+ /* bitmask of sampler which produces integer outputs:
+ */
+ uint16_t vinteger_s, finteger_s;
};
static inline bool