citra-emu
/
citra-canary
Archived
1
0
Fork 0

build: Clear out remaining compile warnings. (#6662)

This commit is contained in:
Steveice10 2023-07-04 21:00:24 -07:00 committed by GitHub
parent 2126c240cd
commit 13a8969824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 117 additions and 103 deletions

View File

@ -5,7 +5,6 @@ mkdir build && cd build
cmake .. -GNinja \ cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES="$TARGET" \ -DCMAKE_OSX_ARCHITECTURES="$TARGET" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DENABLE_QT_TRANSLATION=ON \ -DENABLE_QT_TRANSLATION=ON \

View File

@ -173,7 +173,7 @@ jobs:
install: git make p7zip install: git make p7zip
pacboy: >- pacboy: >-
toolchain:p ccache:p cmake:p ninja:p 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 - name: Setup Vulkan SDK
uses: humbletim/setup-vulkan-sdk@v1.2.0 uses: humbletim/setup-vulkan-sdk@v1.2.0
with: with:

View File

@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0092 NEW) cmake_policy(SET CMP0092 NEW)
# Enforce new LTO setting # Enforce new LTO setting
cmake_policy(SET CMP0069 NEW) 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}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
@ -13,11 +17,25 @@ include(CMakeDependentOption)
project(citra LANGUAGES C CXX ASM) project(citra LANGUAGES C CXX ASM)
if (IOS) if (APPLE)
# Silence warnings on empty objects, for example when platform-specific code is #ifdef'd out.
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
if (IOS)
# Minimum iOS 14
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")
# Enable searching CMAKE_PREFIX_PATH for bundled dependencies. # Enable searching CMAKE_PREFIX_PATH for bundled dependencies.
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
else()
# Minimum macOS 11
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
endif()
endif() endif()
if (CMAKE_BUILD_TYPE STREQUAL Debug) 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_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_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_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) if (CITRA_USE_PRECOMPILED_HEADERS)
message(STATUS "Using 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 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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 up output paths for executable binaries
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$<CONFIG>) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$<CONFIG>)
@ -210,19 +233,6 @@ if (ENABLE_QT)
endif() endif()
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) # Use system tsl::robin_map if available (otherwise we fallback to version bundled with dynarmic)
find_package(tsl-robin-map QUIET) find_package(tsl-robin-map QUIET)
@ -352,11 +362,6 @@ endif()
enable_testing() enable_testing()
add_subdirectory(externals) add_subdirectory(externals)
# See externals/CMakeLists.txt
foreach(def ${CRYPTOPP_COMPILE_DEFINITIONS})
add_definitions(-D${def})
endforeach()
# Boost # Boost
if (USE_SYSTEM_BOOST) if (USE_SYSTEM_BOOST)
find_package(Boost 1.70.0 COMPONENTS serialization iostreams REQUIRED) 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) add_library(SDL2::SDL2 ALIAS SDL2)
endif() endif()
if (ENABLE_LIBUSB AND USE_SYSTEM_LIBUSB)
include(FindPkgConfig)
find_package(LibUSB)
endif()
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(dist/installer) add_subdirectory(dist/installer)

View File

