Commit 3105c22d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/vmr9: Pass the already retrieved caps pointer to…

quartz/vmr9: Pass the already retrieved caps pointer to VMR9_SurfaceAllocator_SetAllocationSettings(). Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0e4620dc
......@@ -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;
hr = IDirect3DDevice9_GetDeviceCaps(This->d3d9_dev, &caps);
if (FAILED(hr))
return hr;
return;
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment