diff --git a/dynamic.c b/dynamic.c index f5bd40c8e1..bd5952f789 100644 --- a/dynamic.c +++ b/dynamic.c @@ -57,9 +57,11 @@ #include "performance_counters.h" #include "led/led_driver.h" #include "midi/midi_driver.h" +#include "input/input_driver.h" #include "cores/internal_cores.h" #include "content.h" +#include "msg_hash.h" #include "paths.h" #include "retroarch.h" #include "configuration.h" diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index a757a49157..7eb5d49066 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -17,6 +17,7 @@ #include #include "../../configuration.h" +#include "../../input/input_driver.h" #include "../../verbosity.h" #include "d3d_common.h" diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index 6255382c24..91c15de985 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -23,6 +23,8 @@ #include #include #include +#include + #include #include "../../driver.h" @@ -58,6 +60,19 @@ static struct string_list *d3d10_gpu_list = NULL; static IDXGIAdapter1 *d3d10_adapters[D3D10_MAX_GPU_COUNT] = {NULL}; static IDXGIAdapter1 *d3d10_current_adapter = NULL; +static void d3d10_clear_scissor(d3d10_video_t *d3d10, video_frame_info_t *video_info) +{ + D3D10_RECT scissor_rect; + + scissor_rect.left = 0; + scissor_rect.top = 0; + scissor_rect.right = video_info->width; + scissor_rect.bottom = video_info->height; + + D3D10SetScissorRects(d3d10->device, 1, &scissor_rect); +} + + #ifdef HAVE_OVERLAY static void d3d10_free_overlays(d3d10_video_t* d3d10) { @@ -86,18 +101,6 @@ d3d10_overlay_vertex_geom(void* data, unsigned index, float x, float y, float w, D3D10UnmapBuffer(d3d10->overlays.vbo); } -static void d3d10_clear_scissor(d3d10_video_t *d3d10, video_frame_info_t *video_info) -{ - D3D10_RECT scissor_rect; - - scissor_rect.left = 0; - scissor_rect.top = 0; - scissor_rect.right = video_info->width; - scissor_rect.bottom = video_info->height; - - D3D10SetScissorRects(d3d10->device, 1, &scissor_rect); -} - static void d3d10_overlay_tex_geom(void* data, unsigned index, float u, float v, float w, float h) { d3d10_sprite_t* sprites = NULL; diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 744d739203..043181cbaf 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -25,6 +25,8 @@ #include #include #include +#include + #include #ifdef HAVE_MENU @@ -71,6 +73,19 @@ static struct string_list *d3d11_gpu_list = NULL; static IDXGIAdapter1 *d3d11_adapters[D3D11_MAX_GPU_COUNT] = {NULL}; static IDXGIAdapter1 *d3d11_current_adapter = NULL; +static void d3d11_clear_scissor(d3d11_video_t *d3d11, video_frame_info_t *video_info) +{ + D3D11_RECT scissor_rect; + + scissor_rect.left = 0; + scissor_rect.top = 0; + scissor_rect.right = video_info->width; + scissor_rect.bottom = video_info->height; + + D3D11SetScissorRects(d3d11->context, 1, &scissor_rect); +} + + #ifdef HAVE_OVERLAY static void d3d11_free_overlays(d3d11_video_t* d3d11) { @@ -102,18 +117,6 @@ d3d11_overlay_vertex_geom(void* data, unsigned index, float x, float y, float w, D3D11UnmapBuffer(d3d11->context, d3d11->overlays.vbo, 0); } -static void d3d11_clear_scissor(d3d11_video_t *d3d11, video_frame_info_t *video_info) -{ - D3D11_RECT scissor_rect; - - scissor_rect.left = 0; - scissor_rect.top = 0; - scissor_rect.right = video_info->width; - scissor_rect.bottom = video_info->height; - - D3D11SetScissorRects(d3d11->context, 1, &scissor_rect); -} - static void d3d11_overlay_tex_geom(void* data, unsigned index, float u, float v, float w, float h) { D3D11_MAPPED_SUBRESOURCE mapped_vbo; diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index 2a8b9215f0..3002661c4e 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "../font_driver.h" #include "../common/d3d_common.h" diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 47ec7ddb7b..745ab6e859 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -108,16 +108,114 @@ static const GLfloat gl1_white_color[] = { if (gl1_shared_context_use) \ gl1->ctx_driver->bind_hw_render(gl1->ctx_data, enable) -static void gl1_render_overlay(gl1_t *gl, video_frame_info_t *video_info); -static void gl1_free_overlay(gl1_t *gl); +#ifdef HAVE_OVERLAY +static void gl1_render_overlay(gl1_t *gl, video_frame_info_t *video_info) +{ + unsigned i; + unsigned width = video_info->width; + unsigned height = video_info->height; + + glEnable(GL_BLEND); + + if (gl->overlay_full_screen) + glViewport(0, 0, width, height); + + gl->coords.vertex = gl->overlay_vertex_coord; + gl->coords.tex_coord = gl->overlay_tex_coord; + gl->coords.color = gl->overlay_color_coord; + gl->coords.vertices = 4 * gl->overlays; + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + for (i = 0; i < gl->overlays; i++) + { + glBindTexture(GL_TEXTURE_2D, gl->overlay_tex[i]); + glDrawArrays(GL_TRIANGLE_STRIP, 4 * i, 4); + } + + glDisable(GL_BLEND); + gl->coords.vertex = gl->vertex_ptr; + gl->coords.tex_coord = gl->tex_info.coord; + gl->coords.color = gl->white_color_ptr; + gl->coords.vertices = 4; + if (gl->overlay_full_screen) + glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height); +} + +static void gl1_free_overlay(gl1_t *gl) +{ + glDeleteTextures(gl->overlays, gl->overlay_tex); + + free(gl->overlay_tex); + free(gl->overlay_vertex_coord); + free(gl->overlay_tex_coord); + free(gl->overlay_color_coord); + gl->overlay_tex = NULL; + gl->overlay_vertex_coord = NULL; + gl->overlay_tex_coord = NULL; + gl->overlay_color_coord = NULL; + gl->overlays = 0; +} + static void gl1_overlay_vertex_geom(void *data, unsigned image, float x, float y, - float w, float h); + float w, float h) +{ + GLfloat *vertex = NULL; + gl1_t *gl = (gl1_t*)data; + + if (!gl) + return; + + if (image > gl->overlays) + { + RARCH_ERR("[GL]: Invalid overlay id: %u\n", image); + return; + } + + vertex = (GLfloat*)&gl->overlay_vertex_coord[image * 8]; + + /* Flipped, so we preserve top-down semantics. */ + y = 1.0f - y; + h = -h; + + vertex[0] = x; + vertex[1] = y; + vertex[2] = x + w; + vertex[3] = y; + vertex[4] = x; + vertex[5] = y + h; + vertex[6] = x + w; + vertex[7] = y + h; +} + static void gl1_overlay_tex_geom(void *data, unsigned image, GLfloat x, GLfloat y, - GLfloat w, GLfloat h); + GLfloat w, GLfloat h) +{ + GLfloat *tex = NULL; + gl1_t *gl = (gl1_t*)data; + + if (!gl) + return; + + tex = (GLfloat*)&gl->overlay_tex_coord[image * 8]; + + tex[0] = x; + tex[1] = y; + tex[2] = x + w; + tex[3] = y; + tex[4] = x; + tex[5] = y + h; + tex[6] = x + w; + tex[7] = y + h; +} + +#endif static bool is_pot(unsigned x) { @@ -1415,114 +1513,6 @@ static void gl1_get_overlay_interface(void *data, *iface = &gl1_overlay_interface; } -static void gl1_free_overlay(gl1_t *gl) -{ - glDeleteTextures(gl->overlays, gl->overlay_tex); - - free(gl->overlay_tex); - free(gl->overlay_vertex_coord); - free(gl->overlay_tex_coord); - free(gl->overlay_color_coord); - gl->overlay_tex = NULL; - gl->overlay_vertex_coord = NULL; - gl->overlay_tex_coord = NULL; - gl->overlay_color_coord = NULL; - gl->overlays = 0; -} - -static void gl1_overlay_vertex_geom(void *data, - unsigned image, - float x, float y, - float w, float h) -{ - GLfloat *vertex = NULL; - gl1_t *gl = (gl1_t*)data; - - if (!gl) - return; - - if (image > gl->overlays) - { - RARCH_ERR("[GL]: Invalid overlay id: %u\n", image); - return; - } - - vertex = (GLfloat*)&gl->overlay_vertex_coord[image * 8]; - - /* Flipped, so we preserve top-down semantics. */ - y = 1.0f - y; - h = -h; - - vertex[0] = x; - vertex[1] = y; - vertex[2] = x + w; - vertex[3] = y; - vertex[4] = x; - vertex[5] = y + h; - vertex[6] = x + w; - vertex[7] = y + h; -} - -static void gl1_overlay_tex_geom(void *data, - unsigned image, - GLfloat x, GLfloat y, - GLfloat w, GLfloat h) -{ - GLfloat *tex = NULL; - gl1_t *gl = (gl1_t*)data; - - if (!gl) - return; - - tex = (GLfloat*)&gl->overlay_tex_coord[image * 8]; - - tex[0] = x; - tex[1] = y; - tex[2] = x + w; - tex[3] = y; - tex[4] = x; - tex[5] = y + h; - tex[6] = x + w; - tex[7] = y + h; -} - -static void gl1_render_overlay(gl1_t *gl, video_frame_info_t *video_info) -{ - unsigned i; - unsigned width = video_info->width; - unsigned height = video_info->height; - - glEnable(GL_BLEND); - - if (gl->overlay_full_screen) - glViewport(0, 0, width, height); - - gl->coords.vertex = gl->overlay_vertex_coord; - gl->coords.tex_coord = gl->overlay_tex_coord; - gl->coords.color = gl->overlay_color_coord; - gl->coords.vertices = 4 * gl->overlays; - - /*gl->shader->set_coords(gl->shader_data, &gl->coords); - gl->shader->set_mvp(gl->shader_data, &gl->mvp_no_rot);*/ - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - - for (i = 0; i < gl->overlays; i++) - { - glBindTexture(GL_TEXTURE_2D, gl->overlay_tex[i]); - glDrawArrays(GL_TRIANGLE_STRIP, 4 * i, 4); - } - - glDisable(GL_BLEND); - gl->coords.vertex = gl->vertex_ptr; - gl->coords.tex_coord = gl->tex_info.coord; - gl->coords.color = gl->white_color_ptr; - gl->coords.vertices = 4; - if (gl->overlay_full_screen) - glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height); -} #endif video_driver_t video_gl1 = { diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index b61a10941d..181f0ae1cc 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -113,31 +113,6 @@ static void gl_core_deinit_pbo_readback(gl_core_t *gl) scaler_ctx_gen_reset(&gl->pbo_readback_scaler); } -#ifdef HAVE_OVERLAY -static void gl_core_free_overlay(gl_core_t *gl) -{ - if (gl->overlay_tex) - glDeleteTextures(gl->overlays, gl->overlay_tex); - - free(gl->overlay_tex); - free(gl->overlay_vertex_coord); - free(gl->overlay_tex_coord); - free(gl->overlay_color_coord); - gl->overlay_tex = NULL; - gl->overlay_vertex_coord = NULL; - gl->overlay_tex_coord = NULL; - gl->overlay_color_coord = NULL; - gl->overlays = 0; -} - -static void gl_core_free_scratch_vbos(gl_core_t *gl) -{ - unsigned i; - for (i = 0; i < GL_CORE_NUM_VBOS; i++) - if (gl->scratch_vbos[i]) - glDeleteBuffers(1, &gl->scratch_vbos[i]); -} - static void gl_core_slow_readback(gl_core_t *gl, void *buffer) { glPixelStorei(GL_PACK_ALIGNMENT, 4); @@ -207,6 +182,31 @@ void gl_core_bind_scratch_vbo(gl_core_t *gl, const void *data, size_t size) gl->scratch_vbo_index = 0; } +#ifdef HAVE_OVERLAY +static void gl_core_free_overlay(gl_core_t *gl) +{ + if (gl->overlay_tex) + glDeleteTextures(gl->overlays, gl->overlay_tex); + + free(gl->overlay_tex); + free(gl->overlay_vertex_coord); + free(gl->overlay_tex_coord); + free(gl->overlay_color_coord); + gl->overlay_tex = NULL; + gl->overlay_vertex_coord = NULL; + gl->overlay_tex_coord = NULL; + gl->overlay_color_coord = NULL; + gl->overlays = 0; +} + +static void gl_core_free_scratch_vbos(gl_core_t *gl) +{ + unsigned i; + for (i = 0; i < GL_CORE_NUM_VBOS; i++) + if (gl->scratch_vbos[i]) + glDeleteBuffers(1, &gl->scratch_vbos[i]); +} + static void gl_core_overlay_vertex_geom(void *data, unsigned image, float x, float y, @@ -377,8 +377,10 @@ static void gl_core_destroy_resources(gl_core_t *gl) if (gl->pipelines.bokeh) glDeleteProgram(gl->pipelines.bokeh); +#ifdef HAVE_OVERLAY gl_core_free_overlay(gl); gl_core_free_scratch_vbos(gl); +#endif gl_core_deinit_fences(gl); gl_core_deinit_pbo_readback(gl); gl_core_deinit_hw_render(gl); diff --git a/gfx/drivers_context/gdi_ctx.c b/gfx/drivers_context/gdi_ctx.c index 04782b1165..2d79bb33c6 100644 --- a/gfx/drivers_context/gdi_ctx.c +++ b/gfx/drivers_context/gdi_ctx.c @@ -36,6 +36,7 @@ #include "../../dynamic.h" #include "../../configuration.h" +#include "../../input/input_driver.h" #include "../../retroarch.h" #include "../../verbosity.h" #include "../../frontend/frontend_driver.h" diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index 0b7fae942d..7a91178f7c 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -41,6 +41,7 @@ #include "../../configuration.h" #include "../../dynamic.h" +#include "../../input/input_driver.h" #include "../../retroarch.h" #include "../../verbosity.h" #include "../../frontend/frontend_driver.h" diff --git a/input/input_mapper.c b/input/input_mapper.c index 68fa61b11f..60915fb273 100644 --- a/input/input_mapper.c +++ b/input/input_mapper.c @@ -38,6 +38,7 @@ #include "../config.h" #endif +#include "input_driver.h" #include "input_mapper.h" #ifdef HAVE_OVERLAY @@ -79,13 +80,16 @@ void input_mapper_free(input_mapper_t *handle) } void input_mapper_poll(input_mapper_t *handle, - input_overlay_t *overlay_pointer, + void *ol_pointer, void *settings_data, unsigned max_users, bool poll_overlay) { unsigned i, j; input_bits_t current_input; +#ifdef HAVE_OVERLAY + input_overlay_t *overlay_pointer = (input_overlay_t*)ol_pointer; +#endif settings_t *settings = (settings_t*)settings_data; bool key_event[RARCH_CUSTOM_BIND_LIST_END] = { false }; diff --git a/input/input_mapper.h b/input/input_mapper.h index 14d3645da9..dc7df00efd 100644 --- a/input/input_mapper.h +++ b/input/input_mapper.h @@ -36,7 +36,7 @@ input_mapper_t *input_mapper_new(void); void input_mapper_free(input_mapper_t *handle); void input_mapper_poll(input_mapper_t *handle, - input_overlay_t *overlay_pointer, + void *overlay_pointer, void *settings_data, unsigned max_users, bool poll_overlay); diff --git a/menu/drivers/ozone/ozone_sidebar.c b/menu/drivers/ozone/ozone_sidebar.c index 8c776ff0ac..dc45fc13cb 100644 --- a/menu/drivers/ozone/ozone_sidebar.c +++ b/menu/drivers/ozone/ozone_sidebar.c @@ -25,6 +25,7 @@ #include #include +#include #include "../../menu_animation.h" diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 9dffc12640..5118c70a87 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -29,6 +29,8 @@ #include #include #include +#include + #include #include #include diff --git a/retroarch.c b/retroarch.c index a164bbe0eb..3d0b2bb436 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1340,6 +1340,7 @@ typedef struct input_remote_state static input_remote_state_t remote_st_ptr; /* INPUT OVERLAY GLOBAL VARIABLES */ +#ifdef HAVE_OVERLAY #define OVERLAY_GET_KEY(state, key) (((state)->keys[(key) / 32] >> ((key) % 32)) & 1) #define OVERLAY_SET_KEY(state, key) (state)->keys[(key) / 32] |= 1 << ((key) % 32) @@ -1379,6 +1380,7 @@ struct input_overlay }; input_overlay_t *overlay_ptr = NULL; +#endif /* INPUT GLOBAL VARIABLES */ @@ -4845,7 +4847,11 @@ static void input_poll(void) if (do_poll) input_mapper_poll(input_driver_mapper, +#ifdef HAVE_OVERLAY overlay_ptr, +#else + NULL, +#endif settings, max_users, overlay_is_alive diff --git a/ui/drivers/qt/coreoptionsdialog.cpp b/ui/drivers/qt/coreoptionsdialog.cpp index 82c9cebf15..60162623e7 100644 --- a/ui/drivers/qt/coreoptionsdialog.cpp +++ b/ui/drivers/qt/coreoptionsdialog.cpp @@ -29,6 +29,7 @@ extern "C" { #include #include "../../../command.h" #include "../../../configuration.h" +#include "../../../msg_hash.h" #include "../../../retroarch.h" #include "../../../paths.h" #include "../../../file_path_special.h" diff --git a/ui/drivers/qt/filedropwidget.cpp b/ui/drivers/qt/filedropwidget.cpp index 57d14a19b6..4d1398e058 100644 --- a/ui/drivers/qt/filedropwidget.cpp +++ b/ui/drivers/qt/filedropwidget.cpp @@ -21,6 +21,7 @@ extern "C" { #include "../../../file_path_special.h" #include "../../../configuration.h" +#include "../../../msg_hash.h" #ifndef CXX_BUILD } diff --git a/ui/drivers/qt/playlistentrydialog.cpp b/ui/drivers/qt/playlistentrydialog.cpp index 407821d279..d4401a795b 100644 --- a/ui/drivers/qt/playlistentrydialog.cpp +++ b/ui/drivers/qt/playlistentrydialog.cpp @@ -19,6 +19,7 @@ extern "C" { #include "../../../core_info.h" #include "../../../file_path_special.h" +#include "../../../msg_hash.h" #ifndef CXX_BUILD } diff --git a/ui/drivers/qt/shaderparamsdialog.cpp b/ui/drivers/qt/shaderparamsdialog.cpp index cb57546c6b..2552deb772 100644 --- a/ui/drivers/qt/shaderparamsdialog.cpp +++ b/ui/drivers/qt/shaderparamsdialog.cpp @@ -29,6 +29,7 @@ extern "C" { #include #include "../../../command.h" #include "../../../configuration.h" +#include "../../../msg_hash.h" #include "../../../retroarch.h" #include "../../../paths.h" #include "../../../file_path_special.h"