summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-03-10 08:57:51 -0500
committerJason Ekstrand <[email protected]>2019-03-15 01:02:19 +0000
commitefa4fc0ebd96b3fbcf30550494251307f11dc7b9 (patch)
tree14306409e69f1e5dd37757f54682da9778f5d850 /src/mesa/state_tracker
parentbe2990d8fbcd5b4b450e7bfd2053b62d66153b8d (diff)
st/mesa: Let NIR lower UBO and SSBO access when we have it
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_extensions.c8
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp4
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 528e6b74a54..c953bfd9f7a 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -329,7 +329,13 @@ void st_init_limits(struct pipe_screen *screen,
if (!screen->get_param(screen, PIPE_CAP_NIR_COMPACT_ARRAYS))
options->LowerCombinedClipCullDistance = true;
- options->LowerBufferInterfaceBlocks = true;
+ bool prefer_nir = PIPE_SHADER_IR_NIR ==
+ screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_PREFERRED_IR);
+
+ /* NIR can do the lowering on our behalf and we'll get better results
+ * because it can actually optimize SSBO access.
+ */
+ options->LowerBufferInterfaceBlocks = !prefer_nir;
}
c->MaxUserAssignableUniformLocations =
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 03637299ca4..e5d5fe21e27 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -415,6 +415,10 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
st_nir_opts(nir, is_scalar);
+ NIR_PASS_V(nir, gl_nir_lower_buffers, shader_program);
+ /* Do a round of constant folding to clean up address calculations */
+ NIR_PASS_V(nir, nir_opt_constant_folding);
+
if (lower_64bit) {
bool lowered_64bit_ops = false;
bool progress = false;