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

[dxvk] Add DXVK context method to transparently flush the command list

This is identical to what the D3D11 function did, but having it in this
place will allow us to potentially implement better flush heuristics
based on work done on the CS thread.
This commit is contained in:
Philip Rebohle 2018-11-01 13:24:42 +01:00
parent 36ccd46ae7
commit 8054e4a772
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 20 additions and 7 deletions

View File

@ -101,13 +101,8 @@ namespace dxvk {
if (m_csIsBusy || m_csChunk->commandCount() != 0) { if (m_csIsBusy || m_csChunk->commandCount() != 0) {
// Add commands to flush the threaded // Add commands to flush the threaded
// context, then flush the command list // context, then flush the command list
EmitCs([dev = m_device] (DxvkContext* ctx) { EmitCs([] (DxvkContext* ctx) {
dev->submitCommandList( ctx->flushCommandList();
ctx->endRecording(),
nullptr, nullptr);
ctx->beginRecording(
dev->createCommandList());
}); });
FlushCsChunk(); FlushCsChunk();

View File

@ -63,6 +63,16 @@ namespace dxvk {
m_cmd->endRecording(); m_cmd->endRecording();
return std::exchange(m_cmd, nullptr); return std::exchange(m_cmd, nullptr);
} }
void DxvkContext::flushCommandList() {
m_device->submitCommandList(
this->endRecording(),
nullptr, nullptr);
this->beginRecording(
m_device->createCommandList());
}
void DxvkContext::beginQuery(const DxvkQueryRevision& query) { void DxvkContext::beginQuery(const DxvkQueryRevision& query) {

View File

@ -62,6 +62,14 @@ namespace dxvk {
* \returns Active command list * \returns Active command list
*/ */
Rc<DxvkCommandList> endRecording(); Rc<DxvkCommandList> endRecording();
/**
* \brief Flushes command buffer
*
* Transparently submits the current command
* buffer and allocates a new one.
*/
void flushCommandList();
/** /**
* \brief Begins generating query data * \brief Begins generating query data