Merge pull request #1 from libretro/master

Merge master
This commit is contained in:
Aleksey Samoilov 2019-01-20 21:54:14 +04:00 committed by GitHub
commit 07ca62915a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
444 changed files with 4879 additions and 2352 deletions

2
.gitignore vendored
View File

@ -11,6 +11,8 @@
.tmp
.tmp.c
.tmp.cxx
.moc.h
.moc.cpp
config.log
/.project
/.externalToolBuilders/

View File

@ -10,7 +10,9 @@ matrix:
- g++-mingw-w64-i686
- mingw-w64-i686-dev
script:
- CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 --enable-builtinzlib
- make
env: CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
- compiler: mingw-x64
addons:
apt:
@ -18,41 +20,34 @@ matrix:
- g++-mingw-w64-x86-64
- mingw-w64-x86-64-dev
script:
- CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 --enable-builtinzlib
- make
env: CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
- compiler: gcc
addons:
# Install a more recent gcc than the default
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
# Install a more recent gcc than the default
before_install:
- sudo apt-get install -y g++-8
env: CC=gcc-8 CXX=g++-8
- compiler: clang
addons:
# Install a more recent clang than the default
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env: COMPILER_NAME=clang-3.8 CXX=clang++-3.8 CC=clang-3.8
# Install a more recent clang than the default
before_install:
- sudo apt-get install -y libstdc++-7-dev
- sudo apt-get install -y clang-6.0
env: CC=clang-6.0 CXX=clang++-6.0
- os: osx
osx_image: xcode8
script:
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
- os: osx
osx_image: xcode9.3
script:
- cd ~/
- brew update
- brew install --force-bottle qt5
- git clone --depth=50 https://github.com/libretro/libretro-super
- cd libretro-super/travis
- ./build-retroarch-metal.sh
- xcodebuild -target RetroArchQt -configuration Release -project pkg/apple/RetroArch_Metal.xcodeproj
deploy:
skip_cleanup: true
provider: script
script: cd ../retroarch; bash travis_metal_deploy.sh
script: bash travis_metal_deploy.sh
on:
branch: master
@ -67,19 +62,13 @@ env:
addons:
apt:
packages:
- curl
- pkg-config
- libglu1-mesa-dev
- freeglut3-dev
- mesa-common-dev
- libsdl1.2-dev
- libsdl-image1.2-dev
- libsdl-mixer1.2-dev
- libsdl-ttf2.0-dev
- libsdl2-dev
- libusb-1.0-0-dev
- qt5-default
- qt5-qmake
- qtbase5-dev-tools
- qtbase5-dev
- qtdeclarative5-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
coverity_scan:
project:
name: "RetroArch"

View File

@ -1,6 +1,7 @@
# 1.7.6 (future)
- ANDROID: Fix Xperia Play input binding
- CHEEVOS: Reset when hardcore mode is toggled
- COMMON: Add new JSON playlist format
- CORE UPDATER: Allow sideloading cores from the menu
- CPU FILTERS: Add Normal2x filter.
- DATE: Add Date / Time style options.
@ -19,6 +20,7 @@
- MENU: User Interface -> Appearance -> 'Menu Font Green/Blue Color' settings now work properly.
- MIDI: Add a Linux ALSA driver for MIDI.
- NETPLAY: Force fast-save-states when netlay is enabled
- NETPLAY: Allow quick joining subsystem lobbies
- PS2: Initial PlayStation2 port.
- PS4: Initial PlayStation4 port.
- RECORDING: Implement recording options in the menu complete with quality profiles, streaming, and proper file naming
@ -40,6 +42,7 @@
- UWP: Initial UWP port.
- XBONE: Initial Xbox One port.
- XMB/OZONE: Add more icons
- ???: Easter Egg
# 1.7.5
- CAMERA: Fix Video4Linux2 driver that broke years ago.

View File

@ -171,7 +171,7 @@ all: $(TARGET) config.mk
$(MOC_SRC):
@$(if $(Q), $(shell echo echo MOC $<),)
$(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@))
$(Q)$(MOC) -o $(MOC_TMP) $<
$(Q)QT_SELECT=$(QT_VERSION) $(MOC) -o $(MOC_TMP) $<
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))

View File

@ -343,7 +343,7 @@ ifeq ($(HAVE_QT), 1)
ui/drivers/qt/coreinfodialog.o \
ui/drivers/qt/playlistentrydialog.o \
ui/drivers/qt/viewoptionsdialog.o \
ui/drivers/qt/playlist.o \
ui/drivers/qt/qt_playlist.o \
ui/drivers/qt/updateretroarch.o \
ui/drivers/qt/thumbnaildownload.o \
ui/drivers/qt/thumbnailpackdownload.o \

View File

@ -280,4 +280,3 @@ clean:
rm -f ctr/3dsx_custom_crt0.o
.PHONY: clean

View File

@ -219,4 +219,3 @@ clean:
rm -f ctr/3dsx_custom_crt0.o
.PHONY: clean

View File

@ -22,7 +22,7 @@ OBJ :=
# For threading we need to overwrite some vars with global defines because devkitPro's includes
# make it hard for us. This works for the pthread wrapper
DEFINES_THREAD := -Dpthread_t=Thread -Dpthread_mutex_t=Mutex -Dpthread_mutexattr_t='void*' -Dpthread_attr_t=int -Dpthread_cond_t=CondVar -Dpthread_condattr_t='int' -D_SYS__PTHREADTYPES_H_
DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD)
DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD) -DHAVE_STB_VORBIS
HAVE_CC_RESAMPLER = 1
HAVE_MENU_COMMON = 1
@ -42,6 +42,7 @@ HAVE_NETPLAYDISCOVERY = 1
HAVE_STB_FONT = 1
HAVE_CHEEVOS = 1
HAVE_CHD = 1
HAVE_STB_VORBIS = 1
# RetroArch libnx useful flags
HAVE_THREADS = 1

View File

@ -52,4 +52,3 @@ clean:
rm -f $(BINDIR)/retroarch-joyconfig
rm -f $(PNDDIR)/readme.html
rm -f retroarch

View File

@ -128,4 +128,3 @@ clean:
rm -f $(OBJ)
.PHONY: clean

View File

@ -172,4 +172,3 @@ clean:
rm -f *.d
.PHONY: all install uninstall clean

View File

@ -137,7 +137,7 @@ static const audio_driver_t *audio_drivers[] = {
NULL,
};
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_STREAMS] = {{0}};
static struct audio_mixer_stream audio_mixer_streams[AUDIO_MIXER_MAX_SYSTEM_STREAMS] = {{0}};
static size_t audio_driver_chunk_size = 0;
static size_t audio_driver_chunk_nonblock_size = 0;
@ -203,14 +203,14 @@ enum resampler_quality audio_driver_get_resampler_quality(void)
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i)
{
if (i > (AUDIO_MIXER_MAX_STREAMS-1))
if (i > (AUDIO_MIXER_MAX_SYSTEM_STREAMS-1))
return NULL;
return &audio_mixer_streams[i];
}
const char *audio_driver_mixer_get_stream_name(unsigned i)
{
if (i > (AUDIO_MIXER_MAX_STREAMS-1))
if (i > (AUDIO_MIXER_MAX_SYSTEM_STREAMS-1))
return "N/A";
if (!string_is_empty(audio_mixer_streams[i].name))
return audio_mixer_streams[i].name;
@ -1053,7 +1053,7 @@ static int audio_mixer_find_index(audio_mixer_sound_t *sound)
{
unsigned i;
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
for (i = 0; i < AUDIO_MIXER_MAX_SYSTEM_STREAMS; i++)
{
audio_mixer_sound_t *handle = audio_mixer_streams[i].handle;
if (handle == sound)
@ -1112,6 +1112,11 @@ static void audio_mixer_play_stop_sequential_cb(
if (!string_is_empty(audio_mixer_streams[i].name))
free(audio_mixer_streams[i].name);
if (i < AUDIO_MIXER_MAX_STREAMS)
audio_mixer_streams[i].type = AUDIO_STREAM_TYPE_USER;
else
audio_mixer_streams[i].type = AUDIO_STREAM_TYPE_SYSTEM;
audio_mixer_streams[i].name = NULL;
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
audio_mixer_streams[i].volume = 0.0f;
@ -1122,7 +1127,7 @@ static void audio_mixer_play_stop_sequential_cb(
i++;
for (; i < AUDIO_MIXER_MAX_STREAMS; i++)
for (; i < AUDIO_MIXER_MAX_SYSTEM_STREAMS; i++)
{
if (audio_mixer_streams[i].state == AUDIO_STREAM_STATE_STOPPED)
{
@ -1139,10 +1144,11 @@ static void audio_mixer_play_stop_sequential_cb(
}
}
bool audio_driver_mixer_get_free_stream_slot(unsigned *id)
static bool audio_driver_mixer_get_free_stream_slot(unsigned *id, enum audio_mixer_stream_type type)
{
unsigned i;
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
unsigned i = (type == AUDIO_STREAM_TYPE_USER) ? 0 : AUDIO_MIXER_MAX_STREAMS;
unsigned count = (type == AUDIO_STREAM_TYPE_USER) ? AUDIO_MIXER_MAX_STREAMS : AUDIO_MIXER_MAX_SYSTEM_STREAMS;
for (; i < count; i++)
{
if (audio_mixer_streams[i].state == AUDIO_STREAM_STATE_NONE)
{
@ -1162,9 +1168,22 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
audio_mixer_stop_cb_t stop_cb = audio_mixer_play_stop_cb;
bool looped = false;
void *buf = NULL;
if (!audio_driver_mixer_get_free_stream_slot(&free_slot))
if (params->stream_type == AUDIO_STREAM_TYPE_NONE)
return false;
switch (params->slot_selection_type)
{
case AUDIO_MIXER_SLOT_SELECTION_MANUAL:
free_slot = params->slot_selection_idx;
break;
case AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC:
default:
if (!audio_driver_mixer_get_free_stream_slot(
&free_slot, params->stream_type))
return false;
break;
}
if (params->state == AUDIO_STREAM_STATE_NONE)
return false;
@ -1230,6 +1249,7 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
audio_mixer_streams[free_slot].buf = buf;
audio_mixer_streams[free_slot].handle = handle;
audio_mixer_streams[free_slot].voice = voice;
audio_mixer_streams[free_slot].type = params->stream_type;
audio_mixer_streams[free_slot].state = params->state;
audio_mixer_streams[free_slot].volume = params->volume;
audio_mixer_streams[free_slot].stop_cb = stop_cb;
@ -1239,7 +1259,7 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i)
{
if (i >= AUDIO_MIXER_MAX_STREAMS)
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return AUDIO_STREAM_STATE_NONE;
return audio_mixer_streams[i].state;
@ -1249,7 +1269,7 @@ static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
{
bool set_state = false;
if (i >= AUDIO_MIXER_MAX_STREAMS)
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
switch (audio_mixer_streams[i].state)
@ -1291,7 +1311,7 @@ void audio_driver_mixer_play_stream_sequential(unsigned i)
float audio_driver_mixer_get_stream_volume(unsigned i)
{
if (i >= AUDIO_MIXER_MAX_STREAMS)
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return 0.0f;
return audio_mixer_streams[i].volume;
@ -1301,7 +1321,7 @@ void audio_driver_mixer_set_stream_volume(unsigned i, float vol)
{
audio_mixer_voice_t *voice = NULL;
if (i >= AUDIO_MIXER_MAX_STREAMS)
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
audio_mixer_streams[i].volume = vol;
@ -1316,7 +1336,7 @@ void audio_driver_mixer_stop_stream(unsigned i)
{
bool set_state = false;
if (i >= AUDIO_MIXER_MAX_STREAMS)
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
switch (audio_mixer_streams[i].state)
@ -1346,7 +1366,7 @@ void audio_driver_mixer_remove_stream(unsigned i)
{
bool destroy = false;
if (i >= AUDIO_MIXER_MAX_STREAMS)
if (i >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
switch (audio_mixer_streams[i].state)
@ -1388,7 +1408,7 @@ static void audio_driver_mixer_deinit(void)
audio_mixer_active = false;
for (i = 0; i < AUDIO_MIXER_MAX_STREAMS; i++)
for (i = 0; i < AUDIO_MIXER_MAX_SYSTEM_STREAMS; i++)
{
audio_driver_mixer_stop_stream(i);
audio_driver_mixer_remove_stream(i);

View File

@ -37,6 +37,8 @@ RETRO_BEGIN_DECLS
#define AUDIO_MIXER_MAX_STREAMS 16
#define AUDIO_MIXER_MAX_SYSTEM_STREAMS (AUDIO_MIXER_MAX_STREAMS+4)
enum audio_action
{
AUDIO_ACTION_NONE = 0,
@ -48,6 +50,19 @@ enum audio_action
AUDIO_ACTION_MIXER
};
enum audio_mixer_slot_selection_type
{
AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC = 0,
AUDIO_MIXER_SLOT_SELECTION_MANUAL
};
enum audio_mixer_stream_type
{
AUDIO_STREAM_TYPE_NONE = 0,
AUDIO_STREAM_TYPE_USER,
AUDIO_STREAM_TYPE_SYSTEM
};
enum audio_mixer_state
{
AUDIO_STREAM_STATE_NONE = 0,
@ -62,6 +77,8 @@ typedef struct audio_mixer_stream
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
enum audio_mixer_stream_type stream_type;
enum audio_mixer_type type;
enum audio_mixer_state state;
float volume;
void *buf;
@ -163,6 +180,9 @@ typedef struct audio_driver
typedef struct audio_mixer_stream_params
{
float volume;
enum audio_mixer_slot_selection_type slot_selection_type;
unsigned slot_selection_idx;
enum audio_mixer_stream_type stream_type;
enum audio_mixer_type type;
enum audio_mixer_state state;
void *buf;

View File

@ -43,4 +43,3 @@ bool audio_init_thread(const audio_driver_t **out_driver, void **out_data,
const audio_driver_t *driver);
#endif

View File

@ -210,4 +210,3 @@ audio_driver_t audio_ctr_dsp = {
ctr_dsp_audio_write_avail,
ctr_dsp_audio_buffer_size
};

View File

@ -360,4 +360,3 @@ static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_
#pragma pack(pop)
#endif

View File

@ -2571,7 +2571,8 @@ enum
static int cheevos_iterate(coro_t *coro)
{
const int SNES_HEADER_LEN = 0x200;
const int snes_header_len = 0x200;
const int lynx_header_len = 0x40;
ssize_t num_read = 0;
size_t to_read = 4096;
uint8_t *buffer = NULL;
@ -2615,7 +2616,7 @@ static int cheevos_iterate(coro_t *coro)
{
{SNES_MD5, "SNES (discards header)", snes_exts},
{GENESIS_MD5, "Genesis (6Mb padding)", genesis_exts},
{LYNX_MD5, "Atari Lynx (only first 512 bytes)", lynx_exts},
{LYNX_MD5, "Atari Lynx (discards header)", lynx_exts},
{NES_MD5, "NES (discards header)", NULL},
{GENERIC_MD5, "Generic (plain content)", NULL},
{FILENAME_MD5, "Generic (filename)", NULL}
@ -2904,7 +2905,7 @@ found:
/* Checks for the existence of a headered SNES file.
Unheadered files fall back to GENERIC_MD5. */
if (coro->len < 0x2000 || coro->len % 0x2000 != SNES_HEADER_LEN)
if (coro->len < 0x2000 || coro->len % 0x2000 != snes_header_len)
{
coro->gameid = 0;
CORO_RET();
@ -2955,16 +2956,19 @@ found:
*************************************************************************/
CORO_SUB(LYNX_MD5)
if (coro->len < 0x0240)
/* Checks for the existence of a headered Lynx file.
Unheadered files fall back to GENERIC_MD5. */
if (coro->len <= lynx_header_len ||
memcmp("LYNX", (void *)coro->data, 5) != 0)
{
coro->gameid = 0;
CORO_RET();
}
MD5_Init(&coro->md5);
coro->offset = 0x0040;
coro->count = 0x0200;
coro->offset = lynx_header_len;
coro->count = coro->len - lynx_header_len;
CORO_GOSUB(EVAL_MD5);
MD5_Final(coro->hash, &coro->md5);

View File

@ -42,7 +42,7 @@
#ifdef HAVE_CHEEVOS
#include "cheevos/cheevos.h"
#ifdef HAVE_NEW_CHEEVOS
#include "cheevos/fixup.h"
#include "cheevos-new/fixup.h"
#else
#include "cheevos/var.h"
#endif
@ -89,6 +89,7 @@
#include "managers/cheat_manager.h"
#include "managers/state_manager.h"
#include "ui/ui_companion_driver.h"
#include "tasks/task_content.h"
#include "tasks/tasks_internal.h"
#include "list_special.h"
@ -1766,56 +1767,6 @@ static bool command_event_resize_windowed_scale(void)
return true;
}
void command_playlist_push_write(
playlist_t *playlist,
const char *path,
const char *label,
const char *core_path,
const char *core_name)
{
if (!playlist)
return;
if (playlist_push(
playlist,
path,
label,
core_path,
core_name,
NULL,
NULL
))
playlist_write_file(playlist);
}
void command_playlist_update_write(
playlist_t *plist,
size_t idx,
const char *path,
const char *label,
const char *core_path,
const char *core_display_name,
const char *crc32,
const char *db_name)
{
playlist_t *playlist = plist ? plist : playlist_get_cached();
if (!playlist)
return;
playlist_update(
playlist,
idx,
path,
label,
core_path,
core_display_name,
crc32,
db_name);
playlist_write_file(playlist);
}
/**
* command_event:
* @cmd : Event command index.

View File

@ -27,8 +27,6 @@
#include "config.h"
#endif
#include "playlist.h"
RETRO_BEGIN_DECLS
typedef struct command command_t;
@ -272,23 +270,6 @@ bool command_free(command_t *handle);
**/
bool command_event(enum event_command action, void *data);
void command_playlist_push_write(
playlist_t *playlist,
const char *path,
const char *label,
const char *core_path,
const char *core_name);
void command_playlist_update_write(
playlist_t *playlist,
size_t idx,
const char *path,
const char *label,
const char *core_path,
const char *core_display_name,
const char *crc32,
const char *db_name);
RETRO_END_DECLS
#endif

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2016 - Brad Parker
* Copyright (C) 2016-2019 - 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-
@ -689,6 +689,9 @@ static const uint16_t network_remote_base_port = 55400;
/* Number of entries that will be kept in content history playlist file. */
static const unsigned default_content_history_size = 100;
/* File format to use when writing playlists to disk */
static const bool playlist_use_old_format = false;
/* Show Menu start-up screen on boot. */
static const bool default_menu_show_start_screen = true;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2014-2017 - Jean-André Santoni
* Copyright (C) 2015-2017 - Andrés Suárez
* Copyright (C) 2016-2017 - Brad Parker
* Copyright (C) 2016-2019 - 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-
@ -50,6 +50,7 @@
#include "verbosity.h"
#include "lakka.h"
#include "tasks/task_content.h"
#include "tasks/tasks_internal.h"
#include "../list_special.h"
@ -1377,7 +1378,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, scale_integer, false);
SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, video_smooth, false);
SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, force_aspect, false);
SETTING_BOOL("video_threaded", video_driver_get_threaded(), true, video_threaded, false);
SETTING_BOOL("video_threaded", &settings->bools.video_threaded, true, video_threaded, false);
SETTING_BOOL("video_shared_context", &settings->bools.video_shared_context, true, video_shared_context, false);
SETTING_BOOL("auto_screenshot_filename", &settings->bools.auto_screenshot_filename, true, auto_screenshot_filename, false);
SETTING_BOOL("video_force_srgb_disable", &settings->bools.video_force_srgb_disable, true, false, false);
@ -1562,6 +1563,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("video_3ds_lcd_bottom", &settings->bools.video_3ds_lcd_bottom, true, video_3ds_lcd_bottom, false);
#endif
SETTING_BOOL("playlist_use_old_format", &settings->bools.playlist_use_old_format, true, playlist_use_old_format, false);
*size = count;
return tmp;

View File

@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2014-2016 - Jean-André Santoni
* Copyright (C) 2016 - Brad Parker
* Copyright (C) 2016-2019 - 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-
@ -300,6 +300,7 @@ typedef struct settings
bool video_window_save_positions;
bool sustained_performance_mode;
bool playlist_use_old_format;
} bools;
struct

4
configure vendored
View File

@ -11,3 +11,7 @@ cat /dev/null > config.log
. qb/qb.comp.sh
. qb/qb.libs.sh
. qb/qb.moc.sh
. qb/qb.make.sh

View File

@ -109,6 +109,9 @@ void content_set_subsystem_info(void);
/* Get the path to the last selected subsystem rom */
char* content_get_subsystem_rom(unsigned index);
/* Sets the subsystem by name */
bool content_set_subsystem_by_name(const char* subsystem_name);
RETRO_END_DECLS
#endif

View File

@ -223,4 +223,3 @@ void libretro_dummy_retro_cheat_set(unsigned idx,
(void)enabled;
(void)code;
}

View File

@ -226,4 +226,3 @@ clean:
rm -f $(TARGET)
.PHONY: clean

View File

@ -10,4 +10,3 @@ static const char *fragment_source = GLSL(
gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).rgb, vec3(2.2)), pow(texture2D(sTex1, vTex).rgb, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0);
}
);

View File

@ -9,4 +9,3 @@ static const char *vertex_source = GLSL(
gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aTexCoord;
}
);

View File

@ -10,4 +10,3 @@ static const char *fragment_source = GLSL(
gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).bgr, vec3(2.2)), pow(texture2D(sTex1, vTex).bgr, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0);
}
);

View File

@ -2,4 +2,3 @@
global: retro_*;
local: *;
};

View File

@ -2,4 +2,3 @@
global: retro_*;
local: *;
};

View File

@ -145,4 +145,3 @@ clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: clean

View File

@ -2,4 +2,3 @@
global: retro_*;
local: *;
};

View File

@ -144,4 +144,3 @@ clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: clean

View File

@ -2,4 +2,3 @@
global: retro_*;
local: *;
};

View File

@ -5,4 +5,3 @@
*startfile:
ctr/3dsx_custom_crt0%O%s crti%O%s crtbegin%O%s

View File

@ -72,4 +72,3 @@ ClrLoop:
bne ClrLoop
bx lr

View File

@ -308,4 +308,3 @@ long sysconf(int name)
return -1;
}

2
deps/mbedtls/dhm.c vendored
View File

@ -530,7 +530,7 @@ static int load_file( const char *path, unsigned char **buf, size_t *n )
*n = (size_t) size;
if( *n + 1 == 0 ||
( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL )
( *buf = (unsigned char*)mbedtls_calloc( 1, *n + 1 ) ) == NULL )
{
fclose( f );
return( MBEDTLS_ERR_DHM_ALLOC_FAILED );

4
deps/mbedtls/ecp.c vendored
View File

@ -811,7 +811,7 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
}
#endif
if( ( c = mbedtls_calloc( t_len, sizeof( mbedtls_mpi ) ) ) == NULL )
if( ( c = (mbedtls_mpi*)mbedtls_calloc( t_len, sizeof( mbedtls_mpi ) ) ) == NULL )
return( MBEDTLS_ERR_ECP_ALLOC_FAILED );
mbedtls_mpi_init( &u ); mbedtls_mpi_init( &Zi ); mbedtls_mpi_init( &ZZi );
@ -1406,7 +1406,7 @@ static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
if( T == NULL )
{
T = mbedtls_calloc( pre_len, sizeof( mbedtls_ecp_point ) );
T = (mbedtls_ecp_point*)mbedtls_calloc( pre_len, sizeof( mbedtls_ecp_point ) );
if( T == NULL )
{
ret = MBEDTLS_ERR_ECP_ALLOC_FAILED;

View File

@ -578,7 +578,7 @@ int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len )
if( ret < 0 )
{
if( net_would_block( ctx ) != 0 )
if( net_would_block((const mbedtls_net_context*)ctx) != 0 )
return( MBEDTLS_ERR_SSL_WANT_WRITE );
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \

View File

@ -14,18 +14,24 @@
*/
#include <file/file_path.h>
#include <string/stdstring.h>
#include <retro_timers.h>
#include "discord.h"
#include "discord_register.h"
#include "../deps/discord-rpc/include/discord_rpc.h"
#include "../retroarch.h"
#include "../configuration.h"
#include "../core.h"
#include "../core_info.h"
#include "../paths.h"
#include "../playlist.h"
#include "../verbosity.h"
#include "../msg_hash.h"
#include "../tasks/task_file_transfer.h"
#ifdef HAVE_NETWORKING
#include "../../network/netplay/netplay.h"
@ -187,8 +193,7 @@ static void handle_discord_join_cb(void *task_data, void *user_data, const char
RARCH_LOG("[Discord] joining lobby at: %s\n", tmp_hostname);
task_push_netplay_crc_scan(room->gamecrc,
room->gamename, tmp_hostname, room->corename);
room->gamename, tmp_hostname, room->corename, room->subsystem_name);
}
finish:
@ -306,11 +311,13 @@ void discord_update(enum discord_presence presence)
discord_presence.instance = 0;
break;
case DISCORD_PRESENCE_GAME_PAUSED:
discord_presence.smallImageKey = "paused";
discord_presence.smallImageText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED);
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED);
pause_time = time(0);
ellapsed_time = difftime(time(0), start_time);
discord_presence.smallImageKey = "paused";
discord_presence.smallImageText = msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PAUSED);
discord_presence.details = msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED);
pause_time = time(0);
ellapsed_time = difftime(time(0), start_time);
discord_presence.startTimestamp = pause_time;
break;
case DISCORD_PRESENCE_GAME:
@ -340,13 +347,15 @@ void discord_update(enum discord_presence presence)
if (pause_time != 0)
start_time = time(0) - ellapsed_time;
pause_time = 0;
pause_time = 0;
ellapsed_time = 0;
discord_presence.smallImageKey = "playing";
discord_presence.smallImageText = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING);
discord_presence.smallImageText = msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING);
discord_presence.startTimestamp = start_time;
discord_presence.details = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME);
discord_presence.details = msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME);
discord_presence.state = label;
discord_presence.instance = 0;
@ -367,9 +376,9 @@ void discord_update(enum discord_presence presence)
snprintf(join_secret, sizeof(join_secret), "%d|%s", room->id, room->nickname);
discord_presence.joinSecret = strdup(join_secret);
/* discord_presence.spectateSecret = "SPECSPECSPEC"; */
discord_presence.partyId = strdup(party_name);
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
discord_presence.partyId = strdup(party_name);
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
RARCH_LOG("[Discord] join secret: %s\n", join_secret);
RARCH_LOG("[Discord] party id: %s\n", party_name);

