#include "ir.h"
#include "program.h"
#include "program/prog_instruction.h"
+#include "program/program.h"
#include "util/set.h"
#include "util/string_to_uint_map.h"
#include "linker.h"
}
gl_linked_shader *linked = ctx->Driver.NewShader(shader_list[0]->Stage);
+
+ /* Create program and attach it to the linked shader */
+ struct gl_program *gl_prog =
+ ctx->Driver.NewProgram(ctx,
+ _mesa_shader_stage_to_program(shader_list[0]->Stage),
+ prog->Name);
+ if (!prog) {
+ prog->LinkStatus = false;
+ _mesa_delete_linked_shader(ctx, linked);
+ return NULL;
+ }
+
+ /* Don't use _mesa_reference_program() just take ownership */
+ linked->Program = gl_prog;
+
linked->ir = new(linked) exec_list;
clone_ir_list(mem_ctx, linked->ir, main->ir);
if (!shader)
continue;
- struct gl_program *prog =
- ctx->Driver.NewProgram(ctx, _mesa_shader_stage_to_program(stage),
- 0);
- if (!prog)
- return false;
-
- /* Don't use _mesa_reference_program() just take ownership */
- shader->Program = prog;
-
+ struct gl_program *prog = shader->Program;
prog->Parameters = _mesa_new_parameter_list();
process_glsl_ir(brw, shProg, shader);
validate_ir_tree(shader->ir);
- prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name);
- if (!prog)
- return NULL;
+ prog = shader->Program;
prog->Parameters = _mesa_new_parameter_list();
v.ctx = ctx;
v.prog = prog;
prog->info.fs.depth_layout = shader_program->FragDepthLayout;
}
- /* Don't use _mesa_reference_program() just take ownership */
- shader->Program = prog;
-
if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0) {
_mesa_optimize_program(ctx, prog, prog);
}
struct gl_linked_shader *shader)
{
struct gl_program *prog;
- GLenum target = _mesa_shader_stage_to_program(shader->Stage);
validate_ir_tree(shader->ir);
- prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name);
- if (!prog)
- return NULL;
-
- /* Don't use _mesa_reference_program() just take ownership */
- shader->Program = prog;
+ prog = shader->Program;
prog->Parameters = _mesa_new_parameter_list();
{
glsl_to_tgsi_visitor* v;
struct gl_program *prog;
- GLenum target = _mesa_shader_stage_to_program(shader->Stage);
struct gl_shader_compiler_options *options =
&ctx->Const.ShaderCompilerOptions[shader->Stage];
struct pipe_screen *pscreen = ctx->st->pipe->screen;
validate_ir_tree(shader->ir);
- prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name);
- if (!prog)
- return NULL;
-
- /* Don't use _mesa_reference_program() just take ownership */
- shader->Program = prog;
+ prog = shader->Program;
prog->Parameters = _mesa_new_parameter_list();
v = new glsl_to_tgsi_visitor();