summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/linker.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp10
-rw-r--r--src/mesa/program/ir_to_mesa.cpp7
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp8
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp8
5 files changed, 20 insertions, 29 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index cc28b26964a..e34cf286b54 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -72,6 +72,7 @@
#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"
@@ -2187,6 +2188,21 @@ link_intrastage_shaders(void *mem_ctx,
}
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);
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index a0c9e20807c..3f6041b7ba2 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -221,15 +221,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
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);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 7f4212333f1..88a7f368ee1 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2794,9 +2794,7 @@ get_mesa_program(struct gl_context *ctx,
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;
@@ -2929,9 +2927,6 @@ get_mesa_program(struct gl_context *ctx,
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);
}
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 2d8cf81dcce..cbc7e5a693d 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -367,16 +367,10 @@ st_nir_get_mesa_program(struct gl_context *ctx,
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();
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b47e1470e3f..2c2bbb6c26b 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6407,7 +6407,6 @@ get_mesa_program_tgsi(struct gl_context *ctx,
{
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;
@@ -6415,12 +6414,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
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();