View File

@ -20,15 +20,8 @@
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <boolean.h>
#include <string/stdstring.h>
#include <lists/string_list.h>
#include <retro_timers.h>
#include "../deps/discord-rpc/include/discord_rpc.h"
#include "verbosity.h"
enum discord_presence
{
@ -53,13 +46,13 @@ void discord_shutdown(void);
void discord_update(enum discord_presence presence);
void discord_run_callbacks();
void discord_run_callbacks(void);
bool discord_is_ready();
bool discord_is_ready(void);
void discord_avatar_set_ready(bool ready);
bool discord_avatar_is_ready();
bool discord_avatar_is_ready(void);
char* discord_get_own_username(void);

View File

@ -192,4 +192,3 @@ fi
for core in $cores; do
buildCore $core
done

View File

@ -116,6 +116,10 @@ static bool ignore_environment_cb = false;
static bool core_set_shared_context = false;
static bool *load_no_content_hook = NULL;
struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
unsigned subsystem_current_count;
const struct retro_subsystem_info *libretro_find_subsystem_info(
const struct retro_subsystem_info *info, unsigned num_info,
const char *ident)
@ -187,9 +191,7 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
break;
case RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO:
{
unsigned i = 0;
unsigned j = 0;
unsigned size = i;
unsigned i, j, size;
const struct retro_subsystem_info *info =
(const struct retro_subsystem_info*)data;
subsystem_current_count = 0;
@ -492,8 +494,9 @@ bool libretro_get_system_info(const char *path,
* Setup libretro callback symbols. Returns true on success,
* or false if symbols could not be loaded.
**/
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, dylib_t *lib_handle_p)
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, void *_lib_handle_p)
{
dylib_t *lib_handle_p = (dylib_t*)_lib_handle_p;
#ifdef HAVE_DYNAMIC
/* the library handle for use with the SYMBOL macro */
dylib_t lib_handle_local;
@ -1511,7 +1514,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
{
memcpy(hwr,
cb, offsetof(struct retro_hw_render_callback, stencil));
memset((uint8_t*)hwr + offsetof(struct retro_hw_render_callback, stencil),
memset((uint8_t*)hwr + offsetof(struct retro_hw_render_callback, stencil),
0, sizeof(*cb) - offsetof(struct retro_hw_render_callback, stencil));
}
else
@ -1923,9 +1926,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_GET_VFS_INTERFACE:
{
const uint32_t supported_vfs_version = 1;
const uint32_t supported_vfs_version = 3;
static struct retro_vfs_interface vfs_iface =
{
/* VFS API v1 */
retro_vfs_file_get_path_impl,
retro_vfs_file_open_impl,
retro_vfs_file_close_impl,
@ -1935,15 +1939,32 @@ bool rarch_environment_cb(unsigned cmd, void *data)
retro_vfs_file_read_impl,
retro_vfs_file_write_impl,
retro_vfs_file_flush_impl,
retro_vfs_file_remove_impl
retro_vfs_file_remove_impl,
retro_vfs_file_rename_impl,
/* VFS API v2 */
retro_vfs_file_truncate_impl,
/* VFS API v3 */
retro_vfs_stat_impl,
retro_vfs_mkdir_impl,
retro_vfs_opendir_impl,
retro_vfs_readdir_impl,
retro_vfs_dirent_get_name_impl,
retro_vfs_dirent_is_dir_impl,
retro_vfs_closedir_impl
};
struct retro_vfs_interface_info *vfs_iface_info = (struct retro_vfs_interface_info *) data;
if (vfs_iface_info->required_interface_version <= supported_vfs_version)
{
RARCH_LOG("Core requested VFS version >= v%d, providing v%d\n", vfs_iface_info->required_interface_version, supported_vfs_version);
vfs_iface_info->required_interface_version = supported_vfs_version;
vfs_iface_info->iface = &vfs_iface;
}
else
{
RARCH_WARN("Core requested VFS version v%d which is higher than what we support (v%d)\n", vfs_iface_info->required_interface_version, supported_vfs_version);
return false;
}
break;
}

View File

@ -20,7 +20,6 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <libretro.h>
#include <dynamic/dylib.h>
#include "core_type.h"
@ -133,7 +132,7 @@ bool libretro_get_shared_context(void);
bool init_libretro_sym(enum rarch_core_type type,
struct retro_core_t *core);
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, dylib_t *lib_handle_p);
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, void *lib_handle_p);
/**
* uninit_libretro_sym:
@ -151,11 +150,10 @@ void uninit_libretro_sym(struct retro_core_t *core);
/* Arbitrary 10 roms for each subsystem limit */
#define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10
struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
unsigned subsystem_current_count;
extern struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
extern struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS][SUBSYSTEM_MAX_SUBSYSTEM_ROMS];
extern unsigned subsystem_current_count;
RETRO_END_DECLS
#endif

View File

@ -29,9 +29,10 @@
#endif
#include "frontend.h"
#include "frontend_driver.h"
#include "../configuration.h"
#include "../ui/ui_companion_driver.h"
#include "../tasks/tasks_internal.h"
#include "../tasks/task_content.h"
#include "../driver.h"
#include "../paths.h"

View File

@ -363,4 +363,3 @@ void d3d8x_font_get_text_metrics(void *data, void *metrics)
font->lpVtbl->GetTextMetrics(font, (TEXTMETRICA*)metrics);
#endif
}

View File

@ -601,7 +601,7 @@ void d3d9x_constant_table_set_matrix(LPDIRECT3DDEVICE9 dev,
#if defined(HAVE_D3DX)
LPD3DXCONSTANTTABLE consttbl = (LPD3DXCONSTANTTABLE)p;
D3DXHANDLE handle = (D3DXHANDLE)data;
const D3DXMATRIX *matrix = (const D3DXMATRIX*)matrix;
const D3DXMATRIX *matrix = (const D3DXMATRIX*)_matrix;
if (consttbl && dev && handle)
consttbl->lpVtbl->SetMatrix(consttbl, dev, handle, matrix);
#endif

View File

@ -358,7 +358,7 @@ bool egl_init_context(egl_ctx_data_t *egl,
return false;
}
configs = malloc(*count * sizeof(*configs));
configs = (EGLConfig*)malloc(*count * sizeof(*configs));
if (!configs)
return false;

View File

@ -29,13 +29,13 @@
#include <retro_inline.h>
#include <gfx/math/matrix_4x4.h>
#include <gfx/scaler/scaler.h>
#include <glsym/glsym.h>
#include <formats/image.h>
#include "../../verbosity.h"
#include "../font_driver.h"
#include "../video_coord_array.h"
#include "../video_driver.h"
#include <glsym/glsym.h>
RETRO_BEGIN_DECLS

View File

@ -89,4 +89,3 @@ typedef struct
} FontFragmentIn;
#endif /* ShaderTypes_h */

