_mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader);
/* Update the program */
- _mesa_use_program(ctx, sh_prog);
+ _mesa_use_shader_program(ctx, sh_prog);
}
void
* that we don't have to worry about the current pipeline state.
*/
for (i = 0; i < MESA_SHADER_STAGES; i++) {
- _mesa_reference_shader_program(ctx, &save->Shader[i],
- ctx->Shader.CurrentProgram[i]);
+ _mesa_reference_program(ctx, &save->Program[i],
+ ctx->Shader.CurrentProgram[i]);
}
_mesa_reference_shader_program(ctx, &save->ActiveShader,
ctx->Shader.ActiveProgram);
}
if (state & MESA_META_SHADER) {
- static const GLenum targets[] = {
- GL_VERTEX_SHADER,
- GL_TESS_CONTROL_SHADER,
- GL_TESS_EVALUATION_SHADER,
- GL_GEOMETRY_SHADER,
- GL_FRAGMENT_SHADER,
- GL_COMPUTE_SHADER,
- };
- STATIC_ASSERT(MESA_SHADER_STAGES == ARRAY_SIZE(targets));
-
bool any_shader;
if (ctx->Extensions.ARB_vertex_program) {
any_shader = false;
for (i = 0; i < MESA_SHADER_STAGES; i++) {
- /* It is safe to call _mesa_use_shader_program even if the extension
+ /* It is safe to call _mesa_use_program even if the extension
* necessary for that program state is not supported. In that case,
* the saved program object must be NULL and the currently bound
- * program object must be NULL. _mesa_use_shader_program is a no-op
+ * program object must be NULL. _mesa_use_program is a no-op
* in that case.
*/
- _mesa_use_shader_program(ctx, targets[i],
- save->Shader[i],
- &ctx->Shader);
+ _mesa_use_program(ctx, i, save->Program[i], &ctx->Shader);
/* Do this *before* killing the reference. :)
*/
- if (save->Shader[i] != NULL)
+ if (save->Program[i] != NULL)
any_shader = true;
- _mesa_reference_shader_program(ctx, &save->Shader[i], NULL);
+ _mesa_reference_program(ctx, &save->Program[i], NULL);
}
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram,
GLboolean FragmentProgramEnabled;
struct gl_program *FragmentProgram;
GLboolean ATIFragmentShaderEnabled;
- struct gl_shader_program *Shader[MESA_SHADER_STAGES];
+ struct gl_program *Program[MESA_SHADER_STAGES];
struct gl_shader_program *ActiveShader;
struct gl_pipeline_object *Pipeline;
/* Resolve color for each active shader image. */
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
- const struct gl_linked_shader *shader =
- ctx->_Shader->CurrentProgram[i] ?
- ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i] : NULL;
+ const struct gl_program *prog = ctx->_Shader->CurrentProgram[i];
- if (unlikely(shader && shader->Program->info.num_images)) {
- for (unsigned j = 0; j < shader->Program->info.num_images; j++) {
+ if (unlikely(prog && prog->info.num_images)) {
+ for (unsigned j = 0; j < prog->info.num_images; j++) {
struct gl_image_unit *u =
- &ctx->ImageUnits[shader->Program->sh.ImageUnits[j]];
+ &ctx->ImageUnits[prog->sh.ImageUnits[j]];
tex_obj = intel_texture_object(u->TexObj);
if (tex_obj && tex_obj->mt) {
/* On Gen6, GS is used for transform feedback. */
/* BRW_NEW_TRANSFORM_FEEDBACK */
if (_mesa_is_xfb_active_and_unpaused(ctx)) {
- const struct gl_shader_program *shaderprog =
+ const struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
const struct gl_transform_feedback_info *linked_xfb_info =
- shaderprog->xfb_program->sh.LinkedTransformFeedback;
+ prog->sh.LinkedTransformFeedback;
int i;
/* Make sure that the VUE slots won't overflow the unsigned chars in
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
+ struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- 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]->Program,
- &brw->gs.base, prog_data);
+ brw_upload_ubo_surfaces(brw, prog, &brw->gs.base, prog_data);
}
const struct brw_tracked_state brw_gs_ubo_surfaces = {
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
+ struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- 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]->Program,
- &brw->tcs.base, prog_data);
+ brw_upload_ubo_surfaces(brw, prog, &brw->tcs.base, prog_data);
}
const struct brw_tracked_state brw_tcs_ubo_surfaces = {
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
+ struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- 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]->Program,
- &brw->tes.base, prog_data);
+ brw_upload_ubo_surfaces(brw, prog, &brw->tes.base, prog_data);
}
const struct brw_tracked_state brw_tes_ubo_surfaces = {
{
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
-
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
- return;
+ struct gl_program *prog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
/* BRW_NEW_VS_PROG_DATA */
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
- &brw->vs.base, brw->vs.base.prog_data);
+ brw_upload_ubo_surfaces(brw, prog, &brw->vs.base, brw->vs.base.prog_data);
}
const struct brw_tracked_state brw_vs_ubo_surfaces = {
{
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
+ struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
- return;
-
/* BRW_NEW_CS_PROG_DATA */
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
- &brw->cs.base, brw->cs.base.prog_data);
+ brw_upload_ubo_surfaces(brw, prog, &brw->cs.base, brw->cs.base.prog_data);
}
const struct brw_tracked_state brw_cs_ubo_surfaces = {
{
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
+ struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
/* BRW_NEW_CS_PROG_DATA */
const struct brw_cs_prog_data *cs_prog_data =
{
uint32_t *bind;
struct gl_context *ctx = &brw->ctx;
- const struct gl_shader_program *shaderprog;
+ const struct gl_program *prog;
bool need_binding_table = false;
/* We have two scenarios here:
if (!brw->geometry_program) {
/* BRW_NEW_VERTEX_PROGRAM */
- shaderprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- if (shaderprog) {
+ prog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
+ if (prog) {
/* Skip making a binding table if we don't have anything to put in it */
const struct gl_transform_feedback_info *linked_xfb_info =
- shaderprog->xfb_program->sh.LinkedTransformFeedback;
+ prog->sh.LinkedTransformFeedback;
need_binding_table = linked_xfb_info->NumOutputs > 0;
}
if (!need_binding_table) {
BRW_MAX_SOL_BINDINGS * sizeof(uint32_t));
} else {
/* BRW_NEW_GEOMETRY_PROGRAM */
- shaderprog = ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- if (shaderprog) {
+ prog = ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
+ if (prog) {
/* Skip making a binding table if we don't have anything to put in it */
struct brw_stage_prog_data *prog_data = brw->gs.base.prog_data;
const struct gl_transform_feedback_info *linked_xfb_info =
- shaderprog->xfb_program->sh.LinkedTransformFeedback;
+ prog->sh.LinkedTransformFeedback;
need_binding_table = linked_xfb_info->NumOutputs > 0 ||
prog_data->binding_table.size_bytes > 0;
}
struct gl_transform_feedback_object *obj)
{
struct brw_context *brw = brw_context(ctx);
- const struct gl_shader_program *shaderprog;
+ const struct gl_program *prog;
const struct gl_transform_feedback_info *linked_xfb_info;
struct gl_transform_feedback_object *xfb_obj =
ctx->TransformFeedback.CurrentObject;
if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
/* BRW_NEW_GEOMETRY_PROGRAM */
- shaderprog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
+ prog = ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
} else {
/* BRW_NEW_VERTEX_PROGRAM */
- shaderprog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
+ prog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
}
- linked_xfb_info = shaderprog->xfb_program->sh.LinkedTransformFeedback;
+ linked_xfb_info = prog->sh.LinkedTransformFeedback;
/* Compute the maximum number of vertices that we can write without
* overflowing any of the buffers currently being used for feedback.
bool needs_dc = false, needs_slm = false;
for (unsigned i = 0; i < ARRAY_SIZE(stage_states); i++) {
- const struct gl_shader_program *prog =
+ const struct gl_program *prog =
brw->ctx._Shader->CurrentProgram[stage_states[i]->stage];
const struct brw_stage_prog_data *prog_data = stage_states[i]->prog_data;
- needs_dc |= (prog && (prog->data->NumAtomicBuffers ||
- prog->data->NumShaderStorageBlocks)) ||
+ needs_dc |= (prog && (prog->sh.data->NumAtomicBuffers ||
+ prog->sh.data->NumShaderStorageBlocks)) ||
(prog_data && (prog_data->total_scratch || prog_data->nr_image_params));
needs_slm |= prog_data && prog_data->total_shared;
}
#ifdef DEBUG
if (ctx->_Shader->Flags & GLSL_LOG) {
- struct gl_shader_program **shProg = ctx->_Shader->CurrentProgram;
- gl_shader_stage i;
+ struct gl_program **prog = ctx->_Shader->CurrentProgram;
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (shProg[i] == NULL || shProg[i]->_LinkedShaders[i] == NULL ||
- shProg[i]->_LinkedShaders[i]->Program->_Used)
+ for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+ if (prog[i] == NULL || prog[i]->_Used)
continue;
/* This is the first time this shader is being used.
* program isn't also bound to the fragment shader target we don't
* want to log its fragment data.
*/
- _mesa_append_uniforms_to_file(shProg[i]->_LinkedShaders[i]->Program);
+ _mesa_append_uniforms_to_file(prog[i]);
}
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (shProg[i] != NULL && shProg[i]->_LinkedShaders[i] != NULL)
- shProg[i]->_LinkedShaders[i]->Program->_Used = GL_TRUE;
+ for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+ if (prog[i] != NULL)
+ prog[i]->_Used = GL_TRUE;
}
}
#endif
if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
const GLenum geom_mode =
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->
- _LinkedShaders[MESA_SHADER_GEOMETRY]->info.Geom.InputType;
- struct gl_shader_program *tes =
+ info.gs.input_primitive;
+ struct gl_program *tes =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
GLenum mode_before_gs = mode;
if (tes) {
- struct gl_linked_shader *tes_sh =
- tes->_LinkedShaders[MESA_SHADER_TESS_EVAL];
- if (tes_sh->info.TessEval.PointMode)
+ if (tes->info.tess.point_mode)
mode_before_gs = GL_POINTS;
- else if (tes_sh->info.TessEval.PrimitiveMode == GL_ISOLINES)
+ else if (tes->info.tess.primitive_mode == GL_ISOLINES)
mode_before_gs = GL_LINES;
else
/* the GL_QUADS mode generates triangles too */
if(ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
switch (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->
- _LinkedShaders[MESA_SHADER_GEOMETRY]->
- info.Geom.OutputType) {
+ info.gs.output_primitive) {
case GL_POINTS:
pass = ctx->TransformFeedback.Mode == GL_POINTS;
break;
}
}
else if (ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL]) {
- struct gl_shader_program *tes =
+ struct gl_program *tes =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- struct gl_linked_shader *tes_sh =
- tes->_LinkedShaders[MESA_SHADER_TESS_EVAL];
- if (tes_sh->info.TessEval.PointMode)
+ if (tes->info.tess.point_mode)
pass = ctx->TransformFeedback.Mode == GL_POINTS;
- else if (tes_sh->info.TessEval.PrimitiveMode == GL_ISOLINES)
+ else if (tes->info.tess.primitive_mode == GL_ISOLINES)
pass = ctx->TransformFeedback.Mode == GL_LINES;
else
pass = ctx->TransformFeedback.Mode == GL_TRIANGLES;
static bool
check_valid_to_compute(struct gl_context *ctx, const char *function)
{
- struct gl_shader_program *prog;
-
if (!_mesa_has_compute_shaders(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"unsupported function (%s) called",
* "An INVALID_OPERATION error is generated if there is no active program
* for the compute shader stage."
*/
- prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (prog == NULL || prog->_LinkedShaders[MESA_SHADER_COMPUTE] == NULL) {
+ if (ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE] == NULL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no active compute shader)",
function);
_mesa_validate_DispatchCompute(struct gl_context *ctx,
const GLuint *num_groups)
{
- struct gl_shader_program *prog;
int i;
FLUSH_CURRENT(ctx, 0);
* "An INVALID_OPERATION error is generated by DispatchCompute if the active
* program for the compute shader stage has a variable work group size."
*/
- prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (prog->Comp.LocalSizeVariable) {
+ struct gl_program *prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
+ if (prog->info.cs.local_size_variable) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDispatchCompute(variable work group size forbidden)");
return GL_FALSE;
const GLuint *num_groups,
const GLuint *group_size)
{
- struct gl_shader_program *prog;
GLuint total_invocations = 1;
int i;
* DispatchComputeGroupSizeARB if the active program for the compute
* shader stage has a fixed work group size."
*/
- prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog->Comp.LocalSizeVariable) {
+ struct gl_program *prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
+ if (!prog->info.cs.local_size_variable) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDispatchComputeGroupSizeARB(fixed work group size "
"forbidden)");
GLsizei size, const char *name)
{
const uint64_t end = (uint64_t) indirect + size;
- struct gl_shader_program *prog;
if (!check_valid_to_compute(ctx, name))
return GL_FALSE;
* "An INVALID_OPERATION error is generated if the active program for the
* compute shader stage has a variable work group size."
*/
- prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (prog->Comp.LocalSizeVariable) {
+ struct gl_program *prog = ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
+ if (prog->info.cs.local_size_variable) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(variable work group size forbidden)", name);
return GL_FALSE;
{
/* _NEW_PROGRAM */
const GLboolean vertexShader =
- (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] &&
- ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->data->LinkStatus &&
- ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]);
+ ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] != NULL;
const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
GLbitfield fp_inputs = 0x0;
* validation (see additional comments in state.c).
*/
if (vertexShader)
- vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
+ vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
else
vprog = ctx->VertexProgram.Current;
*
* There is a separate program set for each shader stage.
*/
- struct gl_shader_program *CurrentProgram[MESA_SHADER_STAGES];
+ struct gl_program *CurrentProgram[MESA_SHADER_STAGES];
struct gl_program *_CurrentFragmentProgram;
_mesa_reference_program(ctx, &obj->_CurrentFragmentProgram, NULL);
for (i = 0; i < MESA_SHADER_STAGES; i++)
- _mesa_reference_shader_program(ctx, &obj->CurrentProgram[i], NULL);
+ _mesa_reference_program(ctx, &obj->CurrentProgram[i], NULL);
_mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL);
mtx_destroy(&obj->Mutex);
}
}
+static void
+use_program_stage(struct gl_context *ctx, GLenum type,
+ struct gl_shader_program *shProg,
+ struct gl_pipeline_object *pipe) {
+ gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type);
+ struct gl_program *prog = NULL;
+ if (shProg && shProg->_LinkedShaders[stage])
+ prog = shProg->_LinkedShaders[stage]->Program;
+
+ _mesa_use_program(ctx, stage, prog, pipe);
+}
+
/**
* Bound program to severals stages of the pipeline
*/
* configured for the indicated shader stages."
*/
if ((stages & GL_VERTEX_SHADER_BIT) != 0)
- _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, shProg, pipe);
+ use_program_stage(ctx, GL_VERTEX_SHADER, shProg, pipe);
if ((stages & GL_FRAGMENT_SHADER_BIT) != 0)
- _mesa_use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg, pipe);
+ use_program_stage(ctx, GL_FRAGMENT_SHADER, shProg, pipe);
if ((stages & GL_GEOMETRY_SHADER_BIT) != 0)
- _mesa_use_shader_program(ctx, GL_GEOMETRY_SHADER, shProg, pipe);
+ use_program_stage(ctx, GL_GEOMETRY_SHADER, shProg, pipe);
if ((stages & GL_TESS_CONTROL_SHADER_BIT) != 0)
- _mesa_use_shader_program(ctx, GL_TESS_CONTROL_SHADER, shProg, pipe);
+ use_program_stage(ctx, GL_TESS_CONTROL_SHADER, shProg, pipe);
if ((stages & GL_TESS_EVALUATION_SHADER_BIT) != 0)
- _mesa_use_shader_program(ctx, GL_TESS_EVALUATION_SHADER, shProg, pipe);
+ use_program_stage(ctx, GL_TESS_EVALUATION_SHADER, shProg, pipe);
if ((stages & GL_COMPUTE_SHADER_BIT) != 0)
- _mesa_use_shader_program(ctx, GL_COMPUTE_SHADER, shProg, pipe);
+ use_program_stage(ctx, GL_COMPUTE_SHADER, shProg, pipe);
pipe->Validated = false;
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (ctx->_Shader->CurrentProgram[i]) {
- struct gl_linked_shader *sh =
- ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i];
- if (sh)
- _mesa_program_init_subroutine_defaults(ctx, sh->Program);
+ struct gl_program *prog = ctx->_Shader->CurrentProgram[i];
+ if (prog) {
+ _mesa_program_init_subroutine_defaults(ctx, prog);
}
}
}
return;
case GL_VERTEX_SHADER:
*params = pipe->CurrentProgram[MESA_SHADER_VERTEX]
- ? pipe->CurrentProgram[MESA_SHADER_VERTEX]->Name : 0;
+ ? pipe->CurrentProgram[MESA_SHADER_VERTEX]->Id : 0;
return;
case GL_TESS_EVALUATION_SHADER:
if (!has_tess)
break;
*params = pipe->CurrentProgram[MESA_SHADER_TESS_EVAL]
- ? pipe->CurrentProgram[MESA_SHADER_TESS_EVAL]->Name : 0;
+ ? pipe->CurrentProgram[MESA_SHADER_TESS_EVAL]->Id : 0;
return;
case GL_TESS_CONTROL_SHADER:
if (!has_tess)
break;
*params = pipe->CurrentProgram[MESA_SHADER_TESS_CTRL]
- ? pipe->CurrentProgram[MESA_SHADER_TESS_CTRL]->Name : 0;
+ ? pipe->CurrentProgram[MESA_SHADER_TESS_CTRL]->Id : 0;
return;
case GL_GEOMETRY_SHADER:
if (!has_gs)
break;
*params = pipe->CurrentProgram[MESA_SHADER_GEOMETRY]
- ? pipe->CurrentProgram[MESA_SHADER_GEOMETRY]->Name : 0;
+ ? pipe->CurrentProgram[MESA_SHADER_GEOMETRY]->Id : 0;
return;
case GL_FRAGMENT_SHADER:
*params = pipe->CurrentProgram[MESA_SHADER_FRAGMENT]
- ? pipe->CurrentProgram[MESA_SHADER_FRAGMENT]->Name : 0;
+ ? pipe->CurrentProgram[MESA_SHADER_FRAGMENT]->Id : 0;
return;
case GL_COMPUTE_SHADER:
if (!_mesa_has_compute_shaders(ctx))
break;
*params = pipe->CurrentProgram[MESA_SHADER_COMPUTE]
- ? pipe->CurrentProgram[MESA_SHADER_COMPUTE]->Name : 0;
+ ? pipe->CurrentProgram[MESA_SHADER_COMPUTE]->Id : 0;
return;
default:
break;
*/
static bool
program_stages_all_active(struct gl_pipeline_object *pipe,
- const struct gl_shader_program *prog)
+ const struct gl_program *prog)
{
- unsigned i;
bool status = true;
if (!prog)
return true;
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (prog->_LinkedShaders[i]) {
- if (pipe->CurrentProgram[i]) {
- if (prog->Name != pipe->CurrentProgram[i]->Name) {
- status = false;
- }
- } else {
+ unsigned mask = prog->sh.data->linked_stages;
+ while (mask) {
+ const int i = u_bit_scan(&mask);
+ if (pipe->CurrentProgram[i]) {
+ if (prog->Id != pipe->CurrentProgram[i]->Id) {
status = false;
}
+ } else {
+ status = false;
}
}
pipe->InfoLog = ralloc_asprintf(pipe,
"Program %d is not active for all "
"shaders that was linked",
- prog->Name);
+ prog->Id);
}
return status;
* sequence of unrelated programs or empty stages.
*/
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
- struct gl_shader_program *cur = pipe->CurrentProgram[i];
+ struct gl_program *cur = pipe->CurrentProgram[i];
/* Empty stages anywhere in the pipe are OK. Also we can be confident
* that if the linked_stages mask matches we are looking at the same
* programs with the sames stages linked are not active for all linked
* stages.
*/
- if (!cur || cur->data->linked_stages == prev_linked_stages)
+ if (!cur || cur->sh.data->linked_stages == prev_linked_stages)
continue;
if (prev_linked_stages) {
return true;
}
- prev_linked_stages = cur->data->linked_stages;
+ prev_linked_stages = cur->sh.data->linked_stages;
}
return false;
* PROGRAM_SEPARABLE parameter set to FALSE.
*/
for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (pipe->CurrentProgram[i] && !pipe->CurrentProgram[i]->SeparateShader) {
+ if (pipe->CurrentProgram[i] &&
+ !pipe->CurrentProgram[i]->info.separate_shader) {
pipe->InfoLog = ralloc_asprintf(pipe,
"Program %d was relinked without "
"PROGRAM_SEPARABLE state",
- pipe->CurrentProgram[i]->Name);
+ pipe->CurrentProgram[i]->Id);
return GL_FALSE;
}
}
}
static bool
-validate_io(struct gl_shader_program *producer,
- struct gl_shader_program *consumer,
- gl_shader_stage producer_stage,
- gl_shader_stage consumer_stage)
+validate_io(struct gl_program *producer, struct gl_program *consumer)
{
- if (producer == consumer)
+ if (producer->sh.data->linked_stages == consumer->sh.data->linked_stages)
return true;
const bool nonarray_stage_to_array_stage =
- producer_stage != MESA_SHADER_TESS_CTRL &&
- (consumer_stage == MESA_SHADER_GEOMETRY ||
- consumer_stage == MESA_SHADER_TESS_CTRL ||
- consumer_stage == MESA_SHADER_TESS_EVAL);
+ producer->info.stage != MESA_SHADER_TESS_CTRL &&
+ (consumer->info.stage == MESA_SHADER_GEOMETRY ||
+ consumer->info.stage == MESA_SHADER_TESS_CTRL ||
+ consumer->info.stage == MESA_SHADER_TESS_EVAL);
bool valid = true;
gl_shader_variable const **outputs =
- (gl_shader_variable const **) calloc(producer->data->NumProgramResourceList,
+ (gl_shader_variable const **) calloc(producer->sh.data->NumProgramResourceList,
sizeof(gl_shader_variable *));
if (outputs == NULL)
return false;
* some output that did not have an input.
*/
unsigned num_outputs = 0;
- for (unsigned i = 0; i < producer->data->NumProgramResourceList; i++) {
+ for (unsigned i = 0; i < producer->sh.data->NumProgramResourceList; i++) {
struct gl_program_resource *res =
- &producer->data->ProgramResourceList[i];
+ &producer->sh.data->ProgramResourceList[i];
if (res->Type != GL_PROGRAM_OUTPUT)
continue;
}
unsigned match_index = 0;
- for (unsigned i = 0; i < consumer->data->NumProgramResourceList; i++) {
+ for (unsigned i = 0; i < consumer->sh.data->NumProgramResourceList; i++) {
struct gl_program_resource *res =
- &consumer->data->ProgramResourceList[i];
+ &consumer->sh.data->ProgramResourceList[i];
if (res->Type != GL_PROGRAM_INPUT)
continue;
extern "C" bool
_mesa_validate_pipeline_io(struct gl_pipeline_object *pipeline)
{
- struct gl_shader_program **shProg =
- (struct gl_shader_program **) pipeline->CurrentProgram;
+ struct gl_program **prog = (struct gl_program **) pipeline->CurrentProgram;
/* Find first active stage in pipeline. */
unsigned idx, prev = 0;
for (idx = 0; idx < ARRAY_SIZE(pipeline->CurrentProgram); idx++) {
- if (shProg[idx]) {
+ if (prog[idx]) {
prev = idx;
break;
}
}
for (idx = prev + 1; idx < ARRAY_SIZE(pipeline->CurrentProgram); idx++) {
- if (shProg[idx]) {
+ if (prog[idx]) {
/* Pipeline might include both non-compute and a compute program, do
* not attempt to validate varyings between non-compute and compute
* stage.
*/
- if (shProg[idx]->_LinkedShaders[idx]->Stage == MESA_SHADER_COMPUTE)
+ if (prog[idx]->info.stage == MESA_SHADER_COMPUTE)
break;
- if (!validate_io(shProg[prev], shProg[idx],
- shProg[prev]->_LinkedShaders[prev]->Stage,
- shProg[idx]->_LinkedShaders[idx]->Stage))
+ if (!validate_io(prog[prev], prog[idx]))
return false;
prev = idx;
void
_mesa_free_shader_state(struct gl_context *ctx)
{
- int i;
- for (i = 0; i < MESA_SHADER_STAGES; i++) {
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[i],
- NULL);
+ for (int i = 0; i < MESA_SHADER_STAGES; i++) {
+ _mesa_reference_program(ctx, &ctx->Shader.CurrentProgram[i], NULL);
}
_mesa_reference_program(ctx, &ctx->Shader._CurrentFragmentProgram, NULL);
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL);
unsigned programs_in_use = 0;
if (ctx->_Shader)
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
- if (ctx->_Shader->CurrentProgram[stage] == shProg) {
+ if (ctx->_Shader->CurrentProgram[stage] &&
+ ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) {
programs_in_use |= 1 << stage;
}
}
* is attached."
*/
if (shProg->data->LinkStatus && programs_in_use) {
- ctx->NewState |= _NEW_PROGRAM;
+ while (programs_in_use) {
+ const int stage = u_bit_scan(&programs_in_use);
+
+ struct gl_program *prog = NULL;
+ if (shProg->_LinkedShaders[stage])
+ prog = shProg->_LinkedShaders[stage]->Program;
+
+ _mesa_use_program(ctx, stage, prog, ctx->_Shader);
+ }
}
/* Capture .shader_test files. */
static void
-use_shader_program(struct gl_context *ctx, gl_shader_stage stage,
- struct gl_shader_program *shProg,
- struct gl_pipeline_object *shTarget)
+use_program(struct gl_context *ctx, gl_shader_stage stage,
+ struct gl_program *new_prog, struct gl_pipeline_object *shTarget)
{
- struct gl_shader_program **target;
+ struct gl_program **target;
target = &shTarget->CurrentProgram[stage];
- if ((shProg != NULL) && (shProg->_LinkedShaders[stage] == NULL))
- shProg = NULL;
-
- if (shProg) {
- for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
- struct gl_linked_shader *sh = shProg->_LinkedShaders[i];
- if (!sh)
- continue;
-
- _mesa_program_init_subroutine_defaults(ctx, sh->Program);
- }
+ if (new_prog) {
+ _mesa_program_init_subroutine_defaults(ctx, new_prog);
}
- if (*target != shProg) {
+ if (*target != new_prog) {
/* Program is current, flush it */
if (shTarget == ctx->_Shader) {
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
/* Empty for now. */
break;
case MESA_SHADER_FRAGMENT:
- if (*target != NULL &&
- ((*target)->_LinkedShaders[MESA_SHADER_FRAGMENT] &&
- (*target)->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program ==
- ctx->_Shader->_CurrentFragmentProgram)) {
+ if (*target == ctx->_Shader->_CurrentFragmentProgram) {
_mesa_reference_program(ctx,
&ctx->_Shader->_CurrentFragmentProgram,
NULL);
break;
}
- _mesa_reference_shader_program(ctx, target, shProg);
+ _mesa_reference_program(ctx, target, new_prog);
return;
}
}
* Use the named shader program for subsequent rendering.
*/
void
-_mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
+_mesa_use_shader_program(struct gl_context *ctx,
+ struct gl_shader_program *shProg)
{
- int i;
- for (i = 0; i < MESA_SHADER_STAGES; i++)
- use_shader_program(ctx, i, shProg, &ctx->Shader);
+ for (int i = 0; i < MESA_SHADER_STAGES; i++) {
+ struct gl_program *new_prog = NULL;
+ if (shProg && shProg->_LinkedShaders[i])
+ new_prog = shProg->_LinkedShaders[i]->Program;
+ use_program(ctx, i, new_prog, &ctx->Shader);
+ }
_mesa_active_program(ctx, shProg, "glUseProgram");
}
/* Attach shader state to the binding point */
_mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader);
/* Update the program */
- _mesa_use_program(ctx, shProg);
+ _mesa_use_shader_program(ctx, shProg);
} else {
/* Must be done first: detach the progam */
- _mesa_use_program(ctx, shProg);
+ _mesa_use_shader_program(ctx, shProg);
/* Unattach shader_state binding point */
_mesa_reference_pipeline_object(ctx, &ctx->_Shader, ctx->Pipeline.Default);
/* If a pipeline was bound, rebind it */
void
-_mesa_use_shader_program(struct gl_context *ctx, GLenum type,
- struct gl_shader_program *shProg,
- struct gl_pipeline_object *shTarget)
+_mesa_use_program(struct gl_context *ctx, gl_shader_stage stage,
+ struct gl_program *prog,
+ struct gl_pipeline_object *shTarget)
{
- gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type);
- use_shader_program(ctx, stage, shProg, shTarget);
+ use_program(ctx, stage, prog, shTarget);
}
{
GET_CURRENT_CONTEXT(ctx);
const char *api_name = "glUniformSubroutinesuiv";
- struct gl_shader_program *shProg;
- struct gl_linked_shader *sh;
gl_shader_stage stage;
int i;
}
stage = _mesa_shader_enum_to_shader_stage(shadertype);
- shProg = ctx->_Shader->CurrentProgram[stage];
- if (!shProg) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
- return;
- }
-
- sh = shProg->_LinkedShaders[stage];
- if (!sh) {
+ struct gl_program *p = ctx->_Shader->CurrentProgram[stage];
+ if (!p) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
- struct gl_program *p = shProg->_LinkedShaders[stage]->Program;
if (count != p->sh.NumSubroutineUniformRemapTable) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s", api_name);
return;
{
GET_CURRENT_CONTEXT(ctx);
const char *api_name = "glGetUniformSubroutineuiv";
- struct gl_shader_program *shProg;
- struct gl_linked_shader *sh;
gl_shader_stage stage;
if (!_mesa_has_ARB_shader_subroutine(ctx)) {
}
stage = _mesa_shader_enum_to_shader_stage(shadertype);
- shProg = ctx->_Shader->CurrentProgram[stage];
- if (!shProg) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
- return;
- }
-
- sh = shProg->_LinkedShaders[stage];
- if (!sh) {
+ struct gl_program *p = ctx->_Shader->CurrentProgram[stage];
+ if (!p) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
- struct gl_program *p = sh->Program;
if (location >= p->sh.NumSubroutineUniformRemapTable) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s", api_name);
return;
_mesa_shader_write_subroutine_indices(struct gl_context *ctx,
gl_shader_stage stage)
{
- if (ctx->_Shader->CurrentProgram[stage] &&
- ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage])
+ if (ctx->_Shader->CurrentProgram[stage])
_mesa_shader_write_subroutine_index(ctx,
- ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage]->Program);
+ ctx->_Shader->CurrentProgram[stage]);
}
void
GLsizei *length, const GLchar *src);
extern void
-_mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg);
+_mesa_use_shader_program(struct gl_context *ctx,
+ struct gl_shader_program *shProg);
extern void
_mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value);
void
-_mesa_use_shader_program(struct gl_context *ctx, GLenum type,
- struct gl_shader_program *shProg,
- struct gl_pipeline_object *shTarget);
+_mesa_use_program(struct gl_context *ctx, gl_shader_stage stage,
+ struct gl_program *prog,
+ struct gl_pipeline_object *shTarget);
extern void
_mesa_copy_linked_program_data(const struct gl_shader_program *src,
static GLbitfield
update_program(struct gl_context *ctx)
{
- const struct gl_shader_program *vsProg =
+ struct gl_program *vsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- const struct gl_shader_program *tcsProg =
+ struct gl_program *tcsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- const struct gl_shader_program *tesProg =
+ struct gl_program *tesProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- const struct gl_shader_program *gsProg =
+ struct gl_program *gsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- struct gl_shader_program *fsProg =
+ struct gl_program *fsProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
- const struct gl_shader_program *csProg =
+ struct gl_program *csProg =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
const struct gl_program *prevVP = ctx->VertexProgram._Current;
const struct gl_program *prevFP = ctx->FragmentProgram._Current;
* come up, or matter.
*/
- if (fsProg && fsProg->data->LinkStatus
- && fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
+ if (fsProg) {
/* Use GLSL fragment shader */
_mesa_reference_program(ctx, &ctx->_Shader->_CurrentFragmentProgram,
- fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
- _mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
- fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
+ fsProg);
+ _mesa_reference_program(ctx, &ctx->FragmentProgram._Current, fsProg);
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
NULL);
}
NULL);
}
- if (gsProg && gsProg->data->LinkStatus
- && gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
+ if (gsProg) {
/* Use GLSL geometry shader */
- _mesa_reference_program(ctx, &ctx->GeometryProgram._Current,
- gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
+ _mesa_reference_program(ctx, &ctx->GeometryProgram._Current, gsProg);
} else {
/* No geometry program */
_mesa_reference_program(ctx, &ctx->GeometryProgram._Current, NULL);
}
- if (tesProg && tesProg->data->LinkStatus
- && tesProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]) {
+ if (tesProg) {
/* Use GLSL tessellation evaluation shader */
- _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current,
- tesProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program);
+ _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, tesProg);
}
else {
/* No tessellation evaluation program */
_mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
}
- if (tcsProg && tcsProg->data->LinkStatus
- && tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]) {
+ if (tcsProg) {
/* Use GLSL tessellation control shader */
- _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current,
- tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program);
+ _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, tcsProg);
}
else {
/* No tessellation control program */
* _mesa_get_fixed_func_vertex_program() needs to know active
* fragprog inputs.
*/
- if (vsProg && vsProg->data->LinkStatus
- && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
+ if (vsProg) {
/* Use GLSL vertex shader */
- _mesa_reference_program(ctx, &ctx->VertexProgram._Current,
- vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
+ _mesa_reference_program(ctx, &ctx->VertexProgram._Current, vsProg);
}
else if (ctx->VertexProgram._Enabled) {
/* Use user-defined vertex program */
_mesa_reference_program(ctx, &ctx->VertexProgram._Current, NULL);
}
- if (csProg && csProg->data->LinkStatus
- && csProg->_LinkedShaders[MESA_SHADER_COMPUTE]) {
+ if (csProg) {
/* Use GLSL compute shader */
- _mesa_reference_program(ctx, &ctx->ComputeProgram._Current,
- csProg->_LinkedShaders[MESA_SHADER_COMPUTE]->Program);
+ _mesa_reference_program(ctx, &ctx->ComputeProgram._Current, csProg);
} else {
/* no compute program */
_mesa_reference_program(ctx, &ctx->ComputeProgram._Current, NULL);
BITSET_DECLARE(enabled_texture_units, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
for (i = 0; i < MESA_SHADER_STAGES; i++) {
- if (ctx->_Shader->CurrentProgram[i] &&
- ctx->_Shader->CurrentProgram[i]->data->LinkStatus) {
- prog[i] = ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]->Program;
+ if (ctx->_Shader->CurrentProgram[i]) {
+ prog[i] = ctx->_Shader->CurrentProgram[i];
} else {
if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled)
prog[i] = ctx->FragmentProgram.Current;
int i;
for (i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--) {
if (ctx->_Shader->CurrentProgram[i] != NULL)
- return ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]->Program;
+ return ctx->_Shader->CurrentProgram[i];
}
return NULL;
}
GLbitfield mask;
GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
- struct gl_linked_shader *shader;
unsigned active_samplers = 0;
- const struct gl_shader_program **shProg =
- (const struct gl_shader_program **) pipeline->CurrentProgram;
+ const struct gl_program **prog =
+ (const struct gl_program **) pipeline->CurrentProgram;
memset(TexturesUsed, 0, sizeof(TexturesUsed));
for (unsigned idx = 0; idx < ARRAY_SIZE(pipeline->CurrentProgram); idx++) {
- if (!shProg[idx])
+ if (!prog[idx])
continue;
- shader = shProg[idx]->_LinkedShaders[idx];
- if (!shader || !shader->Program)
- continue;
-
- mask = shader->Program->SamplersUsed;
+ mask = prog[idx]->SamplersUsed;
while (mask) {
const int s = u_bit_scan(&mask);
- GLuint unit = shader->Program->SamplerUnits[s];
- GLuint tgt = shader->Program->sh.SamplerTargets[s];
+ GLuint unit = prog[idx]->SamplerUnits[s];
+ GLuint tgt = prog[idx]->sh.SamplerTargets[s];
/* FIXME: Samplers are initialized to 0 and Mesa doesn't do a
* great job of eliminating unused uniforms currently so for now
ralloc_asprintf(pipeline,
"Program %d: "
"Texture unit %d is accessed with 2 different types",
- shProg[idx]->Name, unit);
+ prog[idx]->Id, unit);
return false;
}
TexturesUsed[unit] |= (1 << tgt);
}
- active_samplers += shader->Program->info.num_textures;
+ active_samplers += prog[idx]->info.num_textures;
}
if (active_samplers > MAX_COMBINED_TEXTURE_IMAGE_UNITS) {
#include "st_program.h"
static void
-st_bind_atomics(struct st_context *st,
- struct gl_shader_program *prog,
+st_bind_atomics(struct st_context *st, struct gl_program *prog,
enum pipe_shader_type shader_type)
{
unsigned i;
if (!prog || !st->pipe->set_shader_buffers)
return;
- for (i = 0; i < prog->data->NumAtomicBuffers; i++) {
- struct gl_active_atomic_buffer *atomic = &prog->data->AtomicBuffers[i];
+ for (i = 0; i < prog->sh.data->NumAtomicBuffers; i++) {
+ struct gl_active_atomic_buffer *atomic =
+ &prog->sh.data->AtomicBuffers[i];
struct gl_atomic_buffer_binding *binding =
&st->ctx->AtomicBufferBindings[atomic->Binding];
struct st_buffer_object *st_obj =
static void
bind_vs_atomics(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
st_bind_atomics(st, prog, PIPE_SHADER_VERTEX);
static void
bind_fs_atomics(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
st_bind_atomics(st, prog, PIPE_SHADER_FRAGMENT);
static void
bind_gs_atomics(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
st_bind_atomics(st, prog, PIPE_SHADER_GEOMETRY);
static void
bind_tcs_atomics(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
st_bind_atomics(st, prog, PIPE_SHADER_TESS_CTRL);
static void
bind_tes_atomics(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
st_bind_atomics(st, prog, PIPE_SHADER_TESS_EVAL);
static void
bind_cs_atomics(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
st_bind_atomics(st, prog, PIPE_SHADER_COMPUTE);
static void bind_vs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
- return;
-
- st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program, PIPE_SHADER_VERTEX);
+ st_bind_ubos(st, prog, PIPE_SHADER_VERTEX);
}
const struct st_tracked_state st_bind_vs_ubos = {
static void bind_fs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
- return;
-
- st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program, PIPE_SHADER_FRAGMENT);
+ st_bind_ubos(st, prog, PIPE_SHADER_FRAGMENT);
}
const struct st_tracked_state st_bind_fs_ubos = {
static void bind_gs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_GEOMETRY])
- return;
-
- st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program, PIPE_SHADER_GEOMETRY);
+ st_bind_ubos(st, prog, PIPE_SHADER_GEOMETRY);
}
const struct st_tracked_state st_bind_gs_ubos = {
static void bind_tcs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_CTRL])
- return;
-
- st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program, PIPE_SHADER_TESS_CTRL);
+ st_bind_ubos(st, prog, PIPE_SHADER_TESS_CTRL);
}
const struct st_tracked_state st_bind_tcs_ubos = {
static void bind_tes_ubos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_EVAL])
- return;
-
- st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program, PIPE_SHADER_TESS_EVAL);
+ st_bind_ubos(st, prog, PIPE_SHADER_TESS_EVAL);
}
const struct st_tracked_state st_bind_tes_ubos = {
static void bind_cs_ubos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
- return;
-
- st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
- PIPE_SHADER_COMPUTE);
+ st_bind_ubos(st, prog, PIPE_SHADER_COMPUTE);
}
const struct st_tracked_state st_bind_cs_ubos = {
static void bind_vs_images(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
- return;
-
- st_bind_images(st, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program, PIPE_SHADER_VERTEX);
+ st_bind_images(st, prog, PIPE_SHADER_VERTEX);
}
const struct st_tracked_state st_bind_vs_images = {
static void bind_fs_images(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
- return;
-
- st_bind_images(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program, PIPE_SHADER_FRAGMENT);
+ st_bind_images(st, prog, PIPE_SHADER_FRAGMENT);
}
const struct st_tracked_state st_bind_fs_images = {
static void bind_gs_images(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_GEOMETRY])
- return;
-
- st_bind_images(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program, PIPE_SHADER_GEOMETRY);
+ st_bind_images(st, prog, PIPE_SHADER_GEOMETRY);
}
const struct st_tracked_state st_bind_gs_images = {
static void bind_tcs_images(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_CTRL])
- return;
-
- st_bind_images(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program, PIPE_SHADER_TESS_CTRL);
+ st_bind_images(st, prog, PIPE_SHADER_TESS_CTRL);
}
const struct st_tracked_state st_bind_tcs_images = {
static void bind_tes_images(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_EVAL])
- return;
-
- st_bind_images(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program, PIPE_SHADER_TESS_EVAL);
+ st_bind_images(st, prog, PIPE_SHADER_TESS_EVAL);
}
const struct st_tracked_state st_bind_tes_images = {
static void bind_cs_images(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
- return;
-
- st_bind_images(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program, PIPE_SHADER_COMPUTE);
+ st_bind_images(st, prog, PIPE_SHADER_COMPUTE);
}
const struct st_tracked_state st_bind_cs_images = {
static void bind_vs_ssbos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
- return;
-
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
- PIPE_SHADER_VERTEX);
+ st_bind_ssbos(st, prog, PIPE_SHADER_VERTEX);
}
const struct st_tracked_state st_bind_vs_ssbos = {
static void bind_fs_ssbos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
- return;
-
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
- PIPE_SHADER_FRAGMENT);
+ st_bind_ssbos(st, prog, PIPE_SHADER_FRAGMENT);
}
const struct st_tracked_state st_bind_fs_ssbos = {
static void bind_gs_ssbos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_GEOMETRY])
- return;
-
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
- PIPE_SHADER_GEOMETRY);
+ st_bind_ssbos(st, prog, PIPE_SHADER_GEOMETRY);
}
const struct st_tracked_state st_bind_gs_ssbos = {
static void bind_tcs_ssbos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_CTRL])
- return;
-
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program,
- PIPE_SHADER_TESS_CTRL);
+ st_bind_ssbos(st, prog, PIPE_SHADER_TESS_CTRL);
}
const struct st_tracked_state st_bind_tcs_ssbos = {
static void bind_tes_ssbos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_EVAL])
- return;
-
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program,
- PIPE_SHADER_TESS_EVAL);
+ st_bind_ssbos(st, prog, PIPE_SHADER_TESS_EVAL);
}
const struct st_tracked_state st_bind_tes_ssbos = {
static void bind_cs_ssbos(struct st_context *st)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
- return;
-
- st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
- PIPE_SHADER_COMPUTE);
+ st_bind_ssbos(st, prog, PIPE_SHADER_COMPUTE);
}
const struct st_tracked_state st_bind_cs_ssbos = {
struct pipe_resource *indirect,
GLintptr indirect_offset)
{
- struct gl_shader_program *prog =
+ struct gl_program *prog =
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
st_validate_state(st, ST_PIPELINE_COMPUTE);
for (unsigned i = 0; i < 3; i++) {
- info.block[i] = group_size ? group_size[i] : prog->Comp.LocalSize[i];
+ info.block[i] = group_size ? group_size[i] : prog->info.cs.local_size[i];
info.grid[i] = num_groups ? num_groups[i] : 0;
}