@ -4,7 +4,7 @@
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/W0) add_compile_options(/W0)
else() else()
add_compile_options(-Wno-error) add_compile_options(-w)
endif() endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
@ -12,9 +12,9 @@ include(DownloadExternals)
include(ExternalProject) include(ExternalProject)
# Boost # Boost
set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost") set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "")
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost") set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "")
set(Boost_NO_SYSTEM_PATHS ON) set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "")
add_library(boost INTERFACE) add_library(boost INTERFACE)
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR}) 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! # Add additional boost libs here; remember to ALIAS them in the root CMakeLists!
# Catch2 # Catch2
set(CATCH_INSTALL_DOCS OFF) set(CATCH_INSTALL_DOCS OFF CACHE BOOL "")
set(CATCH_INSTALL_EXTRAS OFF) set(CATCH_INSTALL_EXTRAS OFF CACHE BOOL "")
add_subdirectory(catch2) add_subdirectory(catch2)
# Crypto++ # Crypto++
set(CRYPTOPP_BUILD_DOCUMENTATION OFF) set(CRYPTOPP_BUILD_DOCUMENTATION OFF CACHE BOOL "")
set(CRYPTOPP_BUILD_TESTING OFF) set(CRYPTOPP_BUILD_TESTING OFF CACHE BOOL "")
set(CRYPTOPP_INSTALL OFF) set(CRYPTOPP_INSTALL OFF CACHE BOOL "")
set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp") set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp" CACHE STRING "")
add_subdirectory(cryptopp-cmake) 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. # 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. # Until there is a fixed version available, this code will detect and add in the proper include if it does not exist.
if(ANDROID) if(ANDROID)
@ -82,8 +76,8 @@ endif()
# Dynarmic # Dynarmic
if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE) if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE)
set(DYNARMIC_TESTS OFF) set(DYNARMIC_TESTS OFF CACHE BOOL "")
set(DYNARMIC_FRONTENDS "A32") set(DYNARMIC_FRONTENDS "A32" CACHE STRING "")
add_subdirectory(dynarmic EXCLUDE_FROM_ALL) add_subdirectory(dynarmic EXCLUDE_FROM_ALL)
endif() endif()
@ -96,10 +90,11 @@ endif()
add_subdirectory(glad) add_subdirectory(glad)
# glslang # glslang
set(SKIP_GLSLANG_INSTALL ON) set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
set(ENABLE_GLSLANG_BINARIES OFF) set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
set(ENABLE_SPVREMAPPER OFF) set(ENABLE_SPVREMAPPER OFF CACHE BOOL "")
set(ENABLE_CTEST OFF) set(ENABLE_CTEST OFF CACHE BOOL "")
set(ENABLE_HLSL OFF CACHE BOOL "")
add_subdirectory(glslang) add_subdirectory(glslang)
# inih # inih
@ -107,15 +102,14 @@ add_subdirectory(inih)
# MicroProfile # MicroProfile
add_library(microprofile INTERFACE) add_library(microprofile INTERFACE)
target_include_directories(microprofile INTERFACE ./microprofile) target_include_directories(microprofile SYSTEM INTERFACE ./microprofile)
# Nihstro # Nihstro
add_library(nihstro-headers INTERFACE) add_library(nihstro-headers INTERFACE)
target_include_directories(nihstro-headers INTERFACE ./nihstro/include) target_include_directories(nihstro-headers SYSTEM INTERFACE ./nihstro/include)
if (MSVC) if (MSVC)
target_compile_options(nihstro-headers INTERFACE /W0) # TODO: For some reason MSVC still applies this warning even with /W0 for externals.
else() target_compile_options(nihstro-headers INTERFACE /wd4715)
target_compile_options(nihstro-headers INTERFACE -Wno-error)
endif() endif()
# Open Source Archives # Open Source Archives
@ -141,6 +135,13 @@ if (ENABLE_SDL2 AND NOT USE_SYSTEM_SDL2)
add_subdirectory(sdl2) add_subdirectory(sdl2)
endif() 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 # Zstandard
set(ZSTD_LEGACY_SUPPORT OFF) set(ZSTD_LEGACY_SUPPORT OFF)
set(ZSTD_BUILD_PROGRAMS OFF) set(ZSTD_BUILD_PROGRAMS OFF)
@ -204,11 +205,6 @@ if (ENABLE_WEB_SERVICE)
add_library(cpp-jwt INTERFACE) add_library(cpp-jwt INTERFACE)
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include) target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON) 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() endif()
# lodepng # lodepng
@ -236,8 +232,8 @@ endif()
# VMA # VMA
add_library(vma INTERFACE) add_library(vma INTERFACE)
target_include_directories(vma INTERFACE ./vma/include) target_include_directories(vma SYSTEM INTERFACE ./vma/include)
# vulkan-headers # vulkan-headers
add_library(vulkan-headers INTERFACE) add_library(vulkan-headers INTERFACE)
target_include_directories(vulkan-headers INTERFACE ./vulkan-headers/include) target_include_directories(vulkan-headers SYSTEM INTERFACE ./vulkan-headers/include)

@ -1 +1 @@
Subproject commit 071bc4282ca29ec255ab2dae32c978481ca5dfea Subproject commit 3b3e28dbe6d033395ce2967fa8030825e7b89de7

View File

@ -40,7 +40,6 @@ if (MSVC)
/Zo /Zo
/permissive- /permissive-
/EHsc /EHsc
/std:c++latest
/utf-8 /utf-8
/volatile:iso /volatile:iso
/Zc:externConstexpr /Zc:externConstexpr

View File

@ -65,7 +65,7 @@ public:
* @param length the number of bytes to read. The max is 65,535 (max of u16). * @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. * @returns a vector of bytes from the specified pipe. On error, will be empty.
*/ */
virtual std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) = 0; virtual std::vector<u8> PipeRead(DspPipe pipe_number, std::size_t length) = 0;
/** /**
* How much data is left in pipe * How much data is left in pipe

View File

@ -64,7 +64,7 @@ public:
u16 RecvData(u32 register_number); u16 RecvData(u32 register_number);
bool RecvDataIsReady(u32 register_number) const; bool RecvDataIsReady(u32 register_number) const;
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length); std::vector<u8> PipeRead(DspPipe pipe_number, std::size_t length);
std::size_t GetPipeReadableSize(DspPipe pipe_number) const; std::size_t GetPipeReadableSize(DspPipe pipe_number) const;
void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer); void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer);
@ -202,7 +202,7 @@ bool DspHle::Impl::RecvDataIsReady(u32 register_number) const {
return true; return true;
} }
std::vector<u8> DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) { std::vector<u8> DspHle::Impl::PipeRead(DspPipe pipe_number, std::size_t length) {
const std::size_t pipe_index = static_cast<std::size_t>(pipe_number); const std::size_t pipe_index = static_cast<std::size_t>(pipe_number);
if (pipe_index >= num_dsp_pipe) { if (pipe_index >= num_dsp_pipe) {
@ -486,7 +486,7 @@ void DspHle::SetSemaphore(u16 semaphore_value) {
// Do nothing in HLE // Do nothing in HLE
} }
std::vector<u8> DspHle::PipeRead(DspPipe pipe_number, u32 length) { std::vector<u8> DspHle::PipeRead(DspPipe pipe_number, std::size_t length) {
return impl->PipeRead(pipe_number, length); return impl->PipeRead(pipe_number, length);
} }

View File

@ -28,7 +28,7 @@ public:
u16 RecvData(u32 register_number) override; u16 RecvData(u32 register_number) override;
bool RecvDataIsReady(u32 register_number) const override; bool RecvDataIsReady(u32 register_number) const override;
void SetSemaphore(u16 semaphore_value) override; void SetSemaphore(u16 semaphore_value) override;
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) override; std::vector<u8> PipeRead(DspPipe pipe_number, std::size_t length) override;
std::size_t GetPipeReadableSize(DspPipe pipe_number) const override; std::size_t GetPipeReadableSize(DspPipe pipe_number) const override;
void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) override; void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) override;

View File

@ -392,7 +392,7 @@ void DspLle::SetSemaphore(u16 semaphore_value) {
impl->teakra.SetSemaphore(semaphore_value); impl->teakra.SetSemaphore(semaphore_value);
} }
std::vector<u8> DspLle::PipeRead(DspPipe pipe_number, u32 length) { std::vector<u8> DspLle::PipeRead(DspPipe pipe_number, std::size_t length) {
return impl->ReadPipe(static_cast<u8>(pipe_number), static_cast<u16>(length)); return impl->ReadPipe(static_cast<u8>(pipe_number), static_cast<u16>(length));
} }

View File

@ -20,7 +20,7 @@ public:
u16 RecvData(u32 register_number) override; u16 RecvData(u32 register_number) override;
bool RecvDataIsReady(u32 register_number) const override; bool RecvDataIsReady(u32 register_number) const override;
void SetSemaphore(u16 semaphore_value) override; void SetSemaphore(u16 semaphore_value) override;
std::vector<u8> PipeRead(DspPipe pipe_number, u32 length) override; std::vector<u8> PipeRead(DspPipe pipe_number, std::size_t length) override;
std::size_t GetPipeReadableSize(DspPipe pipe_number) const override; std::size_t GetPipeReadableSize(DspPipe pipe_number) const override;
void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) override; void PipeWrite(DspPipe pipe_number, const std::vector<u8>& buffer) override;

View File

@ -290,6 +290,11 @@ elseif(WIN32)
endif() endif()
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) create_target_directory_groups(citra-qt)
target_link_libraries(citra-qt PRIVATE audio_core citra_common citra_core input_common network video_core) target_link_libraries(citra-qt PRIVATE audio_core citra_common citra_core input_common network video_core)

View File

@ -26,7 +26,7 @@ void HotkeyRegistry::SaveHotkeys() {
void HotkeyRegistry::LoadHotkeys() { void HotkeyRegistry::LoadHotkeys() {
// Make sure NOT to use a reference here because it would become invalid once we call // Make sure NOT to use a reference here because it would become invalid once we call
// beginGroup() // beginGroup()
for (const auto shortcut : UISettings::values.shortcuts) { for (auto shortcut : UISettings::values.shortcuts) {
Hotkey& hk = hotkey_groups[shortcut.group][shortcut.name]; Hotkey& hk = hotkey_groups[shortcut.group][shortcut.name];
if (!shortcut.shortcut.keyseq.isEmpty()) { if (!shortcut.shortcut.keyseq.isEmpty()) {
hk.keyseq = hk.keyseq =

View File

@ -115,6 +115,10 @@ __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
} }
#endif #endif
#ifdef HAVE_SDL2
#include <SDL.h>
#endif
constexpr int default_mouse_timeout = 2500; constexpr int default_mouse_timeout = 2500;
/** /**
@ -967,7 +971,7 @@ void GMainWindow::ShowUpdaterWidgets() {
} }
#endif #endif
#if defined(__unix__) && !defined(__APPLE__) #if defined(HAVE_SDL2) && defined(__unix__) && !defined(__APPLE__)
static std::optional<QDBusObjectPath> HoldWakeLockLinux(u32 window_id = 0) { static std::optional<QDBusObjectPath> HoldWakeLockLinux(u32 window_id = 0) {
if (!QDBusConnection::sessionBus().isConnected()) { if (!QDBusConnection::sessionBus().isConnected()) {
return {}; return {};
@ -1013,12 +1017,12 @@ void GMainWindow::PreventOSSleep() {
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
#elif defined(HAVE_SDL2) #elif defined(HAVE_SDL2)
SDL_DisableScreenSaver(); SDL_DisableScreenSaver();
#ifdef __unix__ #if defined(__unix__) && !defined(__APPLE__)
auto reply = HoldWakeLockLinux(winId()); auto reply = HoldWakeLockLinux(winId());
if (reply) { if (reply) {
wake_lock = std::move(reply.value()); wake_lock = std::move(reply.value());
} }
#endif // __unix__ #endif // defined(__unix__) && !defined(__APPLE__)
#endif // _WIN32 #endif // _WIN32
} }
@ -1027,11 +1031,11 @@ void GMainWindow::AllowOSSleep() {
SetThreadExecutionState(ES_CONTINUOUS); SetThreadExecutionState(ES_CONTINUOUS);
#elif defined(HAVE_SDL2) #elif defined(HAVE_SDL2)
SDL_EnableScreenSaver(); SDL_EnableScreenSaver();
#ifdef __unix__ #if defined(__unix__) && !defined(__APPLE__)
if (!wake_lock.path().isEmpty()) { if (!wake_lock.path().isEmpty()) {
ReleaseWakeLockLinux(wake_lock); ReleaseWakeLockLinux(wake_lock);
} }
#endif // __unix__ #endif // defined(__unix__) && !defined(__APPLE__)
#endif // _WIN32 #endif // _WIN32
} }

View File

@ -33,7 +33,6 @@ std::string_view GetAudioEmulationName(AudioEmulation emulation) {
default: default:
return "Invalid"; return "Invalid";
} }
UNREACHABLE();
}; };
std::string_view GetGraphicsAPIName(GraphicsAPI api) { std::string_view GetGraphicsAPIName(GraphicsAPI api) {
@ -45,7 +44,6 @@ std::string_view GetGraphicsAPIName(GraphicsAPI api) {
default: default:
return "Invalid"; return "Invalid";
} }
UNREACHABLE();
} }
std::string_view GetTextureFilterName(TextureFilter filter) { std::string_view GetTextureFilterName(TextureFilter filter) {
@ -67,7 +65,6 @@ std::string_view GetTextureFilterName(TextureFilter filter) {
default: default:
return "Invalid"; return "Invalid";
} }
UNREACHABLE();
} }
} // Anonymous namespace } // Anonymous namespace

View File

@ -3,10 +3,12 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <array> #include <array>
#include "common/common_types.h"
constexpr int fixure_buffer_size = 41; constexpr int fixure_buffer_size = 41;
constexpr std::array<u8, 41> fixure_buffer[41] = { constexpr std::array<u8, 41> fixure_buffer[41] = {
0xff, 0xf1, 0x4c, 0x80, 0x05, 0x3f, 0xfc, 0x21, 0x1a, 0x4e, 0xb0, 0x00, 0x00, 0x00, {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, 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}; 0x3e, 0x1d, 0x08, 0x84, 0x03, 0xd8, 0x3f, 0xe4, 0xe1, 0x20, 0x00, 0x0b, 0x38}};

View File

@ -168,6 +168,7 @@ TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel
VAddr target_address = 0x10000000; VAddr target_address = 0x10000000;
auto result = process->vm_manager.MapBackingMemory( auto result = process->vm_manager.MapBackingMemory(
target_address, buffer, static_cast<u32>(buffer.GetSize()), MemoryState::Private); target_address, buffer, static_cast<u32>(buffer.GetSize()), MemoryState::Private);
REQUIRE(result.Code() == RESULT_SUCCESS);
const u32_le input[]{ const u32_le input[]{
IPC::MakeHeader(0, 0, 2), IPC::MakeHeader(0, 0, 2),

View File

@ -4,6 +4,9 @@
//? #version 430 core //? #version 430 core
precision highp int;
precision highp float;
layout(location = 0) in mediump vec2 tex_coord; layout(location = 0) in mediump vec2 tex_coord;
layout(location = 0) out lowp vec4 frag_color; layout(location = 0) out lowp vec4 frag_color;

View File

@ -4,6 +4,9 @@
//? #version 430 core //? #version 430 core
precision highp int;
precision highp float;
layout(location = 0) in mediump vec2 tex_coord; layout(location = 0) in mediump vec2 tex_coord;
layout(location = 0) out lowp vec4 frag_color; layout(location = 0) out lowp vec4 frag_color;

View File

@ -681,8 +681,8 @@ Sampler::Sampler(TextureRuntime&, VideoCore::SamplerParams params) {
const GLenum wrap_s = PicaToGL::WrapMode(params.wrap_s); const GLenum wrap_s = PicaToGL::WrapMode(params.wrap_s);
const GLenum wrap_t = PicaToGL::WrapMode(params.wrap_t); const GLenum wrap_t = PicaToGL::WrapMode(params.wrap_t);
const Common::Vec4f gl_color = PicaToGL::ColorRGBA8(params.border_color); const Common::Vec4f gl_color = PicaToGL::ColorRGBA8(params.border_color);
const float lod_min = params.lod_min; const auto lod_min = static_cast<float>(params.lod_min);
const float lod_max = params.lod_max; const auto lod_max = static_cast<float>(params.lod_max);
sampler.Create(); sampler.Create();
@ -706,7 +706,8 @@ DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f, std::string_view
if (!Settings::values.renderer_debug) { if (!Settings::values.renderer_debug) {
return; return;
} }
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, local_scope_depth, label.size(), label.data()); glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, local_scope_depth,
static_cast<GLsizei>(label.size()), label.data());
} }
DebugScope::~DebugScope() { DebugScope::~DebugScope() {

View File

@ -292,11 +292,6 @@ void RasterizerSoftware::ProcessTriangle(const Vertex& v0, const Vertex& v1, con
auto textures = regs.texturing.GetTextures(); auto textures = regs.texturing.GetTextures();
const auto tev_stages = regs.texturing.GetTevStages(); 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. // Enter rasterization loop, starting at the center of the topleft bounding box corner.
// TODO: Not sure if looping through x first might be faster // TODO: Not sure if looping through x first might be faster
for (u16 y = min_y + 8; y < max_y; y += 0x10) { 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; continue;
} }
WriteFog(combiner_output, depth); WriteFog(combiner_output, depth);
if (!DoDepthStencilTest(x, y, depth, stencil_action_enable)) { if (!DoDepthStencilTest(x, y, depth)) {
continue; continue;
} }
const auto result = PixelColor(x, y, combiner_output); 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; return alpha > output_merger.alpha_test.ref;
case FramebufferRegs::CompareFunc::GreaterThanOrEqual: case FramebufferRegs::CompareFunc::GreaterThanOrEqual:
return alpha >= output_merger.alpha_test.ref; 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 RasterizerSoftware::DoDepthStencilTest(u16 x, u16 y, float depth) const {
bool stencil_action_enable) const {
const auto& framebuffer = regs.framebuffer.framebuffer; const auto& framebuffer = regs.framebuffer.framebuffer;
const auto stencil_test = regs.framebuffer.output_merger.stencil_test; const auto stencil_test = regs.framebuffer.output_merger.stencil_test;
u8 old_stencil = 0; 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) { if (stencil_action_enable) {
old_stencil = fb.GetStencil(x >> 4, y >> 4); old_stencil = fb.GetStencil(x >> 4, y >> 4);
const u8 dest = old_stencil & stencil_test.input_mask; const u8 dest = old_stencil & stencil_test.input_mask;

View File

@ -68,7 +68,7 @@ private:
bool DoAlphaTest(u8 alpha) const; bool DoAlphaTest(u8 alpha) const;
/// Performs the depth stencil test. Returns false if the test failed. /// 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: private:
Memory::MemorySystem& memory; Memory::MemorySystem& memory;

View File

@ -281,7 +281,6 @@ private:
bool pipeline_creation_cache_control{}; bool pipeline_creation_cache_control{};
bool shader_stencil_export{}; bool shader_stencil_export{};
bool debug_messenger_supported{}; bool debug_messenger_supported{};
bool debug_report_supported{};
}; };
} // namespace Vulkan } // namespace Vulkan

View File

@ -99,10 +99,10 @@ std::shared_ptr<Common::DynamicLibrary> OpenLibrary() {
auto library = std::make_shared<Common::DynamicLibrary>(); auto library = std::make_shared<Common::DynamicLibrary>();
#ifdef __APPLE__ #ifdef __APPLE__
const std::string filename = Common::DynamicLibrary::GetLibraryName("vulkan"); const std::string filename = Common::DynamicLibrary::GetLibraryName("vulkan");
library->Load(filename); if (!library->Load(filename)) {
if (!library->IsLoaded()) {
// Fall back to directly loading bundled MoltenVK library. // 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 #else
std::string filename = Common::DynamicLibrary::GetLibraryName("vulkan", 1); std::string filename = Common::DynamicLibrary::GetLibraryName("vulkan", 1);

View File

@ -1497,7 +1497,6 @@ void FragmentModule::DefineInterface() {
// Define shadow textures // Define shadow textures
shadow_texture_px_id = DefineUniformConst(image_r32_id, 2, 0, true); shadow_texture_px_id = DefineUniformConst(image_r32_id, 2, 0, true);
shadow_buffer_id = DefineUniformConst(image_r32_id, 2, 6);
// Define built-ins // Define built-ins
gl_frag_coord_id = DefineVar(vec_ids.Get(4), spv::StorageClass::Input); gl_frag_coord_id = DefineVar(vec_ids.Get(4), spv::StorageClass::Input);

View File

@ -256,13 +256,7 @@ private:
Id texture_buffer_lut_lf_id{}; Id texture_buffer_lut_lf_id{};
Id texture_buffer_lut_rg_id{}; Id texture_buffer_lut_rg_id{};
Id texture_buffer_lut_rgba_id{}; Id texture_buffer_lut_rgba_id{};
Id shadow_buffer_id{};
Id shadow_texture_px_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_lf{};
Id texture_buffer_lut_rg{}; Id texture_buffer_lut_rg{};