diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 792185f54..d523332cf 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -189,17 +189,31 @@ namespace dxvk { // We don't support tiled resources if (pDesc->MiscFlags & (D3D11_RESOURCE_MISC_TILE_POOL | D3D11_RESOURCE_MISC_TILED)) return E_INVALIDARG; + + // Constant buffer size must be a multiple of 16 + if ((pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER) + && (pDesc->ByteWidth & 0xF)) + return E_INVALIDARG; // Basic validation for structured buffers if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) - && ((pDesc->StructureByteStride == 0) + && ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS) + || (pDesc->StructureByteStride == 0) || (pDesc->StructureByteStride & 0x3))) return E_INVALIDARG; + + // Basic validation for raw buffers + if ((pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS) + && (!(pDesc->BindFlags & (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS)))) + return E_INVALIDARG; // Mip generation obviously doesn't work for buffers if (pDesc->MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS) return E_INVALIDARG; + if (!(pDesc->MiscFlags & D3D11_RESOURCE_MISC_BUFFER_STRUCTURED)) + pDesc->StructureByteStride = 0; + return S_OK; }