summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 1af1c3f5794..358969b082c 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2152,14 +2152,20 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
/**
* Copy program-specific data generated by linking from the gl_shader_program
- * object to a specific gl_program object.
+ * object to the gl_program object referred to by the gl_linked_shader.
+ *
+ * This function expects _mesa_reference_program() to have been previously
+ * called setting the gl_linked_shaders program reference.
*/
void
-_mesa_copy_linked_program_data(gl_shader_stage type,
- const struct gl_shader_program *src,
- struct gl_program *dst)
+_mesa_copy_linked_program_data(const struct gl_shader_program *src,
+ struct gl_linked_shader *dst_sh)
{
- switch (type) {
+ assert(dst_sh->Program);
+
+ struct gl_program *dst = dst_sh->Program;
+
+ switch (dst_sh->Stage) {
case MESA_SHADER_VERTEX:
dst->ClipDistanceArraySize = src->Vert.ClipDistanceArraySize;
dst->CullDistanceArraySize = src->Vert.CullDistanceArraySize;
@@ -2167,34 +2173,29 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
case MESA_SHADER_TESS_CTRL: {
struct gl_tess_ctrl_program *dst_tcp =
(struct gl_tess_ctrl_program *) dst;
- dst_tcp->VerticesOut = src->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
- info.TessCtrl.VerticesOut;
+ dst_tcp->VerticesOut = dst_sh->info.TessCtrl.VerticesOut;
break;
}
case MESA_SHADER_TESS_EVAL: {
struct gl_tess_eval_program *dst_tep =
(struct gl_tess_eval_program *) dst;
- struct gl_linked_shader *tes_sh =
- src->_LinkedShaders[MESA_SHADER_TESS_EVAL];
- dst_tep->PrimitiveMode = tes_sh->info.TessEval.PrimitiveMode;
- dst_tep->Spacing = tes_sh->info.TessEval.Spacing;
- dst_tep->VertexOrder = tes_sh->info.TessEval.VertexOrder;
- dst_tep->PointMode = tes_sh->info.TessEval.PointMode;
+ dst_tep->PrimitiveMode = dst_sh->info.TessEval.PrimitiveMode;
+ dst_tep->Spacing = dst_sh->info.TessEval.Spacing;
+ dst_tep->VertexOrder = dst_sh->info.TessEval.VertexOrder;
+ dst_tep->PointMode = dst_sh->info.TessEval.PointMode;
dst->ClipDistanceArraySize = src->TessEval.ClipDistanceArraySize;
dst->CullDistanceArraySize = src->TessEval.CullDistanceArraySize;
break;
}
case MESA_SHADER_GEOMETRY: {
struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst;
- struct gl_linked_shader *geom_sh =
- src->_LinkedShaders[MESA_SHADER_GEOMETRY];
dst_gp->VerticesIn = src->Geom.VerticesIn;
- dst_gp->VerticesOut = geom_sh->info.Geom.VerticesOut;
- dst_gp->Invocations = geom_sh->info.Geom.Invocations;
- dst_gp->InputType = geom_sh->info.Geom.InputType;
- dst_gp->OutputType = geom_sh->info.Geom.OutputType;
+ dst_gp->VerticesOut = dst_sh->info.Geom.VerticesOut;
+ dst_gp->Invocations = dst_sh->info.Geom.Invocations;
+ dst_gp->InputType = dst_sh->info.Geom.InputType;
+ dst_gp->OutputType = dst_sh->info.Geom.OutputType;
dst->ClipDistanceArraySize = src->Geom.ClipDistanceArraySize;
dst->CullDistanceArraySize = src->Geom.CullDistanceArraySize;
dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;