Merge remote-tracking branch 'refs/remotes/libretro/master' into wiiu_controller_patcher

This commit is contained in:
Maschell 2017-05-20 13:14:13 +02:00
commit 2ac91822c3
276 changed files with 15818 additions and 15637 deletions

View File

@ -1,4 +1,5 @@
# 1.5.1 (future)
- AUTOSAVE/SRAM - Fix bug #3829 / #4820 (https://github.com/libretro/RetroArch/issues/3829)
- NET: Fix bug #4703 (https://github.com/libretro/RetroArch/issues/4703)
- ANDROID: Runtime permission checking
- ANDROID: Improve autoconf fallback
@ -14,8 +15,13 @@ default font
- WINDOWS: Core mouse input should be relative again in cores
- MISC: Various frontend optimizations.
- VIDEO: Fix threaded video regression; tickering of menu entries would no longer work.
- WII: Fix crashing issues which could occur with the dummy core
- LOBBIES: Fallback to filename based matching if no CRC matches are found (for people making playlists by hand)
- LOBBIES: GUI refinement, show stop hosting when a host has been started, show disconnect when playing as client
- VITA: Fix slow I/O
- VITA: Fix 30fps menu (poke into input now instead of reading the entire input buffer which apparently is slow)
- VITA: Fix frame throttle
- VULKAN: Unicode font rendering support. Should fix bad character encoding for French characters, etc.
- VULKAN: Fix some crashes on loading some thumbnails
# 1.5.0

View File

@ -1,6 +1,7 @@
ROOT_DIR := .
DEPS_DIR := $(ROOT_DIR)/deps
LIBRETRO_COMM_DIR := $(ROOT_DIR)/libretro-common
WANT_WGL = 0
ifeq ($(HAVE_GL_CONTEXT),)
HAVE_GL_CONTEXT=0
@ -160,12 +161,12 @@ OBJ += frontend/frontend.o \
command.o \
msg_hash.o \
intl/msg_hash_us.o \
runloop.o \
$(LIBRETRO_COMM_DIR)/queues/task_queue.o \
tasks/task_content.o \
tasks/task_save.o \
tasks/task_file_transfer.o \
tasks/task_image.o \
tasks/task_audio_mixer.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.o \
$(LIBRETRO_COMM_DIR)/lists/file_list.o \
@ -222,7 +223,6 @@ OBJ += frontend/frontend.o \
tasks/task_powerstate.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler.o \
gfx/drivers_shader/shader_null.o \
gfx/video_shader_driver.o \
gfx/video_shader_parse.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/pixconv.o \
$(LIBRETRO_COMM_DIR)/gfx/scaler/scaler_int.o \
@ -555,7 +555,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/menu_input.o \
menu/menu_event.o \
menu/menu_entries.o \
menu/menu_navigation.o \
menu/menu_setting.o \
menu/menu_shader.o \
menu/widgets/menu_filebrowser.o \
@ -583,7 +582,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/cbs/menu_cbs_up.o \
menu/cbs/menu_cbs_down.o \
menu/cbs/menu_cbs_contentlist_switch.o \
menu/menu_display.o \
menu/menu_displaylist.o \
menu/menu_animation.o \
menu/drivers_display/menu_display_null.o \
@ -757,6 +755,10 @@ ifeq ($(HAVE_PARPORT), 1)
OBJ += input/drivers_joypad/parport_joypad.o
endif
ifneq ($(findstring Win32,$(OS)),)
OBJ += input/drivers/winraw_input.o
endif
# Companion UI
ifneq ($(findstring Win32,$(OS)),)
@ -769,8 +771,7 @@ endif
# Video
OBJ += gfx/video_context_driver.o \
gfx/drivers_context/gfx_null_ctx.o \
OBJ += gfx/drivers_context/gfx_null_ctx.o \
gfx/video_state_tracker.o
ifeq ($(HAVE_KMS), 1)
@ -872,8 +873,8 @@ endif
GL_LIBS := -framework OpenGL
OBJ += gfx/drivers_context/cgl_ctx.o
else ifneq ($(findstring Win32,$(OS)),)
GL_LIBS := -lopengl32 -lgdi32 -lcomdlg32 -lcomctl32
OBJ += gfx/drivers_context/wgl_ctx.o
GL_LIBS := -lopengl32 -lgdi32 -lcomdlg32
WANT_WGL=1
endif
LIBS += $(GL_LIBS)
endif
@ -926,6 +927,7 @@ endif
ifeq ($(HAVE_VULKAN), 1)
ifneq ($(findstring Win32,$(OS)),)
GLSLANG_PLATFORM := Windows
WANT_WGL = 1
else
GLSLANG_PLATFORM := Unix
endif
@ -984,6 +986,10 @@ ifeq ($(HAVE_VULKAN), 1)
DEFINES += -DHAVE_SLANG
endif
ifeq ($(WANT_WGL), 1)
OBJ += gfx/drivers_context/wgl_ctx.o
LIBS += -lcomctl32
endif
ifeq ($(HAVE_OMAP), 1)
OBJ += gfx/drivers/omap_gfx.o

View File

@ -23,7 +23,6 @@
#include <audio/conversion/s16_to_float.h>
#include <audio/audio_resampler.h>
#include <audio/dsp_filter.h>
#include <audio/audio_mixer.h>
#include <file/file_path.h>
#include <lists/dir_list.h>
@ -41,12 +40,13 @@
#include "../driver.h"
#include "../configuration.h"
#include "../retroarch.h"
#include "../runloop.h"
#include "../verbosity.h"
#include "../list_special.h"
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
#define AUDIO_MIXER_MAX_STREAMS 8
static const audio_driver_t *audio_drivers[] = {
#ifdef HAVE_ALSA
&audio_alsa,
@ -116,6 +116,18 @@ static const audio_driver_t *audio_drivers[] = {
NULL,
};
struct audio_mixer_stream
{
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
enum audio_mixer_state state;
float volume;
};
static unsigned audio_mixer_current_max_idx = 0;
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_STREAMS] = {{0}};
static size_t audio_driver_chunk_size = 0;
static size_t audio_driver_chunk_nonblock_size = 0;
static size_t audio_driver_chunk_block_size = 0;
@ -309,17 +321,15 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
float *samples_buf = NULL;
int16_t *conv_buf = NULL;
int16_t *rewind_buf = NULL;
size_t outsamples_max = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
size_t max_bufsamples = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
settings_t *settings = config_get_ptr();
/* Accomodate rewind since at some point we might have two full buffers. */
size_t outsamples_max = AUDIO_CHUNK_SIZE_NONBLOCKING * 2 * AUDIO_MAX_RATIO *
settings->floats.slowmotion_ratio;
convert_s16_to_float_init_simd();
convert_float_to_s16_init_simd();
/* Accomodate rewind since at some point we might have two full buffers. */
outsamples_max = max_bufsamples * AUDIO_MAX_RATIO *
settings->floats.slowmotion_ratio;
conv_buf = (int16_t*)malloc(outsamples_max
* sizeof(int16_t));
/* Used for recording even if audio isn't enabled. */
@ -764,14 +774,12 @@ void audio_driver_monitor_adjust_system_rates(void)
{
float timing_skew;
settings_t *settings = config_get_ptr();
const struct retro_system_timing *info = NULL;
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
float video_refresh_rate = settings->floats.video_refresh_rate;
float max_timing_skew = settings->floats.audio_max_timing_skew;
const struct retro_system_timing *info = av_info ?
(const struct retro_system_timing*)&av_info->timing : NULL;
if (av_info)
info = (const struct retro_system_timing*)&av_info->timing;
if (!info || info->sample_rate <= 0.0)
return;
@ -883,10 +891,111 @@ bool audio_driver_get_devices_list(void **data)
return true;
}
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
{
audio_mixer_voice_t *voice = NULL;
audio_mixer_sound_t *handle = NULL;
audio_mixer_stop_cb_t stop_cb = NULL;
bool looped = false;
if (audio_mixer_current_max_idx >= AUDIO_MIXER_MAX_STREAMS)
return false;
if (params->state == AUDIO_STREAM_STATE_NONE)
return false;
switch (params->type)
{
case AUDIO_MIXER_TYPE_WAV:
handle = audio_mixer_load_wav(params->buf, params->bufsize);
break;
case AUDIO_MIXER_TYPE_OGG:
handle = audio_mixer_load_ogg(params->buf, params->bufsize);
break;
case AUDIO_MIXER_TYPE_NONE:
return false;
}
if (!handle)
return false;
if (params->state == AUDIO_STREAM_STATE_PLAYING)
{
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
audio_set_bool(AUDIO_ACTION_MIXER, true);
}
else if (params->state == AUDIO_STREAM_STATE_PLAYING_LOOPED)
{
looped = true;
voice = audio_mixer_play(handle, looped, params->volume, stop_cb);
audio_set_bool(AUDIO_ACTION_MIXER, true);
}
audio_mixer_streams[audio_mixer_current_max_idx].handle = handle;
audio_mixer_streams[audio_mixer_current_max_idx].voice = voice;
audio_mixer_streams[audio_mixer_current_max_idx].state = params->state;
audio_mixer_streams[audio_mixer_current_max_idx].volume = params->volume;
audio_mixer_streams[audio_mixer_current_max_idx].stop_cb = stop_cb;
audio_mixer_current_max_idx++;
return true;
}
static void audio_driver_mixer_remove_stream(unsigned i)
{
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
audio_mixer_voice_t *voice = audio_mixer_streams[i].voice;
switch (audio_mixer_streams[i].state)
{
case AUDIO_STREAM_STATE_PLAYING:
audio_mixer_stop(voice);
#if 0
/* TODO - crashes at this part */
if (handle)
audio_mixer_destroy(handle);
#endif
break;
case AUDIO_STREAM_STATE_PLAYING_LOOPED:
audio_mixer_stop(voice);
#if 0
/* TODO - crashes at this part */
if (handle)
audio_mixer_destroy(handle);
#endif
break;
case AUDIO_STREAM_STATE_STOPPED:
if (handle)
audio_mixer_destroy(handle);
break;
case AUDIO_STREAM_STATE_NONE:
break;
}
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
audio_mixer_streams[i].stop_cb = NULL;
audio_mixer_streams[i].handle = NULL;
audio_mixer_streams[i].voice = NULL;
}
static void audio_driver_mixer_deinit(void)
{
unsigned i;
audio_set_bool(AUDIO_ACTION_MIXER, false);
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
audio_driver_mixer_remove_stream(i);
audio_mixer_current_max_idx = 0;
audio_mixer_done();
}
bool audio_driver_deinit(void)
{
audio_mixer_done();
audio_driver_mixer_deinit();
audio_driver_free_devices_list();
if (!audio_driver_deinit_internal())
return false;
@ -951,7 +1060,6 @@ bool audio_driver_has_callback(void)
bool audio_driver_toggle_mute(void)
{
settings_t *settings = config_get_ptr();
bool new_mute_state = !audio_driver_mute_enable;
if (!audio_driver_context_audio_data)
return false;
@ -1053,6 +1161,19 @@ void audio_driver_destroy(void)
current_audio = NULL;
}
void audio_set_bool(enum audio_action action, bool val)
{
switch (action)
{
case AUDIO_ACTION_MIXER:
audio_mixer_active = val;
break;
case AUDIO_ACTION_NONE:
default:
break;
}
}
void audio_set_float(enum audio_action action, float val)
{
switch (action)

View File

@ -22,6 +22,7 @@
#include <sys/types.h>
#include <boolean.h>
#include <audio/audio_mixer.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
@ -37,7 +38,8 @@ enum audio_action
{
AUDIO_ACTION_NONE = 0,
AUDIO_ACTION_RATE_CONTROL_DELTA,
AUDIO_ACTION_MUTE_ENABLE
AUDIO_ACTION_MUTE_ENABLE,
AUDIO_ACTION_MIXER
};
typedef struct audio_driver
@ -122,6 +124,24 @@ typedef struct audio_driver
size_t (*buffer_size)(void *data);
} audio_driver_t;
enum audio_mixer_state
{
AUDIO_STREAM_STATE_NONE = 0,
AUDIO_STREAM_STATE_STOPPED,
AUDIO_STREAM_STATE_PLAYING,
AUDIO_STREAM_STATE_PLAYING_LOOPED
};
typedef struct audio_mixer_stream_params
{
float volume;
enum audio_mixer_type type;
enum audio_mixer_state state;
void *buf;
size_t bufsize;
audio_mixer_stop_cb_t cb;
} audio_mixer_stream_params_t;
void audio_driver_destroy_data(void);
void audio_driver_set_own_driver(void);
@ -218,6 +238,10 @@ void audio_driver_frame_is_reverse(void);
void audio_set_float(enum audio_action action, float val);
void audio_set_bool(enum audio_action action, bool val);
void audio_unset_bool(enum audio_action action, bool val);
float *audio_get_float_ptr(enum audio_action action);
bool *audio_get_bool_ptr(enum audio_action action);
@ -226,6 +250,8 @@ bool audio_driver_deinit(void);
bool audio_driver_init(void);
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
extern audio_driver_t audio_rsound;
extern audio_driver_t audio_oss;
extern audio_driver_t audio_alsa;

View File

@ -370,7 +370,7 @@ static void *alsa_device_list_new(void *data)
/* description of device IOID - input / output identifcation
* ("Input" or "Output"), NULL means both) */
if (!io || (memcmp(io, "Output", 6) == 0))
if (!io || (string_is_equal_fast(io, "Output", 6)))
string_list_append(s, name, attr);
if (name)

View File

@ -370,7 +370,7 @@ static void *alsa_device_list_new(void *data)
/* description of device IOID - input / output identifcation
* ("Input" or "Output"), NULL means both) */
if (!io || (memcmp(io,"Output", 6) == 0))
if (!io || (string_is_equal_fast(io,"Output", 6)))
string_list_append(s, name, attr);
if (name)

View File

@ -1,37 +0,0 @@
diff --git a/audio/audio_driver.c b/audio/audio_driver.c
index 10dcbc5b3..0d2bb4d85 100644
--- a/audio/audio_driver.c
+++ b/audio/audio_driver.c
@@ -464,6 +464,8 @@ static bool audio_driver_init_internal(bool audio_cb_inited)
audio_driver_free_samples_count = 0;
+ audio_mixer_init(48000);
+
/* Threaded driver is initially stopped. */
if (
audio_driver_active
@@ -597,6 +599,8 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
audio_driver_resampler->process(audio_driver_resampler_data, &src_data);
+ audio_mixer_mix(audio_driver_output_samples_buf, src_data.output_frames);
+
output_data = audio_driver_output_samples_buf;
output_frames = (unsigned)src_data.output_frames;
diff --git a/runloop.c b/runloop.c
index 0e3a8dc44..4f79b2ed7 100644
--- a/runloop.c
+++ b/runloop.c
@@ -1021,7 +1021,10 @@ static enum runloop_state runloop_check_state(
command_event(CMD_EVENT_DISK_PREV, NULL);
if (runloop_cmd_triggered(trigger_input, RARCH_RESET))
+ {
command_event(CMD_EVENT_RESET, NULL);
+ audio_mixer_load_ogg("/home/squarepusher/SumertimeBlues.ogg");
+ }
cheat_manager_state_checks(
runloop_cmd_triggered(trigger_input, RARCH_CHEAT_INDEX_PLUS),

View File

@ -25,7 +25,6 @@
#include "../configuration.h"
#include "../driver.h"
#include "../retroarch.h"
#include "../runloop.h"
#include "../list_special.h"
#include "../verbosity.h"

File diff suppressed because it is too large Load Diff

83
cheevos/coro.h Normal file
View File

@ -0,0 +1,83 @@
#ifndef CORO_H
#define CORO_H
/*
Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/
*/
/* Use at the beginning of the coroutine, you must have declared a variable coro_t* coro */
#define CORO_ENTER() \
{ \
CORO_again: ; \
switch ( coro->step ) { \
case CORO_BEGIN: ;
/* Use to define labels which are targets to GOTO and GOSUB */
#define CORO_SUB( x ) \
case x: ;
/* Use at the end of the coroutine */
#define CORO_LEAVE() \
} \
} \
do { return 0; } while ( 0 )
/* Go to the x label */
#define CORO_GOTO( x ) \
do { \
coro->step = ( x ); \
goto CORO_again; \
} while ( 0 )
/* Go to a subroutine, execution continues until the subroutine returns via RET */
/* x is the subroutine label, y and z are the A and B arguments */
#define CORO_GOSUB( x ) \
do { \
coro->stack[ coro->sp++ ] = __LINE__; \
coro->step = ( x ); \
goto CORO_again; \
case __LINE__: ; \
} while ( 0 )
/* Returns from a subroutine */
#define CORO_RET() \
do { \
coro->step = coro->stack[ --coro->sp ]; \
goto CORO_again; \
} while ( 0 )
/* Yields to the caller, execution continues from this point when the coroutine is resumed */
#define CORO_YIELD() \
do { \
coro->step = __LINE__; \
return 1; \
case __LINE__: ; \
} while ( 0 )
#define CORO_STOP() \
do { \
return 0; \
} while ( 0 )
/* The coroutine entry point, never use 0 as a label */
#define CORO_BEGIN 0
/* Sets up a coroutine, x is a pointer to coro_t */
#define CORO_SETUP( x ) \
do { \
( x )->step = CORO_BEGIN; \
( x )->sp = 0; \
} while ( 0 )
#define CORO_VAR( x ) ( coro->x )
/* A coroutine */
typedef struct
{
CORO_VARS
int step, sp;
int stack[ 8 ];
}
coro_t;
#endif /* CORO_H */

View File

@ -49,7 +49,6 @@
#ifdef HAVE_MENU
#include "menu/menu_driver.h"
#include "menu/menu_content.h"
#include "menu/menu_display.h"
#include "menu/menu_shader.h"
#include "menu/widgets/menu_dialog.h"
#endif
@ -87,7 +86,7 @@
#include "core.h"
#include "verbosity.h"
#include "runloop.h"
#include "retroarch.h"
#include "configuration.h"
#include "input/input_remapping.h"
@ -392,14 +391,14 @@ static void command_parse_msg(command_t *handle, char *buf, enum cmd_source_t so
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD)
static bool command_network_init(command_t *handle, uint16_t port)
{
int fd;
struct addrinfo *res = NULL;
int fd = socket_init((void**)&res, port,
NULL, SOCKET_TYPE_DATAGRAM);
RARCH_LOG("%s %hu.\n",
msg_hash_to_str(MSG_BRINGING_UP_COMMAND_INTERFACE_ON_PORT),
(unsigned short)port);
fd = socket_init((void**)&res, port, NULL, SOCKET_TYPE_DATAGRAM);
if (fd < 0)
goto error;
@ -437,9 +436,10 @@ static bool send_udp_packet(const char *host,
int fd = -1;
bool ret = true;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_socktype = SOCK_DGRAM;
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
if (getaddrinfo_retro(host, port_buf, &hints, &res) < 0)
return false;
@ -794,12 +794,6 @@ static void command_stdin_poll(command_t *handle)
#endif
#endif
static void command_local_poll(command_t *handle)
{
if (!handle->local_enable)
return;
}
bool command_poll(command_t *handle)
{
memset(handle->state, 0, sizeof(handle->state));
@ -814,8 +808,6 @@ bool command_poll(command_t *handle)
command_stdin_poll(handle);
#endif
command_local_poll(handle);
return true;
}
@ -1368,15 +1360,15 @@ static bool command_event_init_core(enum rarch_core_type *data)
if (!core_init_symbols(data))
return false;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_INIT, NULL);
rarch_ctl(RARCH_CTL_SYSTEM_INFO_INIT, NULL);
/* auto overrides: apply overrides */
if(settings->bools.auto_overrides_enable)
{
if (config_load_override())
runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_SET_OVERRIDES_ACTIVE, NULL);
else
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
}
/* Auto-remap: apply shader preset files */
@ -1395,7 +1387,7 @@ static bool command_event_init_core(enum rarch_core_type *data)
config_load_remap();
/* Per-core saves: reset redirection paths */
rarch_ctl(RARCH_CTL_SET_PATHS_REDIRECT, NULL);
path_set_redirect();
if (!core_init())
return false;
@ -1406,20 +1398,20 @@ static bool command_event_init_core(enum rarch_core_type *data)
if (!core_load(settings->uints.input_poll_type_behavior))
return false;
runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL);
rarch_ctl(RARCH_CTL_SET_FRAME_LIMIT, NULL);
return true;
}
static void command_event_disable_overrides(void)
{
if (!runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
if (!rarch_ctl(RARCH_CTL_IS_OVERRIDES_ACTIVE, NULL))
return;
/* reload the original config */
config_unload_override();
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
}
static void command_event_restore_default_shader_preset(void)
@ -1583,12 +1575,12 @@ static bool command_event_save_core_config(void)
sizeof(config_path));
}
if (runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
if (rarch_ctl(RARCH_CTL_IS_OVERRIDES_ACTIVE, NULL))
{
/* Overrides block config file saving,
* make it appear as overrides weren't enabled
* for a manual save. */
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
overrides_active = true;
}
@ -1597,9 +1589,9 @@ static bool command_event_save_core_config(void)
runloop_msg_queue_push(msg, 1, 180, true);
if (overrides_active)
runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_SET_OVERRIDES_ACTIVE, NULL);
else
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
return ret;
}
@ -1633,7 +1625,7 @@ static void command_event_save_current_config(enum override_type type)
/* set overrides to active so the original config can be
restored after closing content */
runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL);
rarch_ctl(RARCH_CTL_SET_OVERRIDES_ACTIVE, NULL);
}
else
{
@ -1762,7 +1754,7 @@ static bool command_event_resize_windowed_scale(void)
unsigned *window_scale = NULL;
settings_t *settings = config_get_ptr();
if (runloop_ctl(RUNLOOP_CTL_GET_WINDOWED_SCALE, &window_scale))
if (rarch_ctl(RARCH_CTL_GET_WINDOWED_SCALE, &window_scale))
{
if (!window_scale || *window_scale == 0)
return false;
@ -1773,7 +1765,7 @@ static bool command_event_resize_windowed_scale(void)
if (!settings->bools.video_fullscreen)
command_event(CMD_EVENT_REINIT, NULL);
runloop_ctl(RUNLOOP_CTL_SET_WINDOWED_SCALE, &idx);
rarch_ctl(RARCH_CTL_SET_WINDOWED_SCALE, &idx);
return true;
}
@ -1888,9 +1880,9 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_MENU_TOGGLE:
#ifdef HAVE_MENU
if (menu_driver_is_alive())
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
else
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
rarch_menu_running();
#endif
break;
case CMD_EVENT_CONTROLLERS_INIT:
@ -1945,7 +1937,8 @@ bool command_event(enum event_command cmd, void *data)
}
break;
case CMD_EVENT_TAKE_SCREENSHOT:
if (!take_screenshot(path_get(RARCH_PATH_BASENAME), false))
if (!take_screenshot(path_get(RARCH_PATH_BASENAME), false,
video_driver_cached_frame_has_valid_framebuffer()))
return false;
break;
case CMD_EVENT_UNLOAD_CORE:
@ -2056,10 +2049,9 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_AUDIO_STOP:
return audio_driver_stop();
case CMD_EVENT_AUDIO_START:
return audio_driver_start(runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL));
return audio_driver_start(rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL));
case CMD_EVENT_AUDIO_MUTE_TOGGLE:
{
settings_t *settings = config_get_ptr();
bool audio_mute_enable = *(audio_get_bool_ptr(AUDIO_ACTION_MUTE_ENABLE));
const char *msg = !audio_mute_enable ?
msg_hash_to_str(MSG_AUDIO_MUTED):
@ -2304,7 +2296,7 @@ bool command_event(enum event_command cmd, void *data)
#endif
break;
case CMD_EVENT_RESUME:
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
rarch_menu_running_finished();
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
break;
@ -2362,21 +2354,21 @@ bool command_event(enum event_command cmd, void *data)
}
break;
case CMD_EVENT_PAUSE_TOGGLE:
boolean = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);
boolean = rarch_ctl(RARCH_CTL_IS_PAUSED, NULL);
boolean = !boolean;
runloop_ctl(RUNLOOP_CTL_SET_PAUSED, &boolean);
rarch_ctl(RARCH_CTL_SET_PAUSED, &boolean);
command_event(CMD_EVENT_PAUSE_CHECKS, NULL);
break;
case CMD_EVENT_UNPAUSE:
boolean = false;
runloop_ctl(RUNLOOP_CTL_SET_PAUSED, &boolean);
rarch_ctl(RARCH_CTL_SET_PAUSED, &boolean);
command_event(CMD_EVENT_PAUSE_CHECKS, NULL);
break;
case CMD_EVENT_PAUSE:
boolean = true;
runloop_ctl(RUNLOOP_CTL_SET_PAUSED, &boolean);
rarch_ctl(RARCH_CTL_SET_PAUSED, &boolean);
command_event(CMD_EVENT_PAUSE_CHECKS, NULL);
break;
case CMD_EVENT_MENU_PAUSE_LIBRETRO:
@ -2694,7 +2686,7 @@ bool command_event(enum event_command cmd, void *data)
command_event_set_volume(-0.5f);
break;
case CMD_EVENT_SET_FRAME_LIMIT:
runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL);
rarch_ctl(RARCH_CTL_SET_FRAME_LIMIT, NULL);
break;
case CMD_EVENT_DISABLE_OVERRIDES:
command_event_disable_overrides();

