Zhiyi Zhang : wined3d: Pass a struct wined3d_adapter pointer to wined3d_calculate_format_pitch().
Alexandre Julliard
julliard at winehq.org
Wed Mar 11 17:38:31 CDT 2020
Module: wine
Branch: master
Commit: c9f0d862b55be91f416a0114e9a52226bb2658d9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c9f0d862b55be91f416a0114e9a52226bb2658d9
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Tue Mar 10 17:35:46 2020 +0800
wined3d: Pass a struct wined3d_adapter pointer to wined3d_calculate_format_pitch().
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 7c13d4abd4..e82f9644e3 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 627963232e..85c1ef4966 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 d026c6a49e..8f8933801a 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);
-
- if (adapter_idx >= wined3d->adapter_count)
- return ~0u;
+ TRACE("adapter %p, format_id %s, width %u.\n", adapter, debug_d3dformat(format_id), width);
- 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 3e511c6c2e..a25accc237 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 035268be7a..d6a9a079d7 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2247,8 +2247,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);
More information about the wine-cvs
mailing list