summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-05 08:44:22 +1100
committerTimothy Arceri <[email protected]>2017-01-06 11:21:41 +1100
commitb792c3897927c1d89968bc0040faef02ec976184 (patch)
treec2de83abcdb6522dd42b2599127fbc1f1b2dccbe /src/mesa
parenta1da57c19c27505b9eab4792355f2f1b5c774a0a (diff)
st/mesa/glsl/i965: set num_ubos directly in shader_info
This also removes the duplicate field in gl_linked_shader, and gets num_ubos from shader_info instead. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c4
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c2
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp6
5 files changed, 7 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index dfc7407ea5b..e45f6cce088 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -1208,9 +1208,9 @@ brw_assign_common_binding_table_offsets(gl_shader_stage stage,
next_binding_table_offset += num_textures;
if (shader) {
- assert(shader->NumUniformBlocks <= BRW_MAX_UBO);
+ assert(prog->info.num_ubos <= BRW_MAX_UBO);
stage_prog_data->binding_table.ubo_start = next_binding_table_offset;
- next_binding_table_offset += shader->NumUniformBlocks;
+ next_binding_table_offset += prog->info.num_ubos;
assert(shader->NumShaderStorageBlocks <= BRW_MAX_SSBO);
stage_prog_data->binding_table.ssbo_start = next_binding_table_offset;
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 34fec7e7d94..e3a6033e01a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1383,7 +1383,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
uint32_t *ubo_surf_offsets =
&stage_state->surf_offset[prog_data->binding_table.ubo_start];
- for (int i = 0; i < shader->NumUniformBlocks; i++) {
+ for (int i = 0; i < shader->Program->info.num_ubos; i++) {
struct gl_uniform_buffer_binding *binding =
&ctx->UniformBufferBindings[shader->UniformBlocks[i]->Binding];
@@ -1430,7 +1430,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
}
}
- if (shader->NumUniformBlocks || shader->NumShaderStorageBlocks)
+ if (shader->Program->info.num_ubos || shader->NumShaderStorageBlocks)
brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fa14c87a2c0..9c1bbd5b40a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2382,7 +2382,6 @@ struct gl_linked_shader
*/
unsigned num_combined_uniform_components;
- unsigned NumUniformBlocks;
struct gl_uniform_block **UniformBlocks;
unsigned NumShaderStorageBlocks;
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 3b5031dcf20..30bffa648c5 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -248,7 +248,7 @@ static void st_bind_ubos(struct st_context *st,
if (!shader)
return;
- for (i = 0; i < shader->NumUniformBlocks; i++) {
+ for (i = 0; i < shader->Program->info.num_ubos; i++) {
struct gl_uniform_buffer_binding *binding;
struct st_buffer_object *st_obj;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index df7a1bc0cfe..99422df7f74 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6302,9 +6302,7 @@ st_translate_program(
}
if (program->shader) {
- unsigned num_ubos = program->shader->NumUniformBlocks;
-
- for (i = 0; i < num_ubos; i++) {
+ 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;
@@ -6646,7 +6644,7 @@ set_affected_state_flags(uint64_t *states,
if (shader->NumImages)
*states |= new_images;
- if (shader->NumUniformBlocks)
+ if (prog->info.num_ubos)
*states |= new_ubos;
if (shader->NumShaderStorageBlocks)