summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-07-29 20:07:41 -0600
committerBrian Paul <brianp@vmware.com>2009-07-29 20:07:41 -0600
commit9d0b8d72d8d704ff4d8e10448b60cbb42f07eecb (patch)
tree86b13d3647665a05cd3b3237abee8565e25da5b5 /src/mesa/shader
parent0723cd1b0a8a76808844a2216d709f56fbad88e2 (diff)
mesa: add new FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC fragment program inputs
Previously, the FOGC attribute contained the fragment fog coord, front/back- face flag and the gl_PointCoord.xy values. Now each of those things are separate fragment program attributes. This simplifies quite a few things in Mesa and gallium. Need to test i965 driver and fix up point coord handling in the gallium/draw module...
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/arbprogparse.c7
-rw-r--r--src/mesa/shader/programopt.c1
-rw-r--r--src/mesa/shader/slang/slang_codegen.c4
-rw-r--r--src/mesa/shader/slang/slang_link.c14
4 files changed, 2 insertions, 24 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index bc65aba39a..f428ee541b 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -3974,13 +3974,6 @@ _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 = GL_TRUE;
-
if (program->Base.Instructions)
_mesa_free(program->Base.Instructions);
program->Base.Instructions = ap.Base.Instructions;
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index ac5fe0f691..f70c75cec8 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -396,7 +396,6 @@ _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; */
}
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 2b7e781f98..4fe68eafa7 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -381,8 +381,8 @@ _slang_input_index(const char *name, GLenum target, GLuint *swizzleOut)
{ "gl_TexCoord", FRAG_ATTRIB_TEX0, SWIZZLE_NOOP },
/* note: we're packing several quantities into the fogcoord vector */
{ "gl_FogFragCoord", FRAG_ATTRIB_FOGC, SWIZZLE_XXXX },
- { "gl_FrontFacing", FRAG_ATTRIB_FOGC, SWIZZLE_YYYY }, /*XXX*/
- { "gl_PointCoord", FRAG_ATTRIB_FOGC, SWIZZLE_ZWWW },
+ { "gl_PointCoord", FRAG_ATTRIB_PNTC, SWIZZLE_XYZW },
+ { "gl_FrontFacing", FRAG_ATTRIB_FACE, SWIZZLE_XXXX },
{ NULL, 0, SWIZZLE_NOOP }
};
GLuint i;
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index f6032d1e9a..6c19fc895b 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -484,20 +484,6 @@ _slang_update_inputs_outputs(struct gl_program *prog)
for (j = 0; j < numSrc; j++) {
if (inst->SrcReg[j].File == PROGRAM_INPUT) {
prog->InputsRead |= 1 << inst->SrcReg[j].Index;
- if (prog->Target == GL_FRAGMENT_PROGRAM_ARB &&
- inst->SrcReg[j].Index == FRAG_ATTRIB_FOGC) {
- /* The fragment shader FOGC input is used for fog,
- * front-facing and sprite/point coord.
- */
- struct gl_fragment_program *fp = fragment_program(prog);
- const GLint swz = GET_SWZ(inst->SrcReg[j].Swizzle, 0);
- if (swz == SWIZZLE_X)
- fp->UsesFogFragCoord = GL_TRUE;
- else if (swz == SWIZZLE_Y)
- fp->UsesFrontFacing = GL_TRUE;
- else if (swz == SWIZZLE_Z || swz == SWIZZLE_W)
- fp->UsesPointCoord = GL_TRUE;
- }
}
else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) {
maxAddrReg = MAX2(maxAddrReg, (GLuint) (inst->SrcReg[j].Index + 1));