mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d11] Validate buffer view format compatibility
Prevents the app from creating illegal buffer views.
This commit is contained in:
parent
9373bab3e3
commit
f9e096e954
@ -74,8 +74,12 @@ namespace dxvk {
|
|||||||
if ((m_buffer->info().usage & usage) != usage)
|
if ((m_buffer->info().usage & usage) != usage)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO implement format validation
|
// Check whether the given combination of buffer view
|
||||||
return true;
|
// type and view format is supported by the device
|
||||||
|
DXGI_VK_FORMAT_INFO viewFormat = m_device->LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY);
|
||||||
|
VkFormatFeatureFlags features = GetBufferFormatFeatures(BindFlags);
|
||||||
|
|
||||||
|
return CheckFormatFeatureSupport(viewFormat.Format, features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,6 +167,14 @@ namespace dxvk {
|
|||||||
|
|
||||||
return m_device->GetDXVKDevice()->createBuffer(info, memoryFlags);
|
return m_device->GetDXVKDevice()->createBuffer(info, memoryFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL D3D11Buffer::CheckFormatFeatureSupport(
|
||||||
|
VkFormat Format,
|
||||||
|
VkFormatFeatureFlags Features) const {
|
||||||
|
VkFormatProperties properties = m_device->GetDXVKDevice()->adapter()->formatProperties(Format);
|
||||||
|
return (properties.bufferFeatures & Features) == Features;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) {
|
D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) {
|
||||||
|
@ -82,7 +82,11 @@ namespace dxvk {
|
|||||||
DxvkPhysicalBufferSlice m_mappedSlice;
|
DxvkPhysicalBufferSlice m_mappedSlice;
|
||||||
|
|
||||||
Rc<DxvkBuffer> CreateBuffer(
|
Rc<DxvkBuffer> CreateBuffer(
|
||||||
const D3D11_BUFFER_DESC* pDesc) const;
|
const D3D11_BUFFER_DESC* pDesc) const;
|
||||||
|
|
||||||
|
BOOL CheckFormatFeatureSupport(
|
||||||
|
VkFormat Format,
|
||||||
|
VkFormatFeatureFlags Features) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user