Commit 2a913ecb authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wined3d: Support NVIDIA alpha to coverage state.

parent c7363216
...@@ -26604,7 +26604,7 @@ static void test_alpha_to_coverage(void) ...@@ -26604,7 +26604,7 @@ static void test_alpha_to_coverage(void)
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
if (!adapter_is_amd(&identifier)) if (!adapter_is_amd(&identifier))
{ {
skip("Alpha to coverage is not supported.\n"); win_skip("Alpha to coverage is not supported.\n");
refcount = IDirect3DDevice9_Release(device); refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D9_Release(d3d); IDirect3D9_Release(d3d);
...@@ -3842,6 +3842,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3842,6 +3842,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
struct wined3d_blend_state *blend_state; struct wined3d_blend_state *blend_state;
struct wined3d_color colour; struct wined3d_color colour;
unsigned int i, j, count; unsigned int i, j, count;
BOOL set_blend_state;
TRACE("device %p, stateblock %p.\n", device, stateblock); TRACE("device %p, stateblock %p.\n", device, stateblock);
...@@ -3945,14 +3946,18 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3945,14 +3946,18 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
} }
} }
if (changed->blend_state) if ((set_blend_state = changed->blend_state
|| wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_ADAPTIVETESS_Y)))
{ {
blend_state = state->rs[WINED3D_RS_ADAPTIVETESS_Y] == WINED3DFMT_ATOC
? device->blend_state_atoc_enabled : state->blend_state;
if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR)) if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR))
wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]); wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]);
else else
wined3d_device_get_blend_state(device, &colour); wined3d_device_get_blend_state(device, &colour);
wined3d_device_set_blend_state(device, state->blend_state, &colour); wined3d_device_set_blend_state(device, blend_state, &colour);
} }
for (i = 0; i < ARRAY_SIZE(state->rs); ++i) for (i = 0; i < ARRAY_SIZE(state->rs); ++i)
...@@ -3966,7 +3971,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3966,7 +3971,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
continue; continue;
} }
if (!changed->blend_state) if (!set_blend_state)
{ {
blend_state = wined3d_device_get_blend_state(device, &colour); blend_state = wined3d_device_get_blend_state(device, &colour);
wined3d_color_from_d3dcolor(&colour, state->rs[i]); wined3d_color_from_d3dcolor(&colour, state->rs[i]);
......
...@@ -1052,6 +1052,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, ...@@ -1052,6 +1052,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
struct wined3d_device *device = stateblock->device; struct wined3d_device *device = stateblock->device;
struct wined3d_blend_state *blend_state; struct wined3d_blend_state *blend_state;
struct wined3d_color colour; struct wined3d_color colour;
BOOL set_blend_state;
unsigned int i; unsigned int i;
DWORD map; DWORD map;
...@@ -1140,21 +1141,25 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, ...@@ -1140,21 +1141,25 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
wined3d_device_set_ps_consts_b(device, idx, 1, &stateblock->stateblock_state.ps_consts_b[idx]); wined3d_device_set_ps_consts_b(device, idx, 1, &stateblock->stateblock_state.ps_consts_b[idx]);
} }
if (stateblock->changed.blend_state) if ((set_blend_state = stateblock->changed.blend_state
|| wined3d_bitmap_is_set(stateblock->changed.renderState, WINED3D_RS_ADAPTIVETESS_Y)))
{ {
if (stateblock->stateblock_state.blend_state) blend_state = stateblock->stateblock_state.rs[WINED3D_RS_ADAPTIVETESS_Y] == WINED3DFMT_ATOC
wined3d_blend_state_incref(stateblock->stateblock_state.blend_state); ? device->blend_state_atoc_enabled : stateblock->stateblock_state.blend_state;
if (blend_state)
wined3d_blend_state_incref(blend_state);
if (state->blend_state) if (state->blend_state)
wined3d_blend_state_decref(state->blend_state); wined3d_blend_state_decref(state->blend_state);
state->blend_state = stateblock->stateblock_state.blend_state; state->blend_state = blend_state;
if (wined3d_bitmap_is_set(stateblock->changed.renderState, WINED3D_RS_BLENDFACTOR)) if (wined3d_bitmap_is_set(stateblock->changed.renderState, WINED3D_RS_BLENDFACTOR))
wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]); wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]);
else else
wined3d_device_get_blend_state(device, &colour); wined3d_device_get_blend_state(device, &colour);
wined3d_device_set_blend_state(device, stateblock->stateblock_state.blend_state, &colour); wined3d_device_set_blend_state(device, blend_state, &colour);
} }
/* Render states. */ /* Render states. */
...@@ -1169,7 +1174,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, ...@@ -1169,7 +1174,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
continue; continue;
} }
if (!stateblock->changed.blend_state) if (!set_blend_state)
{ {
blend_state = wined3d_device_get_blend_state(device, &colour); blend_state = wined3d_device_get_blend_state(device, &colour);
wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[rs]); wined3d_color_from_d3dcolor(&colour, stateblock->stateblock_state.rs[rs]);
......
...@@ -65,6 +65,7 @@ format_index_remap[] = ...@@ -65,6 +65,7 @@ format_index_remap[] =
{WINED3DFMT_R16, WINED3D_FORMAT_FOURCC_BASE + 20}, {WINED3DFMT_R16, WINED3D_FORMAT_FOURCC_BASE + 20},
{WINED3DFMT_AL16, WINED3D_FORMAT_FOURCC_BASE + 21}, {WINED3DFMT_AL16, WINED3D_FORMAT_FOURCC_BASE + 21},
{WINED3DFMT_NV12, WINED3D_FORMAT_FOURCC_BASE + 22}, {WINED3DFMT_NV12, WINED3D_FORMAT_FOURCC_BASE + 22},
{WINED3DFMT_ATOC, WINED3D_FORMAT_FOURCC_BASE + 23},
}; };
#define WINED3D_FORMAT_COUNT (WINED3D_FORMAT_FOURCC_BASE + ARRAY_SIZE(format_index_remap)) #define WINED3D_FORMAT_COUNT (WINED3D_FORMAT_FOURCC_BASE + ARRAY_SIZE(format_index_remap))
...@@ -135,6 +136,7 @@ static const struct wined3d_format_channels formats[] = ...@@ -135,6 +136,7 @@ static const struct wined3d_format_channels formats[] =
{WINED3DFMT_ATI1N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_ATI1N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
{WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
{WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{WINED3DFMT_ATOC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{WINED3DFMT_INTZ, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8}, {WINED3DFMT_INTZ, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
{WINED3DFMT_RESZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {WINED3DFMT_RESZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
...@@ -339,6 +341,7 @@ static const struct wined3d_format_base_flags format_base_flags[] = ...@@ -339,6 +341,7 @@ static const struct wined3d_format_base_flags format_base_flags[] =
{WINED3DFMT_INST, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_INST, WINED3DFMT_FLAG_EXTENSION},
{WINED3DFMT_NULL, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_NULL, WINED3DFMT_FLAG_EXTENSION},
{WINED3DFMT_NVDB, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_NVDB, WINED3DFMT_FLAG_EXTENSION},
{WINED3DFMT_ATOC, WINED3DFMT_FLAG_EXTENSION},
{WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION},
}; };
...@@ -3673,6 +3676,12 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_ ...@@ -3673,6 +3676,12 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
format_set_flag(&format->f, WINED3DFMT_FLAG_TEXTURE); format_set_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
} }
if (gl_info->supported[ARB_MULTISAMPLE])
{
format = get_format_gl_internal(adapter, WINED3DFMT_ATOC);
format_set_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
}
/* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ /* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ
* support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with * support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with
* RENDERTARGET usage. */ * RENDERTARGET usage. */
...@@ -4591,6 +4600,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) ...@@ -4591,6 +4600,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id)
FMT_TO_STR(WINED3DFMT_R16); FMT_TO_STR(WINED3DFMT_R16);
FMT_TO_STR(WINED3DFMT_AL16); FMT_TO_STR(WINED3DFMT_AL16);
FMT_TO_STR(WINED3DFMT_NV12); FMT_TO_STR(WINED3DFMT_NV12);
FMT_TO_STR(WINED3DFMT_ATOC);
#undef FMT_TO_STR #undef FMT_TO_STR
default: default:
{ {
......
...@@ -269,6 +269,7 @@ enum wined3d_format_id ...@@ -269,6 +269,7 @@ enum wined3d_format_id
WINED3DFMT_NV12 = WINEMAKEFOURCC('N','V','1','2'), WINED3DFMT_NV12 = WINEMAKEFOURCC('N','V','1','2'),
WINED3DFMT_DF16 = WINEMAKEFOURCC('D','F','1','6'), WINED3DFMT_DF16 = WINEMAKEFOURCC('D','F','1','6'),
WINED3DFMT_DF24 = WINEMAKEFOURCC('D','F','2','4'), WINED3DFMT_DF24 = WINEMAKEFOURCC('D','F','2','4'),
WINED3DFMT_ATOC = WINEMAKEFOURCC('A','T','O','C'),
WINED3DFMT_FORCE_DWORD = 0xffffffff WINED3DFMT_FORCE_DWORD = 0xffffffff
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment