summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-05 09:24:51 +1100
committerTimothy Arceri <[email protected]>2017-01-06 11:21:41 +1100
commitf62eb6c7eb22cd97c691ebdb5f25eb5fe8e9ed11 (patch)
tree6ffcf849dfef0c490d475a880a8208a4ab2fbf9b /src/mesa
parent0e7eec1ab5f27ced1aa4b2d77c2c63512d299694 (diff)
st/mesa/glsl/i965: set num_ssbos directly in shader_info
Here we also remove the duplicate field in gl_linked_shader and always get the value 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.cpp11
-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_storagebuf.c10
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
5 files changed, 15 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index e45f6cce088..cabaf622a6f 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -1207,16 +1207,19 @@ brw_assign_common_binding_table_offsets(gl_shader_stage stage,
stage_prog_data->binding_table.texture_start = next_binding_table_offset;
next_binding_table_offset += num_textures;
- if (shader) {
+ if (prog->info.num_ubos) {
assert(prog->info.num_ubos <= BRW_MAX_UBO);
stage_prog_data->binding_table.ubo_start = next_binding_table_offset;
next_binding_table_offset += prog->info.num_ubos;
+ } else {
+ stage_prog_data->binding_table.ubo_start = 0xd0d0d0d0;
+ }
- assert(shader->NumShaderStorageBlocks <= BRW_MAX_SSBO);
+ if (prog->info.num_ssbos) {
+ assert(prog->info.num_ssbos <= BRW_MAX_SSBO);
stage_prog_data->binding_table.ssbo_start = next_binding_table_offset;
- next_binding_table_offset += shader->NumShaderStorageBlocks;
+ next_binding_table_offset += prog->info.num_ssbos;
} else {
- stage_prog_data->binding_table.ubo_start = 0xd0d0d0d0;
stage_prog_data->binding_table.ssbo_start = 0xd0d0d0d0;
}
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 2140312a802..28cb2ca2bd4 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1408,7 +1408,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
uint32_t *ssbo_surf_offsets =
&stage_state->surf_offset[prog_data->binding_table.ssbo_start];
- for (int i = 0; i < shader->NumShaderStorageBlocks; i++) {
+ for (int i = 0; i < shader->Program->info.num_ssbos; i++) {
struct gl_shader_storage_buffer_binding *binding =
&ctx->ShaderStorageBufferBindings[shader->ShaderStorageBlocks[i]->Binding];
@@ -1430,7 +1430,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
}
}
- if (shader->Program->info.num_ubos || shader->NumShaderStorageBlocks)
+ if (shader->Program->info.num_ubos || shader->Program->info.num_ssbos)
brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 308af2d3a75..e4be2ea9a3a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2384,7 +2384,6 @@ struct gl_linked_shader
*/
unsigned num_combined_uniform_components;
- unsigned NumShaderStorageBlocks;
struct gl_uniform_block **ShaderStorageBlocks;
struct exec_list *ir;
diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c
index 1b6ed99e54a..d01688cd649 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -53,7 +53,7 @@ st_bind_ssbos(struct st_context *st, struct gl_linked_shader *shader,
c = &st->ctx->Const.Program[shader->Stage];
- for (i = 0; i < shader->NumShaderStorageBlocks; i++) {
+ for (i = 0; i < shader->Program->info.num_ssbos; i++) {
struct gl_shader_storage_buffer_binding *binding;
struct st_buffer_object *st_obj;
struct pipe_shader_buffer *sb = &buffers[i];
@@ -80,13 +80,13 @@ st_bind_ssbos(struct st_context *st, struct gl_linked_shader *shader,
}
}
st->pipe->set_shader_buffers(st->pipe, shader_type, c->MaxAtomicBuffers,
- shader->NumShaderStorageBlocks, buffers);
+ shader->Program->info.num_ssbos, buffers);
/* clear out any stale shader buffers */
- if (shader->NumShaderStorageBlocks < c->MaxShaderStorageBlocks)
+ if (shader->Program->info.num_ssbos < c->MaxShaderStorageBlocks)
st->pipe->set_shader_buffers(
st->pipe, shader_type,
- c->MaxAtomicBuffers + shader->NumShaderStorageBlocks,
- c->MaxShaderStorageBlocks - shader->NumShaderStorageBlocks,
+ c->MaxAtomicBuffers + shader->Program->info.num_ssbos,
+ c->MaxShaderStorageBlocks - shader->Program->info.num_ssbos,
NULL);
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 393d66820d8..b4ccc5f0525 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6645,7 +6645,7 @@ set_affected_state_flags(uint64_t *states,
if (prog->info.num_ubos)
*states |= new_ubos;
- if (shader->NumShaderStorageBlocks)
+ if (prog->info.num_ssbos)
*states |= new_ssbos;
if (prog->info.num_abos)