From b3e8e1cd4c1584f735e35914861ae2e8ae5b6b2b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 2 Jul 2009 11:28:56 +0100 Subject: mesa: ensure UsesFogFragCoord value is set for non-glsl shaders With recent changes to support frontfacing in glsl, it is necessary to ensure that the UsesFogFragCoord value is accurate in all shaders. We were previously not setting it for fixed-function and ARB_fs shaders. --- src/mesa/shader/arbprogparse.c | 7 +++++++ src/mesa/shader/programopt.c | 1 + 2 files changed, 8 insertions(+) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index bb4c5b38d4..f5053d3289 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3922,6 +3922,13 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, if (program->FogOption) program->Base.InputsRead |= FRAG_BIT_FOGC; + + /* XXX: assume that ARB fragment programs don't have access to the + * FrontFacing and PointCoord values stuffed into the fog + * coordinate in GLSL shaders. + */ + if (program->Base.InputsRead & FRAG_BIT_FOGC) + program->UsesFogFragCoord = TRUE; if (program->Base.Instructions) _mesa_free(program->Base.Instructions); diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index f70c75cec8..ac5fe0f691 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -396,6 +396,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) fprog->Base.Instructions = newInst; fprog->Base.NumInstructions = inst - newInst; fprog->Base.InputsRead |= FRAG_BIT_FOGC; + fprog->UsesFogFragCoord = GL_TRUE; /* XXX do this? fprog->FogOption = GL_NONE; */ } -- cgit v1.2.3 From 588c8625714c744047dd1d710d87b1dfcec48db7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 2 Jul 2009 14:43:16 +0100 Subject: mesa: s/TRUE/GL_TRUE Fix compile breakage on Linux. --- src/mesa/shader/arbprogparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index f5053d3289..0d4f13c970 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3928,7 +3928,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, * coordinate in GLSL shaders. */ if (program->Base.InputsRead & FRAG_BIT_FOGC) - program->UsesFogFragCoord = TRUE; + program->UsesFogFragCoord = GL_TRUE; if (program->Base.Instructions) _mesa_free(program->Base.Instructions); -- cgit v1.2.3 From b928d18398330d862ab162f687e224b93932824c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 3 Jul 2009 14:26:26 +0100 Subject: mesa/shaders: fix gl_NormalMatrix state parameters gl_NormalMatrix is the inverse transpose of the modelview matrix, but as every matrix here needs to be transposed, we end up with {MODELVIEW_MATRIX, INVERSE}. --- src/mesa/shader/slang/slang_builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index 83e76b77db..154609c26e 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -85,7 +85,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 }, { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE }, - { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE }, + { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, { NULL, 0, 0 } }; -- cgit v1.2.3