[Mesa-dev] [PATCH 20/43] st/nine: Implement AMD alpha to coverage

Ilia Mirkin imirkin at alum.mit.edu
Sat Jan 31 10:20:58 PST 2015


On Fri, Jan 30, 2015 at 3:34 PM, Axel Davy <axel.davy at ens.fr> wrote:
> This D3D hack is supposed to be supported
> by all AMD SM2+ cards. Apps use it without
> checking if they are on AMD.
>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
>  src/gallium/state_trackers/nine/device9.c    | 17 +++++++++++++++--
>  src/gallium/state_trackers/nine/nine_pipe.c  |  2 +-
>  src/gallium/state_trackers/nine/nine_state.c |  3 ++-
>  src/gallium/state_trackers/nine/nine_state.h |  3 ++-
>  4 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index a446c8f..63f9f16 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -2049,6 +2049,9 @@ NineDevice9_ResolveZ( struct NineDevice9 *This )
>      return D3D_OK;
>  }
>
> +#define ALPHA_TO_COVERAGE_ENABLE   MAKEFOURCC('A', '2', 'M', '1')
> +#define ALPHA_TO_COVERAGE_DISABLE  MAKEFOURCC('A', '2', 'M', '0')
> +
>  HRESULT WINAPI
>  NineDevice9_SetRenderState( struct NineDevice9 *This,
>                              D3DRENDERSTATETYPE State,
> @@ -2059,8 +2062,18 @@ NineDevice9_SetRenderState( struct NineDevice9 *This,
>      DBG("This=%p State=%u(%s) Value=%08x\n", This,
>          State, nine_d3drs_to_string(State), Value);
>
> -    if (State == D3DRS_POINTSIZE && Value == RESZ_CODE)
> -        return NineDevice9_ResolveZ(This);
> +    /* Amd hacks (equivalent to GL extensions) */
> +    if (State == D3DRS_POINTSIZE) {
> +        if (Value == RESZ_CODE)
> +            return NineDevice9_ResolveZ(This);
> +
> +        if (Value == ALPHA_TO_COVERAGE_ENABLE ||
> +            Value == ALPHA_TO_COVERAGE_DISABLE) {
> +            state->rs[NINED3DRS_ALPHACOVERAGE] = (Value == ALPHA_TO_COVERAGE_ENABLE);
> +            state->changed.group |= NINE_STATE_BLEND;

Only if it actually changed, no?


More information about the mesa-dev mailing list