Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/ddraw/ddraw.c | 2 +- dlls/ddraw/surface.c | 4 ++-- dlls/wined3d/directx.c | 12 +++--------- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 4 ++-- 5 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 7c13d4abd4b..e82f9644e3b 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1913,7 +1913,7 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *c wined3d_mutex_unlock(); return hr; } - framebuffer_size = wined3d_calculate_format_pitch(ddraw->wined3d, WINED3DADAPTER_DEFAULT, + framebuffer_size = wined3d_calculate_format_pitch(ddraw->wined3d_adapter, mode.format_id, mode.width); framebuffer_size *= mode.height;
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 627963232e4..85c1ef4966b 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6265,7 +6265,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ }
if ((desc->dwFlags & DDSD_LINEARSIZE) - && desc->u1.dwLinearSize < wined3d_calculate_format_pitch(ddraw->wined3d, WINED3DADAPTER_DEFAULT, + && desc->u1.dwLinearSize < wined3d_calculate_format_pitch(ddraw->wined3d_adapter, wined3d_desc.format, wined3d_desc.width) * ((desc->dwHeight + 3) / 4)) { WARN("Invalid linear size %u specified.\n", desc->u1.dwLinearSize); @@ -6282,7 +6282,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ return DDERR_INVALIDPARAMS; }
- if (desc->u1.lPitch < wined3d_calculate_format_pitch(ddraw->wined3d, WINED3DADAPTER_DEFAULT, + if (desc->u1.lPitch < wined3d_calculate_format_pitch(ddraw->wined3d_adapter, wined3d_desc.format, wined3d_desc.width) || desc->u1.lPitch & 3) { WARN("Invalid pitch %u specified.\n", desc->u1.lPitch); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d026c6a49ef..8f8933801a9 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1738,19 +1738,13 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, return WINED3D_OK; }
-UINT CDECL wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, - enum wined3d_format_id format_id, UINT width) +unsigned int CDECL wined3d_calculate_format_pitch(const struct wined3d_adapter *adapter, + enum wined3d_format_id format_id, unsigned int width) { - const struct wined3d_adapter *adapter; unsigned int row_pitch, slice_pitch;
- TRACE("wined3d %p, adapter_idx %u, format_id %s, width %u.\n", - wined3d, adapter_idx, debug_d3dformat(format_id), width); + TRACE("adapter %p, format_id %s, width %u.\n", adapter, debug_d3dformat(format_id), width);
- if (adapter_idx >= wined3d->adapter_count) - return ~0u; - - adapter = wined3d->adapters[adapter_idx]; wined3d_format_calculate_pitch(wined3d_get_format(adapter, format_id, 0), 1, width, 1, &row_pitch, &slice_pitch);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 3e511c6c2e1..a25accc2371 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -1,7 +1,7 @@ @ stdcall wined3d_mutex_lock() @ stdcall wined3d_mutex_unlock()
-@ cdecl wined3d_calculate_format_pitch(ptr long long long) +@ cdecl wined3d_calculate_format_pitch(ptr long long) @ cdecl wined3d_check_depth_stencil_match(ptr long long long long) @ cdecl wined3d_check_device_format(ptr ptr long long long long long long) @ cdecl wined3d_check_device_format_conversion(ptr long long long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 8f2829d21d0..e1e90a1dbc0 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2245,8 +2245,8 @@ typedef HRESULT (CDECL *wined3d_device_reset_cb)(struct wined3d_resource *resour void __stdcall wined3d_mutex_lock(void); void __stdcall wined3d_mutex_unlock(void);
-UINT __cdecl wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT adapter_idx, - enum wined3d_format_id format_id, UINT width); +unsigned int __cdecl wined3d_calculate_format_pitch(const struct wined3d_adapter *adapter, + enum wined3d_format_id format_id, unsigned int width); HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d_adapter *adapter, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id);