Mesa (master): glsl: move check_subroutine_resources() into the shared util code
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jan 10 01:06:13 UTC 2020
Module: Mesa
Branch: master
Commit: a6fd1c7752787a42aef72f93ce4168c3e73808b7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6fd1c7752787a42aef72f93ce4168c3e73808b7
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Tue Jan 7 10:08:15 2020 +1100
glsl: move check_subroutine_resources() into the shared util code
We will make use of this in the nir linker in the following patch.
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
---
src/compiler/glsl/linker.cpp | 16 +---------------
src/compiler/glsl/linker_util.cpp | 16 ++++++++++++++++
src/compiler/glsl/linker_util.h | 3 +++
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index bf41337e479..f2ea266c9d6 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3436,20 +3436,6 @@ link_calculate_subroutine_compat(struct gl_shader_program *prog)
}
}
-static void
-check_subroutine_resources(struct gl_shader_program *prog)
-{
- unsigned mask = prog->data->linked_stages;
- while (mask) {
- const int i = u_bit_scan(&mask);
- struct gl_program *p = prog->_LinkedShaders[i]->Program;
-
- if (p->sh.NumSubroutineUniformRemapTable > MAX_SUBROUTINE_UNIFORM_LOCATIONS) {
- linker_error(prog, "Too many %s shader subroutine uniforms\n",
- _mesa_shader_stage_to_string(i));
- }
- }
-}
/**
* Validate shader image resources.
*/
@@ -4535,7 +4521,7 @@ link_and_validate_uniforms(struct gl_context *ctx,
link_calculate_subroutine_compat(prog);
check_resources(ctx, prog);
- check_subroutine_resources(prog);
+ link_util_check_subroutine_resources(prog);
if (!ctx->Const.UseNIRGLSLLinker) {
check_image_resources(ctx, prog);
diff --git a/src/compiler/glsl/linker_util.cpp b/src/compiler/glsl/linker_util.cpp
index 99e3693b548..32bc4cb33a5 100644
--- a/src/compiler/glsl/linker_util.cpp
+++ b/src/compiler/glsl/linker_util.cpp
@@ -23,6 +23,7 @@
*/
#include "main/mtypes.h"
#include "linker_util.h"
+#include "util/bitscan.h"
#include "util/set.h"
#include "ir_uniform.h" /* for gl_uniform_storage */
@@ -154,3 +155,18 @@ link_util_update_empty_uniform_locations(struct gl_shader_program *prog)
}
}
}
+
+void
+link_util_check_subroutine_resources(struct gl_shader_program *prog)
+{
+ unsigned mask = prog->data->linked_stages;
+ while (mask) {
+ const int i = u_bit_scan(&mask);
+ struct gl_program *p = prog->_LinkedShaders[i]->Program;
+
+ if (p->sh.NumSubroutineUniformRemapTable > MAX_SUBROUTINE_UNIFORM_LOCATIONS) {
+ linker_error(prog, "Too many %s shader subroutine uniforms\n",
+ _mesa_shader_stage_to_string(i));
+ }
+ }
+}
diff --git a/src/compiler/glsl/linker_util.h b/src/compiler/glsl/linker_util.h
index 20a7b97527a..90ee200545a 100644
--- a/src/compiler/glsl/linker_util.h
+++ b/src/compiler/glsl/linker_util.h
@@ -70,6 +70,9 @@ link_util_find_empty_block(struct gl_shader_program *prog,
void
link_util_update_empty_uniform_locations(struct gl_shader_program *prog);
+void
+link_util_check_subroutine_resources(struct gl_shader_program *prog);
+
#ifdef __cplusplus
}
#endif
More information about the mesa-commit
mailing list