mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[dxvk] Implement native discardBuffer function in the backend
This may be more efficient because it avoids renaming the buffer in case it can be used without inserting additional barriers.
This commit is contained in:
parent
fb88070888
commit
fe66e668e5
@ -2728,8 +2728,7 @@ namespace dxvk {
|
||||
void D3D11DeviceContext::DiscardBuffer(
|
||||
D3D11Buffer* pBuffer) {
|
||||
EmitCs([cBuffer = pBuffer->GetBuffer()] (DxvkContext* ctx) {
|
||||
ctx->invalidateBuffer(cBuffer,
|
||||
cBuffer->allocPhysicalSlice());
|
||||
ctx->discardBuffer(cBuffer);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -941,6 +941,17 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::discardBuffer(
|
||||
const Rc<DxvkBuffer>& buffer) {
|
||||
DxvkAccessFlags accessFlags(
|
||||
DxvkAccess::Read,
|
||||
DxvkAccess::Write);
|
||||
|
||||
if (m_barriers.isBufferDirty(buffer->slice(), accessFlags))
|
||||
this->invalidateBuffer(buffer, buffer->allocPhysicalSlice());
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::dispatch(
|
||||
uint32_t x,
|
||||
uint32_t y,
|
||||
|
@ -322,6 +322,18 @@ namespace dxvk {
|
||||
VkOffset3D srcOffset,
|
||||
VkExtent3D srcExtent);
|
||||
|
||||
/**
|
||||
* \brief Discards a buffer
|
||||
*
|
||||
* Renames the buffer in case it is currently
|
||||
* used by the GPU in order to avoid having to
|
||||
* insert barriers before future commands using
|
||||
* the buffer.
|
||||
* \param [in] buffer The buffer to discard
|
||||
*/
|
||||
void discardBuffer(
|
||||
const Rc<DxvkBuffer>& buffer);
|
||||
|
||||
/**
|
||||
* \brief Starts compute jobs
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user