diff options
author | Vadim Girlin <[email protected]> | 2013-04-25 19:42:31 +0400 |
---|---|---|
committer | Vadim Girlin <[email protected]> | 2013-04-30 21:50:47 +0400 |
commit | 7d555f2f4ce8be3c53bcc914620bcefc22c05cb5 (patch) | |
tree | 3afe556033a621c5e0fd8fd0f278f719d59199f2 /src/gallium | |
parent | df410863d7c2377cfbabfef907fc318e10c5486e (diff) |
r600g: mask unused source components for SAMPLE
This results in more clean shader code and may improve the quality of
optimized code produced by r600-sb due to eliminated false dependencies
in some cases.
Signed-off-by: Vadim Girlin <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index bb54e38a63c..f0d3be405d2 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -4743,6 +4743,26 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) /* the array index is read from Z */ tex.coord_type_z = 0; + /* mask unused source components */ + if (opcode == FETCH_OP_SAMPLE) { + switch (inst->Texture.Texture) { + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_RECT: + tex.src_sel_z = 7; + tex.src_sel_w = 7; + break; + case TGSI_TEXTURE_1D_ARRAY: + tex.src_sel_y = 7; + tex.src_sel_w = 7; + break; + case TGSI_TEXTURE_1D: + tex.src_sel_y = 7; + tex.src_sel_z = 7; + tex.src_sel_w = 7; + break; + } + } + r = r600_bytecode_add_tex(ctx->bc, &tex); if (r) return r; |