summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-20 15:00:36 -0700
committerIan Romanick <[email protected]>2011-10-07 16:39:50 -0700
commitde772c402215b956ab3aa0875330fc1bf7cdf95b (patch)
tree218fb8b814d144ceccb08a0f7ebe6640fa8bf675 /src/mesa/main
parent39348bf79fb247eec895c93e52f23afe138be46a (diff)
mesa: Use gl_shader_program::_LinkedShaders instead of FragmentProgram
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main')
-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
7 files changed, 22 insertions, 21 deletions
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);
}