[Mesa-dev] [WIP 07/13] glsl/linker: change link_assign_uniform_locations signature
Tapani Pälli
tapani.palli at intel.com
Thu Mar 27 23:45:30 PDT 2014
Patch changes link_assign_uniform_locations to return bool to indicate
success and adds context as a parameter so that function can access
constant variables in the context.
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
src/glsl/link_uniforms.cpp | 9 +++++----
src/glsl/linker.cpp | 5 ++++-
src/glsl/linker.h | 5 +++--
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 3fedf31..9c959f6 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -792,8 +792,9 @@ link_set_image_access_qualifiers(struct gl_shader_program *prog)
}
}
-void
-link_assign_uniform_locations(struct gl_shader_program *prog)
+bool
+link_assign_uniform_locations(struct gl_context *ctx,
+ struct gl_shader_program *prog)
{
ralloc_free(prog->UniformStorage);
prog->UniformStorage = NULL;
@@ -875,7 +876,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
/* On the outside chance that there were no uniforms, bail out.
*/
if (num_user_uniforms == 0)
- return;
+ return true;
struct gl_uniform_storage *uniforms =
rzalloc_array(prog, struct gl_uniform_storage, num_user_uniforms);
@@ -952,5 +953,5 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
link_set_image_access_qualifiers(prog);
link_set_uniform_initializers(prog);
- return;
+ return true;
}
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 43db824..c31948e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2445,7 +2445,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
update_array_sizes(prog);
- link_assign_uniform_locations(prog);
+
+ if (!link_assign_uniform_locations(ctx, prog))
+ goto done;
+
link_assign_atomic_counter_resources(ctx, prog);
store_fragdepth_layout(prog);
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index 130915d..f91b49e 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -33,8 +33,9 @@ link_function_calls(gl_shader_program *prog, gl_shader *main,
extern void
link_invalidate_variable_locations(exec_list *ir);
-extern void
-link_assign_uniform_locations(struct gl_shader_program *prog);
+extern bool
+link_assign_uniform_locations(struct gl_context *ctx,
+ struct gl_shader_program *prog);
extern void
link_set_uniform_initializers(struct gl_shader_program *prog);
--
1.8.3.1
More information about the mesa-dev
mailing list