mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[dxvk,d3d11] Fix draw buffer tracking for DrawAuto
Not like anybody uses this feature, but we need to both check for hazards and make sure the SO counter actually gets tracked. Use the existing draw buffer mechanism for this.
This commit is contained in:
parent
ff2faa4b1b
commit
eaa2c9f513
3 changed files with 27 additions and 13 deletions
|
@ -1009,10 +1009,22 @@ namespace dxvk {
|
||||||
if (!ctrBuf.defined())
|
if (!ctrBuf.defined())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EmitCs([=] (DxvkContext* ctx) {
|
// We bind the SO counter as an indirect count buffer,
|
||||||
ctx->drawIndirectXfb(ctrBuf,
|
// so reset any tracking we may have been doing here.
|
||||||
|
m_state.id.reset();
|
||||||
|
|
||||||
|
EmitCs([=] (DxvkContext* ctx) mutable {
|
||||||
|
ctx->bindDrawBuffers(DxvkBufferSlice(),
|
||||||
|
Forwarder::move(ctrBuf));
|
||||||
|
|
||||||
|
ctx->drawIndirectXfb(0u,
|
||||||
vtxBuf.buffer()->getXfbVertexStride(),
|
vtxBuf.buffer()->getXfbVertexStride(),
|
||||||
vtxBuf.offset());
|
vtxBuf.offset());
|
||||||
|
|
||||||
|
// Reset draw buffer right away so we don't
|
||||||
|
// keep the SO counter alive indefinitely
|
||||||
|
ctx->bindDrawBuffers(DxvkBufferSlice(),
|
||||||
|
DxvkBufferSlice());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1052,17 +1052,19 @@ namespace dxvk {
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::drawIndirectXfb(
|
void DxvkContext::drawIndirectXfb(
|
||||||
const DxvkBufferSlice& counterBuffer,
|
VkDeviceSize counterOffset,
|
||||||
uint32_t counterDivisor,
|
uint32_t counterDivisor,
|
||||||
uint32_t counterBias) {
|
uint32_t counterBias) {
|
||||||
if (this->commitGraphicsState<false, false>()) {
|
if (this->commitGraphicsState<false, true>()) {
|
||||||
auto physSlice = counterBuffer.getSliceHandle();
|
auto physSlice = m_state.id.cntBuffer.getSliceHandle();
|
||||||
|
|
||||||
m_cmd->cmdDrawIndirectVertexCount(1, 0,
|
m_cmd->cmdDrawIndirectVertexCount(1, 0,
|
||||||
physSlice.handle,
|
physSlice.handle, physSlice.offset + counterOffset,
|
||||||
physSlice.offset,
|
counterBias, counterDivisor);
|
||||||
counterBias,
|
|
||||||
counterDivisor);
|
// The count will generally be written from streamout
|
||||||
|
if (likely(m_state.id.cntBuffer.buffer()->hasGfxStores()))
|
||||||
|
accessDrawCountBuffer(counterOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -832,14 +832,14 @@ namespace dxvk {
|
||||||
uint32_t stride);
|
uint32_t stride);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Transform feddback draw call
|
* \brief Transform feedback draw call
|
||||||
|
*
|
||||||
* \param [in] counterBuffer Xfb counter buffer
|
* \param [in] counterOffset Draw count offset
|
||||||
* \param [in] counterDivisor Vertex stride
|
* \param [in] counterDivisor Vertex stride
|
||||||
* \param [in] counterBias Counter bias
|
* \param [in] counterBias Counter bias
|
||||||
*/
|
*/
|
||||||
void drawIndirectXfb(
|
void drawIndirectXfb(
|
||||||
const DxvkBufferSlice& counterBuffer,
|
VkDeviceSize counterOffset,
|
||||||
uint32_t counterDivisor,
|
uint32_t counterDivisor,
|
||||||
uint32_t counterBias);
|
uint32_t counterBias);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue