Don't end stream-out queries twice

This commit is contained in:
baldurk
2020-03-20 16:16:52 +00:00
parent 0e44c51450
commit 7ff8a95205
3 changed files with 50 additions and 13 deletions
+5 -2
View File
@@ -318,8 +318,11 @@ bool WrappedID3D11DeviceContext::Serialise_BeginCaptureFrame(SerialiserType &ser
{
ResourceId id = GetIDForResource(buf);
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
if(m_StreamOutCounters[id].running)
{
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
}
restart[b] = true;
}
+20 -8
View File
@@ -2212,8 +2212,11 @@ bool WrappedID3D11DeviceContext::Serialise_SOSetTargets(SerialiserType &ser, UIN
{
ResourceId id = GetIDForResource(buf);
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
if(m_StreamOutCounters[id].running)
{
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
}
}
}
@@ -2318,8 +2321,11 @@ void WrappedID3D11DeviceContext::SOSetTargets(UINT NumBuffers, ID3D11Buffer *con
{
ResourceId id = GetIDForResource(buf);
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
if(m_StreamOutCounters[id].running)
{
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
}
}
}
@@ -6447,8 +6453,11 @@ bool WrappedID3D11DeviceContext::Serialise_ClearState(SerialiserType &ser)
{
ResourceId id = GetIDForResource(buf);
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
if(m_StreamOutCounters[id].running)
{
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
}
}
}
@@ -6488,8 +6497,11 @@ void WrappedID3D11DeviceContext::ClearState()
{
ResourceId id = GetIDForResource(buf);
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
if(m_StreamOutCounters[id].running)
{
m_pRealContext->End(m_StreamOutCounters[id].query);
m_StreamOutCounters[id].running = false;
}
}
}
+25 -3
View File
@@ -165,9 +165,7 @@ RD_TEST(D3D11_Stream_Out, D3D11GraphicsTest)
IASetVertexBuffer(vb, sizeof(DefaultA2V), 0);
ctx->IASetInputLayout(defaultLayout);
// draw with streamout and clear state
ctx->SOSetTargets(2, bufs, offs);
ctx->DrawInstanced(3, 2, 0, 0);
// check that we can clear state after unbinding
ctx->ClearState();
ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
@@ -181,10 +179,34 @@ RD_TEST(D3D11_Stream_Out, D3D11GraphicsTest)
RSSetViewport({screenWidth / 4.0f, 0.0f, (float)screenWidth / 4.0f,
(float)screenHeight / 4.0f, 0.0f, 1.0f});
ctx->IASetVertexBuffers(0, 2, emptyBuf, &strides[0], offs);
IASetVertexBuffer(vb, sizeof(DefaultA2V), 0);
ctx->IASetInputLayout(defaultLayout);
// draw with streamout and clear state
ctx->SOSetTargets(2, bufs, offs);
ctx->DrawInstanced(3, 2, 0, 0);
ctx->ClearState();
ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
ctx->VSSetShader(vs, NULL, 0);
ctx->GSSetShader(gs, NULL, 0);
ctx->PSSetShader(ps, NULL, 0);
ctx->OMSetRenderTargets(1, &bbRTV.GetInterfacePtr(), NULL);
RSSetViewport({(screenWidth * 2.0f) / 4.0f, 0.0f, (float)screenWidth / 4.0f,
(float)screenHeight / 4.0f, 0.0f, 1.0f});
ctx->IASetVertexBuffers(0, 2, bufs, &strides[0], offs);
ctx->IASetInputLayout(streamoutLayout);
ctx->DrawAuto();
// leave stream-out buffers bound at the end of the frame
ctx->ClearState();
ctx->SOSetTargets(2, bufs, offs);
Present();
}