mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 22:08:59 +01:00
[d3d11] Add ResourceAddRef/ReleasePrivate with known resource type
This commit is contained in:
parent
6b91b87dba
commit
391c9e13ca
@ -198,11 +198,8 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT ResourceAddRefPrivate(ID3D11Resource* pResource) {
|
||||
D3D11_RESOURCE_DIMENSION dim;
|
||||
pResource->GetType(&dim);
|
||||
|
||||
switch (dim) {
|
||||
HRESULT ResourceAddRefPrivate(ID3D11Resource* pResource, D3D11_RESOURCE_DIMENSION Type) {
|
||||
switch (Type) {
|
||||
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;
|
||||
@ -212,11 +209,16 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT ResourceReleasePrivate(ID3D11Resource* pResource) {
|
||||
HRESULT ResourceAddRefPrivate(ID3D11Resource* pResource) {
|
||||
D3D11_RESOURCE_DIMENSION dim;
|
||||
pResource->GetType(&dim);
|
||||
|
||||
switch (dim) {
|
||||
return ResourceAddRefPrivate(pResource, dim);
|
||||
}
|
||||
|
||||
|
||||
HRESULT ResourceReleasePrivate(ID3D11Resource* pResource, D3D11_RESOURCE_DIMENSION Type) {
|
||||
switch (Type) {
|
||||
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;
|
||||
@ -225,4 +227,12 @@ namespace dxvk {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT ResourceReleasePrivate(ID3D11Resource* pResource) {
|
||||
D3D11_RESOURCE_DIMENSION dim;
|
||||
pResource->GetType(&dim);
|
||||
|
||||
return ResourceReleasePrivate(pResource, dim);
|
||||
}
|
||||
|
||||
}
|
@ -128,19 +128,29 @@ namespace dxvk {
|
||||
* Helper method that figures out the exact type of
|
||||
* the resource and calls its \c AddRefPrivate method.
|
||||
* \param [in] pResource The resource to reference
|
||||
* \param [in] Type Resource type
|
||||
* \returns \c S_OK, or \c E_INVALIDARG for an invalid resource
|
||||
*/
|
||||
HRESULT ResourceAddRefPrivate(
|
||||
ID3D11Resource* pResource);
|
||||
ID3D11Resource* pResource,
|
||||
D3D11_RESOURCE_DIMENSION Type);
|
||||
|
||||
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
|
||||
* \param [in] Type Resource type
|
||||
* \returns \c S_OK, or \c E_INVALIDARG for an invalid resource
|
||||
*/
|
||||
HRESULT ResourceReleasePrivate(
|
||||
ID3D11Resource* pResource,
|
||||
D3D11_RESOURCE_DIMENSION Type);
|
||||
|
||||
HRESULT ResourceReleasePrivate(
|
||||
ID3D11Resource* pResource);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user