diff options
author | Brian Paul <[email protected]> | 2009-08-12 20:32:41 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-12 20:32:41 -0600 |
commit | f3b215cba2bca92d6582cc0c34702b73289f909c (patch) | |
tree | b7a534f0adae00b68641b005c0db81227cf5aa8e /src/mesa/shader | |
parent | fdfb0d4b0e04bff2f3dbae2d1f8e3765fb4b0dce (diff) | |
parent | f7618f4f37d42461b1a6feaa392935d1ae703873 (diff) |
Merge branch 'new-frag-attribs'
This branch introduces new FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC fragment
program inputs for GLSL gl_FrontFacing and gl_PointCoord. Before, these
attributes were packed with the FOG attribute. That made things
complicated elsewhere.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 7 | ||||
-rw-r--r-- | src/mesa/shader/programopt.c | 1 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_builtin.c | 5 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 14 |
4 files changed, 3 insertions, 24 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 0f530ebb8a5..381445c0e84 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3975,13 +3975,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 ac5fe0f691f..f70c75cec8e 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_builtin.c b/src/mesa/shader/slang/slang_builtin.c index 5721e9b8f10..9ed8e3ecb39 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -752,8 +752,9 @@ static const struct input_info fragInputs[] = { { "gl_TexCoord", FRAG_ATTRIB_TEX0, GL_FLOAT_VEC4, SWIZZLE_NOOP }, /* note: we're packing several quantities into the fogcoord vector */ { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX }, - { "gl_FrontFacing", FRAG_ATTRIB_FOGC, GL_BOOL, SWIZZLE_YYYY }, /*XXX*/ - { "gl_PointCoord", FRAG_ATTRIB_FOGC, GL_FLOAT_VEC2, SWIZZLE_ZWWW }, + { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX }, + { "gl_FrontFacing", FRAG_ATTRIB_FACE, GL_FLOAT, SWIZZLE_XXXX }, + { "gl_PointCoord", FRAG_ATTRIB_PNTC, GL_FLOAT_VEC2, SWIZZLE_XYZW }, { NULL, 0, SWIZZLE_NOOP } }; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index d1e91d306d9..c5c94a65a24 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -504,20 +504,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)); |