Merge pull request #76 from libretro/master

update
This commit is contained in:
alphanu1 2018-07-08 18:13:05 +01:00 committed by GitHub
commit 74eacd5a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2590 changed files with 358232 additions and 113838 deletions

View File

@ -5,7 +5,8 @@
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
"${workspaceRoot}",
"${workspaceRoot}/libretro-common/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",

View File

@ -13,7 +13,7 @@
"frontend_driver.h": "c",
"*.in": "c",
"*.rh": "c",
"array": "c"
"array": "c",
},
"C_Cpp.dimInactiveRegions": false,
}

View File

@ -1,18 +1,29 @@
# 1.7.4 (future)
- ANDROID: Add sustained performance mode, can be turned on/off in Power Management settings menu.
- ANDROID: Powerstate/battery level support.
- COMMON: Automatically hide "Configuration Override options" in Quick Menu.
- COMMON: Small Bugfix to not trigger savestate code when pressing Reset.
- HID/OSX: Fix to set hid device registration deterministic (#6497), to address issue #6640 re-adding dynamic device registration.
- LOCALIZATION: Update Italian translation.
- LOCALIZATION: Update Japanese translation.
- LOCALIZATION: Update Polish translation.
- LOCALIZATION: Update Portuguese / Brazilian translation.
- LOCALIZATION: Update Russian translation.
- LOCALIZATION: Update Spanish translation.
- MIDI: Add MIDI support to the libretro API. Dosbox is the first proof of concept core implementing libretro MIDI.
- MIDI: Add a Windows driver for MIDI, based on winmm.
- MENU/QT/WIMP: QT QSlider styling for Dark Theme.
- MENU/QT/WIMP: Remove button ghostly inside highlighting.
- METAL: Initial work-in-progress video driver for Metal. macOS-only right now, and currently requires macOS 10.13.
- METAL: Supports XMB/MaterialUI, has a menu display driver. Has a font rendering driver.
- METAL/SLANG: Slang shaders should be compatible with Metal video driver.
- PS3: Add audio mixer support for FLAC and MP3.
- PSP: Use proper button labels, fix inverted R-Stick Y axis.
- REMAPS: Fix the way offsets are calculated for keyboard remapping.
- RUNAHEAD: Fix full-screen mode change breaking Secondary Core's environment variables.
- VITA: Use proper button labels, fix inverted R-Stick Y axis.
- VULKAN: Fix two validation errors.
- VULKAN: Try to avoid creating swapchains redundantly. Should fix black screen and having to alt tab out of window again to get display working on Nvidia GPUs (Windows).
- VULKAN/OSX: Initial MoltenVK support. Not enabled yet, several MoltenVK bugs should be fixed first before we can have it fully working.
- WII: Change deflicker setting to work in 480p or higher, and always enables vfilter so that the user can easily change brightness.
- WIIU: Fix out-of-bounds rendering bug

View File

@ -264,6 +264,8 @@ OBJ += frontend/frontend.o \
$(LIBRETRO_COMM_DIR)/features/features_cpu.o \
performance_counters.o \
verbosity.o \
midi/midi_driver.o \
midi/drivers/null_midi.o
ifeq ($(HAVE_RUNAHEAD), 1)
DEFINES += -DHAVE_RUNAHEAD
@ -686,6 +688,12 @@ ifeq ($(HAVE_XAUDIO), 1)
LIBS += -lole32
endif
ifeq ($(HAVE_WINMM), 1)
OBJ += midi/drivers/winmm_midi.o
DEFINES += -DHAVE_WINMM
LIBS += -lwinmm
endif
# Audio Resamplers
ifeq ($(HAVE_NEON),1)
@ -1093,11 +1101,16 @@ ifneq ($(C89_BUILD), 1)
ifneq ($(HAVE_OPENGLES), 1)
OBJ += cores/libretro-ffmpeg/ffmpeg_fft.o
DEFINES += -I$(DEPS_DIR) -DHAVE_GL_FFT
NEED_CXX_LINKER=1
endif
endif
endif
ifeq ($(HAVE_MPV), 1)
OBJ += cores/libretro-mpv/mpv-libretro.o
DEFINES += -I$(DEPS_DIR) -DHAVE_MPV
LIBS += -lmpv
endif
ifeq ($(HAVE_OPENGLES), 1)
LIBS += $(OPENGLES_LIBS)
DEFINES += $(OPENGLES_CFLAGS) -DHAVE_OPENGLES
@ -1379,9 +1392,14 @@ ifeq ($(HAVE_GLSLANG), 1)
$(wildcard $(DEPS_DIR)/glslang/glslang/OGLCompilersDLL/*.cpp) \
$(wildcard $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/*.cpp) \
$(wildcard $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent/preprocessor/*.cpp) \
$(wildcard $(DEPS_DIR)/glslang/glslang/hlsl/*.cpp) \
$(wildcard $(DEPS_DIR)/glslang/glslang/glslang/OSDependent/$(GLSLANG_PLATFORM)/*.cpp)
ifneq ($(findstring Win32,$(OS)),)
DEFINES += -DENABLE_HLSL
GLSLANG_SOURCES += $(wildcard $(DEPS_DIR)/glslang/glslang/hlsl/*.cpp)
endif
OBJ += $(GLSLANG_SOURCES:.cpp=.o)
endif
@ -1623,6 +1641,29 @@ ifeq ($(HAVE_NETWORKING), 1)
$(LIBRETRO_COMM_DIR)/utils/md5.o
endif
ifeq ($(HAVE_DISCORD), 1)
DEFINES += -DHAVE_DISCORD
DEFINES += -Ideps/discord-rpc/include/ -Ideps/discord-rpc/thirdparty/rapidjson-1.1.0/include/
OBJ += deps/discord-rpc/src/discord_rpc.o \
deps/discord-rpc/src/rpc_connection.o \
deps/discord-rpc/src/serialization.o \
discord/discord.o
ifneq ($(findstring Win32,$(OS)),)
OBJ += deps/discord-rpc/src/discord_register_win.o \
deps/discord-rpc/src/connection_win.o
LIBS += -lpsapi -ladvapi32
endif
ifneq ($(findstring Linux,$(OS)),)
OBJ += deps/discord-rpc/src/discord_register_linux.o \
deps/discord-rpc/src/connection_unix.o
endif
ifneq ($(findstring Darwin,$(OS)),)
OBJ += deps/discord-rpc/src/discord_register_osx.o \
deps/discord-rpc/src/connection_unix.o
endif
endif
ifeq ($(HAVE_NETWORKGAMEPAD), 1)
OBJ += input/input_remote.o \
cores/libretro-net-retropad/net_retropad_core.o

View File

@ -6,8 +6,8 @@ BUILD_3DSX = 1
BUILD_3DS = 0
BUILD_CIA = 1
APP_TITLE = Retroarch 3DS
APP_DESCRIPTION = Retroarch 3DS
APP_TITLE = RetroArch 3DS
APP_DESCRIPTION = RetroArch 3DS
APP_AUTHOR = Team Libretro
APP_PRODUCT_CODE = RETROARCH-3DS
APP_UNIQUE_ID = 0xBAC00

View File

@ -25,6 +25,7 @@ HAVE_XAUDIO := 1
HAVE_XINPUT := 1
HAVE_WASAPI := 0
HAVE_THREAD_STORAGE := 1
HAVE_WINMM := 1
HAVE_RPNG := 1
HAVE_ZLIB := 1

View File

@ -6,13 +6,13 @@ WHOLE_ARCHIVE_LINK = 0
OBJ :=
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL -DHAVE_DYNAMIC
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_NEON -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
DEFINES += -DHAVE_RUNAHEAD
DEFINES += -DHAVE_RUNAHEAD -DHAVE_DYNAMIC
else
HAVE_CC_RESAMPLER = 1
HAVE_MENU_COMMON = 1
@ -31,6 +31,7 @@ else
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_MENU = 1
HAVE_RUNAHEAD = 1
HAVE_DYNAMIC = 1
include Makefile.common
BLACKLIST :=

View File

@ -118,7 +118,7 @@ endif
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 1
HAVE_BUILTINZLIB = 0
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 1
@ -232,7 +232,7 @@ CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
LDFLAGS += -Wl,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm -lpng -lz
ifneq ($(WANT_LIBFAT), 1)
LIBS += -lfat

View File

@ -18,6 +18,7 @@ HAVE_PYTHON = 0
DYNAMIC = 1
HAVE_XINPUT = 1
HAVE_WINMM = 1
HAVE_SDL := 0
HAVE_SDL2 := 0

View File

@ -27,12 +27,11 @@ interface to include support for emulators and/or game engines. libretro is comp
## Binaries
Latest Windows binaries are currently hosted on the [buildbot](http://buildbot.libretro.com/).
Latest binaries are currently hosted on the [buildbot](http://buildbot.libretro.com/).
## Support
To reach developers, either make an issue here on GitHub, make a thread on the [forum](http://www.libretro.com/forums/),
or visit our IRC channel: #retroarch @ irc.freenode.org.
To reach developers, either make an issue here on GitHub, make a thread on the [forum](http://www.libretro.com/forums/), chat on [Discord](https://discord.gg/C4amCeV), or visit our IRC channel: #retroarch @ irc.freenode.org.
## Documentation
@ -51,13 +50,13 @@ More developer-centric stuff is found [here](https://github.com/libretro/libretr
RetroArch attempts to be small and lean
while still having all the useful core features expected from an emulator.
It is designed to be very portable and features a gamepad-centric UI.
It is designed to be very portable and features a gamepad-centric and touchscreen UI.
It also has a full-featured command-line interface.
In some areas, RetroArch goes beyond and emphasizes on not-so-common technical features such as multi-pass shader support,
real-time rewind (Braid-style), video recording (using FFmpeg), etc.
real-time rewind (Braid-style), video recording (using FFmpeg), run-ahead input latency removal, etc.
RetroArch also emphasizes on being easy to integrate into various launcher frontends.
RetroArch also emphasizes being easy to integrate into various launcher frontends.
## Platforms
@ -66,22 +65,24 @@ RetroArch has been ported to the following platforms:
- DOS
- Windows
- Linux
- Emscripten
- Emscripten (WebAssembly and JavaScript)
- FreeBSD
- NetBSD
- OpenBSD
- Haiku
- Solaris
- MacOS X
- macOS (PPC, x86-32 and x86-64)
- PlayStation 3
- PlayStation Portable
- PlayStation Vita
- Original Microsoft Xbox
- Microsoft Xbox 360 (Libxenon/XeXDK)
- Nintendo Wii, GameCube (Libogc)
- Nintendo GameCube
- Nintendo Wii
- Nintendo Wii U
- Nintendo 3DS
- Nintendo Switch
- Nintendo NES/SNES Classic Edition
- Raspberry Pi
- Android
- iOS
@ -147,9 +148,9 @@ Instructions for compiling and installing RetroArch can be found in the [Libretr
## CRT 15Khz Resolution Switching
CRT Switch res will turn on, on the fly. However, you will need to restart retroarch to disable it. With CRT SwitchRes enable Retroarch will start in 2560 x 480 @ 60.
CRT SwitchRes will turn on, on the fly. However, you will need to restart RetroArch to disable it. With CRT SwitchRes enable RetroArch will start in 2560 x 480 @ 60.
If you are running windows, before enabling the CRT SwitchRes options please make sure you have installed CRTEmudriver and installed some modelines. The minimum modelins for all games to switch correctly are:
If you are running Windows, before enabling the CRT SwitchRes options please make sure you have installed CRTEmudriver and installed some modelines. The minimum modelines for all games to switch correctly are:
- 2560 x 192 @ 60.000000
- 2560 x 200 @ 60.000000
@ -161,7 +162,7 @@ If you are running windows, before enabling the CRT SwitchRes options please mak
- 2560 x 448 @ 60.000000
- 2560 x 480 @ 60.000000
Install these modelines replacing 2560 with your desired super resolution. The above resolutions are NTSC only so if you would be playing any PAL content please add pal modelines:
Install these modelines replacing 2560 with your desired super resolution. The above resolutions are NTSC only so if you would be playing any PAL content please add PAL modelines:
- 2560 x 192 @ 50.000000
- 2560 x 200 @ 50.000000
@ -251,8 +252,8 @@ If native resolutions are activated you will need a whole new set of modelines:
These modelines are more accurate giving exact hz. However, some games may have unwanted results. This is due to mid-scanline resolution changes on the original hardware. For the best results super resolutions are the way to go.
## CRT resolution switching & Mame
## CRT resolution switching & MAME
Some arcade resolutions can be a lot different. There is resolution detection to ensure mame games will be displayed in the closest available resolution but drawn at their native resolution within this resolution. Meaning that the mame game will look just like the original hardware.
Some arcade resolutions can be very different from consumer CRTs. There is resolution detection to ensure MAME games will be displayed in the closest available resolution but drawn at their native resolution within this resolution. Meaning that the MAME game will look just like the original hardware.
Mame roms that run in a vertical aspect like DoDonPachi need to be rotated within mame before resolution switching and aspect correction will work. Do this before enabling CRT switchRes so that Retroarch will run in your desktop resolution. Once you have roted any games that may need it switch CRT SwitchRes on.
MAME ROMs that run in a vertical aspect like DoDonPachi need to be rotated within MAME before resolution switching and aspect correction will work. Do this before enabling CRT SwitchRes so that RetroArch will run in your desktop resolution. Once you have rotated any games that may need it turn CRT SwitchRes on.

View File

@ -1289,62 +1289,31 @@ static int cheevos_test_condition(cheevos_cond_t *cond)
return 1;
}
static int cheevos_test_cond_set(const cheevos_condset_t *condset,
int *dirty_conds, int *reset_conds, int match_any)
static int cheevos_test_pause_cond_set(const cheevos_condset_t *condset,
int *dirty_conds, int *reset_conds, int process_pause)
{
int cond_valid = 0;
int set_valid = 1;
const cheevos_cond_t *end = NULL;
int set_valid = 1; /* must start true so AND logic works */
cheevos_cond_t *cond = NULL;
if (!condset)
return 0;
end = condset->conds + condset->count;
const cheevos_cond_t *end = condset->conds + condset->count;
cheevos_locals.add_buffer = 0;
cheevos_locals.add_hits = 0;
/* Now, read all Pause conditions, and if any are true,
* do not process further (retain old state). */
for (cond = condset->conds; cond < end; cond++)
{
if (cond->type != CHEEVOS_COND_TYPE_PAUSE_IF)
continue;
/* Reset by default, set to 1 if hit! */
cond->curr_hits = 0;
if (cheevos_test_condition(cond))
{
cond->curr_hits = 1;
*dirty_conds = 1;
/* Early out: this achievement is paused,
* do not process any further! */
return 0;
}
}
/* Read all standard conditions, and process as normal: */
for (cond = condset->conds; cond < end; cond++)
{
if ( cond->type == CHEEVOS_COND_TYPE_PAUSE_IF ||
cond->type == CHEEVOS_COND_TYPE_RESET_IF)
if (cond->pause != process_pause)
continue;
if (cond->type == CHEEVOS_COND_TYPE_ADD_SOURCE)
{
cheevos_locals.add_buffer += cheevos_var_get_value(&cond->source);
set_valid &= 1;
continue;
}
if (cond->type == CHEEVOS_COND_TYPE_SUB_SOURCE)
{
cheevos_locals.add_buffer -= cheevos_var_get_value(&cond->source);
set_valid &= 1;
continue;
}
@ -1360,17 +1329,17 @@ static int cheevos_test_cond_set(const cheevos_condset_t *condset,
continue;
}
/* always evaluate the condition to ensure delta values get tracked correctly */
cond_valid = cheevos_test_condition(cond);
/* if the condition has a target hit count that has already been met,
* it's automatically true, even if not currently true. */
if ( (cond->req_hits != 0) &&
(cond->curr_hits + cheevos_locals.add_hits) >= cond->req_hits)
{
cheevos_locals.add_buffer = 0;
cheevos_locals.add_hits = 0;
continue;
cond_valid = 1;
}
cond_valid = cheevos_test_condition(cond);
if (cond_valid)
else if (cond_valid)
{
cond->curr_hits++;
*dirty_conds = 1;
@ -1379,38 +1348,100 @@ static int cheevos_test_cond_set(const cheevos_condset_t *condset,
if (cond->req_hits == 0)
; /* Not a hit-based requirement: ignore any additional logic! */
else if ((cond->curr_hits + cheevos_locals.add_hits) < cond->req_hits)
cond_valid = 0; /* Not entirely valid yet! */
if (match_any)
break;
cond_valid = 0; /* HitCount target has not yet been met, condition is not yet valid. */
}
cheevos_locals.add_buffer = 0;
cheevos_locals.add_hits = 0;
/* Sequential or non-sequential? */
set_valid &= cond_valid;
}
/* Now, ONLY read reset conditions! */
for (cond = condset->conds; cond < end; cond++)
if (cond->type == CHEEVOS_COND_TYPE_PAUSE_IF)
{
if (cond->type != CHEEVOS_COND_TYPE_RESET_IF)
continue;
/* as soon as we find a PauseIf that evaluates to true,
* stop processing the rest of the group. */
if (cond_valid)
return 1;
cond_valid = cheevos_test_condition(cond);
/* if we make it to the end of the function, make sure we are
* indicating nothing matched. if we do find a later PauseIf match,
* it'll automatically return true via the previous condition. */
set_valid = 0;
if (cond->req_hits == 0)
{
/* PauseIf didn't evaluate true, and doesn't have a HitCount,
* reset the HitCount to indicate the condition didn't match. */
if (cond->curr_hits != 0)
{
cond->curr_hits = 0;
*dirty_conds = 1;
}
}
else
{
/* PauseIf has a HitCount that hasn't been met, ignore it for now. */
}
}
else if (cond->type == CHEEVOS_COND_TYPE_RESET_IF)
{
if (cond_valid)
{
*reset_conds = 1; /* Resets all hits found so far */
set_valid = 0; /* Cannot be valid if we've hit a reset condition. */
break; /* No point processing any further reset conditions. */
}
}
else /* Sequential or non-sequential? */
set_valid &= cond_valid;
}
return set_valid;
}
static int cheevos_test_cond_set(const cheevos_condset_t *condset,
int *dirty_conds, int *reset_conds)
{
int in_pause = 0;
int has_pause = 0;
cheevos_cond_t *cond = NULL;
if (!condset)
return 1; /* important: empty group must evaluate true */
/* the ints below are used for Pause conditions and their dependent AddSource/AddHits. */
/* this loop needs to go backwards to check AddSource/AddHits */
cond = condset->conds + condset->count - 1;
for (; cond >= condset->conds; cond--)
{
if (cond->type == CHEEVOS_COND_TYPE_PAUSE_IF)
{
has_pause = 1;
in_pause = 1;
cond->pause = 1;
}
else if (cond->type == CHEEVOS_COND_TYPE_ADD_SOURCE ||
cond->type == CHEEVOS_COND_TYPE_SUB_SOURCE ||
cond->type == CHEEVOS_COND_TYPE_ADD_HITS)
{
cond->pause = in_pause;
}
else
{
in_pause = 0;
cond->pause = 0;
}
}
if (has_pause)
{ /* one or more Pause conditions exists, if any of them are true,
* stop processing this group. */
if (cheevos_test_pause_cond_set(condset, dirty_conds, reset_conds, 1))
return 0;
}
/* process the non-Pause conditions to see if the group is true */
return cheevos_test_pause_cond_set(condset, dirty_conds, reset_conds, 0);
}
static int cheevos_reset_cond_set(cheevos_condset_t *condset, int deltas)
{
int dirty = 0;
@ -1469,14 +1500,14 @@ static int cheevos_test_cheevo(cheevo_t *cheevo)
if (condset < end)
{
ret_val = cheevos_test_cond_set(condset, &dirty_conds, &reset_conds, 0);
ret_val = cheevos_test_cond_set(condset, &dirty_conds, &reset_conds);
condset++;
}
while (condset < end)
{
ret_val_sub_cond |= cheevos_test_cond_set(
condset, &dirty_conds, &reset_conds, 0);
condset, &dirty_conds, &reset_conds);
condset++;
}
@ -1674,14 +1705,14 @@ static int cheevos_test_lboard_condition(const cheevos_condition_t* condition)
if (condset < end)
{
ret_val = cheevos_test_cond_set(
condset, &dirty_conds, &reset_conds, 0);
condset, &dirty_conds, &reset_conds);
condset++;
}
while (condset < end)
{
ret_val_sub_cond |= cheevos_test_cond_set(
condset, &dirty_conds, &reset_conds, 0);
condset, &dirty_conds, &reset_conds);
condset++;
}
@ -2041,7 +2072,7 @@ void cheevos_reset_game(void)
void cheevos_populate_menu(void *data)
{
#ifdef HAVE_MENU
unsigned i;
unsigned i = 0;
unsigned items_found = 0;
settings_t *settings = config_get_ptr();
menu_displaylist_info_t *info = (menu_displaylist_info_t*)data;
@ -2076,7 +2107,6 @@ void cheevos_populate_menu(void *data)
cheevo->description,
MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE,
MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
items_found++;
set_badge_info(&badges_ctx, i, cheevo->badge,
(cheevo->active & CHEEVOS_ACTIVE_HARDCORE));
}
@ -2086,7 +2116,6 @@ void cheevos_populate_menu(void *data)
cheevo->description,
MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY,
MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
items_found++;
set_badge_info(&badges_ctx, i, cheevo->badge,
(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE));
}
@ -2096,10 +2125,10 @@ void cheevos_populate_menu(void *data)
cheevo->description,
MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY,
MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
items_found++;
set_badge_info(&badges_ctx, i, cheevo->badge,
(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE));
}
items_found++;
}
}
@ -2109,7 +2138,7 @@ void cheevos_populate_menu(void *data)
{
end = cheevo + cheevos_locals.unofficial.count;
for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++)
for (i = items_found; cheevo < end; i++, cheevo++)
{
if (!(cheevo->active & CHEEVOS_ACTIVE_HARDCORE))
{
@ -2117,7 +2146,6 @@ void cheevos_populate_menu(void *data)
cheevo->description,
MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY_HARDCORE,
MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
items_found++;
set_badge_info(&badges_ctx, i, cheevo->badge,
(cheevo->active & CHEEVOS_ACTIVE_HARDCORE));
}
@ -2127,7 +2155,6 @@ void cheevos_populate_menu(void *data)
cheevo->description,
MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY,
MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
items_found++;
set_badge_info(&badges_ctx, i, cheevo->badge,
(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE));
}
@ -2137,10 +2164,10 @@ void cheevos_populate_menu(void *data)
cheevo->description,
MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY,
MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
items_found++;
set_badge_info(&badges_ctx, i, cheevo->badge,
(cheevo->active & CHEEVOS_ACTIVE_SOFTCORE));
}
items_found++;
}
}
@ -2170,7 +2197,7 @@ bool cheevos_get_description(cheevos_ctx_desc_t *desc)
if (desc->idx >= cheevos_locals.core.count)
{
cheevos = cheevos_locals.unofficial.cheevos;
desc->idx -= cheevos_locals.unofficial.count;
desc->idx -= cheevos_locals.core.count;
}
if (!string_is_empty(cheevos[desc->idx].description))

View File

@ -47,6 +47,7 @@ typedef struct
cheevos_cond_type_t type;
unsigned req_hits;
unsigned curr_hits;
char pause;
cheevos_var_t source;
cheevos_cond_op_t op;

View File

@ -44,6 +44,12 @@
#include "cheevos/var.h"
#endif
#ifdef HAVE_DISCORD
#include "discord/discord.h"
#endif
#include "midi/midi_driver.h"
#ifdef HAVE_MENU
#include "menu/menu_driver.h"
#include "menu/menu_content.h"
@ -1275,8 +1281,8 @@ static bool command_event_init_core(enum rarch_core_type *data)
if (!core_load(settings->uints.input_poll_type_behavior))
return false;
rarch_ctl(RARCH_CTL_SET_FRAME_LIMIT, NULL);
rarch_ctl(RARCH_CTL_SET_FRAME_LIMIT, NULL);
return true;
}
@ -1740,7 +1746,7 @@ void command_playlist_update_write(
**/
bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = config_get_ptr();
static bool discord_inited = false;
bool boolean = false;
switch (cmd)
@ -1938,7 +1944,6 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_REINIT_FROM_TOGGLE:
retroarch_unset_forced_fullscreen();
case CMD_EVENT_REINIT:
{
video_driver_reinit();
{
const input_driver_t *input_drv = input_get_ptr();
@ -1949,14 +1954,16 @@ bool command_event(enum event_command cmd, void *data)
}
command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, (void*)(intptr_t)-1);
#ifdef HAVE_MENU
{
settings_t *settings = config_get_ptr();
menu_display_set_framebuffer_dirty_flag();
if (settings->bools.video_fullscreen)
video_driver_hide_mouse();
if (menu_driver_is_alive())
command_event(CMD_EVENT_VIDEO_SET_BLOCKING_STATE, NULL);
#endif
}
#endif
break;
case CMD_EVENT_CHEATS_DEINIT:
cheat_manager_state_free();
@ -2035,6 +2042,7 @@ TODO: Add a setting for these tweaks */
command_event_save_auto_state();
break;
case CMD_EVENT_AUDIO_STOP:
midi_driver_set_all_sounds_off();
return audio_driver_stop();
case CMD_EVENT_AUDIO_START:
return audio_driver_start(rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL));
@ -2126,7 +2134,7 @@ TODO: Add a setting for these tweaks */
}
g_defaults.music_history = NULL;
#ifdef HAVE_FFMPEG
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
if (g_defaults.video_history)
{
playlist_write_file(g_defaults.video_history);
@ -2176,7 +2184,7 @@ TODO: Add a setting for these tweaks */
settings->paths.path_content_music_history,
content_history_size);
#ifdef HAVE_FFMPEG
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_video_history);
@ -2508,17 +2516,18 @@ TODO: Add a setting for these tweaks */
/* buf is expected to be address|port */
char *buf = (char *)data;
static struct string_list *hostname = NULL;
settings_t *settings = config_get_ptr();
hostname = string_split(buf, "|");
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435);
? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435))
? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
string_list_free(hostname);
@ -2541,17 +2550,18 @@ TODO: Add a setting for these tweaks */
/* buf is expected to be address|port */
char *buf = (char *)data;
static struct string_list *hostname = NULL;
settings_t *settings = config_get_ptr();
hostname = string_split(buf, "|");
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435);
? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
if (!init_netplay_deferred(hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435))
? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
string_list_free(hostname);
@ -2820,6 +2830,41 @@ TODO: Add a setting for these tweaks */
#if HAVE_LIBUI
extern int libui_main(void);
libui_main();
#endif
break;
case CMD_EVENT_DISCORD_INIT:
#ifdef HAVE_DISCORD
{
settings_t *settings = config_get_ptr();
if (!settings->bools.discord_enable)
return false;
if (discord_inited)
return true;
discord_init();
discord_inited = true;
}
#endif
break;
case CMD_EVENT_DISCORD_DEINIT:
#ifdef HAVE_DISCORD
if (!discord_inited)
return false;
discord_shutdown();
discord_inited = false;
#endif
break;
case CMD_EVENT_DISCORD_UPDATE:
#ifdef HAVE_DISCORD
if (!data || !discord_inited)
return false;
{
discord_userdata_t *userdata = (discord_userdata_t*)data;
discord_update(userdata->status);
}
#endif
break;
case CMD_EVENT_NONE:

View File

@ -231,6 +231,9 @@ enum event_command
CMD_EVENT_DISABLE_OVERRIDES,
CMD_EVENT_RESTORE_REMAPS,
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET,
CMD_EVENT_DISCORD_INIT,
CMD_EVENT_DISCORD_DEINIT,
CMD_EVENT_DISCORD_UPDATE,
CMD_EVENT_LIBUI_TEST
};

View File

@ -277,6 +277,7 @@ static bool menu_show_configurations = true;
static bool menu_show_help = true;
static bool menu_show_quit_retroarch = true;
static bool menu_show_reboot = true;
static bool menu_show_shutdown = true;
#if defined(HAVE_LAKKA) || defined(VITA) || defined(_3DS)
static bool menu_show_core_updater = false;
#else
@ -289,7 +290,7 @@ static bool content_show_favorites = true;
static bool content_show_images = true;
#endif
static bool content_show_music = true;
#ifdef HAVE_FFMPEG
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
static bool content_show_video = true;
#endif
#ifdef HAVE_NETWORKING
@ -661,6 +662,8 @@ static const unsigned input_poll_type_behavior = 2;
static const unsigned input_bind_timeout = 5;
static const unsigned input_bind_hold = 2;
static const unsigned menu_thumbnails_default = 3;
static const unsigned menu_left_thumbnails_default = 0;
@ -689,6 +692,14 @@ static enum resampler_quality audio_resampler_quality_level = RESAMPLER_QUALITY_
static enum resampler_quality audio_resampler_quality_level = RESAMPLER_QUALITY_NORMAL;
#endif
/* MIDI */
static const char *midi_input = "Off";
static const char *midi_output = "Off";
static const unsigned midi_volume = 100;
/* Only applies to Android 7.0 (API 24) and up */
static const bool sustained_performance_mode = false;
#if defined(ANDROID)
#if defined(ANDROID_ARM)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/android/latest/armeabi-v7a/";

View File

@ -80,6 +80,12 @@ static const bool _vulkan_supp = true;
static const bool _vulkan_supp = false;
#endif
#ifdef HAVE_METAL
static const bool _metal_supp = true;
#else
static const bool _metal_supp = false;
#endif
#if defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES2) || defined(HAVE_OPENGLES3) || defined(HAVE_OPENGLES_3_1) || defined(HAVE_OPENGLES_3_2)
static const bool _opengles_supp = true;
#else
@ -272,6 +278,12 @@ static const bool _ffmpeg_supp = true;
static const bool _ffmpeg_supp = false;
#endif
#ifdef HAVE_MPV
static const bool _mpv_supp = true;
#else
static const bool _mpv_supp = false;
#endif
#ifdef HAVE_FREETYPE
static const bool _freetype_supp = true;
#else

View File

@ -52,6 +52,8 @@
#include "tasks/tasks_internal.h"
#include "../list_special.h"
static const char* invalid_filename_chars[] = {
/* https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo */
"~", "#", "%", "&", "*", "{", "}", "\\", ":", "[", "]", "?", "/", "|", "\'", "\"",
@ -281,6 +283,11 @@ enum record_driver_enum
RECORD_NULL
};
enum midi_driver_enum
{
MIDI_WINMM = RECORD_NULL + 1,
MIDI_NULL
};
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(__CELLOS_LV2__)
static enum video_driver_enum VIDEO_DEFAULT_DRIVER = VIDEO_GL;
@ -386,6 +393,12 @@ static enum record_driver_enum RECORD_DEFAULT_DRIVER = RECORD_FFMPEG;
static enum record_driver_enum RECORD_DEFAULT_DRIVER = RECORD_NULL;
#endif
#ifdef HAVE_WINMM
static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_WINMM;
#else
static enum midi_driver_enum MIDI_DEFAULT_DRIVER = MIDI_NULL;
#endif
#if defined(XENON)
static enum input_driver_enum INPUT_DEFAULT_DRIVER = INPUT_XENON360;
#elif defined(_XBOX360) || defined(_XBOX) || defined(HAVE_XINPUT2) || defined(HAVE_XINPUT_XBOX1)
@ -1005,6 +1018,26 @@ const char *config_get_default_menu(void)
return "null";
}
const char *config_get_default_midi(void)
{
enum midi_driver_enum default_driver = MIDI_DEFAULT_DRIVER;
switch (default_driver)
{
case MIDI_WINMM:
return "winmm";
case MIDI_NULL:
break;
}
return "null";
}
const char *config_get_midi_driver_options(void)
{
return char_list_new_special(STRING_LIST_MIDI_DRIVERS, NULL);
}
bool config_overlay_enable_default(void)
{
if (g_defaults.overlay.set)
@ -1046,6 +1079,9 @@ static struct config_array_setting *populate_settings_array(settings_t *settings
SETTING_ARRAY("bundle_assets_dst_path_subdir", settings->arrays.bundle_assets_dst_subdir, false, NULL, true);
SETTING_ARRAY("led_driver", settings->arrays.led_driver, false, NULL, true);
SETTING_ARRAY("netplay_mitm_server", settings->arrays.netplay_mitm_server, false, NULL, true);
SETTING_ARRAY("midi_driver", settings->arrays.midi_driver, false, NULL, true);
SETTING_ARRAY("midi_input", settings->arrays.midi_input, true, midi_input, true);
SETTING_ARRAY("midi_output", settings->arrays.midi_output, true, midi_output, true);
*size = count;
return tmp;
@ -1263,6 +1299,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("video_font_enable", &settings->bools.video_font_enable, true, font_enable, false);
SETTING_BOOL("core_updater_auto_extract_archive", &settings->bools.network_buildbot_auto_extract_archive, true, true, false);
SETTING_BOOL("camera_allow", &settings->bools.camera_allow, true, false, false);
SETTING_BOOL("discord_allow", &settings->bools.discord_enable, true, false, false);
#if defined(VITA)
SETTING_BOOL("input_backtouch_enable", &settings->bools.input_backtouch_enable, false, false, false);
SETTING_BOOL("input_backtouch_toggle", &settings->bools.input_backtouch_toggle, false, false, false);
@ -1308,7 +1345,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("content_show_images", &settings->bools.menu_content_show_images, true, content_show_images, false);
#endif
SETTING_BOOL("content_show_music", &settings->bools.menu_content_show_music, true, content_show_music, false);
#ifdef HAVE_FFMPEG
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
SETTING_BOOL("content_show_video", &settings->bools.menu_content_show_video, true, content_show_video, false);
#endif
#ifdef HAVE_NETWORKING
@ -1329,6 +1366,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("menu_show_help", &settings->bools.menu_show_help, true, menu_show_help, false);
SETTING_BOOL("menu_show_quit_retroarch", &settings->bools.menu_show_quit_retroarch, true, menu_show_quit_retroarch, false);
SETTING_BOOL("menu_show_reboot", &settings->bools.menu_show_reboot, true, menu_show_reboot, false);
SETTING_BOOL("menu_show_shutdown", &settings->bools.menu_show_shutdown, true, menu_show_shutdown, false);
SETTING_BOOL("menu_show_online_updater", &settings->bools.menu_show_online_updater, true, menu_show_online_updater, false);
SETTING_BOOL("menu_show_core_updater", &settings->bools.menu_show_core_updater, true, menu_show_core_updater, false);
SETTING_BOOL("filter_by_current_core", &settings->bools.filter_by_current_core, false, false /* TODO */, false);
@ -1408,6 +1446,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, window_decorations, false);
SETTING_BOOL("sustained_performance_mode", &settings->bools.sustained_performance_mode, true, sustained_performance_mode, false);
*size = count;
return tmp;
@ -1454,6 +1494,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting));
SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false);
SETTING_UINT("input_bind_hold", &settings->uints.input_bind_hold, true, input_bind_hold, 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", input_driver_get_uint(INPUT_ACTION_MAX_USERS), true, input_max_users, false);
@ -1531,6 +1572,8 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("run_ahead_frames", &settings->uints.run_ahead_frames, true, 1, false);
SETTING_UINT("midi_volume", &settings->uints.midi_volume, true, midi_volume, false);
*size = count;
return tmp;
@ -1584,6 +1627,7 @@ static void config_set_defaults(void)
const char *def_led = config_get_default_led();
const char *def_location = config_get_default_location();
const char *def_record = config_get_default_record();
const char *def_midi = config_get_default_midi();
const char *def_mitm = netplay_mitm_server;
struct config_float_setting *float_settings = populate_settings_float (settings, &float_settings_size);
struct config_bool_setting *bool_settings = populate_settings_bool (settings, &bool_settings_size);
@ -1664,6 +1708,9 @@ static void config_set_defaults(void)
if (def_record)
strlcpy(settings->arrays.record_driver,
def_record, sizeof(settings->arrays.record_driver));
if (def_midi)
strlcpy(settings->arrays.midi_driver,
def_midi, sizeof(settings->arrays.midi_driver));
if (def_mitm)
strlcpy(settings->arrays.netplay_mitm_server,
def_mitm, sizeof(settings->arrays.netplay_mitm_server));
@ -1681,7 +1728,7 @@ static void config_set_defaults(void)
#endif
#endif
#ifdef HAVE_FFMPEG
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
configuration_set_bool(settings, settings->bools.multimedia_builtin_mediaplayer_enable, true);
#else
configuration_set_bool(settings, settings->bools.multimedia_builtin_mediaplayer_enable, false);
@ -1981,6 +2028,13 @@ static void config_set_defaults(void)
free(temp_str);
}
if (midi_input)
strlcpy(settings->arrays.midi_input,
midi_input, sizeof(settings->arrays.midi_input));
if (midi_output)
strlcpy(settings->arrays.midi_output,
midi_output, sizeof(settings->arrays.midi_output));
/* Avoid reloading config on every content load */
if (default_block_config_read)
rarch_ctl(RARCH_CTL_SET_BLOCK_CONFIG_READ, NULL);
@ -2892,7 +2946,9 @@ static bool config_load_file(const char *path, bool set_defaults,
settings->paths.path_shader[0] = '\0';
break;
}
}
}
frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode);
ret = true;

View File

@ -149,6 +149,7 @@ typedef struct settings
bool menu_show_help;
bool menu_show_quit_retroarch;
bool menu_show_reboot;
bool menu_show_shutdown;
bool menu_show_latency;
bool menu_show_rewind;
bool menu_show_overlays;
@ -230,6 +231,7 @@ typedef struct settings
bool bundle_assets_extract_enable;
/* Misc. */
bool discord_enable;
bool threaded_data_runloop_enable;
bool set_supports_no_game_enable;
bool auto_screenshot_filename;
@ -274,6 +276,8 @@ typedef struct settings
bool automatically_add_content_to_playlist;
bool video_window_show_decorations;
bool sustained_performance_mode;
} bools;
struct
@ -329,6 +333,7 @@ typedef struct settings
unsigned input_turbo_duty_cycle;
unsigned input_bind_timeout;
unsigned input_bind_hold;
unsigned input_menu_toggle_gamepad_combo;
unsigned input_keyboard_gamepad_mapping_type;
@ -402,6 +407,8 @@ typedef struct settings
unsigned led_map[MAX_LEDS];
unsigned run_ahead_frames;
unsigned midi_volume;
} uints;
struct
@ -423,6 +430,7 @@ typedef struct settings
char audio_resampler[32];
char input_driver[32];
char input_joypad_driver[32];
char midi_driver[32];
char input_keyboard_layout[64];
@ -436,6 +444,9 @@ typedef struct settings
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
char netplay_mitm_server[255];
char midi_input[32];
char midi_output[32];
} arrays;
struct
@ -582,6 +593,9 @@ const char *config_get_default_joypad(void);
**/
const char *config_get_default_menu(void);
const char *config_get_default_midi(void);
const char *config_get_midi_driver_options(void);
const char *config_get_default_record(void);
/**

View File

@ -290,6 +290,8 @@ bool core_load_game(retro_ctx_load_content_info_t *load_info)
bool contentless = false;
bool is_inited = false;
video_driver_set_cached_frame_ptr(NULL);
#ifdef HAVE_RUNAHEAD
set_load_content_info(load_info);
clear_controller_port_map();
@ -373,12 +375,16 @@ bool core_get_system_av_info(struct retro_system_av_info *av_info)
bool core_reset(void)
{
video_driver_set_cached_frame_ptr(NULL);
current_core.retro_reset();
return true;
}
bool core_init(void)
{
video_driver_set_cached_frame_ptr(NULL);
current_core.retro_init();
current_core.inited = true;
return true;
@ -386,6 +392,8 @@ bool core_init(void)
bool core_unload(void)
{
video_driver_set_cached_frame_ptr(NULL);
current_core.retro_deinit();
return true;
}
@ -396,9 +404,12 @@ bool core_unload_game(void)
video_driver_free_hw_context();
audio_driver_stop();
video_driver_set_cached_frame_ptr(NULL);
current_core.retro_unload_game();
current_core.game_loaded = false;
return true;
}

View File

@ -21,6 +21,7 @@ enum rarch_core_type
CORE_TYPE_PLAIN = 0,
CORE_TYPE_DUMMY,
CORE_TYPE_FFMPEG,
CORE_TYPE_MPV,
CORE_TYPE_IMAGEVIEWER,
CORE_TYPE_NETRETROPAD,
CORE_TYPE_VIDEO_PROCESSOR

View File

@ -136,6 +136,62 @@ size_t libretro_ffmpeg_retro_get_memory_size(unsigned id);
#endif
#ifdef HAVE_MPV
/* Internal mpv core. */
void libretro_mpv_retro_init(void);
void libretro_mpv_retro_deinit(void);
unsigned libretro_mpv_retro_api_version(void);
void libretro_mpv_retro_get_system_info(struct retro_system_info *info);
void libretro_mpv_retro_get_system_av_info(struct retro_system_av_info *info);
void libretro_mpv_retro_set_environment(retro_environment_t cb);
void libretro_mpv_retro_set_video_refresh(retro_video_refresh_t cb);
void libretro_mpv_retro_set_audio_sample(retro_audio_sample_t cb);
void libretro_mpv_retro_set_audio_sample_batch(retro_audio_sample_batch_t cb);
void libretro_mpv_retro_set_input_poll(retro_input_poll_t cb);
void libretro_mpv_retro_set_input_state(retro_input_state_t cb);
void libretro_mpv_retro_set_controller_port_device(unsigned port, unsigned device);
void libretro_mpv_retro_reset(void);
void libretro_mpv_retro_run(void);
size_t libretro_mpv_retro_serialize_size(void);
bool libretro_mpv_retro_serialize(void *data, size_t size);
bool libretro_mpv_retro_unserialize(const void *data, size_t size);
void libretro_mpv_retro_cheat_reset(void);
void libretro_mpv_retro_cheat_set(unsigned index, bool enabled, const char *code);
bool libretro_mpv_retro_load_game(const struct retro_game_info *game);
bool libretro_mpv_retro_load_game_special(unsigned game_type,
const struct retro_game_info *info, size_t num_info);
void libretro_mpv_retro_unload_game(void);
unsigned libretro_mpv_retro_get_region(void);
void *libretro_mpv_retro_get_memory_data(unsigned id);
size_t libretro_mpv_retro_get_memory_size(unsigned id);
#endif
#ifdef HAVE_IMAGEVIEWER
/* Internal image viewer core. */

View File

@ -114,7 +114,7 @@ endif
CFLAGS += -I../../libretro-common/include
OBJECTS := mpv-libretro.o
LDFLAGS += -lmpv -ldl -lm
LDFLAGS += -lmpv -lm
CFLAGS += -Wall -pedantic
all: $(TARGET)

View File

@ -1,17 +1,46 @@
# libretro-mpv
mpv media player as a libretro core. A proof of concept release is now available.
mpv media player as a libretro core. A proof of concept release is now
available.
Aims to use features already established in mpv that are not currently available in Retroarch movieplayer.
Aims to use features already established in mpv that are not currently
available in Retroarch movieplayer.
I want to be able to use Retroarch as my movie player on my embedded devices (Raspberry Pi) and desktop using hardware acceleration without having to use Kodi or mpv directly. Thus allowing for a more integrated experience, and smaller root filesystem.
I want to be able to use Retroarch as my movie player on my embedded devices
(Raspberry Pi) and desktop using hardware acceleration without having to use
Kodi or mpv directly. Thus allowing for a more integrated experience, and
smaller root filesystem.
## Compiling
Retroarch must be compiled with `--disable-ffmpeg` to stop the integrated movieplayer from playing the input file.
### Overview
Retroarch must be compiled with `--disable-ffmpeg` to stop the integrated
movieplayer from playing the input file.
FFmpeg (preferably master branch) must be compiled with `--enable-shared`.
mpv must be compiled with `--enable-libmpv-shared`.
Then run `make` in the mpv-libretro folder.
### Compiling with Mingw-w64 on Windows
RetroArch must be compiled with `--disable-ffmpeg` and have OpenGL or
OpenGLES enabled. Compiling RetroArch is not described here.
1. Open `Minwg-w64 64 bit` (not MSYS2 shell).
2. Install ffmpeg using `pacman -S mingw64/mingw-w64-x86_64-ffmpeg`.
3. Clone the ao_cb branch of https://github.com/deltabeard/mpv.git . This fork has the audio
callback patches required for libretro-mpv.
4. Follow the instructions at https://github.com/mpv-player/mpv/blob/master/DOCS/compile-windows.md#native-compilation-with-msys2 to compile mpv.
5. Download libretro-mpv release 0.3.alpha by either checking out the
`audio-cb-new` branch of `https://github.com/libretro/libretro-mpv.git` or
by downloading
https://github.com/libretro/libretro-mpv/archive/0.3.alpha.tar.gz .
6. Run `make` in the libretro-mpv folder. If using OpenGLES, run `make
platform=gles` instead.
Overall, the dependencies required to build libretro-mpv are:
- ffmpeg 4.0 (provided by mingw64/mingw-w64-x86_64-ffmpeg)
- mpv from https://github.com/deltabeard/mpv.git fork.

View File

@ -0,0 +1 @@
#include "../internal_cores.h"

View File

@ -20,20 +20,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_OPENGLES
#include <dlfcn.h>
#endif
#ifdef HAVE_LOCALE
#include <locale.h>
#endif
#include <mpv/client.h>
#include <mpv/opengl_cb.h>
#include <mpv/render_gl.h>
#include <libretro.h>
#ifdef RARCH_INTERNAL
#include "internal_cores.h"
#define CORE_PREFIX(s) libretro_mpv_##s
#else
#define CORE_PREFIX(s) s
#endif
#include "version.h"
static struct retro_hw_render_callback hw_render;
@ -41,28 +43,25 @@ static struct retro_hw_render_callback hw_render;
static struct retro_log_callback logging;
static retro_log_printf_t log_cb;
static retro_video_refresh_t video_cb;
static retro_audio_sample_t audio_cb;
static retro_audio_sample_batch_t audio_batch_cb;
static retro_environment_t environ_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
static retro_video_refresh_t CORE_PREFIX(video_cb);
static retro_audio_sample_t CORE_PREFIX(audio_cb);
static retro_audio_sample_batch_t CORE_PREFIX(audio_batch_cb);
static retro_environment_t CORE_PREFIX(environ_cb);
static retro_input_poll_t CORE_PREFIX(input_poll_cb);
static retro_input_state_t CORE_PREFIX(input_state_cb);
static mpv_handle *mpv;
static mpv_opengl_cb_context *mpv_gl;
/* Keep track of the number of events in mpv queue */
static unsigned int event_waiting = 0;
static mpv_render_context *mpv_gl;
/* Save the current playback time for context changes */
static int64_t *playback_time = 0;
static int64_t playback_time = 0;
/* filepath required globaly as mpv is reopened on context change */
static char *filepath = NULL;
static volatile int frame_queue = 0;
void queue_new_frame(void *cb_ctx)
void on_mpv_redraw(void *cb_ctx)
{
frame_queue++;
}
@ -76,17 +75,24 @@ static void fallback_log(enum retro_log_level level, const char *fmt, ...)
va_end(va);
}
static void print_mpv_logs(void)
/**
* Process various events triggered by mpv, such as printing log messages.
*
* \param event_block Wait until the mpv triggers specified event. Should be
* NULL if no wait is required.
*/
static void process_mpv_events(mpv_event_id event_block)
{
/* Print out mpv logs */
if(event_waiting > 0)
{
while(1)
do
{
mpv_event *mp_event = mpv_wait_event(mpv, 0);
if(mp_event->event_id == MPV_EVENT_NONE)
if(event_block == MPV_EVENT_NONE &&
mp_event->event_id == MPV_EVENT_NONE)
break;
if(mp_event->event_id == event_block)
event_block = MPV_EVENT_NONE;
if(mp_event->event_id == MPV_EVENT_LOG_MESSAGE)
{
struct mpv_event_log_message *msg =
@ -100,7 +106,7 @@ static void print_mpv_logs(void)
(struct mpv_event_end_file *)mp_event->data;
if(eof->reason == MPV_END_FILE_REASON_EOF)
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
#if 0
/* The following could be done instead if the file was not
* closed once the end was reached - allowing the user to seek
@ -110,18 +116,18 @@ static void print_mpv_logs(void)
"Finished playing file", 60 * 5, /* 5 seconds */
};
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &ra_msg);RETRO_ENVIRONMENT_SHUTDOWN
CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_MESSAGE, &ra_msg);RETRO_ENVIRONMENT_SHUTDOWN
#endif
}
else if(mp_event->event_id == MPV_EVENT_NONE)
continue;
else
{
log_cb(RETRO_LOG_INFO, "mpv: %s\n",
mpv_event_name(mp_event->event_id));
}
}
event_waiting = 0;
}
while(1);
}
static void *get_proc_address_mpv(void *fn_ctx, const char *name)
@ -134,58 +140,38 @@ static void *get_proc_address_mpv(void *fn_ctx, const char *name)
void *proc_addr = (void *) hw_render.get_proc_address(name);
#pragma GCC diagnostic pop
#ifdef HAVE_OPENGLES
/* EGL 1.4 (supported by the RPI firmware) does not necessarily return
* function pointers for core functions.
*/
if (!proc_addr)
{
void *h = dlopen("/opt/vc/lib/libGLESv2.so", RTLD_LAZY);
if (!h)
h = dlopen("/usr/lib/libGLESv2.so", RTLD_LAZY);
if (h)
{
proc_addr = dlsym(h, name);
dlclose(h);
}
}
#endif
if(proc_addr == NULL)
log_cb(RETRO_LOG_ERROR, "Failure obtaining %s proc address\n", name);
return proc_addr;
}
static void on_mpv_events(void *mpv)
void CORE_PREFIX(retro_init)(void)
{
event_waiting++;
}
if(mpv_client_api_version() != MPV_CLIENT_API_VERSION)
{
log_cb(RETRO_LOG_WARN, "libmpv version mismatch. Please update or "
"recompile mpv-libretro after updating libmpv.");
}
void retro_init(void)
{
return;
}
void retro_deinit(void)
{
return;
}
void CORE_PREFIX(retro_deinit)(void)
{}
unsigned retro_api_version(void)
unsigned CORE_PREFIX(retro_api_version)(void)
{
return RETRO_API_VERSION;
}
void retro_set_controller_port_device(unsigned port, unsigned device)
void CORE_PREFIX(retro_set_controller_port_device)(unsigned port, unsigned device)
{
log_cb(RETRO_LOG_INFO, "Plugging device %u into port %u.\n", device, port);
return;
}
void retro_get_system_info(struct retro_system_info *info)
void CORE_PREFIX(retro_get_system_info)(struct retro_system_info *info)
{
memset(info, 0, sizeof(*info));
info->library_name = "mpv";
@ -206,18 +192,19 @@ void retro_get_system_info(struct retro_system_info *info)
"vtt|wav|wsd|xl|xm|xmgz|xmr|xmv|xmz|xvag|y4m|yop|yuv|yuv10";
}
void retro_get_system_av_info(struct retro_system_av_info *info)
void CORE_PREFIX(retro_get_system_av_info)(struct retro_system_av_info *info)
{
float sampling_rate = 48000.0f;
#if 0
struct retro_variable var = { .key = "test_aspect" };
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
var.key = "test_samplerate";
if(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
if(CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
sampling_rate = strtof(var.value, NULL);
#endif
info->timing = (struct retro_system_timing) {
.fps = 60.0,
.sample_rate = sampling_rate,
@ -235,15 +222,17 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
};
}
void retro_set_environment(retro_environment_t cb)
void CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
{
environ_cb = cb;
CORE_PREFIX(environ_cb) = cb;
static const struct retro_variable vars[] = {
{ "test_samplerate", "Sample Rate; 48000|30000|20000" },
#if 0
{ "test_samplerate", "Sample Rate; 48000" },
{ "test_opt0", "Test option #0; false|true" },
{ "test_opt1", "Test option #1; 0" },
{ "test_opt2", "Test option #2; 0|1|foo|3" },
#endif
{ NULL, NULL },
};
@ -258,6 +247,7 @@ void retro_set_environment(retro_environment_t cb)
static void context_reset(void)
{
const char *cmd[] = {"loadfile", filepath, NULL};
int ret;
#ifdef HAVE_LOCALE
setlocale(LC_NUMERIC, "C");
@ -265,66 +255,68 @@ static void context_reset(void)
mpv = mpv_create();
if(mpv == NULL)
if(!mpv)
{
log_cb(RETRO_LOG_ERROR, "failed creating context\n");
exit(EXIT_FAILURE);
}
if(mpv_initialize(mpv) < 0)
if((ret = mpv_initialize(mpv)) < 0)
{
log_cb(RETRO_LOG_ERROR, "mpv init failed\n");
log_cb(RETRO_LOG_ERROR, "mpv init failed: %s\n", mpv_error_string(ret));
exit(EXIT_FAILURE);
}
/* When normal mpv events are available. */
mpv_set_wakeup_callback(mpv, on_mpv_events, NULL);
if(mpv_request_log_messages(mpv, "v") < 0)
log_cb(RETRO_LOG_ERROR, "mpv logging failed\n");
/* The OpenGL API is somewhat separate from the normal mpv API. This only
* returns NULL if no OpenGL support is compiled.
*/
mpv_gl = mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
if(mpv_gl == NULL)
if((ret = mpv_request_log_messages(mpv, "v")) < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to create mpv GL API handle\n");
log_cb(RETRO_LOG_ERROR, "mpv logging failed: %s\n",
mpv_error_string(ret));
}
mpv_render_param params[] = {
{MPV_RENDER_PARAM_API_TYPE, MPV_RENDER_API_TYPE_OPENGL},
{MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &(mpv_opengl_init_params){
.get_proc_address = get_proc_address_mpv,
}},
{0}
};
if((ret = mpv_render_context_create(&mpv_gl, mpv, params)) < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to initialize mpv GL context: %s\n",
mpv_error_string(ret));
goto err;
}
if(mpv_opengl_cb_init_gl(mpv_gl, NULL, get_proc_address_mpv, NULL) < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to initialize mpv GL context\n");
goto err;
}
mpv_render_context_set_update_callback(mpv_gl, on_mpv_redraw, NULL);
/* Actually using the opengl_cb state has to be explicitly requested.
* Otherwise, mpv will create a separate platform window.
*/
if(mpv_set_option_string(mpv, "vo", "opengl-cb") < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to set video output to OpenGL\n");
goto err;
}
mpv_opengl_cb_set_update_callback(mpv_gl, queue_new_frame, NULL);
mpv_set_option_string(mpv, "ao", "audio-cb");
mpv_set_option_string(mpv, "ao", "libmpv");
/* Attempt to enable hardware acceleration. MPV will fallback to software
* decoding on failure.
*/
if(mpv_set_option_string(mpv, "hwdec", "auto") < 0)
log_cb(RETRO_LOG_ERROR, "failed to set hwdec option\n");
if(mpv_command(mpv, cmd) != 0)
if((ret = mpv_set_option_string(mpv, "hwdec", "auto")) < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to issue mpv_command to load file\n");
log_cb(RETRO_LOG_ERROR, "failed to set hwdec option: %s\n",
mpv_error_string(ret));
}
if((ret = mpv_command(mpv, cmd)) != 0)
{
log_cb(RETRO_LOG_ERROR, "mpv_command failed to load input file: %s\n",
mpv_error_string(ret));
goto err;
}
/* TODO #2: Check for the highest samplerate in audio stream, and use that.
* Fall back to 48kHz otherwise.
* We currently force the audio to be sampled at 48KHz.
*/
mpv_set_option_string(mpv, "af", "format=s16:48000:stereo");
//mpv_set_option_string(mpv, "opengl-swapinterval", "0");
/* Process any events whilst we wait for playback to begin. */
process_mpv_events(MPV_EVENT_NONE);
/* Keep trying until mpv accepts the property. This is done to seek to the
* point in the file after the previous context was destroyed. If no
@ -332,20 +324,14 @@ static void context_reset(void)
*
* This also seems to fix some black screen issues.
*/
if(playback_time != 0)
{
process_mpv_events(MPV_EVENT_PLAYBACK_RESTART);
while(mpv_set_property(mpv,
"playback-time", MPV_FORMAT_INT64, &playback_time) < 0)
{
/* Garbage fix to overflowing log */
usleep(10);
{}
}
/* TODO #2: Check for the highest samplerate in audio stream, and use that.
* Fall back to 48kHz otherwise.
* We currently force the audio to be sampled at 48KHz.
*/
mpv_set_option_string(mpv, "audio-samplerate", "48000");
mpv_set_option_string(mpv, "opengl-swapinterval", "0");
/* The following works best when vsync is switched off in Retroarch. */
//mpv_set_option_string(mpv, "video-sync", "display-resample");
//mpv_set_option_string(mpv, "display-fps", "60");
@ -356,14 +342,14 @@ static void context_reset(void)
err:
/* Print mpv logs to see why mpv failed. */
print_mpv_logs();
process_mpv_events(MPV_EVENT_NONE);
exit(EXIT_FAILURE);
}
static void context_destroy(void)
{
mpv_get_property(mpv, "playback-time", MPV_FORMAT_INT64, &playback_time);
mpv_opengl_cb_uninit_gl(mpv_gl);
mpv_render_context_free(mpv_gl);
mpv_terminate_destroy(mpv);
log_cb(RETRO_LOG_INFO, "Context destroyed.\n");
}
@ -378,60 +364,77 @@ static bool retro_init_hw_context(void)
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
if (!CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
return false;
return true;
}
void retro_set_audio_sample(retro_audio_sample_t cb)
void CORE_PREFIX(retro_set_audio_sample)(retro_audio_sample_t cb)
{
audio_cb = cb;
CORE_PREFIX(audio_cb) = cb;
}
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
void CORE_PREFIX(retro_set_audio_sample_batch)(retro_audio_sample_batch_t cb)
{
audio_batch_cb = cb;
CORE_PREFIX(audio_batch_cb) = cb;
}
void retro_set_input_poll(retro_input_poll_t cb)
void CORE_PREFIX(retro_set_input_poll)(retro_input_poll_t cb)
{
input_poll_cb = cb;
CORE_PREFIX(input_poll_cb) = cb;
}
void retro_set_input_state(retro_input_state_t cb)
void CORE_PREFIX(retro_set_input_state)(retro_input_state_t cb)
{
input_state_cb = cb;
CORE_PREFIX(input_state_cb) = cb;
}
void retro_set_video_refresh(retro_video_refresh_t cb)
void CORE_PREFIX(retro_set_video_refresh)(retro_video_refresh_t cb)
{
video_cb = cb;
CORE_PREFIX(video_cb) = cb;
}
void retro_reset(void)
void CORE_PREFIX(retro_reset)(void)
{
return;
}
static void audio_callback(double fps)
{
/* Obtain len samples to reduce lag. */
int len = 48000 / (int)floor(fps);
static int16_t frames[512];
const unsigned int buff_len = 1024;
uint8_t buff[buff_len];
while(len > 0)
if(len < 4)
len = 4;
do
{
int mpv_len = mpv_audio_callback(&frames, len > 512 ? 512*2 : len*2);
//printf("mpv cb: %d\n", mpv_len);
if(mpv_len < 1)
len = len - (len % 4);
int ret = mpv_audio_callback(mpv, &buff,
len > buff_len ? buff_len : len);
if(ret < 0)
{
#if 0
log_cb(RETRO_LOG_ERROR, "mpv encountered an error in audio "
"callback: %d.\n", ret);
#endif
return;
}
/* mpv may refuse to buffer audio if the first video frame has not
* displayed yet. */
if(ret == 0)
return;
len -= mpv_len;
len -= ret;
//printf("acb: %lu\n", audio_batch_cb(frames, mpv_len));
audio_batch_cb(frames, mpv_len);
CORE_PREFIX(audio_batch_cb)((const int16_t*)buff, ret);
}
while(len > 4);
}
static void retropad_update_input(void)
@ -445,7 +448,7 @@ static void retropad_update_input(void)
struct Input current;
static struct Input last;
input_poll_cb();
CORE_PREFIX(input_poll_cb)();
/* Commands that are called on rising edge only */
@ -456,11 +459,11 @@ static void retropad_update_input(void)
* Unsure if saving the memory is worth the extra checks, costing CPU time,
* but both are incredibly miniscule anyway.
*/
current.l = input_state_cb(0, RETRO_DEVICE_JOYPAD,
current.l = CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD,
0, RETRO_DEVICE_ID_JOYPAD_L) != 0 ? 1 : 0;
current.r = input_state_cb(0, RETRO_DEVICE_JOYPAD,
current.r = CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD,
0, RETRO_DEVICE_ID_JOYPAD_R) != 0 ? 1 : 0;
current.a = input_state_cb(0, RETRO_DEVICE_JOYPAD,
current.a = CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD,
0, RETRO_DEVICE_ID_JOYPAD_A) != 0 ? 1 : 0;
if(current.l == 1 && last.l == 0)
@ -473,24 +476,24 @@ static void retropad_update_input(void)
mpv_command_string(mpv, "cycle pause");
/* TODO #3: Press and hold commands with small delay */
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
if (CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_LEFT))
mpv_command_string(mpv, "seek -5");
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
if (CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_RIGHT))
mpv_command_string(mpv, "seek 5");
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
if (CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_UP))
mpv_command_string(mpv, "seek 60");
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
if (CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_DOWN))
mpv_command_string(mpv, "seek -60");
/* Press and hold commands */
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
if (CORE_PREFIX(input_state_cb)(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_X))
mpv_command_string(mpv, "show-progress");
@ -502,7 +505,7 @@ static void retropad_update_input(void)
last.a = current.a;
}
void retro_run(void)
void CORE_PREFIX(retro_run)(void)
{
/* We only need to update the base video size once, and we do it here since
* the input file is not processed during the first
@ -546,51 +549,60 @@ void retro_run(void)
};
if(width > 0 && height > 0)
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &av_info);
CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &av_info);
updated_video_dimensions = true;
}
print_mpv_logs();
retropad_update_input();
/* TODO #2: Implement an audio callback feature in to libmpv */
audio_callback(container_fps);
process_mpv_events(MPV_EVENT_NONE);
#if 1
if(frame_queue > 0)
{
mpv_opengl_cb_draw(mpv_gl, hw_render.get_current_framebuffer(), width, height);
video_cb(RETRO_HW_FRAME_BUFFER_VALID, width, height, 0);
mpv_render_param params[] = {
{MPV_RENDER_PARAM_OPENGL_FBO, &(mpv_opengl_fbo){
.fbo = hw_render.get_current_framebuffer(),
.w = width,
.h = height,
}},
{0}
};
mpv_render_context_render(mpv_gl, params);
CORE_PREFIX(video_cb)(RETRO_HW_FRAME_BUFFER_VALID, width, height, 0);
frame_queue--;
}
else
video_cb(NULL, width, height, 0);
CORE_PREFIX(video_cb)(NULL, width, height, 0);
#else
mpv_opengl_cb_draw(mpv_gl, hw_render.get_current_framebuffer(), width, height);
video_cb(RETRO_HW_FRAME_BUFFER_VALID, width, height, 0);
CORE_PREFIX(video_cb)(RETRO_HW_FRAME_BUFFER_VALID, width, height, 0);
#endif
return;
}
/* No save-state support */
size_t retro_serialize_size(void)
size_t CORE_PREFIX(retro_serialize_size)(void)
{
return 0;
}
bool retro_serialize(void *data_, size_t size)
bool CORE_PREFIX(retro_serialize)(void *data_, size_t size)
{
return true;
}
bool retro_unserialize(const void *data_, size_t size)
bool CORE_PREFIX(retro_unserialize)(const void *data_, size_t size)
{
return true;
}
bool retro_load_game(const struct retro_game_info *info)
bool CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
{
/* Supported on most systems. */
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
@ -607,21 +619,30 @@ bool retro_load_game(const struct retro_game_info *info)
{ 0 },
};
if(info->path == NULL)
return false;
/* Copy the file path to a global variable as we need it in context_reset()
* where mpv is initialised.
*/
filepath = strdup(info->path);
if((filepath = malloc(strlen(info->path)+1)) == NULL)
{
log_cb(RETRO_LOG_ERROR, "Unable to allocate memory for filepath\n");
return false;
}
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
strcpy(filepath,info->path);
CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
/* Not bothered if this fails. Assuming the default is selected anyway. */
if(environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt) == false)
if(CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt) == false)
{
log_cb(RETRO_LOG_ERROR, "XRGB8888 is not supported.\n");
/* Try RGB565 */
fmt = RETRO_PIXEL_FORMAT_RGB565;
environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt);
CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt);
}
if(retro_init_hw_context() == false)
@ -633,41 +654,39 @@ bool retro_load_game(const struct retro_game_info *info)
return true;
}
bool retro_load_game_special(unsigned type, const struct retro_game_info *info,
bool CORE_PREFIX(retro_load_game_special)(unsigned type, const struct retro_game_info *info,
size_t num)
{
return false;
}
void retro_unload_game(void)
void CORE_PREFIX(retro_unload_game)(void)
{
free(filepath);
filepath = NULL;
return;
}
unsigned retro_get_region(void)
unsigned CORE_PREFIX(retro_get_region)(void)
{
return RETRO_REGION_NTSC;
}
void *retro_get_memory_data(unsigned id)
void *CORE_PREFIX(retro_get_memory_data)(unsigned id)
{
return NULL;
}
size_t retro_get_memory_size(unsigned id)
size_t CORE_PREFIX(retro_get_memory_size)(unsigned id)
{
return 0;
}
void retro_cheat_reset(void)
{
return;
}
void CORE_PREFIX(retro_cheat_reset)(void)
{}
void retro_cheat_set(unsigned index, bool enabled, const char *code)
void CORE_PREFIX(retro_cheat_set)(unsigned index, bool enabled, const char *code)
{
return;
(void)index;
(void)enabled;
(void)code;
}

View File

@ -1,3 +1,3 @@
#ifndef LIBRETRO_MPV_VERSION
#define LIBRETRO_MPV_VERSION "0.2.alpha"
#define LIBRETRO_MPV_VERSION "0.3.alpha"
#endif

View File

@ -107,7 +107,7 @@ struct defaults
playlist_t *image_history;
#endif
playlist_t *music_history;
#ifdef HAVE_FFMPEG
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
playlist_t *video_history;
#endif
#endif

View File

@ -2,32 +2,17 @@ language: cpp
os:
- linux
- osx
osx_image: xcode8.3
osx_image: xcode9.3beta
# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
sudo: required
dist: trusty
# We check out glslang and SPIRV-Tools at specific revisions to avoid test output mismatches
env:
- GLSLANG_REV=9c6f8cc29ba303b43ccf36deea6bb38a304f9b92 SPIRV_TOOLS_REV=e28edd458b729da7bbfd51e375feb33103709e6f
before_script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python3; fi
- git clone https://github.com/KhronosGroup/glslang.git glslang
- git clone https://github.com/KhronosGroup/SPIRV-Tools SPIRV-Tools
- git clone https://github.com/KhronosGroup/SPIRV-Headers.git SPIRV-Tools/external/spirv-headers
- ./checkout_glslang_spirv_tools.sh
script:
- git -C glslang checkout $GLSLANG_REV
- git -C SPIRV-Tools checkout $SPIRV_TOOLS_REV
- cd glslang && cmake . && make -j2 && cd ..
- cd SPIRV-Tools && cmake . && make -j2 && cd ..
- ./build_glslang_spirv_tools.sh Debug 2
- make -j2
- PATH=./glslang/StandAlone:./SPIRV-Tools/tools:$PATH
- ./test_shaders.py shaders
- ./test_shaders.py --msl shaders-msl
- ./test_shaders.py --hlsl shaders-hlsl
- ./test_shaders.py shaders --opt
- ./test_shaders.py --msl shaders-msl --opt
- ./test_shaders.py --hlsl shaders-hlsl --opt
- ./test_shaders.sh

View File

@ -93,6 +93,10 @@ spirv_cross_add_library(spirv-cross-cpp spirv_cross_cpp STATIC
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_cpp.cpp)
spirv_cross_add_library(spirv-cross-reflect spirv_cross_reflect STATIC
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_reflect.cpp)
spirv_cross_add_library(spirv-cross-msl spirv_cross_msl STATIC
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/spirv_msl.cpp)
@ -110,7 +114,7 @@ target_compile_options(spirv-cross PRIVATE ${spirv-compiler-options})
target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines})
install(TARGETS spirv-cross RUNTIME DESTINATION bin)
target_link_libraries(spirv-cross spirv-cross-glsl spirv-cross-hlsl spirv-cross-cpp spirv-cross-msl spirv-cross-util spirv-cross-core)
target_link_libraries(spirv-cross spirv-cross-glsl spirv-cross-hlsl spirv-cross-cpp spirv-cross-reflect spirv-cross-msl spirv-cross-util spirv-cross-core)
target_link_libraries(spirv-cross-util spirv-cross-core)
target_link_libraries(spirv-cross-glsl spirv-cross-core)
target_link_libraries(spirv-cross-msl spirv-cross-glsl)
@ -128,12 +132,21 @@ if (${PYTHONINTERP_FOUND})
add_test(NAME spirv-cross-test
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py
${CMAKE_CURRENT_SOURCE_DIR}/shaders)
add_test(NAME spirv-cross-test-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py
${CMAKE_CURRENT_SOURCE_DIR}/shaders-no-opt)
add_test(NAME spirv-cross-test-metal
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl)
add_test(NAME spirv-cross-test-metal-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl-no-opt)
add_test(NAME spirv-cross-test-hlsl
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl)
add_test(NAME spirv-cross-test-hlsl-no-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl-no-opt)
add_test(NAME spirv-cross-test-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --opt
${CMAKE_CURRENT_SOURCE_DIR}/shaders)

View File

@ -3,6 +3,7 @@
SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.
[![Build Status](https://travis-ci.org/KhronosGroup/SPIRV-Cross.svg?branch=master)](https://travis-ci.org/KhronosGroup/SPIRV-Cross)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/KhronosGroup/SPIRV-Cross?svg=true&branch=master)](https://ci.appveyor.com/project/HansKristian-ARM/SPIRV-Cross)
## Features
@ -10,6 +11,7 @@ SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader
- Convert SPIR-V to readable, usable and efficient Metal Shading Language (MSL)
- Convert SPIR-V to readable, usable and efficient HLSL
- Convert SPIR-V to debuggable C++ [EXPERIMENTAL]
- Convert SPIR-V to a JSON reflection format [EXPERIMENTAL]
- Reflection API to simplify the creation of Vulkan pipeline layouts
- Reflection API to modify and tweak OpDecorations
- Supports "all" of vertex, fragment, tessellation, geometry and compute shaders.
@ -24,7 +26,7 @@ However, most missing features are expected to be "trivial" improvements at this
SPIRV-Cross has been tested on Linux, OSX and Windows.
The make and CMake build flavors offer the option to treat exceptions as assertions. To disable exceptions for make just append SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=1 to the command line. For CMake append -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON. By default exceptions are enabled.
The make and CMake build flavors offer the option to treat exceptions as assertions. To disable exceptions for make just append `SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=1` to the command line. For CMake append `-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=ON`. By default exceptions are enabled.
### Linux and macOS
@ -38,6 +40,8 @@ MinGW-w64 based compilation works with `make`, and an MSVC 2013 solution is also
### Using the C++ API
For more in-depth documentation than what's provided in this README, please have a look at the [Wiki](https://github.com/KhronosGroup/SPIRV-Cross/wiki).
To perform reflection and convert to other shader languages you can use the SPIRV-Cross API.
For example:
@ -279,6 +283,7 @@ although there are a couple of convenience script for doing this:
```
./checkout_glslang_spirv_tools.sh # Checks out glslang and SPIRV-Tools at a fixed revision which matches the reference output.
./build_glslang_spirv_tools.sh # Builds glslang and SPIRV-Tools.
./test_shaders.sh # Runs over all changes and makes sure that there are no deltas compared to reference files.
```

31
deps/SPIRV-Cross/appveyor.yml vendored Normal file
View File

@ -0,0 +1,31 @@
environment:
matrix:
- GENERATOR: "Visual Studio 12 2013 Win64"
CONFIG: Debug
- GENERATOR: "Visual Studio 12 2013 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 14 2015 Win64"
CONFIG: Debug
- GENERATOR: "Visual Studio 14 2015 Win64"
CONFIG: Release
- GENERATOR: "Visual Studio 12 2013"
CONFIG: Debug
- GENERATOR: "Visual Studio 12 2013"
CONFIG: Release
- GENERATOR: "Visual Studio 14 2015"
CONFIG: Debug
- GENERATOR: "Visual Studio 14 2015"
CONFIG: Release
build_script:
- git submodule update --init
- cmake "-G%GENERATOR%" -H. -B_builds
- cmake --build _builds --config "%CONFIG%"

26
deps/SPIRV-Cross/build_glslang_spirv_tools.sh vendored Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
PROFILE=Release
if [ ! -z $1 ]; then
PROFILE=$1
fi
NPROC=$(nproc)
if [ ! -z $2 ]; then
NPROC=$2
fi
echo "Building glslang."
mkdir -p external/glslang-build
cd external/glslang-build
cmake ../glslang -DCMAKE_BUILD_TYPE=$PROFILE -G"Unix Makefiles"
make -j$NPROC
cd ../..
echo "Building SPIRV-Tools."
mkdir -p external/spirv-tools-build
cd external/spirv-tools-build
cmake ../spirv-tools -DCMAKE_BUILD_TYPE=$PROFILE -G"Unix Makefiles" -DSPIRV_WERROR=OFF
make -j$NPROC
cd ../..

View File

@ -1,7 +1,7 @@
#!/bin/bash
GLSLANG_REV=9c6f8cc29ba303b43ccf36deea6bb38a304f9b92
SPIRV_TOOLS_REV=e28edd458b729da7bbfd51e375feb33103709e6f
GLSLANG_REV=461ea09943e0e88ea854ab9e3b42d17d728af2ad
SPIRV_TOOLS_REV=53bc1623ecd3cc304d0d6feed8385e70c7ab30d3
if [ -d external/glslang ]; then
echo "Updating glslang to revision $GLSLANG_REV."
@ -18,13 +18,6 @@ else
fi
cd ../..
echo "Building glslang."
mkdir -p external/glslang-build
cd external/glslang-build
cmake ../glslang -DCMAKE_BUILD_TYPE=Release -G"Unix Makefiles"
make -j$(nproc)
cd ../..
if [ -d external/spirv-tools ]; then
echo "Updating SPIRV-Tools to revision $SPIRV_TOOLS_REV."
cd external/spirv-tools
@ -37,21 +30,15 @@ else
git clone git://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
cd spirv-tools
git checkout $SPIRV_TOOLS_REV
fi
if [ -d external/spirv-headers ]; then
if [ -d external/spirv-headers ]; then
cd external/spirv-headers
git pull origin master
cd ../..
else
else
git clone git://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers
fi
fi
cd ../..
echo "Building SPIRV-Tools."
mkdir -p external/spirv-tools-build
cd external/spirv-tools-build
cmake ../spirv-tools -DCMAKE_BUILD_TYPE=Release -G"Unix Makefiles"
make -j$(nproc)
cd ../..

View File

@ -1,6 +1,7 @@
#!/bin/bash
for file in spirv_*.{cpp,hpp} include/spirv_cross/*.{hpp,h} samples/cpp/*.cpp main.cpp
#for file in spirv_*.{cpp,hpp} include/spirv_cross/*.{hpp,h} samples/cpp/*.cpp main.cpp
for file in spirv_*.{cpp,hpp} main.cpp
do
echo "Formatting file: $file ..."
clang-format -style=file -i $file

View File

@ -19,6 +19,7 @@
#include "spirv_glsl.hpp"
#include "spirv_hlsl.hpp"
#include "spirv_msl.hpp"
#include "spirv_reflect.hpp"
#include <algorithm>
#include <cstdio>
#include <cstring>
@ -122,7 +123,7 @@ struct CLIParser
THROW("Tried to parse uint, but nothing left in arguments");
}
uint32_t val = stoul(*argv);
uint64_t val = stoul(*argv);
if (val > numeric_limits<uint32_t>::max())
{
THROW("next_uint() out of range");
@ -131,7 +132,7 @@ struct CLIParser
argc--;
argv++;
return val;
return uint32_t(val);
}
double next_double()
@ -149,6 +150,22 @@ struct CLIParser
return val;
}
// Return a string only if it's not prefixed with `--`, otherwise return the default value
const char *next_value_string(const char *default_value)
{
if (!argc)
{
return default_value;
}
if (0 == strncmp("--", *argv, 2))
{
return default_value;
}
return next_string();
}
const char *next_string()
{
if (!argc)
@ -212,7 +229,6 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
for (auto &res : resources)
{
auto &type = compiler.get_type(res.type_id);
auto mask = compiler.get_decoration_mask(res.id);
if (print_ssbo && compiler.buffer_is_hlsl_counter_buffer(res.id))
continue;
@ -221,8 +237,8 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
// for SSBOs and UBOs since those are the only meaningful names to use externally.
// Push constant blocks are still accessed by name and not block name, even though they are technically Blocks.
bool is_push_constant = compiler.get_storage_class(res.id) == StorageClassPushConstant;
bool is_block = (compiler.get_decoration_mask(type.self) &
((1ull << DecorationBlock) | (1ull << DecorationBufferBlock))) != 0;
bool is_block = compiler.get_decoration_bitset(type.self).get(DecorationBlock) ||
compiler.get_decoration_bitset(type.self).get(DecorationBufferBlock);
bool is_sized_block = is_block && (compiler.get_storage_class(res.id) == StorageClassUniform ||
compiler.get_storage_class(res.id) == StorageClassUniformConstant);
uint32_t fallback_id = !is_push_constant && is_block ? res.base_type_id : res.id;
@ -231,6 +247,12 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
if (is_sized_block)
block_size = uint32_t(compiler.get_declared_struct_size(compiler.get_type(res.base_type_id)));
Bitset mask;
if (print_ssbo)
mask = compiler.get_buffer_block_flags(res.id);
else
mask = compiler.get_decoration_bitset(res.id);
string array;
for (auto arr : type.array)
array = join("[", arr ? convert_to_string(arr) : "", "]") + array;
@ -238,17 +260,17 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
fprintf(stderr, " ID %03u : %s%s", res.id,
!res.name.empty() ? res.name.c_str() : compiler.get_fallback_name(fallback_id).c_str(), array.c_str());
if (mask & (1ull << DecorationLocation))
if (mask.get(DecorationLocation))
fprintf(stderr, " (Location : %u)", compiler.get_decoration(res.id, DecorationLocation));
if (mask & (1ull << DecorationDescriptorSet))
if (mask.get(DecorationDescriptorSet))
fprintf(stderr, " (Set : %u)", compiler.get_decoration(res.id, DecorationDescriptorSet));
if (mask & (1ull << DecorationBinding))
if (mask.get(DecorationBinding))
fprintf(stderr, " (Binding : %u)", compiler.get_decoration(res.id, DecorationBinding));
if (mask & (1ull << DecorationInputAttachmentIndex))
if (mask.get(DecorationInputAttachmentIndex))
fprintf(stderr, " (Attachment : %u)", compiler.get_decoration(res.id, DecorationInputAttachmentIndex));
if (mask & (1ull << DecorationNonReadable))
if (mask.get(DecorationNonReadable))
fprintf(stderr, " writeonly");
if (mask & (1ull << DecorationNonWritable))
if (mask.get(DecorationNonWritable))
fprintf(stderr, " readonly");
if (is_sized_block)
fprintf(stderr, " (BlockSize : %u bytes)", block_size);
@ -284,7 +306,7 @@ static const char *execution_model_to_str(spv::ExecutionModel model)
static void print_resources(const Compiler &compiler, const ShaderResources &res)
{
uint64_t modes = compiler.get_execution_mode_mask();
auto &modes = compiler.get_execution_mode_bitset();
fprintf(stderr, "Entry points:\n");
auto entry_points = compiler.get_entry_points_and_stages();
@ -293,11 +315,7 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res
fprintf(stderr, "\n");
fprintf(stderr, "Execution modes:\n");
for (unsigned i = 0; i < 64; i++)
{
if (!(modes & (1ull << i)))
continue;
modes.for_each_bit([&](uint32_t i) {
auto mode = static_cast<ExecutionMode>(i);
uint32_t arg0 = compiler.get_execution_mode_argument(mode, 0);
uint32_t arg1 = compiler.get_execution_mode_argument(mode, 1);
@ -353,7 +371,7 @@ static void print_resources(const Compiler &compiler, const ShaderResources &res
default:
break;
}
}
});
fprintf(stderr, "\n");
print_resources(compiler, "subpass inputs", res.subpass_inputs);
@ -460,6 +478,7 @@ struct CLIArguments
bool fixup = false;
bool yflip = false;
bool sso = false;
bool support_nonzero_baseinstance = true;
vector<PLSArg> pls_in;
vector<PLSArg> pls_out;
vector<Remap> remaps;
@ -480,6 +499,7 @@ struct CLIArguments
uint32_t iterations = 1;
bool cpp = false;
string reflect;
bool msl = false;
bool hlsl = false;
bool hlsl_compat = false;
@ -487,25 +507,49 @@ struct CLIArguments
bool flatten_multidimensional_arrays = false;
bool use_420pack_extension = true;
bool remove_unused = false;
bool combined_samplers_inherit_bindings = false;
};
static void print_help()
{
fprintf(stderr, "Usage: spirv-cross [--output <output path>] [SPIR-V file] [--es] [--no-es] "
"[--version <GLSL version>] [--dump-resources] [--help] [--force-temporary] "
"[--vulkan-semantics] [--flatten-ubo] [--fixup-clipspace] [--flip-vert-y] [--iterations iter] "
"[--cpp] [--cpp-interface-name <name>] "
"[--msl] [--msl-version <MMmmpp>]"
"[--hlsl] [--shader-model] [--hlsl-enable-compat] "
"[--separate-shader-objects]"
"[--pls-in format input-name] [--pls-out format output-name] [--remap source_name target_name "
"components] [--extension ext] [--entry name] [--stage <stage (vert, frag, geom, tesc, tese, "
"comp)>] [--remove-unused-variables] "
"[--flatten-multidimensional-arrays] [--no-420pack-extension] "
"[--remap-variable-type <variable_name> <new_variable_type>] "
"[--rename-interface-variable <in|out> <location> <new_variable_name>] "
"[--set-hlsl-vertex-input-semantic <location> <semantic>] "
"[--rename-entry-point <old> <new> <stage>] "
fprintf(stderr, "Usage: spirv-cross\n"
"\t[--output <output path>]\n"
"\t[SPIR-V file]\n"
"\t[--es]\n"
"\t[--no-es]\n"
"\t[--version <GLSL version>]\n"
"\t[--dump-resources]\n"
"\t[--help]\n"
"\t[--force-temporary]\n"
"\t[--vulkan-semantics]\n"
"\t[--flatten-ubo]\n"
"\t[--fixup-clipspace]\n"
"\t[--flip-vert-y]\n"
"\t[--iterations iter]\n"
"\t[--cpp]\n"
"\t[--cpp-interface-name <name>]\n"
"\t[--msl]\n"
"\t[--msl-version <MMmmpp>]\n"
"\t[--hlsl]\n"
"\t[--reflect]\n"
"\t[--shader-model]\n"
"\t[--hlsl-enable-compat]\n"
"\t[--separate-shader-objects]\n"
"\t[--pls-in format input-name]\n"
"\t[--pls-out format output-name]\n"
"\t[--remap source_name target_name components]\n"
"\t[--extension ext]\n"
"\t[--entry name]\n"
"\t[--stage <stage (vert, frag, geom, tesc, tese comp)>]\n"
"\t[--remove-unused-variables]\n"
"\t[--flatten-multidimensional-arrays]\n"
"\t[--no-420pack-extension]\n"
"\t[--remap-variable-type <variable_name> <new_variable_type>]\n"
"\t[--rename-interface-variable <in|out> <location> <new_variable_name>]\n"
"\t[--set-hlsl-vertex-input-semantic <location> <semantic>]\n"
"\t[--rename-entry-point <old> <new> <stage>]\n"
"\t[--combined-samplers-inherit-bindings]\n"
"\t[--no-support-nonzero-baseinstance]\n"
"\n");
}
@ -640,6 +684,7 @@ static int main_inner(int argc, char *argv[])
cbs.add("--flip-vert-y", [&args](CLIParser &) { args.yflip = true; });
cbs.add("--iterations", [&args](CLIParser &parser) { args.iterations = parser.next_uint(); });
cbs.add("--cpp", [&args](CLIParser &) { args.cpp = true; });
cbs.add("--reflect", [&args](CLIParser &parser) { args.reflect = parser.next_value_string("json"); });
cbs.add("--cpp-interface-name", [&args](CLIParser &parser) { args.cpp_interface_name = parser.next_string(); });
cbs.add("--metal", [&args](CLIParser &) { args.msl = true; }); // Legacy compatibility
cbs.add("--msl", [&args](CLIParser &) { args.msl = true; });
@ -711,6 +756,10 @@ static int main_inner(int argc, char *argv[])
});
cbs.add("--remove-unused-variables", [&args](CLIParser &) { args.remove_unused = true; });
cbs.add("--combined-samplers-inherit-bindings",
[&args](CLIParser &) { args.combined_samplers_inherit_bindings = true; });
cbs.add("--no-support-nonzero-baseinstance", [&](CLIParser &) { args.support_nonzero_baseinstance = false; });
cbs.default_handler = [&args](const char *value) { args.input = value; };
cbs.error_handler = [] { print_help(); };
@ -732,8 +781,20 @@ static int main_inner(int argc, char *argv[])
return EXIT_FAILURE;
}
unique_ptr<CompilerGLSL> compiler;
// Special case reflection because it has little to do with the path followed by code-outputting compilers
if (!args.reflect.empty())
{
CompilerReflection compiler(read_spirv_file(args.input));
compiler.set_format(args.reflect);
auto json = compiler.compile();
if (args.output)
write_string_to_file(args.output, json.c_str());
else
printf("%s", json.c_str());
return EXIT_SUCCESS;
}
unique_ptr<CompilerGLSL> compiler;
bool combined_image_samplers = false;
bool build_dummy_sampler = false;
@ -748,10 +809,10 @@ static int main_inner(int argc, char *argv[])
compiler = unique_ptr<CompilerMSL>(new CompilerMSL(read_spirv_file(args.input)));
auto *msl_comp = static_cast<CompilerMSL *>(compiler.get());
auto msl_opts = msl_comp->get_options();
auto msl_opts = msl_comp->get_msl_options();
if (args.set_msl_version)
msl_opts.msl_version = args.msl_version;
msl_comp->set_options(msl_opts);
msl_comp->set_msl_options(msl_opts);
}
else if (args.hlsl)
compiler = unique_ptr<CompilerHLSL>(new CompilerHLSL(read_spirv_file(args.input)));
@ -851,14 +912,14 @@ static int main_inner(int argc, char *argv[])
if (!entry_point.empty())
compiler->set_entry_point(entry_point, model);
if (!args.set_version && !compiler->get_options().version)
if (!args.set_version && !compiler->get_common_options().version)
{
fprintf(stderr, "Didn't specify GLSL version and SPIR-V did not specify language.\n");
print_help();
return EXIT_FAILURE;
}
CompilerGLSL::Options opts = compiler->get_options();
CompilerGLSL::Options opts = compiler->get_common_options();
if (args.set_version)
opts.version = args.version;
if (args.set_es)
@ -870,13 +931,14 @@ static int main_inner(int argc, char *argv[])
opts.vulkan_semantics = args.vulkan_semantics;
opts.vertex.fixup_clipspace = args.fixup;
opts.vertex.flip_vert_y = args.yflip;
compiler->set_options(opts);
opts.vertex.support_nonzero_base_instance = args.support_nonzero_baseinstance;
compiler->set_common_options(opts);
// Set HLSL specific options.
if (args.hlsl)
{
auto *hlsl = static_cast<CompilerHLSL *>(compiler.get());
auto hlsl_opts = hlsl->get_options();
auto hlsl_opts = hlsl->get_hlsl_options();
if (args.set_shader_model)
{
if (args.shader_model < 30)
@ -894,11 +956,19 @@ static int main_inner(int argc, char *argv[])
hlsl_opts.point_size_compat = true;
hlsl_opts.point_coord_compat = true;
}
hlsl->set_options(hlsl_opts);
hlsl->set_hlsl_options(hlsl_opts);
}
if (build_dummy_sampler)
compiler->build_dummy_sampler_for_combined_images();
{
uint32_t sampler = compiler->build_dummy_sampler_for_combined_images();
if (sampler != 0)
{
// Set some defaults to make validation happy.
compiler->set_decoration(sampler, DecorationDescriptorSet, 0);
compiler->set_decoration(sampler, DecorationBinding, 0);
}
}
ShaderResources res;
if (args.remove_unused)
@ -961,6 +1031,9 @@ static int main_inner(int argc, char *argv[])
if (combined_image_samplers)
{
compiler->build_combined_image_samplers();
if (args.combined_samplers_inherit_bindings)
spirv_cross_util::inherit_combined_sampler_bindings(*compiler);
// Give the remapped combined samplers new names.
for (auto &remap : compiler->get_combined_image_samplers())
{

View File

@ -127,6 +127,7 @@
<ClCompile Include="..\spirv_cpp.cpp" />
<ClCompile Include="..\spirv_cross.cpp" />
<ClCompile Include="..\spirv_glsl.cpp" />
<ClCompile Include="..\spirv_reflect.cpp" />
<ClCompile Include="..\spirv_hlsl.cpp" />
<ClCompile Include="..\spirv_msl.cpp" />
<ClCompile Include="..\spirv_cfg.cpp" />
@ -138,6 +139,7 @@
<ClInclude Include="..\spirv_cpp.hpp" />
<ClInclude Include="..\spirv_cross.hpp" />
<ClInclude Include="..\spirv_glsl.hpp" />
<ClInclude Include="..\spirv_reflect.hpp" />
<ClInclude Include="..\spirv.hpp" />
<ClInclude Include="..\spirv_hlsl.hpp" />
<ClInclude Include="..\spirv_msl.hpp" />

View File

@ -24,6 +24,9 @@
<ClCompile Include="..\spirv_glsl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\spirv_reflect.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\spirv_cpp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -50,6 +53,9 @@
<ClInclude Include="..\spirv_glsl.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\spirv_reflect.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\spirv.hpp">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -0,0 +1,32 @@
RWByteAddressBuffer bar : register(u0);
RWByteAddressBuffer foo : register(u1);
void comp_main()
{
[unroll]
for (int _135 = 0; _135 < 16; )
{
bar.Store4(_135 * 16 + 0, asuint(asfloat(foo.Load4(_135 * 16 + 0))));
_135++;
continue;
}
[loop]
for (int _136 = 0; _136 < 16; )
{
bar.Store4((15 - _136) * 16 + 0, asuint(asfloat(foo.Load4(_136 * 16 + 0))));
_136++;
continue;
}
[branch]
if (asfloat(bar.Load(160)) > 10.0f)
{
foo.Store4(320, asuint(5.0f.xxxx));
}
foo.Store4(320, asuint(20.0f.xxxx));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View File

@ -0,0 +1,30 @@
Texture2D<float4> uTex : register(t1);
SamplerState uSampler : register(s0);
static float4 FragColor;
static float2 vUV;
struct SPIRV_Cross_Input
{
float2 vUV : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = uTex.Sample(uSampler, vUV);
FragColor += uTex.Sample(uSampler, vUV, int2(1, 1));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vUV = stage_input.vUV;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,8 @@
void frag_main()
{
}
void main()
{
frag_main();
}

View File

@ -7,7 +7,7 @@ struct SPIRV_Cross_Output
void frag_main()
{
FragColor = (((1.0f.xxxx + 1.0f.xxxx) + (1.0f.xxx.xyzz + 1.0f.xxxx)) + (1.0f.xxxx + 2.0f.xxxx)) + (1.0f.xx.xyxy + 2.0f.xxxx);
FragColor = 10.0f.xxxx;
}
SPIRV_Cross_Output main()

View File

@ -0,0 +1,31 @@
Texture2D<float4> uTexture : register(t0);
SamplerState _uTexture_sampler : register(s0);
static int2 Size;
struct SPIRV_Cross_Output
{
int2 Size : SV_Target0;
};
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
void frag_main()
{
uint _19_dummy_parameter;
uint _20_dummy_parameter;
Size = int2(SPIRV_Cross_textureSize(uTexture, uint(0), _19_dummy_parameter)) + int2(SPIRV_Cross_textureSize(uTexture, uint(1), _20_dummy_parameter));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.Size = Size;
return stage_output;
}

View File

@ -0,0 +1,57 @@
Texture2D<float4> uImage : register(t0);
SamplerState _uImage_sampler : register(s0);
static float4 v0;
static float4 FragColor;
struct SPIRV_Cross_Input
{
float4 v0 : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
float phi;
float4 _36;
int _51;
_51 = 0;
phi = 1.0f;
_36 = float4(1.0f, 2.0f, 1.0f, 2.0f);
for (;;)
{
FragColor = _36;
if (_51 < 4)
{
if (v0[_51] > 0.0f)
{
float2 _48 = phi.xx;
_51++;
phi += 2.0f;
_36 = uImage.SampleLevel(_uImage_sampler, _48, 0.0f);
continue;
}
else
{
break;
}
}
else
{
break;
}
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v0 = stage_input.v0;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,57 @@
static const float _46[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f };
static const float4 _76[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx };
static const float4 _90[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx };
static float FragColor;
static int index;
struct SPIRV_Cross_Input
{
nointerpolation int index : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
float4 foobar[4] = _76;
float4 baz[4] = _76;
FragColor = _46[index];
if (index < 10)
{
FragColor += _46[index ^ 1];
}
else
{
FragColor += _46[index & 1];
}
bool _99 = index > 30;
if (_99)
{
FragColor += _76[index & 3].y;
}
else
{
FragColor += _76[index & 1].x;
}
if (_99)
{
foobar[1].z = 20.0f;
}
int _37 = index & 3;
FragColor += foobar[_37].z;
baz = _90;
FragColor += baz[_37].z;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
index = stage_input.index;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,29 @@
static float4 FragColor;
static int4 vA;
static int4 vB;
struct SPIRV_Cross_Input
{
nointerpolation int4 vA : TEXCOORD0;
nointerpolation int4 vB : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = float4(vA - vB * (vA / vB));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vA = stage_input.vA;
vB = stage_input.vB;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,29 @@
Texture2D<float4> uTexture : register(t0);
SamplerState _uTexture_sampler : register(s0);
static float4 gl_FragCoord;
static float4 FragColor;
struct SPIRV_Cross_Input
{
float4 gl_FragCoord : SV_Position;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = uTexture.Load(int3(int2(gl_FragCoord.xy), 0));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_FragCoord = stage_input.gl_FragCoord;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,31 @@
Texture2D<float4> uShadow : register(t0);
SamplerComparisonState _uShadow_sampler : register(s0);
Texture2D<float4> uTexture : register(t1);
SamplerComparisonState uSampler : register(s2);
static float3 vUV;
static float FragColor;
struct SPIRV_Cross_Input
{
float3 vUV : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
FragColor = uShadow.SampleCmp(_uShadow_sampler, vUV.xy, vUV.z) + uTexture.SampleCmp(uSampler, vUV.xy, vUV.z);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vUV = stage_input.vUV;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -11,25 +11,23 @@ struct SPIRV_Cross_Output
float4 FragColor : SV_Target0;
};
float4 _21;
void frag_main()
{
float4 _33;
do
bool _29;
for (;;)
{
if (counter == 10)
_29 = counter == 10;
if (_29)
{
_33 = 10.0f.xxxx;
break;
}
else
{
_33 = 30.0f.xxxx;
break;
}
} while (false);
FragColor = _33;
}
bool4 _35 = _29.xxxx;
FragColor = float4(_35.x ? 10.0f.xxxx.x : 30.0f.xxxx.x, _35.y ? 10.0f.xxxx.y : 30.0f.xxxx.y, _35.z ? 10.0f.xxxx.z : 30.0f.xxxx.z, _35.w ? 10.0f.xxxx.w : 30.0f.xxxx.w);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@ -1,8 +0,0 @@
void vert_main()
{
}
void main()
{
vert_main();
}

View File

@ -0,0 +1,37 @@
static const int _7 = -10;
static const uint _8 = 100u;
static const int _20 = (_7 + 2);
static const uint _25 = (_8 % 5u);
static const int4 _30 = int4(20, 30, _20, _20);
static const int2 _32 = int2(_30.y, _30.x);
static const int _33 = _30.y;
static float4 gl_Position;
static int _4;
struct SPIRV_Cross_Output
{
nointerpolation int _4 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
float4 _64 = 0.0f.xxxx;
_64.y = float(_20);
float4 _68 = _64;
_68.z = float(_25);
float4 _52 = _68 + float4(_30);
float2 _56 = _52.xy + float2(_32);
gl_Position = float4(_56.x, _56.y, _52.z, _52.w);
_4 = _33;
}
SPIRV_Cross_Output main()
{
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output._4 = _4;
return stage_output;
}

View File

@ -0,0 +1,28 @@
static float4 gl_Position;
static int gl_VertexIndex;
static int gl_InstanceIndex;
struct SPIRV_Cross_Input
{
uint gl_VertexIndex : SV_VertexID;
uint gl_InstanceIndex : SV_InstanceID;
};
struct SPIRV_Cross_Output
{
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = float(uint(gl_VertexIndex) + uint(gl_InstanceIndex)).xxxx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_VertexIndex = int(stage_input.gl_VertexIndex);
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
return stage_output;
}

View File

@ -1,3 +1,5 @@
static const uint3 gl_WorkGroupSize = uint3(8u, 4u, 2u);
void comp_main()
{
}

View File

@ -0,0 +1,16 @@
globallycoherent RWByteAddressBuffer _29 : register(u3);
ByteAddressBuffer _33 : register(t2);
RWTexture2D<float> uImageIn : register(u0);
globallycoherent RWTexture2D<float> uImageOut : register(u1);
void comp_main()
{
uImageOut[int2(9, 7)] = uImageIn[int2(9, 7)].x;
_29.Store(0, asuint(asfloat(_33.Load(0))));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View File

@ -34,24 +34,26 @@ struct SPIRV_Cross_Input
void comp_main()
{
uImageOutF[int2(gl_GlobalInvocationID.xy)] = uImageInF[int2(gl_GlobalInvocationID.xy)].x;
uImageOutI[int2(gl_GlobalInvocationID.xy)] = uImageInI[int2(gl_GlobalInvocationID.xy)].x;
uImageOutU[int2(gl_GlobalInvocationID.xy)] = uImageInU[int2(gl_GlobalInvocationID.xy)].x;
uImageOutBuffer[int(gl_GlobalInvocationID.x)] = uImageInBuffer[int(gl_GlobalInvocationID.x)].x;
uImageOutF2[int2(gl_GlobalInvocationID.xy)] = uImageInF2[int2(gl_GlobalInvocationID.xy)].xy;
uImageOutI2[int2(gl_GlobalInvocationID.xy)] = uImageInI2[int2(gl_GlobalInvocationID.xy)].xy;
uImageOutU2[int2(gl_GlobalInvocationID.xy)] = uImageInU2[int2(gl_GlobalInvocationID.xy)].xy;
float4 _135 = uImageInBuffer2[int(gl_GlobalInvocationID.x)].xyyy;
uImageOutBuffer2[int(gl_GlobalInvocationID.x)] = _135.xy;
uImageOutF4[int2(gl_GlobalInvocationID.xy)] = uImageInF4[int2(gl_GlobalInvocationID.xy)];
int4 _165 = uImageInI4[int2(gl_GlobalInvocationID.xy)];
uImageOutI4[int2(gl_GlobalInvocationID.xy)] = _165;
uint4 _180 = uImageInU4[int2(gl_GlobalInvocationID.xy)];
uImageOutU4[int2(gl_GlobalInvocationID.xy)] = _180;
uImageOutBuffer4[int(gl_GlobalInvocationID.x)] = uImageInBuffer4[int(gl_GlobalInvocationID.x)];
uImageNoFmtF[int2(gl_GlobalInvocationID.xy)] = _135;
uImageNoFmtU[int2(gl_GlobalInvocationID.xy)] = _180;
uImageNoFmtI[int2(gl_GlobalInvocationID.xy)] = _165;
int2 _23 = int2(gl_GlobalInvocationID.xy);
uImageOutF[_23] = uImageInF[_23].x;
uImageOutI[_23] = uImageInI[_23].x;
uImageOutU[_23] = uImageInU[_23].x;
int _74 = int(gl_GlobalInvocationID.x);
uImageOutBuffer[_74] = uImageInBuffer[_74].x;
uImageOutF2[_23] = uImageInF2[_23].xy;
uImageOutI2[_23] = uImageInI2[_23].xy;
uImageOutU2[_23] = uImageInU2[_23].xy;
float4 _135 = uImageInBuffer2[_74].xyyy;
uImageOutBuffer2[_74] = _135.xy;
uImageOutF4[_23] = uImageInF4[_23];
int4 _165 = uImageInI4[_23];
uImageOutI4[_23] = _165;
uint4 _180 = uImageInU4[_23];
uImageOutU4[_23] = _180;
uImageOutBuffer4[_74] = uImageInBuffer4[_74];
uImageNoFmtF[_23] = _135;
uImageNoFmtU[_23] = _180;
uImageNoFmtI[_23] = _165;
}
[numthreads(1, 1, 1)]

View File

@ -0,0 +1,20 @@
RWByteAddressBuffer _11 : register(u0);
void comp_main()
{
_11.Store(0, asuint(asfloat(_11.Load(0)) * asfloat(_11.Load(96))));
_11.Store4(16, asuint(asfloat(_11.Load4(16)) * asfloat(_11.Load4(112))));
float4x4 _35 = asfloat(uint4x4(_11.Load4(128), _11.Load4(144), _11.Load4(160), _11.Load4(176)));
float4x4 _37 = asfloat(uint4x4(_11.Load4(32), _11.Load4(48), _11.Load4(64), _11.Load4(80)));
float4x4 _38 = mul(_35, _37);
_11.Store4(32, asuint(_38[0]));
_11.Store4(48, asuint(_38[1]));
_11.Store4(64, asuint(_38[2]));
_11.Store4(80, asuint(_38[3]));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}

View File

@ -17,7 +17,7 @@ void comp_main()
{
sShared[gl_LocalInvocationIndex] = asfloat(_22.Load(gl_GlobalInvocationID.x * 4 + 0));
GroupMemoryBarrierWithGroupSync();
_44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[(4u - gl_LocalInvocationIndex) - 1u]));
_44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[3u - gl_LocalInvocationIndex]));
}
[numthreads(4, 1, 1)]

View File

@ -0,0 +1,67 @@
RWByteAddressBuffer _9 : register(u0, space0);
static uint4 gl_SubgroupEqMask;
static uint4 gl_SubgroupGeMask;
static uint4 gl_SubgroupGtMask;
static uint4 gl_SubgroupLeMask;
static uint4 gl_SubgroupLtMask;
void comp_main()
{
_9.Store(0, asuint(float(WaveGetLaneCount())));
_9.Store(0, asuint(float(WaveGetLaneIndex())));
_9.Store(0, asuint(float4(gl_SubgroupEqMask).x));
_9.Store(0, asuint(float4(gl_SubgroupGeMask).x));
_9.Store(0, asuint(float4(gl_SubgroupGtMask).x));
_9.Store(0, asuint(float4(gl_SubgroupLeMask).x));
_9.Store(0, asuint(float4(gl_SubgroupLtMask).x));
uint4 _75 = WaveActiveBallot(true);
float4 _88 = WaveActiveSum(20.0f.xxxx);
int4 _94 = WaveActiveSum(int4(20, 20, 20, 20));
float4 _96 = WaveActiveProduct(20.0f.xxxx);
int4 _98 = WaveActiveProduct(int4(20, 20, 20, 20));
float4 _127 = WavePrefixProduct(_96) * _96;
int4 _129 = WavePrefixProduct(_98) * _98;
}
[numthreads(1, 1, 1)]
void main()
{
gl_SubgroupEqMask = 1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96));
if (WaveGetLaneIndex() >= 32) gl_SubgroupEqMask.x = 0;
if (WaveGetLaneIndex() >= 64 || WaveGetLaneIndex() < 32) gl_SubgroupEqMask.y = 0;
if (WaveGetLaneIndex() >= 96 || WaveGetLaneIndex() < 64) gl_SubgroupEqMask.z = 0;
if (WaveGetLaneIndex() < 96) gl_SubgroupEqMask.w = 0;
gl_SubgroupGeMask = ~((1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u);
if (WaveGetLaneIndex() >= 32) gl_SubgroupGeMask.x = 0u;
if (WaveGetLaneIndex() >= 64) gl_SubgroupGeMask.y = 0u;
if (WaveGetLaneIndex() >= 96) gl_SubgroupGeMask.z = 0u;
if (WaveGetLaneIndex() < 32) gl_SubgroupGeMask.y = ~0u;
if (WaveGetLaneIndex() < 64) gl_SubgroupGeMask.z = ~0u;
if (WaveGetLaneIndex() < 96) gl_SubgroupGeMask.w = ~0u;
uint gt_lane_index = WaveGetLaneIndex() + 1;
gl_SubgroupGtMask = ~((1u << (gt_lane_index - uint4(0, 32, 64, 96))) - 1u);
if (gt_lane_index >= 32) gl_SubgroupGtMask.x = 0u;
if (gt_lane_index >= 64) gl_SubgroupGtMask.y = 0u;
if (gt_lane_index >= 96) gl_SubgroupGtMask.z = 0u;
if (gt_lane_index >= 128) gl_SubgroupGtMask.w = 0u;
if (gt_lane_index < 32) gl_SubgroupGtMask.y = ~0u;
if (gt_lane_index < 64) gl_SubgroupGtMask.z = ~0u;
if (gt_lane_index < 96) gl_SubgroupGtMask.w = ~0u;
uint le_lane_index = WaveGetLaneIndex() + 1;
gl_SubgroupLeMask = (1u << (le_lane_index - uint4(0, 32, 64, 96))) - 1u;
if (le_lane_index >= 32) gl_SubgroupLeMask.x = ~0u;
if (le_lane_index >= 64) gl_SubgroupLeMask.y = ~0u;
if (le_lane_index >= 96) gl_SubgroupLeMask.z = ~0u;
if (le_lane_index >= 128) gl_SubgroupLeMask.w = ~0u;
if (le_lane_index < 32) gl_SubgroupLeMask.y = 0u;
if (le_lane_index < 64) gl_SubgroupLeMask.z = 0u;
if (le_lane_index < 96) gl_SubgroupLeMask.w = 0u;
gl_SubgroupLtMask = (1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u;
if (WaveGetLaneIndex() >= 32) gl_SubgroupLtMask.x = ~0u;
if (WaveGetLaneIndex() >= 64) gl_SubgroupLtMask.y = ~0u;
if (WaveGetLaneIndex() >= 96) gl_SubgroupLtMask.z = ~0u;
if (WaveGetLaneIndex() < 32) gl_SubgroupLtMask.y = 0u;
if (WaveGetLaneIndex() < 64) gl_SubgroupLtMask.z = 0u;
if (WaveGetLaneIndex() < 96) gl_SubgroupLtMask.w = 0u;
comp_main();
}

View File

@ -0,0 +1,34 @@
static const float _17[5] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f };
static float4 FragColor;
static float4 v0;
struct SPIRV_Cross_Input
{
float4 v0 : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
for (int _46 = 0; _46 < 4; )
{
int _33 = _46 + 1;
FragColor += _17[_33].xxxx;
_46 = _33;
continue;
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v0 = stage_input.v0;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -30,7 +30,7 @@ void frag_main()
lut = _16;
foos = _28;
FragColor = lut[_line].xxxx;
FragColor += (foos[_line].a * (foos[1 - _line].a)).xxxx;
FragColor += (foos[_line].a * foos[1 - _line].a).xxxx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@ -0,0 +1,54 @@
Texture2D<float4> uSampler : register(t0);
SamplerState _uSampler_sampler : register(s0);
static float4 FragColor;
static float4 vInput;
struct SPIRV_Cross_Input
{
float4 vInput : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = vInput;
float4 _23 = uSampler.Sample(_uSampler_sampler, vInput.xy);
float4 _26 = ddx(vInput);
float4 _29 = ddy(vInput);
float4 _32 = fwidth(vInput);
float4 _35 = ddx_coarse(vInput);
float4 _38 = ddy_coarse(vInput);
float4 _41 = fwidth(vInput);
float4 _44 = ddx_fine(vInput);
float4 _47 = ddy_fine(vInput);
float4 _50 = fwidth(vInput);
float _56_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vInput.zw);
if (vInput.y > 10.0f)
{
FragColor += _23;
FragColor += _26;
FragColor += _29;
FragColor += _32;
FragColor += _35;
FragColor += _38;
FragColor += _41;
FragColor += _44;
FragColor += _47;
FragColor += _50;
FragColor += float2(_56_tmp, _56_tmp).xyxy;
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vInput = stage_input.vInput;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,45 @@
static min16float4 v4;
static min16float3 v3;
static min16float v1;
static min16float2 v2;
static float o1;
static float2 o2;
static float3 o3;
static float4 o4;
struct SPIRV_Cross_Input
{
min16float v1 : TEXCOORD0;
min16float2 v2 : TEXCOORD1;
min16float3 v3 : TEXCOORD2;
min16float4 v4 : TEXCOORD3;
};
struct SPIRV_Cross_Output
{
float o1 : SV_Target0;
float2 o2 : SV_Target1;
float3 o3 : SV_Target2;
float4 o4 : SV_Target3;
};
void frag_main()
{
min16float4 _324;
min16float4 _387 = modf(v4, _324);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v4 = stage_input.v4;
v3 = stage_input.v3;
v1 = stage_input.v1;
v2 = stage_input.v2;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.o1 = o1;
stage_output.o2 = o2;
stage_output.o3 = o3;
stage_output.o4 = o4;
return stage_output;
}

View File

@ -2,6 +2,30 @@ Texture1D<uint4> uSampler1DUint : register(t0);
SamplerState _uSampler1DUint_sampler : register(s0);
Texture1D<int4> uSampler1DInt : register(t0);
SamplerState _uSampler1DInt_sampler : register(s0);
Texture1D<float4> uSampler1DFloat : register(t0);
SamplerState _uSampler1DFloat_sampler : register(s0);
Texture2DArray<int4> uSampler2DArray : register(t2);
SamplerState _uSampler2DArray_sampler : register(s2);
Texture3D<float4> uSampler3D : register(t3);
SamplerState _uSampler3D_sampler : register(s3);
TextureCube<float4> uSamplerCube : register(t4);
SamplerState _uSamplerCube_sampler : register(s4);
TextureCubeArray<uint4> uSamplerCubeArray : register(t5);
SamplerState _uSamplerCubeArray_sampler : register(s5);
Buffer<float4> uSamplerBuffer : register(t6);
Texture2DMS<int4> uSamplerMS : register(t7);
SamplerState _uSamplerMS_sampler : register(s7);
Texture2DMSArray<float4> uSamplerMSArray : register(t8);
SamplerState _uSamplerMSArray_sampler : register(s8);
Texture2D<float4> uSampler2D : register(t1);
SamplerState _uSampler2D_sampler : register(s1);
uint SPIRV_Cross_textureSize(Texture1D<float4> Tex, uint Level, out uint Param)
{
uint ret;
Tex.GetDimensions(Level, ret.x, Param);
return ret;
}
uint SPIRV_Cross_textureSize(Texture1D<int4> Tex, uint Level, out uint Param)
{
@ -17,10 +41,87 @@ uint SPIRV_Cross_textureSize(Texture1D<uint4> Tex, uint Level, out uint Param)
return ret;
}
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(Texture2DArray<int4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(Texture3D<float4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param);
return ret;
}
uint SPIRV_Cross_textureSize(Buffer<float4> Tex, uint Level, out uint Param)
{
uint ret;
Tex.GetDimensions(ret.x);
Param = 0u;
return ret;
}
uint2 SPIRV_Cross_textureSize(TextureCube<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(TextureCubeArray<uint4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param);
return ret;
}
uint2 SPIRV_Cross_textureSize(Texture2DMS<int4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(ret.x, ret.y, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(Texture2DMSArray<float4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(ret.x, ret.y, ret.z, Param);
return ret;
}
void frag_main()
{
uint _17_dummy_parameter;
uint _24_dummy_parameter;
uint _32_dummy_parameter;
uint _42_dummy_parameter;
uint _50_dummy_parameter;
uint _60_dummy_parameter;
uint _68_dummy_parameter;
uint _76_dummy_parameter;
uint _84_dummy_parameter;
uint _92_dummy_parameter;
int _100;
SPIRV_Cross_textureSize(uSampler2D, 0u, _100);
int _104;
SPIRV_Cross_textureSize(uSampler2DArray, 0u, _104);
int _108;
SPIRV_Cross_textureSize(uSampler3D, 0u, _108);
int _112;
SPIRV_Cross_textureSize(uSamplerCube, 0u, _112);
int _116;
SPIRV_Cross_textureSize(uSamplerMS, 0u, _116);
int _120;
SPIRV_Cross_textureSize(uSamplerMSArray, 0u, _120);
}
void main()

View File

@ -1,5 +1,112 @@
Texture1D<float4> uSampler1D : register(t0);
SamplerState _uSampler1D_sampler : register(s0);
Texture2D<float4> uSampler2D : register(t1);
SamplerState _uSampler2D_sampler : register(s1);
Texture2DArray<float4> uSampler2DArray : register(t2);
SamplerState _uSampler2DArray_sampler : register(s2);
Texture3D<float4> uSampler3D : register(t3);
SamplerState _uSampler3D_sampler : register(s3);
TextureCube<float4> uSamplerCube : register(t4);
SamplerState _uSamplerCube_sampler : register(s4);
TextureCubeArray<float4> uSamplerCubeArray : register(t5);
SamplerState _uSamplerCubeArray_sampler : register(s5);
Buffer<float4> uSamplerBuffer : register(t6);
Texture2DMS<float4> uSamplerMS : register(t7);
SamplerState _uSamplerMS_sampler : register(s7);
Texture2DMSArray<float4> uSamplerMSArray : register(t8);
SamplerState _uSamplerMSArray_sampler : register(s8);
uint SPIRV_Cross_textureSize(Texture1D<float4> Tex, uint Level, out uint Param)
{
uint ret;
Tex.GetDimensions(Level, ret.x, Param);
return ret;
}
uint2 SPIRV_Cross_textureSize(Texture2D<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(Texture2DArray<float4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(Texture3D<float4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param);
return ret;
}
uint SPIRV_Cross_textureSize(Buffer<float4> Tex, uint Level, out uint Param)
{
uint ret;
Tex.GetDimensions(ret.x);
Param = 0u;
return ret;
}
uint2 SPIRV_Cross_textureSize(TextureCube<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(Level, ret.x, ret.y, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(TextureCubeArray<float4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param);
return ret;
}
uint2 SPIRV_Cross_textureSize(Texture2DMS<float4> Tex, uint Level, out uint Param)
{
uint2 ret;
Tex.GetDimensions(ret.x, ret.y, Param);
return ret;
}
uint3 SPIRV_Cross_textureSize(Texture2DMSArray<float4> Tex, uint Level, out uint Param)
{
uint3 ret;
Tex.GetDimensions(ret.x, ret.y, ret.z, Param);
return ret;
}
void frag_main()
{
uint _17_dummy_parameter;
uint _27_dummy_parameter;
uint _37_dummy_parameter;
uint _45_dummy_parameter;
uint _53_dummy_parameter;
uint _61_dummy_parameter;
uint _69_dummy_parameter;
uint _77_dummy_parameter;
uint _85_dummy_parameter;
int _89;
SPIRV_Cross_textureSize(uSampler1D, 0u, _89);
int _93;
SPIRV_Cross_textureSize(uSampler2D, 0u, _93);
int _97;
SPIRV_Cross_textureSize(uSampler2DArray, 0u, _97);
int _101;
SPIRV_Cross_textureSize(uSampler3D, 0u, _101);
int _105;
SPIRV_Cross_textureSize(uSamplerCube, 0u, _105);
int _109;
SPIRV_Cross_textureSize(uSamplerCubeArray, 0u, _109);
int _113;
SPIRV_Cross_textureSize(uSamplerMS, 0u, _113);
int _117;
SPIRV_Cross_textureSize(uSamplerMSArray, 0u, _117);
}
void main()

View File

@ -0,0 +1,57 @@
static const float _16[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f };
static const float4 _60[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx };
static const float4 _104[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx };
static float FragColor;
static int index;
struct SPIRV_Cross_Input
{
nointerpolation int index : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
FragColor = _16[index];
if (index < 10)
{
FragColor += _16[index ^ 1];
}
else
{
FragColor += _16[index & 1];
}
bool _63 = index > 30;
if (_63)
{
FragColor += _60[index & 3].y;
}
else
{
FragColor += _60[index & 1].x;
}
float4 foobar[4] = _60;
if (_63)
{
foobar[1].z = 20.0f;
}
int _91 = index & 3;
FragColor += foobar[_91].z;
float4 baz[4] = _60;
baz = _104;
FragColor += baz[_91].z;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
index = stage_input.index;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -1,9 +1,3 @@
struct B
{
float a;
float b;
};
void frag_main()
{
}

View File

@ -4,7 +4,7 @@ cbuffer cbuf : register(b3)
};
cbuffer registers
{
float4 registers_d : packoffset(c0);
float4 registers_a : packoffset(c0);
};
Texture2D<float4> uSampledImage : register(t4);
SamplerState _uSampledImage_sampler : register(s4);
@ -26,7 +26,7 @@ struct SPIRV_Cross_Output
void frag_main()
{
FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (cbuf_a + registers_d);
FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (cbuf_a + registers_a);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@ -0,0 +1,37 @@
struct Foo
{
row_major float4x4 v;
row_major float4x4 w;
};
cbuffer _17 : register(b0)
{
Foo _17_foo : packoffset(c0);
};
static float4 FragColor;
static float4 vUV;
struct SPIRV_Cross_Input
{
float4 vUV : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = mul(mul(vUV, _17_foo.w), _17_foo.v);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vUV = stage_input.vUV;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -41,9 +41,7 @@ void frag_main()
{
float4 _80 = vDirRef;
_80.z = vDirRef.w;
float4 _87 = vDirRef;
_87.z = vDirRef.w;
FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_87.xyz), vDirRef.z, int2(1, 1));
FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@ -17,7 +17,8 @@ struct SPIRV_Cross_Input
void frag_main()
{
uImage[vIndex][int2(gl_FragCoord.xy)] = ((uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex) + uTex[vIndex].Sample(uSampler[vIndex], vTex)) + (uCombined[vIndex + 1].Sample(_uCombined_sampler[vIndex + 1], vTex))) + (uTex[vIndex + 1].Sample(uSampler[vIndex + 1], vTex));
int _72 = vIndex + 1;
uImage[vIndex][int2(gl_FragCoord.xy)] = ((uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex) + uTex[vIndex].Sample(uSampler[vIndex], vTex)) + uCombined[_72].Sample(_uCombined_sampler[_72], vTex)) + uTex[_72].Sample(uSampler[_72], vTex);
}
void main(SPIRV_Cross_Input stage_input)

View File

@ -0,0 +1,39 @@
Texture2D<float4> uSampler[4] : register(t0);
SamplerState _uSampler_sampler[4] : register(s0);
Texture2D<float4> uTextures[4] : register(t8);
SamplerState uSamplers[4] : register(s4);
static int vIndex;
static float2 vTex;
static float4 FragColor;
struct SPIRV_Cross_Input
{
nointerpolation float2 vTex : TEXCOORD0;
nointerpolation int vIndex : TEXCOORD1;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = 0.0f.xxxx;
FragColor += uTextures[2].Sample(uSamplers[1], vTex);
FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex);
FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex + 0.100000001490116119384765625f.xx);
FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex + 0.20000000298023223876953125f.xx);
FragColor += uSampler[3].Sample(_uSampler_sampler[3], vTex + 0.300000011920928955078125f.xx);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vIndex = stage_input.vIndex;
vTex = stage_input.vTex;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,23 @@
static const uint s = 10u;
static const bool _13 = (s > 20u);
static const uint _16 = _13 ? 30u : 50u;
static float FragColor;
struct SPIRV_Cross_Output
{
float FragColor : SV_Target0;
};
void frag_main()
{
FragColor = float(_16);
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -1,33 +0,0 @@
static const float a = 1.0f;
static const float b = 2.0f;
static const int c = 3;
static const int d = 4;
struct Foo
{
float elems[(d + 2)];
};
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
float vec0[(c + 3)][8];
vec0[0][0] = 10.0f;
Foo foo;
foo.elems[c] = 10.0f;
FragColor = (((a + b).xxxx + vec0[0][0].xxxx) + 20.0f.xxxx) + foo.elems[c].xxxx;
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,33 @@
Texture2DMS<float4> uTex : register(t0);
SamplerState _uTex_sampler : register(s0);
static float4 gl_FragCoord;
static float4 FragColor;
struct SPIRV_Cross_Input
{
float4 gl_FragCoord : SV_Position;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
int2 _22 = int2(gl_FragCoord.xy);
FragColor = uTex.Load(_22, 0);
FragColor += uTex.Load(_22, 1);
FragColor += uTex.Load(_22, 2);
FragColor += uTex.Load(_22, 3);
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_FragCoord = stage_input.gl_FragCoord;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -1,27 +1,27 @@
Texture1D<float4> tex1d;
SamplerState _tex1d_sampler;
Texture2D<float4> tex2d;
SamplerState _tex2d_sampler;
Texture3D<float4> tex3d;
SamplerState _tex3d_sampler;
TextureCube<float4> texCube;
SamplerState _texCube_sampler;
Texture1D<float4> tex1dShadow;
SamplerComparisonState _tex1dShadow_sampler;
Texture2D<float4> tex2dShadow;
SamplerComparisonState _tex2dShadow_sampler;
TextureCube<float4> texCubeShadow;
SamplerComparisonState _texCubeShadow_sampler;
Texture1DArray<float4> tex1dArray;
SamplerState _tex1dArray_sampler;
Texture2DArray<float4> tex2dArray;
SamplerState _tex2dArray_sampler;
TextureCubeArray<float4> texCubeArray;
SamplerState _texCubeArray_sampler;
Texture2D<float4> separateTex2d;
SamplerState samplerNonDepth;
Texture2D<float4> separateTex2dDepth;
SamplerComparisonState samplerDepth;
Texture1D<float4> tex1d : register(t0);
SamplerState _tex1d_sampler : register(s0);
Texture2D<float4> tex2d : register(t1);
SamplerState _tex2d_sampler : register(s1);
Texture3D<float4> tex3d : register(t2);
SamplerState _tex3d_sampler : register(s2);
TextureCube<float4> texCube : register(t3);
SamplerState _texCube_sampler : register(s3);
Texture1D<float4> tex1dShadow : register(t4);
SamplerComparisonState _tex1dShadow_sampler : register(s4);
Texture2D<float4> tex2dShadow : register(t5);
SamplerComparisonState _tex2dShadow_sampler : register(s5);
TextureCube<float4> texCubeShadow : register(t6);
SamplerComparisonState _texCubeShadow_sampler : register(s6);
Texture1DArray<float4> tex1dArray : register(t7);
SamplerState _tex1dArray_sampler : register(s7);
Texture2DArray<float4> tex2dArray : register(t8);
SamplerState _tex2dArray_sampler : register(s8);
TextureCubeArray<float4> texCubeArray : register(t9);
SamplerState _texCubeArray_sampler : register(s9);
Texture2D<float4> separateTex2d : register(t12);
SamplerState samplerNonDepth : register(s11);
Texture2D<float4> separateTex2dDepth : register(t13);
SamplerComparisonState samplerDepth : register(s10);
static float texCoord1d;
static float2 texCoord2d;
@ -60,14 +60,8 @@ float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
void frag_main()
{
float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, SPIRV_Cross_projectTextureCoordinate(float2(texCoord1d, 2.0f)))) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, SPIRV_Cross_projectTextureCoordinate(float3(texCoord2d, 2.0f)))) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f)))) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f);
float _178 = _162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f);
float4 _327 = _162;
_327.w = _178;
float _193 = _178 + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f);
float4 _331 = _327;
_331.w = _193;
float4 _335 = _331;
_335.w = _193 + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f);
float4 _335 = _162;
_335.w = ((_162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f)) + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f)) + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f);
float4 _308 = ((((((((((((((_335 + tex1dArray.Sample(_tex1dArray_sampler, texCoord2d)) + tex2dArray.Sample(_tex2dArray_sampler, texCoord3d)) + texCubeArray.Sample(_texCubeArray_sampler, texCoord4d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d)) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d)) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.Load(int3(int2(1, 2), 0))) + separateTex2d.Sample(samplerNonDepth, texCoord2d);
float4 _339 = _308;
_339.w = _308.w + separateTex2dDepth.SampleCmp(samplerDepth, texCoord3d.xy, texCoord3d.z);

View File

@ -15,7 +15,7 @@ struct SPIRV_Cross_Output
void frag_main()
{
FragColor = -(-vIn);
FragColor = vIn;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@ -5,6 +5,8 @@ struct Foo
float3 c;
};
static const Foo _71 = { 1.0f.xxx, 1.0f.xxx, 1.0f.xxx };
static float4 gl_Position;
static float4 Input2;
static float4 Input4;
@ -40,8 +42,6 @@ struct SPIRV_Cross_Output
float4 gl_Position : SV_Position;
};
Foo _70;
void vert_main()
{
gl_Position = ((1.0f.xxxx + Input2) + Input4) + Input0;
@ -49,13 +49,7 @@ void vert_main()
vLocation1 = 1.0f;
vLocation2[0] = 2.0f;
vLocation2[1] = 2.0f;
Foo _65 = _70;
_65.a = 1.0f.xxx;
Foo _67 = _65;
_67.b = 1.0f.xxx;
Foo _69 = _67;
_69.c = 1.0f.xxx;
vLocation4 = _69;
vLocation4 = _71;
vLocation9 = 9.0f;
vout.color = 2.0f.xxx;
vout.foo = 4.0f.xxx;

View File

@ -0,0 +1,35 @@
cbuffer _104 : register(b0)
{
column_major float2x3 _104_var[3][4] : packoffset(c0);
};
static float4 gl_Position;
static float4 a_position;
static float v_vtxResult;
struct SPIRV_Cross_Input
{
float4 a_position : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float v_vtxResult : TEXCOORD0;
float4 gl_Position : SV_Position;
};
void vert_main()
{
gl_Position = a_position;
v_vtxResult = ((float(abs(_104_var[0][0][0].x - 2.0f) < 0.0500000007450580596923828125f) * float(abs(_104_var[0][0][0].y - 6.0f) < 0.0500000007450580596923828125f)) * float(abs(_104_var[0][0][0].z - (-6.0f)) < 0.0500000007450580596923828125f)) * ((float(abs(_104_var[0][0][1].x) < 0.0500000007450580596923828125f) * float(abs(_104_var[0][0][1].y - 5.0f) < 0.0500000007450580596923828125f)) * float(abs(_104_var[0][0][1].z - 5.0f) < 0.0500000007450580596923828125f));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
a_position = stage_input.a_position;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.v_vtxResult = v_vtxResult;
return stage_output;
}

View File

@ -1,5 +1,3 @@
static const float4 _20[2] = { 10.0f.xxxx, 20.0f.xxxx };
static float4 gl_Position;
static float4 vInput0;
static float4 vInput1;

View File

@ -17,13 +17,15 @@ struct _4
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
{
_6._m0 = uint4(int4(_5._m1) >> _5._m0);
_6._m0 = uint4(_5._m0 >> int4(_5._m1));
_6._m0 = uint4(int4(_5._m1) >> int4(_5._m1));
_6._m0 = uint4(_5._m0 >> _5._m0);
_6._m1 = int4(_5._m1) >> int4(_5._m1);
_6._m1 = _5._m0 >> _5._m0;
_6._m1 = int4(_5._m1) >> _5._m0;
_6._m1 = _5._m0 >> int4(_5._m1);
int4 _22 = _5._m0;
uint4 _23 = _5._m1;
_6._m0 = uint4(int4(_23) >> _22);
_6._m0 = uint4(_22 >> int4(_23));
_6._m0 = uint4(int4(_23) >> int4(_23));
_6._m0 = uint4(_22 >> _22);
_6._m1 = int4(_23) >> int4(_23);
_6._m1 = _22 >> _22;
_6._m1 = int4(_23) >> _22;
_6._m1 = _22 >> int4(_23);
}

View File

@ -17,13 +17,15 @@ struct _4
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
{
_6._m0 = uint4(int4(_5._m1) / _5._m0);
_6._m0 = uint4(_5._m0 / int4(_5._m1));
_6._m0 = uint4(int4(_5._m1) / int4(_5._m1));
_6._m0 = uint4(_5._m0 / _5._m0);
_6._m1 = int4(_5._m1) / int4(_5._m1);
_6._m1 = _5._m0 / _5._m0;
_6._m1 = int4(_5._m1) / _5._m0;
_6._m1 = _5._m0 / int4(_5._m1);
int4 _22 = _5._m0;
uint4 _23 = _5._m1;
_6._m0 = uint4(int4(_23) / _22);
_6._m0 = uint4(_22 / int4(_23));
_6._m0 = uint4(int4(_23) / int4(_23));
_6._m0 = uint4(_22 / _22);
_6._m1 = int4(_23) / int4(_23);
_6._m1 = _22 / _22;
_6._m1 = int4(_23) / _22;
_6._m1 = _22 / int4(_23);
}

View File

@ -17,13 +17,15 @@ struct _4
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
{
_6._m0 = _5._m1 >> uint4(_5._m0);
_6._m0 = uint4(_5._m0) >> _5._m1;
_6._m0 = _5._m1 >> _5._m1;
_6._m0 = uint4(_5._m0) >> uint4(_5._m0);
_6._m1 = int4(_5._m1 >> _5._m1);
_6._m1 = int4(uint4(_5._m0) >> uint4(_5._m0));
_6._m1 = int4(_5._m1 >> uint4(_5._m0));
_6._m1 = int4(uint4(_5._m0) >> _5._m1);
int4 _22 = _5._m0;
uint4 _23 = _5._m1;
_6._m0 = _23 >> uint4(_22);
_6._m0 = uint4(_22) >> _23;
_6._m0 = _23 >> _23;
_6._m0 = uint4(_22) >> uint4(_22);
_6._m1 = int4(_23 >> _23);
_6._m1 = int4(uint4(_22) >> uint4(_22));
_6._m1 = int4(_23 >> uint4(_22));
_6._m1 = int4(uint4(_22) >> _23);
}

View File

@ -16,7 +16,7 @@ struct _6
kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
{
uint3 _23 = gl_WorkGroupSize;
_8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x];
uint3 _23 = gl_WorkGroupSize;
}

View File

@ -0,0 +1,23 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float2 vUV [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uTex [[texture(1)]], sampler uSampler [[sampler(0)]])
{
main0_out out = {};
out.FragColor = uTex.sample(uSampler, in.vUV);
out.FragColor += uTex.sample(uSampler, in.vUV, int2(1));
return out;
}

View File

@ -3,29 +3,7 @@
using namespace metal;
struct _9
{
float _m0;
};
struct _10
{
float _m0;
float _m1;
float _m2;
float _m3;
float _m4;
float _m5;
float _m6;
float _m7;
float _m8;
float _m9;
float _m10;
float _m11;
_9 _m12;
};
constant _10 _51 = {};
constant float _57 = {};
struct main0_out
{
@ -35,7 +13,7 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
out.m_3 = float4(_51._m0, _51._m1, _51._m2, _51._m3);
out.m_3 = float4(_57);
return out;
}

View File

@ -3,7 +3,7 @@
using namespace metal;
vertex void main0()
fragment void main0()
{
}

View File

@ -3,17 +3,17 @@
using namespace metal;
struct main0_in
{
float4 vB [[user(locn1)]];
float4 vA [[user(locn0)]];
};
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float4 vA [[user(locn0)]];
float4 vB [[user(locn1)]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};

View File

@ -11,7 +11,7 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
out.FragColor = (((float4(1.0) + float4(1.0)) + (float3(1.0).xyzz + float4(1.0))) + (float4(1.0) + float4(2.0))) + (float2(1.0).xyxy + float4(2.0));
out.FragColor = float4(10.0);
return out;
}

View File

@ -0,0 +1,17 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
int2 Size [[color(0)]];
};
fragment main0_out main0(texture2d<float> uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]])
{
main0_out out = {};
out.Size = int2(uTexture.get_width(), uTexture.get_height()) + int2(uTexture.get_width(1), uTexture.get_height(1));
return out;
}

View File

@ -0,0 +1,50 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float4 v0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uImage [[texture(0)]], sampler uImageSmplr [[sampler(0)]])
{
main0_out out = {};
float phi;
float4 _36;
int _51;
_51 = 0;
phi = 1.0;
_36 = float4(1.0, 2.0, 1.0, 2.0);
for (;;)
{
out.FragColor = _36;
if (_51 < 4)
{
if (in.v0[_51] > 0.0)
{
float2 _48 = float2(phi);
_51++;
phi += 2.0;
_36 = uImage.sample(uImageSmplr, _48, level(0.0));
continue;
}
else
{
break;
}
}
else
{
break;
}
}
return out;
}

View File

@ -0,0 +1,69 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float _46[16] = {1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0};
constant float4 _76[4] = {float4(0.0), float4(1.0), float4(8.0), float4(5.0)};
constant float4 _90[4] = {float4(20.0), float4(30.0), float4(50.0), float4(60.0)};
struct main0_out
{
float FragColor [[color(0)]];
};
struct main0_in
{
int index [[user(locn0)]];
};
// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment.
template<typename T, uint N>
void spvArrayCopy(thread T (&dst)[N], thread const T (&src)[N])
{
for (uint i = 0; i < N; dst[i] = src[i], i++);
}
// An overload for constant arrays.
template<typename T, uint N>
void spvArrayCopyConstant(thread T (&dst)[N], constant T (&src)[N])
{
for (uint i = 0; i < N; dst[i] = src[i], i++);
}
fragment main0_out main0(main0_in in [[stage_in]])
{
float4 foobar[4] = {float4(0.0), float4(1.0), float4(8.0), float4(5.0)};
float4 baz[4] = {float4(0.0), float4(1.0), float4(8.0), float4(5.0)};
main0_out out = {};
out.FragColor = _46[in.index];
if (in.index < 10)
{
out.FragColor += _46[in.index ^ 1];
}
else
{
out.FragColor += _46[in.index & 1];
}
bool _99 = in.index > 30;
if (_99)
{
out.FragColor += _76[in.index & 3].y;
}
else
{
out.FragColor += _76[in.index & 1].x;
}
if (_99)
{
foobar[1].z = 20.0;
}
int _37 = in.index & 3;
out.FragColor += foobar[_37].z;
spvArrayCopyConstant(baz, _90);
out.FragColor += baz[_37].z;
return out;
}

View File

@ -3,12 +3,6 @@
using namespace metal;
struct D
{
float4 a;
float b;
};
struct main0_out
{
float FragColor [[color(0)]];

View File

@ -5,8 +5,5 @@ using namespace metal;
fragment void main0()
{
for (int _22 = 35; _22 >= 0; _22--)
{
}
}

View File

@ -3,28 +3,21 @@
using namespace metal;
struct VOUT
{
float4 a;
};
struct main0_in
{
float4 VOUT_a [[user(locn0)]];
};
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
int4 vA [[user(locn0)]];
int4 vB [[user(locn1)]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
VOUT tmp;
tmp.a = in.VOUT_a;
tmp.a += float4(1.0);
out.FragColor = tmp.a;
out.FragColor = float4(in.vA - in.vB * (in.vA / in.vB));
return out;
}

View File

@ -0,0 +1,17 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
fragment main0_out main0(texture2d<float> uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)), 0);
return out;
}

View File

@ -3,9 +3,6 @@
using namespace metal;
constant float4 _38 = {};
constant float4 _50 = {};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
@ -14,25 +11,7 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
float4 _51;
_51 = _50;
float4 _52;
for (;;)
{
if (0.0 != 0.0)
{
_52 = float4(1.0, 0.0, 0.0, 1.0);
break;
}
else
{
_52 = float4(1.0, 1.0, 0.0, 1.0);
break;
}
_52 = _38;
break;
}
out._entryPointOutput = _52;
out._entryPointOutput = float4(1.0, 1.0, 0.0, 1.0);
return out;
}

View File

@ -0,0 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float FragColor [[color(0)]];
};
struct main0_in
{
float3 vUV [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uShadow [[texture(0)]], depth2d<float> uTexture [[texture(1)]], sampler uShadowSmplr [[sampler(0)]], sampler uSampler [[sampler(2)]])
{
main0_out out = {};
out.FragColor = uShadow.sample_compare(uShadowSmplr, in.vUV.xy, in.vUV.z) + uTexture.sample_compare(uSampler, in.vUV.xy, in.vUV.z);
return out;
}

View File

@ -3,36 +3,34 @@
using namespace metal;
constant float4 _21 = {};
struct main0_in
{
int counter [[user(locn0)]];
};
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
int counter [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
float4 _33;
do
bool _29;
for (;;)
{
if (in.counter == 10)
_29 = in.counter == 10;
if (_29)
{
_33 = float4(10.0);
break;
}
else
{
_33 = float4(30.0);
break;
}
} while (false);
out.FragColor = _33;
}
bool4 _35 = bool4(_29);
out.FragColor = float4(_35.x ? float4(10.0).x : float4(30.0).x, _35.y ? float4(10.0).y : float4(30.0).y, _35.z ? float4(10.0).z : float4(30.0).z, _35.w ? float4(10.0).w : float4(30.0).w);
return out;
}

View File

@ -95,212 +95,212 @@ struct main0_out
float4 m_5 [[color(0)]];
};
fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buffer(1)]], constant _18& _19 [[buffer(2)]], texture2d<float> _8 [[texture(0)]], texture2d<float> _12 [[texture(1)]], texture2d<float> _14 [[texture(2)]], sampler _9 [[sampler(0)]], sampler _13 [[sampler(1)]], sampler _15 [[sampler(2)]], float4 gl_FragCoord [[position]])
fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _18& _19 [[buffer(1)]], constant _10& _11 [[buffer(2)]], texture2d<float> _14 [[texture(4)]], texture2d<float> _12 [[texture(13)]], texture2d<float> _8 [[texture(14)]], sampler _15 [[sampler(3)]], sampler _13 [[sampler(5)]], sampler _9 [[sampler(6)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
_28 _77 = _74;
_77._m0 = float4(0.0);
float2 _82 = gl_FragCoord.xy * _19._m23.xy;
float4 _88 = _7._m2 * _7._m0.xyxy;
float2 _97 = clamp(_82 + (float3(0.0, -2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _109 = _11._m5 * clamp(_8.sample(_9, _97, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _95 = _88.xy;
float2 _96 = _88.zw;
float2 _97 = clamp(_82 + (float2(0.0, -2.0) * _7._m0.xy), _95, _96);
float3 _109 = float3(_11._m5) * clamp(_8.sample(_9, _97, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _113 = _12.sample(_13, _97, level(0.0));
float _114 = _113.y;
float3 _129;
if (_113.y > 0.0)
if (_114 > 0.0)
{
_129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * clamp(_113.y * _113.z, 0.0, 1.0));
_129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * clamp(_114 * _113.z, 0.0, 1.0));
}
else
{
_129 = _109;
}
float3 _133 = float4(0.0).xyz + (_129 * 0.5);
float4 _134 = float4(_133.x, _133.y, _133.z, float4(0.0).w);
_28 _135 = _77;
_135._m0 = _134;
float2 _144 = clamp(_82 + (float3(-1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _156 = _11._m5 * clamp(_8.sample(_9, _144, level(0.0)).w * _7._m1, 0.0, 1.0);
float3 _130 = _129 * 0.5;
float4 _134 = float4(_130.x, _130.y, _130.z, float4(0.0).w);
float2 _144 = clamp(_82 + (float2(-1.0) * _7._m0.xy), _95, _96);
float3 _156 = float3(_11._m5) * clamp(_8.sample(_9, _144, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _160 = _12.sample(_13, _144, level(0.0));
float _161 = _160.y;
float3 _176;
if (_160.y > 0.0)
if (_161 > 0.0)
{
_176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * clamp(_160.y * _160.z, 0.0, 1.0));
_176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * clamp(_161 * _160.z, 0.0, 1.0));
}
else
{
_176 = _156;
}
float3 _180 = _134.xyz + (_176 * 0.5);
float3 _177 = _176 * 0.5;
float3 _180 = _134.xyz + _177;
float4 _181 = float4(_180.x, _180.y, _180.z, _134.w);
_28 _182 = _135;
_182._m0 = _181;
float2 _191 = clamp(_82 + (float3(0.0, -1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _203 = _11._m5 * clamp(_8.sample(_9, _191, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _191 = clamp(_82 + (float2(0.0, -1.0) * _7._m0.xy), _95, _96);
float3 _203 = float3(_11._m5) * clamp(_8.sample(_9, _191, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _207 = _12.sample(_13, _191, level(0.0));
float _208 = _207.y;
float3 _223;
if (_207.y > 0.0)
if (_208 > 0.0)
{
_223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * clamp(_207.y * _207.z, 0.0, 1.0));
_223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * clamp(_208 * _207.z, 0.0, 1.0));
}
else
{
_223 = _203;
}
float3 _227 = _181.xyz + (_223 * 0.75);
float3 _224 = _223 * 0.75;
float3 _227 = _181.xyz + _224;
float4 _228 = float4(_227.x, _227.y, _227.z, _181.w);
_28 _229 = _182;
_229._m0 = _228;
float2 _238 = clamp(_82 + (float3(1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _250 = _11._m5 * clamp(_8.sample(_9, _238, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _238 = clamp(_82 + (float2(1.0, -1.0) * _7._m0.xy), _95, _96);
float3 _250 = float3(_11._m5) * clamp(_8.sample(_9, _238, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _254 = _12.sample(_13, _238, level(0.0));
float _255 = _254.y;
float3 _270;
if (_254.y > 0.0)
if (_255 > 0.0)
{
_270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * clamp(_254.y * _254.z, 0.0, 1.0));
_270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * clamp(_255 * _254.z, 0.0, 1.0));
}
else
{
_270 = _250;
}
float3 _274 = _228.xyz + (_270 * 0.5);
float3 _271 = _270 * 0.5;
float3 _274 = _228.xyz + _271;
float4 _275 = float4(_274.x, _274.y, _274.z, _228.w);
_28 _276 = _229;
_276._m0 = _275;
float2 _285 = clamp(_82 + (float3(-2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _297 = _11._m5 * clamp(_8.sample(_9, _285, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _285 = clamp(_82 + (float2(-2.0, 0.0) * _7._m0.xy), _95, _96);
float3 _297 = float3(_11._m5) * clamp(_8.sample(_9, _285, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _301 = _12.sample(_13, _285, level(0.0));
float _302 = _301.y;
float3 _317;
if (_301.y > 0.0)
if (_302 > 0.0)
{
_317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * clamp(_301.y * _301.z, 0.0, 1.0));
_317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * clamp(_302 * _301.z, 0.0, 1.0));
}
else
{
_317 = _297;
}
float3 _321 = _275.xyz + (_317 * 0.5);
float3 _318 = _317 * 0.5;
float3 _321 = _275.xyz + _318;
float4 _322 = float4(_321.x, _321.y, _321.z, _275.w);
_28 _323 = _276;
_323._m0 = _322;
float2 _332 = clamp(_82 + (float3(-1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _344 = _11._m5 * clamp(_8.sample(_9, _332, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _332 = clamp(_82 + (float2(-1.0, 0.0) * _7._m0.xy), _95, _96);
float3 _344 = float3(_11._m5) * clamp(_8.sample(_9, _332, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _348 = _12.sample(_13, _332, level(0.0));
float _349 = _348.y;
float3 _364;
if (_348.y > 0.0)
if (_349 > 0.0)
{
_364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * clamp(_348.y * _348.z, 0.0, 1.0));
_364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * clamp(_349 * _348.z, 0.0, 1.0));
}
else
{
_364 = _344;
}
float3 _368 = _322.xyz + (_364 * 0.75);
float3 _365 = _364 * 0.75;
float3 _368 = _322.xyz + _365;
float4 _369 = float4(_368.x, _368.y, _368.z, _322.w);
_28 _370 = _323;
_370._m0 = _369;
float2 _379 = clamp(_82 + (float3(0.0, 0.0, 1.0).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _391 = _11._m5 * clamp(_8.sample(_9, _379, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _379 = clamp(_82, _95, _96);
float3 _391 = float3(_11._m5) * clamp(_8.sample(_9, _379, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _395 = _12.sample(_13, _379, level(0.0));
float _396 = _395.y;
float3 _411;
if (_395.y > 0.0)
if (_396 > 0.0)
{
_411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * clamp(_395.y * _395.z, 0.0, 1.0));
_411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * clamp(_396 * _395.z, 0.0, 1.0));
}
else
{
_411 = _391;
}
float3 _415 = _369.xyz + (_411 * 1.0);
float3 _412 = _411 * 1.0;
float3 _415 = _369.xyz + _412;
float4 _416 = float4(_415.x, _415.y, _415.z, _369.w);
_28 _417 = _370;
_417._m0 = _416;
float2 _426 = clamp(_82 + (float3(1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _438 = _11._m5 * clamp(_8.sample(_9, _426, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _426 = clamp(_82 + (float2(1.0, 0.0) * _7._m0.xy), _95, _96);
float3 _438 = float3(_11._m5) * clamp(_8.sample(_9, _426, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _442 = _12.sample(_13, _426, level(0.0));
float _443 = _442.y;
float3 _458;
if (_442.y > 0.0)
if (_443 > 0.0)
{
_458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * clamp(_442.y * _442.z, 0.0, 1.0));
_458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * clamp(_443 * _442.z, 0.0, 1.0));
}
else
{
_458 = _438;
}
float3 _462 = _416.xyz + (_458 * 0.75);
float3 _459 = _458 * 0.75;
float3 _462 = _416.xyz + _459;
float4 _463 = float4(_462.x, _462.y, _462.z, _416.w);
_28 _464 = _417;
_464._m0 = _463;
float2 _473 = clamp(_82 + (float3(2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _485 = _11._m5 * clamp(_8.sample(_9, _473, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _473 = clamp(_82 + (float2(2.0, 0.0) * _7._m0.xy), _95, _96);
float3 _485 = float3(_11._m5) * clamp(_8.sample(_9, _473, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _489 = _12.sample(_13, _473, level(0.0));
float _490 = _489.y;
float3 _505;
if (_489.y > 0.0)
if (_490 > 0.0)
{
_505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * clamp(_489.y * _489.z, 0.0, 1.0));
_505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * clamp(_490 * _489.z, 0.0, 1.0));
}
else
{
_505 = _485;
}
float3 _509 = _463.xyz + (_505 * 0.5);
float3 _506 = _505 * 0.5;
float3 _509 = _463.xyz + _506;
float4 _510 = float4(_509.x, _509.y, _509.z, _463.w);
_28 _511 = _464;
_511._m0 = _510;
float2 _520 = clamp(_82 + (float3(-1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _532 = _11._m5 * clamp(_8.sample(_9, _520, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _520 = clamp(_82 + (float2(-1.0, 1.0) * _7._m0.xy), _95, _96);
float3 _532 = float3(_11._m5) * clamp(_8.sample(_9, _520, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _536 = _12.sample(_13, _520, level(0.0));
float _537 = _536.y;
float3 _552;
if (_536.y > 0.0)
if (_537 > 0.0)
{
_552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * clamp(_536.y * _536.z, 0.0, 1.0));
_552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * clamp(_537 * _536.z, 0.0, 1.0));
}
else
{
_552 = _532;
}
float3 _556 = _510.xyz + (_552 * 0.5);
float3 _553 = _552 * 0.5;
float3 _556 = _510.xyz + _553;
float4 _557 = float4(_556.x, _556.y, _556.z, _510.w);
_28 _558 = _511;
_558._m0 = _557;
float2 _567 = clamp(_82 + (float3(0.0, 1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _579 = _11._m5 * clamp(_8.sample(_9, _567, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _567 = clamp(_82 + (float2(0.0, 1.0) * _7._m0.xy), _95, _96);
float3 _579 = float3(_11._m5) * clamp(_8.sample(_9, _567, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _583 = _12.sample(_13, _567, level(0.0));
float _584 = _583.y;
float3 _599;
if (_583.y > 0.0)
if (_584 > 0.0)
{
_599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * clamp(_583.y * _583.z, 0.0, 1.0));
_599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * clamp(_584 * _583.z, 0.0, 1.0));
}
else
{
_599 = _579;
}
float3 _603 = _557.xyz + (_599 * 0.75);
float3 _600 = _599 * 0.75;
float3 _603 = _557.xyz + _600;
float4 _604 = float4(_603.x, _603.y, _603.z, _557.w);
_28 _605 = _558;
_605._m0 = _604;
float2 _614 = clamp(_82 + (float3(1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _626 = _11._m5 * clamp(_8.sample(_9, _614, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _614 = clamp(_82 + _7._m0.xy, _95, _96);
float3 _626 = float3(_11._m5) * clamp(_8.sample(_9, _614, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _630 = _12.sample(_13, _614, level(0.0));
float _631 = _630.y;
float3 _646;
if (_630.y > 0.0)
if (_631 > 0.0)
{
_646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * clamp(_630.y * _630.z, 0.0, 1.0));
_646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * clamp(_631 * _630.z, 0.0, 1.0));
}
else
{
_646 = _626;
}
float3 _650 = _604.xyz + (_646 * 0.5);
float3 _647 = _646 * 0.5;
float3 _650 = _604.xyz + _647;
float4 _651 = float4(_650.x, _650.y, _650.z, _604.w);
_28 _652 = _605;
_652._m0 = _651;
float2 _661 = clamp(_82 + (float3(0.0, 2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw);
float3 _673 = _11._m5 * clamp(_8.sample(_9, _661, level(0.0)).w * _7._m1, 0.0, 1.0);
float2 _661 = clamp(_82 + (float2(0.0, 2.0) * _7._m0.xy), _95, _96);
float3 _673 = float3(_11._m5) * clamp(_8.sample(_9, _661, level(0.0)).w * _7._m1, 0.0, 1.0);
float4 _677 = _12.sample(_13, _661, level(0.0));
float _678 = _677.y;
float3 _693;
if (_677.y > 0.0)
if (_678 > 0.0)
{
_693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * clamp(_677.y * _677.z, 0.0, 1.0));
_693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * clamp(_678 * _677.z, 0.0, 1.0));
}
else
{
@ -308,10 +308,8 @@ fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buff
}
float3 _697 = _651.xyz + (_693 * 0.5);
float4 _698 = float4(_697.x, _697.y, _697.z, _651.w);
_28 _699 = _652;
_699._m0 = _698;
float3 _702 = _698.xyz / float3(((((((((((((0.0 + 0.5) + 0.5) + 0.75) + 0.5) + 0.5) + 0.75) + 1.0) + 0.75) + 0.5) + 0.5) + 0.75) + 0.5) + 0.5);
_28 _704 = _699;
float3 _702 = _698.xyz * float3(0.125);
_28 _704 = _74;
_704._m0 = float4(_702.x, _702.y, _702.z, _698.w);
_28 _705 = _704;
_705._m0.w = 1.0;

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