wined3d: Allow a custom pitch to be specified in wined3d_surface_set_mem().
This commit is contained in:
parent
aa0cc00b48
commit
4de77fa23f
|
@ -766,7 +766,7 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface,
|
||||||
|
|
||||||
resource = wined3d_texture_get_sub_resource(object->wined3d_texture, 0);
|
resource = wined3d_texture_get_sub_resource(object->wined3d_texture, 0);
|
||||||
surface = wined3d_resource_get_parent(resource);
|
surface = wined3d_resource_get_parent(resource);
|
||||||
wined3d_surface_set_mem(surface->wined3d_surface, *shared_handle);
|
wined3d_surface_set_mem(surface->wined3d_surface, *shared_handle, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Created texture %p.\n", object);
|
TRACE("Created texture %p.\n", object);
|
||||||
|
|
|
@ -4233,7 +4233,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
|
||||||
| DDSD_HEIGHT | DDSD_PITCH | DDSD_CAPS;
|
| DDSD_HEIGHT | DDSD_PITCH | DDSD_CAPS;
|
||||||
enum wined3d_format_id format_id;
|
enum wined3d_format_id format_id;
|
||||||
BOOL update_wined3d = FALSE;
|
BOOL update_wined3d = FALSE;
|
||||||
UINT width, height;
|
UINT pitch, width, height;
|
||||||
|
|
||||||
TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, DDSD, Flags);
|
TRACE("iface %p, surface_desc %p, flags %#x.\n", iface, DDSD, Flags);
|
||||||
|
|
||||||
|
@ -4293,6 +4293,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
|
||||||
TRACE("Surface pitch changed from %u to %u.\n", This->surface_desc.u1.lPitch, DDSD->u1.lPitch);
|
TRACE("Surface pitch changed from %u to %u.\n", This->surface_desc.u1.lPitch, DDSD->u1.lPitch);
|
||||||
update_wined3d = TRUE;
|
update_wined3d = TRUE;
|
||||||
}
|
}
|
||||||
|
pitch = DDSD->u1.lPitch;
|
||||||
width = DDSD->dwWidth;
|
width = DDSD->dwWidth;
|
||||||
}
|
}
|
||||||
else if (DDSD->dwFlags & DDSD_PITCH)
|
else if (DDSD->dwFlags & DDSD_PITCH)
|
||||||
|
@ -4302,6 +4303,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
pitch = This->surface_desc.u1.lPitch;
|
||||||
width = This->surface_desc.dwWidth;
|
width = This->surface_desc.dwWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4370,8 +4372,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
|
||||||
|
|
||||||
if (DDSD->dwFlags & DDSD_LPSURFACE && DDSD->lpSurface)
|
if (DDSD->dwFlags & DDSD_LPSURFACE && DDSD->lpSurface)
|
||||||
{
|
{
|
||||||
hr = wined3d_surface_set_mem(This->wined3d_surface, DDSD->lpSurface);
|
if (FAILED(hr = wined3d_surface_set_mem(This->wined3d_surface, DDSD->lpSurface, pitch)))
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
{
|
||||||
/* No need for a trace here, wined3d does that for us */
|
/* No need for a trace here, wined3d does that for us */
|
||||||
switch(hr)
|
switch(hr)
|
||||||
|
@ -5843,8 +5844,15 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
|
||||||
}
|
}
|
||||||
if (desc->dwFlags & DDSD_LPSURFACE)
|
if (desc->dwFlags & DDSD_LPSURFACE)
|
||||||
{
|
{
|
||||||
hr = wined3d_surface_set_mem(surface->wined3d_surface, desc->lpSurface);
|
UINT pitch = 0;
|
||||||
if (FAILED(hr))
|
|
||||||
|
if (desc->dwFlags & DDSD_PITCH)
|
||||||
|
{
|
||||||
|
pitch = desc->u1.lPitch;
|
||||||
|
surface->surface_desc.u1.lPitch = pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr = wined3d_surface_set_mem(surface->wined3d_surface, desc->lpSurface, pitch)))
|
||||||
{
|
{
|
||||||
ERR("Failed to set surface memory, hr %#x.\n", hr);
|
ERR("Failed to set surface memory, hr %#x.\n", hr);
|
||||||
wined3d_surface_decref(surface->wined3d_surface);
|
wined3d_surface_decref(surface->wined3d_surface);
|
||||||
|
|
|
@ -101,7 +101,7 @@ static void surface_cleanup(struct wined3d_surface *surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->flags & SFLAG_USERPTR)
|
if (surface->flags & SFLAG_USERPTR)
|
||||||
wined3d_surface_set_mem(surface, NULL);
|
wined3d_surface_set_mem(surface, NULL, 0);
|
||||||
if (surface->overlay_dest)
|
if (surface->overlay_dest)
|
||||||
list_remove(&surface->overlay_entry);
|
list_remove(&surface->overlay_entry);
|
||||||
|
|
||||||
|
@ -3202,6 +3202,9 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
|
||||||
|
|
||||||
TRACE("surface %p.\n", surface);
|
TRACE("surface %p.\n", surface);
|
||||||
|
|
||||||
|
if (surface->pitch)
|
||||||
|
return surface->pitch;
|
||||||
|
|
||||||
if (format->flags & WINED3DFMT_FLAG_BLOCKS)
|
if (format->flags & WINED3DFMT_FLAG_BLOCKS)
|
||||||
{
|
{
|
||||||
/* Since compressed formats are block based, pitch means the amount of
|
/* Since compressed formats are block based, pitch means the amount of
|
||||||
|
@ -3221,7 +3224,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
|
||||||
return pitch;
|
return pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem)
|
HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem, UINT pitch)
|
||||||
{
|
{
|
||||||
TRACE("surface %p, mem %p.\n", surface, mem);
|
TRACE("surface %p, mem %p.\n", surface, mem);
|
||||||
|
|
||||||
|
@ -3290,6 +3293,8 @@ HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem
|
||||||
surface_modify_location(surface, SFLAG_INSYSMEM, TRUE);
|
surface_modify_location(surface, SFLAG_INSYSMEM, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
surface->pitch = pitch;
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@
|
||||||
@ cdecl wined3d_surface_releasedc(ptr ptr)
|
@ cdecl wined3d_surface_releasedc(ptr ptr)
|
||||||
@ cdecl wined3d_surface_restore(ptr)
|
@ cdecl wined3d_surface_restore(ptr)
|
||||||
@ cdecl wined3d_surface_set_color_key(ptr long ptr)
|
@ cdecl wined3d_surface_set_color_key(ptr long ptr)
|
||||||
@ cdecl wined3d_surface_set_mem(ptr ptr)
|
@ cdecl wined3d_surface_set_mem(ptr ptr long)
|
||||||
@ cdecl wined3d_surface_set_overlay_position(ptr long long)
|
@ cdecl wined3d_surface_set_overlay_position(ptr long long)
|
||||||
@ cdecl wined3d_surface_set_palette(ptr ptr)
|
@ cdecl wined3d_surface_set_palette(ptr ptr)
|
||||||
@ cdecl wined3d_surface_set_priority(ptr long)
|
@ cdecl wined3d_surface_set_priority(ptr long)
|
||||||
|
|
|
@ -2095,8 +2095,9 @@ struct wined3d_surface
|
||||||
|
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
|
|
||||||
UINT pow2Width;
|
UINT pitch;
|
||||||
UINT pow2Height;
|
UINT pow2Width;
|
||||||
|
UINT pow2Height;
|
||||||
|
|
||||||
/* A method to retrieve the drawable size. Not in the Vtable to make it changeable */
|
/* A method to retrieve the drawable size. Not in the Vtable to make it changeable */
|
||||||
void (*get_drawable_size)(const struct wined3d_context *context, UINT *width, UINT *height);
|
void (*get_drawable_size)(const struct wined3d_context *context, UINT *width, UINT *height);
|
||||||
|
|
|
@ -2332,7 +2332,7 @@ HRESULT __cdecl wined3d_surface_releasedc(struct wined3d_surface *surface, HDC d
|
||||||
HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface);
|
HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface);
|
||||||
HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface,
|
HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface,
|
||||||
DWORD flags, const struct wined3d_color_key *color_key);
|
DWORD flags, const struct wined3d_color_key *color_key);
|
||||||
HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem);
|
HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem, UINT pitch);
|
||||||
HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
|
HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
|
||||||
void __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette);
|
void __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette);
|
||||||
DWORD __cdecl wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD new_priority);
|
DWORD __cdecl wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD new_priority);
|
||||||
|
|
Loading…
Reference in New Issue