A few more patches after !9520.
From: Matteo Bruni mbruni@codeweavers.com
--- dlls/ddraw/tests/ddraw4.c | 46 +++++++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw7.c | 46 +++++++++++++++++++++++++++++---------- 2 files changed, 70 insertions(+), 22 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e9a964d86d..72e67705a56 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -6436,21 +6436,19 @@ static void test_block_formats_creation(void) {MAKEFOURCC('D','X','T','5'), "D3DFMT_DXT5", SUPPORT_DXT5, 4, 4, 16, TRUE, FALSE}, {MAKEFOURCC('Y','U','Y','2'), "D3DFMT_YUY2", SUPPORT_YUY2, 2, 1, 4, FALSE, TRUE }, {MAKEFOURCC('U','Y','V','Y'), "D3DFMT_UYVY", SUPPORT_UYVY, 2, 1, 4, FALSE, TRUE }, + {MAKEFOURCC('I','V','5','0'), "D3DFMT_UYVY", SUPPORT_UYVY, 2, 1, 4, FALSE, TRUE }, + {MAKEFOURCC('N','O','P','E'), "D3DFMT_UYVY", SUPPORT_UYVY, 2, 1, 4, FALSE, TRUE }, }; static const struct { DWORD caps, caps2; const char *name; BOOL overlay; + BOOL allow_nondxt; + BOOL allow_all; } types[] = { - /* DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY fails to create any fourcc - * surface with DDERR_INVALIDPIXELFORMAT. Don't care about it for now. - * - * Nvidia returns E_FAIL on DXTN DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY. - * Other hw / drivers successfully create those surfaces. Ignore them, this - * suggests that no game uses this, otherwise Nvidia would support it. */ { DDSCAPS_VIDEOMEMORY | DDSCAPS_TEXTURE, 0, "videomemory texture", FALSE @@ -6466,7 +6464,22 @@ static void test_block_formats_creation(void) { DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, "managed texture", FALSE - } + }, + { + DDSCAPS_OFFSCREENPLAIN, 0, + "offscreen plain surface", FALSE, + .allow_nondxt = TRUE, .allow_all = TRUE, + }, + { + DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN, 0, + "videomemory offscreen plain surface", FALSE, + .allow_nondxt = TRUE, .allow_all = TRUE, + }, + { + DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN, 0, + "systemmemory offscreen plain surface", FALSE, + .allow_nondxt = TRUE, + }, }; enum size_type { @@ -6581,18 +6594,29 @@ static void test_block_formats_creation(void) * behavior on windows because I have no hardware that doesn't at * least support np2_conditional. There's probably no HW that * supports DXTN textures but no conditional np2 textures. */ - if (!support && !(types[j].caps & DDSCAPS_SYSTEMMEMORY)) - expect_hr = DDERR_INVALIDPARAMS; - else if (formats[i].create_size_checked && !block_aligned) + + if (formats[i].create_size_checked && !block_aligned) { expect_hr = DDERR_INVALIDPARAMS; - if (!(types[j].caps & DDSCAPS_TEXTURE)) + } + else if (types[j].caps & DDSCAPS_OFFSCREENPLAIN) + { + expect_hr = types[j].caps & DDSCAPS_VIDEOMEMORY ? E_NOTIMPL : DDERR_INVALIDPIXELFORMAT; + if (types[j].caps & DDSCAPS_SYSTEMMEMORY) todo = TRUE; } + else if (!support && !(types[j].caps & DDSCAPS_SYSTEMMEMORY)) + expect_hr = DDERR_INVALIDPARAMS; else expect_hr = D3D_OK;
hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL); + if (hr == DD_OK && types[j].caps & DDSCAPS_OFFSCREENPLAIN) + { + BOOL is_dxt = (formats[i].fourcc & MAKEFOURCC(0xff,0xff,0xff,0)) == MAKEFOURCC('D','X','T',0); + if (types[j].allow_all || (types[j].allow_nondxt && !is_dxt)) + expect_hr = DD_OK; + } todo_wine_if (todo) ok(hr == expect_hr, "Got unexpected hr %#lx for format %s, resource type %s, size %ux%u, expected %#lx.\n", diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7a3c96fa315..02e3f61b0a9 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -6280,21 +6280,19 @@ static void test_block_formats_creation(void) {MAKEFOURCC('D','X','T','5'), "D3DFMT_DXT5", SUPPORT_DXT5, 4, 4, 16, TRUE, FALSE}, {MAKEFOURCC('Y','U','Y','2'), "D3DFMT_YUY2", SUPPORT_YUY2, 2, 1, 4, FALSE, TRUE }, {MAKEFOURCC('U','Y','V','Y'), "D3DFMT_UYVY", SUPPORT_UYVY, 2, 1, 4, FALSE, TRUE }, + {MAKEFOURCC('I','V','5','0'), "D3DFMT_UYVY", SUPPORT_UYVY, 2, 1, 4, FALSE, TRUE }, + {MAKEFOURCC('N','O','P','E'), "D3DFMT_UYVY", SUPPORT_UYVY, 2, 1, 4, FALSE, TRUE }, }; static const struct { DWORD caps, caps2; const char *name; BOOL overlay; + BOOL allow_nondxt; + BOOL allow_all; } types[] = { - /* DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY fails to create any fourcc - * surface with DDERR_INVALIDPIXELFORMAT. Don't care about it for now. - * - * Nvidia returns E_FAIL on DXTN DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY. - * Other hw / drivers successfully create those surfaces. Ignore them, this - * suggests that no game uses this, otherwise Nvidia would support it. */ { DDSCAPS_VIDEOMEMORY | DDSCAPS_TEXTURE, 0, "videomemory texture", FALSE @@ -6310,7 +6308,22 @@ static void test_block_formats_creation(void) { DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, "managed texture", FALSE - } + }, + { + DDSCAPS_OFFSCREENPLAIN, 0, + "offscreen plain surface", FALSE, + .allow_nondxt = TRUE, .allow_all = TRUE, + }, + { + DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN, 0, + "videomemory offscreen plain surface", FALSE, + .allow_nondxt = TRUE, .allow_all = TRUE, + }, + { + DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN, 0, + "systemmemory offscreen plain surface", FALSE, + .allow_nondxt = TRUE, + }, }; enum size_type { @@ -6425,18 +6438,29 @@ static void test_block_formats_creation(void) * behavior on windows because I have no hardware that doesn't at * least support np2_conditional. There's probably no HW that * supports DXTN textures but no conditional np2 textures. */ - if (!support && !(types[j].caps & DDSCAPS_SYSTEMMEMORY)) - expect_hr = DDERR_INVALIDPARAMS; - else if (formats[i].create_size_checked && !block_aligned) + + if (formats[i].create_size_checked && !block_aligned) { expect_hr = DDERR_INVALIDPARAMS; - if (!(types[j].caps & DDSCAPS_TEXTURE)) + } + else if (types[j].caps & DDSCAPS_OFFSCREENPLAIN) + { + expect_hr = types[j].caps & DDSCAPS_VIDEOMEMORY ? E_NOTIMPL : DDERR_INVALIDPIXELFORMAT; + if (types[j].caps & DDSCAPS_SYSTEMMEMORY) todo = TRUE; } + else if (!support && !(types[j].caps & DDSCAPS_SYSTEMMEMORY)) + expect_hr = DDERR_INVALIDPARAMS; else expect_hr = D3D_OK;
hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL); + if (hr == DD_OK && types[j].caps & DDSCAPS_OFFSCREENPLAIN) + { + BOOL is_dxt = (formats[i].fourcc & MAKEFOURCC(0xff,0xff,0xff,0)) == MAKEFOURCC('D','X','T',0); + if (types[j].allow_all || (types[j].allow_nondxt && !is_dxt)) + expect_hr = DD_OK; + } todo_wine_if (todo) ok(hr == expect_hr, "Got unexpected hr %#lx for format %s, resource type %s, size %ux%u, expected %#lx.\n",
From: Matteo Bruni mbruni@codeweavers.com
--- dlls/quartz/vmr7_presenter.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/vmr7_presenter.c b/dlls/quartz/vmr7_presenter.c index d1170792455..2931dc4c36d 100644 --- a/dlls/quartz/vmr7_presenter.c +++ b/dlls/quartz/vmr7_presenter.c @@ -31,6 +31,8 @@ struct vmr7_presenter IVMRWindowlessControl IVMRWindowlessControl_iface; LONG refcount;
+ IVMRSurfaceAllocatorNotify *notify; + IDirectDraw7 *ddraw; IDirectDrawSurface7 *frontbuffer; IDirectDrawSurface7 *primary; @@ -275,7 +277,14 @@ static HRESULT WINAPI surface_allocator_PrepareSurface(IVMRSurfaceAllocator *ifa static HRESULT WINAPI surface_allocator_AdviseNotify(IVMRSurfaceAllocator *iface, IVMRSurfaceAllocatorNotify *notify) { - FIXME("iface %p, notify %p, stub!\n", iface, notify); + struct vmr7_presenter *presenter = impl_from_IVMRSurfaceAllocator(iface); + RECT rect = {0, 0, 0, 0}; + + TRACE("presenter %p, notify %p.\n", presenter, notify); + + presenter->notify = notify; + IVMRSurfaceAllocatorNotify_SetDDrawDevice(notify, presenter->ddraw, + MonitorFromRect(&rect, MONITOR_DEFAULTTOPRIMARY)); return S_OK; }
From: Matteo Bruni mbruni@codeweavers.com
--- dlls/quartz/vmr7.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index e9834e300b0..cb38a1883d1 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -826,6 +826,7 @@ static HRESULT WINAPI filter_config_SetRenderingMode(IVMRFilterConfig *iface, DW } IUnknown_QueryInterface(default_presenter, &IID_IVMRSurfaceAllocator, (void **)&filter->allocator); IUnknown_QueryInterface(default_presenter, &IID_IVMRImagePresenter, (void **)&filter->presenter); + IVMRSurfaceAllocator_AdviseNotify(filter->allocator, &filter->IVMRSurfaceAllocatorNotify_iface); IUnknown_Release(default_presenter); break;
From: Matteo Bruni mbruni@codeweavers.com
--- dlls/quartz/tests/vmr7.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index a77d02ade97..0e799efb960 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3338,6 +3338,8 @@ static ULONG WINAPI allocator_Release(IVMRSurfaceAllocator *iface) return InterlockedDecrement(&presenter->refcount); }
+static unsigned int allocatesurface_count; + static HRESULT WINAPI allocator_AllocateSurface(IVMRSurfaceAllocator *iface, DWORD_PTR cookie, VMRALLOCATIONINFO *info, DWORD *buffer_count, IDirectDrawSurface7 **surface) { @@ -3346,6 +3348,7 @@ static HRESULT WINAPI allocator_AllocateSurface(IVMRSurfaceAllocator *iface, HRESULT hr;
if (winetest_debug > 1) trace("AllocateSurface()\n"); + ++allocatesurface_count;
ok(!presenter->surfaces[0], "Surface should not already exist.\n");
@@ -3516,6 +3519,7 @@ static void test_renderless_formats(void) .IVMRImagePresenter_iface.lpVtbl = &presenter_vtbl, .refcount = 1, }; + unsigned int prev_allocatesurface_count; struct presenter presenter2 = presenter; IVMRSurfaceAllocatorNotify *notify; RECT rect = {0, 0, 640, 480}; @@ -3592,6 +3596,7 @@ static void test_renderless_formats(void) vih.bmiHeader.biBitCount = tests[i].depth; vih.bmiHeader.biCompression = tests[i].compression;
+ prev_allocatesurface_count = allocatesurface_count; hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt); /* Wine currently creates surfaces during IPin::ReceiveConnection() * instead of IMemAllocator::SetProperties(), so accept those extra @@ -3600,6 +3605,9 @@ static void test_renderless_formats(void) ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr); else ok(hr == S_OK || hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr); + todo_wine_if(i < 5) ok(allocatesurface_count == prev_allocatesurface_count, + "Got allocatesurface_count %u, prev_allocatesurface_count %u.\n", + allocatesurface_count, prev_allocatesurface_count); if (hr != S_OK) { if (!tests[i].must_fail) @@ -3607,7 +3615,6 @@ static void test_renderless_formats(void) winetest_pop_context(); continue; } - ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IMemInputPin_GetAllocator(input, &allocator); todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -3617,6 +3624,7 @@ static void test_renderless_formats(void) hr = IMemInputPin_GetAllocator(input, &allocator); }
+ prev_allocatesurface_count = allocatesurface_count; req_props.cbBuffer = vih.bmiHeader.biWidth * vih.bmiHeader.biHeight * vih.bmiHeader.biBitCount / 8; hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); if (hr != S_OK) @@ -3632,6 +3640,11 @@ static void test_renderless_formats(void) } ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n"); + + todo_wine ok(allocatesurface_count == prev_allocatesurface_count + 1, + "Got allocatesurface_count %u, prev_allocatesurface_count %u.\n", + allocatesurface_count, prev_allocatesurface_count); + hr = IMemAllocator_Commit(allocator); ok(hr == S_OK, "Got hr %#lx.\n", hr);
From: Matteo Bruni mbruni@codeweavers.com
--- include/vmrender.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/vmrender.idl b/include/vmrender.idl index c81a1acead3..16c8a870a5e 100644 --- a/include/vmrender.idl +++ b/include/vmrender.idl @@ -257,7 +257,7 @@ interface IVMRMonitorConfig : IUnknown typedef enum _VMRRenderPrefs { RenderPrefs_RestrictToInitialMonitor = 0x00, - RenderPrefs_ForceOffScreen = 0x01, + RenderPrefs_ForceOffscreen = 0x01, RenderPrefs_ForceOverlays = 0x02, RenderPrefs_AllowOverlays = 0x00, RenderPrefs_AllowOffscreen = 0x00,