Change interval type to signed int

This commit is contained in:
twinaphex 2018-09-12 00:07:43 +02:00
parent 5d8c268afc
commit 4738ef545c
30 changed files with 80 additions and 62 deletions

View File

@ -171,7 +171,7 @@ void egl_swap_buffers(void *data)
eglSwapBuffers(egl->dpy, egl->surf);
}
void egl_set_swap_interval(egl_ctx_data_t *egl, unsigned interval)
void egl_set_swap_interval(egl_ctx_data_t *egl, int interval)
{
/* Can be called before initialization.
* Some contexts require that swap interval

View File

@ -58,7 +58,7 @@ typedef struct
EGLSurface surf;
EGLDisplay dpy;
EGLConfig config;
unsigned interval;
int interval;
unsigned major;
unsigned minor;
@ -84,7 +84,7 @@ void egl_bind_hw_render(egl_ctx_data_t *egl, bool enable);
void egl_swap_buffers(void *data);
void egl_set_swap_interval(egl_ctx_data_t *egl, unsigned interval);
void egl_set_swap_interval(egl_ctx_data_t *egl, int interval);
void egl_get_video_size(egl_ctx_data_t *egl, unsigned *width, unsigned *height);

View File

@ -1006,13 +1006,15 @@ static bool d3d8_restore(void *data)
static void d3d8_set_nonblock_state(void *data, bool state)
{
unsigned interval = state ? 0 : 1;
int interval = 0;
d3d8_video_t *d3d = (d3d8_video_t*)data;
if (!d3d)
return;
d3d->video_info.vsync = !state;
if (!state)
interval = 1;
d3d->video_info.vsync = !state;
#ifdef _XBOX
d3d8_set_render_state(d3d->dev, D3D8_PRESENTATIONINTERVAL,

View File

@ -1059,14 +1059,19 @@ static bool d3d9_restore(void *data)
static void d3d9_set_nonblock_state(void *data, bool state)
{
unsigned interval = state ? 0 : 1;
int interval = 0;
d3d9_video_t *d3d = (d3d9_video_t*)data;
if (!d3d)
return;
if (!state)
interval = 1;
d3d->video_info.vsync = !state;
(void)interval;
#ifdef _XBOX
d3d9_set_render_state(d3d->dev,
D3D9_PRESENTATIONINTERVAL,

View File

@ -1318,7 +1318,7 @@ static void gl_free(void *data)
static void gl_set_nonblock_state(void *data, bool state)
{
unsigned interval = 0;
int interval = 0;
gl_t *gl = (gl_t*)data;
settings_t *settings = config_get_ptr();
@ -1696,13 +1696,14 @@ static void *gl_init(const video_info_t *video,
{
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp;
unsigned interval, mip_level;
unsigned full_x, full_y;
video_shader_ctx_filter_t shader_filter;
video_shader_ctx_info_t shader_info;
video_shader_ctx_ident_t ident_info;
settings_t *settings = config_get_ptr();
video_shader_ctx_wrap_t wrap_info = {0};
int interval = 0;
unsigned mip_level = 0;
unsigned win_width = 0;
unsigned win_height = 0;
unsigned temp_width = 0;

View File

@ -77,7 +77,7 @@ static PFNVGCREATEEGLIMAGETARGETKHRPROC pvgCreateEGLImageTargetKHR;
static void vg_set_nonblock_state(void *data, bool state)
{
unsigned interval = state ? 0 : 1;
int interval = state ? 0 : 1;
video_context_driver_swap_interval(&interval);
}
@ -97,13 +97,14 @@ static void *vg_init(const video_info_t *video,
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp;
gfx_ctx_aspect_t aspect_data;
unsigned interval;
unsigned temp_width = 0, temp_height = 0;
unsigned win_width, win_height;
VGfloat clearColor[4] = {0, 0, 0, 1};
settings_t *settings = config_get_ptr();
vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
const gfx_ctx_driver_t *ctx = video_context_driver_init_first(
VGfloat clearColor[4] = {0, 0, 0, 1};
int interval = 0;
unsigned temp_width = 0;
unsigned temp_height = 0;
settings_t *settings = config_get_ptr();
vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
const gfx_ctx_driver_t *ctx = video_context_driver_init_first(
vg, settings->arrays.video_context_driver,
GFX_CTX_OPENVG_API, 0, 0, false);

View File

@ -1121,10 +1121,10 @@ static void *vulkan_init(const video_info_t *video,
{
gfx_ctx_mode_t mode;
gfx_ctx_input_t inp;
unsigned interval;
unsigned full_x, full_y;
unsigned win_width;
unsigned win_height;
int interval = 0;
unsigned temp_width = 0;
unsigned temp_height = 0;
const gfx_ctx_driver_t *ctx_driver = NULL;
@ -1259,7 +1259,7 @@ static void vulkan_check_swapchain(vk_t *vk)
static void vulkan_set_nonblock_state(void *data, bool state)
{
unsigned interval;
int interval = 0;
vk_t *vk = (vk_t*)data;
settings_t *settings = config_get_ptr();
@ -1268,7 +1268,9 @@ static void vulkan_set_nonblock_state(void *data, bool state)
RARCH_LOG("[Vulkan]: VSync => %s\n", state ? "off" : "on");
interval = state ? 0 : settings->uints.video_swap_interval;
if (!state)
interval = settings->uints.video_swap_interval;
video_context_driver_swap_interval(&interval);
/* Changing vsync might require recreating the swapchain, which means new VkImages
@ -2024,7 +2026,8 @@ static bool vulkan_frame(void *data, const void *frame,
}
/* Vulkan doesn't directly support swap_interval > 1, so we fake it by duping out more frames. */
if (vk->context->swap_interval > 1 && !vk->context->swap_interval_emulation_lock)
if ( vk->context->swap_interval > 1
&& !vk->context->swap_interval_emulation_lock)
{
unsigned i;
vk->context->swap_interval_emulation_lock = true;

View File

@ -60,7 +60,7 @@ typedef struct
gfx_ctx_vulkan_data_t vk;
unsigned width;
unsigned height;
unsigned swap_interval;
int swap_interval;
#endif
} android_ctx_data_t;
@ -507,7 +507,7 @@ static void android_gfx_ctx_swap_buffers(void *data, void *data2)
}
}
static void android_gfx_ctx_set_swap_interval(void *data, unsigned swap_interval)
static void android_gfx_ctx_set_swap_interval(void *data, int swap_interval)
{
android_ctx_data_t *and = (android_ctx_data_t*)data;

View File

@ -63,7 +63,7 @@ typedef struct gfx_ctx_cgl_data
int width, height;
} gfx_ctx_cgl_data_t;
static void gfx_ctx_cgl_swap_interval(void *data, unsigned interval)
static void gfx_ctx_cgl_swap_interval(void *data, int interval)
{
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data;
GLint params = interval;

View File

@ -81,7 +81,7 @@ typedef struct gfx_ctx_drm_data
egl_ctx_data_t egl;
#endif
int fd;
unsigned interval;
int interval;
unsigned fb_width;
unsigned fb_height;
@ -134,7 +134,7 @@ error:
return NULL;
}
static void gfx_ctx_drm_swap_interval(void *data, unsigned interval)
static void gfx_ctx_drm_swap_interval(void *data, int interval)
{
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
drm->interval = interval;

View File

@ -49,14 +49,14 @@ static int emscripten_initial_width;
static int emscripten_initial_height;
static enum gfx_ctx_api emscripten_api = GFX_CTX_NONE;
static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval)
static void gfx_ctx_emscripten_swap_interval(void *data, int interval)
{
(void)data;
if (interval == 0)
emscripten_set_main_loop_timing(EM_TIMING_SETIMMEDIATE, 0);
else
emscripten_set_main_loop_timing(EM_TIMING_RAF, (int)interval);
emscripten_set_main_loop_timing(EM_TIMING_RAF, interval);
}
static void gfx_ctx_emscripten_get_canvas_size(int *width, int *height)

