Skip to content

Commit

Permalink
[d3d9] Don't upload buffers before Up draws
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin committed Dec 19, 2023
1 parent 1b31aa5 commit 9ea827e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@ namespace dxvk {
if (unlikely(!PrimitiveCount))
return S_OK;

PrepareDraw(PrimitiveType);
PrepareDraw(PrimitiveType, false);

EmitCs([this,
cPrimType = PrimitiveType,
Expand Down Expand Up @@ -2652,7 +2652,7 @@ namespace dxvk {
if (unlikely(!PrimitiveCount))
return S_OK;

PrepareDraw(PrimitiveType);
PrepareDraw(PrimitiveType, false);

EmitCs([this,
cPrimType = PrimitiveType,
Expand Down Expand Up @@ -2688,7 +2688,7 @@ namespace dxvk {
if (unlikely(!PrimitiveCount))
return S_OK;

PrepareDraw(PrimitiveType);
PrepareDraw(PrimitiveType, true);

uint32_t vertexCount = GetVertexCount(PrimitiveType, PrimitiveCount);

Expand Down Expand Up @@ -2740,7 +2740,7 @@ namespace dxvk {
if (unlikely(!PrimitiveCount))
return S_OK;

PrepareDraw(PrimitiveType);
PrepareDraw(PrimitiveType, true);

uint32_t vertexCount = GetVertexCount(PrimitiveType, PrimitiveCount);

Expand Down Expand Up @@ -2827,7 +2827,7 @@ namespace dxvk {
D3D9CommonBuffer* dst = static_cast<D3D9VertexBuffer*>(pDestBuffer)->GetCommonBuffer();
D3D9VertexDecl* decl = static_cast<D3D9VertexDecl*> (pVertexDecl);

PrepareDraw(D3DPT_FORCE_DWORD);
PrepareDraw(D3DPT_FORCE_DWORD, true);

if (decl == nullptr) {
DWORD FVF = dst->Desc()->FVF;
Expand Down Expand Up @@ -6454,7 +6454,7 @@ namespace dxvk {
}


void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType) {
void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType, bool UpDraw) {
if (unlikely(m_activeHazardsRT != 0 || m_activeHazardsDS != 0))
MarkRenderHazards();

Expand All @@ -6467,7 +6467,7 @@ namespace dxvk {

for (uint32_t i = 0; i < caps::MaxStreams; i++) {
auto* vbo = GetCommonBuffer(m_state.vertexBuffers[i].vertexBuffer);
if (vbo != nullptr && vbo->NeedsUpload())
if (vbo != nullptr && vbo->NeedsUpload() && !UpDraw)
FlushBuffer(vbo);
}

Expand All @@ -6483,7 +6483,7 @@ namespace dxvk {
GenerateTextureMips(texturesToGen);

auto* ibo = GetCommonBuffer(m_state.indices);
if (ibo != nullptr && ibo->NeedsUpload())
if (ibo != nullptr && ibo->NeedsUpload() && !UpDraw)
FlushBuffer(ibo);

UpdateFog();
Expand Down
2 changes: 1 addition & 1 deletion src/d3d9/d3d9_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ namespace dxvk {

uint32_t GetInstanceCount() const;

void PrepareDraw(D3DPRIMITIVETYPE PrimitiveType);
void PrepareDraw(D3DPRIMITIVETYPE PrimitiveType, bool UpDraw);

template <DxsoProgramType ShaderStage>
void BindShader(
Expand Down

0 comments on commit 9ea827e

Please sign in to comment.