Signed-off-by: Zebediah Figura z.figura12@gmail.com --- 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 e01e9ad5572..dc9aeec834c 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -2731,6 +2731,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 888f9e17510..f4faf2f97a8 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");