1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 13:24:10 +01:00

[d3d11] Validate buffer descriptions

This commit is contained in:
Philip Rebohle 2019-06-13 03:06:11 +02:00
parent 6a76577f15
commit 63d8d9c3db
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 28 additions and 0 deletions

View File

@ -198,6 +198,22 @@ namespace dxvk {
}
HRESULT D3D11Buffer::ValidateBufferProperties(
const D3D11_BUFFER_DESC* pDesc) {
// Basic validation for structured buffers
if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED)
&& ((pDesc->StructureByteStride == 0)
|| (pDesc->StructureByteStride & 0x3)))
return E_INVALIDARG;
// Mip generation obviously doesn't work for buffers
if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS)
return E_INVALIDARG;
return S_OK;
}
BOOL D3D11Buffer::CheckFormatFeatureSupport(
VkFormat Format,
VkFormatFeatureFlags Features) const {

View File

@ -112,6 +112,15 @@ namespace dxvk {
return &m_d3d10;
}
/**
* \brief Validates buffer description
*
* \param [in] pDesc Buffer description
* \returns \c S_OK if the parameters are valid
*/
static HRESULT ValidateBufferProperties(
const D3D11_BUFFER_DESC* pDesc);
private:
const Com<D3D11Device> m_device;

View File

@ -80,6 +80,9 @@ namespace dxvk {
if (pDesc == nullptr)
return E_INVALIDARG;
if (FAILED(D3D11Buffer::ValidateBufferProperties(pDesc)))
return E_INVALIDARG;
if (ppBuffer == nullptr)
return S_FALSE;