diff options
author | Brian Paul <[email protected]> | 2009-07-29 20:07:41 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-07-29 20:07:41 -0600 |
commit | 9d0b8d72d8d704ff4d8e10448b60cbb42f07eecb (patch) | |
tree | 86b13d3647665a05cd3b3237abee8565e25da5b5 /src/mesa/state_tracker | |
parent | 0723cd1b0a8a76808844a2216d709f56fbad88e2 (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/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_shader.c | 17 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 42 |
3 files changed, 14 insertions, 66 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 8b3bb5cc033..ee649be885e 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -139,23 +139,6 @@ find_translated_vp(struct st_context *st, if (fragInputsRead & (1 << inAttr)) { stfp->input_to_slot[inAttr] = numIn; numIn++; - if (((1 << inAttr) & FRAG_BIT_FOGC)) { - /* leave placeholders for the - * extra registers we extract from fog */ - if (stfp->Base.UsesFrontFacing) { - if (!stfp->Base.UsesFogFragCoord) - --stfp->input_to_slot[inAttr]; - else - ++numIn; - } - if (stfp->Base.UsesPointCoord) { - if (!stfp->Base.UsesFrontFacing && - !stfp->Base.UsesFogFragCoord) - stfp->input_to_slot[inAttr] -= 2; - else - ++numIn; - } - } } else { stfp->input_to_slot[inAttr] = UNUSED; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 6380cd6b2a8..210ca82c42e 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -112,27 +112,6 @@ map_register_file_index( { switch( file ) { case TGSI_FILE_INPUT: - if (procType == TGSI_PROCESSOR_FRAGMENT && - index == FRAG_ATTRIB_FOGC) { - if (GET_SWZ(*swizzle, 0) == SWIZZLE_X) { - /* do nothing we're, ok */ - } else if (GET_SWZ(*swizzle, 0) == SWIZZLE_Y) { - /* replace the swizzle with xxxx */ - *swizzle = MAKE_SWIZZLE4(SWIZZLE_X, - SWIZZLE_X, - SWIZZLE_X, - SWIZZLE_X); - /* register after fog */ - return inputMapping[index] + 1; - } else { - *swizzle = MAKE_SWIZZLE4(SWIZZLE_Z, - SWIZZLE_W, - SWIZZLE_Z, - SWIZZLE_W); - /* register after frontface */ - return inputMapping[index] + 2; - } - } /* inputs are mapped according to the user-defined map */ return inputMapping[index]; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 806e0ca8f65..d2da20ae424 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -458,34 +458,20 @@ st_translate_fragment_program(struct st_context *st, stfp->input_semantic_index[slot] = 1; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; - case FRAG_ATTRIB_FOGC: { - int extra_decls = 0; - if (stfp->Base.UsesFogFragCoord) { - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; - stfp->input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - input_flags[slot] = stfp->Base.Base.InputFlags[attr]; - ++extra_decls; - } - if (stfp->Base.UsesFrontFacing) { - GLint idx = slot + extra_decls; - stfp->input_semantic_name[idx] = TGSI_SEMANTIC_FACE; - stfp->input_semantic_index[idx] = 0; - interpMode[idx] = TGSI_INTERPOLATE_CONSTANT; - input_flags[idx] = stfp->Base.Base.InputFlags[attr]; - ++extra_decls; - } - if (stfp->Base.UsesPointCoord) { - GLint idx = slot + extra_decls; - stfp->input_semantic_name[idx] = TGSI_SEMANTIC_GENERIC; - stfp->input_semantic_index[idx] = num_generic++; - interpMode[idx] = TGSI_INTERPOLATE_PERSPECTIVE; - input_flags[idx] = stfp->Base.Base.InputFlags[attr]; - ++extra_decls; - } - fs_num_inputs += extra_decls - 1; - continue; - } + case FRAG_ATTRIB_FOGC: + stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; + stfp->input_semantic_index[slot] = 0; + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; + break; + case FRAG_ATTRIB_FACE: + stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE; + stfp->input_semantic_index[slot] = num_generic++; + interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; + break; + case FRAG_ATTRIB_PNTC: + stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + stfp->input_semantic_index[slot] = num_generic++; + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: |