This is a step towards freeing gl_linked_shader after linking.
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
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);
void brw_upload_image_surfaces(struct brw_context *brw,
/* _NEW_PROGRAM */
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
+ const struct gl_program *gp = brw->geometry_program;
- if (prog) {
+ if (gp && prog) {
/* BRW_NEW_GS_PROG_DATA */
brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_GEOMETRY],
- &brw->gs.base, brw->gs.base.prog_data);
+ gp, &brw->gs.base, brw->gs.base.prog_data);
}
}
stage_prog_data->binding_table.gather_texture_start = 0xd0d0d0d0;
}
- if (shader && shader->NumAtomicBuffers) {
+ if (prog->info.num_abos) {
stage_prog_data->binding_table.abo_start = next_binding_table_offset;
- next_binding_table_offset += shader->NumAtomicBuffers;
+ next_binding_table_offset += prog->info.num_abos;
} else {
stage_prog_data->binding_table.abo_start = 0xd0d0d0d0;
}
/* _NEW_PROGRAM */
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
+ const struct gl_program *tcp = brw->tess_ctrl_program;
- if (prog) {
+ if (tcp && prog) {
/* BRW_NEW_TCS_PROG_DATA */
brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL],
- &brw->tcs.base, brw->tcs.base.prog_data);
+ tcp, &brw->tcs.base, brw->tcs.base.prog_data);
}
}
/* _NEW_PROGRAM */
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
+ const struct gl_program *tep = brw->tess_eval_program;
- if (prog) {
+ if (tep && prog) {
/* BRW_NEW_TES_PROG_DATA */
brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL],
- &brw->tes.base, brw->tes.base.prog_data);
+ tep, &brw->tes.base, brw->tes.base.prog_data);
}
}
/* _NEW_PROGRAM */
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
+ const struct gl_program *vp = brw->vertex_program;
- if (prog) {
+ if (vp && prog) {
/* BRW_NEW_VS_PROG_DATA */
brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_VERTEX],
- &brw->vs.base, brw->vs.base.prog_data);
+ vp, &brw->vs.base, brw->vs.base.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)
{
uint32_t *surf_offsets =
&stage_state->surf_offset[prog_data->binding_table.abo_start];
- if (shader && shader->NumAtomicBuffers) {
- for (unsigned i = 0; i < shader->NumAtomicBuffers; i++) {
+ 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];
struct intel_buffer_object *intel_bo =
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) {
/* BRW_NEW_FS_PROG_DATA */
brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
- &brw->wm.base, brw->wm.base.prog_data);
+ wm, &brw->wm.base, brw->wm.base.prog_data);
}
}
/* _NEW_PROGRAM */
struct gl_shader_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
+ const struct gl_program *cp = brw->compute_program;
- if (prog) {
+ if (cp && prog) {
/* BRW_NEW_CS_PROG_DATA */
brw_upload_abo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
- &brw->cs.base, brw->cs.base.prog_data);
+ cp, &brw->cs.base, brw->cs.base.prog_data);
}
}