mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 18:37:17 +00:00
wined3d: Remove no longer used arguments from wined3d_texture_update_desc().
Limit it to updating user memory and pitch.
This commit is contained in:
parent
ebaa0a9426
commit
221f110bbd
|
@ -1419,9 +1419,7 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface,
|
|||
if (set_mem)
|
||||
{
|
||||
wined3d_mutex_lock();
|
||||
wined3d_texture_update_desc(object->wined3d_texture, 0, width, height,
|
||||
wined3dformat_from_d3dformat(format), WINED3D_MULTISAMPLE_NONE, 0,
|
||||
*shared_handle, 0);
|
||||
wined3d_texture_update_desc(object->wined3d_texture, 0, *shared_handle, 0);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
|
@ -1685,8 +1683,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, unsigned i
|
|||
IDirect3DSurface9_AddRef(*surface);
|
||||
|
||||
if (user_mem)
|
||||
wined3d_texture_update_desc(texture, 0, width, height, desc.format,
|
||||
multisample_type, multisample_quality, user_mem, 0);
|
||||
wined3d_texture_update_desc(texture, 0, user_mem, 0);
|
||||
|
||||
wined3d_texture_decref(texture);
|
||||
|
||||
|
|
|
@ -4812,8 +4812,8 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
|
|||
{
|
||||
/* Updating memory only. */
|
||||
|
||||
if (FAILED(hr = wined3d_texture_update_desc(surface->wined3d_texture, surface->sub_resource_idx,
|
||||
width, height, format_id, WINED3D_MULTISAMPLE_NONE, 0, DDSD->lpSurface, pitch)))
|
||||
if (FAILED(hr = wined3d_texture_update_desc(surface->wined3d_texture,
|
||||
surface->sub_resource_idx, DDSD->lpSurface, pitch)))
|
||||
{
|
||||
WARN("Failed to update surface desc, hr %#lx.\n", hr);
|
||||
wined3d_mutex_unlock();
|
||||
|
@ -4856,8 +4856,7 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
|
|||
return hr_ddraw_from_wined3d(hr);
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_texture_update_desc(new_texture, 0, width, height,
|
||||
format_id, WINED3D_MULTISAMPLE_NONE, 0, DDSD->lpSurface, pitch)))
|
||||
if (FAILED(hr = wined3d_texture_update_desc(new_texture, 0, DDSD->lpSurface, pitch)))
|
||||
{
|
||||
ERR("Failed to set user memory, hr %#lx.\n", hr);
|
||||
wined3d_texture_decref(new_texture);
|
||||
|
@ -6154,8 +6153,6 @@ static HRESULT ddraw_surface_reserve_memory(struct wined3d_texture *wined3d_text
|
|||
wined3d_texture_get_pitch(wined3d_texture, i, &pitch, &slice_pitch);
|
||||
|
||||
if (FAILED(hr = wined3d_texture_update_desc(wined3d_texture, i,
|
||||
desc.width, desc.height, resource_desc.format,
|
||||
desc.multisample_type, desc.multisample_quality,
|
||||
(BYTE *)texture->texture_memory + offset, pitch)))
|
||||
{
|
||||
heap_free(texture->texture_memory);
|
||||
|
@ -6336,9 +6333,8 @@ static HRESULT ddraw_texture_init(struct ddraw_texture *texture, struct ddraw *d
|
|||
return hr;
|
||||
}
|
||||
|
||||
if ((desc->dwFlags & DDSD_LPSURFACE) && FAILED(hr = wined3d_texture_update_desc(wined3d_texture, 0,
|
||||
wined3d_desc.width, wined3d_desc.height, wined3d_desc.format,
|
||||
WINED3D_MULTISAMPLE_NONE, 0, desc->lpSurface, pitch)))
|
||||
if ((desc->dwFlags & DDSD_LPSURFACE)
|
||||
&& FAILED(hr = wined3d_texture_update_desc(wined3d_texture, 0, desc->lpSurface, pitch)))
|
||||
{
|
||||
ERR("Failed to set surface memory, hr %#lx.\n", hr);
|
||||
goto fail;
|
||||
|
|
|
@ -1882,54 +1882,34 @@ void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl *t
|
|||
checkGLcall("set compatible renderbuffer");
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
UINT width, UINT height, enum wined3d_format_id format_id,
|
||||
enum wined3d_multisample_type multisample_type, UINT multisample_quality, void *mem, UINT pitch)
|
||||
HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, void *mem, unsigned int pitch)
|
||||
{
|
||||
unsigned int current_row_pitch, current_slice_pitch, width, height;
|
||||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
unsigned int i, level, sub_resource_count;
|
||||
const struct wined3d_d3d_info *d3d_info;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
const struct wined3d_format *format;
|
||||
struct wined3d_device *device;
|
||||
unsigned int resource_size;
|
||||
unsigned int slice_pitch;
|
||||
bool update_memory_only;
|
||||
bool create_dib = false;
|
||||
|
||||
TRACE("texture %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u, "
|
||||
"mem %p, pitch %u, sub_resource_idx %u.\n",
|
||||
texture, width, height, debug_d3dformat(format_id), multisample_type, multisample_quality, mem, pitch,
|
||||
sub_resource_idx);
|
||||
TRACE("texture %p, sub_resource_idx %u, mem %p, pitch %u.\n", texture, sub_resource_idx, mem, pitch);
|
||||
|
||||
device = texture->resource.device;
|
||||
gl_info = &device->adapter->gl_info;
|
||||
d3d_info = &device->adapter->d3d_info;
|
||||
format = wined3d_get_format(device->adapter, format_id, texture->resource.bind_flags);
|
||||
resource_size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, 1);
|
||||
format = texture->resource.format;
|
||||
level = sub_resource_idx % texture->level_count;
|
||||
sub_resource_count = texture->level_count * texture->layer_count;
|
||||
|
||||
update_memory_only = width == wined3d_texture_get_level_width(texture, level)
|
||||
&& height == wined3d_texture_get_level_height(texture, level)
|
||||
&& format_id == texture->resource.format->id && multisample_type == texture->resource.multisample_type
|
||||
&& multisample_quality == texture->resource.multisample_quality;
|
||||
|
||||
width = wined3d_texture_get_level_width(texture, level);
|
||||
height = wined3d_texture_get_level_height(texture, level);
|
||||
if (pitch)
|
||||
slice_pitch = height * pitch;
|
||||
else
|
||||
wined3d_format_calculate_pitch(format, 1, width, height, &pitch, &slice_pitch);
|
||||
|
||||
if (update_memory_only)
|
||||
{
|
||||
unsigned int current_row_pitch, current_slice_pitch;
|
||||
|
||||
wined3d_texture_get_pitch(texture, level, ¤t_row_pitch, ¤t_slice_pitch);
|
||||
update_memory_only = pitch == current_row_pitch && slice_pitch == current_slice_pitch;
|
||||
}
|
||||
|
||||
if (!resource_size)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
update_memory_only = (pitch == current_row_pitch && slice_pitch == current_slice_pitch);
|
||||
|
||||
if (sub_resource_count > 1 && !update_memory_only)
|
||||
{
|
||||
|
@ -1995,60 +1975,17 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, unsig
|
|||
texture->row_pitch = pitch;
|
||||
texture->slice_pitch = slice_pitch;
|
||||
|
||||
texture->resource.format = format;
|
||||
texture->resource.multisample_type = multisample_type;
|
||||
texture->resource.multisample_quality = multisample_quality;
|
||||
texture->resource.width = width;
|
||||
texture->resource.height = height;
|
||||
if (!(texture->resource.access & WINED3D_RESOURCE_ACCESS_CPU)
|
||||
&& texture->resource.usage & WINED3DUSAGE_VIDMEM_ACCOUNTING)
|
||||
adapter_adjust_memory(device->adapter, (INT64)texture->slice_pitch - texture->resource.size);
|
||||
texture->resource.size = texture->slice_pitch;
|
||||
sub_resource->size = texture->slice_pitch;
|
||||
sub_resource->locations = WINED3D_LOCATION_DISCARDED;
|
||||
|
||||
if (texture->texture_ops == &texture_gl_ops)
|
||||
{
|
||||
if (multisample_type && gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
|
||||
{
|
||||
wined3d_texture_gl(texture)->target = GL_TEXTURE_2D_MULTISAMPLE;
|
||||
texture->flags &= ~WINED3D_TEXTURE_DOWNLOADABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
wined3d_texture_gl(texture)->target = GL_TEXTURE_2D;
|
||||
texture->flags |= WINED3D_TEXTURE_DOWNLOADABLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (((width & (width - 1)) || (height & (height - 1))) && !d3d_info->texture_npot
|
||||
&& !d3d_info->texture_npot_conditional)
|
||||
{
|
||||
texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
|
||||
texture->pow2_width = texture->pow2_height = 1;
|
||||
while (texture->pow2_width < width)
|
||||
texture->pow2_width <<= 1;
|
||||
while (texture->pow2_height < height)
|
||||
texture->pow2_height <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
texture->flags &= ~WINED3D_TEXTURE_COND_NP2_EMULATED;
|
||||
texture->pow2_width = width;
|
||||
texture->pow2_height = height;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mem && !wined3d_resource_prepare_sysmem(&texture->resource))
|
||||
ERR("Failed to allocate resource memory.\n");
|
||||
|
||||
/* The format might be changed to a format that needs conversion.
|
||||
* If the surface didn't use PBOs previously but could now, don't
|
||||
* change it - whatever made us not use PBOs might come back, e.g.
|
||||
* color keys. */
|
||||
if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER && !wined3d_texture_use_pbo(texture, d3d_info))
|
||||
texture->resource.map_binding = WINED3D_LOCATION_SYSMEM;
|
||||
|
||||
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_SYSMEM);
|
||||
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_SYSMEM);
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@
|
|||
@ cdecl wined3d_texture_set_lod(ptr long)
|
||||
@ cdecl wined3d_texture_set_overlay_position(ptr long long long)
|
||||
@ cdecl wined3d_texture_set_sub_resource_parent(ptr long ptr ptr)
|
||||
@ cdecl wined3d_texture_update_desc(ptr long long long long long long ptr long)
|
||||
@ cdecl wined3d_texture_update_desc(ptr long ptr long)
|
||||
@ cdecl wined3d_texture_update_overlay(ptr long ptr ptr long ptr long)
|
||||
|
||||
@ cdecl wined3d_unordered_access_view_create(ptr ptr ptr ptr ptr)
|
||||
|
|
|
@ -2868,10 +2868,8 @@ HRESULT __cdecl wined3d_texture_set_overlay_position(struct wined3d_texture *tex
|
|||
unsigned int sub_resource_idx, LONG x, LONG y);
|
||||
void __cdecl wined3d_texture_set_sub_resource_parent(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops);
|
||||
HRESULT __cdecl wined3d_texture_update_desc(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
UINT width, UINT height, enum wined3d_format_id format_id,
|
||||
enum wined3d_multisample_type multisample_type, UINT multisample_quality,
|
||||
void *mem, UINT pitch);
|
||||
HRESULT __cdecl wined3d_texture_update_desc(struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, void *mem, unsigned int pitch);
|
||||
HRESULT __cdecl wined3d_texture_update_overlay(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect, uint32_t flags);
|
||||
|
|
Loading…
Reference in a new issue