[Mesa-dev] [PATCH] i965: Move PSCDEPTH calculations from draw time to compile time.

Matt Turner mattst88 at gmail.com
Tue Dec 2 10:34:49 PST 2014


On Tue, Dec 2, 2014 at 3:50 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> The "Pixel Shader Computed Depth Mode" value is entirely based on the
> shader program, so we can easily do it at compile time.  This avoids the
> if+switch on every 3DSTATE_WM (Gen7)/3DSTATE_PS_EXTRA (Gen8+) upload,
> and shares a bit more code.
>
> This also simplifies the PMA stall code, making it match the formula
> more closely, and drops a BRW_NEW_FRAGMENT_PROGRAM dependency.  (Note
> that the previous comment was wrong - the code and the documentation
> have != PSCDEPTH_OFF, not ==.)
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_context.h      |  2 ++
>  src/mesa/drivers/dri/i965/brw_defines.h      | 17 +++++++++--------
>  src/mesa/drivers/dri/i965/brw_wm.c           | 21 +++++++++++++++++++++
>  src/mesa/drivers/dri/i965/gen7_wm_state.c    | 22 +++-------------------
>  src/mesa/drivers/dri/i965/gen8_depth_state.c | 12 ++++--------
>  src/mesa/drivers/dri/i965/gen8_ps_state.c    | 18 +-----------------
>  6 files changed, 40 insertions(+), 52 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index ec4b3dd..b4ddc17 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -390,6 +390,8 @@ struct brw_wm_prog_data {
>        /** @} */
>     } binding_table;
>
> +   uint8_t computed_depth_mode;

Presumably we should use the new enum type here (and below in the
function call), and mark the enum definition PACKED.

With that,

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list