OSDN Git Service

swrast: Fix fixed-function fragment processing
authorChad Versace <chad.versace@linux.intel.com>
Thu, 26 Jan 2012 03:38:10 +0000 (19:38 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 7 Feb 2012 18:20:07 +0000 (10:20 -0800)
commit20da01fecdd2379bd6df1407d1c344aa8ddd5c45
treeb320b89d4730c00171a20d698abfaf6d6d5ddb08
parent203ef2a12b8e8fa520decf9e9024329f4dc96996
swrast: Fix fixed-function fragment processing

On i965, _mesa_ir_link_shader is never called. As a consequence, the
current fragment program (ctx->FragmentProgram->_Current) exists but is
invalid because it has no instructions. Yet swrast continued to attempt to
use the empty program.

To avoid using the empty program, this patch 1) defines a new function,
_swrast_use_fragment_program, which checks if the current fragment program
exists and differs from the fixed function fragment program, and, when
appropriate, 2) replaces checks of the form
    if (ctx->FragmentProgram->_Current == NULL)
with
    if (_swrast_use_fragment_program(ctx))

Fixes the following oglconform regressions on i965/gen6:
    api-fogcoord(basic.allCases.log)
    api-mtexcoord(basic.allCases.log)
    api-seccolor(basic.allCases.log)
    api-texcoord(basic.allCases.log)
    blend-separate(basic.allCases)
    colorsum(basic.allCases.log)

The tests were ran with the GLXFBConfig:
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x021 24 tc  0  32  0 r  y .   8  8  8  8 .  .  0 24 8  0  0  0  0  0 0 None

(Note: I originally believed that the hunk in
_swrast_update_fragment_program was unnecessary. But it is required to fix
blend-separate.)

Note: This is a candidate for the 8.0 branch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43327
Reveiwed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 1c0f1dd42a50464eeb81de4aad8eecf24b3d6c89)
src/mesa/swrast/s_aaline.c
src/mesa/swrast/s_aalinetemp.h
src/mesa/swrast/s_aatriangle.c
src/mesa/swrast/s_context.c
src/mesa/swrast/s_fragprog.c
src/mesa/swrast/s_fragprog.h
src/mesa/swrast/s_lines.c
src/mesa/swrast/s_span.c
src/mesa/swrast/s_triangle.c