summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_validate.c10
-rw-r--r--src/mesa/main/context.c30
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp8
-rw-r--r--src/mesa/main/mtypes.h7
-rw-r--r--src/mesa/main/shaderapi.c12
-rw-r--r--src/mesa/main/state.c8
-rw-r--r--src/mesa/main/texstate.c18
-rw-r--r--src/mesa/main/transformfeedback.c8
8 files changed, 50 insertions, 51 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 96b178905cc..6945584433e 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -128,7 +128,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
case API_OPENGL_CORE:
{
const struct gl_shader_program *vsProg =
- ctx->Shader.CurrentVertexProgram;
+ ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus);
GLboolean haveVertexProgram = ctx->VertexProgram._Enabled;
if (haveVertexShader || haveVertexProgram) {
@@ -269,9 +269,9 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
* TRIANGLES_ADJACENCY_ARB or TRIANGLE_STRIP_ADJACENCY_ARB.
*
*/
- if (ctx->Shader.CurrentGeometryProgram) {
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) {
const GLenum geom_mode =
- ctx->Shader.CurrentGeometryProgram->Geom.InputType;
+ ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType;
switch (mode) {
case GL_POINTS:
valid_enum = (geom_mode == GL_POINTS);
@@ -330,8 +330,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
if (_mesa_is_xfb_active_and_unpaused(ctx)) {
GLboolean pass = GL_TRUE;
- if(ctx->Shader.CurrentGeometryProgram) {
- switch (ctx->Shader.CurrentGeometryProgram->Geom.OutputType) {
+ if(ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) {
+ switch (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.OutputType) {
case GL_POINTS:
pass = ctx->TransformFeedback.Mode == GL_POINTS;
break;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 807812955d1..28ce6a1bc5c 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1765,10 +1765,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
if (ctx->NewState)
_mesa_update_state(ctx);
- if (ctx->Shader.CurrentVertexProgram) {
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]) {
vert_from_glsl_shader = true;
- if (!ctx->Shader.CurrentVertexProgram->LinkStatus) {
+ if (!ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(shader not linked)", where);
return GL_FALSE;
@@ -1777,19 +1777,19 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
{
char errMsg[100];
if (!_mesa_validate_shader_program(ctx,
- ctx->Shader.CurrentVertexProgram,
+ ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX],
errMsg)) {
_mesa_warning(ctx, "Shader program %u is invalid: %s",
- ctx->Shader.CurrentVertexProgram->Name, errMsg);
+ ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->Name, errMsg);
}
}
#endif
}
- if (ctx->Shader.CurrentGeometryProgram) {
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) {
geom_from_glsl_shader = true;
- if (!ctx->Shader.CurrentGeometryProgram->LinkStatus) {
+ if (!ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(shader not linked)", where);
return GL_FALSE;
@@ -1798,19 +1798,19 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
{
char errMsg[100];
if (!_mesa_validate_shader_program(ctx,
- ctx->Shader.CurrentGeometryProgram,
+ ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY],
errMsg)) {
_mesa_warning(ctx, "Shader program %u is invalid: %s",
- ctx->Shader.CurrentGeometryProgram->Name, errMsg);
+ ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Name, errMsg);
}
}
#endif
}
- if (ctx->Shader.CurrentFragmentProgram) {
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]) {
frag_from_glsl_shader = true;
- if (!ctx->Shader.CurrentFragmentProgram->LinkStatus) {
+ if (!ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(shader not linked)", where);
return GL_FALSE;
@@ -1819,10 +1819,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
{
char errMsg[100];
if (!_mesa_validate_shader_program(ctx,
- ctx->Shader.CurrentFragmentProgram,
+ ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT],
errMsg)) {
_mesa_warning(ctx, "Shader program %u is invalid: %s",
- ctx->Shader.CurrentFragmentProgram->Name, errMsg);
+ ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]->Name, errMsg);
}
}
#endif
@@ -1875,9 +1875,9 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
struct gl_shader_program *shProg[MESA_SHADER_STAGES];
gl_shader_stage i;
- shProg[MESA_SHADER_VERTEX] = ctx->Shader.CurrentVertexProgram;
- shProg[MESA_SHADER_GEOMETRY] = ctx->Shader.CurrentGeometryProgram;
- shProg[MESA_SHADER_FRAGMENT] = ctx->Shader.CurrentFragmentProgram;
+ shProg[MESA_SHADER_VERTEX] = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
+ shProg[MESA_SHADER_GEOMETRY] = ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY];
+ shProg[MESA_SHADER_FRAGMENT] = ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT];
for (i = 0; i < MESA_SHADER_STAGES; i++) {
if (shProg[i] == NULL || shProg[i]->_Used
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 8523edf41b6..cad67aa8513 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -317,9 +317,9 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
{
/* _NEW_PROGRAM */
const GLboolean vertexShader =
- (ctx->Shader.CurrentVertexProgram &&
- ctx->Shader.CurrentVertexProgram->LinkStatus &&
- ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]);
+ (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] &&
+ ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus &&
+ ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]);
const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
GLbitfield fp_inputs = 0x0;
@@ -383,7 +383,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
* validation (see additional comments in state.c).
*/
if (vertexShader)
- vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
+ vprog = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
else
vprog = &ctx->VertexProgram.Current->Base;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c396609203d..3dd967884c4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1815,7 +1815,8 @@ struct gl_transform_feedback_object
/**
* The shader program active when BeginTransformFeedback() was called.
- * When active and unpaused, this equals ctx->Shader.CurrentVertexProgram.
+ * When active and unpaused, this equals
+ * ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX].
*/
struct gl_shader_program *shader_program;
@@ -2714,9 +2715,7 @@ struct gl_shader_state
* GL_EXT_separate_shader_objects is not supported, each of these must point
* to \c NULL or to the same program.
*/
- struct gl_shader_program *CurrentVertexProgram;
- struct gl_shader_program *CurrentGeometryProgram;
- struct gl_shader_program *CurrentFragmentProgram;
+ struct gl_shader_program *CurrentProgram[MESA_SHADER_STAGES];
struct gl_shader_program *_CurrentFragmentProgram;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 2ab0a0cfde2..d57748c93ad 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -130,10 +130,10 @@ _mesa_init_shader_state(struct gl_context *ctx)
void
_mesa_free_shader_state(struct gl_context *ctx)
{
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentVertexProgram, NULL);
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentGeometryProgram,
+ _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX], NULL);
+ _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY],
NULL);
- _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentFragmentProgram,
+ _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT],
NULL);
_mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram,
NULL);
@@ -949,21 +949,21 @@ use_shader_program(struct gl_context *ctx, GLenum type,
switch (type) {
case GL_VERTEX_SHADER:
- target = &ctx->Shader.CurrentVertexProgram;
+ target = &ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
if ((shProg == NULL)
|| (shProg->_LinkedShaders[MESA_SHADER_VERTEX] == NULL)) {
shProg = NULL;
}
break;
case GL_GEOMETRY_SHADER_ARB:
- target = &ctx->Shader.CurrentGeometryProgram;
+ target = &ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY];
if ((shProg == NULL)
|| (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] == NULL)) {
shProg = NULL;
}
break;
case GL_FRAGMENT_SHADER:
- target = &ctx->Shader.CurrentFragmentProgram;
+ target = &ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT];
if ((shProg == NULL)
|| (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)) {
shProg = NULL;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 87f6553a5f9..bde548f68d8 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -94,9 +94,9 @@ update_program_enables(struct gl_context *ctx)
static GLbitfield
update_program(struct gl_context *ctx)
{
- const struct gl_shader_program *vsProg = ctx->Shader.CurrentVertexProgram;
- const struct gl_shader_program *gsProg = ctx->Shader.CurrentGeometryProgram;
- struct gl_shader_program *fsProg = ctx->Shader.CurrentFragmentProgram;
+ const struct gl_shader_program *vsProg = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
+ const struct gl_shader_program *gsProg = ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY];
+ struct gl_shader_program *fsProg = ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT];
const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current;
@@ -307,7 +307,7 @@ update_multisample(struct gl_context *ctx)
static void
update_twoside(struct gl_context *ctx)
{
- if (ctx->Shader.CurrentVertexProgram ||
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] ||
ctx->VertexProgram._Enabled) {
ctx->VertexProgram._TwoSideEnabled = ctx->VertexProgram.TwoSideEnabled;
} else {
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 7720965a8c8..b6da76d4213 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -532,19 +532,19 @@ update_texture_state( struct gl_context *ctx )
struct gl_program *gprog = NULL;
GLbitfield enabledFragUnits = 0x0;
- if (ctx->Shader.CurrentVertexProgram &&
- ctx->Shader.CurrentVertexProgram->LinkStatus) {
- vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] &&
+ ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus) {
+ vprog = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
}
- if (ctx->Shader.CurrentGeometryProgram &&
- ctx->Shader.CurrentGeometryProgram->LinkStatus) {
- gprog = ctx->Shader.CurrentGeometryProgram->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program;
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY] &&
+ ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->LinkStatus) {
+ gprog = ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program;
}
- if (ctx->Shader.CurrentFragmentProgram &&
- ctx->Shader.CurrentFragmentProgram->LinkStatus) {
- fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] &&
+ ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]->LinkStatus) {
+ fprog = ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else if (ctx->FragmentProgram._Enabled) {
fprog = &ctx->FragmentProgram.Current->Base;
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 76d213b16aa..9eaa698ab95 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -387,13 +387,13 @@ _mesa_BeginTransformFeedback(GLenum mode)
obj = ctx->TransformFeedback.CurrentObject;
- if (ctx->Shader.CurrentVertexProgram == NULL) {
+ if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] == NULL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginTransformFeedback(no program active)");
return;
}
- info = &ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback;
+ info = &ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->LinkedTransformFeedback;
if (info->NumOutputs == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -451,7 +451,7 @@ _mesa_BeginTransformFeedback(GLenum mode)
obj->GlesRemainingPrims = max_vertices / vertices_per_prim;
}
- obj->shader_program = ctx->Shader.CurrentVertexProgram;
+ obj->shader_program = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
assert(ctx->Driver.BeginTransformFeedback);
ctx->Driver.BeginTransformFeedback(ctx, mode, obj);
@@ -993,7 +993,7 @@ _mesa_ResumeTransformFeedback(void)
* the program object being used by the current transform feedback object
* is not active."
*/
- if (obj->shader_program != ctx->Shader.CurrentVertexProgram) {
+ if (obj->shader_program != ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glResumeTransformFeedback(wrong vertex program bound)");
return;