View File

@ -28,15 +28,13 @@
#endif
#include "vulkan_common.h"
#include "../../libretro-common/include/retro_timers.h"
#include <retro_timers.h>
#include "../../configuration.h"
#include "../include/vulkan/vulkan.h"
#include "../../libretro-common/include/retro_assert.h"
#include <retro_assert.h>
#include "vksym.h"
#include "../../libretro-common/include/dynamic/dylib.h"
#include "../../libretro-common/include/libretro_vulkan.h"
#include "../../libretro-common/include/retro_math.h"
#include "../../libretro-common/include/string/stdstring.h"
#include <libretro_vulkan.h>
#include <retro_math.h>
#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_NV 0x10DE

View File

@ -48,10 +48,7 @@
#include "../font_driver.h"
#include "../video_driver.h"
#include "../drivers_shader/shader_vulkan.h"
#include "../../libretro-common/include/gfx/math/matrix_4x4.h"
#include "../include/vulkan/vulkan.h"
#include "../../libretro-common/include/gfx/scaler/scaler.h"
#include "../../libretro-common/include/libretro_vulkan.h"
RETRO_BEGIN_DECLS
@ -587,4 +584,3 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
RETRO_END_DECLS
#endif

View File

@ -64,4 +64,3 @@ typedef struct input_ctx_wayland_data
} input_ctx_wayland_data_t;
#endif

View File

@ -44,6 +44,7 @@
#include "../../driver.h"
#include "../../paths.h"
#include "../../retroarch.h"
#include "../../tasks/task_content.h"
#include "../../tasks/tasks_internal.h"
#include "../../core_info.h"
@ -51,7 +52,6 @@
#include <commdlg.h>
#include <dbt.h>
#include "../../retroarch.h"
#include "../../input/input_driver.h"
#include "../../input/input_keymaps.h"
#include "../video_thread_wrapper.h"

View File

@ -805,4 +805,3 @@ char *x11_get_wm_name(Display *dpy)
return title;
}

View File

@ -82,4 +82,3 @@ char *x11_get_wm_name(Display *dpy);
bool x11_has_net_wm_fullscreen(Display *dpy);
#endif

View File

@ -30,4 +30,3 @@ unsigned xinerama_get_monitor(Display *dpy,
int x, int y, int w, int h);
#endif

View File

@ -54,4 +54,3 @@ const video_display_server_t dispserv_null = {
NULL, /* get_output_options */
"null"
};

View File

