summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-20 14:26:12 -0700
committerIan Romanick <[email protected]>2011-10-07 16:39:50 -0700
commit39348bf79fb247eec895c93e52f23afe138be46a (patch)
treeab54c146078a569e77bca80eec86fe251edc42bb
parent010cc547ca8c1fb2107106b0ad0de560780ce9aa (diff)
mesa: Use gl_shader_program::_LinkedShaders instead of GeometryProgram
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-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.c1
-rw-r--r--src/mesa/main/state.c6
-rw-r--r--src/mesa/main/uniforms.c12
-rw-r--r--src/mesa/program/ir_to_mesa.cpp5
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp4
-rw-r--r--src/mesa/state_tracker/st_program.c4
9 files changed, 23 insertions, 22 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b825a63feef..6ef394fe730 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1856,8 +1856,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
break;
case GL_GEOMETRY_SHADER_ARB:
- _mesa_append_uniforms_to_file(sh,
- &shProg[i]->GeometryProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
case GL_FRAGMENT_SHADER:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 71236f9d67c..c7183b39935 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2172,7 +2172,6 @@ struct gl_shader_program
/* post-link info: */
struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
- struct gl_geometry_program *GeometryProgram; /**< Linked geometry 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 d9559baeff7..c70fda1e205 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -813,8 +813,9 @@ print_shader_info(const struct gl_shader_program *shProg)
shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program->Id);
if (shProg->FragmentProgram)
printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
- if (shProg->GeometryProgram)
- printf(" geom prog %u\n", shProg->GeometryProgram->Base.Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY])
+ printf(" geom prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id);
}
@@ -965,7 +966,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
char *errMsg)
{
const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
- const struct gl_geometry_program *gp = shProg->GeometryProgram;
+ const struct gl_shader *gs = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY];
const struct gl_fragment_program *fp = shProg->FragmentProgram;
if (!shProg->LinkStatus) {
@@ -995,7 +996,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
if (vs && !validate_samplers(vs->Program, errMsg)) {
return GL_FALSE;
}
- if (gp && !validate_samplers(&gp->Base, errMsg)) {
+ if (gs && !validate_samplers(gs->Program, errMsg)) {
return GL_FALSE;
}
if (fp && !validate_samplers(&fp->Base, errMsg)) {
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index f5f5e701a41..bebf736911f 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -276,7 +276,6 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
_mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
- _mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL);
if (shProg->Uniforms) {
_mesa_free_uniform_list(shProg->Uniforms);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index ab7250f3fc1..80502e59af7 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -268,10 +268,12 @@ update_program(struct gl_context *ctx)
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
}
- if (gsProg && gsProg->LinkStatus && gsProg->GeometryProgram) {
+ if (gsProg && gsProg->LinkStatus
+ && gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
/* Use GLSL geometry shader */
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current,
- gsProg->GeometryProgram);
+ (struct gl_geometry_program *)
+ gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
} else {
/* No geometry program */
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 28a3beef596..1e395f7bbed 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -190,7 +190,7 @@ find_uniform_parameter_pos(struct gl_shader_program *shProg, GLint index,
else {
pos = shProg->Uniforms->Uniforms[index].GeomPos;
if (pos >= 0) {
- prog = &shProg->GeometryProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program;
}
}
}
@@ -930,11 +930,12 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
}
}
- if (shProg->GeometryProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
/* convert uniform location to program parameter index */
GLint index = uniform->GeomPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->GeometryProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
index, offset, type, count, elems, values);
}
}
@@ -1078,11 +1079,12 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
}
}
- if (shProg->GeometryProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
/* convert uniform location to program parameter index */
GLint index = uniform->GeomPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->GeometryProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->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 652e7067d57..ddc4ab83364 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3306,8 +3306,8 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
linked_prog);
break;
case GL_GEOMETRY_SHADER:
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
- (struct gl_geometry_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
linked_prog);
break;
@@ -3428,7 +3428,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
}
_mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram, 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 01e4d88baf7..56bc7f8fac5 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5202,8 +5202,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
}
break;
case GL_GEOMETRY_SHADER:
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
- (struct gl_geometry_program *)linked_prog);
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
linked_prog);
if (!ok) {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 5211043de04..ba9980854d0 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1157,8 +1157,8 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData)
shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
destroy_program_variants(st, (struct gl_program *)
shProg->FragmentProgram);
- destroy_program_variants(st, (struct gl_program *)
- shProg->GeometryProgram);
+ destroy_program_variants(st,
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
}
break;
case GL_VERTEX_SHADER: