quartz/vmr9: Pass the already retrieved caps pointer to VMR9_SurfaceAllocator_SetAllocationSettings().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-02-01 22:37:41 -06:00 committed by Alexandre Julliard
parent 0e4620dcd4
commit 3105c22d0d
1 changed files with 9 additions and 23 deletions

View File

@ -2778,21 +2778,15 @@ static ULONG WINAPI VMR9_SurfaceAllocator_Release(IVMRSurfaceAllocator9 *iface)
return IVMRImagePresenter9_Release(&presenter->IVMRImagePresenter9_iface);
}
static HRESULT VMR9_SurfaceAllocator_SetAllocationSettings(struct default_presenter *This, VMR9AllocationInfo *allocinfo)
static void adjust_surface_size(const D3DCAPS9 *caps, VMR9AllocationInfo *allocinfo)
{
D3DCAPS9 caps;
UINT width, height;
HRESULT hr;
/* There are no restrictions on the size of offscreen surfaces. */
if (!(allocinfo->dwFlags & VMR9AllocFlag_TextureSurface))
/* Only needed for texture surfaces */
return S_OK;
return;
hr = IDirect3DDevice9_GetDeviceCaps(This->d3d9_dev, &caps);
if (FAILED(hr))
return hr;
if (!(caps.TextureCaps & D3DPTEXTURECAPS_POW2) || (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY))
if (!(caps->TextureCaps & D3DPTEXTURECAPS_POW2) || (caps->TextureCaps & D3DPTEXTURECAPS_SQUAREONLY))
{
width = allocinfo->dwWidth;
height = allocinfo->dwHeight;
@ -2808,7 +2802,7 @@ static HRESULT VMR9_SurfaceAllocator_SetAllocationSettings(struct default_presen
FIXME("NPOW2 support missing, not using proper surfaces!\n");
}
if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
if (caps->TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
{
if (height > width)
width = height;
@ -2819,8 +2813,6 @@ static HRESULT VMR9_SurfaceAllocator_SetAllocationSettings(struct default_presen
allocinfo->dwHeight = height;
allocinfo->dwWidth = width;
return hr;
}
static UINT d3d9_adapter_from_hwnd(IDirect3D9 *d3d9, HWND hwnd, HMONITOR *mon_out)
@ -2899,19 +2891,13 @@ static HRESULT WINAPI VMR9_SurfaceAllocator_InitializeDevice(IVMRSurfaceAllocato
if (!(This->d3d9_surfaces = calloc(*numbuffers, sizeof(IDirect3DSurface9 *))))
return E_OUTOFMEMORY;
hr = VMR9_SurfaceAllocator_SetAllocationSettings(This, info);
if (FAILED(hr))
ERR("Setting allocation settings failed: %08x\n", hr);
if (SUCCEEDED(hr))
{
hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(This->SurfaceAllocatorNotify, info, numbuffers, This->d3d9_surfaces);
if (FAILED(hr))
ERR("Allocating surfaces failed: %08x\n", hr);
}
adjust_surface_size(&caps, info);
hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(This->SurfaceAllocatorNotify,
info, numbuffers, This->d3d9_surfaces);
if (FAILED(hr))
{
ERR("Failed to allocate surfaces, hr %#x.\n", hr);
IVMRSurfaceAllocator9_TerminateDevice(This->pVMR9->allocator, This->pVMR9->cookie);
return hr;
}