Skip to content

Commit

Permalink
Use at least one BackBuffer in D3D8DeviceEx
Browse files Browse the repository at this point in the history
Gets Red Faction going up to the game menu and mirrors what D3D9 does. I *think* I'm doing the right thing here, but please treat all my PRs as coming from a monkey with a wrench inside of a nuclear reactor.

This was discovered while investigating a crash in IDirect3DDevice8::GetBackBuffer. Red Faction will create a IDirect3DDevice8 with BackBufferCount = 0, then call GetBackBuffer for iBackBuffer = 0, which would trigger a crash.
  • Loading branch information
WinterSnowfall authored Jan 23, 2023
1 parent 2e226a7 commit d25a5e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/d3d8/d3d8_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ namespace dxvk {
D3DRS_ZVISIBLE,
D3DRS_PATCHSEGMENTS
);

// Mirrors how D3D9 handles the BackBufferCount
m_presentParams.BackBufferCount = std::max(m_presentParams.BackBufferCount, 1u);

m_textures.fill(nullptr);
m_streams.fill(D3D8VBO());
Expand Down Expand Up @@ -547,4 +550,4 @@ namespace dxvk {
return pPixelShader->GetFunction(pData, &SizeOfData);
}

} // namespace dxvk
} // namespace dxvk

0 comments on commit d25a5e4

Please sign in to comment.