View File

@ -226,7 +226,7 @@ static const bool overlay_hide_in_menu = true;
static const bool display_keyboard_overlay = false;
#ifdef HAVE_MENU
#include "menu/menu_display.h"
#include "menu/menu_driver.h"
static bool default_block_config_read = true;
@ -263,13 +263,11 @@ static float menu_footer_opacity = 1.000;
static float menu_header_opacity = 1.000;
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) || defined(HAVE_VULKAN)
#if defined(HAVE_OPENGLES2) || (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
static unsigned menu_shader_pipeline = 1;
#else
static unsigned menu_shader_pipeline = 2;
#endif
#endif
static bool show_advanced_settings = false;
static const uint32_t menu_entry_normal_color = 0xffffffff;

View File

@ -32,6 +32,7 @@
#include "file_path_special.h"
#include "audio/audio_driver.h"
#include "input/input_driver.h"
#include "configuration.h"
#include "content.h"
#include "config.def.h"
@ -43,7 +44,6 @@
#include "dirs.h"
#include "paths.h"
#include "retroarch.h"
#include "runloop.h"
#include "verbosity.h"
#include "lakka.h"
@ -1283,7 +1283,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
SETTING_FLOAT("video_font_size", &settings->floats.video_font_size, true, font_size, false);
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, fastforward_ratio, false);
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, slowmotion_ratio, false);
SETTING_FLOAT("input_axis_threshold", &settings->floats.input_axis_threshold, true, axis_threshold, false);
SETTING_FLOAT("input_axis_threshold", input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD), true, axis_threshold, false);
*size = count;
@ -1299,7 +1299,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false);
SETTING_UINT("input_turbo_period", &settings->uints.input_turbo_period, true, turbo_period, false);
SETTING_UINT("input_duty_cycle", &settings->uints.input_turbo_duty_cycle, true, turbo_duty_cycle, false);
SETTING_UINT("input_max_users", &settings->uints.input_max_users, true, input_max_users, false);
SETTING_UINT("input_max_users", input_driver_get_uint(INPUT_ACTION_MAX_USERS), true, input_max_users, false);
SETTING_UINT("input_menu_toggle_gamepad_combo", &settings->uints.input_menu_toggle_gamepad_combo, true, menu_toggle_gamepad_combo, false);
SETTING_UINT("audio_latency", &settings->uints.audio_latency, false, 0 /* TODO */, false);
SETTING_UINT("audio_block_frames", &settings->uints.audio_block_frames, true, 0, false);
@ -1332,9 +1332,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("xmb_menu_color_theme", &settings->uints.menu_xmb_color_theme, true, xmb_theme, false);
#endif
SETTING_UINT("materialui_menu_color_theme", &settings->uints.menu_materialui_color_theme, true, MATERIALUI_THEME_BLUE, false);
#ifdef HAVE_SHADERPIPELINE
SETTING_UINT("menu_shader_pipeline", &settings->uints.menu_xmb_shader_pipeline, true, menu_shader_pipeline, false);
#endif
#endif
SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, out_rate, false);
SETTING_UINT("custom_viewport_width", &custom_vp->width, false, 0 /* TODO */, false);
@ -1354,7 +1352,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("netplay_input_latency_frames_range",&settings->uints.netplay_input_latency_frames_range, true, 0, false);
#endif
#ifdef HAVE_LANGEXTRA
SETTING_UINT("user_language", &settings->uints.user_language, true, RETRO_LANGUAGE_ENGLISH, false);
SETTING_UINT("user_language", msg_hash_get_uint(MSG_HASH_USER_LANGUAGE), true, RETRO_LANGUAGE_ENGLISH, false);
#endif
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
@ -1507,7 +1505,7 @@ static void config_set_defaults(void)
#endif
settings->floats.video_scale = scale;
if (rarch_ctl(RARCH_CTL_IS_FORCE_FULLSCREEN, NULL))
if (retroarch_is_forced_fullscreen())
{
configuration_set_bool(settings, settings->bools.video_fullscreen, true);
}
@ -1697,7 +1695,7 @@ static void config_set_defaults(void)
strlcpy(settings->paths.network_buildbot_url,
g_defaults.path.buildbot_server_url, sizeof(settings->paths.network_buildbot_url));
if (!string_is_empty(g_defaults.path.core))
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, g_defaults.path.core);
rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, g_defaults.path.core);
if (!string_is_empty(g_defaults.dir.database))
strlcpy(settings->paths.path_content_database, g_defaults.dir.database,
sizeof(settings->paths.path_content_database));
@ -1719,7 +1717,7 @@ static void config_set_defaults(void)
if (string_is_empty(settings->paths.path_overlay))
fill_pathname_join(settings->paths.path_overlay,
settings->paths.directory_overlay,
"gamepads/retropad/retropad.cfg",
"gamepads/flat/retropad.cfg",
sizeof(settings->paths.path_overlay));
#endif
}
@ -2067,15 +2065,15 @@ static bool check_shader_compatibility(enum file_path_enum enum_idx)
{
settings_t *settings = config_get_ptr();
if (memcmp(settings->arrays.video_driver, "vulkan", 6) == 0)
if (string_is_equal_fast(settings->arrays.video_driver, "vulkan", 6))
{
if (enum_idx != FILE_PATH_SLANGP_EXTENSION)
return false;
return true;
}
if ((memcmp(settings->arrays.video_driver, "gl", 2) == 0) ||
(memcmp(settings->arrays.video_driver, "d3d", 3) == 0)
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2) ||
string_is_equal_fast(settings->arrays.video_driver, "d3d", 3)
)
{
if (enum_idx == FILE_PATH_SLANGP_EXTENSION)
@ -2245,7 +2243,7 @@ static bool config_load_file(const char *path, bool set_defaults,
*bool_settings[i].ptr = tmp;
}
if (!rarch_ctl(RARCH_CTL_IS_FORCE_FULLSCREEN, NULL))
if (!retroarch_is_forced_fullscreen())
CONFIG_GET_BOOL_BASE(conf, settings, bools.video_fullscreen, "video_fullscreen");
#ifdef HAVE_NETWORKGAMEPAD
@ -2280,9 +2278,9 @@ static bool config_load_file(const char *path, bool set_defaults,
if (config_get_bool(conf, tmp, &tmp_bool))
{
if (tmp_bool)
runloop_ctl(RUNLOOP_CTL_SET_PERFCNT_ENABLE, NULL);
rarch_ctl(RARCH_CTL_SET_PERFCNT_ENABLE, NULL);
else
runloop_ctl(RUNLOOP_CTL_UNSET_PERFCNT_ENABLE, NULL);
rarch_ctl(RARCH_CTL_UNSET_PERFCNT_ENABLE, NULL);
}
}
@ -2504,7 +2502,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!string_is_empty(settings->paths.directory_screenshot))
{
if (memcmp(settings->paths.directory_screenshot, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_screenshot, "default", 7))
*settings->paths.directory_screenshot = '\0';
else if (!path_is_directory(settings->paths.directory_screenshot))
{
@ -2522,36 +2520,36 @@ static bool config_load_file(const char *path, bool set_defaults,
path_clear(RARCH_PATH_CORE);
}
if (memcmp(settings->paths.path_menu_wallpaper, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.path_menu_wallpaper, "default", 7))
*settings->paths.path_menu_wallpaper = '\0';
if (memcmp(settings->paths.directory_video_shader, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_video_shader, "default", 7))
*settings->paths.directory_video_shader = '\0';
if (memcmp(settings->paths.directory_video_filter, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_video_filter, "default", 7))
*settings->paths.directory_video_filter = '\0';
if (memcmp(settings->paths.directory_audio_filter, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_audio_filter, "default", 7))
*settings->paths.directory_audio_filter = '\0';
if (memcmp(settings->paths.directory_core_assets, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_core_assets, "default", 7))
*settings->paths.directory_core_assets = '\0';
if (memcmp(settings->paths.directory_assets, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_assets, "default", 7))
*settings->paths.directory_assets = '\0';
if (memcmp(settings->paths.directory_dynamic_wallpapers, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_dynamic_wallpapers, "default", 7))
*settings->paths.directory_dynamic_wallpapers = '\0';
if (memcmp(settings->paths.directory_thumbnails, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_thumbnails, "default", 7))
*settings->paths.directory_thumbnails = '\0';
if (memcmp(settings->paths.directory_playlist, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_playlist, "default", 7))
*settings->paths.directory_playlist = '\0';
#ifdef HAVE_MENU
if (memcmp(settings->paths.directory_menu_content, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_menu_content, "default", 7))
*settings->paths.directory_menu_content = '\0';
if (memcmp(settings->paths.directory_menu_config, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_menu_config, "default", 7))
*settings->paths.directory_menu_config = '\0';
#endif
#ifdef HAVE_OVERLAY
if (memcmp(settings->paths.directory_overlay, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_overlay, "default", 7))
*settings->paths.directory_overlay = '\0';
#endif
if (memcmp(settings->paths.directory_system, "default", 7) == 0)
if (string_is_equal_fast(settings->paths.directory_system, "default", 7))
*settings->paths.directory_system = '\0';
if (settings->floats.slowmotion_ratio < 1.0f)
@ -2575,7 +2573,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str)))
{
if (memcmp(tmp_str, "default", 7) == 0)
if (string_is_equal_fast(tmp_str, "default", 7))
dir_set(RARCH_DIR_SAVEFILE, g_defaults.dir.sram);
else if (path_is_directory(tmp_str))
@ -2601,7 +2599,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str)))
{
if (memcmp(tmp_str, "default", 7) == 0)
if (string_is_equal_fast(tmp_str, "default", 7))
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dir.savestate);
else if (path_is_directory(tmp_str))
{
@ -3385,7 +3383,7 @@ bool config_save_file(const char *path)
if (!conf)
conf = config_file_new(NULL);
if (!conf || runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
if (!conf || rarch_ctl(RARCH_CTL_IS_OVERRIDES_ACTIVE, NULL))
{
if (conf)
config_file_free(conf);
@ -3505,7 +3503,7 @@ bool config_save_file(const char *path)
config_set_bool(conf, "log_verbosity",
verbosity_is_enabled());
config_set_bool(conf, "perfcnt_enable",
runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL));
rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL));
msg_color = (((int)(settings->floats.video_msg_color_r * 255.0f) & 0xff) << 16) +
(((int)(settings->floats.video_msg_color_g * 255.0f) & 0xff) << 8) +

