[Mesa-dev] [PATCH 1/7] i965: Base HW depth format setup based on MESA_FORMAT, not bpp.

Chad Versace chad.versace at linux.intel.com
Mon Nov 28 12:08:49 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/23/2011 12:37 PM, Eric Anholt wrote:
> This will make handling new formats (like actually exposing Z32F)
> easier and more reliable.
> ---
>  src/mesa/drivers/dri/i965/brw_misc_state.c  |   53 +++++++++++++++++----------
>  src/mesa/drivers/dri/i965/brw_state.h       |    9 +++--
>  src/mesa/drivers/dri/i965/gen7_misc_state.c |   30 +---------------
>  src/mesa/drivers/dri/i965/gen7_sf_state.c   |    2 +-
>  src/mesa/drivers/dri/intel/intel_context.h  |    1 -
>  5 files changed, 41 insertions(+), 54 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
> index f6a5ad6..e66f361 100644
> --- a/src/mesa/drivers/dri/i965/brw_misc_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
> @@ -197,6 +197,39 @@ const struct brw_tracked_state brw_psp_urb_cbs = {
>     .emit = upload_psp_urb_cbs,
>  };
>  
> +uint32_t
> +brw_depthbuffer_format(struct brw_context *brw)
> +{
> +   struct intel_context *intel = &brw->intel;
> +   struct gl_context *ctx = &intel->ctx;
> +   struct gl_framebuffer *fb = ctx->DrawBuffer;
> +   struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
> +   struct intel_renderbuffer *srb;
> +
> +   if (!drb &&
> +       (srb = intel_get_renderbuffer(fb, BUFFER_STENCIL)) &&
> +       srb->Base.Format == MESA_FORMAT_S8_Z24) {
> +      drb = srb;
> +   }
> +
> +   switch (drb->Base.Format) {
> +   case MESA_FORMAT_Z16:
> +      return BRW_DEPTHFORMAT_D16_UNORM;
> +   case MESA_FORMAT_Z32_FLOAT:
> +      return BRW_DEPTHFORMAT_D32_FLOAT;
> +   case MESA_FORMAT_X8_Z24:
> +   case MESA_FORMAT_S8_Z24:
> +      if (intel_framebuffer_has_hiz(ctx->DrawBuffer))
> +	 return BRW_DEPTHFORMAT_D24_UNORM_X8_UINT;
> +      else
> +	 return BRW_DEPTHFORMAT_D24_UNORM_S8_UINT;

I don't believe the special case for hiz is necessary. This should
work just fine:

> +   case MESA_FORMAT_X8_Z24:
> +	 return BRW_DEPTHFORMAT_D24_UNORM_X8_UINT;
> +   case MESA_FORMAT_S8_Z24:
> +	 return BRW_DEPTHFORMAT_D24_UNORM_S8_UINT;

I assume that you special-cased hiz because the old logic in emit_depthbuffer(),
which reverse-engineered the format from the bpp, did so?

- ----
Chad Versace
chad.versace at linux.intel.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJO0+pPAAoJEAIvNt057x8iMksP/A18jdaxQhgh172LjLT7gOsF
9Tg1lgp5tvXloPjmRT7xiKUjf2aRWWWyc9WWsXgXTrOrEhRrF+VKTpQPPLKXcYl3
ApFh1Z6zg+dFtKs/bc7i6eF+XkPEEvx+usvwE7RXGXrmUHXZe1vPsrCT3KneoIXV
iE36+DnhJxI6p2YUj9vzd0CwjAWms+bvvcWrwt3shwZtx4HuxV8hdhcnKa/uLrcF
GJLoet/I/IcV/4cDhmZnKfOL649Sn0OEi2Lh204G+ClzLAZ01jkPTwQoMz6oAERu
6aH73OxRB7iZYgYcyHj4ri/9nDj/5NgfZUZ1GjEcMRZ9bPk4Hc9hQ+k/AwEuBK2k
x5vXrMd4qBqAE/cURkYsqYG9JfF1CeAn+7OLdhQo/RVS0FlYtz5iQhRCJFqZuHA3
5IqiIXCW5AHflrKtPrUzUt4E4QrR/Zw0Z5Il4x6yUb/dHdg0lORf7Za4TI6aVyzu
ObcRELKrj2s/lfPN/dpXLG2vJ4pgiyyAlyF3QVvBTX66xHsaLeDX60sLo3dR2mZP
Vc4Vb8M4ZG3Pq9IUd52GMZtuOtPtL9HrE4ZjDjWIJdUdKd2vuGrS86ewioeiL9Oa
Y21C0RXZOnUavmr59CBp94j2wLvYmO9px5WLMpQV5s9UwhgkkocXZKAjSeukNQzB
3K14mqoOQbvOFfqw3+pP
=873b
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list