summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp3
-rw-r--r--src/mesa/state_tracker/st_glsl_types.cpp11
-rw-r--r--src/mesa/state_tracker/st_glsl_types.h2
-rw-r--r--src/mesa/state_tracker/st_nir_builtins.c3
4 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index fb10869c9f9..bb693dc70f7 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -945,6 +945,9 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
(nir_lower_io_options)0);
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 4);
+ } else {
+ NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_uniforms_type_size,
+ (nir_lower_io_options)0);
}
st_nir_lower_samplers(screen, nir, shader_program, prog);
diff --git a/src/mesa/state_tracker/st_glsl_types.cpp b/src/mesa/state_tracker/st_glsl_types.cpp
index 42d4e9cef2d..277b91c4a5c 100644
--- a/src/mesa/state_tracker/st_glsl_types.cpp
+++ b/src/mesa/state_tracker/st_glsl_types.cpp
@@ -155,3 +155,14 @@ st_glsl_type_dword_size(const struct glsl_type *type)
return 0;
}
+
+/**
+ * Returns the type size of uniforms when !PIPE_CAP_PACKED_UNIFORMS -- each
+ * value or array element is aligned to a vec4 offset and expanded out to a
+ * vec4.
+ */
+int
+st_glsl_uniforms_type_size(const struct glsl_type *type)
+{
+ return st_glsl_storage_type_size(type, false);
+}
diff --git a/src/mesa/state_tracker/st_glsl_types.h b/src/mesa/state_tracker/st_glsl_types.h
index 16b31b684f3..e0aff12366a 100644
--- a/src/mesa/state_tracker/st_glsl_types.h
+++ b/src/mesa/state_tracker/st_glsl_types.h
@@ -36,6 +36,8 @@ extern "C" {
int st_glsl_storage_type_size(const struct glsl_type *type,
bool is_bindless);
+int st_glsl_uniforms_type_size(const struct glsl_type *type);
+
int st_glsl_type_dword_size(const struct glsl_type *type);
#ifdef __cplusplus
diff --git a/src/mesa/state_tracker/st_nir_builtins.c b/src/mesa/state_tracker/st_nir_builtins.c
index 8ec320cbb9c..01663b702ac 100644
--- a/src/mesa/state_tracker/st_nir_builtins.c
+++ b/src/mesa/state_tracker/st_nir_builtins.c
@@ -67,6 +67,9 @@ st_nir_finish_builtin_shader(struct st_context *st,
NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
(nir_lower_io_options)0);
NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, 4);
+ } else {
+ NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_uniforms_type_size,
+ (nir_lower_io_options)0);
}
struct pipe_shader_state state = {