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:
parent
6a76577f15
commit
63d8d9c3db
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user