1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-18 13:54:16 +01:00

[d3d11] Introduce GetCommonBuffer helper

Also update GetCommonTexture documentation.
This commit is contained in:
Philip Rebohle 2018-08-05 18:29:29 +02:00
parent ace8e42213
commit 66e178756e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 23 additions and 4 deletions

View File

@ -150,4 +150,14 @@ namespace dxvk {
return m_device->GetDXVKDevice()->createBuffer(info, memoryFlags);
}
D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) {
D3D11_RESOURCE_DIMENSION dimension = D3D11_RESOURCE_DIMENSION_UNKNOWN;
pResource->GetType(&dimension);
return dimension == D3D11_RESOURCE_DIMENSION_BUFFER
? static_cast<D3D11Buffer*>(pResource)
: nullptr;
}
}

View File

@ -77,5 +77,15 @@ namespace dxvk {
const D3D11_BUFFER_DESC* pDesc) const;
};
/**
* \brief Retrieves buffer from resource pointer
*
* \param [in] pResource The resource to query
* \returns Pointer to buffer, or \c nullptr
*/
D3D11Buffer* GetCommonBuffer(
ID3D11Resource* pResource);
}

View File

@ -365,11 +365,10 @@ namespace dxvk {
/**
* \brief Retrieves common info about a texture
* \brief Retrieves texture from resource pointer
*
* \param [in] pResource The resource. Must be a texture.
* \param [out] pTextureInfo Pointer to the texture info struct.
* \returns E_INVALIDARG if the resource is not a texture
* \param [in] pResource The resource to query
* \returns Pointer to texture info, or \c nullptr
*/
D3D11CommonTexture* GetCommonTexture(
ID3D11Resource* pResource);