Zebediah Figura : quartz/vmr9: Retrieve a default format if none is given in IVMRSurfaceAllocatorNotify9::AllocateSurfaceHelper().

Alexandre Julliard julliard at winehq.org
Thu Apr 30 15:24:08 CDT 2020


Module: wine
Branch: master
Commit: 1c8c26dfde2eeab7f72877903b1c695d1d81e5ea
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1c8c26dfde2eeab7f72877903b1c695d1d81e5ea

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Apr 29 20:15:15 2020 -0500

quartz/vmr9: Retrieve a default format if none is given in IVMRSurfaceAllocatorNotify9::AllocateSurfaceHelper().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/vmr9.c | 22 ++++++++++++++++++++++
 dlls/quartz/vmr9.c       | 12 ++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 783165a03a..367d7df568 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -2523,6 +2523,28 @@ static void test_allocate_surface_helper(void)
     ok(!surfaces[0], "Surface 0 was allocated.\n");
     ok(!surfaces[1], "Surface 1 was allocated.\n");
 
+    info.Format = 0;
+    info.dwFlags = VMR9AllocFlag_3DRenderTarget;
+    count = 1;
+    hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(count == 1, "Got count %u.\n", count);
+    ok(!!surfaces[0], "Surface 0 was not allocated.\n");
+    ok(info.Format != 0, "Expected a format.\n");
+
+    hr = IDirect3DSurface9_GetDesc(surfaces[0], &desc);
+    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(desc.Format == info.Format, "Expected format %#x, got %#x.\n", info.Format, desc.Format);
+    ok(desc.Type == D3DRTYPE_SURFACE, "Got type %u.\n", desc.Type);
+    ok(desc.Usage == D3DUSAGE_RENDERTARGET, "Got usage %#x.\n", desc.Usage);
+    ok(desc.Pool == D3DPOOL_DEFAULT, "Got pool %u.\n", desc.Pool);
+    ok(desc.MultiSampleType == D3DMULTISAMPLE_NONE, "Got multisample type %u.\n", desc.MultiSampleType);
+    ok(!desc.MultiSampleQuality, "Got multisample quality %u.\n", desc.MultiSampleQuality);
+    ok(desc.Width == 32, "Got width %u.\n", desc.Width);
+    ok(desc.Height == 16, "Got height %u.\n", desc.Height);
+
+    IDirect3DSurface9_Release(surfaces[0]);
+
 out:
     IVMRSurfaceAllocatorNotify9_Release(notify);
     ref = IBaseFilter_Release(filter);
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index 888f9e1751..f4faf2f97a 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -2112,6 +2112,18 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa
     if (!allocinfo || !numbuffers || !surface)
         return E_POINTER;
 
+    if (!allocinfo->Format)
+    {
+        IDirect3DSurface9 *backbuffer;
+        D3DSURFACE_DESC desc;
+
+        IDirect3DDevice9_GetBackBuffer(This->allocator_d3d9_dev, 0, 0,
+                D3DBACKBUFFER_TYPE_MONO, &backbuffer);
+        IDirect3DSurface9_GetDesc(backbuffer, &desc);
+        IDirect3DSurface9_Release(backbuffer);
+        allocinfo->Format = desc.Format;
+    }
+
     if (!*numbuffers || *numbuffers < allocinfo->MinBuffers)
     {
         ERR("Invalid number of buffers?\n");




More information about the wine-cvs mailing list