[d3d11] Validate buffer view bind flags

This commit is contained in:
Philip Rebohle 2018-08-09 22:04:03 +02:00
parent b06eb4fe2a
commit f586970c59
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 20 additions and 1 deletions

View File

@ -65,6 +65,20 @@ namespace dxvk {
}
bool D3D11Buffer::CheckViewCompatibility(
UINT BindFlags,
DXGI_FORMAT Format) const {
// Check whether the given bind flags are supported
VkBufferUsageFlags usage = GetBufferUsageFlags(BindFlags);
if ((m_buffer->info().usage & usage) != usage)
return false;
// TODO implement format validation
return true;
}
Rc<DxvkBuffer> D3D11Buffer::CreateBuffer(
const D3D11_BUFFER_DESC* pDesc) const {
DxvkBufferCreateInfo info;

View File

@ -37,6 +37,10 @@ namespace dxvk {
void STDMETHODCALLTYPE GetDesc(
D3D11_BUFFER_DESC *pDesc) final;
bool CheckViewCompatibility(
UINT BindFlags,
DXGI_FORMAT Format) const;
const D3D11_BUFFER_DESC* Desc() const {
return &m_desc;
}

View File

@ -35,10 +35,11 @@ namespace dxvk {
UINT BindFlags,
DXGI_FORMAT Format) {
auto texture = GetCommonTexture(pResource);
auto buffer = GetCommonBuffer (pResource);
return texture != nullptr
? texture->CheckViewCompatibility(BindFlags, Format)
: true; /* for buffers */
: buffer ->CheckViewCompatibility(BindFlags, Format);
}