summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-12-04 21:42:14 +1100
committerTimothy Arceri <[email protected]>2017-01-19 15:55:02 +1100
commitc054bbf0d40350bce931bccfce59d0c4ebca6fd1 (patch)
tree36af93b2a87c8f9666db3627ce0ddcdff9f370cb
parentce4fb3c8a136d129d7afad5a919c1403e38d8c02 (diff)
glsl: create a new link_and_validate_uniforms() helper
Currently this just breaks up the linking code a bit but in the future i965 will call this from the backend via Driver.LinkShader() so that we can do NIR optimisations before assigning uniform locations. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/compiler/glsl/linker.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 61360df8a6e..4db3ad1dea4 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4531,6 +4531,22 @@ disable_varying_optimizations_for_sso(struct gl_shader_program *prog)
}
}
+static void
+link_and_validate_uniforms(struct gl_context *ctx,
+ struct gl_shader_program *prog,
+ unsigned num_explicit_uniform_locs)
+{
+ update_array_sizes(prog);
+ link_assign_uniform_locations(prog, ctx, num_explicit_uniform_locs);
+
+ link_assign_atomic_counter_resources(ctx, prog);
+ link_calculate_subroutine_compat(prog);
+ check_resources(ctx, prog);
+ check_subroutine_resources(prog);
+ check_image_resources(ctx, prog);
+ link_check_atomic_counter_resources(ctx, prog);
+}
+
static bool
link_varyings_and_uniforms(unsigned first, unsigned last,
unsigned num_explicit_uniform_locs,
@@ -4579,15 +4595,7 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
if (!link_varyings(prog, first, last, ctx, mem_ctx))
return false;
- update_array_sizes(prog);
- link_assign_uniform_locations(prog, ctx, num_explicit_uniform_locs);
- link_assign_atomic_counter_resources(ctx, prog);
-
- link_calculate_subroutine_compat(prog);
- check_resources(ctx, prog);
- check_subroutine_resources(prog);
- check_image_resources(ctx, prog);
- link_check_atomic_counter_resources(ctx, prog);
+ link_and_validate_uniforms(ctx, prog, num_explicit_uniform_locs);
if (!prog->data->LinkStatus)
return false;