OSDN Git Service

i965/fs: Jump from discard statements to the end of the program when done.
authorEric Anholt <eric@anholt.net>
Mon, 19 Dec 2011 18:53:10 +0000 (10:53 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 16 Mar 2012 18:55:38 +0000 (11:55 -0700)
commit31866308fcf989df992ace28b5b986c3d3770e90
tree28db9a1b780624214ef409b78108f809842dfb3f
parentbddb2edab616d30f7894cfff7071a70d273a848e
i965/fs: Jump from discard statements to the end of the program when done.

From the GLSL 1.30 spec:

     The discard keyword is only allowed within fragment shaders. It
     can be used within a fragment shader to abandon the operation on
     the current fragment. This keyword causes the fragment to be
     discarded and no updates to any buffers will occur. Control flow
     exits the shader, and subsequent implicit or explicit derivatives
     are undefined when this control flow is non-uniform (meaning
     different fragments within the primitive take different control
     paths).

v2: Don't emit the final HALT if no other HALTs were emitted.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_emit.c
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_emit.cpp