View File

@ -231,7 +231,6 @@ typedef struct settings
float audio_max_timing_skew;
float audio_volume; /* dB scale. */
float input_axis_threshold;
float input_overlay_opacity;
float input_overlay_scale;
@ -256,8 +255,6 @@ typedef struct settings
unsigned audio_latency;
unsigned input_remap_ids[MAX_USERS][RARCH_BIND_LIST_END];
unsigned input_max_users;
/* Set by autoconfiguration in joypad_autoconfig_dir.
* Does not override main binds. */
unsigned input_libretro_device[MAX_USERS];
@ -285,9 +282,6 @@ typedef struct settings
unsigned autosave_interval;
unsigned network_cmd_port;
unsigned network_remote_base_port;
#ifdef HAVE_LANGEXTRA
unsigned user_language;
#endif
unsigned video_window_x;
unsigned video_window_y;
unsigned video_monitor_index;

View File

@ -27,7 +27,7 @@
#include "config.h"
#endif
#include "runloop.h"
#include "retroarch.h"
#include "verbosity.h"
#include "config.def.h"
@ -507,7 +507,7 @@ static bool core_info_list_update_missing_firmware_internal(
if (!info)
return false;
runloop_ctl(RUNLOOP_CTL_UNSET_MISSING_BIOS, NULL);
rarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL);
for (i = 0; i < info->firmware_count; i++)
{
if (string_is_empty(info->firmware[i].path))
@ -518,7 +518,7 @@ static bool core_info_list_update_missing_firmware_internal(
info->firmware[i].missing = !path_file_exists(path);
if (info->firmware[i].missing && !info->firmware[i].optional)
{
runloop_ctl(RUNLOOP_CTL_SET_MISSING_BIOS, NULL);
rarch_ctl(RARCH_CTL_SET_MISSING_BIOS, NULL);
RARCH_WARN("Firmware missing: %s\n", info->firmware[i].path);
}
}

View File

@ -132,11 +132,6 @@ database_info_handle_t *database_info_file_init(const char *path,
void database_info_free(database_info_handle_t *handle);
#if 0
int database_info_build_query(
char *query, size_t len, const char *label, const char *path);
#endif
int database_info_build_query_enum(
char *query, size_t len, enum database_query_type type, const char *path);

View File

@ -106,7 +106,7 @@ int sceClibPrintf ( const char * format, ... );
#if defined(VITA)
#define CtrlSetSamplingMode(mode) sceCtrlSetSamplingModeExt(mode)
#define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlReadBufferPositiveExt2(port, pad_data, bufs)
#define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositiveExt2(port, pad_data, bufs)
#else
#define CtrlSetSamplingMode(mode) sceCtrlSetSamplingMode(mode)
#define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositive(port, pad_data, bufs)

2
dirs.c
View File

@ -32,7 +32,7 @@
#include "msg_hash.h"
#include "paths.h"
#include "content.h"
#include "runloop.h"
#include "retroarch.h"
#include "verbosity.h"
struct rarch_dir_list

View File

@ -40,7 +40,7 @@
#include "core.h"
#include "core_info.h"
#include "driver.h"
#include "runloop.h"
#include "retroarch.h"
#include "verbosity.h"
#define HASH_LOCATION_DRIVER 0x09189689U
@ -202,7 +202,7 @@ bool driver_find_next(const char *label, char *s, size_t len)
{
int i = driver_find_index(label, s);
if (i >= 0 && (memcmp(s, "null", 4) != 0))
if (i >= 0 && string_is_not_equal_fast(s, "null", 4))
{
find_driver_nonempty(label, i + 1, s, len);
return true;
@ -222,7 +222,7 @@ static void driver_adjust_system_rates(void)
if (!video_driver_get_ptr(false))
return;
if (runloop_ctl(RUNLOOP_CTL_IS_NONBLOCK_FORCED, NULL))
if (rarch_ctl(RARCH_CTL_IS_NONBLOCK_FORCED, NULL))
command_event(CMD_EVENT_VIDEO_SET_NONBLOCKING_STATE, NULL);
else
driver_set_nonblock_state();
@ -247,7 +247,7 @@ void driver_set_nonblock_state(void)
bool video_nonblock = enable;
if ( !settings->bools.video_vsync
|| runloop_ctl(RUNLOOP_CTL_IS_NONBLOCK_FORCED, NULL))
|| rarch_ctl(RARCH_CTL_IS_NONBLOCK_FORCED, NULL))
video_nonblock = true;
video_driver_set_nonblock_state(video_nonblock);
}
@ -330,7 +330,7 @@ void drivers_init(int flags)
hwr->context_reset();
video_driver_unset_video_cache_context_ack();
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL);
rarch_ctl(RARCH_CTL_SET_FRAME_TIME_LAST, NULL);
}
if (flags & DRIVER_AUDIO_MASK)

View File

@ -50,7 +50,7 @@
#include "core.h"
#include "driver.h"
#include "performance_counters.h"
#include "gfx/video_context_driver.h"
#include "gfx/video_driver.h"
#include "cores/internal_cores.h"
#include "frontend/frontend_driver.h"
@ -58,7 +58,6 @@
#include "dirs.h"
#include "paths.h"
#include "retroarch.h"
#include "runloop.h"
#include "configuration.h"
#include "msg_hash.h"
#include "verbosity.h"
@ -672,9 +671,9 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
memset(current_core, 0, sizeof(struct retro_core_t));
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_FREE, NULL);
runloop_ctl(RUNLOOP_CTL_FRAME_TIME_FREE, NULL);
rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
rarch_ctl(RARCH_CTL_FRAME_TIME_FREE, NULL);
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
@ -907,7 +906,7 @@ static bool dynamic_verify_hw_context(enum retro_hw_context_type type,
switch (type)
{
case RETRO_HW_CONTEXT_VULKAN:
if (memcmp(video_ident, "vulkan", 6) != 0)
if (string_is_not_equal_fast(video_ident, "vulkan", 6))
return false;
break;
case RETRO_HW_CONTEXT_OPENGLES2:
@ -915,7 +914,7 @@ static bool dynamic_verify_hw_context(enum retro_hw_context_type type,
case RETRO_HW_CONTEXT_OPENGLES_VERSION:
case RETRO_HW_CONTEXT_OPENGL:
case RETRO_HW_CONTEXT_OPENGL_CORE:
if (memcmp(video_ident, "gl", 2) != 0)
if (string_is_not_equal_fast(video_ident, "gl", 2))
return false;
break;
default:
@ -927,7 +926,7 @@ static bool dynamic_verify_hw_context(enum retro_hw_context_type type,
static void core_performance_counter_start(struct retro_perf_counter *perf)
{
if (runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL))
if (rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL))
{
perf->call_cnt++;
perf->start = cpu_features_get_perf_counter();
@ -936,7 +935,7 @@ static void core_performance_counter_start(struct retro_perf_counter *perf)
static void core_performance_counter_stop(struct retro_perf_counter *perf)
{
if (runloop_ctl(RUNLOOP_CTL_IS_PERFCNT_ENABLE, NULL))
if (rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL))
perf->total += cpu_features_get_perf_counter() - perf->start;
}
@ -973,7 +972,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
break;
case RETRO_ENVIRONMENT_GET_VARIABLE:
if (!runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_GET, data))
if (!rarch_ctl(RARCH_CTL_CORE_OPTIONS_GET, data))
{
struct retro_variable *var = (struct retro_variable*)data;
@ -987,14 +986,14 @@ bool rarch_environment_cb(unsigned cmd, void *data)
break;
case RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE:
*(bool*)data = runloop_ctl(RUNLOOP_CTL_IS_CORE_OPTION_UPDATED, NULL);
*(bool*)data = rarch_ctl(RARCH_CTL_IS_CORE_OPTION_UPDATED, NULL);
break;
case RETRO_ENVIRONMENT_SET_VARIABLES:
RARCH_LOG("Environ SET_VARIABLES.\n");
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_INIT, data);
rarch_ctl(RARCH_CTL_CORE_OPTIONS_DEINIT, NULL);
rarch_ctl(RARCH_CTL_CORE_OPTIONS_INIT, data);
break;
@ -1023,8 +1022,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SHUTDOWN:
RARCH_LOG("Environ SHUTDOWN.\n");
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
runloop_ctl(RUNLOOP_CTL_SET_CORE_SHUTDOWN, NULL);
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
rarch_ctl(RARCH_CTL_SET_CORE_SHUTDOWN, NULL);
break;
case RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL:
@ -1078,9 +1077,11 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_GET_LANGUAGE:
#ifdef HAVE_LANGEXTRA
*(unsigned *)data = settings->uints.user_language;
RARCH_LOG("Environ GET_LANGUAGE: \"%u\".\n",
settings->uints.user_language);
{
unsigned user_lang = *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE);
*(unsigned *)data = user_lang;
RARCH_LOG("Environ GET_LANGUAGE: \"%u\".\n", user_lang);
}
#endif
break;
@ -1190,17 +1191,22 @@ bool rarch_environment_cb(unsigned cmd, void *data)
}
RARCH_LOG("Environ SET_INPUT_DESCRIPTORS:\n");
for (p = 0; p < settings->uints.input_max_users; p++)
{
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
for (p = 0; p < max_users; p++)
{
const char *description = system->input_desc_btn[p][retro_id];
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
{
const char *description = system->input_desc_btn[p][retro_id];
if (!description)
continue;
if (!description)
continue;
RARCH_LOG("\tRetroPad, User %u, Button \"%s\" => \"%s\"\n",
p + 1, libretro_btn_desc[retro_id], description);
RARCH_LOG("\tRetroPad, User %u, Button \"%s\" => \"%s\"\n",
p + 1, libretro_btn_desc[retro_id], description);
}
}
}
@ -1217,8 +1223,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
const struct retro_keyboard_callback *info =
(const struct retro_keyboard_callback*)data;
runloop_ctl(RUNLOOP_CTL_FRONTEND_KEY_EVENT_GET, &frontend_key_event);
runloop_ctl(RUNLOOP_CTL_KEY_EVENT_GET, &key_event);
rarch_ctl(RARCH_CTL_FRONTEND_KEY_EVENT_GET, &frontend_key_event);
rarch_ctl(RARCH_CTL_KEY_EVENT_GET, &key_event);
RARCH_LOG("Environ SET_KEYBOARD_CALLBACK.\n");
if (key_event)
@ -1305,7 +1311,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK:
{
RARCH_LOG("Environ SET_FRAME_TIME_CALLBACK.\n");
runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME, data);
rarch_ctl(RARCH_CTL_SET_FRAME_TIME, data);
break;
}

View File

@ -80,6 +80,8 @@ enum file_path_enum
FILE_PATH_AUTO_EXTENSION,
FILE_PATH_ZIP_EXTENSION,
FILE_PATH_7Z_EXTENSION,
FILE_PATH_OGG_EXTENSION,
FILE_PATH_WAV_EXTENSION,
FILE_PATH_CONFIG_EXTENSION,
FILE_PATH_CORE_INFO_EXTENSION
};

View File

@ -101,6 +101,12 @@ const char *file_path_str(enum file_path_enum enum_idx)
case FILE_PATH_PNG_EXTENSION:
str = ".png";
break;
case FILE_PATH_OGG_EXTENSION:
str = ".ogg";
break;
case FILE_PATH_WAV_EXTENSION:
str = ".wav";
break;
case FILE_PATH_JPEG_EXTENSION:
str = ".jpeg";
break;

View File

@ -60,7 +60,7 @@
#include "../../file_path_special.h"
#include "../../configuration.h"
#include "../../defaults.h"
#include "../../runloop.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../../ui/ui_companion_driver.h"

View File

@ -37,7 +37,6 @@
#include "../../defaults.h"
#include "../../content.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../command.h"
#include "../../tasks/tasks_internal.h"
#include "../../file_path_special.h"
@ -49,7 +48,9 @@ static void emscripten_mainloop(void)
if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms);
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
task_queue_check();
if (ret != -1)
return;

View File

@ -423,7 +423,7 @@ static void frontend_gx_process_args(int *argc, char *argv[])
char path[PATH_MAX_LENGTH] = {0};
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));
if (path_file_exists(path))
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, path);
rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, path);
}
#endif
}

View File

@ -62,7 +62,6 @@
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#include "../../menu/menu_display.h"
#include "../../menu/menu_entries.h"
#endif
@ -384,7 +383,9 @@ static void android_app_entry(void *data)
if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms);
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
task_queue_check();
if (ret == -1)
break;
}while(1);
@ -899,6 +900,9 @@ static bool next_string(char **_ptr, char **_str)
static bool int_string(char *str, int *val)
{
char *endptr = NULL;
if (!str)
return false;
*val = (int) strtol(str, &endptr, 0);
return ((*str != '\0') && (*endptr == '\0'));
}
@ -959,7 +963,7 @@ static bool frontend_linux_powerstate_check_apm(
if (!next_string(&ptr, &str)) /* remaining battery life time units */
goto error;
else if (memcmp(str, "min", 3) == 0)
else if (string_is_equal_fast(str, "min", 3))
battery_time *= 60;
if (battery_flag == 0xFF) /* unknown state */
@ -1205,6 +1209,26 @@ static void frontend_linux_get_os(char *s,
#endif
}
#ifdef HAVE_LAKKA
static void frontend_linux_get_lakka_version(char *s,
size_t len)
{
char version[128];
size_t vlen;
FILE *command_file = popen("cat /etc/release", "r");
fgets(version, sizeof(version), command_file);
vlen = strlen(version);
if (vlen > 0 && version[vlen-1] == '\n')
version[--vlen] = '\0';
strlcpy(s, version, len);
pclose(command_file);
}
#endif
static void frontend_linux_get_env(int *argc,
char *argv[], void *data, void *params_data)
{
@ -1289,7 +1313,7 @@ static void frontend_linux_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
bool used = (memcmp(argv, "false", 5) == 0) ? false : true;
bool used = string_is_equal_fast(argv, "false", 5) ? false : true;
(*env)->ReleaseStringUTFChars(env, jstr, argv);
@ -2131,6 +2155,9 @@ frontend_ctx_driver_t frontend_ctx_linux = {
frontend_linux_destroy_signal_handler_state,
NULL, /* attach_console */
NULL, /* detach_console */
#ifdef HAVE_LAKKA
frontend_linux_get_lakka_version, /* get_lakka_version */
#endif
#ifdef ANDROID
"android"
#else

View File

@ -41,5 +41,8 @@ frontend_ctx_driver_t frontend_ctx_null = {
NULL, /* destroy_sighandler_state */
NULL, /* attach_console */
NULL, /* detach_console */
#ifdef HAVE_LAKKA
NULL, /* get_lakka_version */
#endif
"null",
};

View File

@ -91,7 +91,7 @@ static void callback_sysutil_exit(uint64_t status,
if (frontend)
frontend->shutdown = frontend_ps3_shutdown;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
}
break;
}
@ -573,7 +573,7 @@ static void frontend_ps3_process_args(int *argc, char *argv[])
char path[PATH_MAX_LENGTH] = {0};
strlcpy(path, argv[0], sizeof(path));
if (path_file_exists(path))
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, path);
rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH, path);
}
#endif
}

View File

@ -37,7 +37,7 @@
#include "tasks/tasks_internal.h"
#include "runloop.h"
#include "../../retroarch.h"
#include <sys/socket.h>
#include "fs/fs_utils.h"
#include "fs/sd_fat_devoptab.h"
@ -454,7 +454,7 @@ int main(int argc, char **argv)
if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms);
task_queue_ctl(TASK_QUEUE_CTL_WAIT, NULL);
task_queue_wait();
if (ret == -1)
break;

View File

