1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Pre-clear buffers with D3D11_USAGE_DEFAULT

Some games may expect buffers, like images, to be pre-initialized.
This commit is contained in:
Philip Rebohle 2018-05-22 21:10:39 +02:00
parent 51104c104d
commit a39b9cb131
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1851,6 +1851,9 @@ namespace dxvk {
const D3D11_SUBRESOURCE_DATA* pInitialData) {
const DxvkBufferSlice bufferSlice = pBuffer->GetBufferSlice();
D3D11_BUFFER_DESC desc;
pBuffer->GetDesc(&desc);
if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) {
LockResourceInitContext();
@ -1860,6 +1863,16 @@ namespace dxvk {
bufferSlice.length(),
pInitialData->pSysMem);
UnlockResourceInitContext(1);
} else if (desc.Usage == D3D11_USAGE_DEFAULT) {
LockResourceInitContext();
m_resourceInitContext->clearBuffer(
bufferSlice.buffer(),
bufferSlice.offset(),
bufferSlice.length(),
0u);
UnlockResourceInitContext(1);
}
}