aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker_util.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2020-01-07 10:08:15 +1100
committerTimothy Arceri <[email protected]>2020-01-10 00:41:20 +0000
commita6fd1c7752787a42aef72f93ce4168c3e73808b7 (patch)
treed96c2dd5403f0191214006fb761060457fe35c76 /src/compiler/glsl/linker_util.cpp
parent3dec68e6823ae74c71ce0a24f15cd33df3e08f9c (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker_util.cpp')
-rw-r--r--src/compiler/glsl/linker_util.cpp16
1 files changed, 16 insertions, 0 deletions
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));
+ }
+ }
+}