@ -37,7 +37,7 @@
#include "../frontend_driver.h"
#include "../../configuration.h"
#include "../../defaults.h"
#include "../../runloop.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
/* We only load this library once, so we let it be

View File

@ -36,7 +36,7 @@
#include "../retroarch.h"
#ifndef HAVE_MAIN
#include "../runloop.h"
#include "../retroarch.h"
#endif
/**
@ -130,7 +130,9 @@ int rarch_main(int argc, char *argv[], void *data)
if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms);
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
task_queue_check();
if (ret == -1)
break;
}while(1);

View File

@ -105,16 +105,7 @@ frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
**/
frontend_ctx_driver_t *frontend_ctx_init_first(void)
{
unsigned i;
frontend_ctx_driver_t *frontend = NULL;
for (i = 0; frontend_ctx_drivers[i]; i++)
{
frontend = frontend_ctx_drivers[i];
break;
}
return frontend;
return frontend_ctx_drivers[0];
}
bool frontend_driver_get_core_extension(char *s, size_t len)

View File

@ -85,6 +85,9 @@ typedef struct frontend_ctx_driver
void (*destroy_signal_handler_state)(void);
void (*attach_console)(void);
void (*detach_console)(void);
#ifdef HAVE_LAKKA
void (*get_lakka_version)(char *, size_t);
#endif
const char *ident;

View File

@ -26,7 +26,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include "../video_context_driver.h"
#include "../video_driver.h"
#ifndef EGL_CONTEXT_FLAGS_KHR
#define EGL_CONTEXT_FLAGS_KHR 0x30FC

View File

