wined3d: Pass a sub-resource index instead of a face + miplevel to cube texture methods.
This commit is contained in:
parent
f0a0714ecd
commit
6dd9109358
|
@ -258,13 +258,14 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT
|
||||||
{
|
{
|
||||||
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
|
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
|
||||||
IWineD3DSurface *mySurface = NULL;
|
IWineD3DSurface *mySurface = NULL;
|
||||||
|
UINT sub_resource_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
|
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
|
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
|
||||||
(WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
|
hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, sub_resource_idx, &mySurface);
|
||||||
if (SUCCEEDED(hr) && ppCubeMapSurface)
|
if (SUCCEEDED(hr) && ppCubeMapSurface)
|
||||||
{
|
{
|
||||||
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
|
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
|
||||||
|
@ -276,29 +277,37 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) {
|
static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *iface,
|
||||||
|
D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags)
|
||||||
|
{
|
||||||
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
|
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
|
||||||
|
UINT sub_resource_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
|
TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
|
||||||
iface, FaceType, Level, pLockedRect, pRect, Flags);
|
iface, FaceType, Level, pLockedRect, pRect, Flags);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType,
|
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
|
||||||
Level, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
|
hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx,
|
||||||
|
(WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
|
static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(IDirect3DCubeTexture8 *iface,
|
||||||
|
D3DCUBEMAP_FACES FaceType, UINT Level)
|
||||||
|
{
|
||||||
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
|
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
|
||||||
|
UINT sub_resource_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level);
|
TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType, Level);
|
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
|
||||||
|
hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, sub_resource_idx);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -297,13 +297,14 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT
|
||||||
{
|
{
|
||||||
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
||||||
IWineD3DSurface *mySurface = NULL;
|
IWineD3DSurface *mySurface = NULL;
|
||||||
|
UINT sub_resource_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
|
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
|
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
|
||||||
(WINED3DCUBEMAP_FACES)FaceType, Level, &mySurface);
|
hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, sub_resource_idx, &mySurface);
|
||||||
if (SUCCEEDED(hr) && ppCubeMapSurface)
|
if (SUCCEEDED(hr) && ppCubeMapSurface)
|
||||||
{
|
{
|
||||||
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
|
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
|
||||||
|
@ -315,29 +316,37 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
|
static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 *iface,
|
||||||
|
D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags)
|
||||||
|
{
|
||||||
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
||||||
|
UINT sub_resource_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
|
TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
|
||||||
iface, FaceType, Level, pLockedRect, pRect, Flags);
|
iface, FaceType, Level, pLockedRect, pRect, Flags);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType,
|
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
|
||||||
Level, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
|
hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx,
|
||||||
|
(WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
|
static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(IDirect3DCubeTexture9 *iface,
|
||||||
|
D3DCUBEMAP_FACES FaceType, UINT Level)
|
||||||
|
{
|
||||||
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
||||||
|
UINT sub_resource_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level);
|
TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level);
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES)FaceType, Level);
|
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
|
||||||
|
hr = IWineD3DCubeTexture_Unmap(This->wineD3DCubeTexture, sub_resource_idx);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -81,21 +81,17 @@ void basetexture_cleanup(IWineD3DBaseTexture *iface)
|
||||||
resource_cleanup((IWineD3DResource *)iface);
|
resource_cleanup((IWineD3DResource *)iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT layer, UINT level)
|
IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT sub_resource_idx)
|
||||||
{
|
{
|
||||||
if (layer >= texture->baseTexture.layer_count)
|
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
|
||||||
|
|
||||||
|
if (sub_resource_idx >= sub_count)
|
||||||
{
|
{
|
||||||
WARN("layer %u >= layer_count %u.\n", layer, texture->baseTexture.layer_count);
|
WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level >= texture->baseTexture.level_count)
|
return texture->baseTexture.sub_resources[sub_resource_idx];
|
||||||
{
|
|
||||||
WARN("level %u >= level_count %u.\n", level, texture->baseTexture.level_count);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture->baseTexture.sub_resources[layer * texture->baseTexture.level_count + level];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A GL context is provided by the caller */
|
/* A GL context is provided by the caller */
|
||||||
|
|
|
@ -313,18 +313,15 @@ static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *******************************************
|
|
||||||
IWineD3DCubeTexture IWineD3DCubeTexture parts follow
|
|
||||||
******************************************* */
|
|
||||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface,
|
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface,
|
||||||
UINT level, WINED3DSURFACE_DESC *desc)
|
UINT sub_resource_idx, WINED3DSURFACE_DESC *desc)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
||||||
IWineD3DSurface *surface;
|
IWineD3DSurface *surface;
|
||||||
|
|
||||||
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
|
TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc);
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level)))
|
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -336,15 +333,15 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface,
|
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface,
|
||||||
WINED3DCUBEMAP_FACES face, UINT level, IWineD3DSurface **surface)
|
UINT sub_resource_idx, IWineD3DSurface **surface)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
||||||
IWineD3DSurface *s;
|
IWineD3DSurface *s;
|
||||||
|
|
||||||
TRACE("iface %p, face %u, level %u, surface %p.\n",
|
TRACE("iface %p, sub_resource_idx %u, surface %p.\n",
|
||||||
iface, face, level, surface);
|
iface, sub_resource_idx, surface);
|
||||||
|
|
||||||
if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level)))
|
if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -359,15 +356,15 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeText
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_Map(IWineD3DCubeTexture *iface,
|
static HRESULT WINAPI IWineD3DCubeTextureImpl_Map(IWineD3DCubeTexture *iface,
|
||||||
WINED3DCUBEMAP_FACES face, UINT level, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
|
UINT sub_resource_idx, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
||||||
IWineD3DSurface *surface;
|
IWineD3DSurface *surface;
|
||||||
|
|
||||||
TRACE("iface %p, face %u, level %u, locked_rect %p, rect %s, flags %#x.\n",
|
TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n",
|
||||||
iface, face, level, locked_rect, wine_dbgstr_rect(rect), flags);
|
iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags);
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level)))
|
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -377,15 +374,15 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_Map(IWineD3DCubeTexture *iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_Unmap(IWineD3DCubeTexture *iface,
|
static HRESULT WINAPI IWineD3DCubeTextureImpl_Unmap(IWineD3DCubeTexture *iface,
|
||||||
WINED3DCUBEMAP_FACES face, UINT level)
|
UINT sub_resource_idx)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
||||||
IWineD3DSurface *surface;
|
IWineD3DSurface *surface;
|
||||||
|
|
||||||
TRACE("iface %p, face %u, level %u.\n",
|
TRACE("iface %p, sub_resource_idx %u.\n",
|
||||||
iface, face, level);
|
iface, sub_resource_idx);
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level)))
|
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -398,12 +395,13 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *
|
||||||
WINED3DCUBEMAP_FACES face, const RECT *dirty_rect)
|
WINED3DCUBEMAP_FACES face, const RECT *dirty_rect)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
|
||||||
|
UINT sub_resource_idx = face * texture->baseTexture.level_count;
|
||||||
IWineD3DSurfaceImpl *surface;
|
IWineD3DSurfaceImpl *surface;
|
||||||
|
|
||||||
TRACE("iface %p, face %u, dirty_rect %s.\n",
|
TRACE("iface %p, face %u, dirty_rect %s.\n",
|
||||||
iface, face, wine_dbgstr_rect(dirty_rect));
|
iface, face, wine_dbgstr_rect(dirty_rect));
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, face, 0)))
|
if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
|
@ -5007,27 +5007,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
|
||||||
{
|
{
|
||||||
IWineD3DSurface *src_surface;
|
IWineD3DSurface *src_surface;
|
||||||
IWineD3DSurface *dst_surface;
|
IWineD3DSurface *dst_surface;
|
||||||
WINED3DCUBEMAP_FACES face;
|
|
||||||
|
|
||||||
for (i = 0; i < level_count; ++i)
|
for (i = 0; i < level_count * 6; ++i)
|
||||||
{
|
{
|
||||||
/* Update each cube face. */
|
hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)src_texture, i, &src_surface);
|
||||||
for (face = WINED3DCUBEMAP_FACE_POSITIVE_X; face <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++face)
|
if (FAILED(hr)) ERR("Failed to get src cube sub-resource %u, hr %#x.\n", i, hr);
|
||||||
|
hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)dst_texture, i, &dst_surface);
|
||||||
|
if (FAILED(hr)) ERR("Failed to get dst cube sub-resource %u, hr %#x.\n", i, hr);
|
||||||
|
hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL);
|
||||||
|
IWineD3DSurface_Release(dst_surface);
|
||||||
|
IWineD3DSurface_Release(src_surface);
|
||||||
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)src_texture,
|
WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr);
|
||||||
face, i, &src_surface);
|
return hr;
|
||||||
if (FAILED(hr)) ERR("Failed to get src cube surface face %u, level %u, hr %#x.\n", face, i, hr);
|
|
||||||
hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)dst_texture,
|
|
||||||
face, i, &dst_surface);
|
|
||||||
if (FAILED(hr)) ERR("Failed to get dst cube surface face %u, level %u, hr %#x.\n", face, i, hr);
|
|
||||||
hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL);
|
|
||||||
IWineD3DSurface_Release(dst_surface);
|
|
||||||
IWineD3DSurface_Release(src_surface);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -333,19 +333,6 @@ static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) {
|
||||||
return This->cond_np2;
|
return This->cond_np2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IWineD3DResourceImpl *texture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT sub_resource_idx)
|
|
||||||
{
|
|
||||||
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
|
|
||||||
|
|
||||||
if (sub_resource_idx >= sub_count)
|
|
||||||
{
|
|
||||||
WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture->baseTexture.sub_resources[sub_resource_idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface,
|
static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface,
|
||||||
UINT sub_resource_idx, WINED3DSURFACE_DESC *desc)
|
UINT sub_resource_idx, WINED3DSURFACE_DESC *desc)
|
||||||
{
|
{
|
||||||
|
@ -354,7 +341,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface,
|
||||||
|
|
||||||
TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc);
|
TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc);
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -373,7 +360,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface
|
||||||
|
|
||||||
TRACE("iface %p, sub_resource_idx %u, surface %p.\n", iface, sub_resource_idx, surface);
|
TRACE("iface %p, sub_resource_idx %u, surface %p.\n", iface, sub_resource_idx, surface);
|
||||||
|
|
||||||
if (!(s = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -396,7 +383,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_Map(IWineD3DTexture *iface,
|
||||||
TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n",
|
TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n",
|
||||||
iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags);
|
iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags);
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -412,7 +399,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_Unmap(IWineD3DTexture *iface, UINT sub
|
||||||
|
|
||||||
TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx);
|
TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx);
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurface *)texture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -428,7 +415,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, c
|
||||||
|
|
||||||
TRACE("iface %p, dirty_rect %s.\n", iface, wine_dbgstr_rect(dirty_rect));
|
TRACE("iface %p, dirty_rect %s.\n", iface, wine_dbgstr_rect(dirty_rect));
|
||||||
|
|
||||||
if (!(surface = (IWineD3DSurfaceImpl *)texture_get_sub_resource(texture, 0)))
|
if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, 0)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
|
@ -249,19 +249,6 @@ static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *if
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IWineD3DResourceImpl *volumetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT sub_resource_idx)
|
|
||||||
{
|
|
||||||
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
|
|
||||||
|
|
||||||
if (sub_resource_idx >= sub_count)
|
|
||||||
{
|
|
||||||
WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture->baseTexture.sub_resources[sub_resource_idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTexture *iface,
|
static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTexture *iface,
|
||||||
UINT sub_resource_idx, WINED3DVOLUME_DESC *desc)
|
UINT sub_resource_idx, WINED3DVOLUME_DESC *desc)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +257,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTextu
|
||||||
|
|
||||||
TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc);
|
TRACE("iface %p, sub_resource_idx %u, desc %p.\n", iface, sub_resource_idx, desc);
|
||||||
|
|
||||||
if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -289,7 +276,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetVolumeLevel(IWineD3DVolumeTex
|
||||||
|
|
||||||
TRACE("iface %p, sub_resource_idx %u, volume %p.\n", iface, sub_resource_idx, volume);
|
TRACE("iface %p, sub_resource_idx %u, volume %p.\n", iface, sub_resource_idx, volume);
|
||||||
|
|
||||||
if (!(v= (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(v= (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -312,7 +299,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_Map(IWineD3DVolumeTexture *iface
|
||||||
TRACE("iface %p, sub_resource_idx %u, locked_box %p, box %p, flags %#x.\n",
|
TRACE("iface %p, sub_resource_idx %u, locked_box %p, box %p, flags %#x.\n",
|
||||||
iface, sub_resource_idx, locked_box, box, flags);
|
iface, sub_resource_idx, locked_box, box, flags);
|
||||||
|
|
||||||
if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -328,7 +315,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_Unmap(IWineD3DVolumeTexture *ifa
|
||||||
|
|
||||||
TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx);
|
TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx);
|
||||||
|
|
||||||
if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, sub_resource_idx)))
|
if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, sub_resource_idx)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
@ -344,7 +331,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTextur
|
||||||
|
|
||||||
TRACE("iface %p, dirty_box %p.\n", iface, dirty_box);
|
TRACE("iface %p, dirty_box %p.\n", iface, dirty_box);
|
||||||
|
|
||||||
if (!(volume = (IWineD3DVolume *)volumetexture_get_sub_resource(texture, 0)))
|
if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0)))
|
||||||
{
|
{
|
||||||
WARN("Failed to get sub-resource.\n");
|
WARN("Failed to get sub-resource.\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
|
@ -1916,7 +1916,7 @@ BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
|
||||||
DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
|
DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
|
||||||
DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
|
DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN;
|
||||||
IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture,
|
IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture,
|
||||||
UINT layer, UINT level) DECLSPEC_HIDDEN;
|
UINT sub_resource_idx) DECLSPEC_HIDDEN;
|
||||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
|
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
|
||||||
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
|
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
|
||||||
const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
|
const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
|
||||||
|
|
|
@ -2573,24 +2573,21 @@ interface IWineD3DTexture : IWineD3DBaseTexture
|
||||||
interface IWineD3DCubeTexture : IWineD3DBaseTexture
|
interface IWineD3DCubeTexture : IWineD3DBaseTexture
|
||||||
{
|
{
|
||||||
HRESULT GetLevelDesc(
|
HRESULT GetLevelDesc(
|
||||||
[in] UINT level,
|
[in] UINT sub_resource_idx,
|
||||||
[out] WINED3DSURFACE_DESC *desc
|
[out] WINED3DSURFACE_DESC *desc
|
||||||
);
|
);
|
||||||
HRESULT GetCubeMapSurface(
|
HRESULT GetCubeMapSurface(
|
||||||
[in] WINED3DCUBEMAP_FACES face,
|
[in] UINT sub_resource_idx,
|
||||||
[in] UINT level,
|
|
||||||
[out] IWineD3DSurface **surface
|
[out] IWineD3DSurface **surface
|
||||||
);
|
);
|
||||||
HRESULT Map(
|
HRESULT Map(
|
||||||
[in] WINED3DCUBEMAP_FACES face,
|
[in] UINT sub_resource_idx,
|
||||||
[in] UINT level,
|
|
||||||
[out] WINED3DLOCKED_RECT *locked_rect,
|
[out] WINED3DLOCKED_RECT *locked_rect,
|
||||||
[in] const RECT *rect,
|
[in] const RECT *rect,
|
||||||
[in] DWORD flags
|
[in] DWORD flags
|
||||||
);
|
);
|
||||||
HRESULT Unmap(
|
HRESULT Unmap(
|
||||||
[in] WINED3DCUBEMAP_FACES face,
|
[in] UINT sub_resource_idx
|
||||||
[in] UINT level
|
|
||||||
);
|
);
|
||||||
HRESULT AddDirtyRect(
|
HRESULT AddDirtyRect(
|
||||||
[in] WINED3DCUBEMAP_FACES face,
|
[in] WINED3DCUBEMAP_FACES face,
|
||||||
|
|
Loading…
Reference in New Issue