[Mesa-dev] [PATCH 21/43] st/nine: Implement ATOC hack

Axel Davy axel.davy at ens.fr
Fri Jan 30 12:34:20 PST 2015


ATOC is an hack for Alpha to coverage
that is supported by NV and Intel.

You need to check the support for it
with CheckDeviceFormat.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 include/D3D9/d3d9types.h                   | 1 +
 src/gallium/state_trackers/nine/adapter9.c | 4 ++++
 src/gallium/state_trackers/nine/device9.c  | 8 ++++++++
 3 files changed, 13 insertions(+)

diff --git a/include/D3D9/d3d9types.h b/include/D3D9/d3d9types.h
index 859c2f5..e0f1e72 100644
--- a/include/D3D9/d3d9types.h
+++ b/include/D3D9/d3d9types.h
@@ -651,6 +651,7 @@ typedef enum _D3DFORMAT {
     D3DFMT_BINARYBUFFER = 199,
     D3DFMT_ATI1 = MAKEFOURCC('A', 'T', 'I', '1'),
     D3DFMT_ATI2 = MAKEFOURCC('A', 'T', 'I', '2'),
+    D3DFMT_ATOC = MAKEFOURCC('A', 'T', 'O', 'C'),
     D3DFMT_DF16 = MAKEFOURCC('D', 'F', '1', '6'),
     D3DFMT_DF24 = MAKEFOURCC('D', 'F', '2', '4'),
     D3DFMT_INTZ = MAKEFOURCC('I', 'N', 'T', 'Z'),
diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
index 84578ac..459aac3 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -307,6 +307,10 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
         return screen->get_param(screen, PIPE_CAP_MULTISAMPLE_Z_RESOLVE) ?
                D3D_OK : D3DERR_NOTAVAILABLE;
 
+    /* ATOC hack */
+    if (CheckFormat == D3DFMT_ATOC && RType == D3DRTYPE_SURFACE)
+        return D3D_OK;
+
     if (Usage & D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
         bind |= PIPE_BIND_BLENDABLE;
 
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 63f9f16..46b4c5a 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2075,6 +2075,14 @@ NineDevice9_SetRenderState( struct NineDevice9 *This,
         }
     }
 
+    /* NV hack */
+    if (State == D3DRS_ADAPTIVETESS_Y &&
+        (Value == D3DFMT_ATOC || (Value == D3DFMT_UNKNOWN && state->rs[NINED3DRS_ALPHACOVERAGE]))) {
+            state->rs[NINED3DRS_ALPHACOVERAGE] = (Value == D3DFMT_ATOC);
+            state->changed.group |= NINE_STATE_BLEND;
+            return D3D_OK;
+    }
+
     user_assert(State < Elements(state->rs), D3DERR_INVALIDCALL);
 
     if (likely(state->rs[State] != Value) || unlikely(This->is_recording)) {
-- 
2.1.0



More information about the mesa-dev mailing list