View File

@ -45,7 +45,7 @@ static HDC win32_gdi_hdc;
static unsigned win32_gdi_major = 0;
static unsigned win32_gdi_minor = 0;
static unsigned win32_gdi_interval = 0;
static int win32_gdi_interval = 0;
static enum gfx_ctx_api win32_gdi_api = GFX_CTX_NONE;
typedef struct gfx_ctx_gdi_data
@ -308,7 +308,7 @@ static void gfx_ctx_gdi_show_mouse(void *data, bool state)
win32_show_cursor(state);
}
static void gfx_ctx_gdi_swap_interval(void *data, unsigned interval)
static void gfx_ctx_gdi_swap_interval(void *data, int interval)
{
(void)data;
(void)interval;

View File

@ -18,7 +18,7 @@
#include "../video_driver.h"
static void gfx_ctx_null_swap_interval(void *data, unsigned interval)
static void gfx_ctx_null_swap_interval(void *data, int interval)
{
(void)data;
(void)interval;

View File

@ -23,7 +23,7 @@
typedef struct
{
gfx_ctx_vulkan_data_t vk;
unsigned swap_interval;
int swap_interval;
unsigned width;
unsigned height;
} khr_display_ctx_data_t;
@ -99,7 +99,8 @@ static bool gfx_ctx_khr_display_set_resize(void *data,
khr->width = width;
khr->height = height;
if (!vulkan_create_swapchain(&khr->vk, khr->width, khr->height, khr->swap_interval))
if (!vulkan_create_swapchain(&khr->vk, khr->width, khr->height,
khr->swap_interval))
{
RARCH_ERR("[Vulkan]: Failed to update swapchain.\n");
return false;
@ -189,9 +190,11 @@ static bool gfx_ctx_khr_display_suppress_screensaver(void *data, bool enable)
return false;
}
static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_khr_display_set_swap_interval(void *data,
int swap_interval)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
if (khr->swap_interval != swap_interval)
{
khr->swap_interval = swap_interval;

View File

@ -88,7 +88,7 @@ typedef struct cocoa_ctx_data
bool core_hw_context_enable;
#ifdef HAVE_VULKAN
gfx_ctx_vulkan_data_t vk;
unsigned swap_interval;
int swap_interval;
#endif
unsigned width;
unsigned height;
@ -360,7 +360,7 @@ static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned
return true;
}
static void cocoagl_gfx_ctx_swap_interval(void *data, unsigned interval)
static void cocoagl_gfx_ctx_swap_interval(void *data, int interval)
{
#ifdef HAVE_VULKAN
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
@ -373,10 +373,10 @@ static void cocoagl_gfx_ctx_swap_interval(void *data, unsigned interval)
{
#if defined(HAVE_COCOATOUCH) // < No way to disable Vsync on iOS?
// Just skip presents so fast forward still works.
g_is_syncing = interval ? true : false;
g_is_syncing = interval ? true : false;
g_fast_forward_skips = interval ? 0 : 3;
#elif defined(HAVE_COCOA)
GLint value = interval ? 1 : 0;
GLint value = interval ? 1 : 0;
[g_context setValues:&value forParameter:NSOpenGLCPSwapInterval];
#endif
break;
@ -491,9 +491,10 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
RARCH_LOG("[macOS]: Native window size: %u x %u.\n", cocoa_ctx->width, cocoa_ctx->height);
if (!vulkan_surface_create(&cocoa_ctx->vk, VULKAN_WSI_MVK_MACOS, NULL,
(BRIDGE void *)g_view, cocoa_ctx->width, cocoa_ctx->height,
cocoa_ctx->swap_interval))
if (!vulkan_surface_create(&cocoa_ctx->vk,
VULKAN_WSI_MVK_MACOS, NULL,
(BRIDGE void *)g_view, cocoa_ctx->width, cocoa_ctx->height,
cocoa_ctx->swap_interval))
{
RARCH_ERR("[macOS]: Failed to create surface.\n");
return false;
@ -772,7 +773,8 @@ static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned heig
cocoa_ctx->width = width;
cocoa_ctx->height = height;
if (vulkan_create_swapchain(&cocoa_ctx->vk, width, height, cocoa_ctx->swap_interval))
if (vulkan_create_swapchain(&cocoa_ctx->vk,
width, height, cocoa_ctx->swap_interval))
{
cocoa_ctx->vk.context.invalid_swapchain = true;
if (cocoa_ctx->vk.created_new_swapchain)

View File

@ -244,7 +244,8 @@ static bool gfx_ctx_mali_fbdev_suppress_screensaver(void *data, bool enable)
return false;
}
static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_mali_fbdev_set_swap_interval(void *data,
int swap_interval)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;

View File

@ -225,7 +225,7 @@ static void gfx_ctx_opendingux_swap_buffers(void *data, void *data2)
}
static void gfx_ctx_opendingux_set_swap_interval(
void *data, unsigned swap_interval)
void *data, int swap_interval)
{
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;

View File

@ -240,7 +240,7 @@ static bool osmesa_ctx_bind_api(void *data,
return true;
}
static void osmesa_ctx_swap_interval(void *data, unsigned interval)
static void osmesa_ctx_swap_interval(void *data, int interval)
{
(void)data;
(void)interval;

View File

@ -140,10 +140,10 @@ static void gfx_ctx_ps3_get_available_resolutions(void)
global->console.screen.resolutions.check = true;
}
static void gfx_ctx_ps3_set_swap_interval(void *data, unsigned interval)
static void gfx_ctx_ps3_set_swap_interval(void *data, int interval)
{
#if defined(HAVE_PSGL)
if (interval)
if (interval == 1)
glEnable(GL_VSYNC_SCE);
else
glDisable(GL_VSYNC_SCE);

View File

@ -417,7 +417,7 @@ dpi_fallback:
return true;
}
static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_qnx_set_swap_interval(void *data, int swap_interval)
{
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;

View File

@ -156,7 +156,7 @@ static bool sdl_ctx_bind_api(void *data,
return true;
}
static void sdl_ctx_swap_interval(void *data, unsigned interval)
static void sdl_ctx_swap_interval(void *data, int interval)
{
(void)data;
#ifdef HAVE_SDL2

View File

@ -151,7 +151,7 @@ static void gfx_ctx_sixel_show_mouse(void *data, bool state)
(void)data;
}
static void gfx_ctx_sixel_swap_interval(void *data, unsigned interval)
static void gfx_ctx_sixel_swap_interval(void *data, int interval)
{
(void)data;
(void)interval;

View File

@ -330,7 +330,7 @@ error:
return NULL;
}
static void gfx_ctx_vc_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_vc_set_swap_interval(void *data, int swap_interval)
{
#ifdef HAVE_EGL
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;

View File

@ -221,7 +221,7 @@ static bool gfx_ctx_vivante_suppress_screensaver(void *data, bool enable)
return false;
}
static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_vivante_set_swap_interval(void *data, int swap_interval)
{
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;

View File

@ -86,7 +86,7 @@ typedef struct gfx_ctx_wayland_data
struct wl_touch *wl_touch;
struct wl_seat *seat;
struct wl_shm *shm;
unsigned swap_interval;
int swap_interval;
bool core_hw_context_enable;
unsigned buffer_scale;
@ -1232,7 +1232,7 @@ static void gfx_ctx_wl_destroy(void *data)
free(wl);
}
static void gfx_ctx_wl_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_wl_set_swap_interval(void *data, int swap_interval)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

View File

@ -97,7 +97,7 @@ static gfx_ctx_vulkan_data_t win32_vk;
static unsigned win32_major = 0;
static unsigned win32_minor = 0;
static unsigned win32_interval = 0;
static int win32_interval = 0;
static enum gfx_ctx_api win32_api = GFX_CTX_NONE;
#ifdef HAVE_DYNAMIC
@ -308,7 +308,7 @@ void create_graphics_context(HWND hwnd, bool *quit)
void *dinput_wgl;
static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval)
static void gfx_ctx_wgl_swap_interval(void *data, int interval)
{
(void)data;

View File

@ -100,7 +100,7 @@ typedef struct gfx_ctx_x_data
unsigned swap_mode;
#endif
unsigned g_interval;
int g_interval;
#ifdef HAVE_VULKAN
gfx_ctx_vulkan_data_t vk;
@ -320,7 +320,7 @@ static void gfx_ctx_x_destroy(void *data)
free(data);
}
static void gfx_ctx_x_swap_interval(void *data, unsigned interval)
static void gfx_ctx_x_swap_interval(void *data, int interval)
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;

View File

@ -255,7 +255,7 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
}
/* forward declaration */
static void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval);
static void gfx_ctx_xegl_set_swap_interval(void *data, int swap_interval);
static bool gfx_ctx_xegl_set_video_mode(void *data,
video_frame_info_t *video_info,
@ -561,7 +561,7 @@ static void gfx_ctx_xegl_bind_hw_render(void *data, bool enable)
}
}
static void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval)
static void gfx_ctx_xegl_set_swap_interval(void *data, int swap_interval)
{
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;

View File

@ -3202,7 +3202,7 @@ bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data)
return true;
}
bool video_context_driver_swap_interval(unsigned *interval)
bool video_context_driver_swap_interval(int *interval)
{
if (!current_video_context.swap_interval)
return false;

View File

@ -354,7 +354,7 @@ typedef struct video_info
*/
unsigned height;
unsigned swap_interval;
int swap_interval;
#ifdef GEKKO
bool vfilter;
@ -522,7 +522,7 @@ typedef struct gfx_ctx_driver
unsigned major, unsigned minor);
/* Sets the swap interval. */
void (*swap_interval)(void *data, unsigned);
void (*swap_interval)(void *data, int);
/* Sets video mode. Creates a window, etc. */
bool (*set_video_mode)(void*, video_frame_info_t *video_info, unsigned, unsigned, bool);
@ -1166,7 +1166,7 @@ void video_context_driver_destroy(void);
bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data);
bool video_context_driver_swap_interval(unsigned *interval);
bool video_context_driver_swap_interval(int *interval);
bool video_context_driver_get_proc_address(gfx_ctx_proc_address_t *proc);