[Intel-gfx] [PATCH] i915: separate the fog term from the specular color term.

Eric Anholt eric at anholt.net
Tue Dec 23 18:39:35 CET 2008


On Tue, 2008-12-23 at 17:19 +0800, Xiang, Haihao wrote:
> Previously fog parameter and specular color are packed into the
> same dword. Note specular color should be packed in BGRA, so if fog
> parameter and specular color all are present, fog parameter will
> dirty the alpha term of specular color. This fixes rendering
> issue when playing 'Yo Frankie' on 915/945.

Nice.  This may also help other programs by avoiding dodgy SSE codegen
code.

> ---
>  src/mesa/drivers/dri/i915/i915_fragprog.c |   22 +++-------------------
>  1 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
> index 8bd761e..4760906 100644
> --- a/src/mesa/drivers/dri/i915/i915_fragprog.c
> +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
> @@ -1105,30 +1105,14 @@ i915ValidateFragmentProgram(struct i915_context *i915)
>        EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4);
>     }
>  
> -   if ((inputsRead & (FRAG_BIT_COL1 | FRAG_BIT_FOGC)) ||
> -       i915->vertex_fog != I915_FOG_NONE) {
> -
> -      if (inputsRead & FRAG_BIT_COL1) {
> -         intel->specoffset = offset / 4;
> -         EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, S4_VFMT_SPEC_FOG, 3);
> -      }
> -      else
> -         EMIT_PAD(3);
> -
> -      if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE)
> -         EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1UB_1F, S4_VFMT_SPEC_FOG, 1);
> -      else
> -         EMIT_PAD(1);
> +   if (inputsRead & FRAG_BIT_COL1) {
> +       intel->specoffset = offset / 4;
> +       EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_4UB_4F_BGRA, S4_VFMT_SPEC_FOG, 4);
>     }
>  
> -   /* XXX this was disabled, but enabling this code helped fix the Glean
> -    * tfragprog1 fog tests.
> -    */
> -#if 1
>     if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE) {
>        EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4);
>     }
> -#endif
>  
>     for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
>        if (inputsRead & FRAG_BIT_TEX(i)) {
-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081223/b0bfa29b/attachment.sig>


More information about the Intel-gfx mailing list