From 90bb2d7152ba63e1592e3c1aabc69386a10f2d89 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Tue, 3 Apr 2018 00:00:59 -0400 Subject: [PATCH] st/mesa: tex offsets can't be in a const or 2d-indexed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit All consts are now implicitly 2d (they set .Dimension), so trigger asserts. Also, the texture offset can't handle any sort of 2d indexing. While this could be tacked on, this seems unnecessary, just move it off into a separate temp. Fixes assertion failure in tests/spec/arb_gpu_shader5/compiler/builtin-functions/fs-gatherOffset-uniform-offset.frag Note that this was an issue even before the const-always-2d thing, since there was no detection of when even a proper second dimension was used, e.g. for UBO or geom/tess inputs. Signed-off-by: Ilia Mirkin Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 5f7a0dc..01a58d7 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4096,7 +4096,11 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir, st_src_reg glsl_to_tgsi_visitor::canonicalize_gather_offset(st_src_reg offset) { - if (offset.reladdr || offset.reladdr2) { + if (offset.reladdr || offset.reladdr2 || + offset.has_index2 || + offset.file == PROGRAM_UNIFORM || + offset.file == PROGRAM_CONSTANT || + offset.file == PROGRAM_STATE_VAR) { st_src_reg tmp = get_temp(glsl_type::ivec2_type); st_dst_reg tmp_dst = st_dst_reg(tmp); tmp_dst.writemask = WRITEMASK_XY; -- 2.7.4