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 <vadimgir...@gmail.com> --- There are no piglit regressions with this patch on evergreen. I consider this as a prerequisite for r600-sb branch, it fixes the performance regression with optimized shaders uncovered by some recent changes to tgsi and/or r600 codegen. If there are no objections or new suggestions, is it OK to push the latest version of r600-sb-2 branch [1] that includes this patch? The changes in the branch after the recent mail include 3 additional patches to improve handling of some corner cases (they fix some issues reported on IRC), also they add switching to unoptimized code in case of possible internal optimization problems, and new option "sbnofallback" for R600_DEBUG to disable such fallback. Vadim [1] http://cgit.freedesktop.org/~vadimg/mesa/log/?h=r600-sb-2 src/gallium/drivers/r600/r600_shader.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 0204f80..aa88252 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -4739,6 +4739,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; -- 1.8.2.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev