1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-14 04:29:15 +01:00

Merge d33943f424c534ae3d41229c02da6b80e119f6d7 into c04410ca00f33162d0875bc8500d3f8185bc73df

This commit is contained in:
Robin Kertels 2025-02-28 17:51:07 +01:00 committed by GitHub
commit 015d884ffa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 5 deletions

View File

@ -167,8 +167,19 @@ namespace dxvk {
UpdatePresentRegion(pSourceRect, pDestRect);
UpdatePresentParameters();
if (!SwapWithFrontBuffer()) {
// We never actually rotate in the front buffer.
// Just blit to it for GetFrontBufferData.
const auto& backbuffer = m_backBuffers[0];
const auto& frontbuffer = GetFrontBuffer();
if (FAILED(m_parent->StretchRect(backbuffer.ptr(), nullptr, frontbuffer.ptr(), nullptr, D3DTEXF_NONE))) {
Logger::err("Failed to blit to front buffer");
}
}
#ifdef _WIN32
const bool useGDIFallback = m_partialCopy && !HasFrontBuffer();
const bool useGDIFallback = m_partialCopy && !SwapWithFrontBuffer();
if (useGDIFallback)
return PresentImageGDI(m_window);
#endif
@ -925,7 +936,13 @@ namespace dxvk {
// Rotate swap chain buffers so that the back
// buffer at index 0 becomes the front buffer.
for (uint32_t i = 1; i < m_backBuffers.size(); i++)
uint32_t rotatingBufferCount = m_backBuffers.size();
if (!SwapWithFrontBuffer()) {
// The front buffer only exists for GetFrontBufferData
// and the application cannot obserse buffer swapping in GetBackBuffer()
rotatingBufferCount -= 1;
}
for (uint32_t i = 1; i < rotatingBufferCount; i++)
m_backBuffers[i]->Swap(m_backBuffers[i - 1].ptr());
m_parent->m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
@ -995,8 +1012,7 @@ namespace dxvk {
// creating a new one to free up resources
DestroyBackBuffers();
int NumFrontBuffer = HasFrontBuffer() ? 1 : 0;
const uint32_t NumBuffers = NumBackBuffers + NumFrontBuffer;
const uint32_t NumBuffers = NumBackBuffers + 1; // 1 additional front buffer
m_backBuffers.reserve(NumBuffers);

View File

@ -243,7 +243,7 @@ namespace dxvk {
return m_backBuffers.back();
}
bool HasFrontBuffer() const {
bool SwapWithFrontBuffer() const {
if (m_presentParams.SwapEffect == D3DSWAPEFFECT_COPY)
return false;