[PATCH v2 3/6] d3dx9: Factor our check_texture_requirements() function.

Paul Gofman gofmanp at gmail.com
Fri Oct 25 12:30:56 CDT 2019


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/d3dx9_36/texture.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c
index 3f22b050b6..b45e55fdad 100644
--- a/dlls/d3dx9_36/texture.c
+++ b/dlls/d3dx9_36/texture.c
@@ -210,8 +210,8 @@ static D3DFORMAT get_replacement_format(D3DFORMAT format)
     return format;
 }
 
-HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height,
-        UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
+static HRESULT check_texture_requirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height,
+        UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool, D3DRESOURCETYPE resource_type)
 {
     UINT w = (width && *width) ? *width : 1;
     UINT h = (height && *height) ? *height : 1;
@@ -266,7 +266,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
     fmt = get_format_info(usedformat);
 
     hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format,
-        usage, D3DRTYPE_TEXTURE, usedformat);
+            usage, resource_type, usedformat);
     if (FAILED(hr))
     {
         BOOL allow_24bits;
@@ -301,7 +301,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
                 continue;
 
             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))
                 continue;
 
@@ -420,6 +420,12 @@ cleanup:
     return D3D_OK;
 }
 
+HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height,
+        UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
+{
+    return check_texture_requirements(device, width, height, miplevels, usage, format, pool, D3DRTYPE_TEXTURE);
+}
+
 HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size,
         UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
 {
-- 
2.21.0




More information about the wine-devel mailing list