aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program/ir_to_mesa.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-04 09:28:39 +0100
committermarha <marha@users.sourceforge.net>2011-11-04 09:28:39 +0100
commit23e2767dc3e6b8891d4b55b711c70c6bc85a6f85 (patch)
tree04c538697c3afbd401afb1bb614460b16be28844 /mesalib/src/mesa/program/ir_to_mesa.cpp
parent125500b44d0253d7fd7a59905ab730151d4f66e2 (diff)
parent02f377d5e2dd18537d0807ad63675a0970b5a37d (diff)
downloadvcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.tar.gz
vcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.tar.bz2
vcxsrv-23e2767dc3e6b8891d4b55b711c70c6bc85a6f85.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/include/scrnintstr.h xorg-server/xkb/ddxList.c xorg-server/xkb/ddxLoad.c
Diffstat (limited to 'mesalib/src/mesa/program/ir_to_mesa.cpp')
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 93563bdaa..3c2eb5707 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -2273,6 +2273,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
case GLSL_SAMPLER_DIM_BUF:
assert(!"FINISHME: Implement ARB_texture_buffer_object");
break;
+ case GLSL_SAMPLER_DIM_EXTERNAL:
+ inst->tex_target = TEXTURE_EXTERNAL_INDEX;
+ break;
default:
assert(!"Should not get here.");
}
@@ -2546,7 +2549,7 @@ count_resources(struct gl_program *prog)
*
* XXX more checks are needed...
*/
-static void
+static bool
check_resources(const struct gl_context *ctx,
struct gl_shader_program *shader_program,
struct gl_program *prog)
@@ -2586,6 +2589,8 @@ check_resources(const struct gl_context *ctx,
default:
_mesa_problem(ctx, "unexpected program type in check_resources()");
}
+
+ return shader_program->LinkStatus;
}
class add_uniform_to_shader : public uniform_field_visitor {
@@ -3168,9 +3173,7 @@ get_mesa_program(struct gl_context *ctx,
}
if (!shader_program->LinkStatus) {
- free(mesa_instructions);
- _mesa_reference_program(ctx, &shader->Program, NULL);
- return NULL;
+ goto fail_exit;
}
set_branchtargets(&v, mesa_instructions, num_instructions);
@@ -3191,10 +3194,16 @@ get_mesa_program(struct gl_context *ctx,
prog->Instructions = mesa_instructions;
prog->NumInstructions = num_instructions;
+ /* Setting this to NULL prevents a possible double free in the fail_exit
+ * path (far below).
+ */
+ mesa_instructions = NULL;
+
do_set_program_inouts(shader->ir, prog, shader->Type == GL_FRAGMENT_SHADER);
count_resources(prog);
- check_resources(ctx, shader_program, prog);
+ if (!check_resources(ctx, shader_program, prog))
+ goto fail_exit;
_mesa_reference_program(ctx, &shader->Program, prog);
@@ -3203,6 +3212,11 @@ get_mesa_program(struct gl_context *ctx,
}
return prog;
+
+fail_exit:
+ free(mesa_instructions);
+ _mesa_reference_program(ctx, &shader->Program, NULL);
+ return NULL;
}
extern "C" {
@@ -3301,7 +3315,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
_mesa_reference_program(ctx, &linked_prog, NULL);
}
- return GL_TRUE;
+ return prog->LinkStatus;
}