st/nine: Implement ATOC hack
authorAxel Davy <axel.davy@ens.fr>
Wed, 14 Jan 2015 11:41:16 +0000 (12:41 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:19 +0000 (00:07 +0100)
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.

Reviewed-by: Tiziano Bacocco <tizbac2@gmail.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
include/D3D9/d3d9types.h
src/gallium/state_trackers/nine/adapter9.c
src/gallium/state_trackers/nine/device9.c

index 859c2f56dc4540d273cd3accef22e6f2a3ecef5d..e0f1e720ab174c1f0965d5b673313c9d9337d624 100644 (file)
@@ -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'),
index 84578aca5eac82a29aacee065edb2f8aa953da2f..459aac3695f012cde3f5991a7361cc530655750b 100644 (file)
@@ -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;
 
index 63f9f16586e440d53726c2058c5ea9e65f3d3ae6..46b4c5a6c4433d5d61967e81cd4faebbe1ca5dfc 100644 (file)
@@ -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)) {