summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_link.c
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-05-25 14:19:18 +1000
committerBen Skeggs <[email protected]>2008-05-25 14:19:18 +1000
commit92120851947ad4a47d2150a7cf3f8dc5fdde396c (patch)
tree21a04cf25570028ee0266558a1350577751722ab /src/mesa/shader/slang/slang_link.c
parent9a01ee4424718e0c3015c1f0477cae63ee63d96b (diff)
parent7fbb61eedd4b07f07007a172cea227d5c363b908 (diff)
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/mesa/shader/slang/slang_link.c')
-rw-r--r--src/mesa/shader/slang/slang_link.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index ae581553dc7..80cd4b6df62 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -369,12 +369,9 @@ link_error(struct gl_shader_program *shProg, const char *msg)
* 2. Varying vars in the two shaders are combined so their locations
* agree between the vertex and fragment stages. They're treated as
* vertex program output attribs and as fragment program input attribs.
- * 3. Uniform vars (including state references, constants, etc) from the
- * vertex and fragment shaders are merged into one group. Recall that
- * GLSL uniforms are shared by all linked shaders.
- * 4. The vertex and fragment programs are cloned and modified to update
- * src/dst register references so they use the new, linked uniform/
- * varying storage locations.
+ * 3. The vertex and fragment programs are cloned and modified to update
+ * src/dst register references so they use the new, linked varying
+ * storage locations.
*/
void
_slang_link(GLcontext *ctx,
@@ -409,20 +406,20 @@ _slang_link(GLcontext *ctx,
* Make copies of the vertex/fragment programs now since we'll be
* changing src/dst registers after merging the uniforms and varying vars.
*/
+ _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
if (vertProg) {
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram,
- vertex_program(_mesa_clone_program(ctx, &vertProg->Base)));
- }
- else {
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
+ struct gl_vertex_program *linked_vprog =
+ vertex_program(_mesa_clone_program(ctx, &vertProg->Base));
+ shProg->VertexProgram = linked_vprog; /* refcount OK */
+ ASSERT(shProg->VertexProgram->Base.RefCount == 1);
}
+ _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
if (fragProg) {
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram,
- fragment_program(_mesa_clone_program(ctx, &fragProg->Base)));
- }
- else {
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
+ struct gl_fragment_program *linked_fprog =
+ fragment_program(_mesa_clone_program(ctx, &fragProg->Base));
+ shProg->FragmentProgram = linked_fprog; /* refcount OK */
+ ASSERT(shProg->FragmentProgram->Base.RefCount == 1);
}
/* link varying vars */
@@ -440,18 +437,6 @@ _slang_link(GLcontext *ctx,
/*_mesa_print_uniforms(shProg->Uniforms);*/
if (shProg->VertexProgram) {
- /* Rather than cloning the parameter list here, just share it.
- * We need to be careful _mesa_clear_shader_program_data() in
- * to avoid double-freeing.
- */
- shProg->VertexProgram->Base.Parameters = vertProg->Base.Parameters;
- }
- if (shProg->FragmentProgram) {
- /* see comment just above */
- shProg->FragmentProgram->Base.Parameters = fragProg->Base.Parameters;
- }
-
- if (shProg->VertexProgram) {
if (!_slang_resolve_attributes(shProg, &shProg->VertexProgram->Base)) {
/*goto cleanup;*/
_mesa_problem(ctx, "_slang_resolve_attributes() failed");