[Mesa-dev] [PATCH 43/70] i965: pass gl_program to brw_upload_ubo_surfaces()
Timothy Arceri
timothy.arceri at collabora.com
Fri Nov 11 00:46:25 UTC 2016
There is no need to pass gl_linked_shader anymore.
---
src/mesa/drivers/dri/i965/brw_context.h | 3 +--
src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 4 ++--
src/mesa/drivers/dri/i965/brw_tcs_surface_state.c | 4 ++--
src/mesa/drivers/dri/i965/brw_tes_surface_state.c | 4 ++--
src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 4 ++--
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 23 +++++++++++------------
6 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 67a6192..9191abb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1501,8 +1501,7 @@ brw_update_sol_surface(struct brw_context *brw,
struct gl_buffer_object *buffer_obj,
uint32_t *out_offset, unsigned num_vector_components,
unsigned stride_dwords, unsigned offset_dwords);
-void brw_upload_ubo_surfaces(struct brw_context *brw,
- struct gl_linked_shader *shader,
+void brw_upload_ubo_surfaces(struct brw_context *brw, struct gl_program *prog,
struct brw_stage_state *stage_state,
struct brw_stage_prog_data *prog_data);
void brw_upload_abo_surfaces(struct brw_context *brw,
diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
index e2ef222..dc06462 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ -75,13 +75,13 @@ brw_upload_gs_ubo_surfaces(struct brw_context *brw)
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_GEOMETRY])
return;
/* BRW_NEW_GS_PROG_DATA */
struct brw_stage_prog_data *prog_data = brw->gs.base.prog_data;
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_GEOMETRY],
+ brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
&brw->gs.base, prog_data);
}
diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
index 16f0bd2..083058b 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -75,13 +75,13 @@ brw_upload_tcs_ubo_surfaces(struct brw_context *brw)
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_CTRL])
return;
/* BRW_NEW_TCS_PROG_DATA */
struct brw_stage_prog_data *prog_data = brw->tcs.base.prog_data;
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL],
+ brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program,
&brw->tcs.base, prog_data);
}
diff --git a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
index f74d869..03b301e 100644
--- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
@@ -75,13 +75,13 @@ brw_upload_tes_ubo_surfaces(struct brw_context *brw)
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_EVAL])
return;
/* BRW_NEW_TES_PROG_DATA */
struct brw_stage_prog_data *prog_data = brw->tes.base.prog_data;
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL],
+ brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program,
&brw->tes.base, prog_data);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 6c349f4..5665735 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -143,11 +143,11 @@ brw_upload_vs_ubo_surfaces(struct brw_context *brw)
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
return;
/* BRW_NEW_VS_PROG_DATA */
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_VERTEX],
+ brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
&brw->vs.base, brw->vs.base.prog_data);
}
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 2ea2435..9cea923 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1371,22 +1371,21 @@ const struct brw_tracked_state brw_cs_texture_surfaces = {
void
-brw_upload_ubo_surfaces(struct brw_context *brw,
- struct gl_linked_shader *shader,
+brw_upload_ubo_surfaces(struct brw_context *brw, struct gl_program *prog,
struct brw_stage_state *stage_state,
struct brw_stage_prog_data *prog_data)
{
struct gl_context *ctx = &brw->ctx;
- if (!shader)
+ if (!prog)
return;
uint32_t *ubo_surf_offsets =
&stage_state->surf_offset[prog_data->binding_table.ubo_start];
- for (int i = 0; i < shader->Program->info.num_ubos; i++) {
+ for (int i = 0; i < prog->info.num_ubos; i++) {
struct gl_uniform_buffer_binding *binding =
- &ctx->UniformBufferBindings[shader->Program->sh.UniformBlocks[i]->Binding];
+ &ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->Binding];
if (binding->BufferObject == ctx->Shared->NullBufferObj) {
brw->vtbl.emit_null_surface_state(brw, 1, 1, 1, &ubo_surf_offsets[i]);
@@ -1409,9 +1408,9 @@ 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->Program->info.num_ssbos; i++) {
+ for (int i = 0; i < prog->info.num_ssbos; i++) {
struct gl_shader_storage_buffer_binding *binding =
- &ctx->ShaderStorageBufferBindings[shader->Program->sh.ShaderStorageBlocks[i]->Binding];
+ &ctx->ShaderStorageBufferBindings[prog->sh.ShaderStorageBlocks[i]->Binding];
if (binding->BufferObject == ctx->Shared->NullBufferObj) {
brw->vtbl.emit_null_surface_state(brw, 1, 1, 1, &ssbo_surf_offsets[i]);
@@ -1431,7 +1430,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw,
}
}
- if (shader->Program->info.num_ubos || shader->Program->info.num_ssbos)
+ if (prog->info.num_ubos || prog->info.num_ssbos)
brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
}
@@ -1442,11 +1441,11 @@ brw_upload_wm_ubo_surfaces(struct brw_context *brw)
/* _NEW_PROGRAM */
struct gl_shader_program *prog = ctx->_Shader->_CurrentFragmentProgram;
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
return;
/* BRW_NEW_FS_PROG_DATA */
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
+ brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
&brw->wm.base, brw->wm.base.prog_data);
}
@@ -1469,11 +1468,11 @@ brw_upload_cs_ubo_surfaces(struct brw_context *brw)
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
return;
/* BRW_NEW_CS_PROG_DATA */
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
+ brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
&brw->cs.base, brw->cs.base.prog_data);
}
--
2.7.4
More information about the mesa-dev
mailing list