summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-05 08:55:57 +1100
committerTimothy Arceri <[email protected]>2017-01-06 11:21:41 +1100
commit0e7eec1ab5f27ced1aa4b2d77c2c63512d299694 (patch)
tree1cf0ae90e08fd5c0f177a773a62a74c39545223d /src/mesa
parentb792c3897927c1d89968bc0040faef02ec976184 (diff)
st/mesa/glsl/i965: move per stage UniformBlocks to gl_program
This will help allow us to store pointers to gl_program structs in the CurrentProgram array resulting in a bunch of code simplifications. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c2
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp18
4 files changed, 12 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index e3a6033e01a..2140312a802 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1385,7 +1385,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
for (int i = 0; i < shader->Program->info.num_ubos; i++) {
struct gl_uniform_buffer_binding *binding =
- &ctx->UniformBufferBindings[shader->UniformBlocks[i]->Binding];
+ &ctx->UniformBufferBindings[shader->Program->sh.UniformBlocks[i]->Binding];
if (binding->BufferObject == ctx->Shared->NullBufferObj) {
brw->vtbl.emit_null_surface_state(brw, 1, 1, 1, &ubo_surf_offsets[i]);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9c1bbd5b40a..308af2d3a75 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1999,6 +1999,8 @@ struct gl_program
*/
GLenum ImageAccess[MAX_IMAGE_UNIFORMS];
+ struct gl_uniform_block **UniformBlocks;
+
union {
struct {
/**
@@ -2382,8 +2384,6 @@ struct gl_linked_shader
*/
unsigned num_combined_uniform_components;
- struct gl_uniform_block **UniformBlocks;
-
unsigned NumShaderStorageBlocks;
struct gl_uniform_block **ShaderStorageBlocks;
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 30bffa648c5..45bb8853599 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -252,7 +252,7 @@ static void st_bind_ubos(struct st_context *st,
struct gl_uniform_buffer_binding *binding;
struct st_buffer_object *st_obj;
- binding = &st->ctx->UniformBufferBindings[shader->UniformBlocks[i]->Binding];
+ binding = &st->ctx->UniformBufferBindings[shader->Program->sh.UniformBlocks[i]->Binding];
st_obj = st_buffer_object(binding->BufferObject);
cb.buffer = st_obj->buffer;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 99422df7f74..393d66820d8 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6301,16 +6301,14 @@ st_translate_program(
}
}
- if (program->shader) {
- for (i = 0; i < proginfo->info.num_ubos; i++) {
- unsigned size = program->shader->UniformBlocks[i]->UniformBufferSize;
- unsigned num_const_vecs = (size + 15) / 16;
- unsigned first, last;
- assert(num_const_vecs > 0);
- first = 0;
- last = num_const_vecs > 0 ? num_const_vecs - 1 : 0;
- ureg_DECL_constant2D(t->ureg, first, last, i + 1);
- }
+ for (i = 0; i < proginfo->info.num_ubos; i++) {
+ unsigned size = proginfo->sh.UniformBlocks[i]->UniformBufferSize;
+ unsigned num_const_vecs = (size + 15) / 16;
+ unsigned first, last;
+ assert(num_const_vecs > 0);
+ first = 0;
+ last = num_const_vecs > 0 ? num_const_vecs - 1 : 0;
+ ureg_DECL_constant2D(t->ureg, first, last, i + 1);
}
/* Emit immediate values.