diff --git a/gfx/drivers_display/gfx_display_d3d10.c b/gfx/drivers_display/gfx_display_d3d10.c index 3994a3dedf..c03c9007f3 100644 --- a/gfx/drivers_display/gfx_display_d3d10.c +++ b/gfx/drivers_display/gfx_display_d3d10.c @@ -269,10 +269,12 @@ static bool gfx_display_d3d10_font_init_first( return true; } -void gfx_display_d3d10_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) +void gfx_display_d3d10_scissor_begin(void *data, + unsigned video_width, unsigned video_height, + int x, int y, unsigned width, unsigned height) { D3D10_RECT rect; - d3d10_video_t *d3d10 = (d3d10_video_t*)video_info->userdata; + d3d10_video_t *d3d10 = (d3d10_video_t*)data; if (!d3d10 || !width || !height) return; @@ -285,12 +287,11 @@ void gfx_display_d3d10_scissor_begin(video_frame_info_t *video_info, int x, int D3D10SetScissorRects(d3d10->device, 1, &rect); } -void gfx_display_d3d10_scissor_end(video_frame_info_t *video_info) +void gfx_display_d3d10_scissor_end(void *data, + unsigned video_width, unsigned video_height) { D3D10_RECT rect; - d3d10_video_t *d3d10 = (d3d10_video_t*)video_info->userdata; - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; + d3d10_video_t *d3d10 = (d3d10_video_t*)data; if (!d3d10) return; diff --git a/gfx/drivers_display/gfx_display_d3d11.c b/gfx/drivers_display/gfx_display_d3d11.c index 241cdb12ea..73e43f4cb3 100644 --- a/gfx/drivers_display/gfx_display_d3d11.c +++ b/gfx/drivers_display/gfx_display_d3d11.c @@ -268,10 +268,13 @@ static bool gfx_display_d3d11_font_init_first( return true; } -void gfx_display_d3d11_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) +void gfx_display_d3d11_scissor_begin(void *data, + unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height) { D3D11_RECT rect; - d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; + d3d11_video_t *d3d11 = (d3d11_video_t*)data; if (!d3d11 || !width || !height) return; @@ -284,12 +287,12 @@ void gfx_display_d3d11_scissor_begin(video_frame_info_t *video_info, int x, int D3D11SetScissorRects(d3d11->context, 1, &rect); } -void gfx_display_d3d11_scissor_end(video_frame_info_t *video_info) +void gfx_display_d3d11_scissor_end(void *data, + unsigned video_width, + unsigned video_height) { D3D11_RECT rect; - d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; + d3d11_video_t *d3d11 = (d3d11_video_t*)data; if (!d3d11) return; diff --git a/gfx/drivers_display/gfx_display_d3d12.c b/gfx/drivers_display/gfx_display_d3d12.c index 3ba8d5bafc..e228816eaf 100644 --- a/gfx/drivers_display/gfx_display_d3d12.c +++ b/gfx/drivers_display/gfx_display_d3d12.c @@ -289,10 +289,12 @@ static bool gfx_display_d3d12_font_init_first( return true; } -void gfx_display_d3d12_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) +void gfx_display_d3d12_scissor_begin(void *data, + unsigned video_width, unsigned video_height, + int x, int y, unsigned width, unsigned height) { D3D12_RECT rect; - d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; + d3d12_video_t *d3d12 = (d3d12_video_t*)data; if (!d3d12 || !width || !height) return; @@ -305,12 +307,12 @@ void gfx_display_d3d12_scissor_begin(video_frame_info_t *video_info, int x, int D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &rect); } -void gfx_display_d3d12_scissor_end(video_frame_info_t *video_info) +void gfx_display_d3d12_scissor_end(void *data, + unsigned video_width, + unsigned video_height) { D3D12_RECT rect; - d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; + d3d12_video_t *d3d12 = (d3d12_video_t*)data; if (!d3d12) return; diff --git a/gfx/drivers_display/gfx_display_d3d9.c b/gfx/drivers_display/gfx_display_d3d9.c index a8a41effc5..4ad88c136c 100644 --- a/gfx/drivers_display/gfx_display_d3d9.c +++ b/gfx/drivers_display/gfx_display_d3d9.c @@ -303,11 +303,12 @@ static bool gfx_display_d3d9_font_init_first( } void gfx_display_d3d9_scissor_begin( - video_frame_info_t *video_info, + void *data, + unsigned video_width, unsigned video_height, int x, int y, unsigned width, unsigned height) { RECT rect; - d3d9_video_t *d3d9 = (d3d9_video_t*)video_info->userdata; + d3d9_video_t *d3d9 = (d3d9_video_t*)data; if (!d3d9 || !width || !height) return; @@ -320,12 +321,11 @@ void gfx_display_d3d9_scissor_begin( d3d9_set_scissor_rect(d3d9->dev, &rect); } -void gfx_display_d3d9_scissor_end(video_frame_info_t *video_info) +void gfx_display_d3d9_scissor_end(void *data, + unsigned video_width, unsigned video_height) { RECT rect; - d3d9_video_t *d3d9 = (d3d9_video_t*)video_info->userdata; - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; + d3d9_video_t *d3d9 = (d3d9_video_t*)data; if (!d3d9) return; diff --git a/gfx/drivers_display/gfx_display_gdi.c b/gfx/drivers_display/gfx_display_gdi.c index 39e68ba27a..1e2aace5c3 100644 --- a/gfx/drivers_display/gfx_display_gdi.c +++ b/gfx/drivers_display/gfx_display_gdi.c @@ -108,15 +108,11 @@ static void gfx_display_gdi_draw(gfx_display_ctx_draw_t *draw, } static void gfx_display_gdi_draw_pipeline(gfx_display_ctx_draw_t *draw, - video_frame_info_t *video_info) -{ -} + video_frame_info_t *video_info) { } static void gfx_display_gdi_viewport(gfx_display_ctx_draw_t *draw, void *data) { } -static void gfx_display_gdi_restore_clear_color(void) -{ -} +static void gfx_display_gdi_restore_clear_color(void) { } static void gfx_display_gdi_clear_color( gfx_display_ctx_clearcolor_t *clearcolor, @@ -168,6 +164,6 @@ gfx_display_ctx_driver_t gfx_display_ctx_gdi = { GFX_VIDEO_DRIVER_GDI, "gdi", false, - NULL, - NULL + NULL, /* scissor_begin */ + NULL /* scissor_end */ }; diff --git a/gfx/drivers_display/gfx_display_gl.c b/gfx/drivers_display/gfx_display_gl.c index 141b0e587f..a8229ac92f 100644 --- a/gfx/drivers_display/gfx_display_gl.c +++ b/gfx/drivers_display/gfx_display_gl.c @@ -367,10 +367,12 @@ static bool gfx_display_gl_font_init_first( } static void gfx_display_gl_scissor_begin( - video_frame_info_t *video_info, int x, int y, + void *data, + unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height) { - unsigned video_height = video_info->height; glScissor(x, video_height - y - height, width, height); glEnable(GL_SCISSOR_TEST); #ifdef MALI_BUG @@ -386,10 +388,11 @@ static void gfx_display_gl_scissor_begin( #endif } -static void gfx_display_gl_scissor_end(video_frame_info_t *video_info) +static void gfx_display_gl_scissor_end( + void *data, + unsigned video_width, + unsigned video_height) { - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; glScissor(0, 0, video_width, video_height); glDisable(GL_SCISSOR_TEST); #ifdef MALI_BUG diff --git a/gfx/drivers_display/gfx_display_gl1.c b/gfx/drivers_display/gfx_display_gl1.c index b89d7e73be..f3c5ab97f5 100644 --- a/gfx/drivers_display/gfx_display_gl1.c +++ b/gfx/drivers_display/gfx_display_gl1.c @@ -201,19 +201,21 @@ static bool gfx_display_gl1_font_init_first( return true; } -static void gfx_display_gl1_scissor_begin(video_frame_info_t *video_info, int x, int y, +static void gfx_display_gl1_scissor_begin(void *data, + unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height) { - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; glScissor(x, video_height - y - height, width, height); glEnable(GL_SCISSOR_TEST); } -static void gfx_display_gl1_scissor_end(video_frame_info_t *video_info) +static void gfx_display_gl1_scissor_end( + void *data, + unsigned video_width, + unsigned video_height) { - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; glScissor(0, 0, video_width, video_height); glDisable(GL_SCISSOR_TEST); } diff --git a/gfx/drivers_display/gfx_display_gl_core.c b/gfx/drivers_display/gfx_display_gl_core.c index 53066594be..64fc62b706 100644 --- a/gfx/drivers_display/gfx_display_gl_core.c +++ b/gfx/drivers_display/gfx_display_gl_core.c @@ -331,15 +331,19 @@ static bool gfx_display_gl_core_font_init_first( return false; } -static void gfx_display_gl_core_scissor_begin(video_frame_info_t *video_info, +static void gfx_display_gl_core_scissor_begin(void *data, + unsigned video_width, + unsigned video_height, int x, int y, unsigned width, unsigned height) { - unsigned video_height = video_info->height; glScissor(x, video_height - y - height, width, height); glEnable(GL_SCISSOR_TEST); } -static void gfx_display_gl_core_scissor_end(video_frame_info_t *video_info) +static void gfx_display_gl_core_scissor_end( + void *data, + unsigned video_width, + unsigned video_height) { glDisable(GL_SCISSOR_TEST); } diff --git a/gfx/drivers_display/gfx_display_metal.m b/gfx/drivers_display/gfx_display_metal.m index c1bba37e4b..fcef602dd1 100644 --- a/gfx/drivers_display/gfx_display_metal.m +++ b/gfx/drivers_display/gfx_display_metal.m @@ -84,9 +84,13 @@ static void gfx_display_metal_draw_pipeline(gfx_display_ctx_draw_t *draw, video_ static void gfx_display_metal_viewport(gfx_display_ctx_draw_t *draw, void *data) } { } -static void gfx_display_metal_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) +static void gfx_display_metal_scissor_begin( + void *data, + unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height) { - MetalDriver *md = (__bridge MetalDriver *)video_info->userdata; + MetalDriver *md = (__bridge MetalDriver *)data; if (!md) return; @@ -94,22 +98,23 @@ static void gfx_display_metal_scissor_begin(video_frame_info_t *video_info, int [md.display setScissorRect:r]; } -static void gfx_display_metal_scissor_end(video_frame_info_t *video_info) +static void gfx_display_metal_scissor_end(void *data, + unsigned video_width, + unsigned video_height) { - MetalDriver *md = (__bridge MetalDriver *)video_info->userdata; + MetalDriver *md = (__bridge MetalDriver *)data; if (!md) return; [md.display clearScissorRect]; } -static void gfx_display_metal_restore_clear_color(void) -{ - /* nothing to do */ -} +/* Nothing to do */ +static void gfx_display_metal_restore_clear_color(void) { } -static void gfx_display_metal_clear_color(gfx_display_ctx_clearcolor_t *clearcolor, - video_frame_info_t *video_info) +static void gfx_display_metal_clear_color( + gfx_display_ctx_clearcolor_t *clearcolor, + video_frame_info_t *video_info) { MetalDriver *md = (__bridge MetalDriver *)video_info->userdata; if (!md) @@ -125,9 +130,9 @@ static bool gfx_display_metal_font_init_first( { font_data_t **handle = (font_data_t **)font_handle; *handle = font_driver_init_first(video_data, - font_path, font_size, true, - is_threaded, - FONT_DRIVER_RENDER_METAL_API); + font_path, font_size, true, + is_threaded, + FONT_DRIVER_RENDER_METAL_API); if (*handle) return true; diff --git a/gfx/drivers_display/gfx_display_switch.c b/gfx/drivers_display/gfx_display_switch.c index 24c689988e..7c5ad0a157 100644 --- a/gfx/drivers_display/gfx_display_switch.c +++ b/gfx/drivers_display/gfx_display_switch.c @@ -22,37 +22,18 @@ #include "../gfx_display.h" -static void *gfx_display_switch_get_default_mvp(void *data) -{ - return NULL; -} - +static void *gfx_display_switch_get_default_mvp(void *data) { return NULL; } static void gfx_display_switch_blend_begin(void *data) { } static void gfx_display_switch_blend_end(void *data) { } - static void gfx_display_switch_draw(gfx_display_ctx_draw_t *draw, - video_frame_info_t *video_info) -{ -} - + video_frame_info_t *video_info) { } static void gfx_display_switch_draw_pipeline( - gfx_display_ctx_draw_t *draw, video_frame_info_t *video_info) -{ -} - + gfx_display_ctx_draw_t *draw, video_frame_info_t *video_info) { } static void gfx_display_switch_viewport(gfx_display_ctx_draw_t *draw, void *data) { } +static void gfx_display_switch_restore_clear_color(void) { } -static void gfx_display_switch_restore_clear_color(void) -{ -} - -static void gfx_display_switch_clear_color( - gfx_display_ctx_clearcolor_t *clearcolor, - video_frame_info_t *video_info) -{ - (void)clearcolor; -} +static void gfx_display_switch_clear_color(gfx_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info) { } static bool gfx_display_switch_font_init_first( void **font_handle, void *video_data, @@ -94,6 +75,6 @@ gfx_display_ctx_driver_t gfx_display_ctx_switch = { GFX_VIDEO_DRIVER_SWITCH, "switch", false, - NULL, - NULL + NULL, /* scissor_begin */ + NULL /* scissor_end */ }; diff --git a/gfx/drivers_display/gfx_display_vita2d.c b/gfx/drivers_display/gfx_display_vita2d.c index f5cdabe2cb..302e7d20df 100644 --- a/gfx/drivers_display/gfx_display_vita2d.c +++ b/gfx/drivers_display/gfx_display_vita2d.c @@ -180,21 +180,27 @@ static bool gfx_display_vita2d_font_init_first( return *handle; } -static void gfx_display_vita2d_scissor_end(video_frame_info_t *video_info) -{ - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; - vita2d_set_region_clip(SCE_GXM_REGION_CLIP_NONE, 0, 0, video_width, video_height); - vita2d_disable_clipping(); -} - -static void gfx_display_vita2d_scissor_begin(video_frame_info_t *video_info, int x, int y, +static void gfx_display_vita2d_scissor_begin(void *data, + unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height) { vita2d_set_clip_rectangle(x, y, x + width, y + height); vita2d_set_region_clip(SCE_GXM_REGION_CLIP_OUTSIDE, x, y, x + width, y + height); } +static void gfx_display_vita2d_scissor_end( + void *data, + unsigned video_width, + unsigned video_height) +{ + vita2d_set_region_clip(SCE_GXM_REGION_CLIP_NONE, 0, 0, + video_width, video_height); + vita2d_disable_clipping(); +} + + gfx_display_ctx_driver_t gfx_display_ctx_vita2d = { gfx_display_vita2d_draw, gfx_display_vita2d_draw_pipeline, diff --git a/gfx/drivers_display/gfx_display_vulkan.c b/gfx/drivers_display/gfx_display_vulkan.c index 50c16b3df4..a333b3a973 100644 --- a/gfx/drivers_display/gfx_display_vulkan.c +++ b/gfx/drivers_display/gfx_display_vulkan.c @@ -357,10 +357,13 @@ static bool gfx_display_vk_font_init_first( return false; } -static void gfx_display_vk_scissor_begin(video_frame_info_t *video_info, +static void gfx_display_vk_scissor_begin( + void *data, + unsigned video_width, + unsigned video_height, int x, int y, unsigned width, unsigned height) { - vk_t *vk = (vk_t*)video_info->userdata; + vk_t *vk = (vk_t*)data; vk->tracker.use_scissor = true; vk->tracker.scissor.offset.x = x; @@ -370,9 +373,11 @@ static void gfx_display_vk_scissor_begin(video_frame_info_t *video_info, vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; } -static void gfx_display_vk_scissor_end(video_frame_info_t *video_info) +static void gfx_display_vk_scissor_end(void *data, + unsigned video_width, + unsigned video_height) { - vk_t *vk = (vk_t*)video_info->userdata; + vk_t *vk = (vk_t*)data; vk->tracker.use_scissor = false; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; diff --git a/gfx/drivers_display/gfx_display_wiiu.c b/gfx/drivers_display/gfx_display_wiiu.c index 0ae7761312..9c55cf4421 100644 --- a/gfx/drivers_display/gfx_display_wiiu.c +++ b/gfx/drivers_display/gfx_display_wiiu.c @@ -28,24 +28,11 @@ #include "../../wiiu/system/memory.h" #include "../../wiiu/wiiu_dbg.h" -static const float *gfx_display_wiiu_get_default_vertices(void) -{ - return NULL; -} - -static const float *gfx_display_wiiu_get_default_tex_coords(void) -{ - return NULL; -} - -static void *gfx_display_wiiu_get_default_mvp(void *data) -{ - return NULL; -} - +static const float *gfx_display_wiiu_get_default_vertices(void) { return NULL; } +static const float *gfx_display_wiiu_get_default_tex_coords(void) { return NULL; } +static void *gfx_display_wiiu_get_default_mvp(void *data) { return NULL; } static void gfx_display_wiiu_blend_begin(void *data) { } static void gfx_display_wiiu_blend_end(void *data) { } - static void gfx_display_wiiu_viewport(gfx_display_ctx_draw_t *draw, void *data) { } static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw, @@ -307,20 +294,21 @@ static bool gfx_display_wiiu_font_init_first( } static void gfx_display_wiiu_scissor_begin( - video_frame_info_t *video_info, int x, int y, + void *data, + unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height) { - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; - GX2SetScissor(MAX(x, 0), MAX(video_height - y - height, 0), MIN(width, video_width), MIN(height, video_height)); } -static void gfx_display_wiiu_scissor_end(video_frame_info_t *video_info) +static void gfx_display_wiiu_scissor_end( + void *data, + unsigned video_width, + unsigned video_height + ) { - unsigned video_width = video_info->width; - unsigned video_height = video_info->height; - GX2SetScissor(0, 0, video_width, video_height); } diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index 2ea789891d..c9ea65cc13 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -650,6 +650,7 @@ void gfx_display_scissor_begin(video_frame_info_t *video_info, { unsigned video_width = video_info->width; unsigned video_height = video_info->height; + void *userdata = video_info->userdata; if (dispctx && dispctx->scissor_begin) { @@ -684,7 +685,9 @@ void gfx_display_scissor_begin(video_frame_info_t *video_info, if ((x + width) > video_width) width = video_width - x; - dispctx->scissor_begin(video_info, x, y, width, height); + dispctx->scissor_begin(userdata, + video_width, video_height, + x, y, width, height); } } @@ -692,7 +695,9 @@ void gfx_display_scissor_begin(video_frame_info_t *video_info, void gfx_display_scissor_end(video_frame_info_t *video_info) { if (dispctx && dispctx->scissor_end) - dispctx->scissor_end(video_info); + dispctx->scissor_end(video_info->userdata, + video_info->width, + video_info->height); } font_data_t *gfx_display_font_file( diff --git a/gfx/gfx_display.h b/gfx/gfx_display.h index 448679a9d9..23e5c58d02 100644 --- a/gfx/gfx_display.h +++ b/gfx/gfx_display.h @@ -134,8 +134,11 @@ typedef struct gfx_display_ctx_driver const char *ident; bool handles_transform; /* Enables and disables scissoring */ - void (*scissor_begin)(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height); - void (*scissor_end)(video_frame_info_t *video_info); + void (*scissor_begin)(void *data, unsigned video_width, + unsigned video_height, + int x, int y, unsigned width, unsigned height); + void (*scissor_end)(void *data, unsigned video_width, + unsigned video_height); } gfx_display_ctx_driver_t; struct gfx_display_ctx_draw