#include "st_program.h"
static void
-st_bind_ssbos(struct st_context *st, struct gl_linked_shader *shader,
+st_bind_ssbos(struct st_context *st, struct gl_program *prog,
enum pipe_shader_type shader_type)
{
unsigned i;
struct pipe_shader_buffer buffers[MAX_SHADER_STORAGE_BUFFERS];
struct gl_program_constants *c;
- if (!shader || !st->pipe->set_shader_buffers)
+ if (!prog || !st->pipe->set_shader_buffers)
return;
- c = &st->ctx->Const.Program[shader->Stage];
+ c = &st->ctx->Const.Program[prog->info.stage];
- for (i = 0; i < shader->Program->info.num_ssbos; i++) {
+ for (i = 0; i < prog->info.num_ssbos; i++) {
struct gl_shader_storage_buffer_binding *binding;
struct st_buffer_object *st_obj;
struct pipe_shader_buffer *sb = &buffers[i];
binding = &st->ctx->ShaderStorageBufferBindings[
- shader->Program->sh.ShaderStorageBlocks[i]->Binding];
+ prog->sh.ShaderStorageBlocks[i]->Binding];
st_obj = st_buffer_object(binding->BufferObject);
sb->buffer = st_obj->buffer;
}
}
st->pipe->set_shader_buffers(st->pipe, shader_type, c->MaxAtomicBuffers,
- shader->Program->info.num_ssbos, buffers);
+ prog->info.num_ssbos, buffers);
/* clear out any stale shader buffers */
- if (shader->Program->info.num_ssbos < c->MaxShaderStorageBlocks)
+ if (prog->info.num_ssbos < c->MaxShaderStorageBlocks)
st->pipe->set_shader_buffers(
st->pipe, shader_type,
- c->MaxAtomicBuffers + shader->Program->info.num_ssbos,
- c->MaxShaderStorageBlocks - shader->Program->info.num_ssbos,
+ c->MaxAtomicBuffers + prog->info.num_ssbos,
+ c->MaxShaderStorageBlocks - prog->info.num_ssbos,
NULL);
}
struct gl_shader_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
return;
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX],
+ st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
PIPE_SHADER_VERTEX);
}
struct gl_shader_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
return;
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
+ st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
PIPE_SHADER_FRAGMENT);
}
struct gl_shader_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_GEOMETRY])
return;
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY],
+ st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
PIPE_SHADER_GEOMETRY);
}
struct gl_shader_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_CTRL])
return;
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL],
+ st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program,
PIPE_SHADER_TESS_CTRL);
}
struct gl_shader_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_EVAL])
return;
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL],
+ st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program,
PIPE_SHADER_TESS_EVAL);
}
struct gl_shader_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog)
+ if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
return;
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
+ st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
PIPE_SHADER_COMPUTE);
}