summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2022-05-17 08:18:26 -0700
committerIan Romanick <ian.d.romanick@intel.com>2022-05-17 08:18:34 -0700
commitf9f7ea3a720b95b527fb7ac34e4e1404ca0a873f (patch)
tree3ea3fe6d73131025d5ad665e43915413db9a8251
parentc19f9ff044f3d0ca1773722130d7066c973e6371 (diff)
WIP: Use NIR lowering for tg4 offset arrays instead of GLSL loweringreview/issue-6365
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp3
-rw-r--r--src/gallium/drivers/d3d12/d3d12_compiler.cpp1
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_nir.cpp1
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c1
-rw-r--r--src/mesa/state_tracker/st_extensions.c3
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp3
6 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 767b96e98f4..a9cacdb7f28 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2116,9 +2116,6 @@ opt_shader_and_create_symbol_table(const struct gl_constants *consts,
do_common_optimization(shader->ir, false, false, options,
consts->NativeIntegers);
- if (options->LowerTextureGatherOffsetArrays)
- lower_offset_arrays(shader->ir, shader->symbols);
-
validate_ir_tree(shader->ir);
enum ir_variable_mode other;
diff --git a/src/gallium/drivers/d3d12/d3d12_compiler.cpp b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
index b0fbebd2e05..e4262345d94 100644
--- a/src/gallium/drivers/d3d12/d3d12_compiler.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_compiler.cpp
@@ -1159,6 +1159,7 @@ select_shader_variant(struct d3d12_selection_context *sel_ctx, d3d12_shader_sele
tex_options.saturate_r = key.tex_saturate_r;
tex_options.saturate_t = key.tex_saturate_t;
tex_options.lower_invalid_implicit_lod = true;
+ tex_options.lower_tg4_offsets = true;
NIR_PASS_V(new_nir_variant, nir_lower_tex, &tex_options);
}
diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp
index 46c10e40008..a0e0fae1b9d 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp
@@ -837,6 +837,7 @@ int r600_shader_from_nir(struct r600_context *rctx,
lower_tex_options.lower_txp = ~0u;
lower_tex_options.lower_txf_offset = true;
lower_tex_options.lower_invalid_implicit_lod = true;
+ lower_tex_options.lower_tg4_offsets = true;
NIR_PASS_V(sel->nir, nir_lower_tex, &lower_tex_options);
NIR_PASS_V(sel->nir, r600::r600_nir_lower_txl_txf_array_or_cube);
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index d3bbc864b6e..c4eb09b6a8b 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -236,6 +236,7 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
.lower_txp = ~0u,
.lower_txs_cube_array = true,
.lower_invalid_implicit_lod = true,
+ .lower_tg4_options = true,
};
NIR_PASS_V(nir, nir_lower_tex, &lower_tex_options);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 66d179f463f..e0ceb29a26d 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -358,9 +358,6 @@ void st_init_limits(struct pipe_screen *screen,
if (!screen->get_param(screen, PIPE_CAP_NIR_COMPACT_ARRAYS))
options->LowerCombinedClipCullDistance = true;
- if (!screen->get_param(screen, PIPE_CAP_TEXTURE_GATHER_OFFSETS))
- options->LowerTextureGatherOffsetArrays = true;
-
if (sh == PIPE_SHADER_VERTEX || sh == PIPE_SHADER_GEOMETRY) {
if (screen->get_param(screen, PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED))
options->LowerBuiltinVariablesXfb |= VARYING_BIT_POS;
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index c379702d94a..241720d862e 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -1101,6 +1101,9 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
opts.lower_rect = true;
+ if (!st->screen->get_param(screen, PIPE_CAP_TEXTURE_GATHER_OFFSETS))
+ opts.lower_tg4_offsets = true;
+
NIR_PASS_V(nir, nir_lower_tex, &opts);
}