summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp8
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c2
-rw-r--r--src/mesa/main/context.c3
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/shaderapi.c9
-rw-r--r--src/mesa/main/shaderobj.c2
-rw-r--r--src/mesa/main/state.c6
-rw-r--r--src/mesa/main/texstate.c10
-rw-r--r--src/mesa/main/uniforms.c12
-rw-r--r--src/mesa/program/ir_to_mesa.cpp6
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp4
-rw-r--r--src/mesa/state_tracker/st_program.c4
13 files changed, 36 insertions, 34 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index e073eaaec2d..6d17839df95 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1828,12 +1828,14 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
{
struct brw_context *brw = brw_context(ctx);
struct brw_wm_prog_key key;
- struct gl_fragment_program *fp = prog->FragmentProgram;
- struct brw_fragment_program *bfp = brw_fragment_program(fp);
- if (!fp)
+ if (!prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
return true;
+ struct gl_fragment_program *fp = (struct gl_fragment_program *)
+ prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
+ struct brw_fragment_program *bfp = brw_fragment_program(fp);
+
memset(&key, 0, sizeof(key));
if (fp->UsesKill)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 56181a37c9f..4035186af00 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -347,7 +347,8 @@ public:
this->c = c;
this->p = &c->func;
this->brw = p->brw;
- this->fp = prog->FragmentProgram;
+ this->fp = (struct gl_fragment_program *)
+ prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
this->prog = prog;
this->intel = &brw->intel;
this->ctx = &intel->ctx;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index fdb2d15c609..f6af7815bb7 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -224,7 +224,7 @@ bool do_wm_prog(struct brw_context *brw,
brw_init_compile(brw, &c->func, c);
- if (prog && prog->FragmentProgram) {
+ if (prog && prog->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
if (!brw_wm_fs_emit(brw, c, prog))
return false;
} else {
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 6ef394fe730..fc52e8c1562 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1860,8 +1860,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
break;
case GL_FRAGMENT_SHADER:
- _mesa_append_uniforms_to_file(sh,
- &shProg[i]->FragmentProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c7183b39935..749324d7629 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2171,7 +2171,6 @@ struct gl_shader_program
} Vert;
/* post-link info: */
- struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
struct gl_uniform_list *Uniforms;
struct gl_program_parameter_list *Varying;
GLboolean LinkStatus; /**< GL_LINK_STATUS */
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c70fda1e205..1583520391d 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -811,8 +811,9 @@ print_shader_info(const struct gl_shader_program *shProg)
if (shProg->_LinkedShaders[MESA_SHADER_VERTEX])
printf(" vert prog %u\n",
shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program->Id);
- if (shProg->FragmentProgram)
- printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT])
+ printf(" frag prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program->Id);
if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY])
printf(" geom prog %u\n",
shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id);
@@ -967,7 +968,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
{
const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
const struct gl_shader *gs = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY];
- const struct gl_fragment_program *fp = shProg->FragmentProgram;
+ const struct gl_shader *fs = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
if (!shProg->LinkStatus) {
return GL_FALSE;
@@ -999,7 +1000,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
if (gs && !validate_samplers(gs->Program, errMsg)) {
return GL_FALSE;
}
- if (fp && !validate_samplers(&fp->Base, errMsg)) {
+ if (fs && !validate_samplers(fs->Program, errMsg)) {
return GL_FALSE;
}
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index bebf736911f..ccf7efddbde 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -275,8 +275,6 @@ void
_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
-
if (shProg->Uniforms) {
_mesa_free_uniform_list(shProg->Uniforms);
shProg->Uniforms = NULL;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 80502e59af7..bbe90a32e08 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -246,10 +246,12 @@ update_program(struct gl_context *ctx)
* come up, or matter.
*/
- if (fsProg && fsProg->LinkStatus && fsProg->FragmentProgram) {
+ if (fsProg && fsProg->LinkStatus
+ && fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* Use GLSL fragment shader */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- fsProg->FragmentProgram);
+ (struct gl_fragment_program *)
+ fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
}
else if (ctx->FragmentProgram._Enabled) {
/* Use user-defined fragment program */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index ee99e507c97..9f14d8a0d17 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -489,7 +489,7 @@ static void
update_texture_state( struct gl_context *ctx )
{
GLuint unit;
- struct gl_fragment_program *fprog = NULL;
+ struct gl_program *fprog = NULL;
struct gl_program *vprog = NULL;
GLbitfield enabledFragUnits = 0x0;
@@ -505,10 +505,10 @@ update_texture_state( struct gl_context *ctx )
if (ctx->Shader.CurrentFragmentProgram &&
ctx->Shader.CurrentFragmentProgram->LinkStatus) {
- fprog = ctx->Shader.CurrentFragmentProgram->FragmentProgram;
+ fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else if (ctx->FragmentProgram._Enabled) {
- fprog = ctx->FragmentProgram.Current;
+ fprog = &ctx->FragmentProgram.Current->Base;
}
/* FINISHME: Geometry shader texture accesses should also be considered
@@ -544,7 +544,7 @@ update_texture_state( struct gl_context *ctx )
}
if (fprog) {
- enabledFragTargets |= fprog->Base.TexturesUsed[unit];
+ enabledFragTargets |= fprog->TexturesUsed[unit];
}
else {
/* fixed-function fragment program */
@@ -611,7 +611,7 @@ update_texture_state( struct gl_context *ctx )
if (fprog) {
const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
ctx->Texture._EnabledCoordUnits
- = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
+ = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
}
else {
ctx->Texture._EnabledCoordUnits = enabledFragUnits;
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 1e395f7bbed..7bdeec743d6 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -185,7 +185,7 @@ find_uniform_parameter_pos(struct gl_shader_program *shProg, GLint index,
else {
pos = shProg->Uniforms->Uniforms[index].FragPos;
if (pos >= 0) {
- prog = &shProg->FragmentProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else {
pos = shProg->Uniforms->Uniforms[index].GeomPos;
@@ -921,11 +921,12 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
}
}
- if (shProg->FragmentProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* convert uniform location to program parameter index */
GLint index = uniform->FragPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->FragmentProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
index, offset, type, count, elems, values);
}
}
@@ -1069,11 +1070,12 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
}
}
- if (shProg->FragmentProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* convert uniform location to program parameter index */
GLint index = uniform->FragPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
index, offset,
count, rows, cols, transpose, values);
}
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index ddc4ab83364..b9b7b1adbe9 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3300,8 +3300,8 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
linked_prog);
break;
case GL_FRAGMENT_SHADER:
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram,
- (struct gl_fragment_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
linked_prog);
break;
@@ -3427,8 +3427,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
}
}
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
-
if (prog->LinkStatus) {
link_shaders(ctx, prog);
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 56bc7f8fac5..80a593071b4 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5193,8 +5193,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
}
break;
case GL_FRAGMENT_SHADER:
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram,
- (struct gl_fragment_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
linked_prog);
if (!ok) {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index ba9980854d0..4162bb99abf 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1155,8 +1155,8 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData)
destroy_program_variants(st,
shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
- destroy_program_variants(st, (struct gl_program *)
- shProg->FragmentProgram);
+ destroy_program_variants(st,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
destroy_program_variants(st,
shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
}