*/
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]);
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 =
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);
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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)
&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(
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);
}
}
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);
}
}
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;
*/
GLuint NumImages;
- struct gl_active_atomic_buffer **AtomicBuffers;
- unsigned NumAtomicBuffers;
-
/**
* Number of types for subroutine uniforms.
*/
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) {
if (shader->NumShaderStorageBlocks)
*states |= new_ssbos;
- if (shader->NumAtomicBuffers)
+ if (prog->info.num_abos)
*states |= new_atomics;
}