diff --git a/.ci/macos.sh b/.ci/macos.sh index 7beabe199a..0ae06761b0 100755 --- a/.ci/macos.sh +++ b/.ci/macos.sh @@ -5,7 +5,6 @@ mkdir build && cd build cmake .. -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_OSX_ARCHITECTURES="$TARGET" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DENABLE_QT_TRANSLATION=ON \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 162c2532a3..43e66b82f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -173,7 +173,7 @@ jobs: install: git make p7zip pacboy: >- toolchain:p ccache:p cmake:p ninja:p - qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p + qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p qt6-translations:p - name: Setup Vulkan SDK uses: humbletim/setup-vulkan-sdk@v1.2.0 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 19d59f685d..12c511b052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0092 NEW) # Enforce new LTO setting cmake_policy(SET CMP0069 NEW) +# Honor visibility properties for all targets +# Set the default so subdirectory cmake_minimum_required calls won't unset the policy. +cmake_policy(SET CMP0063 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") @@ -13,11 +17,25 @@ include(CMakeDependentOption) project(citra LANGUAGES C CXX ASM) -if (IOS) - # Enable searching CMAKE_PREFIX_PATH for bundled dependencies. - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) +if (APPLE) + # Silence warnings on empty objects, for example when platform-specific code is #ifdef'd out. + set(CMAKE_C_ARCHIVE_CREATE " Scr ") + set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") + set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") + set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") + + if (IOS) + # Minimum iOS 14 + set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0") + + # Enable searching CMAKE_PREFIX_PATH for bundled dependencies. + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) + else() + # Minimum macOS 11 + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") + endif() endif() if (CMAKE_BUILD_TYPE STREQUAL Debug) @@ -62,6 +80,7 @@ CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OFF) option(USE_SYSTEM_BOOST "Use the system Boost libs (instead of the bundled ones)" OFF) option(USE_SYSTEM_OPENSSL "Use the system OpenSSL libs (instead of the bundled LibreSSL)" OFF) +option(USE_SYSTEM_LIBUSB "Use the system libusb (instead of the bundled libusb)" OFF) if (CITRA_USE_PRECOMPILED_HEADERS) message(STATUS "Using Precompiled Headers.") @@ -183,6 +202,10 @@ add_definitions(-DBOOST_NO_CXX98_FUNCTION_BASE) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Apply consistent visibility settings. +set(CMAKE_CXX_VISIBILITY_PRESET default) +set(CMAKE_VISIBILITY_INLINES_HIDDEN NO) + # set up output paths for executable binaries set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$) @@ -210,19 +233,6 @@ if (ENABLE_QT) endif() endif() -# Ensure libusb is properly configured (based on dolphin libusb include) -if (ENABLE_LIBUSB) - if(NOT APPLE) - include(FindPkgConfig) - find_package(LibUSB) - endif() - if (NOT LIBUSB_FOUND) - add_subdirectory(externals/libusb) - set(LIBUSB_INCLUDE_DIR "") - set(LIBUSB_LIBRARIES usb) - endif() -endif() - # Use system tsl::robin_map if available (otherwise we fallback to version bundled with dynarmic) find_package(tsl-robin-map QUIET) @@ -352,11 +362,6 @@ endif() enable_testing() add_subdirectory(externals) -# See externals/CMakeLists.txt -foreach(def ${CRYPTOPP_COMPILE_DEFINITIONS}) - add_definitions(-D${def}) -endforeach() - # Boost if (USE_SYSTEM_BOOST) find_package(Boost 1.70.0 COMPONENTS serialization iostreams REQUIRED) @@ -375,6 +380,11 @@ if (ENABLE_SDL2 AND USE_SYSTEM_SDL2) add_library(SDL2::SDL2 ALIAS SDL2) endif() +if (ENABLE_LIBUSB AND USE_SYSTEM_LIBUSB) + include(FindPkgConfig) + find_package(LibUSB) +endif() + add_subdirectory(src) add_subdirectory(dist/installer) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 79c7d57e42..4406c3d660 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -4,7 +4,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") add_compile_options(/W0) else() - add_compile_options(-Wno-error) + add_compile_options(-w) endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) @@ -12,9 +12,9 @@ include(DownloadExternals) include(ExternalProject) # Boost -set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost") -set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost") -set(Boost_NO_SYSTEM_PATHS ON) +set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "") +set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "") +set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "") add_library(boost INTERFACE) target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR}) @@ -35,23 +35,17 @@ target_link_libraries(boost_iostreams PUBLIC boost) # Add additional boost libs here; remember to ALIAS them in the root CMakeLists! # Catch2 -set(CATCH_INSTALL_DOCS OFF) -set(CATCH_INSTALL_EXTRAS OFF) +set(CATCH_INSTALL_DOCS OFF CACHE BOOL "") +set(CATCH_INSTALL_EXTRAS OFF CACHE BOOL "") add_subdirectory(catch2) # Crypto++ -set(CRYPTOPP_BUILD_DOCUMENTATION OFF) -set(CRYPTOPP_BUILD_TESTING OFF) -set(CRYPTOPP_INSTALL OFF) -set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp") +set(CRYPTOPP_BUILD_DOCUMENTATION OFF CACHE BOOL "") +set(CRYPTOPP_BUILD_TESTING OFF CACHE BOOL "") +set(CRYPTOPP_INSTALL OFF CACHE BOOL "") +set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp" CACHE STRING "") add_subdirectory(cryptopp-cmake) -# HACK: Mismatch between compilation of CryptoPP and headers used in Citra can cause runtime issues. -# Pull out the compile definitions from CryptoPP and apply them to Citra as well to fix this. -# See: https://github.com/weidai11/cryptopp/issues/1191 -get_source_file_property(CRYPTOPP_COMPILE_DEFINITIONS ${CRYPTOPP_SOURCES}/cryptlib.cpp TARGET_DIRECTORY cryptopp COMPILE_DEFINITIONS) -set(CRYPTOPP_COMPILE_DEFINITIONS ${CRYPTOPP_COMPILE_DEFINITIONS} PARENT_SCOPE) - # HACK: The logic to set up the base include directory for CryptoPP does not work with Android SDK CMake 3.22.1. # Until there is a fixed version available, this code will detect and add in the proper include if it does not exist. if(ANDROID) @@ -82,8 +76,8 @@ endif() # Dynarmic if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE) - set(DYNARMIC_TESTS OFF) - set(DYNARMIC_FRONTENDS "A32") + set(DYNARMIC_TESTS OFF CACHE BOOL "") + set(DYNARMIC_FRONTENDS "A32" CACHE STRING "") add_subdirectory(dynarmic EXCLUDE_FROM_ALL) endif() @@ -96,10 +90,11 @@ endif() add_subdirectory(glad) # glslang -set(SKIP_GLSLANG_INSTALL ON) -set(ENABLE_GLSLANG_BINARIES OFF) -set(ENABLE_SPVREMAPPER OFF) -set(ENABLE_CTEST OFF) +set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "") +set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "") +set(ENABLE_SPVREMAPPER OFF CACHE BOOL "") +set(ENABLE_CTEST OFF CACHE BOOL "") +set(ENABLE_HLSL OFF CACHE BOOL "") add_subdirectory(glslang) # inih @@ -107,15 +102,14 @@ add_subdirectory(inih) # MicroProfile add_library(microprofile INTERFACE) -target_include_directories(microprofile INTERFACE ./microprofile) +target_include_directories(microprofile SYSTEM INTERFACE ./microprofile) # Nihstro add_library(nihstro-headers INTERFACE) -target_include_directories(nihstro-headers INTERFACE ./nihstro/include) +target_include_directories(nihstro-headers SYSTEM INTERFACE ./nihstro/include) if (MSVC) - target_compile_options(nihstro-headers INTERFACE /W0) -else() - target_compile_options(nihstro-headers INTERFACE -Wno-error) + # TODO: For some reason MSVC still applies this warning even with /W0 for externals. + target_compile_options(nihstro-headers INTERFACE /wd4715) endif() # Open Source Archives @@ -141,6 +135,13 @@ if (ENABLE_SDL2 AND NOT USE_SYSTEM_SDL2) add_subdirectory(sdl2) endif() +# libusb +if (ENABLE_LIBUSB AND NOT USE_SYSTEM_LIBUSB) + add_subdirectory(libusb) + set(LIBUSB_INCLUDE_DIR "" PARENT_SCOPE) + set(LIBUSB_LIBRARIES usb PARENT_SCOPE) +endif() + # Zstandard set(ZSTD_LEGACY_SUPPORT OFF) set(ZSTD_BUILD_PROGRAMS OFF) @@ -204,11 +205,6 @@ if (ENABLE_WEB_SERVICE) add_library(cpp-jwt INTERFACE) target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include) target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON) - if (MSVC) - target_compile_options(cpp-jwt INTERFACE /W0) - else() - target_compile_options(cpp-jwt INTERFACE -Wno-error) - endif() endif() # lodepng @@ -236,8 +232,8 @@ endif() # VMA add_library(vma INTERFACE) -target_include_directories(vma INTERFACE ./vma/include) +target_include_directories(vma SYSTEM INTERFACE ./vma/include) # vulkan-headers add_library(vulkan-headers INTERFACE) -target_include_directories(vulkan-headers INTERFACE ./vulkan-headers/include) +target_include_directories(vulkan-headers SYSTEM INTERFACE ./vulkan-headers/include) diff --git a/externals/library-headers/library-headers b/externals/library-headers/library-headers index 071bc4282c..3b3e28dbe6 160000 --- a/externals/library-headers/library-headers +++ b/externals/library-headers/library-headers @@ -1 +1 @@ -Subproject commit 071bc4282ca29ec255ab2dae32c978481ca5dfea +Subproject commit 3b3e28dbe6d033395ce2967fa8030825e7b89de7 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acfc1d7d91..e22cb211ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -40,7 +40,6 @@ if (MSVC) /Zo /permissive- /EHsc - /std:c++latest /utf-8 /volatile:iso /Zc:externConstexpr diff --git a/src/audio_core/dsp_interface.h b/src/audio_core/dsp_interface.h index d24d7fc330..2c99f71cc3 100644 --- a/src/audio_core/dsp_interface.h +++ b/src/audio_core/dsp_interface.h @@ -65,7 +65,7 @@ public: * @param length the number of bytes to read. The max is 65,535 (max of u16). * @returns a vector of bytes from the specified pipe. On error, will be empty. */ - virtual std::vector PipeRead(DspPipe pipe_number, u32 length) = 0; + virtual std::vector PipeRead(DspPipe pipe_number, std::size_t length) = 0; /** * How much data is left in pipe diff --git a/src/audio_core/hle/hle.cpp b/src/audio_core/hle/hle.cpp index de42c13bc6..964477ed35 100644 --- a/src/audio_core/hle/hle.cpp +++ b/src/audio_core/hle/hle.cpp @@ -64,7 +64,7 @@ public: u16 RecvData(u32 register_number); bool RecvDataIsReady(u32 register_number) const; - std::vector PipeRead(DspPipe pipe_number, u32 length); + std::vector PipeRead(DspPipe pipe_number, std::size_t length); std::size_t GetPipeReadableSize(DspPipe pipe_number) const; void PipeWrite(DspPipe pipe_number, const std::vector& buffer); @@ -202,7 +202,7 @@ bool DspHle::Impl::RecvDataIsReady(u32 register_number) const { return true; } -std::vector DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) { +std::vector DspHle::Impl::PipeRead(DspPipe pipe_number, std::size_t length) { const std::size_t pipe_index = static_cast(pipe_number); if (pipe_index >= num_dsp_pipe) { @@ -486,7 +486,7 @@ void DspHle::SetSemaphore(u16 semaphore_value) { // Do nothing in HLE } -std::vector DspHle::PipeRead(DspPipe pipe_number, u32 length) { +std::vector DspHle::PipeRead(DspPipe pipe_number, std::size_t length) { return impl->PipeRead(pipe_number, length); } diff --git a/src/audio_core/hle/hle.h b/src/audio_core/hle/hle.h index 014a3b73c7..ff0ac4781a 100644 --- a/src/audio_core/hle/hle.h +++ b/src/audio_core/hle/hle.h @@ -28,7 +28,7 @@ public: u16 RecvData(u32 register_number) override; bool RecvDataIsReady(u32 register_number) const override; void SetSemaphore(u16 semaphore_value) override; - std::vector PipeRead(DspPipe pipe_number, u32 length) override; + std::vector PipeRead(DspPipe pipe_number, std::size_t length) override; std::size_t GetPipeReadableSize(DspPipe pipe_number) const override; void PipeWrite(DspPipe pipe_number, const std::vector& buffer) override; diff --git a/src/audio_core/lle/lle.cpp b/src/audio_core/lle/lle.cpp index f644e75413..884ae80d4e 100644 --- a/src/audio_core/lle/lle.cpp +++ b/src/audio_core/lle/lle.cpp @@ -392,7 +392,7 @@ void DspLle::SetSemaphore(u16 semaphore_value) { impl->teakra.SetSemaphore(semaphore_value); } -std::vector DspLle::PipeRead(DspPipe pipe_number, u32 length) { +std::vector DspLle::PipeRead(DspPipe pipe_number, std::size_t length) { return impl->ReadPipe(static_cast(pipe_number), static_cast(length)); } diff --git a/src/audio_core/lle/lle.h b/src/audio_core/lle/lle.h index e3c3ab82b8..4b3f62bc98 100644 --- a/src/audio_core/lle/lle.h +++ b/src/audio_core/lle/lle.h @@ -20,7 +20,7 @@ public: u16 RecvData(u32 register_number) override; bool RecvDataIsReady(u32 register_number) const override; void SetSemaphore(u16 semaphore_value) override; - std::vector PipeRead(DspPipe pipe_number, u32 length) override; + std::vector PipeRead(DspPipe pipe_number, std::size_t length) override; std::size_t GetPipeReadableSize(DspPipe pipe_number) const override; void PipeWrite(DspPipe pipe_number, const std::vector& buffer) override; diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index f23b185556..9c0f4cf72b 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -290,6 +290,11 @@ elseif(WIN32) endif() endif() +if(ENABLE_SDL2) + target_link_libraries(citra-qt PRIVATE SDL2::SDL2) + target_compile_definitions(citra-qt PRIVATE HAVE_SDL2) +endif() + create_target_directory_groups(citra-qt) target_link_libraries(citra-qt PRIVATE audio_core citra_common citra_core input_common network video_core) diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index bce0f64026..8997b45676 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -26,7 +26,7 @@ void HotkeyRegistry::SaveHotkeys() { void HotkeyRegistry::LoadHotkeys() { // Make sure NOT to use a reference here because it would become invalid once we call // beginGroup() - for (const auto shortcut : UISettings::values.shortcuts) { + for (auto shortcut : UISettings::values.shortcuts) { Hotkey& hk = hotkey_groups[shortcut.group][shortcut.name]; if (!shortcut.shortcut.keyseq.isEmpty()) { hk.keyseq = diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 4f889cf224..24b94af702 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -115,6 +115,10 @@ __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; } #endif +#ifdef HAVE_SDL2 +#include +#endif + constexpr int default_mouse_timeout = 2500; /** @@ -967,7 +971,7 @@ void GMainWindow::ShowUpdaterWidgets() { } #endif -#if defined(__unix__) && !defined(__APPLE__) +#if defined(HAVE_SDL2) && defined(__unix__) && !defined(__APPLE__) static std::optional HoldWakeLockLinux(u32 window_id = 0) { if (!QDBusConnection::sessionBus().isConnected()) { return {}; @@ -1013,12 +1017,12 @@ void GMainWindow::PreventOSSleep() { SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); #elif defined(HAVE_SDL2) SDL_DisableScreenSaver(); -#ifdef __unix__ +#if defined(__unix__) && !defined(__APPLE__) auto reply = HoldWakeLockLinux(winId()); if (reply) { wake_lock = std::move(reply.value()); } -#endif // __unix__ +#endif // defined(__unix__) && !defined(__APPLE__) #endif // _WIN32 } @@ -1027,11 +1031,11 @@ void GMainWindow::AllowOSSleep() { SetThreadExecutionState(ES_CONTINUOUS); #elif defined(HAVE_SDL2) SDL_EnableScreenSaver(); -#ifdef __unix__ +#if defined(__unix__) && !defined(__APPLE__) if (!wake_lock.path().isEmpty()) { ReleaseWakeLockLinux(wake_lock); } -#endif // __unix__ +#endif // defined(__unix__) && !defined(__APPLE__) #endif // _WIN32 } diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 19a52263c6..09b24770f1 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -33,7 +33,6 @@ std::string_view GetAudioEmulationName(AudioEmulation emulation) { default: return "Invalid"; } - UNREACHABLE(); }; std::string_view GetGraphicsAPIName(GraphicsAPI api) { @@ -45,7 +44,6 @@ std::string_view GetGraphicsAPIName(GraphicsAPI api) { default: return "Invalid"; } - UNREACHABLE(); } std::string_view GetTextureFilterName(TextureFilter filter) { @@ -67,7 +65,6 @@ std::string_view GetTextureFilterName(TextureFilter filter) { default: return "Invalid"; } - UNREACHABLE(); } } // Anonymous namespace diff --git a/src/tests/audio_core/audio_fixures.h b/src/tests/audio_core/audio_fixures.h index 58147b6fd7..10de2a9cab 100644 --- a/src/tests/audio_core/audio_fixures.h +++ b/src/tests/audio_core/audio_fixures.h @@ -3,10 +3,12 @@ // Refer to the license.txt file included. #pragma once + #include +#include "common/common_types.h" constexpr int fixure_buffer_size = 41; constexpr std::array fixure_buffer[41] = { - 0xff, 0xf1, 0x4c, 0x80, 0x05, 0x3f, 0xfc, 0x21, 0x1a, 0x4e, 0xb0, 0x00, 0x00, 0x00, - 0x05, 0xfc, 0x4e, 0x1f, 0x08, 0x88, 0x00, 0x00, 0x00, 0xc4, 0x1a, 0x03, 0xfc, 0x9c, - 0x3e, 0x1d, 0x08, 0x84, 0x03, 0xd8, 0x3f, 0xe4, 0xe1, 0x20, 0x00, 0x0b, 0x38}; + {0xff, 0xf1, 0x4c, 0x80, 0x05, 0x3f, 0xfc, 0x21, 0x1a, 0x4e, 0xb0, 0x00, 0x00, 0x00, + 0x05, 0xfc, 0x4e, 0x1f, 0x08, 0x88, 0x00, 0x00, 0x00, 0xc4, 0x1a, 0x03, 0xfc, 0x9c, + 0x3e, 0x1d, 0x08, 0x84, 0x03, 0xd8, 0x3f, 0xe4, 0xe1, 0x20, 0x00, 0x0b, 0x38}}; diff --git a/src/tests/core/hle/kernel/hle_ipc.cpp b/src/tests/core/hle/kernel/hle_ipc.cpp index a0711f1cf4..2cb3557669 100644 --- a/src/tests/core/hle/kernel/hle_ipc.cpp +++ b/src/tests/core/hle/kernel/hle_ipc.cpp @@ -168,6 +168,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel VAddr target_address = 0x10000000; auto result = process->vm_manager.MapBackingMemory( target_address, buffer, static_cast(buffer.GetSize()), MemoryState::Private); + REQUIRE(result.Code() == RESULT_SUCCESS); const u32_le input[]{ IPC::MakeHeader(0, 0, 2), diff --git a/src/video_core/host_shaders/format_reinterpreter/d24s8_to_rgba8.frag b/src/video_core/host_shaders/format_reinterpreter/d24s8_to_rgba8.frag index 17c8e77f7b..8921ac0e74 100644 --- a/src/video_core/host_shaders/format_reinterpreter/d24s8_to_rgba8.frag +++ b/src/video_core/host_shaders/format_reinterpreter/d24s8_to_rgba8.frag @@ -4,6 +4,9 @@ //? #version 430 core +precision highp int; +precision highp float; + layout(location = 0) in mediump vec2 tex_coord; layout(location = 0) out lowp vec4 frag_color; diff --git a/src/video_core/host_shaders/format_reinterpreter/rgba4_to_rgb5a1.frag b/src/video_core/host_shaders/format_reinterpreter/rgba4_to_rgb5a1.frag index 99ca820da4..ce2bef2c76 100644 --- a/src/video_core/host_shaders/format_reinterpreter/rgba4_to_rgb5a1.frag +++ b/src/video_core/host_shaders/format_reinterpreter/rgba4_to_rgb5a1.frag @@ -4,6 +4,9 @@ //? #version 430 core +precision highp int; +precision highp float; + layout(location = 0) in mediump vec2 tex_coord; layout(location = 0) out lowp vec4 frag_color; diff --git a/src/video_core/renderer_opengl/gl_texture_runtime.cpp b/src/video_core/renderer_opengl/gl_texture_runtime.cpp index e9c6816fb8..6f09de2765 100644 --- a/src/video_core/renderer_opengl/gl_texture_runtime.cpp +++ b/src/video_core/renderer_opengl/gl_texture_runtime.cpp @@ -681,8 +681,8 @@ Sampler::Sampler(TextureRuntime&, VideoCore::SamplerParams params) { const GLenum wrap_s = PicaToGL::WrapMode(params.wrap_s); const GLenum wrap_t = PicaToGL::WrapMode(params.wrap_t); const Common::Vec4f gl_color = PicaToGL::ColorRGBA8(params.border_color); - const float lod_min = params.lod_min; - const float lod_max = params.lod_max; + const auto lod_min = static_cast(params.lod_min); + const auto lod_max = static_cast(params.lod_max); sampler.Create(); @@ -706,7 +706,8 @@ DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f, std::string_view if (!Settings::values.renderer_debug) { return; } - glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, local_scope_depth, label.size(), label.data()); + glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, local_scope_depth, + static_cast(label.size()), label.data()); } DebugScope::~DebugScope() { diff --git a/src/video_core/renderer_software/sw_rasterizer.cpp b/src/video_core/renderer_software/sw_rasterizer.cpp index 7509aa29e1..d4c26e4967 100644 --- a/src/video_core/renderer_software/sw_rasterizer.cpp +++ b/src/video_core/renderer_software/sw_rasterizer.cpp @@ -292,11 +292,6 @@ void RasterizerSoftware::ProcessTriangle(const Vertex& v0, const Vertex& v1, con auto textures = regs.texturing.GetTextures(); const auto tev_stages = regs.texturing.GetTevStages(); - const bool stencil_action_enable = - regs.framebuffer.output_merger.stencil_test.enable && - regs.framebuffer.framebuffer.depth_format == FramebufferRegs::DepthFormat::D24S8; - const auto stencil_test = regs.framebuffer.output_merger.stencil_test; - // Enter rasterization loop, starting at the center of the topleft bounding box corner. // TODO: Not sure if looping through x first might be faster for (u16 y = min_y + 8; y < max_y; y += 0x10) { @@ -446,7 +441,7 @@ void RasterizerSoftware::ProcessTriangle(const Vertex& v0, const Vertex& v1, con continue; } WriteFog(combiner_output, depth); - if (!DoDepthStencilTest(x, y, depth, stencil_action_enable)) { + if (!DoDepthStencilTest(x, y, depth)) { continue; } const auto result = PixelColor(x, y, combiner_output); @@ -828,11 +823,14 @@ bool RasterizerSoftware::DoAlphaTest(u8 alpha) const { return alpha > output_merger.alpha_test.ref; case FramebufferRegs::CompareFunc::GreaterThanOrEqual: return alpha >= output_merger.alpha_test.ref; + default: + LOG_CRITICAL(Render_Software, "Unknown alpha test condition {}", + output_merger.alpha_test.func.Value()); + return false; } } -bool RasterizerSoftware::DoDepthStencilTest(u16 x, u16 y, float depth, - bool stencil_action_enable) const { +bool RasterizerSoftware::DoDepthStencilTest(u16 x, u16 y, float depth) const { const auto& framebuffer = regs.framebuffer.framebuffer; const auto stencil_test = regs.framebuffer.output_merger.stencil_test; u8 old_stencil = 0; @@ -847,6 +845,10 @@ bool RasterizerSoftware::DoDepthStencilTest(u16 x, u16 y, float depth, } }; + const bool stencil_action_enable = + regs.framebuffer.output_merger.stencil_test.enable && + regs.framebuffer.framebuffer.depth_format == FramebufferRegs::DepthFormat::D24S8; + if (stencil_action_enable) { old_stencil = fb.GetStencil(x >> 4, y >> 4); const u8 dest = old_stencil & stencil_test.input_mask; diff --git a/src/video_core/renderer_software/sw_rasterizer.h b/src/video_core/renderer_software/sw_rasterizer.h index 71b5018504..f31f605269 100644 --- a/src/video_core/renderer_software/sw_rasterizer.h +++ b/src/video_core/renderer_software/sw_rasterizer.h @@ -68,7 +68,7 @@ private: bool DoAlphaTest(u8 alpha) const; /// Performs the depth stencil test. Returns false if the test failed. - bool DoDepthStencilTest(u16 x, u16 y, float depth, bool stencil_action_enable) const; + bool DoDepthStencilTest(u16 x, u16 y, float depth) const; private: Memory::MemorySystem& memory; diff --git a/src/video_core/renderer_vulkan/vk_instance.h b/src/video_core/renderer_vulkan/vk_instance.h index dc5c07d3db..d7aa2b26e3 100644 --- a/src/video_core/renderer_vulkan/vk_instance.h +++ b/src/video_core/renderer_vulkan/vk_instance.h @@ -281,7 +281,6 @@ private: bool pipeline_creation_cache_control{}; bool shader_stencil_export{}; bool debug_messenger_supported{}; - bool debug_report_supported{}; }; } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_platform.cpp b/src/video_core/renderer_vulkan/vk_platform.cpp index dafb86a8dc..887b586c2d 100644 --- a/src/video_core/renderer_vulkan/vk_platform.cpp +++ b/src/video_core/renderer_vulkan/vk_platform.cpp @@ -99,10 +99,10 @@ std::shared_ptr OpenLibrary() { auto library = std::make_shared(); #ifdef __APPLE__ const std::string filename = Common::DynamicLibrary::GetLibraryName("vulkan"); - library->Load(filename); - if (!library->IsLoaded()) { + if (!library->Load(filename)) { // Fall back to directly loading bundled MoltenVK library. - library->Load("libMoltenVK.dylib"); + const std::string mvk_filename = Common::DynamicLibrary::GetLibraryName("MoltenVK"); + void(library->Load(mvk_filename)); } #else std::string filename = Common::DynamicLibrary::GetLibraryName("vulkan", 1); diff --git a/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp b/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp index a064a7ce03..4e4d50d227 100644 --- a/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp @@ -1497,7 +1497,6 @@ void FragmentModule::DefineInterface() { // Define shadow textures shadow_texture_px_id = DefineUniformConst(image_r32_id, 2, 0, true); - shadow_buffer_id = DefineUniformConst(image_r32_id, 2, 6); // Define built-ins gl_frag_coord_id = DefineVar(vec_ids.Get(4), spv::StorageClass::Input); diff --git a/src/video_core/renderer_vulkan/vk_shader_gen_spv.h b/src/video_core/renderer_vulkan/vk_shader_gen_spv.h index c23a0a9ed4..98631423f5 100644 --- a/src/video_core/renderer_vulkan/vk_shader_gen_spv.h +++ b/src/video_core/renderer_vulkan/vk_shader_gen_spv.h @@ -256,13 +256,7 @@ private: Id texture_buffer_lut_lf_id{}; Id texture_buffer_lut_rg_id{}; Id texture_buffer_lut_rgba_id{}; - Id shadow_buffer_id{}; Id shadow_texture_px_id{}; - Id shadow_texture_nx_id{}; - Id shadow_texture_py_id{}; - Id shadow_texture_ny_id{}; - Id shadow_texture_pz_id{}; - Id shadow_texture_nz_id{}; Id texture_buffer_lut_lf{}; Id texture_buffer_lut_rg{};