summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-07-28 15:42:35 -0700
committerEric Anholt <[email protected]>2010-07-28 15:51:36 -0700
commit859fd56245c1d725cacab17a34793d41ea14e867 (patch)
tree97085dc9b3c5eb1baae763c61ed0146ea17d6000 /src/mesa
parent56af4e56e3852363a810174c64650df6f0ae4f53 (diff)
ir_to_mesa: Respect the driver if it rejects a shader.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c6
-rw-r--r--src/mesa/program/ir_to_mesa.cpp14
2 files changed, 11 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 4b08d2599bc..c6d11fed064 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -36,6 +36,7 @@
#include "program/program.h"
#include "program/programopt.h"
#include "tnl/tnl.h"
+#include "talloc.h"
#include "brw_context.h"
#include "brw_wm.h"
@@ -114,10 +115,7 @@ shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg)
shader = _mesa_lookup_shader_program(ctx, prog->Id);
if (shader) {
- if (shader->InfoLog) {
- free(shader->InfoLog);
- }
- shader->InfoLog = _mesa_strdup(msg);
+ shader->InfoLog = talloc_strdup_append(shader->InfoLog, msg);
shader->LinkStatus = GL_FALSE;
}
}
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index a3019cc650a..3a28c566d4d 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2320,7 +2320,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
validate_ir_tree(shader->ir);
- prog = ctx->Driver.NewProgram(ctx, target, 1);
+ prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name);
if (!prog)
return NULL;
prog->Parameters = _mesa_new_parameter_list();
@@ -2536,6 +2536,7 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
if (prog->LinkStatus) {
for (i = 0; i < prog->_NumLinkedShaders; i++) {
struct gl_program *linked_prog;
+ bool ok = true;
linked_prog = get_mesa_program(ctx, prog,
prog->_LinkedShaders[i]);
@@ -2547,16 +2548,19 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
case GL_VERTEX_SHADER:
_mesa_reference_vertprog(ctx, &prog->VertexProgram,
(struct gl_vertex_program *)linked_prog);
- ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
- linked_prog);
+ ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
+ linked_prog);
break;
case GL_FRAGMENT_SHADER:
_mesa_reference_fragprog(ctx, &prog->FragmentProgram,
(struct gl_fragment_program *)linked_prog);
- ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
- linked_prog);
+ ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
+ linked_prog);
break;
}
+ if (!ok) {
+ prog->LinkStatus = GL_FALSE;
+ }
}
}
}