diff options
author | Timothy Arceri <[email protected]> | 2016-11-11 11:45:54 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-19 09:35:58 +1100 |
commit | c20564ae3ec2b5ac6bee23751d53a92b2dc09067 (patch) | |
tree | 9db3be4f51b83d177af29bc28214ec76f95993aa | |
parent | 9d96d3803ab5dc896d4844ac785db57bb1717f91 (diff) |
glsl/i965: move per stage AtomicBuffers list to gl_program
Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r-- | src/compiler/glsl/link_atomics.cpp | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tcs_surface_state.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tes_surface_state.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 19 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 8 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 |
10 files changed, 25 insertions, 48 deletions
diff --git a/src/compiler/glsl/link_atomics.cpp b/src/compiler/glsl/link_atomics.cpp index 053e7a433e0..46a8843d2cb 100644 --- a/src/compiler/glsl/link_atomics.cpp +++ b/src/compiler/glsl/link_atomics.cpp @@ -267,8 +267,9 @@ link_assign_atomic_counter_resources(struct gl_context *ctx, */ for (unsigned j = 0; j < MESA_SHADER_STAGES; ++j) { if (prog->_LinkedShaders[j] && num_atomic_buffers[j] > 0) { - prog->_LinkedShaders[j]->NumAtomicBuffers = num_atomic_buffers[j]; - prog->_LinkedShaders[j]->AtomicBuffers = + struct gl_program *gl_prog = prog->_LinkedShaders[j]->Program; + gl_prog->info.num_abos = num_atomic_buffers[j]; + gl_prog->sh.AtomicBuffers = rzalloc_array(prog, gl_active_atomic_buffer *, num_atomic_buffers[j]); @@ -277,8 +278,7 @@ link_assign_atomic_counter_resources(struct gl_context *ctx, struct gl_active_atomic_buffer *atomic_buffer = &prog->AtomicBuffers[i]; if (atomic_buffer->StageReferences[j]) { - prog->_LinkedShaders[j]->AtomicBuffers[intra_stage_idx] = - atomic_buffer; + gl_prog->sh.AtomicBuffers[intra_stage_idx] = atomic_buffer; for (unsigned u = 0; u < atomic_buffer->NumUniforms; u++) { prog->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].index = diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 7604d26b082..be59e3b0d16 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1510,7 +1510,6 @@ void brw_upload_ubo_surfaces(struct brw_context *brw, struct brw_stage_state *stage_state, struct brw_stage_prog_data *prog_data); void brw_upload_abo_surfaces(struct brw_context *brw, - struct gl_linked_shader *shader, const struct gl_program *prog, struct brw_stage_state *stage_state, struct brw_stage_prog_data *prog_data); 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 f9cd18989f7..cf56acfd99a 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c @@ -99,16 +99,12 @@ const struct brw_tracked_state brw_gs_ubo_surfaces = { static void brw_upload_gs_abo_surfaces(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; /* _NEW_PROGRAM */ - struct gl_shader_program *prog = - ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]; const struct gl_program *gp = brw->geometry_program; - if (gp && prog) { + if (gp) { /* BRW_NEW_GS_PROG_DATA */ - brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_GEOMETRY], - gp, &brw->gs.base, brw->gs.base.prog_data); + brw_upload_abo_surfaces(brw, gp, &brw->gs.base, 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 775c7350ec5..b2d075fe6bf 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c @@ -99,16 +99,13 @@ const struct brw_tracked_state brw_tcs_ubo_surfaces = { static void brw_upload_tcs_abo_surfaces(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; /* _NEW_PROGRAM */ - struct gl_shader_program *prog = - ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL]; const struct gl_program *tcp = brw->tess_ctrl_program; - if (tcp && prog) { + if (tcp) { /* BRW_NEW_TCS_PROG_DATA */ - brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL], - tcp, &brw->tcs.base, brw->tcs.base.prog_data); + brw_upload_abo_surfaces(brw, tcp, &brw->tcs.base, + 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 a9b3dfaaaff..a3516834ce4 100644 --- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c @@ -99,16 +99,13 @@ const struct brw_tracked_state brw_tes_ubo_surfaces = { static void brw_upload_tes_abo_surfaces(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; /* _NEW_PROGRAM */ - struct gl_shader_program *prog = - ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL]; const struct gl_program *tep = brw->tess_eval_program; - if (tep && prog) { + if (tep) { /* BRW_NEW_TES_PROG_DATA */ - brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL], - tep, &brw->tes.base, brw->tes.base.prog_data); + brw_upload_abo_surfaces(brw, tep, &brw->tes.base, + 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 514f26569cc..7bc7b77e9cf 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -165,16 +165,12 @@ const struct brw_tracked_state brw_vs_ubo_surfaces = { static void brw_upload_vs_abo_surfaces(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; /* _NEW_PROGRAM */ - struct gl_shader_program *prog = - ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; const struct gl_program *vp = brw->vertex_program; - if (vp && prog) { + if (vp) { /* BRW_NEW_VS_PROG_DATA */ - brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_VERTEX], - vp, &brw->vs.base, brw->vs.base.prog_data); + brw_upload_abo_surfaces(brw, vp, &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 300eff926e4..d40ccbf926d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -1484,7 +1484,6 @@ const struct brw_tracked_state brw_cs_ubo_surfaces = { void brw_upload_abo_surfaces(struct brw_context *brw, - struct gl_linked_shader *shader, const struct gl_program *prog, struct brw_stage_state *stage_state, struct brw_stage_prog_data *prog_data) @@ -1494,10 +1493,9 @@ brw_upload_abo_surfaces(struct brw_context *brw, &stage_state->surf_offset[prog_data->binding_table.abo_start]; if (prog->info.num_abos) { - assert(shader); for (unsigned i = 0; i < prog->info.num_abos; i++) { struct gl_atomic_buffer_binding *binding = - &ctx->AtomicBufferBindings[shader->AtomicBuffers[i]->Binding]; + &ctx->AtomicBufferBindings[prog->sh.AtomicBuffers[i]->Binding]; struct intel_buffer_object *intel_bo = intel_buffer_object(binding->BufferObject); drm_intel_bo *bo = intel_bufferobj_buffer( @@ -1515,15 +1513,12 @@ brw_upload_abo_surfaces(struct brw_context *brw, static void brw_upload_wm_abo_surfaces(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; /* _NEW_PROGRAM */ - struct gl_shader_program *prog = ctx->_Shader->_CurrentFragmentProgram; const struct gl_program *wm = brw->fragment_program; - if (prog) { + if (wm) { /* BRW_NEW_FS_PROG_DATA */ - brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_FRAGMENT], - wm, &brw->wm.base, brw->wm.base.prog_data); + brw_upload_abo_surfaces(brw, wm, &brw->wm.base, brw->wm.base.prog_data); } } @@ -1541,16 +1536,12 @@ const struct brw_tracked_state brw_wm_abo_surfaces = { static void brw_upload_cs_abo_surfaces(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; /* _NEW_PROGRAM */ - struct gl_shader_program *prog = - ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE]; const struct gl_program *cp = brw->compute_program; - if (cp && prog) { + if (cp) { /* BRW_NEW_CS_PROG_DATA */ - brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE], - cp, &brw->cs.base, brw->cs.base.prog_data); + brw_upload_abo_surfaces(brw, cp, &brw->cs.base, brw->cs.base.prog_data); } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d2c1e583004..440bbb4b762 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1944,6 +1944,11 @@ struct gl_program GLubyte SamplerUnits[MAX_SAMPLERS]; union { + /** Fields used by GLSL programs */ + struct { + struct gl_active_atomic_buffer **AtomicBuffers; + } sh; + /** ARB assembly-style program fields */ struct { struct prog_instruction *Instructions; @@ -2354,9 +2359,6 @@ struct gl_linked_shader */ GLuint NumImages; - struct gl_active_atomic_buffer **AtomicBuffers; - unsigned NumAtomicBuffers; - /** * Number of types for subroutine uniforms. */ diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index cedcfa3a04c..aebd81214e7 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2152,7 +2152,6 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src, struct gl_program *dst = dst_sh->Program; - dst->info.num_abos = dst_sh->NumAtomicBuffers; dst->info.num_images = dst_sh->NumImages; switch (dst_sh->Stage) { diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 2c2bbb6c26b..0cea32b764b 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6607,7 +6607,7 @@ set_affected_state_flags(uint64_t *states, if (shader->NumShaderStorageBlocks) *states |= new_ssbos; - if (shader->NumAtomicBuffers) + if (prog->info.num_abos) *states |= new_atomics; } |