summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Kristóf <[email protected]>2019-02-08 22:36:37 +0100
committerEric Anholt <[email protected]>2019-03-05 19:13:27 +0000
commit909d1f50f3ffc62d5a23669ad0bc8eedb9416af0 (patch)
treec027bc73c8997ba44e7c83817f7863a5838339d9 /src
parent4dba72c4b35eeb312da232b2f30f067885bc9f07 (diff)
nir: Move nir_lower_uniforms_to_ubo to compiler/nir.
The nir_lower_uniforms_to_ubo function is useful outside of mesa/state_tracker, and in fact is needed to produce NIR for drivers that have the PIPE_CAP_PACKED_UNIFORMS capability. Signed-Off-By: Timur Kristóf <[email protected]> Tested-by: Andre Heider <[email protected]> Tested-by: Rob Clark <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/Makefile.sources1
-rw-r--r--src/compiler/nir/meson.build1
-rw-r--r--src/compiler/nir/nir.h2
-rw-r--r--src/compiler/nir/nir_lower_uniforms_to_ubo.c (renamed from src/mesa/state_tracker/st_nir_lower_uniforms_to_ubo.c)10
-rw-r--r--src/mesa/Makefile.sources1
-rw-r--r--src/mesa/meson.build1
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp2
-rw-r--r--src/mesa/state_tracker/st_nir.h1
-rw-r--r--src/mesa/state_tracker/st_nir_builtins.c2
9 files changed, 10 insertions, 11 deletions
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 489022a22a1..85c216fef1d 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -262,6 +262,7 @@ NIR_FILES = \
nir/nir_lower_tex.c \
nir/nir_lower_to_source_mods.c \
nir/nir_lower_two_sided_color.c \
+ nir/nir_lower_uniforms_to_ubo.c \
nir/nir_lower_vars_to_ssa.c \
nir/nir_lower_var_copies.c \
nir/nir_lower_vec_to_movs.c \
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 20a26a26255..d7f88f391f4 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -150,6 +150,7 @@ files_libnir = files(
'nir_lower_wpos_center.c',
'nir_lower_wpos_ytransform.c',
'nir_lower_bit_size.c',
+ 'nir_lower_uniforms_to_ubo.c',
'nir_metadata.c',
'nir_move_load_const.c',
'nir_move_vec_src_uses_to_dest.c',
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 76ee81ec074..a0b6db80b76 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -3036,6 +3036,8 @@ void nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader,
void nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask);
void nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask);
+bool nir_lower_uniforms_to_ubo(nir_shader *shader);
+
typedef struct nir_lower_subgroups_options {
uint8_t subgroup_size;
uint8_t ballot_bit_size;
diff --git a/src/mesa/state_tracker/st_nir_lower_uniforms_to_ubo.c b/src/compiler/nir/nir_lower_uniforms_to_ubo.c
index 1727f8214a0..b54c9943ab7 100644
--- a/src/mesa/state_tracker/st_nir_lower_uniforms_to_ubo.c
+++ b/src/compiler/nir/nir_lower_uniforms_to_ubo.c
@@ -29,11 +29,8 @@
* point by 1.
*/
-#include "compiler/nir/nir.h"
-#include "compiler/nir/nir_builder.h"
-#include "st_nir.h"
-
-#include "program/prog_parameter.h"
+#include "nir.h"
+#include "nir_builder.h"
static bool
lower_instr(nir_intrinsic_instr *instr, nir_builder *b)
@@ -74,7 +71,7 @@ lower_instr(nir_intrinsic_instr *instr, nir_builder *b)
}
bool
-st_nir_lower_uniforms_to_ubo(nir_shader *shader)
+nir_lower_uniforms_to_ubo(nir_shader *shader)
{
bool progress = false;
@@ -98,3 +95,4 @@ st_nir_lower_uniforms_to_ubo(nir_shader *shader)
return progress;
}
+
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 1e25f47e509..f482963a1ac 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -540,7 +540,6 @@ STATETRACKER_FILES = \
state_tracker/st_nir_builtins.c \
state_tracker/st_nir_lower_builtin.c \
state_tracker/st_nir_lower_tex_src_plane.c \
- state_tracker/st_nir_lower_uniforms_to_ubo.c \
state_tracker/st_pbo.c \
state_tracker/st_pbo.h \
state_tracker/st_program.c \
diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index d8a5682f6a0..517506b12c4 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -584,7 +584,6 @@ files_libmesa_gallium = files(
'state_tracker/st_nir_builtins.c',
'state_tracker/st_nir_lower_builtin.c',
'state_tracker/st_nir_lower_tex_src_plane.c',
- 'state_tracker/st_nir_lower_uniforms_to_ubo.c',
'state_tracker/st_pbo.c',
'state_tracker/st_pbo.h',
'state_tracker/st_program.c',
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index a1e3b6233c6..84638fd88a5 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -991,7 +991,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
if (st->ctx->Const.PackedDriverUniformStorage) {
NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
(nir_lower_io_options)0);
- NIR_PASS_V(nir, st_nir_lower_uniforms_to_ubo);
+ NIR_PASS_V(nir, nir_lower_uniforms_to_ubo);
}
st_nir_lower_samplers(screen, nir, shader_program, prog);
diff --git a/src/mesa/state_tracker/st_nir.h b/src/mesa/state_tracker/st_nir.h
index d45ab3c4474..94eae84402e 100644
--- a/src/mesa/state_tracker/st_nir.h
+++ b/src/mesa/state_tracker/st_nir.h
@@ -36,7 +36,6 @@ struct nir_shader;
void st_nir_lower_builtin(struct nir_shader *shader);
void st_nir_lower_tex_src_plane(struct nir_shader *shader, unsigned free_slots,
unsigned lower_2plane, unsigned lower_3plane);
-bool st_nir_lower_uniforms_to_ubo(struct nir_shader *shader);
void st_nir_lower_wpos_ytransform(struct nir_shader *nir,
struct gl_program *prog,
diff --git a/src/mesa/state_tracker/st_nir_builtins.c b/src/mesa/state_tracker/st_nir_builtins.c
index 3826d96a888..ce00b5e1671 100644
--- a/src/mesa/state_tracker/st_nir_builtins.c
+++ b/src/mesa/state_tracker/st_nir_builtins.c
@@ -66,7 +66,7 @@ st_nir_finish_builtin_shader(struct st_context *st,
if (st->ctx->Const.PackedDriverUniformStorage) {
NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
(nir_lower_io_options)0);
- NIR_PASS_V(nir, st_nir_lower_uniforms_to_ubo);
+ NIR_PASS_V(nir, nir_lower_uniforms_to_ubo);
}
struct pipe_shader_state state = {