Skip to content

Commit 83a439d

Browse files
wiiu/render: Add a prevent swap window flag
This makes it possible to present TV/DRC-only windows without swapping the scanbuffers and thus preventing a v-sync.
1 parent 63173cd commit 83a439d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

include/SDL_video.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ typedef enum
126126
SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */
127127
SDL_WINDOW_WIIU_GAMEPAD_ONLY = 0x01000000, /**< Wii U: window must be drawn only on the Gamepad */
128128
SDL_WINDOW_WIIU_TV_ONLY = 0x02000000, /**< Wii U: window must be drawn only on the TV */
129+
SDL_WINDOW_WIIU_PREVENT_SWAP = 0x04000000, /**< Wii U: window will not swap scanbuffers on present */
129130
SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */
130131
SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */
131132

src/render/wiiu/SDL_rpresent_wiiu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ int WIIU_SDL_RenderPresent(SDL_Renderer * renderer)
6363
GX2CopyColorBufferToScanBuffer(&tdata->cbuf, GX2_SCAN_TARGET_DRC);
6464
}
6565

66-
/* Swap buffers */
67-
GX2SwapScanBuffers();
66+
/* Swap buffers if the window doesn't prevent it */
67+
if (!(flags & SDL_WINDOW_WIIU_PREVENT_SWAP)) {
68+
GX2SwapScanBuffers();
69+
}
70+
6871
GX2Flush();
6972

7073
/* Restore SDL context state */

src/video/SDL_video.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
15171517
}
15181518

15191519
#define CREATE_FLAGS \
1520-
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_WIIU_GAMEPAD_ONLY | SDL_WINDOW_WIIU_TV_ONLY)
1520+
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_WIIU_GAMEPAD_ONLY | SDL_WINDOW_WIIU_TV_ONLY | SDL_WINDOW_WIIU_PREVENT_SWAP)
15211521

15221522
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
15231523
{

0 commit comments

Comments
 (0)