Commit 92c8c0fc authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Factor our check_texture_requirements() function.

parent fcdcd5d3
...@@ -210,8 +210,8 @@ static D3DFORMAT get_replacement_format(D3DFORMAT format) ...@@ -210,8 +210,8 @@ static D3DFORMAT get_replacement_format(D3DFORMAT format)
return format; return format;
} }
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, static HRESULT check_texture_requirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height,
UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool) UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool, D3DRESOURCETYPE resource_type)
{ {
UINT w = (width && *width) ? *width : 1; UINT w = (width && *width) ? *width : 1;
UINT h = (height && *height) ? *height : 1; UINT h = (height && *height) ? *height : 1;
...@@ -223,8 +223,6 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN ...@@ -223,8 +223,6 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
D3DFORMAT usedformat = D3DFMT_UNKNOWN; D3DFORMAT usedformat = D3DFMT_UNKNOWN;
const struct pixel_format_desc *fmt; const struct pixel_format_desc *fmt;
TRACE("(%p, %p, %p, %p, %u, %p, %u)\n", device, width, height, miplevels, usage, format, pool);
if (!device) if (!device)
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
...@@ -266,7 +264,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN ...@@ -266,7 +264,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
fmt = get_format_info(usedformat); fmt = get_format_info(usedformat);
hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format, hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format,
usage, D3DRTYPE_TEXTURE, usedformat); usage, resource_type, usedformat);
if (FAILED(hr)) if (FAILED(hr))
{ {
BOOL allow_24bits; BOOL allow_24bits;
...@@ -301,7 +299,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN ...@@ -301,7 +299,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
continue; continue;
hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType,
mode.Format, usage, D3DRTYPE_TEXTURE, curfmt->format); mode.Format, usage, resource_type, curfmt->format);
if (FAILED(hr)) if (FAILED(hr))
continue; continue;
...@@ -422,6 +420,15 @@ cleanup: ...@@ -422,6 +420,15 @@ cleanup:
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height,
UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
{
TRACE("device %p, width %p, height %p, miplevels %p, usage %u, format %p, pool %u.\n",
device, width, height, miplevels, usage, format, pool);
return check_texture_requirements(device, width, height, miplevels, usage, format, pool, D3DRTYPE_TEXTURE);
}
HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size, HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size,
UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool) UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
{ {
......
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