mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[d3d11] Add private ref count helpers for ID3D11Resource
This commit is contained in:
parent
c223e35608
commit
ffc87faed0
@ -50,4 +50,32 @@ namespace dxvk {
|
||||
: true; /* for buffers */
|
||||
}
|
||||
|
||||
|
||||
HRESULT ResourceAddRefPrivate(ID3D11Resource* pResource) {
|
||||
D3D11_RESOURCE_DIMENSION dim;
|
||||
pResource->GetType(&dim);
|
||||
|
||||
switch (dim) {
|
||||
case D3D11_RESOURCE_DIMENSION_BUFFER: static_cast<D3D11Buffer*> (pResource)->AddRefPrivate(); return S_OK;
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE1D: static_cast<D3D11Texture1D*>(pResource)->AddRefPrivate(); return S_OK;
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE2D: static_cast<D3D11Texture2D*>(pResource)->AddRefPrivate(); return S_OK;
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE3D: static_cast<D3D11Texture3D*>(pResource)->AddRefPrivate(); return S_OK;
|
||||
default: return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT ResourceReleasePrivate(ID3D11Resource* pResource) {
|
||||
D3D11_RESOURCE_DIMENSION dim;
|
||||
pResource->GetType(&dim);
|
||||
|
||||
switch (dim) {
|
||||
case D3D11_RESOURCE_DIMENSION_BUFFER: static_cast<D3D11Buffer*> (pResource)->ReleasePrivate(); return S_OK;
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE1D: static_cast<D3D11Texture1D*>(pResource)->ReleasePrivate(); return S_OK;
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE2D: static_cast<D3D11Texture2D*>(pResource)->ReleasePrivate(); return S_OK;
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE3D: static_cast<D3D11Texture3D*>(pResource)->ReleasePrivate(); return S_OK;
|
||||
default: return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -59,5 +59,27 @@ namespace dxvk {
|
||||
BOOL CheckResourceViewFormatCompatibility(
|
||||
ID3D11Resource* pResource,
|
||||
DXGI_FORMAT Format);
|
||||
|
||||
/**
|
||||
* \brief Increments private reference count of a resource
|
||||
*
|
||||
* Helper method that figures out the exact type of
|
||||
* the resource and calls its \c AddRefPrivate method.
|
||||
* \param [in] pResource The resource to reference
|
||||
* \returns \c S_OK, or \c E_INVALIDARG for an invalid resource
|
||||
*/
|
||||
HRESULT ResourceAddRefPrivate(
|
||||
ID3D11Resource* pResource);
|
||||
|
||||
/**
|
||||
* \brief Decrements private reference count of a resource
|
||||
*
|
||||
* Helper method that figures out the exact type of
|
||||
* the resource and calls its \c ReleasePrivate method.
|
||||
* \param [in] pResource The resource to reference
|
||||
* \returns \c S_OK, or \c E_INVALIDARG for an invalid resource
|
||||
*/
|
||||
HRESULT ResourceReleasePrivate(
|
||||
ID3D11Resource* pResource);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user