[Mesa-dev] [PATCH 01/13] i965: Allow stencil to be used for sampling and as render target

Kenneth Graunke kenneth at whitecape.org
Fri May 9 17:07:44 PDT 2014


On 05/09/2014 01:28 AM, Topi Pohjolainen wrote:
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_surface_formats.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> index 5907dd9..7ffa5c4 100644
> --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
> +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> @@ -221,7 +221,7 @@ const struct surface_format_info surface_formats[] = {
>     SF( Y,  Y,  x, 45,  Y,  Y,  Y,  x,  x, BRW_SURFACEFORMAT_R8_UNORM)
>     SF( Y,  Y,  x,  x,  Y, 60,  Y,  x,  x, BRW_SURFACEFORMAT_R8_SNORM)
>     SF( Y,  x,  x,  x,  Y,  x,  Y,  x,  x, BRW_SURFACEFORMAT_R8_SINT)
> -   SF( Y,  x,  x,  x,  Y,  x,  Y,  x,  x, BRW_SURFACEFORMAT_R8_UINT)
> +   SF(60,  x,  x,  x, 60,  x,  Y,  x,  x, BRW_SURFACEFORMAT_R8_UINT)

This hunk seems wrong to me.  From the G45 PRM, Volume 4, page 133:

| Y |   |   |   | Y |   | Y |   |   | R8_UINT

So, AFAICT, this has been supported since the original Broadwater/G965.

>     SF( Y,  Y,  x,  Y,  Y,  Y,  x,  x,  x, BRW_SURFACEFORMAT_A8_UNORM)
>     SF( Y,  Y,  x,  x,  x,  x,  x,  x,  x, BRW_SURFACEFORMAT_I8_UNORM)
>     SF( Y,  Y,  x,  Y,  x,  x,  x,  x,  x, BRW_SURFACEFORMAT_L8_UNORM)
> @@ -594,9 +594,12 @@ brw_init_surface_formats(struct brw_context *brw)
>         * integer, so we don't need hardware support for blending on it.  Other
>         * than that, GL in general requires alpha blending for render targets,
>         * even though we don't support it for some formats.
> +       * Stencil is also supported as render targer for internal blitting and

render target (typo)

> +       * scaling purposes.
>         */
>        if (gen >= rinfo->render_target &&
> -	  (gen >= rinfo->alpha_blend || is_integer)) {
> +	  (gen >= rinfo->alpha_blend || is_integer ||
> +           format == MESA_FORMAT_S_UINT8)) {
>  	 brw->render_target_format[format] = render;
>  	 brw->format_supported_as_render_target[format] = true;
>        }

I noticed there is already code that does:

   brw->format_supported_as_render_target[MESA_FORMAT_S_UINT8] = true;

Your patch additionally causes:

   brw->render_target_format[MESA_FORMAT_S_UINT8] =
BRW_SURFACEFORMAT_R8_UINT;

which seems reasonable.  However, I don't think any of your patches
actually rely on this fact, since you override the format in
brw_configure_w_tiled.  So, perhaps this patch can be dropped?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140509/e919480f/attachment.sig>


More information about the mesa-dev mailing list