@ -24,36 +24,6 @@
#include "../drivers/gl_symlinks.h"
#include "../video_coord_array.h"
void gl_ff_vertex(const struct video_coords *coords)
{
#ifndef NO_GL_FF_VERTEX
/* Fall back to fixed function-style if needed and possible. */
glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_FLOAT, 0, coords->color);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
}
void gl_ff_matrix(const math_matrix_4x4 *mat)
{
#ifndef NO_GL_FF_MATRIX
math_matrix_4x4 ident;
/* Fall back to fixed function-style if needed and possible. */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(mat->data);
glMatrixMode(GL_MODELVIEW);
matrix_4x4_identity(ident);
glLoadMatrixf(ident.data);
#endif
}
static void gl_size_format(GLint* internalFormat)
{

View File

@ -31,7 +31,7 @@
#include "../../verbosity.h"
#include "../font_driver.h"
#include "../video_coord_array.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../drivers/gl_symlinks.h"
RETRO_BEGIN_DECLS
@ -155,6 +155,41 @@ typedef struct gl
bool gl_load_luts(const struct video_shader *generic_shader,
GLuint *lut_textures);
#ifdef NO_GL_FF_VERTEX
#define gl_ff_vertex(coords) ((void)0)
#else
static INLINE void gl_ff_vertex(const struct video_coords *coords)
{
/* Fall back to fixed function-style if needed and possible. */
glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_FLOAT, 0, coords->color);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
#endif
#ifdef NO_GL_FF_MATRIX
#define gl_ff_matrix(mat) ((void)0)
#else
static INLINE void gl_ff_matrix(const math_matrix_4x4 *mat)
{
math_matrix_4x4 ident;
/* Fall back to fixed function-style if needed and possible. */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(mat->data);
glMatrixMode(GL_MODELVIEW);
matrix_4x4_identity(ident);
glLoadMatrixf(ident.data);
}
#endif
static INLINE unsigned gl_wrap_type_to_enum(enum gfx_wrap_type type)
{
switch (type)
@ -176,9 +211,8 @@ static INLINE unsigned gl_wrap_type_to_enum(enum gfx_wrap_type type)
return 0;
}
bool gl_query_core_context_in_use(void);
void gl_ff_vertex(const struct video_coords *coords);
void gl_ff_matrix(const math_matrix_4x4 *mat);
void gl_load_texture_image(GLenum target,
GLint level,
GLint internalFormat,

View File

@ -159,7 +159,7 @@ void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd,
retro_assert(staging->type == VULKAN_TEXTURE_STAGING);
vulkan_sync_texture_to_gpu(vk, staging);
vulkan_transition_texture(vk, staging);
vulkan_transition_texture(vk, cmd, staging);
/* We don't have to sync against previous TRANSFER,
* since we observed the completion by fences.
@ -170,7 +170,7 @@ void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd,
* We would also need to optionally maintain extra textures due to
* changes in resolution, so this seems like the sanest and
* simplest solution. */
vulkan_image_layout_transition(vk, vk->cmd, dynamic->image,
vulkan_image_layout_transition(vk, cmd, dynamic->image,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
0, VK_ACCESS_TRANSFER_WRITE_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
@ -184,12 +184,12 @@ void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd,
region.srcSubresource.layerCount = 1;
region.dstSubresource = region.srcSubresource;
vkCmdCopyImage(vk->cmd,
vkCmdCopyImage(cmd,
staging->image, VK_IMAGE_LAYOUT_GENERAL,
dynamic->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &region);
vulkan_image_layout_transition(vk, vk->cmd,
vulkan_image_layout_transition(vk, cmd,
dynamic->image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
@ -729,7 +729,7 @@ static void vulkan_write_quad_descriptors(
}
}
void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture)
void vulkan_transition_texture(vk_t *vk, VkCommandBuffer cmd, struct vk_texture *texture)
{
/* Transition to GENERAL layout for linear streamed textures.
* We're using linear textures here, so only
@ -744,7 +744,7 @@ void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture)
switch (texture->type)
{
case VULKAN_TEXTURE_STREAMED:
vulkan_image_layout_transition(vk, vk->cmd, texture->image,
vulkan_image_layout_transition(vk, cmd, texture->image,
texture->layout, VK_IMAGE_LAYOUT_GENERAL,
VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT,
VK_PIPELINE_STAGE_HOST_BIT,
@ -752,7 +752,7 @@ void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture)
break;
case VULKAN_TEXTURE_STAGING:
vulkan_image_layout_transition(vk, vk->cmd, texture->image,
vulkan_image_layout_transition(vk, cmd, texture->image,
texture->layout, VK_IMAGE_LAYOUT_GENERAL,
VK_ACCESS_HOST_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT,
VK_PIPELINE_STAGE_HOST_BIT,
@ -786,7 +786,7 @@ static void vulkan_check_dynamic_state(
void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call)
{
if (call->texture)
vulkan_transition_texture(vk, call->texture);
vulkan_transition_texture(vk, vk->cmd, call->texture);
if (call->pipeline != vk->tracker.pipeline)
{
@ -844,7 +844,7 @@ void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call)
void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
{
vulkan_transition_texture(vk, quad->texture);
vulkan_transition_texture(vk, vk->cmd, quad->texture);
if (quad->pipeline != vk->tracker.pipeline)
{
@ -867,7 +867,9 @@ void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
sizeof(*quad->mvp), &range))
return;
if (memcmp(quad->mvp, &vk->tracker.mvp, sizeof(*quad->mvp))
if (
string_is_equal_fast(quad->mvp,
&vk->tracker.mvp, sizeof(*quad->mvp))
|| quad->texture->view != vk->tracker.view
|| quad->sampler != vk->tracker.sampler)
{

View File

@ -46,7 +46,7 @@
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../drivers_shader/shader_vulkan.h"
RETRO_BEGIN_DECLS
@ -413,7 +413,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
void vulkan_sync_texture_to_gpu(vk_t *vk, const struct vk_texture *tex);
void vulkan_sync_texture_to_cpu(vk_t *vk, const struct vk_texture *tex);
void vulkan_transition_texture(vk_t *vk, struct vk_texture *texture);
void vulkan_transition_texture(vk_t *vk, VkCommandBuffer cmd, struct vk_texture *texture);
void vulkan_transfer_image_ownership(VkCommandBuffer cmd,
VkImage image, VkImageLayout layout,

View File

@ -26,7 +26,7 @@
#include "../../verbosity.h"
#include "../../driver.h"
#include "../../paths.h"
#include "../../runloop.h"
#include "../../retroarch.h"
#include "../../tasks/tasks_internal.h"
#include "../../core_info.h"
@ -190,7 +190,7 @@ INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message,
core_info_list_get_supported_cores(core_info_list,
path_get(RARCH_PATH_CONTENT), &core_info, &list_size);
info = (const core_info_t*)&core_info[lbItem];
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH,info->path);
rarch_ctl(RARCH_CTL_SET_LIBRETRO_PATH,info->path);
}
break;
}

View File

@ -27,7 +27,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include "../../driver.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#ifdef _XBOX
#include "../../defines/xdk_defines.h"

View File

@ -503,7 +503,7 @@ bool x11_connect(void)
return true;
}
void x11_update_title(void *data, video_frame_info_t *video_info)
void x11_update_title(void *data, void *data2)
{
char title[128];

View File

@ -22,7 +22,6 @@
#include <boolean.h>
#include "../video_driver.h"
#include "../video_context_driver.h"
extern Window g_x11_win;
extern Display *g_x11_dpy;
@ -63,7 +62,7 @@ bool x11_alive(void *data);
bool x11_connect(void);
void x11_update_title(void *data, video_frame_info_t *video_info);
void x11_update_title(void *data, void *data2);
bool x11_input_ctx_new(bool true_full);

View File

@ -526,14 +526,14 @@ static bool ctr_frame(void* data, const void* frame,
}
frames++;
#ifndef HAVE_THREADS
if(task_queue_ctl(TASK_QUEUE_CTL_FIND, &ctr_tasks_finder_data))
if(task_queue_find(&ctr_tasks_finder_data))
{
#if 0
ctr->vsync_event_pending = true;
#endif
while(ctr->vsync_event_pending)
{
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
task_queue_check();
svcSleepThread(0);
#if 0
aptMainLoop();
@ -865,12 +865,6 @@ static bool ctr_suppress_screensaver(void* data, bool enable)
return false;
}
static bool ctr_has_windowed(void* data)
{
(void)data;
return false;
}
static void ctr_free(void* data)
{
ctr_video_t* ctr = (ctr_video_t*)data;
@ -1178,7 +1172,7 @@ video_driver_t video_ctr =
ctr_alive,
ctr_focus,
ctr_suppress_screensaver,
ctr_has_windowed,
NULL, /* has_windowed */
ctr_set_shader,
ctr_free,
"ctr",

View File

@ -313,7 +313,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
static bool d3d_process_shader(d3d_video_t *d3d)
{
#ifdef HAVE_FBO
if (memcmp(path_get_extension(d3d->shader_path.c_str()), "cgp", 3) == 0)
if (string_is_equal_fast(path_get_extension(d3d->shader_path.c_str()), "cgp", 3))
return d3d_init_multipass(d3d);
#endif
@ -893,7 +893,7 @@ static bool d3d_alive(void *data)
mode.width = temp_width;
mode.height = temp_height;
video_context_driver_set_resize(mode);
current_video_context.set_resize(video_context_data, mode.width, mode.height);
d3d_restore(d3d);
}
@ -906,22 +906,12 @@ static bool d3d_alive(void *data)
return ret;
}
static bool d3d_focus(void *data)
{
return video_context_driver_focus();
}
static bool d3d_suppress_screensaver(void *data, bool enable)
{
bool enabled = enable;
return video_context_driver_suppress_screensaver(&enabled);
}
static bool d3d_has_windowed(void *data)
{
return video_context_driver_has_windowed();
}
static void d3d_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
{
d3d_video_t *d3d = (d3d_video_t*)data;
@ -1471,9 +1461,11 @@ static bool d3d_frame(void *data, const void *frame,
}
#endif
video_context_driver_update_window_title(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(
video_info->context_data, video_info);
return true;
}
@ -1721,9 +1713,9 @@ video_driver_t video_d3d = {
d3d_frame,
d3d_set_nonblock_state,
d3d_alive,
d3d_focus,
NULL, /* focus */
d3d_suppress_screensaver,
d3d_has_windowed,
NULL, /* has_windowed */
d3d_set_shader,
d3d_free,
"d3d",
@ -1731,7 +1723,7 @@ video_driver_t video_d3d = {
d3d_set_rotation,
d3d_viewport_info,
d3d_read_viewport,
NULL, /* read_frame_raw */
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
d3d_get_overlay_interface,
#endif

View File

@ -46,12 +46,8 @@
#include "../../driver.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
#include "../video_shader_driver.h"
#endif
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../common/d3d_common.h"
#include "../video_renderchain_driver.h"
#ifdef _XBOX

View File

@ -28,7 +28,6 @@
#include "../../driver.h"
#include "../../retroarch.h"
#include "../video_context_driver.h"
#include "../font_driver.h"
struct dispmanx_page
@ -577,13 +576,6 @@ static bool dispmanx_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool dispmanx_gfx_has_windowed(void *data)
{
(void)data;
return false;
}
static bool dispmanx_gfx_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
@ -696,7 +688,7 @@ video_driver_t video_dispmanx = {
dispmanx_gfx_alive,
dispmanx_gfx_focus,
dispmanx_gfx_suppress_screensaver,
dispmanx_gfx_has_windowed,
NULL, /* has_windowed */
dispmanx_gfx_set_shader,
dispmanx_gfx_free,
"dispmanx",

View File

@ -37,7 +37,6 @@
#endif
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../../retroarch.h"
#include "drm_pixformats.h"
@ -415,7 +414,7 @@ static uint64_t drm_plane_type(drmModePlane *plane)
for (j = 0; j < props->count_props; j++)
{
/* found the type property */
if (memcmp(drmModeGetProperty(drm.fd, props->props[j])->name, "type", 4) == 0)
if (string_is_equal_fast(drmModeGetProperty(drm.fd, props->props[j])->name, "type", 4))
return (props->prop_values[j]);
}
return (0);
@ -916,13 +915,6 @@ static bool drm_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool drm_gfx_has_windowed(void *data)
{
(void)data;
return false;
}
static bool drm_gfx_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
@ -1019,7 +1011,7 @@ video_driver_t video_drm = {
drm_gfx_alive,
drm_gfx_focus,
drm_gfx_suppress_screensaver,
drm_gfx_has_windowed,
NULL, /* has_windowed */
drm_gfx_set_shader,
drm_gfx_free,
"drm",

View File

@ -181,7 +181,7 @@ static int exynos_get_device_index(void)
ver = drmGetVersion(fd);
if (memcmp(ver->name, "exynos", 6) == 0)
if (string_is_equal_fast(ver->name, "exynos", 6))
found = true;
else
++index;
@ -1374,13 +1374,6 @@ static bool exynos_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool exynos_gfx_has_windowed(void *data)
{
(void)data;
return false;
}
static void exynos_gfx_set_rotation(void *data, unsigned rotation)
{
struct exynos_video *vid = (struct exynos_video*)data;
@ -1536,7 +1529,7 @@ video_driver_t video_exynos = {
exynos_gfx_alive,
exynos_gfx_focus,
exynos_gfx_suppress_screensaver,
exynos_gfx_has_windowed,
NULL, /* has_windowed */
exynos_gfx_set_shader,
exynos_gfx_free,
"exynos",

View File

@ -272,7 +272,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
InvalidateRect(hwnd, NULL, false);
video_context_driver_update_window_title(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
return true;
}

View File

@ -54,7 +54,6 @@
#endif
#include "../font_driver.h"
#include "../video_context_driver.h"
#ifdef HAVE_GLSL
#include "../drivers_shader/shader_glsl.h"
@ -76,8 +75,6 @@
#include "../common/win32_common.h"
#endif
#include "../video_shader_driver.h"
#ifndef GL_SYNC_GPU_COMMANDS_COMPLETE
#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
#endif
@ -220,9 +217,7 @@ static void gl_overlay_tex_geom(void *data,
static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
video_shader_ctx_info_t shader_info;
unsigned i;
unsigned width = video_info->width;
unsigned height = video_info->height;
@ -236,11 +231,8 @@ static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
glViewport(0, 0, width, height);
/* Ensure that we reset the attrib array. */
shader_info.data = gl;
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
shader_info.set_active = true;
video_shader_driver_use(shader_info);
video_info->cb_shader_use(gl,
video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true);
gl->coords.vertex = gl->overlay_vertex_coord;
gl->coords.tex_coord = gl->overlay_tex_coord;
@ -252,10 +244,7 @@ static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp_no_rot;
video_shader_driver_set_mvp(mvp);
video_info->cb_shader_set_mvp(gl, video_info->shader_data, &gl->mvp_no_rot);
for (i = 0; i < gl->overlays; i++)
{
@ -815,7 +804,7 @@ static INLINE void gl_copy_frame(gl_t *gl,
#endif
}
static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned idx)
static INLINE void gl_set_shader_viewports(gl_t *gl)
{
unsigned width, height;
video_shader_ctx_info_t shader_info;
@ -823,7 +812,14 @@ static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned idx)
video_driver_get_size(&width, &height);
shader_info.data = gl;
shader_info.idx = idx;
shader_info.idx = 0;
shader_info.set_active = true;
video_shader_driver_use(shader_info);
gl_set_viewport_wrapper(gl, width, height, false, true);
shader_info.data = gl;
shader_info.idx = 1;
shader_info.set_active = true;
video_shader_driver_use(shader_info);
@ -1001,9 +997,7 @@ static void gl_pbo_async_readback(gl_t *gl)
static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
video_shader_ctx_info_t shader_info;
GLfloat color[16];
unsigned width = video_info->width;
unsigned height = video_info->height;
@ -1033,11 +1027,7 @@ static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
gl->coords.color = color;
glBindTexture(GL_TEXTURE_2D, gl->menu_texture);
shader_info.data = gl;
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
shader_info.set_active = true;
video_shader_driver_use(shader_info);
video_info->cb_shader_use(gl, video_info->shader_data, VIDEO_SHADER_STOCK_BLEND, true);
gl->coords.vertices = 4;
@ -1046,10 +1036,7 @@ static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp_no_rot;
video_shader_driver_set_mvp(mvp);
video_info->cb_shader_set_mvp(gl, video_info->shader_data, &gl->mvp_no_rot);
glEnable(GL_BLEND);
@ -1077,11 +1064,9 @@ static bool gl_frame(void *data, const void *frame,
unsigned pitch, const char *msg,
video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
struct video_tex_info feedback_info;
video_shader_ctx_info_t shader_info;
gl_t *gl = (gl_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
@ -1096,11 +1081,7 @@ static bool gl_frame(void *data, const void *frame,
glBindVertexArray(gl->vao);
#endif
shader_info.data = gl;
shader_info.idx = 1;
shader_info.set_active = true;
video_shader_driver_use(shader_info);
video_info->cb_shader_use(gl, video_info->shader_data, 1, true);
#ifdef IOS
/* Apparently the viewport is lost each frame, thanks Apple. */
@ -1126,7 +1107,7 @@ static bool gl_frame(void *data, const void *frame,
mode.width = width;
mode.height = height;
video_context_driver_set_resize(mode);
video_info->cb_set_resize(video_info->context_data, mode.width, mode.height);
#ifdef HAVE_FBO
if (gl->fbo_inited)
@ -1240,10 +1221,7 @@ static bool gl_frame(void *data, const void *frame,
video_shader_driver_set_coords(coords);
mvp.data = gl;
mvp.matrix = &gl->mvp;
video_shader_driver_set_mvp(mvp);
video_info->cb_shader_set_mvp(gl, video_info->shader_data, &gl->mvp);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
@ -1273,17 +1251,14 @@ static bool gl_frame(void *data, const void *frame,
gl_render_overlay(gl, video_info);
#endif
video_context_driver_update_window_title(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
#ifdef HAVE_FBO
/* Reset state which could easily mess up libretro core. */
if (gl->hw_render_fbo_init)
{
shader_info.data = gl;
shader_info.idx = 0;
shader_info.set_active = true;
video_shader_driver_use(shader_info);
video_info->cb_shader_use(gl, video_info->shader_data, 0, true);
glBindTexture(GL_TEXTURE_2D, 0);
#ifndef NO_GL_FF_VERTEX
@ -1318,15 +1293,15 @@ static bool gl_frame(void *data, const void *frame,
* and pause to prevent flicker. */
if (
video_info->black_frame_insertion
&& !input_driver_is_nonblock_state()
&& !video_info->input_driver_nonblock_state
&& !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused)
{
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
glClear(GL_COLOR_BUFFER_BIT);
}
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
#ifdef HAVE_GL_SYNC
if (video_info->hard_sync && gl->have_sync)
@ -2001,8 +1976,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
/* Apparently need to set viewport for passes
* when we aren't using FBOs. */
gl_set_shader_viewport(gl, 0);
gl_set_shader_viewport(gl, 1);
gl_set_shader_viewports(gl);
mip_level = 1;
gl->tex_mipmap = video_shader_driver_mipmap_input(&mip_level);
@ -2133,22 +2107,12 @@ static bool gl_alive(void *data)
return ret;
}
static bool gl_focus(void *data)
{
return video_context_driver_focus();
}
static bool gl_suppress_screensaver(void *data, bool enable)
{
bool enabled = enable;
return video_context_driver_suppress_screensaver(&enabled);
}
static bool gl_has_windowed(void *data)
{
return video_context_driver_has_windowed();
}
static void gl_update_tex_filter_frame(gl_t *gl)
{
video_shader_ctx_filter_t shader_filter;
@ -2297,8 +2261,7 @@ static bool gl_set_shader(void *data,
#endif
/* Apparently need to set viewport for passes when we aren't using FBOs. */
gl_set_shader_viewport(gl, 0);
gl_set_shader_viewport(gl, 1);
gl_set_shader_viewports(gl);
context_bind_hw_render(true);
#if defined(_WIN32) && !defined(_XBOX)
/* Shader dialog is disabled for now, until video_threaded issues are fixed.
@ -2717,9 +2680,9 @@ video_driver_t video_gl = {
gl_frame,
gl_set_nonblock_state,
gl_alive,
gl_focus,
NULL, /* focus */
gl_suppress_screensaver,
gl_has_windowed,
NULL, /* has_windowed */
gl_set_shader,

View File

@ -29,7 +29,6 @@
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#include "../../menu/menu_display.h"
#endif
#ifdef HW_RVL
@ -1121,12 +1120,6 @@ static bool gx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gx_has_windowed(void *data)
{
(void)data;
return false;
}
static void gx_set_rotation(void *data, unsigned orientation)
{
gx_video_t *gx = (gx_video_t*)data;
@ -1591,7 +1584,7 @@ video_driver_t video_gx = {
gx_alive,
gx_focus,
gx_suppress_screensaver,
gx_has_windowed,
NULL, /* has_windowed */
gx_set_shader,
gx_free,
"gx",

View File

@ -49,8 +49,6 @@
#include "../../driver.h"
#include "../../retroarch.h"
#include "../video_context_driver.h"
typedef struct omapfb_page
{
unsigned yoffset;

View File

@ -604,12 +604,6 @@ static bool psp_suppress_screensaver(void *data, bool enable)
return false;
}
static bool psp_has_windowed(void *data)
{
(void)data;
return false;
}
static void psp_free(void *data)
{
psp1_video_t *psp = (psp1_video_t*)data;
@ -964,7 +958,7 @@ video_driver_t video_psp1 = {
psp_alive,
psp_focus,
psp_suppress_screensaver,
psp_has_windowed,
NULL, /* has_windowed */
psp_set_shader,
psp_free,
"psp1",

View File

@ -41,7 +41,6 @@
#include "../../configuration.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
typedef struct sdl2_tex
{

View File

@ -44,8 +44,6 @@
#include "../../configuration.h"
#include "../video_context_driver.h"
typedef struct sdl_menu_frame
{
bool active;

View File

@ -825,13 +825,6 @@ static void sunxi_gfx_set_rotation(void *data, unsigned rotation)
(void)rotation;
}
static bool sunxi_gfx_has_windowed(void *data)
{
(void)data;
return false;
}
static bool sunxi_gfx_suppress_screensaver(void *data, bool enable)
{
(void)data;
@ -971,7 +964,7 @@ video_driver_t video_sunxi = {
sunxi_gfx_alive,
sunxi_gfx_focus,
sunxi_gfx_suppress_screensaver,
sunxi_gfx_has_windowed,
NULL, /* has_windowed */
sunxi_gfx_set_shader,
sunxi_gfx_free,
"sunxi",

View File

@ -37,7 +37,6 @@
#endif
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../../retroarch.h"
#include "../../driver.h"
@ -423,9 +422,10 @@ static bool vg_frame(void *data, const void *frame,
vg_draw_message(vg, msg);
#endif
video_context_driver_update_window_title(video_info);
video_context_driver_swap_buffers(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_info->cb_swap_buffers(
video_info->context_data, video_info);
return true;
}
@ -451,22 +451,12 @@ static bool vg_alive(void *data)
return !quit;
}
static bool vg_focus(void *data)
{
return video_context_driver_focus();
}
static bool vg_suppress_screensaver(void *data, bool enable)
{
bool enabled = enable;
return video_context_driver_suppress_screensaver(&enabled);
}
static bool vg_has_windowed(void *data)
{
return video_context_driver_has_windowed();
}
static bool vg_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
@ -510,19 +500,19 @@ video_driver_t video_vg = {
vg_frame,
vg_set_nonblock_state,
vg_alive,
vg_focus,
NULL, /* focused */
vg_suppress_screensaver,
vg_has_windowed,
NULL, /* has_windowed */
vg_set_shader,
vg_free,
"vg",
NULL, /* set_viewport */
NULL, /* set_viewport */
vg_set_rotation,
vg_viewport_info,
vg_read_viewport,
NULL, /* read_frame_raw */
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
NULL, /* overlay_interface */
NULL, /* overlay_interface */
#endif
vg_get_poke_interface
};

View File

@ -244,7 +244,8 @@ static bool vga_gfx_frame(void *data, const void *frame,
if (msg)
font_driver_render_msg(video_info, NULL, msg, NULL);
video_context_driver_update_window_title(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
return true;
}
@ -275,12 +276,6 @@ static bool vga_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool vga_gfx_has_windowed(void *data)
{
(void)data;
return true;
}
static void vga_gfx_free(void *data)
{
(void)data;
@ -449,7 +444,7 @@ video_driver_t video_vga = {
vga_gfx_alive,
vga_gfx_focus,
vga_gfx_suppress_screensaver,
vga_gfx_has_windowed,
NULL, /* has_windowed */
vga_gfx_set_shader,
vga_gfx_free,
"vga",

View File

@ -33,7 +33,6 @@
#include "../common/vita2d_common.h"
#include "../../driver.h"
#include "../video_coord_array.h"
#include "../video_context_driver.h"
#include "../../verbosity.h"
#include "../../configuration.h"
@ -291,12 +290,6 @@ static bool vita2d_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool vita2d_gfx_has_windowed(void *data)
{
(void)data;
return true;
}
static void vita2d_gfx_free(void *data)
{
vita_video_t *vita = (vita_video_t *)data;
@ -965,7 +958,7 @@ video_driver_t video_vita2d = {
vita2d_gfx_alive,
vita2d_gfx_focus,
vita2d_gfx_suppress_screensaver,
vita2d_gfx_has_windowed,
NULL, /* has_windowed */
vita2d_gfx_set_shader,
vita2d_gfx_free,
"vita2d",

View File

@ -47,7 +47,6 @@
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
#include "../video_coord_array.h"
static void vulkan_set_viewport(void *data, unsigned viewport_width,
@ -1259,12 +1258,6 @@ static bool vulkan_alive(void *data)
return ret;
}
static bool vulkan_focus(void *data)
{
(void)data;
return video_context_driver_focus();
}
static bool vulkan_suppress_screensaver(void *data, bool enable)
{
(void)data;
@ -1272,12 +1265,6 @@ static bool vulkan_suppress_screensaver(void *data, bool enable)
return video_context_driver_suppress_screensaver(&enabled);
}
static bool vulkan_has_windowed(void *data)
{
(void)data;
return video_context_driver_has_windowed();
}
static bool vulkan_set_shader(void *data,
enum rarch_shader_type type, const char *path)
{
@ -1571,7 +1558,7 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
slock_unlock(vk->context->queue_lock);
#endif
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
}
static bool vulkan_frame(void *data, const void *frame,
@ -1727,7 +1714,7 @@ static bool vulkan_frame(void *data, const void *frame,
if (vk->swapchain[vk->last_valid_index].texture_optimal.memory != VK_NULL_HANDLE)
tex = &vk->swapchain[vk->last_valid_index].texture_optimal;
else
vulkan_transition_texture(vk, tex);
vulkan_transition_texture(vk, vk->cmd, tex);
input.image = tex->image;
input.view = tex->view;
@ -1937,12 +1924,11 @@ static bool vulkan_frame(void *data, const void *frame,
slock_unlock(vk->context->queue_lock);
#endif
video_context_driver_swap_buffers(video_info);
video_info->cb_swap_buffers(video_info->context_data, video_info);
if (!vk->context->swap_interval_emulation_lock)
video_context_driver_update_window_title(video_info);
video_info->cb_update_window_title(
video_info->context_data, video_info);
/* Handle spurious swapchain invalidations as soon as we can,
* i.e. right after swap buffers. */
@ -1951,7 +1937,8 @@ static bool vulkan_frame(void *data, const void *frame,
gfx_ctx_mode_t mode;
mode.width = width;
mode.height = height;
video_context_driver_set_resize(mode);
video_info->cb_set_resize(video_info->context_data, mode.width, mode.height);
vk->should_resize = false;
}
@ -1961,7 +1948,7 @@ static bool vulkan_frame(void *data, const void *frame,
* and pause to prevent flicker. */
if (
video_info->black_frame_insertion
&& !input_driver_is_nonblock_state()
&& !video_info->input_driver_nonblock_state
&& !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused)
{
@ -2582,9 +2569,9 @@ video_driver_t video_vulkan = {
vulkan_frame,
vulkan_set_nonblock_state,
vulkan_alive,
vulkan_focus,
NULL, /* focus */
vulkan_suppress_screensaver,
vulkan_has_windowed,
NULL, /* has_windowed */
vulkan_set_shader,
vulkan_free,
"vulkan",
@ -2592,7 +2579,7 @@ video_driver_t video_vulkan = {
vulkan_set_rotation,
vulkan_viewport_info,
vulkan_read_viewport,
NULL, /* vulkan_read_frame_raw */
NULL, /* vulkan_read_frame_raw */
#ifdef HAVE_OVERLAY
vulkan_get_overlay_interface,
@ -2600,6 +2587,6 @@ video_driver_t video_vulkan = {
NULL,
#endif
vulkan_get_poke_interface,
NULL, /* vulkan_wrap_type_to_enum */
NULL, /* vulkan_wrap_type_to_enum */
};

View File

@ -728,12 +728,6 @@ static bool wiiu_gfx_suppress_screensaver(void* data, bool enable)
return false;
}
static bool wiiu_gfx_has_windowed(void* data)
{
(void)data;
return true;
}
static bool wiiu_gfx_set_shader(void* data,
enum rarch_shader_type type, const char* path)
{
@ -887,7 +881,7 @@ video_driver_t video_wiiu =
wiiu_gfx_alive,
wiiu_gfx_focus,
wiiu_gfx_suppress_screensaver,
wiiu_gfx_has_windowed,
NULL, /* has_windowed */
wiiu_gfx_set_shader,
wiiu_gfx_free,
"gx2",

View File

@ -271,12 +271,6 @@ static bool xenon360_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool xenon360_gfx_has_windowed(void *data)
{
(void)data;
return false;
}
static void xenon360_gfx_set_rotation(void *data, unsigned rotation)
{
(void)data;
@ -321,7 +315,7 @@ video_driver_t video_xenon360 = {
xenon360_gfx_alive,
xenon360_gfx_focus,
xenon360_gfx_suppress_screensaver,
xenon360_gfx_has_windowed,
NULL, /* has_windowed */
xenon360_gfx_set_shader,
xenon360_gfx_free,
"xenon360",

View File

@ -138,11 +138,6 @@ static bool xshm_gfx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool xshm_gfx_has_windowed(void *data)
{
return true;
}
static void xshm_gfx_free(void *data)
{

View File

@ -471,7 +471,7 @@ dpi_fallback:
return true;
}
static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
static void android_gfx_ctx_swap_buffers(void *data, void *data2)
{
android_ctx_data_t *and = (android_ctx_data_t*)data;

View File

@ -29,7 +29,7 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include "../video_context_driver.h"
#include "../video_driver.h"
typedef int CGSConnectionID;
typedef int CGSWindowID;

View File

@ -39,7 +39,7 @@
#include <compat/apple_compat.h>
#import "../../ui/drivers/cocoa/cocoa_common.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
@ -427,10 +427,10 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned
}
#if defined(HAVE_COCOA)
static void cocoagl_gfx_ctx_update_title(void *data, video_frame_info_t *video_info)
static void cocoagl_gfx_ctx_update_title(void *data, void *data2)
{
ui_window_cocoa_t view;
const ui_window_t *window = ui_companion_driver_get_window_ptr();
const ui_window_t *window = ui_companion_driver_get_window_ptr();
view.data = (CocoaView*)nsview_get_ptr();
@ -538,7 +538,7 @@ static bool cocoagl_gfx_ctx_has_windowed(void *data)
}
#endif
static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
static void cocoagl_gfx_ctx_swap_buffers(void *data, void *data2)
{
if (!(--g_fast_forward_skips < 0))
return;

View File

@ -25,10 +25,12 @@
#endif
#include <compat/strl.h>
#include <string/stdstring.h>
#include "../drivers/d3d.h"
#include "../common/win32_common.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../ui/ui_companion_driver.h"
@ -75,7 +77,7 @@ static bool gfx_ctx_d3d_set_resize(void *data, unsigned new_width, unsigned new_
return true;
}
static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_d3d_swap_buffers(void *data, void *data2)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
@ -83,8 +85,9 @@ static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t *video_info)
d3d_swap(d3d, d3dr);
}
static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t *video_info)
static void gfx_ctx_d3d_update_title(void *data, void *data2)
{
video_frame_info_t *video_info = (video_frame_info_t*)data2;
#ifdef _XBOX
if (video_info->fps_show)
{
@ -186,6 +189,19 @@ static void gfx_ctx_d3d_input_driver(void *data,
*input = xinput ? (const input_driver_t*)&input_xinput : NULL;
*input_data = xinput;
#else
settings_t *settings = config_get_ptr();
if (string_is_equal_fast(settings->arrays.input_driver, "raw", 4))
{
*input_data = input_winraw.init(name);
if (*input_data)
{
*input = &input_winraw;
dinput = NULL;
return;
}
}
dinput = input_dinput.init(name);
*input = dinput ? &input_dinput : NULL;
*input_data = dinput;

View File

@ -228,9 +228,10 @@ static bool gfx_ctx_drm_queue_flip(void)
return false;
}
static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_drm_swap_buffers(void *data, void *data2)
{
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
video_frame_info_t *video_info = (video_frame_info_t*)data2;
switch (drm_api)
{

View File

@ -25,7 +25,7 @@
#include "../../config.h"
#endif
#include "../video_context_driver.h"
#include "../video_driver.h"
#ifdef HAVE_EGL
#include "../common/egl_common.h"
@ -74,7 +74,7 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
*quit = false;
}
static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_emscripten_swap_buffers(void *data, void *data2)
{
(void)data;
/* no-op in emscripten, no way to force swap/wait for VSync in browsers */

View File

@ -35,7 +35,7 @@
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../common/win32_common.h"
@ -86,7 +86,7 @@ static bool gfx_ctx_gdi_set_resize(void *data,
return false;
}
static void gfx_ctx_gdi_update_window_title(void *data, video_frame_info_t *video_info)
static void gfx_ctx_gdi_update_window_title(void *data, void *data2)
{
const ui_window_t *window = ui_companion_driver_get_window_ptr();
char title[128];
@ -284,7 +284,7 @@ static uint32_t gfx_ctx_gdi_get_flags(void *data)
return flags;
}
static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_gdi_swap_buffers(void *data, void *data2)
{
(void)data;

View File

@ -16,7 +16,7 @@
/* Null context. */
#include "../video_context_driver.h"
#include "../video_driver.h"
static void gfx_ctx_null_swap_interval(void *data, unsigned interval)
{
@ -34,7 +34,7 @@ static void gfx_ctx_null_check_window(void *data, bool *quit,
(void)resize;
}
static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_null_swap_buffers(void *data, void *data2)
{
(void)data;
}

View File

@ -180,7 +180,7 @@ static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_inte
}
}
static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_khr_display_swap_buffers(void *data, void *data2)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index);

View File

@ -241,7 +241,7 @@ static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_inter
#endif
}
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, void *data2)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;

View File

@ -203,7 +203,7 @@ static bool gfx_ctx_opendingux_suppress_screensaver(void *data, bool enable)
return false;
}
static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_opendingux_swap_buffers(void *data, void *data2)
{
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;

View File

@ -337,7 +337,7 @@ static bool osmesa_ctx_has_windowed(void *data)
return true;
}
static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
static void osmesa_ctx_swap_buffers(void *data, void *data2)
{
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
osmesa_fifo_accept(osmesa);

View File

@ -33,7 +33,7 @@
#include "../../configuration.h"
#include "../../defines/ps3_defines.h"
#include "../common/gl_common.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
typedef struct gfx_ctx_ps3_data
{
@ -173,7 +173,7 @@ static bool gfx_ctx_ps3_suppress_screensaver(void *data, bool enable)
return false;
}
static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_ps3_swap_buffers(void *data, void *data2)
{
(void)data;
#ifdef HAVE_LIBDBGFONT

View File

@ -413,7 +413,7 @@ static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned swap_interval)
#endif
}
static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_qnx_swap_buffers(void *data, void *data2)
{
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;

View File

@ -266,7 +266,7 @@ static void sdl_ctx_get_video_size(void *data,
}
}
static void sdl_ctx_update_title(void *data, video_frame_info_t *video_info)
static void sdl_ctx_update_title(void *data, void *data2)
{
char title[128];
@ -365,7 +365,7 @@ static bool sdl_ctx_has_windowed(void *data)
return true;
}
static void sdl_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
static void sdl_ctx_swap_buffers(void *data, void *data2)
{
#ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;

View File

@ -32,7 +32,7 @@
#include <retro_inline.h>
#include "../../configuration.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../../frontend/frontend_driver.h"
@ -581,7 +581,7 @@ error:
return false;
}
static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_vc_swap_buffers(void *data, void *data2)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;

View File

@ -219,7 +219,7 @@ static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval
#endif
}
static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_vivante_swap_buffers(void *data, void *data2)
{
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;

View File

@ -499,22 +499,22 @@ static void registry_handle_global(void *data, struct wl_registry *reg,
(void)version;
if (memcmp(interface, "wl_compositor", 13) == 0)
if (string_is_equal_fast(interface, "wl_compositor", 13))
wl->compositor = (struct wl_compositor*)wl_registry_bind(reg,
id, &wl_compositor_interface, 3);
else if (memcmp(interface, "wl_output", 9) == 0)
else if (string_is_equal_fast(interface, "wl_output", 9))
{
output = (struct wl_output*)wl_registry_bind(reg,
id, &wl_output_interface, 2);
wl_output_add_listener(output, &output_listener, wl);
wl_display_roundtrip(wl->dpy);
}
else if (memcmp(interface, "wl_shell", 8) == 0)
else if (string_is_equal_fast(interface, "wl_shell", 8))
wl->shell = (struct wl_shell*)
wl_registry_bind(reg, id, &wl_shell_interface, 1);
else if (memcmp(interface, "wl_shm", 6) == 0)
else if (string_is_equal_fast(interface, "wl_shm", 6))
wl->shm = (struct wl_shm*)wl_registry_bind(reg, id, &wl_shm_interface, 1);
else if (memcmp(interface, "wl_seat", 7) == 0)
else if (string_is_equal_fast(interface, "wl_seat", 7))
{
wl->seat = (struct wl_seat*)wl_registry_bind(reg, id, &wl_seat_interface, 4);
wl_seat_add_listener(wl->seat, &seat_listener, wl);
@ -720,7 +720,7 @@ static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
return true;
}
static void gfx_ctx_wl_update_title(void *data, video_frame_info_t *video_info)
static void gfx_ctx_wl_update_title(void *data, void *data2)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
char title[128];
@ -1567,7 +1567,7 @@ static void *gfx_ctx_wl_get_context_data(void *data)
}
#endif
static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_wl_swap_buffers(void *data, void *data2)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

View File

@ -34,6 +34,7 @@
#include <commdlg.h>
#include <dynamic/dylib.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -41,7 +42,7 @@
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
#include "../common/win32_common.h"
@ -102,6 +103,27 @@ static enum gfx_ctx_api win32_api = GFX_CTX_NONE;
static dylib_t dll_handle = NULL; /* Handle to OpenGL32.dll */
static gfx_ctx_proc_t gfx_ctx_wgl_get_proc_address(const char *symbol)
{
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#if defined(HAVE_OPENGL)
{
gfx_ctx_proc_t func = (gfx_ctx_proc_t)wglGetProcAddress(symbol);
if (func)
return func;
}
#endif
break;
default:
break;
}
return (gfx_ctx_proc_t)GetProcAddress((HINSTANCE)dll_handle, symbol);
}
#if defined(HAVE_OPENGL)
static void setup_pixel_format(HDC hdc)
{
PIXELFORMATDESCRIPTOR pfd = {0};
@ -117,7 +139,6 @@ static void setup_pixel_format(HDC hdc)
SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd);
}
#if defined(HAVE_OPENGL)
static void create_gl_context(HWND hwnd, bool *quit)
{
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
@ -203,8 +224,7 @@ static void create_gl_context(HWND hwnd, bool *quit)
*aptr = 0;
if (!pcreate_context)
pcreate_context = (wglCreateContextAttribsProc)
wglGetProcAddress("wglCreateContextAttribsARB");
pcreate_context = (wglCreateContextAttribsProc)gfx_ctx_wgl_get_proc_address("wglCreateContextAttribsARB");
if (pcreate_context)
{
@ -331,7 +351,7 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_wgl_swap_buffers(void *data, void *data2)
{
(void)data;
@ -386,7 +406,7 @@ static bool gfx_ctx_wgl_set_resize(void *data,
return false;
}
static void gfx_ctx_wgl_update_title(void *data, video_frame_info_t *video_info)
static void gfx_ctx_wgl_update_title(void *data, void *data2)
{
const ui_window_t *window = ui_companion_driver_get_window_ptr();
@ -540,12 +560,8 @@ static bool gfx_ctx_wgl_set_video_mode(void *data,
switch (win32_api)
{
case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
p_swap_interval = (BOOL (APIENTRY *)(int))
wglGetProcAddress("wglSwapIntervalEXT");
#endif
p_swap_interval = (BOOL (APIENTRY *)(int))gfx_ctx_wgl_get_proc_address("wglSwapIntervalEXT");
break;
case GFX_CTX_NONE:
default:
break;
@ -564,10 +580,22 @@ static void gfx_ctx_wgl_input_driver(void *data,
const char *joypad_name,
const input_driver_t **input, void **input_data)
{
dinput_wgl = input_dinput.init(joypad_name);
settings_t *settings = config_get_ptr();
*input = dinput_wgl ? &input_dinput : NULL;
*input_data = dinput_wgl;
if (string_is_equal_fast(settings->arrays.input_driver, "raw", 4))
{
*input_data = input_winraw.init(joypad_name);
if (*input_data)
{
*input = &input_winraw;
dinput_wgl = NULL;
return;
}
}
dinput_wgl = input_dinput.init(joypad_name);
*input = dinput_wgl ? &input_dinput : NULL;
*input_data = dinput_wgl;
}
static bool gfx_ctx_wgl_has_focus(void *data)
@ -587,15 +615,6 @@ static bool gfx_ctx_wgl_has_windowed(void *data)
return true;
}
static gfx_ctx_proc_t gfx_ctx_wgl_get_proc_address(const char *symbol)
{
#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN)
gfx_ctx_proc_t func = (gfx_ctx_proc_t)wglGetProcAddress(symbol);
if (func)
return func;
#endif
return (gfx_ctx_proc_t)GetProcAddress((HINSTANCE)dll_handle, symbol);
}
static bool gfx_ctx_wgl_get_metrics(void *data,
enum display_metric_types type, float *value)

View File

@ -307,7 +307,7 @@ static void gfx_ctx_x_swap_interval(void *data, unsigned interval)
}
}
static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_x_swap_buffers(void *data, void *data2)
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;

View File

@ -490,7 +490,7 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state)
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t *video_info)
static void gfx_ctx_xegl_swap_buffers(void *data, void *data2)
{
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;

View File

@ -22,8 +22,7 @@
#include "../common/gl_common.h"
#include "../font_driver.h"
#include "../video_shader_driver.h"
#include "../video_context_driver.h"
#include "../video_driver.h"
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */

View File

@ -293,7 +293,7 @@ static void vita2d_font_render_msg(
g = FONT_COLOR_GET_GREEN(params->color);
b = FONT_COLOR_GET_BLUE(params->color);
alpha = FONT_COLOR_GET_ALPHA(params->color);
color = params->color;
color = RGBA8(r,g,b,alpha);
}
else
{

View File

@ -15,6 +15,7 @@
#include <string.h>
#include <encodings/utf.h>
#include <compat/strl.h>
#include "../common/vulkan_common.h"
@ -25,8 +26,11 @@ typedef struct
{
vk_t *vk;
struct vk_texture texture;
struct vk_texture texture_optimal;
const font_renderer_driver_t *font_driver;
void *font_data;
struct font_atlas *atlas;
bool needs_update;
struct vk_vertex *pv;
struct vk_buffer_range range;
@ -39,7 +43,6 @@ static void *vulkan_raster_font_init_font(void *data,
const char *font_path, float font_size,
bool is_threaded)
{
const struct font_atlas *atlas = NULL;
vulkan_raster_t *font =
(vulkan_raster_t*)calloc(1, sizeof(*font));
@ -65,10 +68,19 @@ static void *vulkan_raster_font_init_font(void *data,
return NULL;
}
atlas = font->font_driver->get_atlas(font->font_data);
font->atlas = font->font_driver->get_atlas(font->font_data);
font->texture = vulkan_create_texture(font->vk, NULL,
atlas->width, atlas->height, VK_FORMAT_R8_UNORM, atlas->buffer,
NULL /*&swizzle*/, VULKAN_TEXTURE_STATIC);
font->atlas->width, font->atlas->height, VK_FORMAT_R8_UNORM, font->atlas->buffer,
NULL /*&swizzle*/, VULKAN_TEXTURE_STAGING);
vulkan_map_persistent_texture(
font->vk->context->device, &font->texture);
font->texture_optimal = vulkan_create_texture(font->vk, NULL,
font->atlas->width, font->atlas->height, VK_FORMAT_R8_UNORM, NULL,
NULL /*&swizzle*/, VULKAN_TEXTURE_DYNAMIC);
font->needs_update = true;
return font;
}
@ -85,10 +97,29 @@ static void vulkan_raster_font_free_font(void *data, bool is_threaded)
vkQueueWaitIdle(font->vk->context->queue);
vulkan_destroy_texture(
font->vk->context->device, &font->texture);
vulkan_destroy_texture(
font->vk->context->device, &font->texture_optimal);
free(font);
}
static INLINE void vulkan_raster_font_update_glyph(vulkan_raster_t *font, const struct font_glyph *glyph)
{
if(font->atlas->dirty)
{
int row;
for(row = glyph->atlas_offset_y; row < (glyph->atlas_offset_y + glyph->height); row++)
{
uint8_t* src = font->atlas->buffer + row * font->atlas->width + glyph->atlas_offset_x;
uint8_t* dst = (uint8_t*)font->texture.mapped + row * font->texture.stride + glyph->atlas_offset_x;
memcpy(dst, src, glyph->width);
}
font->atlas->dirty = false;
font->needs_update = true;
}
}
static int vulkan_get_message_width(void *data, const char *msg,
unsigned msg_len, float scale)
{
@ -107,8 +138,12 @@ static int vulkan_get_message_width(void *data, const char *msg,
if (!glyph) /* Do something smarter here ... */
glyph = font->font_driver->get_glyph(font->font_data, '?');
if (glyph)
{
vulkan_raster_font_update_glyph(font, glyph);
delta_x += glyph->advance_x;
}
}
return delta_x * scale;
@ -119,9 +154,9 @@ static void vulkan_raster_font_render_line(
float scale, const float color[4], float pos_x,
float pos_y, unsigned text_align)
{
unsigned i;
struct vk_color vk_color;
vk_t *vk = font->vk;
const char* msg_end = msg + msg_len;
int x = roundf(pos_x * vk->vp.width);
int y = roundf((1.0f - pos_y) * vk->vp.height);
int delta_x = 0;
@ -146,17 +181,20 @@ static void vulkan_raster_font_render_line(
break;
}
for (i = 0; i < msg_len; i++)
while (msg < msg_end)
{
int off_x, off_y, tex_x, tex_y, width, height;
unsigned code = utf8_walk(&msg);
const struct font_glyph *glyph =
font->font_driver->get_glyph(font->font_data, (uint8_t)msg[i]);
font->font_driver->get_glyph(font->font_data, code);
if (!glyph) /* Do something smarter here ... */
glyph = font->font_driver->get_glyph(font->font_data, '?');
if (!glyph)
continue;
vulkan_raster_font_update_glyph(font, glyph);
off_x = glyph->draw_offset_x;
off_y = glyph->draw_offset_y;
tex_x = glyph->atlas_offset_x;
@ -235,7 +273,7 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
{
const struct vk_draw_triangles call = {
font->vk->pipelines.font,
&font->texture,
&font->texture_optimal,
font->vk->samplers.mipmap_linear,
&font->vk->mvp,
sizeof(font->vk->mvp),
@ -243,6 +281,47 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
font->vertices,
};
if(font->needs_update)
{
VkCommandBuffer staging;
VkSubmitInfo submit_info = { VK_STRUCTURE_TYPE_SUBMIT_INFO };
VkCommandBufferAllocateInfo cmd_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO };
VkCommandBufferBeginInfo begin_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
cmd_info.commandPool = font->vk->staging_pool;
cmd_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
cmd_info.commandBufferCount = 1;
vkAllocateCommandBuffers(font->vk->context->device, &cmd_info, &staging);
begin_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
vkBeginCommandBuffer(staging, &begin_info);
vulkan_copy_staging_to_dynamic(font->vk, staging,
&font->texture_optimal, &font->texture);
vkEndCommandBuffer(staging);
#ifdef HAVE_THREADS
slock_lock(font->vk->context->queue_lock);
#endif
submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = &staging;
vkQueueSubmit(font->vk->context->queue,
1, &submit_info, VK_NULL_HANDLE);
vkQueueWaitIdle(font->vk->context->queue);
#ifdef HAVE_THREADS
slock_unlock(font->vk->context->queue_lock);
#endif
vkFreeCommandBuffers(font->vk->context->device,
font->vk->staging_pool, 1, &staging);
font->needs_update = false;
}
vulkan_draw_triangles(font->vk, &call);
}
@ -340,13 +419,20 @@ static void vulkan_raster_font_render_msg(
static const struct font_glyph *vulkan_raster_font_get_glyph(
void *data, uint32_t code)
{
const struct font_glyph* glyph;
vulkan_raster_t *font = (vulkan_raster_t*)data;
if (!font || !font->font_driver)
return NULL;
if (!font->font_driver->ident)
return NULL;
return font->font_driver->get_glyph((void*)font->font_driver, code);
glyph = font->font_driver->get_glyph((void*)font->font_driver, code);
if(glyph)
vulkan_raster_font_update_glyph(font, glyph);
return glyph;
}
static void vulkan_raster_font_flush_block(unsigned width, unsigned height,

View File

@ -299,7 +299,7 @@ static bool cg_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
for (count = 0; count < MAXD3DDECLLENGTH; count++)
{
if (memcmp(&decl_end, &decl[count], sizeof(decl_end)) == 0)
if (string_is_equal_fast(&decl_end, &decl[count], sizeof(decl_end)))
break;
}

View File

@ -50,7 +50,7 @@
#include "../common/win32_common.h"
#endif
#include "../video_shader_driver.h"
#include "../video_driver.h"
#define set_texture_coords(coords, xamt, yamt) \
coords[2] = xamt; \

View File

@ -21,7 +21,7 @@
#include "../drivers/d3d.h"
#include "../common/d3d_common.h"
#include "../video_shader_driver.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"

View File

@ -46,7 +46,7 @@
#include "../include/Cg/cg.h"
#include "../video_shader_driver.h"
#include "../video_driver.h"
#include "../video_shader_parse.h"
#include "../../core.h"
#include "../../managers/state_manager.h"
@ -261,14 +261,13 @@ static bool gl_cg_set_mvp(void *data, void *shader_data, const math_matrix_4x4 *
{
cg_shader_data_t *cg = (cg_shader_data_t*)shader_data;
if (!cg || !cg->prg[cg->active_idx].mvp)
goto fallback;
{
gl_ff_matrix(mat);
return false;
}
cgGLSetMatrixParameterfc(cg->prg[cg->active_idx].mvp, mat->data);
return true;
fallback:
gl_ff_matrix(mat);
return false;
}
static bool gl_cg_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
@ -1054,7 +1053,7 @@ static void *gl_cg_init(void *data, const char *path)
memset(cg->alias_define, 0, sizeof(cg->alias_define));
if ( !string_is_empty(path)
&& (memcmp(path_get_extension(path), "cgp", 3) == 0))
&& string_is_equal_fast(path_get_extension(path), "cgp", 3))
{
if (!gl_cg_load_preset(cg, path))
goto error;

View File

@ -257,10 +257,27 @@ static bool gl_glsl_compile_shader(glsl_shader_data_t *glsl,
GLint status;
const char *source[4];
char version[32];
const char *existing_version = strstr(program, "#version");
version[0] = '\0';
version[0] = '\0';
if (glsl_core && !strstr(program, "#version"))
if (existing_version)
{
const char* version_extra = "";
unsigned version_no = strtoul(existing_version + 8, (char**)&program, 10);
#ifdef HAVE_OPENGLES
if (version_no < 130)
version_no = 100;
else
{
version_extra = " es";
version_no = 300;
}
#endif
snprintf(version, sizeof(version), "#version %u%s\n", version_no, version_extra);
RARCH_LOG("[GLSL]: Using GLSL version %u%s.\n", version_no, version_extra);
}
else if (glsl_core)
{
unsigned version_no = 0;
unsigned gl_ver = glsl_major * 100 + glsl_minor * 10;
@ -758,7 +775,7 @@ static void *gl_glsl_init(void *data, const char *path)
bool ret = false;
const char *path_ext = path_get_extension(path);
if (memcmp(path_ext, "glslp", 5) == 0)
if (string_is_equal_fast(path_ext, "glslp", 5))
{
conf = config_file_new(path);
if (conf)
@ -767,7 +784,7 @@ static void *gl_glsl_init(void *data, const char *path)
glsl->shader->modern = true;
}
}
else if (memcmp(path_ext, "glsl", 4) == 0)
else if (string_is_equal_fast(path_ext, "glsl", 4))
{
strlcpy(glsl->shader->pass[0].source.path, path,
sizeof(glsl->shader->pass[0].source.path));
@ -1361,7 +1378,10 @@ static bool gl_glsl_set_mvp(void *data, void *shader_data, const math_matrix_4x4
(void)data;
if (!glsl || !glsl->shader->modern)
goto fallback;
{
gl_ff_matrix(mat);
return false;
}
loc = glsl->uniforms[glsl->active_idx].mvp;
if (loc >= 0)
@ -1376,11 +1396,8 @@ static bool gl_glsl_set_mvp(void *data, void *shader_data, const math_matrix_4x4
current_mat_data[glsl->active_idx] = *mat->data;
}
}
return true;
fallback:
gl_ff_matrix(mat);
return false;
return true;
}
#define gl_glsl_set_coord_array(attribs, coord1, coord2, coords, size, multiplier) \

View File

@ -19,7 +19,7 @@
#define __RARCH_GLSL_H
#include <boolean.h>
#include "../video_shader_driver.h"
#include "../video_driver.h"
void gl_glsl_set_get_proc_address(gfx_ctx_proc_t (*proc)(const char*));

View File

@ -410,7 +410,7 @@ static void *hlsl_init(void *data, const char *path)
if (!hlsl_data)
return NULL;
if (path && (memcmp(path_get_extension(path), ".cgp", 4) == 0))
if (path && (string_is_equal_fast(path_get_extension(path), ".cgp", 4)))
{
if (!hlsl_load_preset(hlsl_data, d3d, path))
goto error;

View File

@ -17,9 +17,10 @@
#ifndef __RARCH_HLSL_H
#define __RARCH_HLSL_H
#include "../video_shader_driver.h"
#include <stdint.h>
#include "../video_driver.h"
void hlsl_set_proj_matrix(void *data, XMMATRIX rotation_value);
#define RARCH_HLSL_MAX_SHADERS 16

View File

@ -27,11 +27,7 @@
#include "../../config.h"
#endif
#ifdef HAVE_OPENGL
#include "../common/gl_common.h"
#endif
#include "../video_shader_driver.h"
#include "../video_driver.h"
typedef struct null_shader_data
{
@ -58,18 +54,6 @@ static void *shader_null_init(void *data, const char *path)
return null_shader;
}
static void shader_null_set_params(void *data, void *shader_data,
unsigned width, unsigned height,
unsigned tex_width, unsigned tex_height,
unsigned out_width, unsigned out_height,
unsigned frame_count,
const void *info,
const void *prev_info,
const void *feedback_info,
const void *fbo_info, unsigned fbo_info_cnt)
{
}
static void shader_null_set_uniform_parameter(
void *data,
struct uniform_info *param,
@ -77,82 +61,11 @@ static void shader_null_set_uniform_parameter(
{
}
static bool shader_null_set_mvp(void *data, void *shader_data, const math_matrix_4x4 *mat)
{
#ifdef HAVE_OPENGL
#ifndef NO_GL_FF_MATRIX
if (memcmp(video_driver_get_ident(), "gl", 2) == 0)
gl_ff_matrix(mat);
#endif
#endif
return false;
}
static bool shader_null_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
{
#ifdef HAVE_OPENGL
#ifndef NO_GL_FF_VERTEX
if (memcmp(video_driver_get_ident(), "gl", 2) == 0)
gl_ff_vertex(coords);
#endif
#endif
return false;
}
static void shader_null_use(void *data, void *shader_data, unsigned idx, bool set_active)
{
(void)data;
(void)idx;
(void)set_active;
}
static unsigned shader_null_num(void *data)
{
return 0;
}
static bool shader_null_filter_type(void *data, unsigned idx, bool *smooth)
{
(void)idx;
(void)smooth;
return false;
}
static enum gfx_wrap_type shader_null_wrap_type(void *data, unsigned idx)
{
(void)idx;
return RARCH_WRAP_BORDER;
}
static void shader_null_shader_scale(void *data,
unsigned idx, struct gfx_fbo_scale *scale)
{
(void)idx;
(void)scale;
}
static unsigned shader_null_get_prev_textures(void *data)
{
return 0;
}
static bool shader_null_mipmap_input(void *data, unsigned idx)
{
(void)idx;
return false;
}
static bool shader_null_get_feedback_pass(void *data, unsigned *idx)
{
(void)idx;
return false;
}
static struct video_shader *shader_null_get_current_shader(void *data)
{
return NULL;
}
static bool shader_null_compile_program(
void *data,
unsigned idx,
@ -165,21 +78,21 @@ static bool shader_null_compile_program(
const shader_backend_t shader_null_backend = {
shader_null_init,
shader_null_deinit,
shader_null_set_params,
NULL,
shader_null_set_uniform_parameter,
shader_null_compile_program,
shader_null_use,
shader_null_num,
shader_null_filter_type,
shader_null_wrap_type,
shader_null_shader_scale,
shader_null_set_coords,
NULL,
shader_null_set_mvp,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
shader_null_get_prev_textures,
shader_null_get_feedback_pass,
shader_null_mipmap_input,
shader_null_get_current_shader,
NULL,
NULL,
NULL,
RARCH_SHADER_NONE,
"nullshader"

View File

@ -26,10 +26,11 @@
#include <compat/strl.h>
#include <formats/image.h>
#include <retro_miscellaneous.h>
#include "slang_reflection.hpp"
#include "../video_shader_driver.h"
#include "../video_driver.h"
#include "../../verbosity.h"
#include "../../msg_hash.h"
@ -45,7 +46,7 @@ static const uint32_t opaque_frag[] =
static unsigned num_miplevels(unsigned width, unsigned height)
{
unsigned size = std::max(width, height);
unsigned size = MAX(width, height);
unsigned levels = 0;
while (size)
{
@ -280,23 +281,23 @@ class Framebuffer
void generate_mips(VkCommandBuffer cmd);
private:
VkDevice device = VK_NULL_HANDLE;
const VkPhysicalDeviceMemoryProperties &memory_properties;
VkImage image = VK_NULL_HANDLE;
VkImageView view = VK_NULL_HANDLE;
VkDevice device = VK_NULL_HANDLE;
VkImage image = VK_NULL_HANDLE;
VkImageView view = VK_NULL_HANDLE;
VkImageView fb_view = VK_NULL_HANDLE;
Size2D size;
VkFormat format;
unsigned max_levels;
unsigned levels = 0;
unsigned levels = 0;
VkFramebuffer framebuffer = VK_NULL_HANDLE;
VkRenderPass render_pass = VK_NULL_HANDLE;
VkRenderPass render_pass = VK_NULL_HANDLE;
struct
{
size_t size = 0;
uint32_t type = 0;
size_t size = 0;
uint32_t type = 0;
VkDeviceMemory memory = VK_NULL_HANDLE;
} memory;
@ -2171,17 +2172,18 @@ Framebuffer::Framebuffer(
void Framebuffer::clear(VkCommandBuffer cmd)
{
VkClearColorValue color;
VkImageSubresourceRange range;
image_layout_transition(cmd, image,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
0, VK_ACCESS_TRANSFER_WRITE_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT);
VkClearColorValue color;
memset(&color, 0, sizeof(color));
VkImageSubresourceRange range;
memset(&range, 0, sizeof(range));
range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
range.levelCount = 1;
range.layerCount = 1;
@ -2198,6 +2200,7 @@ void Framebuffer::clear(VkCommandBuffer cmd)
void Framebuffer::generate_mips(VkCommandBuffer cmd)
{
unsigned i;
// This is run every frame, so make sure
// we aren't opting into the "lazy" way of doing this. :)
VkImageMemoryBarrier barriers[2] = {
@ -2244,7 +2247,7 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
0, nullptr,
2, barriers);
for (unsigned i = 1; i < levels; i++)
for (i = 1; i < levels; i++)
{
// For subsequent passes, we have to transition from DST_OPTIMAL to SRC_OPTIMAL,
// but only do so one mip-level at a time.
@ -2267,23 +2270,23 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
}
VkImageBlit blit_region = {};
unsigned src_width = std::max(size.width >> (i - 1), 1u);
unsigned src_height = std::max(size.height >> (i - 1), 1u);
unsigned target_width = std::max(size.width >> i, 1u);
unsigned target_height = std::max(size.height >> i, 1u);
unsigned src_width = MAX(size.width >> (i - 1), 1u);
unsigned src_height = MAX(size.height >> (i - 1), 1u);
unsigned target_width = MAX(size.width >> i, 1u);
unsigned target_height = MAX(size.height >> i, 1u);
blit_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit_region.srcSubresource.mipLevel = i - 1;
blit_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit_region.srcSubresource.mipLevel = i - 1;
blit_region.srcSubresource.baseArrayLayer = 0;
blit_region.srcSubresource.layerCount = 1;
blit_region.dstSubresource = blit_region.srcSubresource;
blit_region.dstSubresource.mipLevel = i;
blit_region.srcOffsets[1].x = src_width;
blit_region.srcOffsets[1].y = src_height;
blit_region.srcOffsets[1].z = 1;
blit_region.dstOffsets[1].x = target_width;
blit_region.dstOffsets[1].y = target_height;
blit_region.dstOffsets[1].z = 1;
blit_region.srcSubresource.layerCount = 1;
blit_region.dstSubresource = blit_region.srcSubresource;
blit_region.dstSubresource.mipLevel = i;
blit_region.srcOffsets[1].x = src_width;
blit_region.srcOffsets[1].y = src_height;
blit_region.srcOffsets[1].z = 1;
blit_region.dstOffsets[1].x = target_width;
blit_region.dstOffsets[1].y = target_height;
blit_region.dstOffsets[1].z = 1;
vkCmdBlitImage(cmd,
image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
@ -2325,20 +2328,22 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
void Framebuffer::copy(VkCommandBuffer cmd,
VkImage src_image, VkImageLayout src_layout)
{
VkImageCopy region;
image_layout_transition(cmd, image,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
0, VK_ACCESS_TRANSFER_WRITE_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT);
VkImageCopy region;
memset(&region, 0, sizeof(region));
region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
region.srcSubresource.layerCount = 1;
region.dstSubresource = region.srcSubresource;
region.extent.width = size.width;
region.extent.height = size.height;
region.extent.depth = 1;
region.dstSubresource = region.srcSubresource;
region.extent.width = size.width;
region.extent.height = size.height;
region.extent.depth = 1;
vkCmdCopyImage(cmd,
src_image, src_layout,
@ -2544,7 +2549,6 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_default(
if (!chain)
return nullptr;
memset(&pass_info, 0, sizeof(pass_info));
pass_info.scale_type_x = VULKAN_FILTER_CHAIN_SCALE_VIEWPORT;
pass_info.scale_type_y = VULKAN_FILTER_CHAIN_SCALE_VIEWPORT;
pass_info.scale_x = 1.0f;
@ -2553,6 +2557,8 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_default(
pass_info.source_filter = filter;
pass_info.mip_filter = VULKAN_FILTER_CHAIN_NEAREST;
pass_info.address = VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_EDGE;
pass_info.max_levels = 0;
chain->set_pass_info(0, pass_info);
chain->set_shader(0, VK_SHADER_STAGE_VERTEX_BIT,
@ -2646,6 +2652,7 @@ static unique_ptr<StaticTexture> vulkan_filter_chain_load_lut(VkCommandBuffer cm
vulkan_filter_chain *chain,
const video_shader_lut *shader)
{
unsigned i;
texture_image image;
unique_ptr<Buffer> buffer;
VkMemoryRequirements mem_reqs;
@ -2728,29 +2735,29 @@ static unique_ptr<StaticTexture> vulkan_filter_chain_load_lut(VkCommandBuffer cm
shader->mipmap ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &region);
for (unsigned i = 1; i < image_info.mipLevels; i++)
for (i = 1; i < image_info.mipLevels; i++)
{
VkImageBlit blit_region = {};
unsigned src_width = std::max(image.width >> (i - 1), 1u);
unsigned src_height = std::max(image.height >> (i - 1), 1u);
unsigned target_width = std::max(image.width >> i, 1u);
unsigned target_height = std::max(image.height >> i, 1u);
unsigned src_width = MAX(image.width >> (i - 1), 1u);
unsigned src_height = MAX(image.height >> (i - 1), 1u);
unsigned target_width = MAX(image.width >> i, 1u);
unsigned target_height = MAX(image.height >> i, 1u);
blit_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit_region.srcSubresource.mipLevel = i - 1;
blit_region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit_region.srcSubresource.mipLevel = i - 1;
blit_region.srcSubresource.baseArrayLayer = 0;
blit_region.srcSubresource.layerCount = 1;
blit_region.dstSubresource = blit_region.srcSubresource;
blit_region.dstSubresource.mipLevel = i;
blit_region.srcOffsets[1].x = src_width;
blit_region.srcOffsets[1].y = src_height;
blit_region.srcOffsets[1].z = 1;
blit_region.dstOffsets[1].x = target_width;
blit_region.dstOffsets[1].y = target_height;
blit_region.dstOffsets[1].z = 1;
blit_region.srcSubresource.layerCount = 1;
blit_region.dstSubresource = blit_region.srcSubresource;
blit_region.dstSubresource.mipLevel = i;
blit_region.srcOffsets[1].x = src_width;
blit_region.srcOffsets[1].y = src_height;
blit_region.srcOffsets[1].z = 1;
blit_region.dstOffsets[1].x = target_width;
blit_region.dstOffsets[1].y = target_height;
blit_region.dstOffsets[1].z = 1;
// Only injects execution and memory barriers,
// not actual transition.
/* Only injects execution and memory barriers,
* not actual transition. */
image_layout_transition(cmd, tex,
VK_IMAGE_LAYOUT_GENERAL,
VK_IMAGE_LAYOUT_GENERAL,
@ -2847,6 +2854,7 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
const struct vulkan_filter_chain_create_info *info,
const char *path, vulkan_filter_chain_filter filter)
{
unsigned i;
unique_ptr<video_shader> shader{ new video_shader() };
if (!shader)
return nullptr;
@ -2873,15 +2881,24 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
shader->num_parameters = 0;
for (unsigned i = 0; i < shader->passes; i++)
for (i = 0; i < shader->passes; i++)
{
const video_shader_pass *pass = &shader->pass[i];
glslang_output output;
struct vulkan_filter_chain_pass_info pass_info;
const video_shader_pass *pass = &shader->pass[i];
const video_shader_pass *next_pass =
i + 1 < shader->passes ? &shader->pass[i + 1] : nullptr;
struct vulkan_filter_chain_pass_info pass_info;
memset(&pass_info, 0, sizeof(pass_info));
glslang_output output;
pass_info.scale_type_x = VULKAN_FILTER_CHAIN_SCALE_ORIGINAL;
pass_info.scale_type_y = VULKAN_FILTER_CHAIN_SCALE_ORIGINAL;
pass_info.scale_x = 0.0f;
pass_info.scale_y = 0.0f;
pass_info.rt_format = VK_FORMAT_UNDEFINED;
pass_info.source_filter = VULKAN_FILTER_CHAIN_LINEAR;
pass_info.mip_filter = VULKAN_FILTER_CHAIN_LINEAR;
pass_info.address = VULKAN_FILTER_CHAIN_ADDRESS_REPEAT;
pass_info.max_levels = 0;
if (!glslang_compile_shader(pass->source.path, &output))
{
RARCH_ERR("Failed to compile shader: \"%s\".\n",
@ -2960,15 +2977,14 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
pass->filter == RARCH_FILTER_LINEAR ? VULKAN_FILTER_CHAIN_LINEAR :
VULKAN_FILTER_CHAIN_NEAREST;
}
pass_info.address = wrap_to_address(pass->wrap);
pass_info.address = wrap_to_address(pass->wrap);
pass_info.max_levels = 1;
// TODO: Expose max_levels in slangp.
// CGP format is a bit awkward in that it uses mipmap_input,
// so we much check if next pass needs the mipmapping.
if (next_pass && next_pass->mipmap)
pass_info.max_levels = ~0u;
else
pass_info.max_levels = 1;
pass_info.mip_filter = pass->filter != RARCH_FILTER_NEAREST && pass_info.max_levels > 1
? VULKAN_FILTER_CHAIN_LINEAR : VULKAN_FILTER_CHAIN_NEAREST;
@ -3061,16 +3077,19 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
if (last_pass_is_fbo)
{
struct vulkan_filter_chain_pass_info pass_info;
memset(&pass_info, 0, sizeof(pass_info));
pass_info.scale_type_x = VULKAN_FILTER_CHAIN_SCALE_VIEWPORT;
pass_info.scale_type_y = VULKAN_FILTER_CHAIN_SCALE_VIEWPORT;
pass_info.scale_x = 1.0f;
pass_info.scale_y = 1.0f;
pass_info.rt_format = tmpinfo.swapchain.format;
pass_info.scale_type_x = VULKAN_FILTER_CHAIN_SCALE_VIEWPORT;
pass_info.scale_type_y = VULKAN_FILTER_CHAIN_SCALE_VIEWPORT;
pass_info.scale_x = 1.0f;
pass_info.scale_y = 1.0f;
pass_info.rt_format = tmpinfo.swapchain.format;
pass_info.source_filter = filter;
pass_info.mip_filter = VULKAN_FILTER_CHAIN_NEAREST;
pass_info.address = VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_EDGE;
pass_info.mip_filter = VULKAN_FILTER_CHAIN_NEAREST;
pass_info.address = VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_EDGE;
pass_info.max_levels = 0;
chain->set_pass_info(shader->passes, pass_info);

View File

@ -38,10 +38,10 @@ enum vulkan_filter_chain_filter
enum vulkan_filter_chain_address
{
VULKAN_FILTER_CHAIN_ADDRESS_REPEAT = 0,
VULKAN_FILTER_CHAIN_ADDRESS_MIRRORED_REPEAT = 1,
VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_EDGE = 2,
VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_BORDER = 3,
VULKAN_FILTER_CHAIN_ADDRESS_REPEAT = 0,
VULKAN_FILTER_CHAIN_ADDRESS_MIRRORED_REPEAT = 1,
VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_EDGE = 2,
VULKAN_FILTER_CHAIN_ADDRESS_CLAMP_TO_BORDER = 3,
VULKAN_FILTER_CHAIN_ADDRESS_MIRROR_CLAMP_TO_EDGE = 4,
VULKAN_FILTER_CHAIN_ADDRESS_COUNT
};

View File

@ -18,7 +18,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include "../video_shader_driver.h"
#include "../video_driver.h"
RETRO_BEGIN_DECLS

View File

@ -1,516 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2017 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include "video_context_driver.h"
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include "../configuration.h"
#include "../runloop.h"
#include "../verbosity.h"
static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
#if defined(__CELLOS_LV2__)
&gfx_ctx_ps3,
#endif
#if defined(HAVE_D3D)
&gfx_ctx_d3d,
#endif
#if defined(HAVE_VIDEOCORE)
&gfx_ctx_videocore,
#endif
#if defined(HAVE_MALI_FBDEV)
&gfx_ctx_mali_fbdev,
#endif
#if defined(HAVE_VIVANTE_FBDEV)
&gfx_ctx_vivante_fbdev,
#endif
#if defined(HAVE_OPENDINGUX_FBDEV)
&gfx_ctx_opendingux_fbdev,
#endif
#if defined(_WIN32) && (defined(HAVE_OPENGL) || defined(HAVE_VULKAN))
&gfx_ctx_wgl,
#endif
#if defined(HAVE_WAYLAND)
&gfx_ctx_wayland,
#endif
#if defined(HAVE_X11) && !defined(HAVE_OPENGLES)
#if defined(HAVE_OPENGL) || defined(HAVE_VULKAN)
&gfx_ctx_x,
#endif
#endif
#if defined(HAVE_X11) && defined(HAVE_OPENGL) && defined(HAVE_EGL)
&gfx_ctx_x_egl,
#endif
#if defined(HAVE_KMS)
&gfx_ctx_drm,
#endif
#if defined(ANDROID)
&gfx_ctx_android,
#endif
#if defined(__QNX__)
&gfx_ctx_qnx,
#endif
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
&gfx_ctx_cocoagl,
#endif
#if defined(__APPLE__) && !defined(TARGET_IPHONE_SIMULATOR) && !defined(TARGET_OS_IPHONE)
&gfx_ctx_cgl,
#endif
#if (defined(HAVE_SDL) || defined(HAVE_SDL2)) && defined(HAVE_OPENGL)
&gfx_ctx_sdl_gl,
#endif
#ifdef HAVE_OSMESA
&gfx_ctx_osmesa,
#endif
#ifdef EMSCRIPTEN
&gfx_ctx_emscripten,
#endif
#if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY)
&gfx_ctx_khr_display,
#endif
#if defined(_WIN32) && !defined(_XBOX)
&gfx_ctx_gdi,
#endif
&gfx_ctx_null,
NULL
};
const gfx_ctx_driver_t *current_video_context = NULL;
void *video_context_data = NULL;
/**
* find_video_context_driver_driver_index:
* @ident : Identifier of resampler driver to find.
*
* Finds graphics context driver index by @ident name.
*
* Returns: graphics context driver index if driver was found, otherwise
* -1.
**/
static int find_video_context_driver_index(const char *ident)
{
unsigned i;
for (i = 0; gfx_ctx_drivers[i]; i++)
if (string_is_equal_noncase(ident, gfx_ctx_drivers[i]->ident))
return i;
return -1;
}
/**
* find_prev_context_driver:
*
* Finds previous driver in graphics context driver array.
**/
bool video_context_driver_find_prev_driver(void)
{
settings_t *settings = config_get_ptr();
int i = find_video_context_driver_index(
settings->arrays.video_context_driver);
if (i > 0)
{
strlcpy(settings->arrays.video_context_driver,
gfx_ctx_drivers[i - 1]->ident,
sizeof(settings->arrays.video_context_driver));
return true;
}
RARCH_WARN("Couldn't find any previous video context driver.\n");
return false;
}
/**
* find_next_context_driver:
*
* Finds next driver in graphics context driver array.
**/
bool video_context_driver_find_next_driver(void)
{
settings_t *settings = config_get_ptr();
int i = find_video_context_driver_index(settings->arrays.video_context_driver);
if (i >= 0 && gfx_ctx_drivers[i + 1])
{
strlcpy(settings->arrays.video_context_driver,
gfx_ctx_drivers[i + 1]->ident,
sizeof(settings->arrays.video_context_driver));
return true;
}
RARCH_WARN("Couldn't find any next video context driver.\n");
return false;
}
/**
* video_context_driver_init:
* @data : Input data.
* @ctx : Graphics context driver to initialize.
* @ident : Identifier of graphics context driver to find.
* @api : API of higher-level graphics API.
* @major : Major version number of higher-level graphics API.
* @minor : Minor version number of higher-level graphics API.
* @hw_render_ctx : Request a graphics context driver capable of
* hardware rendering?
*
* Initialize graphics context driver.
*
* Returns: graphics context driver if successfully initialized, otherwise NULL.
**/
static const gfx_ctx_driver_t *video_context_driver_init(
void *data,
const gfx_ctx_driver_t *ctx,
const char *ident,
enum gfx_ctx_api api, unsigned major,
unsigned minor, bool hw_render_ctx)
{
if (ctx->bind_api(data, api, major, minor))
{
video_frame_info_t video_info;
void *ctx_data = NULL;
video_driver_build_info(&video_info);
ctx_data = ctx->init(&video_info, data);
if (!ctx_data)
return NULL;
if (ctx->bind_hw_render)
ctx->bind_hw_render(ctx_data,
video_info.shared_context && hw_render_ctx);
video_context_driver_set_data(ctx_data);
return ctx;
}
#ifndef _WIN32
RARCH_WARN("Failed to bind API (#%u, version %u.%u) on context driver \"%s\".\n",
(unsigned)api, major, minor, ctx->ident);
#endif
return NULL;
}
/**
* video_context_driver_find_driver:
* @data : Input data.
* @ident : Identifier of graphics context driver to find.
* @api : API of higher-level graphics API.
* @major : Major version number of higher-level graphics API.
* @minor : Minor version number of higher-level graphics API.
* @hw_render_ctx : Request a graphics context driver capable of
* hardware rendering?
*
* Finds graphics context driver and initializes.
*
* Returns: graphics context driver if found, otherwise NULL.
**/
static const gfx_ctx_driver_t *video_context_driver_find_driver(void *data,
const char *ident,
enum gfx_ctx_api api, unsigned major,
unsigned minor, bool hw_render_ctx)
{
int i = find_video_context_driver_index(ident);
if (i >= 0)
return video_context_driver_init(data, gfx_ctx_drivers[i], ident,
api, major, minor, hw_render_ctx);
for (i = 0; gfx_ctx_drivers[i]; i++)
{
const gfx_ctx_driver_t *ctx =
video_context_driver_init(data, gfx_ctx_drivers[i], ident,
api, major, minor, hw_render_ctx);
if (ctx)
return ctx;
}
return NULL;
}
/**
* video_context_driver_init_first:
* @data : Input data.
* @ident : Identifier of graphics context driver to find.
* @api : API of higher-level graphics API.
* @major : Major version number of higher-level graphics API.
* @minor : Minor version number of higher-level graphics API.
* @hw_render_ctx : Request a graphics context driver capable of
* hardware rendering?
*
* Finds first suitable graphics context driver and initializes.
*
* Returns: graphics context driver if found, otherwise NULL.
**/
const gfx_ctx_driver_t *video_context_driver_init_first(void *data,
const char *ident, enum gfx_ctx_api api, unsigned major,
unsigned minor, bool hw_render_ctx)
{
return video_context_driver_find_driver(data, ident, api,
major, minor, hw_render_ctx);
}
bool video_context_driver_check_window(gfx_ctx_size_t *size_data)
{
if ( video_context_data
&& current_video_context
&& current_video_context->check_window)
{
bool is_shutdown = runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL);
current_video_context->check_window(video_context_data,
size_data->quit,
size_data->resize,
size_data->width,
size_data->height,
is_shutdown);
return true;
}
return false;
}
bool video_context_driver_init_image_buffer(const video_info_t *data)
{
if ( current_video_context
&& current_video_context->image_buffer_init
&& current_video_context->image_buffer_init(video_context_data, data))
return true;
return false;
}
bool video_context_driver_write_to_image_buffer(gfx_ctx_image_t *img)
{
if ( current_video_context
&& current_video_context->image_buffer_write
&& current_video_context->image_buffer_write(video_context_data,
img->frame, img->width, img->height, img->pitch,
img->rgb32, img->index, img->handle))
return true;
return false;
}
bool video_context_driver_get_video_output_prev(void)
{
if (!current_video_context
|| !current_video_context->get_video_output_prev)
return false;
current_video_context->get_video_output_prev(video_context_data);
return true;
}
bool video_context_driver_get_video_output_next(void)
{
if (!current_video_context ||
!current_video_context->get_video_output_next)
return false;
current_video_context->get_video_output_next(video_context_data);
return true;
}
bool video_context_driver_bind_hw_render(bool *enable)
{
if (!current_video_context || !current_video_context->bind_hw_render)
return false;
current_video_context->bind_hw_render(video_context_data, *enable);
return true;
}
void video_context_driver_make_current(bool release)
{
if (current_video_context && current_video_context->make_current)
current_video_context->make_current(release);
}
bool video_context_driver_set(const gfx_ctx_driver_t *data)
{
if (!data)
return false;
current_video_context = data;
return true;
}
void video_context_driver_destroy(void)
{
current_video_context = NULL;
}
bool video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect)
{
if (!video_context_data || !aspect)
return false;
if (!current_video_context->translate_aspect)
return false;
*aspect->aspect = current_video_context->translate_aspect(
video_context_data, aspect->width, aspect->height);
return true;
}
void video_context_driver_free(void)
{
if (current_video_context->destroy)
current_video_context->destroy(video_context_data);
current_video_context = NULL;
video_context_data = NULL;
}
bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data)
{
if (!size_data)
return false;
if (!current_video_context || !current_video_context->get_video_output_size)
return false;
current_video_context->get_video_output_size(video_context_data,
size_data->width, size_data->height);
return true;
}
bool video_context_driver_swap_interval(unsigned *interval)
{
if (!current_video_context || !current_video_context->swap_interval)
return false;
current_video_context->swap_interval(video_context_data, *interval);
return true;
}
bool video_context_driver_get_proc_address(gfx_ctx_proc_address_t *proc)
{
if (!current_video_context || !current_video_context->get_proc_address)
return false;
proc->addr = current_video_context->get_proc_address(proc->sym);
return true;
}
bool video_context_driver_get_metrics(gfx_ctx_metrics_t *metrics)
{
if ( current_video_context
&& current_video_context->get_metrics
&& current_video_context->get_metrics(video_context_data,
metrics->type,
metrics->value))
return true;
return false;
}
bool video_context_driver_input_driver(gfx_ctx_input_t *inp)
{
settings_t *settings = config_get_ptr();
const char *joypad_name = settings ? settings->arrays.input_joypad_driver : NULL;
if (!current_video_context || !current_video_context->input_driver)
return false;
current_video_context->input_driver(
video_context_data, joypad_name,
inp->input, inp->input_data);
return true;
}
bool video_context_driver_suppress_screensaver(bool *bool_data)
{
if ( video_context_data
&& current_video_context
&& current_video_context->suppress_screensaver(
video_context_data, *bool_data))
return true;
return false;
}
bool video_context_driver_get_ident(gfx_ctx_ident_t *ident)
{
if (!ident)
return false;
ident->ident = NULL;
if (current_video_context)
ident->ident = current_video_context->ident;
return true;
}
bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info)
{
video_frame_info_t video_info;
if (!current_video_context || !current_video_context->set_video_mode)
return false;
video_driver_build_info(&video_info);
if (!current_video_context->set_video_mode(
video_context_data, &video_info, mode_info->width,
mode_info->height, mode_info->fullscreen))
return false;
return true;
}
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info)
{
if (!current_video_context || !current_video_context->get_video_size)
return false;
current_video_context->get_video_size(video_context_data,
&mode_info->width, &mode_info->height);
return true;
}
bool video_context_driver_get_context_data(void *data)
{
if (!current_video_context || !current_video_context->get_context_data)
return false;
*(void**)data = current_video_context->get_context_data(video_context_data);
return true;
}
bool video_context_driver_show_mouse(bool *bool_data)
{
if (!current_video_context || !current_video_context->show_mouse)
return false;
current_video_context->show_mouse(video_context_data, *bool_data);
return true;
}
void video_context_driver_set_data(void *data)
{
video_context_data = data;
}
bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
{
if (!flags)
return false;
if (!current_video_context || !current_video_context->get_flags)
return false;
flags->flags = current_video_context->get_flags(video_context_data);
return true;
}
bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
{
if (!flags)
return false;
if (!current_video_context || !current_video_context->set_flags)
return false;
current_video_context->set_flags(video_context_data, flags->flags);
return true;
}

Some files were not shown because too many files have changed in this diff Show More