@ -1580,7 +1580,7 @@ static uintptr_t d3d10_gfx_load_texture(
return (uintptr_t)texture;
}
static void d3d10_gfx_unload_texture(void* data, uintptr_t handle)
static void d3d10_gfx_unload_texture(void* data, uintptr_t handle, bool threaded)
{
d3d10_texture_t* texture = (d3d10_texture_t*)handle;

View File

@ -1640,7 +1640,7 @@ static uintptr_t d3d11_gfx_load_texture(
return (uintptr_t)texture;
}
static void d3d11_gfx_unload_texture(void* data, uintptr_t handle)
static void d3d11_gfx_unload_texture(void* data, uintptr_t handle, bool threaded)
{
d3d11_texture_t* texture = (d3d11_texture_t*)handle;

View File

@ -1759,7 +1759,7 @@ static uintptr_t d3d12_gfx_load_texture(
return (uintptr_t)texture;
}
static void d3d12_gfx_unload_texture(void* data, uintptr_t handle)
static void d3d12_gfx_unload_texture(void* data, uintptr_t handle, bool threaded)
{
d3d12_texture_t* texture = (d3d12_texture_t*)handle;

View File

@ -1818,7 +1818,7 @@ static uintptr_t d3d8_load_texture(void *video_data, void *data,
return id;
}
static void d3d8_unload_texture(void *data, uintptr_t id)
static void d3d8_unload_texture(void *data, uintptr_t id, bool threaded)
{
LPDIRECT3DTEXTURE8 texid;
if (!id)

View File

@ -1174,11 +1174,13 @@ static void d3d9_set_osd_msg(void *data,
{
d3d9_video_t *d3d = (d3d9_video_t*)data;
LPDIRECT3DDEVICE9 dev = d3d->dev;
const struct font_params *d3d_font_params = (const
struct font_params*)params;
d3d9_set_font_rect(d3d, params);
d3d9_set_font_rect(d3d, d3d_font_params);
d3d9_begin_scene(dev);
font_driver_render_msg(video_info, font,
msg, (const struct font_params *)params);
msg, d3d_font_params);
d3d9_end_scene(dev);
}
@ -1733,14 +1735,14 @@ static bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
!d3d9_device_create_offscreen_plain_surface(d3dr, width, height,
d3d9_get_xrgb8888_format(),
D3DPOOL_SYSTEMMEM, (void**)&dest, NULL) ||
!d3d9_device_get_render_target_data(d3dr, (void*)target, (void*)dest)
!d3d9_device_get_render_target_data(d3dr, target, dest)
)
{
ret = false;
goto end;
}
if (d3d9_surface_lock_rect(dest, (void*)&rect))
if (d3d9_surface_lock_rect(dest, &rect))
{
unsigned x, y;
unsigned pitchpix = rect.Pitch / 4;
@ -1760,7 +1762,7 @@ static bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
}
}
d3d9_surface_unlock_rect((void*)dest);
d3d9_surface_unlock_rect(dest);
}
else
ret = false;
@ -1987,7 +1989,7 @@ static uintptr_t d3d9_load_texture(void *video_data, void *data,
return id;
}
static void d3d9_unload_texture(void *data, uintptr_t id)
static void d3d9_unload_texture(void *data, uintptr_t id, bool threaded)
{
LPDIRECT3DTEXTURE9 texid;
if (!id)

View File

@ -585,7 +585,7 @@ static uintptr_t gdi_load_texture(void *video_data, void *data,
if (!image || image->width > 2048 || image->height > 2048)
return 0;
texture = calloc(1, sizeof(*texture));
texture = (gdi_texture_t*)calloc(1, sizeof(*texture));
if (!texture)
return 0;
@ -610,7 +610,7 @@ static uintptr_t gdi_load_texture(void *video_data, void *data,
return (uintptr_t)texture;
}
static void gdi_unload_texture(void *data, uintptr_t handle)
static void gdi_unload_texture(void *data, uintptr_t handle, bool threaded)
{
struct gdi_texture *texture = (struct gdi_texture*)handle;

View File

@ -1727,6 +1727,7 @@ static void *gl_init(const video_info_t *video,
char *error_string = NULL;
gl_t *gl = (gl_t*)calloc(1, sizeof(gl_t));
const gfx_ctx_driver_t *ctx_driver = gl_get_context(gl);
if (!gl || !ctx_driver)
goto error;
@ -1782,6 +1783,9 @@ static void *gl_init(const video_info_t *video,
RARCH_LOG("[GL]: Vendor: %s, Renderer: %s.\n", vendor, renderer);
RARCH_LOG("[GL]: Version: %s.\n", version);
if (string_is_equal(ctx_driver->ident, "null"))
goto error;
if (!string_is_empty(version))
sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor);
@ -2492,6 +2496,12 @@ static void video_texture_load_gl(
);
}
static void video_texture_unload_gl(
uintptr_t *id)
{
glDeleteTextures(1, (GLuint*)id);
}
#ifdef HAVE_THREADS
static int video_texture_load_wrap_gl_mipmap(void *data)
{
@ -2514,13 +2524,20 @@ static int video_texture_load_wrap_gl(void *data)
TEXTURE_FILTER_LINEAR, &id);
return (int)id;
}
static int video_texture_unload_wrap_gl(void *data)
{
if (!data)
return 0;
video_texture_unload_gl((uintptr_t*)data);
return 0;
}
#endif
static uintptr_t gl_load_texture(void *video_data, void *data,
bool threaded, enum texture_filter_type filter_type)
{
uintptr_t id = 0;
#ifdef HAVE_THREADS
if (threaded)
{
@ -2535,7 +2552,8 @@ static uintptr_t gl_load_texture(void *video_data, void *data,
default:
break;
}
return video_thread_texture_load(data, func);
id=video_thread_texture_load(data, func);
return id;
}
#endif
@ -2543,14 +2561,21 @@ static uintptr_t gl_load_texture(void *video_data, void *data,
return id;
}
static void gl_unload_texture(void *data, uintptr_t id)
static void gl_unload_texture(void *video_data, uintptr_t data, bool threaded)
{
GLuint glid;
if (!id)
if (!data)
return;
glid = (GLuint)id;
glDeleteTextures(1, &glid);
#ifdef HAVE_THREADS
if (threaded)
{
custom_command_method_t func = video_texture_unload_wrap_gl;
video_thread_texture_load((void *)&data, func);
return;
}
#endif
video_texture_unload_gl(&data);
}
static void gl_set_coords(void *handle_data, void *shader_data,

View File

@ -34,5 +34,3 @@ for( int i=0; i < 6; i++ )
color *= sqrt(1.5 - 0.5 * length(uv));
FragColor = vec4(color.r, color.g, color.b , 0.5);
}

View File

@ -71,5 +71,3 @@ void main(void)
a = a * min(pos.y * 4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -71,5 +71,3 @@ void main(void)
a = a * min(pos.y * 4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -73,4 +73,3 @@ void main(void)
FragColor = vec4(col(p));
}

View File

@ -194,12 +194,10 @@ static uintptr_t metal_load_texture(void *video_data, void *data,
return (uintptr_t)(__bridge_retained void *)(t);
}
static void metal_unload_texture(void *data, uintptr_t handle)
static void metal_unload_texture(void *data, uintptr_t handle, bool threaded)
{
if (!handle)
{
return;
}
Texture *t = (__bridge_transfer Texture *)(void *)handle;
t = nil;
}

View File

@ -21,6 +21,7 @@
#include <kernel.h>
#include <gsKit.h>
#include <gsInline.h>
#include "../../libretro-common/include/libretro_gskit_ps2.h"
#define GS_TEXT GS_SETREG_RGBAQ(0x80,0x80,0x80,0x80,0x00) // turn white GS Screen
#define GS_BLACK GS_SETREG_RGBAQ(0x00,0x00,0x00,0x00,0x00) // turn white GS Screen
@ -34,11 +35,14 @@ typedef struct ps2_video
GSTEXTURE *menuTexture;
GSTEXTURE *coreTexture;
bool clearVRAM;
struct retro_hw_render_interface_gskit_ps2 iface; /* Palette in the cores */
bool menuVisible;
bool fullscreen;
bool rgb32;
bool vsync;
int PSM;
bool force_aspect;
int menu_filter;
int core_filter;
@ -85,6 +89,11 @@ static void init_ps2_video(ps2_video_t *ps2)
ps2->gsGlobal = init_GSGlobal();
ps2->menuTexture = prepare_new_texture();
ps2->coreTexture = prepare_new_texture();
/* Used for cores that supports palette */
ps2->iface.interface_type = RETRO_HW_RENDER_INTERFACE_GSKIT_PS2;
ps2->iface.interface_version = RETRO_HW_RENDER_INTERFACE_GSKIT_PS2_VERSION;
ps2->iface.coreTexture = ps2->coreTexture;
}
static void deinitTexture(GSTEXTURE *texture)
@ -95,55 +104,18 @@ static void deinitTexture(GSTEXTURE *texture)
texture->Clut = NULL;
}
static void color_correction32(uint32_t *buffer, uint32_t dimensions)
static bool texture_need_prepare(GSTEXTURE *texture, int width, int height, int PSM)
{
uint32_t i;
uint32_t x32;
for (i = 0; i < dimensions; i++) {
x32 = buffer[i];
buffer[i] = ((x32 >> 16) & 0xFF) | ((x32 << 16) & 0xFF0000) | (x32 & 0xFF00FF00);
}
}
static void color_correction16(uint16_t *buffer, uint32_t dimensions)
{
uint32_t i;
uint16_t x16;
for (i = 0; i < dimensions; i++) {
x16 = buffer[i];
buffer[i] = (x16 & 0x8000) | ((x16 << 10) & 0x7C00) | ((x16 >> 1) & 0x3E0) | ((x16 >> 11) & 0x1F);
}
}
static bool texture_need_prepare(GSTEXTURE *texture, int width, int height, int PSM, int filter)
{
return !texture->Mem || texture->Width != width || texture->Height != height || texture->PSM != PSM;
return texture->Width != width || texture->Height != height || texture->PSM != PSM;
}
static void transfer_texture(GSTEXTURE *texture, const void *frame,
int width, int height, bool rgb32, int filter, bool color_correction)
int width, int height, int PSM, int filter, bool color_correction)
{
int PSM = rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool changed = texture_need_prepare(texture, width, height, rgb32, PSM);
if (color_correction) {
int pixels = width * height;
if (rgb32) {
uint32_t *buffer = (uint32_t *)frame;
color_correction32(buffer, pixels);
} else {
uint16_t *buffer = (uint16_t *)frame;
color_correction16(buffer, pixels);
}
}
if (changed) {
texture->Width = width;
texture->Height = height;
texture->PSM = PSM;
texture->Filter = filter;
}
texture->Width = width;
texture->Height = height;
texture->PSM = PSM;
texture->Filter = filter;
texture->Mem = (void *)frame;
}
@ -154,6 +126,12 @@ static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture)
if(texture->Vram == GSKIT_ALLOC_ERROR) {
printf("VRAM Allocation Failed. Will not upload texture.\n");
}
if (texture->Clut) {
/* Right now just supporting 16 x 16 = 256 colours */
size = gsKit_texture_size(16, 16, texture->ClutPSM);
texture->VramClut = gsKit_vram_alloc(gsGlobal, size , GSKIT_ALLOC_USERBUFFER);
}
}
static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect)
@ -191,11 +169,16 @@ static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition,
GS_TEXT);
}
static void clearVRAMIfNeeded(ps2_video_t *ps2, int width, int height)
static void clearVRAMIfNeeded(ps2_video_t *ps2, void *frame, int width, int height)
{
int PSM = ps2->rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool coreVRAMClear = texture_need_prepare(ps2->coreTexture, width, height, PSM, ps2->core_filter);
ps2->clearVRAM = ps2->clearVRAM || coreVRAMClear;
if (!ps2->clearVRAM) {
if(frame && frame != RETRO_HW_FRAME_BUFFER_VALID) {
bool coreVRAMClear = false;
coreVRAMClear = texture_need_prepare(ps2->coreTexture, width, height, ps2->PSM);
ps2->clearVRAM = ps2->clearVRAM || coreVRAMClear;
}
}
if (ps2->clearVRAM) {
gsKit_clear(ps2->gsGlobal, GS_BLACK);
gsKit_vram_clear(ps2->gsGlobal);
@ -204,7 +187,9 @@ static void clearVRAMIfNeeded(ps2_video_t *ps2, int width, int height)
static void refreshScreen(ps2_video_t *ps2)
{
gsKit_sync_flip(ps2->gsGlobal);
if (ps2->vsync) {
gsKit_sync_flip(ps2->gsGlobal);
}
gsKit_queue_exec(ps2->gsGlobal);
ps2->clearVRAM = false;
@ -225,10 +210,12 @@ static void *ps2_gfx_init(const video_info_t *video,
if (video->font_enable) {
font_driver_init_osd(ps2, false, video->is_threaded, FONT_DRIVER_RENDER_PS2);
}
ps2->rgb32 = video->rgb32;
ps2->PSM = (video->rgb32 ? GS_PSM_CT32 : GS_PSM_CT16);
ps2->fullscreen = video->fullscreen;
ps2->core_filter = video->smooth ? GS_FILTER_LINEAR : GS_FILTER_NEAREST;
ps2->force_aspect = video->force_aspect;
ps2->vsync = video->vsync;
ps2->clearVRAM = true;
if (input && input_data) {
settings_t *settings = config_get_ptr();
@ -249,14 +236,18 @@ static bool ps2_gfx_frame(void *data, const void *frame,
if (!width || !height)
return false;
if (frame_count%120==0) {
#if defined(DEBUG)
if (frame_count%60==0) {
printf("ps2_gfx_frame %lu\n", frame_count);
}
#endif
clearVRAMIfNeeded(ps2, width, height);
clearVRAMIfNeeded(ps2, frame, width, height);
if (frame) {
transfer_texture(ps2->coreTexture, frame, width, height, ps2->rgb32, ps2->core_filter, 1);
if (frame != RETRO_HW_FRAME_BUFFER_VALID){ /* Checking if the transfer is done in the core */
transfer_texture(ps2->coreTexture, frame, width, height, ps2->PSM, ps2->core_filter, 1);
}
if(ps2->clearVRAM) {
vram_alloc(ps2->gsGlobal, ps2->coreTexture);
}
@ -294,8 +285,10 @@ static bool ps2_gfx_frame(void *data, const void *frame,
static void ps2_gfx_set_nonblock_state(void *data, bool toggle)
{
(void)data;
(void)toggle;
ps2_video_t *ps2 = (ps2_video_t*)data;
if (ps2)
ps2->vsync = !toggle;
}
static bool ps2_gfx_alive(void *data)
@ -395,16 +388,20 @@ static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
ps2_video_t *ps2 = (ps2_video_t*)data;
bool color_correction = false;
int PSM = rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool texture_changed = texture_need_prepare(ps2->menuTexture, width, height, rgb32, PSM);
int PSM = (rgb32 ? GS_PSM_CT32 : GS_PSM_CT16);
bool texture_changed = texture_need_prepare(ps2->menuTexture, width, height, PSM);
transfer_texture(ps2->menuTexture, frame, width, height, rgb32, ps2->menu_filter, color_correction);
ps2->clearVRAM = texture_changed;
transfer_texture(ps2->menuTexture, frame, width, height, PSM, ps2->menu_filter, color_correction);
ps2->clearVRAM = ps2->clearVRAM || texture_changed;
}
static void ps2_set_texture_enable(void *data, bool enable, bool fullscreen)
{
ps2_video_t *ps2 = (ps2_video_t*)data;
if (ps2->menuVisible != enable) {
/* If Menu change status, CLEAR VRAM */
ps2->clearVRAM = true;
}
ps2->menuVisible = enable;
ps2->fullscreen = fullscreen;
}
@ -417,6 +414,15 @@ static void ps2_set_osd_msg(void *data,
font_driver_render_msg(video_info, font, msg, params);
}
static bool ps2_get_hw_render_interface(void* data,
const struct retro_hw_render_interface** iface)
{
ps2_video_t* ps2 = (ps2_video_t*)data;
ps2->iface.clearTexture = ps2->clearVRAM;
*iface = (const struct retro_hw_render_interface*)&ps2->iface;
return true;
}
static const video_poke_interface_t ps2_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
@ -440,7 +446,7 @@ static const video_poke_interface_t ps2_poke_interface = {
NULL, /* grab_mouse_toggle */
NULL, /* get_current_shader */
NULL, /* get_current_software_framebuffer */
NULL /* get_hw_render_interface */
ps2_get_hw_render_interface /* get_hw_render_interface */
};
static void ps2_gfx_get_poke_interface(void *data,

View File

@ -784,4 +784,3 @@ video_driver_t video_sdl2 = {
#endif
sdl2_gfx_poke_interface
};

View File

@ -2334,7 +2334,7 @@ static uintptr_t vulkan_load_texture(void *video_data, void *data,
return (uintptr_t)texture;
}
static void vulkan_unload_texture(void *data, uintptr_t handle)
static void vulkan_unload_texture(void *data, uintptr_t handle, bool threaded)
{
vk_t *vk = (vk_t*)data;
struct vk_texture *texture = (struct vk_texture*)handle;
@ -2745,4 +2745,3 @@ video_driver_t video_vulkan = {
vulkan_get_poke_interface,
NULL, /* vulkan_wrap_type_to_enum */
};

View File

@ -35,5 +35,3 @@ for( int i=0; i < 8; i++ )
color *= sqrt(1.5 - 0.5 * length(uv));
FragColor = vec4(color.r, color.g, color.b , 0.5);
}

View File

@ -72,5 +72,3 @@ void main(void)
a = a * min(pos.y * 4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -72,5 +72,3 @@ void main(void)
a = a * min(pos.y * 4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -267,4 +267,3 @@ video_driver_t video_xshm = {
#endif
xshm_gfx_poke_interface
};

View File

@ -376,4 +376,3 @@ const gfx_ctx_driver_t gfx_ctx_gdi = {
NULL,
NULL
};

View File

@ -166,4 +166,3 @@ const gfx_ctx_driver_t gfx_ctx_null = {
NULL,
NULL
};

View File

@ -266,4 +266,3 @@ const gfx_ctx_driver_t gfx_ctx_khr_display = {
gfx_ctx_khr_display_get_context_data,
NULL
};

View File

@ -332,4 +332,3 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
NULL,
NULL
};

View File

@ -442,4 +442,3 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
NULL,
NULL
};

View File

@ -207,4 +207,3 @@ const gfx_ctx_driver_t gfx_ctx_sixel = {
NULL,
NULL
};

View File

@ -874,4 +874,3 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
#endif
NULL
};

View File

@ -154,4 +154,3 @@ font_renderer_driver_t bitmap_font_renderer = {
"bitmap",
font_renderer_bmp_get_line_height,
};

View File

@ -293,6 +293,8 @@ bool glslang_parse_meta(const vector<string> &lines, glslang_meta *meta)
for (auto &line : lines)
{
const char *line_c = line.c_str();
if (line.find("#pragma name ") == 0)
{
const char *str = NULL;
@ -303,7 +305,7 @@ bool glslang_parse_meta(const vector<string> &lines, glslang_meta *meta)
return false;
}
str = line.c_str() + strlen("#pragma name ");
str = line_c + strlen("#pragma name ");
while (*str == ' ')
str++;
@ -312,7 +314,7 @@ bool glslang_parse_meta(const vector<string> &lines, glslang_meta *meta)
else if (line.find("#pragma parameter ") == 0)
{
float initial, minimum, maximum, step;
int ret = sscanf(line.c_str(), "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f",
int ret = sscanf(line_c, "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f",
id, desc, &initial, &minimum, &maximum, &step);
if (ret == 5)
@ -347,7 +349,7 @@ bool glslang_parse_meta(const vector<string> &lines, glslang_meta *meta)
}
else
{
RARCH_ERR("[slang]: Invalid #pragma parameter line: \"%s\".\n", line.c_str());
RARCH_ERR("[slang]: Invalid #pragma parameter line: \"%s\".\n", line_c);
return false;
}
}
@ -361,7 +363,7 @@ bool glslang_parse_meta(const vector<string> &lines, glslang_meta *meta)
return false;
}
str = line.c_str() + strlen("#pragma format ");
str = line_c + strlen("#pragma format ");
while (*str == ' ')
str++;

View File

@ -111,4 +111,3 @@ bool glslang_parse_meta(const std::vector<std::string> &lines, glslang_meta *met
#endif
#endif

View File

@ -1297,4 +1297,3 @@ const shader_backend_t gl_cg_backend = {
RARCH_SHADER_CG,
"gl_cg"
};

View File

@ -22,13 +22,13 @@
#include <utility>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <compat/strl.h>
#include <formats/image.h>
#include <retro_miscellaneous.h>
#include "slang_reflection.h"
#include "slang_reflection.hpp"
#include "../video_driver.h"
#include "../../verbosity.h"
@ -472,12 +472,12 @@ class Pass
struct PushConstant
{
VkShaderStageFlags stages = 0;
vector<uint32_t> buffer; // uint32_t to have correct alignment.
vector<uint32_t> buffer; /* uint32_t to have correct alignment. */
};
PushConstant push;
};
// struct here since we're implementing the opaque typedef from C.
/* struct here since we're implementing the opaque typedef from C. */
struct vulkan_filter_chain
{
public:
@ -749,7 +749,8 @@ bool vulkan_filter_chain::init_history()
return true;
}
// We don't need to store array element #0, since it's aliased with the actual original.
/* We don't need to store array element #0,
* since it's aliased with the actual original. */
required_images--;
original_history.reserve(required_images);
common.original_history.resize(required_images);
@ -762,8 +763,10 @@ bool vulkan_filter_chain::init_history()
RARCH_LOG("[Vulkan filter chain]: Using history of %u frames.\n", required_images);
// On first frame, we need to clear the textures to a known state, but we need
// a command buffer for that, so just defer to first frame.
/* On first frame, we need to clear the textures to
* a known state, but we need
* a command buffer for that, so just defer to first frame.
*/
require_clear = true;
return true;
}
@ -774,7 +777,7 @@ bool vulkan_filter_chain::init_feedback()
bool use_feedbacks = false;
// Final pass cannot have feedback.
/* Final pass cannot have feedback. */
for (unsigned i = 0; i < passes.size() - 1; i++)
{
bool use_feedback = false;
@ -878,7 +881,7 @@ bool vulkan_filter_chain::init_ubo()
vkGetPhysicalDeviceProperties(gpu, &props);
common.ubo_alignment = props.limits.minUniformBufferOffsetAlignment;
// Who knows. :)
/* Who knows. :) */
if (common.ubo_alignment == 0)
common.ubo_alignment = 1;
@ -947,7 +950,7 @@ void vulkan_filter_chain::clear_history_and_feedback(VkCommandBuffer cmd)
void vulkan_filter_chain::build_offscreen_passes(VkCommandBuffer cmd,
const VkViewport &vp)
{
// First frame, make sure our history and feedback textures are in a clean state.
/* First frame, make sure our history and feedback textures are in a clean state. */
if (require_clear)
{
clear_history_and_feedback(cmd);
@ -990,7 +993,7 @@ void vulkan_filter_chain::update_history(DeferredDisposer &disposer, VkCommandBu
{
VkImageLayout src_layout = input_texture.layout;
// Transition input texture to something appropriate.
/* Transition input texture to something appropriate. */
if (input_texture.layout != VK_IMAGE_LAYOUT_GENERAL)
{
vulkan_image_layout_transition_levels(cmd,
@ -1018,7 +1021,7 @@ void vulkan_filter_chain::update_history(DeferredDisposer &disposer, VkCommandBu
tmp->copy(cmd, input_texture.image, src_layout);
// Transition input texture back.
/* Transition input texture back. */
if (input_texture.layout != VK_IMAGE_LAYOUT_GENERAL)
{
vulkan_image_layout_transition_levels(cmd,
@ -1031,16 +1034,17 @@ void vulkan_filter_chain::update_history(DeferredDisposer &disposer, VkCommandBu
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
}
// Should ring buffer, but we don't have *that* many passes.
/* Should ring buffer, but we don't have *that* many passes. */
move_backward(begin(original_history), end(original_history) - 1, end(original_history));
swap(original_history.front(), tmp);
}
void vulkan_filter_chain::end_frame(VkCommandBuffer cmd)
{
// If we need to keep old frames, copy it after fragment is complete.
// TODO: We can improve pipelining by figuring out which pass is the last that reads from
// the history and dispatch the copy earlier.
/* If we need to keep old frames, copy it after fragment is complete.
* TODO: We can improve pipelining by figuring out which
* pass is the last that reads from
* the history and dispatch the copy earlier. */
if (!original_history.empty())
{
DeferredDisposer disposer(deferred_calls[current_sync_index]);
@ -1051,7 +1055,7 @@ void vulkan_filter_chain::end_frame(VkCommandBuffer cmd)
void vulkan_filter_chain::build_viewport_pass(
VkCommandBuffer cmd, const VkViewport &vp, const float *mvp)
{
// First frame, make sure our history and feedback textures are in a clean state.
/* First frame, make sure our history and feedback textures are in a clean state. */
if (require_clear)
{
clear_history_and_feedback(cmd);
@ -1091,7 +1095,7 @@ void vulkan_filter_chain::build_viewport_pass(
passes.back()->build_commands(disposer, cmd,
original, source, vp, mvp);
// For feedback FBOs, swap current and previous.
/* For feedback FBOs, swap current and previous. */
for (auto &pass : passes)
pass->end_frame();
}
@ -1307,7 +1311,7 @@ bool Pass::init_pipeline_layout()
vector<VkDescriptorSetLayoutBinding> bindings;
vector<VkDescriptorPoolSize> desc_counts;
// Main UBO.
/* Main UBO. */
VkShaderStageFlags ubo_mask = 0;
if (reflection.ubo_stage_mask & SLANG_STAGE_VERTEX_MASK)
ubo_mask |= VK_SHADER_STAGE_VERTEX_BIT;
@ -1322,7 +1326,7 @@ bool Pass::init_pipeline_layout()
desc_counts.push_back({ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, num_sync_indices });
}
// Semantic textures.
/* Semantic textures. */
for (auto &semantic : reflection.semantic_textures)
{
for (auto &texture : semantic)
@ -1357,7 +1361,7 @@ bool Pass::init_pipeline_layout()
layout_info.setLayoutCount = 1;
layout_info.pSetLayouts = &set_layout;
// Push constants
/* Push constants */
VkPushConstantRange push_range = {};
if (reflection.push_constant_stage_mask && reflection.push_constant_size)
{
@ -1407,12 +1411,12 @@ bool Pass::init_pipeline()
if (!init_pipeline_layout())
return false;
// Input assembly
/* Input assembly */
VkPipelineInputAssemblyStateCreateInfo input_assembly = {
VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO };
input_assembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
// VAO state
/* VAO state */
VkVertexInputAttributeDescription attributes[2] = {{0}};
VkVertexInputBindingDescription binding = {0};
@ -1436,7 +1440,7 @@ bool Pass::init_pipeline()
vertex_input.vertexAttributeDescriptionCount = 2;
vertex_input.pVertexAttributeDescriptions = attributes;
// Raster state
/* Raster state */
VkPipelineRasterizationStateCreateInfo raster = {
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO };
raster.polygonMode = VK_POLYGON_MODE_FILL;
@ -1447,7 +1451,7 @@ bool Pass::init_pipeline()
raster.depthBiasEnable = false;
raster.lineWidth = 1.0f;
// Blend state
/* Blend state */
VkPipelineColorBlendAttachmentState blend_attachment = {0};
VkPipelineColorBlendStateCreateInfo blend = {
VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
@ -1456,13 +1460,13 @@ bool Pass::init_pipeline()
blend.attachmentCount = 1;
blend.pAttachments = &blend_attachment;
// Viewport state
/* Viewport state */
VkPipelineViewportStateCreateInfo viewport = {
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO };
viewport.viewportCount = 1;
viewport.scissorCount = 1;
// Depth-stencil state
/* Depth-stencil state */
VkPipelineDepthStencilStateCreateInfo depth_stencil = {
VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO };
depth_stencil.depthTestEnable = false;
@ -1472,12 +1476,12 @@ bool Pass::init_pipeline()
depth_stencil.minDepthBounds = 0.0f;
depth_stencil.maxDepthBounds = 1.0f;
// Multisample state
/* Multisample state */
VkPipelineMultisampleStateCreateInfo multisample = {
VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO };
multisample.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
// Dynamic state
/* Dynamic state */
VkPipelineDynamicStateCreateInfo dynamic = {
VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
static const VkDynamicState dynamics[] = {
@ -1485,7 +1489,7 @@ bool Pass::init_pipeline()
dynamic.pDynamicStates = dynamics;
dynamic.dynamicStateCount = sizeof(dynamics) / sizeof(dynamics[0]);
// Shaders
/* Shaders */
VkPipelineShaderStageCreateInfo shader_stages[2] = {
{ VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO },
{ VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO },
@ -1538,16 +1542,18 @@ CommonResources::CommonResources(VkDevice device,
const VkPhysicalDeviceMemoryProperties &memory_properties)
: device(device)
{
// The final pass uses an MVP designed for [0, 1] range VBO.
// For in-between passes, we just go with identity matrices, so keep it simple.
/* The final pass uses an MVP designed for [0, 1] range VBO.
* For in-between passes, we just go with identity matrices,
* so keep it simple.
*/
const float vbo_data[] = {
// Offscreen
/* Offscreen */
-1.0f, -1.0f, 0.0f, 0.0f,
-1.0f, +1.0f, 0.0f, 1.0f,
1.0f, -1.0f, 1.0f, 0.0f,
1.0f, +1.0f, 1.0f, 1.0f,
// Final
/* Final */
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, +1.0f, 0.0f, 1.0f,
1.0f, 0.0f, 1.0f, 0.0f,
@ -1656,12 +1662,12 @@ void Pass::allocate_buffers()
{
if (reflection.ubo_stage_mask)
{
// Align
/* Align */
common->ubo_offset = (common->ubo_offset + common->ubo_alignment - 1) &
~(common->ubo_alignment - 1);
ubo_offset = common->ubo_offset;
// Allocate
/* Allocate */
common->ubo_offset += reflection.ubo_size;
}
}
@ -1718,7 +1724,7 @@ bool Pass::build()
if (!slang_reflect_spirv(vertex_shader, fragment_shader, &reflection))
return false;
// Filter out parameters which we will never use anyways.
/* Filter out parameters which we will never use anyways. */
filtered_parameters.clear();
for (i = 0; i < reflection.semantic_float_parameters.size(); i++)
@ -1836,7 +1842,7 @@ void Pass::build_semantic_parameter(uint8_t *data, unsigned index, float value)
{
auto &refl = reflection.semantic_float_parameters[index];
// We will have filtered out stale parameters.
/* We will have filtered out stale parameters. */
if (data && refl.uniform)
*reinterpret_cast<float*>(data + refl.ubo_offset) = value;
@ -1875,7 +1881,7 @@ void Pass::build_semantic_texture_array(VkDescriptorSet set, uint8_t *buffer,
void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
const float *mvp, const Texture &original, const Texture &source)
{
// MVP
/* MVP */
if (buffer && reflection.semantics[SLANG_SEMANTIC_MVP].uniform)
{
size_t offset = reflection.semantics[SLANG_SEMANTIC_MVP].ubo_offset;
@ -1894,7 +1900,7 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
build_identity_matrix(reinterpret_cast<float *>(push.buffer.data() + (offset >> 2)));
}
// Output information
/* Output information */
build_semantic_vec4(buffer, SLANG_SEMANTIC_OUTPUT,
current_framebuffer_size.width, current_framebuffer_size.height);
build_semantic_vec4(buffer, SLANG_SEMANTIC_FINAL_VIEWPORT,
@ -1903,21 +1909,21 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
build_semantic_uint(buffer, SLANG_SEMANTIC_FRAME_COUNT,
frame_count_period ? uint32_t(frame_count % frame_count_period) : uint32_t(frame_count));
// Standard inputs
/* Standard inputs */
build_semantic_texture(set, buffer, SLANG_TEXTURE_SEMANTIC_ORIGINAL, original);
build_semantic_texture(set, buffer, SLANG_TEXTURE_SEMANTIC_SOURCE, source);
// ORIGINAL_HISTORY[0] is an alias of ORIGINAL.
/* ORIGINAL_HISTORY[0] is an alias of ORIGINAL. */
build_semantic_texture_array(set, buffer, SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY, 0, original);
// Parameters.
/* Parameters. */
for (auto &param : filtered_parameters)
{
float value = common->shader_preset->parameters[param.index].current;
build_semantic_parameter(buffer, param.semantic_index, value);
}
// Previous inputs.
/* Previous inputs. */
unsigned i = 0;
for (auto &texture : common->original_history)
{
@ -1927,7 +1933,7 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
i++;
}
// Previous passes.
/* Previous passes. */
i = 0;
for (auto &texture : common->pass_outputs)
{
@ -1937,7 +1943,7 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
i++;
}
// Feedback FBOs.
/* Feedback FBOs. */
i = 0;
for (auto &texture : common->framebuffer_feedback)
{
@ -1947,7 +1953,7 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
i++;
}
// LUTs.
/* LUTs. */
i = 0;
for (auto &lut : common->luts)
{
@ -1996,10 +2002,10 @@ void Pass::build_commands(
reflection.ubo_size);
}
// The final pass is always executed inside
// another render pass since the frontend will
// want to overlay various things on top for
// the passes that end up on-screen.
/* The final pass is always executed inside
* another render pass since the frontend will
* want to overlay various things on top for
* the passes that end up on-screen. */
if (!final_pass)
{
/* Render. */
@ -2085,7 +2091,7 @@ void Pass::build_commands(
framebuffer->generate_mips(cmd);
else
{
// Barrier to sync with next pass.
/* Barrier to sync with next pass. */
vulkan_image_layout_transition_levels(
cmd,
framebuffer->get_image(),VK_REMAINING_MIP_LEVELS,
@ -2147,19 +2153,20 @@ 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. :)
/* This is run every frame, so make sure
* we aren't opting into the "lazy" way of doing this. :) */
VkImageMemoryBarrier barriers[2] = {
{ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER },
{ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER },
};
// First, transfer the input mip level to TRANSFER_SRC_OPTIMAL.
// This should allow the surface to stay compressed.
// All subsequent mip-layers are now transferred into DST_OPTIMAL from
// UNDEFINED at this point.
/* First, transfer the input mip level to TRANSFER_SRC_OPTIMAL.
* This should allow the surface to stay compressed.
* All subsequent mip-layers are now transferred into DST_OPTIMAL from
* UNDEFINED at this point.
*/
// Input
/* Input */
barriers[0].srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
barriers[0].oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
@ -2172,7 +2179,7 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
barriers[0].subresourceRange.levelCount = 1;
barriers[0].subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
// The rest of the mip chain
/* The rest of the mip chain */
barriers[1].srcAccessMask = 0;
barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
@ -2195,8 +2202,9 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
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.
/* For subsequent passes, we have to transition
* from DST_OPTIMAL to SRC_OPTIMAL,
* but only do so one mip-level at a time. */
if (i > 1)
{
barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
@ -2240,10 +2248,15 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
1, &blit_region, VK_FILTER_LINEAR);
}
// We are now done, and we have all mip-levels except the last in TRANSFER_SRC_OPTIMAL,
// and the last one still on TRANSFER_DST_OPTIMAL, so do a final barrier which
// moves everything to SHADER_READ_ONLY_OPTIMAL in one go along with the execution barrier to next pass.
// Read-to-read memory barrier, so only need execution barrier for first transition.
/* We are now done, and we have all mip-levels except
* the last in TRANSFER_SRC_OPTIMAL,
* and the last one still on TRANSFER_DST_OPTIMAL,
* so do a final barrier which
* moves everything to SHADER_READ_ONLY_OPTIMAL in
* one go along with the execution barrier to next pass.
* Read-to-read memory barrier, so only need execution
* barrier for first transition.
*/
barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
barriers[0].dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
barriers[0].subresourceRange.baseMipLevel = 0;
@ -2251,7 +2264,7 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
barriers[0].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
// This is read-after-write barrier.
/* This is read-after-write barrier. */
barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
barriers[1].dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
barriers[1].subresourceRange.baseMipLevel = levels - 1;
@ -2267,8 +2280,10 @@ void Framebuffer::generate_mips(VkCommandBuffer cmd)
0, nullptr,
2, barriers);
// Next pass will wait for ALL_GRAPHICS_BIT, and since we have dstStage as FRAGMENT_SHADER,
// the dependency chain will ensure we don't start next pass until the mipchain is complete.
/* Next pass will wait for ALL_GRAPHICS_BIT, and since
* we have dstStage as FRAGMENT_SHADER,
* the dependency chain will ensure we don't start
* next pass until the mipchain is complete. */
}
void Framebuffer::copy(VkCommandBuffer cmd,
@ -2335,11 +2350,12 @@ void Framebuffer::init(DeferredDisposer *disposer)
memory_properties, mem_reqs.memoryTypeBits,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
// Can reuse already allocated memory.
/* Can reuse already allocated memory. */
if (memory.size < mem_reqs.size || memory.type != alloc.memoryTypeIndex)
{
// Memory might still be in use since we don't want to totally stall
// the world for framebuffer recreation.
/* Memory might still be in use since we don't want
* to totally stall
* the world for framebuffer recreation. */
if (memory.memory != VK_NULL_HANDLE && disposer)
{
auto d = device;
@ -2384,8 +2400,8 @@ void Framebuffer::init_render_pass()
VkAttachmentReference color_ref = { 0,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL };
// We will always write to the entire framebuffer,
// so we don't really need to clear.
/* We will always write to the entire framebuffer,
* so we don't really need to clear. */
VkAttachmentDescription attachment = {0};
attachment.format = format;
attachment.samples = VK_SAMPLE_COUNT_1_BIT;
@ -2434,13 +2450,13 @@ void Framebuffer::set_size(DeferredDisposer &disposer, const Size2D &size, VkFor
size.width, size.height, (unsigned)this->format);
{
// The current framebuffers, etc, might still be in use
// so defer deletion.
// We'll most likely be able to reuse the memory,
// so don't free it here.
//
// Fake lambda init captures for C++11.
//
/* The current framebuffers, etc, might still be in use
* so defer deletion.
* We'll most likely be able to reuse the memory,
* so don't free it here.
*
* Fake lambda init captures for C++11.
*/
auto d = device;
auto i = image;
auto v = view;
@ -2478,7 +2494,7 @@ Framebuffer::~Framebuffer()
vkFreeMemory(device, memory.memory, nullptr);
}
// C glue
/* C glue */
vulkan_filter_chain_t *vulkan_filter_chain_new(
const vulkan_filter_chain_create_info *info)
{
@ -2870,7 +2886,8 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
if (itr != shader->parameters + shader->num_parameters)
{
// Allow duplicate #pragma parameter, but only if they are exactly the same.
/* Allow duplicate #pragma parameter, but
* only if they are exactly the same. */
if (meta_param.desc != itr->desc ||
meta_param.initial != itr->initial ||
meta_param.minimum != itr->minimum ||
@ -2913,7 +2930,7 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
if (!output.meta.name.empty())
chain->set_pass_name(i, output.meta.name.c_str());
// Preset overrides.
/* Preset overrides. */
if (*pass->alias)
chain->set_pass_name(i, pass->alias);
@ -2928,9 +2945,10 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
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.
/* 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;
@ -2939,7 +2957,7 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
bool explicit_format = output.meta.rt_format != SLANG_FORMAT_UNKNOWN;
// Set a reasonable default.
/* Set a reasonable default. */
if (output.meta.rt_format == SLANG_FORMAT_UNKNOWN)
output.meta.rt_format = SLANG_FORMAT_R8G8B8A8_UNORM;
@ -2971,13 +2989,12 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
}
else
{
// Preset overrides shader.
// Kinda ugly ...
/* Preset overrides shader.
* Kinda ugly ... */
if (pass->fbo.srgb_fbo)
output.meta.rt_format = SLANG_FORMAT_R8G8B8A8_SRGB;
else if (pass->fbo.fp_fbo)
output.meta.rt_format = SLANG_FORMAT_R16G16B16A16_SFLOAT;
///
pass_info.rt_format = glslang_format_to_vk(output.meta.rt_format);
RARCH_LOG("[slang]: Using render target format %s for pass output #%u.\n",
@ -3163,4 +3180,3 @@ void vulkan_filter_chain_end_frame(
{
chain->end_frame(cmd);
}

View File

@ -168,4 +168,3 @@ struct video_shader *vulkan_filter_chain_get_preset(
RETRO_END_DECLS
#endif

View File

@ -95,4 +95,3 @@ bool slang_preprocess_parse_parameters(const char *shader_path,
return false;
return slang_preprocess_parse_parameters(meta, shader);
}

View File

@ -39,4 +39,3 @@ bool slang_preprocess_parse_parameters(glslang_meta& meta,
#endif
#endif

View File

@ -1,4 +1,18 @@

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2017 - Hans-Kristian Arntzen
*
* 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 <fstream>
#include <iostream>
#include <spirv_glsl.hpp>
@ -12,6 +26,7 @@
#include "glslang_util.h"
#include "slang_preprocess.h"
#include "slang_reflection.h"
#include "slang_reflection.hpp"
#include "slang_process.h"
#include "../../verbosity.h"

View File

@ -15,6 +15,7 @@
#include "spirv_cross.hpp"
#include "slang_reflection.h"
#include "slang_reflection.hpp"
#include <vector>
#include <algorithm>
#include <stdio.h>
@ -679,4 +680,3 @@ bool slang_reflect_spirv(const std::vector<uint32_t> &vertex,
return false;
}
}

View File

@ -16,65 +16,70 @@
#ifndef SLANG_REFLECTION_H_
#define SLANG_REFLECTION_H_
// Textures with built-in meaning.
/* Textures with built-in meaning. */
enum slang_texture_semantic
{
// The input texture to the filter chain.
// Canonical name: "Original".
SLANG_TEXTURE_SEMANTIC_ORIGINAL = 0,
/* The input texture to the filter chain.
* Canonical name: "Original". */
SLANG_TEXTURE_SEMANTIC_ORIGINAL = 0,
// The output from pass N - 1 if executing pass N, or ORIGINAL
// if pass #0 is executed.
// Canonical name: "Source".
SLANG_TEXTURE_SEMANTIC_SOURCE = 1,
/* The output from pass N - 1 if executing pass N, or ORIGINAL
* if pass #0 is executed.
* Canonical name: "Source".
*/
SLANG_TEXTURE_SEMANTIC_SOURCE = 1,
// The original inputs with a history back in time.
// Canonical name: "OriginalHistory#", e.g. "OriginalHistory2" <- Two frames back.
// "OriginalHistory0" is an alias for SEMANTIC_ORIGINAL.
// Size name: "OriginalHistorySize#".
/* The original inputs with a history back in time.
* Canonical name: "OriginalHistory#", e.g. "OriginalHistory2" <- Two frames back.
* "OriginalHistory0" is an alias for SEMANTIC_ORIGINAL.
* Size name: "OriginalHistorySize#".
*/
SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY = 2,
// The output from pass #N, where pass #0 is the first pass.
// Canonical name: "PassOutput#", e.g. "PassOutput3".
// Size name: "PassOutputSize#".
SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT = 3,
/* The output from pass #N, where pass #0 is the first pass.
* Canonical name: "PassOutput#", e.g. "PassOutput3".
* Size name: "PassOutputSize#".
*/
SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT = 3,
// The output from pass #N, one frame ago where pass #0 is the first pass.
// It is not valid to use the pass feedback from a pass which is not offscreen.
// Canonical name: "PassFeedback#", e.g. "PassFeedback2".
SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK = 4,
/* The output from pass #N, one frame ago where pass #0 is the first pass.
* It is not valid to use the pass feedback from a pass which is not offscreen.
* Canonical name: "PassFeedback#", e.g. "PassFeedback2".
*/
SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK = 4,
// Inputs from static textures, defined by the user.
// There is no canonical name, and the only way to use these semantics are by
// remapping.
SLANG_TEXTURE_SEMANTIC_USER = 5,
/* Inputs from static textures, defined by the user.
* There is no canonical name, and the only way to use these semantics are by
* remapping.
*/
SLANG_TEXTURE_SEMANTIC_USER = 5,
SLANG_NUM_TEXTURE_SEMANTICS,
SLANG_INVALID_TEXTURE_SEMANTIC = -1
SLANG_INVALID_TEXTURE_SEMANTIC = -1
};
enum slang_semantic
{
// mat4, MVP
SLANG_SEMANTIC_MVP = 0,
// vec4, viewport size of current pass
SLANG_SEMANTIC_OUTPUT = 1,
// vec4, viewport size of final pass
SLANG_SEMANTIC_FINAL_VIEWPORT = 2,
// uint, frame count with modulo
SLANG_SEMANTIC_FRAME_COUNT = 3,
/* mat4, MVP */
SLANG_SEMANTIC_MVP = 0,
/* vec4, viewport size of current pass */
SLANG_SEMANTIC_OUTPUT = 1,
/* vec4, viewport size of final pass */
SLANG_SEMANTIC_FINAL_VIEWPORT = 2,
/* uint, frame count with modulo */
SLANG_SEMANTIC_FRAME_COUNT = 3,
SLANG_NUM_BASE_SEMANTICS,
// float, user defined parameter, arrayed
/* float, user defined parameter, arrayed */
SLANG_SEMANTIC_FLOAT_PARAMETER = 4,
SLANG_NUM_SEMANTICS,
SLANG_INVALID_SEMANTIC = -1
SLANG_INVALID_SEMANTIC = -1
};
enum slang_stage
{
SLANG_STAGE_VERTEX_MASK = 1 << 0,
SLANG_STAGE_VERTEX_MASK = 1 << 0,
SLANG_STAGE_FRAGMENT_MASK = 1 << 1
};
@ -88,75 +93,4 @@ enum slang_constant_buffer
/* Vulkan minimum limit. */
#define SLANG_NUM_BINDINGS 16
#ifdef __cplusplus
#include <string>
#include <unordered_map>
#include <stdint.h>
#include <spirv_cross.hpp>
struct slang_texture_semantic_meta
{
size_t ubo_offset = 0;
size_t push_constant_offset = 0;
unsigned binding = 0;
uint32_t stage_mask = 0;
bool texture = false;
bool uniform = false;
bool push_constant = false;
};
struct slang_semantic_meta
{
size_t ubo_offset = 0;
size_t push_constant_offset = 0;
unsigned num_components = 0;
bool uniform = false;
bool push_constant = false;
};
struct slang_texture_semantic_map
{
slang_texture_semantic semantic;
unsigned index;
};
struct slang_semantic_map
{
slang_semantic semantic;
unsigned index;
};
struct slang_reflection
{
slang_reflection();
size_t ubo_size = 0;
size_t push_constant_size = 0;
unsigned ubo_binding = 0;
uint32_t ubo_stage_mask = 0;
uint32_t push_constant_stage_mask = 0;
std::vector<slang_texture_semantic_meta> semantic_textures[SLANG_NUM_TEXTURE_SEMANTICS];
slang_semantic_meta semantics[SLANG_NUM_SEMANTICS];
std::vector<slang_semantic_meta> semantic_float_parameters;
const std::unordered_map<std::string, slang_texture_semantic_map> *texture_semantic_map = nullptr;
const std::unordered_map<std::string, slang_texture_semantic_map> *texture_semantic_uniform_map = nullptr;
const std::unordered_map<std::string, slang_semantic_map> *semantic_map = nullptr;
unsigned pass_number = 0;
};
bool slang_reflect_spirv(const std::vector<uint32_t> &vertex,
const std::vector<uint32_t> &fragment,
slang_reflection *reflection);
bool slang_reflect(const spirv_cross::Compiler &vertex_compiler, const spirv_cross::Compiler &fragment_compiler,
const spirv_cross::ShaderResources &vertex, const spirv_cross::ShaderResources &fragment,
slang_reflection *reflection);
#endif
#endif

View File

@ -0,0 +1,86 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2019 - Hans-Kristian Arntzen
*
* 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/>.
*/
#ifndef SLANG_REFLECTION_HPP_
#define SLANG_REFLECTION_HPP_
#include <string>
#include <unordered_map>
#include <stdint.h>
#include <spirv_cross.hpp>
struct slang_texture_semantic_meta
{
size_t ubo_offset = 0;
size_t push_constant_offset = 0;
unsigned binding = 0;
uint32_t stage_mask = 0;
bool texture = false;
bool uniform = false;
bool push_constant = false;
};
struct slang_semantic_meta
{
size_t ubo_offset = 0;
size_t push_constant_offset = 0;
unsigned num_components = 0;
bool uniform = false;
bool push_constant = false;
};
struct slang_texture_semantic_map
{
slang_texture_semantic semantic;
unsigned index;
};
struct slang_semantic_map
{
slang_semantic semantic;
unsigned index;
};
struct slang_reflection
{
slang_reflection();
size_t ubo_size = 0;
size_t push_constant_size = 0;
unsigned ubo_binding = 0;
uint32_t ubo_stage_mask = 0;
uint32_t push_constant_stage_mask = 0;
std::vector<slang_texture_semantic_meta> semantic_textures[SLANG_NUM_TEXTURE_SEMANTICS];
slang_semantic_meta semantics[SLANG_NUM_SEMANTICS];
std::vector<slang_semantic_meta> semantic_float_parameters;
const std::unordered_map<std::string, slang_texture_semantic_map> *texture_semantic_map = nullptr;
const std::unordered_map<std::string, slang_texture_semantic_map> *texture_semantic_uniform_map = nullptr;
const std::unordered_map<std::string, slang_semantic_map> *semantic_map = nullptr;
unsigned pass_number = 0;
};
bool slang_reflect_spirv(const std::vector<uint32_t> &vertex,
const std::vector<uint32_t> &fragment,
slang_reflection *reflection);
bool slang_reflect(const spirv_cross::Compiler &vertex_compiler, const spirv_cross::Compiler &fragment_compiler,
const spirv_cross::ShaderResources &vertex, const spirv_cross::ShaderResources &fragment,
slang_reflection *reflection);
#endif

View File

@ -802,7 +802,7 @@ static INLINE unsigned font_get_replacement(const char* src, const char* start)
unsigned result = 0;
bool prev_connected = false;
bool next_connected = false;
unsigned char id = (src[0] << 6) | (src[1] & 0x3F);
unsigned char id = ((unsigned char)src[0] << 6) | ((unsigned char)src[1] & 0x3F);
const char* prev1 = src - 2;
const char* prev2 = src - 4;
@ -821,7 +821,7 @@ static INLINE unsigned font_get_replacement(const char* src, const char* start)
unsigned char prev1_id = 0;
if (prev1)
prev1_id = (prev1[0] << 6) | (prev1[1] & 0x3F);
prev1_id = ((unsigned char)prev1[0] << 6) | ((unsigned char)prev1[1] & 0x3F);
if (prev1_id == 0x44)
{
@ -851,7 +851,7 @@ static INLINE unsigned font_get_replacement(const char* src, const char* start)
if ((src[2] & 0xFC) == 0xD8)
{
unsigned char next_id = (src[2] << 6) | (src[3] & 0x3F);
unsigned char next_id = ((unsigned char)src[2] << 6) | ((unsigned char)src[3] & 0x3F);
if (next_id > 0x20 || next_id < 0x50)
next_connected = true;
@ -882,8 +882,13 @@ static char* font_driver_reshape_msg(const char* msg)
{
src--;
while (IS_MBCONT(src))
{
src--;
if (src == (const unsigned char*)msg)
goto end;
}
if (IS_RTL(src) || IS_DIR_NEUTRAL(src))
{
unsigned replacement = font_get_replacement((const char*)src, msg);
@ -945,7 +950,7 @@ static char* font_driver_reshape_msg(const char* msg)
*dst++ = *src++;
}
}
end:
*dst = '\0';
return (char*)buffer;

View File

@ -744,4 +744,3 @@ D3DXConvertMeshSubsetToStrips
#endif /* __cplusplus */
#endif /* __D3DX8MESH_H__ */

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