summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/common/meta.c28
-rw-r--r--src/mesa/drivers/common/meta.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c10
-rw-r--r--src/mesa/drivers/dri/i965/brw_ff_gs.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_surface_state.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs_surface_state.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes_surface_state.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c10
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sol.c24
-rw-r--r--src/mesa/drivers/dri/i965/gen7_l3_state.c6
-rw-r--r--src/mesa/main/api_validate.c57
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp6
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/pipelineobj.c76
-rw-r--r--src/mesa/main/shader_query.cpp38
-rw-r--r--src/mesa/main/shaderapi.c104
-rw-r--r--src/mesa/main/shaderapi.h9
-rw-r--r--src/mesa/main/state.c50
-rw-r--r--src/mesa/main/texstate.c5
-rw-r--r--src/mesa/main/transformfeedback.c2
-rw-r--r--src/mesa/main/uniform_query.cpp21
-rw-r--r--src/mesa/state_tracker/st_atom_atomicbuf.c20
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c43
-rw-r--r--src/mesa/state_tracker/st_atom_image.c42
-rw-r--r--src/mesa/state_tracker/st_atom_storagebuf.c48
-rw-r--r--src/mesa/state_tracker/st_cb_compute.c4
27 files changed, 248 insertions, 396 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 0d5661ba062..5b99c6baa52 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -167,7 +167,7 @@ _mesa_meta_use_program(struct gl_context *ctx,
_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
@@ -594,8 +594,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
* 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);
@@ -931,16 +931,6 @@ _mesa_meta_end(struct gl_context *ctx)
}
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) {
@@ -966,22 +956,20 @@ _mesa_meta_end(struct gl_context *ctx)
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,
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 0a913e9fa82..1b5cf42eb87 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -125,7 +125,7 @@ struct save_state
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;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 84d34c0f6a0..0b3ac897aa0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -274,14 +274,12 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
/* 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) {
diff --git a/src/mesa/drivers/dri/i965/brw_ff_gs.c b/src/mesa/drivers/dri/i965/brw_ff_gs.c
index 4934af3fd39..0316d0f8c3b 100644
--- a/src/mesa/drivers/dri/i965/brw_ff_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_ff_gs.c
@@ -195,10 +195,10 @@ brw_ff_gs_populate_key(struct brw_context *brw,
/* 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
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 dc064626aea..d5a106d6bec 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ -72,17 +72,13 @@ brw_upload_gs_ubo_surfaces(struct brw_context *brw)
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 = {
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 083058bdf20..ede7ae9d521 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -72,17 +72,13 @@ brw_upload_tcs_ubo_surfaces(struct brw_context *brw)
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 = {
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 03b301e6de3..1982955be8f 100644
--- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
@@ -72,17 +72,13 @@ brw_upload_tes_ubo_surfaces(struct brw_context *brw)
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 = {
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 5665735f432..29359d43c31 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -140,15 +140,10 @@ brw_upload_vs_ubo_surfaces(struct brw_context *brw)
{
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 = {
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 c7c73774c3b..a6fadf9b760 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1461,15 +1461,11 @@ brw_upload_cs_ubo_surfaces(struct brw_context *brw)
{
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 = {
@@ -1844,7 +1840,7 @@ brw_upload_cs_work_groups_surface(struct brw_context *brw)
{
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 =
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 656d042769e..6f1d2c2fd04 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -98,7 +98,7 @@ brw_gs_upload_binding_table(struct brw_context *brw)
{
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:
@@ -112,11 +112,11 @@ brw_gs_upload_binding_table(struct brw_context *brw)
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) {
@@ -140,12 +140,12 @@ brw_gs_upload_binding_table(struct brw_context *brw)
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;
}
@@ -225,7 +225,7 @@ brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
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;
@@ -234,14 +234,12 @@ brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
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.
diff --git a/src/mesa/drivers/dri/i965/gen7_l3_state.c b/src/mesa/drivers/dri/i965/gen7_l3_state.c
index dce39c3d192..536c00c4543 100644
--- a/src/mesa/drivers/dri/i965/gen7_l3_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_l3_state.c
@@ -49,12 +49,12 @@ get_pipeline_state_l3_weights(const struct brw_context *brw)
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;
}
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 5f051dbec6f..6c95701ea0e 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -191,12 +191,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
#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.
@@ -208,12 +206,12 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
* 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
@@ -394,17 +392,15 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
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 */
@@ -501,8 +497,7 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
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;
@@ -517,13 +512,11 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
}
}
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;
@@ -1296,8 +1289,6 @@ _mesa_validate_MultiDrawElementsIndirectCount(struct gl_context *ctx,
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",
@@ -1310,8 +1301,7 @@ check_valid_to_compute(struct gl_context *ctx, const char *function)
* "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);
@@ -1325,7 +1315,6 @@ GLboolean
_mesa_validate_DispatchCompute(struct gl_context *ctx,
const GLuint *num_groups)
{
- struct gl_shader_program *prog;
int i;
FLUSH_CURRENT(ctx, 0);
@@ -1363,8 +1352,8 @@ _mesa_validate_DispatchCompute(struct gl_context *ctx,
* "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;
@@ -1378,7 +1367,6 @@ _mesa_validate_DispatchComputeGroupSizeARB(struct gl_context *ctx,
const GLuint *num_groups,
const GLuint *group_size)
{
- struct gl_shader_program *prog;
GLuint total_invocations = 1;
int i;
@@ -1393,8 +1381,8 @@ _mesa_validate_DispatchComputeGroupSizeARB(struct gl_context *ctx,
* 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)");
@@ -1462,7 +1450,6 @@ valid_dispatch_indirect(struct gl_context *ctx,
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;
@@ -1513,8 +1500,8 @@ valid_dispatch_indirect(struct gl_context *ctx,
* "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;
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 6261b9cacc5..b2942f1aada 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -300,9 +300,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
{
/* _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;
@@ -366,7 +364,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
* 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;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7784d2548d2..c733911c476 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2907,7 +2907,7 @@ struct gl_pipeline_object
*
* 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;
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index e777f991589..ec5df896c09 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -61,7 +61,7 @@ _mesa_delete_pipeline_object(struct gl_context *ctx,
_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);
@@ -218,6 +218,18 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx,
}
}
+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
*/
@@ -325,22 +337,22 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
* 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;
}
@@ -469,11 +481,9 @@ _mesa_bind_pipeline(struct gl_context *ctx,
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);
}
}
}
@@ -659,35 +669,35 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
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;
@@ -703,23 +713,22 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
*/
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;
}
}
@@ -727,7 +736,7 @@ program_stages_all_active(struct gl_pipeline_object *pipe,
pipe->InfoLog = ralloc_asprintf(pipe,
"Program %d is not active for all "
"shaders that was linked",
- prog->Name);
+ prog->Id);
}
return status;
@@ -742,7 +751,7 @@ program_stages_interleaved_illegally(const struct gl_pipeline_object *pipe)
* 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
@@ -751,7 +760,7 @@ program_stages_interleaved_illegally(const struct gl_pipeline_object *pipe)
* 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) {
@@ -762,7 +771,7 @@ program_stages_interleaved_illegally(const struct gl_pipeline_object *pipe)
return true;
}
- prev_linked_stages = cur->data->linked_stages;
+ prev_linked_stages = cur->sh.data->linked_stages;
}
return false;
@@ -861,11 +870,12 @@ _mesa_validate_program_pipeline(struct gl_context* ctx,
* 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;
}
}
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 40107373b80..f465b3959e5 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1373,24 +1373,21 @@ _mesa_get_program_resourceiv(struct gl_shader_program *shProg,
}
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;
@@ -1413,9 +1410,9 @@ validate_io(struct gl_shader_program *producer,
* 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;
@@ -1434,9 +1431,9 @@ validate_io(struct gl_shader_program *producer,
}
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;
@@ -1592,30 +1589,27 @@ validate_io(struct gl_shader_program *producer,
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;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c87ba0946ca..8ad4e36a309 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -156,10 +156,8 @@ _mesa_init_shader_state(struct gl_context *ctx)
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);
@@ -1100,7 +1098,8 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
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;
}
}
@@ -1119,7 +1118,15 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
* 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. */
@@ -1232,27 +1239,17 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
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);
@@ -1271,10 +1268,7 @@ use_shader_program(struct gl_context *ctx, gl_shader_stage stage,
/* 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);
@@ -1282,7 +1276,7 @@ use_shader_program(struct gl_context *ctx, gl_shader_stage stage,
break;
}
- _mesa_reference_shader_program(ctx, target, shProg);
+ _mesa_reference_program(ctx, target, new_prog);
return;
}
}
@@ -1292,11 +1286,15 @@ use_shader_program(struct gl_context *ctx, gl_shader_stage stage,
* 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");
}
@@ -1893,10 +1891,10 @@ _mesa_UseProgram(GLuint program)
/* 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 */
@@ -2178,12 +2176,11 @@ invalid_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)
{
- gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type);
- use_shader_program(ctx, stage, shProg, shTarget);
+ use_program(ctx, stage, prog, shTarget);
}
@@ -2612,8 +2609,6 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
{
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;
@@ -2628,19 +2623,12 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
}
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;
@@ -2697,8 +2685,6 @@ _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location,
{
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)) {
@@ -2712,19 +2698,12 @@ _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location,
}
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;
@@ -2890,10 +2869,9 @@ void
_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
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index 06de11ff766..a89dbfb564c 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -51,7 +51,8 @@ _mesa_copy_string(GLchar *dst, GLsizei maxLength,
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,
@@ -213,9 +214,9 @@ extern void GLAPIENTRY
_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,
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 2a926a182b9..5cb58a469bb 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -95,17 +95,17 @@ update_program_enables(struct gl_context *ctx)
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;
@@ -132,13 +132,11 @@ update_program(struct gl_context *ctx)
* 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);
}
@@ -179,32 +177,26 @@ update_program(struct gl_context *ctx)
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 */
@@ -215,11 +207,9 @@ update_program(struct gl_context *ctx)
* _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 */
@@ -238,11 +228,9 @@ update_program(struct gl_context *ctx)
_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);
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 4676d4aa0d9..be73fc33db6 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -700,9 +700,8 @@ update_texture_state( struct gl_context *ctx )
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;
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 771223aff99..06fa56ab993 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -390,7 +390,7 @@ get_xfb_source(struct gl_context *ctx)
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;
}
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index f505986fcfc..d5a2d0f58bc 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -1163,27 +1163,22 @@ _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline)
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
@@ -1197,14 +1192,14 @@ _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline)
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) {
diff --git a/src/mesa/state_tracker/st_atom_atomicbuf.c b/src/mesa/state_tracker/st_atom_atomicbuf.c
index 93538b567f1..11fb84f1118 100644
--- a/src/mesa/state_tracker/st_atom_atomicbuf.c
+++ b/src/mesa/state_tracker/st_atom_atomicbuf.c
@@ -41,8 +41,7 @@
#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;
@@ -50,8 +49,9 @@ st_bind_atomics(struct st_context *st,
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 =
@@ -72,7 +72,7 @@ st_bind_atomics(struct st_context *st,
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);
@@ -85,7 +85,7 @@ const struct st_tracked_state st_bind_vs_atomics = {
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);
@@ -98,7 +98,7 @@ const struct st_tracked_state st_bind_fs_atomics = {
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);
@@ -111,7 +111,7 @@ const struct st_tracked_state st_bind_gs_atomics = {
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);
@@ -124,7 +124,7 @@ const struct st_tracked_state st_bind_tcs_atomics = {
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);
@@ -137,7 +137,7 @@ const struct st_tracked_state st_bind_tes_atomics = {
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);
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 958b202eb73..6ab4ca99be6 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -278,13 +278,10 @@ static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
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 = {
@@ -293,13 +290,10 @@ 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 = {
@@ -308,13 +302,10 @@ 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 = {
@@ -323,13 +314,10 @@ 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 = {
@@ -338,13 +326,10 @@ 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 = {
@@ -353,14 +338,10 @@ 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 = {
diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c
index 649906c1c1b..5dd2cd64f90 100644
--- a/src/mesa/state_tracker/st_atom_image.c
+++ b/src/mesa/state_tracker/st_atom_image.c
@@ -129,13 +129,10 @@ st_bind_images(struct st_context *st, struct gl_program *prog,
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 = {
@@ -144,13 +141,10 @@ 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 = {
@@ -159,13 +153,10 @@ 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 = {
@@ -174,13 +165,10 @@ 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 = {
@@ -189,13 +177,10 @@ 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 = {
@@ -204,13 +189,10 @@ 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 = {
diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c
index 174b4b3980e..ec89f163832 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -92,14 +92,10 @@ st_bind_ssbos(struct st_context *st, struct gl_program *prog,
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 = {
@@ -108,14 +104,10 @@ 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 = {
@@ -124,14 +116,10 @@ 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 = {
@@ -140,14 +128,10 @@ 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 = {
@@ -156,14 +140,10 @@ 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 = {
@@ -172,14 +152,10 @@ 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 = {
diff --git a/src/mesa/state_tracker/st_cb_compute.c b/src/mesa/state_tracker/st_cb_compute.c
index ccc5dc2b004..f91df4bd177 100644
--- a/src/mesa/state_tracker/st_cb_compute.c
+++ b/src/mesa/state_tracker/st_cb_compute.c
@@ -40,7 +40,7 @@ static void st_dispatch_compute_common(struct gl_context *ctx,
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;
@@ -57,7 +57,7 @@ static void st_dispatch_compute_common(struct gl_context *ctx,
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;
}