mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +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) { }
|
||||
|
||||
void D3D9Surface::AddRefPrivate(bool swapchain) {
|
||||
IDirect3DBaseTexture9* pBaseTexture = this->m_baseTexture;
|
||||
IUnknown* pSwapChain = this->m_container;
|
||||
|
||||
if (pBaseTexture != nullptr) {
|
||||
D3DRESOURCETYPE type = pBaseTexture->GetType();
|
||||
if (m_baseTexture != nullptr) {
|
||||
D3DRESOURCETYPE type = m_baseTexture->GetType();
|
||||
if (type == D3DRTYPE_TEXTURE)
|
||||
reinterpret_cast<D3D9Texture2D*> (pBaseTexture)->AddRefPrivate();
|
||||
static_cast<D3D9Texture2D*> (m_baseTexture)->AddRefPrivate();
|
||||
else //if (type == D3DRTYPE_CUBETEXTURE)
|
||||
reinterpret_cast<D3D9TextureCube*>(pBaseTexture)->AddRefPrivate();
|
||||
static_cast<D3D9TextureCube*>(m_baseTexture)->AddRefPrivate();
|
||||
|
||||
return;
|
||||
}
|
||||
else if (pSwapChain != nullptr && !swapchain) {
|
||||
else if (m_container != nullptr && !swapchain) {
|
||||
// Container must be a swapchain if it isn't a base texture.
|
||||
reinterpret_cast<D3D9SwapChainEx*>(pSwapChain)->AddRefPrivate();
|
||||
static_cast<D3D9SwapChainEx*>(m_container)->AddRefPrivate();
|
||||
|
||||
return;
|
||||
}
|
||||
@ -54,21 +51,18 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
void D3D9Surface::ReleasePrivate(bool swapchain) {
|
||||
IDirect3DBaseTexture9* pBaseTexture = this->m_baseTexture;
|
||||
IUnknown* pSwapChain = this->m_container;
|
||||
|
||||
if (pBaseTexture != nullptr) {
|
||||
D3DRESOURCETYPE type = pBaseTexture->GetType();
|
||||
if (m_baseTexture != nullptr) {
|
||||
D3DRESOURCETYPE type = m_baseTexture->GetType();
|
||||
if (type == D3DRTYPE_TEXTURE)
|
||||
reinterpret_cast<D3D9Texture2D*> (pBaseTexture)->ReleasePrivate();
|
||||
static_cast<D3D9Texture2D*> (m_baseTexture)->ReleasePrivate();
|
||||
else //if (type == D3DRTYPE_CUBETEXTURE)
|
||||
reinterpret_cast<D3D9TextureCube*>(pBaseTexture)->ReleasePrivate();
|
||||
static_cast<D3D9TextureCube*>(m_baseTexture)->ReleasePrivate();
|
||||
|
||||
return;
|
||||
}
|
||||
else if (pSwapChain != nullptr && !swapchain) {
|
||||
else if (m_container != nullptr && !swapchain) {
|
||||
// Container must be a swapchain if it isn't a base texture.
|
||||
reinterpret_cast<D3D9SwapChainEx*>(pSwapChain)->ReleasePrivate();
|
||||
static_cast<D3D9SwapChainEx*>(m_container)->ReleasePrivate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -31,12 +31,9 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D9Volume::AddRefPrivate() {
|
||||
IDirect3DBaseTexture9* pContainer = this->m_baseTexture;
|
||||
|
||||
// Can't have a swapchain container for a volume.
|
||||
|
||||
if (pContainer != nullptr) {
|
||||
reinterpret_cast<D3D9Texture3D*> (pContainer)->AddRefPrivate();
|
||||
if (m_baseTexture != nullptr) {
|
||||
static_cast<D3D9Texture3D*>(m_baseTexture)->AddRefPrivate();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -45,12 +42,9 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D9Volume::ReleasePrivate() {
|
||||
IDirect3DBaseTexture9* pContainer = this->m_baseTexture;
|
||||
|
||||
// Can't have a swapchain container for a volume.
|
||||
|
||||
if (pContainer != nullptr) {
|
||||
reinterpret_cast<D3D9Texture3D*> (pContainer)->ReleasePrivate();
|
||||
if (m_baseTexture != nullptr) {
|
||||
static_cast<D3D9Texture3D*>(m_baseTexture)->ReleasePrivate();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user