On 6 October 2014 13:42, Stefan Dösinger stefan@codeweavers.com wrote:
+static BOOL wined3d_swapchain_mode_changed(const struct wined3d_swapchain *swapchain) +{
- return swapchain->desc.backbuffer_width != swapchain->original_mode.width
|| swapchain->desc.backbuffer_height != swapchain->original_mode.height
|| swapchain->desc.backbuffer_format != swapchain->original_mode.format_id
|| swapchain->desc.refresh_rate != swapchain->original_mode.refresh_rate;
+}
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) { if (!activate)
- {
if (wined3d_swapchain_mode_changed(swapchain))
{
if (FAILED(wined3d_set_adapter_display_mode(swapchain->device->wined3d,
swapchain->device->adapter->ordinal, &swapchain->original_mode)))
ERR("Failed to set display mode.\n");
swapchain->reapply_mode = TRUE;
This seems to imply that if an application created a fullscreen swapchain at the current display resolution, but then some external mode change happened, we should keep the mode from the external mode change on focus loss, but then change it on reset. That may be correct, but it's certainly more complicated than just resetting the original mode on focus loss, and I don't see tests. As a follow up, it would perhaps also be interesting to verify that in some of the places where we're currently using "original_mode", we really shouldn't be using EnumDisplaySettings() with ENUM_REGISTRY_SETTINGS instead.
Am 06.10.2014 um 15:48 schrieb Henri Verbeet hverbeet@gmail.com:
This seems to imply that if an application created a fullscreen swapchain at the current display resolution, but then some external mode change happened, we should keep the mode from the external mode change on focus loss, but then change it on reset. That may be correct, but it's certainly more complicated than just resetting the original mode on focus loss, and I don't see tests.
I expect this to just crash and burn on Windows, but I'll check. Where would an external mode change come from without a focus loss?
The purpose of the wined3d_swapchain_mode_changed() is to prevent redundant mode changes, although most drivers seem to gracefully ignore them in practice.
As a follow up, it would perhaps also be interesting to verify that in some of the places where we're currently using "original_mode", we really shouldn't be using EnumDisplaySettings() with ENUM_REGISTRY_SETTINGS instead.
That sounds like a reasonable thing to test, yeah.
Am 06.10.2014 um 16:40 schrieb Stefan Dösinger stefandoesinger@gmail.com:
I expect this to just crash and burn on Windows, but I'll check. Where would an external mode change come from without a focus loss?
Thinking about it, the app calling ChangeDisplaySettings behind d3d's back isn't too far fetched.