mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 22:54:16 +01:00
[d3d9] Cleanup private ref code for subresources
This commit is contained in:
parent
42089d73c5
commit
837861ffdd
@ -31,21 +31,18 @@ namespace dxvk {
|
|||||||
pBaseTexture) { }
|
pBaseTexture) { }
|
||||||
|
|
||||||
void D3D9Surface::AddRefPrivate(bool swapchain) {
|
void D3D9Surface::AddRefPrivate(bool swapchain) {
|
||||||
IDirect3DBaseTexture9* pBaseTexture = this->m_baseTexture;
|
if (m_baseTexture != nullptr) {
|
||||||
IUnknown* pSwapChain = this->m_container;
|
D3DRESOURCETYPE type = m_baseTexture->GetType();
|
||||||
|
|
||||||
if (pBaseTexture != nullptr) {
|
|
||||||
D3DRESOURCETYPE type = pBaseTexture->GetType();
|
|
||||||
if (type == D3DRTYPE_TEXTURE)
|
if (type == D3DRTYPE_TEXTURE)
|
||||||
reinterpret_cast<D3D9Texture2D*> (pBaseTexture)->AddRefPrivate();
|
static_cast<D3D9Texture2D*> (m_baseTexture)->AddRefPrivate();
|
||||||
else //if (type == D3DRTYPE_CUBETEXTURE)
|
else //if (type == D3DRTYPE_CUBETEXTURE)
|
||||||
reinterpret_cast<D3D9TextureCube*>(pBaseTexture)->AddRefPrivate();
|
static_cast<D3D9TextureCube*>(m_baseTexture)->AddRefPrivate();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (pSwapChain != nullptr && !swapchain) {
|
else if (m_container != nullptr && !swapchain) {
|
||||||
// Container must be a swapchain if it isn't a base texture.
|
// Container must be a swapchain if it isn't a base texture.
|
||||||
reinterpret_cast<D3D9SwapChainEx*>(pSwapChain)->AddRefPrivate();
|
static_cast<D3D9SwapChainEx*>(m_container)->AddRefPrivate();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -54,21 +51,18 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void D3D9Surface::ReleasePrivate(bool swapchain) {
|
void D3D9Surface::ReleasePrivate(bool swapchain) {
|
||||||
IDirect3DBaseTexture9* pBaseTexture = this->m_baseTexture;
|
if (m_baseTexture != nullptr) {
|
||||||
IUnknown* pSwapChain = this->m_container;
|
D3DRESOURCETYPE type = m_baseTexture->GetType();
|
||||||
|
|
||||||
if (pBaseTexture != nullptr) {
|
|
||||||
D3DRESOURCETYPE type = pBaseTexture->GetType();
|
|
||||||
if (type == D3DRTYPE_TEXTURE)
|
if (type == D3DRTYPE_TEXTURE)
|
||||||
reinterpret_cast<D3D9Texture2D*> (pBaseTexture)->ReleasePrivate();
|
static_cast<D3D9Texture2D*> (m_baseTexture)->ReleasePrivate();
|
||||||
else //if (type == D3DRTYPE_CUBETEXTURE)
|
else //if (type == D3DRTYPE_CUBETEXTURE)
|
||||||
reinterpret_cast<D3D9TextureCube*>(pBaseTexture)->ReleasePrivate();
|
static_cast<D3D9TextureCube*>(m_baseTexture)->ReleasePrivate();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (pSwapChain != nullptr && !swapchain) {
|
else if (m_container != nullptr && !swapchain) {
|
||||||
// Container must be a swapchain if it isn't a base texture.
|
// Container must be a swapchain if it isn't a base texture.
|
||||||
reinterpret_cast<D3D9SwapChainEx*>(pSwapChain)->ReleasePrivate();
|
static_cast<D3D9SwapChainEx*>(m_container)->ReleasePrivate();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void D3D9Volume::AddRefPrivate() {
|
void D3D9Volume::AddRefPrivate() {
|
||||||
IDirect3DBaseTexture9* pContainer = this->m_baseTexture;
|
|
||||||
|
|
||||||
// Can't have a swapchain container for a volume.
|
// Can't have a swapchain container for a volume.
|
||||||
|
if (m_baseTexture != nullptr) {
|
||||||
if (pContainer != nullptr) {
|
static_cast<D3D9Texture3D*>(m_baseTexture)->AddRefPrivate();
|
||||||
reinterpret_cast<D3D9Texture3D*> (pContainer)->AddRefPrivate();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +42,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void D3D9Volume::ReleasePrivate() {
|
void D3D9Volume::ReleasePrivate() {
|
||||||
IDirect3DBaseTexture9* pContainer = this->m_baseTexture;
|
|
||||||
|
|
||||||
// Can't have a swapchain container for a volume.
|
// Can't have a swapchain container for a volume.
|
||||||
|
if (m_baseTexture != nullptr) {
|
||||||
if (pContainer != nullptr) {
|
static_cast<D3D9Texture3D*>(m_baseTexture)->ReleasePrivate();
|
||||||
reinterpret_cast<D3D9Texture3D*> (pContainer)->ReleasePrivate();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user