wined3d: Pass a struct wined3d_adapter pointer to wined3d_calculate_format_pitch().

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Zhiyi Zhang 2020-03-10 17:35:46 +08:00 committed by Alexandre Julliard
parent f2a850c844
commit c9f0d862b5
5 changed files with 9 additions and 15 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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);