Accept a 24 bpp desktop when a 32 bpp mode is requested - #11
Open
f1nalspace wants to merge 1 commit into
Open
f1nalspace wants to merge 1 commit into
f1nalspace wants to merge 1 commit into
Conversation
Both depths map to WINED3DFMT_B8G8R8X8_UNORM, so a mode change is neither needed nor possible on a driver that offers only one of them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creating a fullscreen DirectDraw or Direct3D device fails on a display driver whose
desktop runs at 24 bpp and that has no 32 bpp mode at all. The application usually does
not survive it:
ddraw_create_swapchain()fails,ddraw7_SetCooperativeLevel()onlylogs the error and carries on, and the next
CreateSurface()for the primary surfacedereferences the swapchain that was never created.
wined3d_set_adapter_display_mode()derives the depth to set from the format:For
WINED3DFMT_B8G8R8X8_UNORMthat is always 32. Butpixelformat_for_depth()mapsboth 24 and 32 bpp to that same format:
So on a 24 bpp desktop the "only change the mode if necessary" test compares 24 against
32, decides a mode change is needed, and calls
ChangeDisplaySettingsEx()with a depththe driver does not offer. It answers
DISP_CHANGE_BADMODE, and the swapchain is gone.This changes two things:
desktop and a 32 bpp request count as the same mode and no change is attempted;
DISP_CHANGE_BADMODEat 32 bpp is retried at24 bpp, since both carry the same D3D format.
Found under QEMU with the Cirrus GD5446 driver on Windows XP, whose modes are 8/16/24 bpp.
Before the change every fullscreen DirectDraw application crashed on the primary surface;
after it the same test program enumerates the HAL and renders at 9739 FPS. The relevant
lines from a build with logging enabled:
How to reproduce, without the qemu-3dfx pieces: a Windows 2000/XP guest on QEMU's
-device cirrus-vga, whose XP driver offers 8/16/24 bpp and no 32 bpp at all, so thedesktop sits at 24 bpp. Any application that creates a fullscreen device through
wined3d.dllruns into it — the mode change is attempted inwined3d_set_adapter_display_mode(), below bothwinedd.dllandwined8.dll, soDirectDraw and Direct3D 8 are affected alike. A windowed device never gets there,
which is why the same DLLs pass every windowed test.
What was observed here is a small DirectDraw/Direct3D 7 test program rather than a game:
https://github.com/f1nalspace/qemu-3dfx/tree/master/tools/ddcube. It enumerates the
driver and then creates a fullscreen device — without this change it never gets a
swapchain and dies on the primary surface, with it the same binary renders at 9739 FPS.