Merge pull request #3956 from FIX94/master

-(WiiU) added in option to disable vsync
This commit is contained in:
aliaspider 2016-11-06 23:37:27 +01:00 committed by GitHub
commit 8bb13e12a5

View File

@ -87,6 +87,8 @@ typedef struct
wiiu_render_mode_t render_mode; wiiu_render_mode_t render_mode;
int frames; int frames;
bool noblock;
int syncframes;
} wiiu_video_t; } wiiu_video_t;
static const wiiu_render_mode_t wiiu_render_mode_map[] = static const wiiu_render_mode_t wiiu_render_mode_map[] =
@ -316,6 +318,8 @@ static void* wiiu_gfx_init(const video_info_t* video,
*input = wiiuinput ? &input_wiiu : NULL; *input = wiiuinput ? &input_wiiu : NULL;
*input_data = wiiuinput; *input_data = wiiuinput;
} }
wiiu->noblock = false;
wiiu->syncframes = 60;
return wiiu; return wiiu;
} }
@ -374,6 +378,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
int i; int i;
wiiu_video_t* wiiu = (wiiu_video_t*) data; wiiu_video_t* wiiu = (wiiu_video_t*) data;
if(wiiu->menu.enable || wiiu->noblock == false)
wiiu->syncframes = 60;
else if(wiiu->syncframes > 0)
wiiu->syncframes--;
GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.0f, 0.0f, 1.0f); GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.0f, 0.0f, 1.0f);
// GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.3f, 0.8f, 1.0f); // GX2ClearColor(&wiiu->color_buffer, 0.0f, 0.3f, 0.8f, 1.0f);
/* can't call GX2ClearColor after GX2SetContextState for whatever reason */ /* can't call GX2ClearColor after GX2SetContextState for whatever reason */
@ -438,6 +446,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2SwapScanBuffers(); GX2SwapScanBuffers();
GX2Flush(); GX2Flush();
if(wiiu->syncframes)
GX2WaitForVsync(); GX2WaitForVsync();
printf("\rframe : %5i", wiiu->frames++); printf("\rframe : %5i", wiiu->frames++);
fflush(stdout); fflush(stdout);
@ -447,8 +456,12 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
static void wiiu_gfx_set_nonblock_state(void* data, bool toggle) static void wiiu_gfx_set_nonblock_state(void* data, bool toggle)
{ {
(void)data; wiiu_video_t* wiiu = (wiiu_video_t*) data;
(void)toggle;
if (!wiiu)
return;
wiiu->noblock = toggle;
} }
static bool wiiu_gfx_alive(void* data) static bool wiiu_gfx_alive(void* data)