Signed-off-by: Paul Gofman gofmanp@gmail.com --- v4: - move the logic to stateblock application.
dlls/d3d9/tests/visual.c | 2 +- dlls/wined3d/device.c | 11 ++++++++--- dlls/wined3d/stateblock.c | 17 +++++++++++------ dlls/wined3d/utils.c | 10 ++++++++++ include/wine/wined3d.h | 1 + 5 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 336d08513d..d90f59a498 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -26604,7 +26604,7 @@ static void test_alpha_to_coverage(void) ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); 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); ok(!refcount, "Device has %u references left.\n", refcount); IDirect3D9_Release(d3d); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6f236cd8bf..d03fd20637 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3841,6 +3841,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, unsigned int i, j, count; struct wined3d_blend_state *blend_state; struct wined3d_color color; + BOOL set_blend_state;
TRACE("device %p, stateblock %p.\n", device, stateblock);
@@ -3944,14 +3945,18 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, } }
- if (stateblock->changed.blend_state) + if ((set_blend_state = stateblock->changed.blend_state + || wined3d_stateblock_rs_changed(stateblock, WINED3D_RS_ADAPTIVETESS_Y))) { + blend_state = state->rs[WINED3D_RS_ADAPTIVETESS_Y] == WINED3DFMT_ATOC + ? device->blend_state_atoc_enabled : state->blend_state; + if (wined3d_stateblock_rs_changed(stateblock, WINED3D_RS_BLENDFACTOR)) wined3d_color_from_d3dcolor(&color, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]); else wined3d_device_get_blend_state(device, &color);
- wined3d_device_set_blend_state(device, state->blend_state, &color); + wined3d_device_set_blend_state(device, blend_state, &color); }
for (i = 0; i < ARRAY_SIZE(state->rs); ++i) @@ -3962,7 +3967,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, { wined3d_device_set_render_state(device, i, state->rs[i]); } - else if (!stateblock->changed.blend_state) + else if (!set_blend_state) { blend_state = wined3d_device_get_blend_state(device, &color); wined3d_color_from_d3dcolor(&color, state->rs[i]); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index a65b3bbeee..c15616aa73 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1052,6 +1052,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, struct wined3d_device *device = stateblock->device; struct wined3d_blend_state *blend_state; struct wined3d_color color; + BOOL set_blend_state; unsigned int i; DWORD map;
@@ -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]); }
- if (stateblock->changed.blend_state) + if ((set_blend_state = stateblock->changed.blend_state + || wined3d_stateblock_rs_changed(stateblock, WINED3D_RS_ADAPTIVETESS_Y))) { - if (stateblock->stateblock_state.blend_state) - wined3d_blend_state_incref(stateblock->stateblock_state.blend_state); + blend_state = stateblock->stateblock_state.rs[WINED3D_RS_ADAPTIVETESS_Y] == WINED3DFMT_ATOC + ? device->blend_state_atoc_enabled : stateblock->stateblock_state.blend_state; + + if (blend_state) + wined3d_blend_state_incref(blend_state); if (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_stateblock_rs_changed(stateblock, WINED3D_RS_BLENDFACTOR)) wined3d_color_from_d3dcolor(&color, stateblock->stateblock_state.rs[WINED3D_RS_BLENDFACTOR]); else wined3d_device_get_blend_state(device, &color);
- wined3d_device_set_blend_state(device, stateblock->stateblock_state.blend_state, &color); + wined3d_device_set_blend_state(device, blend_state, &color); }
/* Render states. */ @@ -1167,7 +1172,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock, { wined3d_device_set_render_state(device, rs, stateblock->stateblock_state.rs[rs]); } - else if (!stateblock->changed.blend_state) + else if (!set_blend_state) { blend_state = wined3d_device_get_blend_state(device, &color); wined3d_color_from_d3dcolor(&color, stateblock->stateblock_state.rs[rs]); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index bd239d7659..f696b92214 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -65,6 +65,7 @@ format_index_remap[] = {WINED3DFMT_R16, WINED3D_FORMAT_FOURCC_BASE + 20}, {WINED3DFMT_AL16, WINED3D_FORMAT_FOURCC_BASE + 21}, {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)) @@ -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_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_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_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}, @@ -339,6 +341,7 @@ static const struct wined3d_format_base_flags format_base_flags[] = {WINED3DFMT_INST, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_NULL, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_NVDB, WINED3DFMT_FLAG_EXTENSION}, + {WINED3DFMT_ATOC, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION}, };
@@ -3673,6 +3676,12 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_ 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 * support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with * RENDERTARGET usage. */ @@ -4591,6 +4600,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) FMT_TO_STR(WINED3DFMT_R16); FMT_TO_STR(WINED3DFMT_AL16); FMT_TO_STR(WINED3DFMT_NV12); + FMT_TO_STR(WINED3DFMT_ATOC); #undef FMT_TO_STR default: { diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index d783e64a26..734380b0ad 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -269,6 +269,7 @@ enum wined3d_format_id WINED3DFMT_NV12 = WINEMAKEFOURCC('N','V','1','2'), WINED3DFMT_DF16 = WINEMAKEFOURCC('D','F','1','6'), WINED3DFMT_DF24 = WINEMAKEFOURCC('D','F','2','4'), + WINED3DFMT_ATOC = WINEMAKEFOURCC('A','T','O','C'),
WINED3DFMT_FORCE_DWORD = 0xffffffff };