summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-20 13:51:36 -0700
committerIan Romanick <[email protected]>2011-10-07 16:39:50 -0700
commit010cc547ca8c1fb2107106b0ad0de560780ce9aa (patch)
treec653715e4bac2040927dcdbf2f353c6070984855 /src/mesa/main
parent2fae55666e298525fe3b5550aa2a2ebeea437710 (diff)
mesa: Use gl_shader_program::_LinkedShaders instead of VertexProgram
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.c2
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp10
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/shaderapi.c9
-rw-r--r--src/mesa/main/shaderobj.c1
-rw-r--r--src/mesa/main/state.c6
-rw-r--r--src/mesa/main/texstate.c8
-rw-r--r--src/mesa/main/uniforms.c12
8 files changed, 26 insertions, 23 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2532c47de15..b825a63feef 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1852,7 +1852,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
sh = shProg[i]->_LinkedShaders[i];
switch (sh->Type) {
case GL_VERTEX_SHADER:
- _mesa_append_uniforms_to_file(sh, &shProg[i]->VertexProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
case GL_GEOMETRY_SHADER_ARB:
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 7cc17216884..e6451c98b21 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -315,7 +315,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
const GLboolean vertexShader =
(ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus &&
- ctx->Shader.CurrentVertexProgram->VertexProgram);
+ ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]);
const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
GLbitfield fp_inputs = 0x0;
@@ -371,7 +371,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
}
else {
/* calculate from vp->outputs */
- struct gl_vertex_program *vprog;
+ struct gl_program *vprog;
GLbitfield64 vp_outputs;
/* Choose GLSL vertex shader over ARB vertex program. Need this
@@ -379,11 +379,11 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
* validation (see additional comments in state.c).
*/
if (vertexShader)
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
+ vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
else
- vprog = ctx->VertexProgram.Current;
+ vprog = &ctx->VertexProgram.Current->Base;
- vp_outputs = vprog->Base.OutputsWritten;
+ vp_outputs = vprog->OutputsWritten;
/* These get generated in the setup routine regardless of the
* vertex program:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d329bee8006..71236f9d67c 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_vertex_program *VertexProgram; /**< Linked vertex program */
struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
struct gl_geometry_program *GeometryProgram; /**< Linked geometry prog */
struct gl_uniform_list *Uniforms;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 9e0ed9c6977..d9559baeff7 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -808,8 +808,9 @@ print_shader_info(const struct gl_shader_program *shProg)
shProg->Shaders[i]->Name,
shProg->Shaders[i]->SourceChecksum);
}
- if (shProg->VertexProgram)
- printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+ 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->GeometryProgram)
@@ -963,7 +964,7 @@ static GLboolean
validate_shader_program(const struct gl_shader_program *shProg,
char *errMsg)
{
- const struct gl_vertex_program *vp = shProg->VertexProgram;
+ const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
const struct gl_geometry_program *gp = shProg->GeometryProgram;
const struct gl_fragment_program *fp = shProg->FragmentProgram;
@@ -991,7 +992,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
* Check: any two active samplers in the current program object are of
* different types, but refer to the same texture image unit,
*/
- if (vp && !validate_samplers(&vp->Base, errMsg)) {
+ if (vs && !validate_samplers(vs->Program, errMsg)) {
return GL_FALSE;
}
if (gp && !validate_samplers(&gp->Base, errMsg)) {
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 1eba75697f7..f5f5e701a41 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -275,7 +275,6 @@ void
_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
_mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
_mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index fc25515a00c..ab7250f3fc1 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -281,10 +281,12 @@ update_program(struct gl_context *ctx)
* _mesa_get_fixed_func_vertex_program() needs to know active
* fragprog inputs.
*/
- if (vsProg && vsProg->LinkStatus && vsProg->VertexProgram) {
+ if (vsProg && vsProg->LinkStatus
+ && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* Use GLSL vertex shader */
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- vsProg->VertexProgram);
+ (struct gl_vertex_program *)
+ vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
}
else if (ctx->VertexProgram._Enabled) {
/* Use user-defined vertex program */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index e02f16240fd..ee99e507c97 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -490,16 +490,16 @@ update_texture_state( struct gl_context *ctx )
{
GLuint unit;
struct gl_fragment_program *fprog = NULL;
- struct gl_vertex_program *vprog = NULL;
+ struct gl_program *vprog = NULL;
GLbitfield enabledFragUnits = 0x0;
if (ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus) {
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
+ vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
} else if (ctx->VertexProgram._Enabled) {
/* XXX enable this if/when non-shader vertex programs get
* texture fetches:
- vprog = ctx->VertexProgram.Current;
+ vprog = &ctx->VertexProgram.Current->Base;
*/
}
@@ -540,7 +540,7 @@ update_texture_state( struct gl_context *ctx )
* settle on the one with highest priority (see below).
*/
if (vprog) {
- enabledVertTargets |= vprog->Base.TexturesUsed[unit];
+ enabledVertTargets |= vprog->TexturesUsed[unit];
}
if (fprog) {
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 2323819aa43..28a3beef596 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -180,7 +180,7 @@ find_uniform_parameter_pos(struct gl_shader_program *shProg, GLint index,
pos = shProg->Uniforms->Uniforms[index].VertPos;
if (pos >= 0) {
- prog = &shProg->VertexProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
}
else {
pos = shProg->Uniforms->Uniforms[index].FragPos;
@@ -911,11 +911,12 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
/* A uniform var may be used by both a vertex shader and a fragment
* shader. We may need to update one or both shader's uniform here:
*/
- if (shProg->VertexProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* convert uniform location to program parameter index */
GLint index = uniform->VertPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->VertexProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
index, offset, type, count, elems, values);
}
}
@@ -1056,11 +1057,12 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
uniform = &shProg->Uniforms->Uniforms[location];
- if (shProg->VertexProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* convert uniform location to program parameter index */
GLint index = uniform->VertPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
index, offset,
count, rows, cols, transpose, values);
}