From 27fca2ed330dd4de6a0c1198f9c1f0de6ca7c172 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Sat, 22 Jun 2019 22:54:42 -0700 Subject: [PATCH 01/11] CMake refactor --- CMakeLists.txt | 20 +++- rpcs3/cmake_modules/ConfigureCompiler.cmake | 125 ++++++++------------ 2 files changed, 67 insertions(+), 78 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37ba0da32dfc..d62619083a9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,20 +2,25 @@ cmake_minimum_required(VERSION 3.8.2) project(rpcs3) +if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8) + message(FATAL_ERROR "RPCS3 requires at least gcc-8.") + endif() +elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + message(FATAL_ERROR "RPCS3 requires at least clang-5.0.") + endif() +endif() + option(WITH_GDB "WITH_GDB" OFF) option(USE_NATIVE_INSTRUCTIONS "USE_NATIVE_INSTRUCTIONS makes rpcs3 compile with -march=native, which is useful for local builds, but not good for packages." ON) - option(WITH_LLVM "Enable usage of LLVM library" ON) option(BUILD_LLVM_SUBMODULE "Build LLVM from git submodule" ON) - option(USE_ALSA "ALSA audio backend" ON) option(USE_PULSE "PulseAudio audio backend" ON) option(USE_LIBEVDEV "libevdev-based joystick support" ON) - option(USE_DISCORD_RPC "Discord rich presence integration" ON) - option(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the builtin one" ON) - option(USE_VULKAN "Vulkan render backend" ON) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/rpcs3/cmake_modules") @@ -56,9 +61,14 @@ if(APPLE) link_directories(/opt/local/lib) endif() +# Warnings are silenced for 3rdparty code +set(CMAKE_CXX_FLAGS -w) +set(CMAKE_C_FLAGS -w) add_subdirectory(Vulkan EXCLUDE_FROM_ALL) add_subdirectory(asmjitsrc EXCLUDE_FROM_ALL) add_subdirectory(3rdparty) +unset(CMAKE_CXX_FLAGS) +unset(CMAKE_C_FLAGS) # TODO: do real installation, including copying directory structure set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin") diff --git a/rpcs3/cmake_modules/ConfigureCompiler.cmake b/rpcs3/cmake_modules/ConfigureCompiler.cmake index 4dec84342793..5c091db530f1 100644 --- a/rpcs3/cmake_modules/ConfigureCompiler.cmake +++ b/rpcs3/cmake_modules/ConfigureCompiler.cmake @@ -1,97 +1,76 @@ # Check and configure compiler options for RPCS3 -if(CMAKE_COMPILER_IS_GNUCXX) - # GCC 8.1 or latter is required - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8) - message(FATAL_ERROR "RPCS3 requires at least gcc-8.") - endif() +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _ENABLE_EXTENDED_ALIGNED_STORAGE=1") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /BASE:0x10000 /FIXED") - # Set compiler options here + # Increase stack limit to 8 MB + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8388608,1048576") +else() + # Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it. + CHECK_CXX_COMPILER_FLAG("-no-pie" HAS_NO_PIE) + CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) - # Warnings add_compile_options(-Wall) - add_compile_options(-Wno-attributes -Wno-enum-compare -Wno-invalid-offsetof) - add_compile_options(-Wno-unknown-pragmas -Wno-unused-variable -Wno-reorder -Wno-comment) - -elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") - # Clang 5.0 or latter is required - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - message(FATAL_ERROR "RPCS3 requires at least clang-5.0.") - endif() + add_compile_options(-fexceptions) + add_compile_options(-msse -msse2 -mcx16) - # Set compiler options here + #TODO Clean the code so these are removed + add_compile_options(-Wno-unused-variable) + add_compile_options(-Wno-reorder) + add_compile_options(-Wno-unknown-pragmas) + add_compile_options(-Wno-invalid-offsetof) + add_compile_options(-Wno-unused-function) + add_compile_options(-Wno-attributes) + add_compile_options(-Wno-enum-compare) + add_compile_options(-Wno-comment) + add_compile_options(-Wno-overloaded-virtual) + add_compile_options(-Wno-missing-braces) + add_compile_options(-Wno-sign-compare) - add_compile_options(-ftemplate-depth=1024) - add_compile_options(-Wunused-value -Wunused-comparison) - if(APPLE) - add_compile_options(-stdlib=libc++) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wno-sometimes-uninitialized) + add_compile_options(-Wno-unused-lambda-capture) + add_compile_options(-Wno-unused-private-field) + add_compile_options(-Wno-self-assign) + add_compile_options(-Wno-pessimizing-move) + add_compile_options(-Wno-delete-non-virtual-dtor) + add_compile_options(-Wno-unused-command-line-argument) + elseif(CMAKE_COMPILER_IS_GNUCXX) + add_compile_options(-Wno-maybe-uninitialized) + add_compile_options(-Wno-strict-aliasing) + add_compile_options(-Wno-unused-but-set-variable) + add_compile_options(-Wno-class-memaccess) endif() -endif() -if(NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-pch -fexceptions") - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument") + if(USE_NATIVE_INSTRUCTIONS AND COMPILER_SUPPORTS_MARCH_NATIVE) + add_compile_options(-march=native) endif() - # This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts. - if(NOT APPLE) + if(NOT APPLE AND NOT WIN32) + # This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL") - endif() - if(WIN32) + if(HAS_NO_PIE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") + endif() + elseif(APPLE) + add_compile_options(-stdlib=libc++) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie") + elseif(WIN32) set(CMAKE_RC_COMPILER_INIT windres) enable_language(RC) set(CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1") + # Workaround for mingw64 (MSYS2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition") # Increase stack limit to 8 MB set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack -Wl,8388608") - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1") - endif() - - add_compile_options(-msse -msse2 -mcx16) - - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # This fixes 'some' of the st11range issues. See issue #2516 - if(APPLE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000") - else() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -image-base=0x10000") - endif() - endif() - - # Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it. - if(APPLE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie") - else() - CHECK_CXX_COMPILER_FLAG("-no-pie" HAS_NO_PIE) - CHECK_CXX_COMPILER_FLAG("-nopie" HAS_NOPIE) - - if(HAS_NO_PIE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") - elseif(HAS_NOPIE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nopie") - endif() - endif() -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1") - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _ENABLE_EXTENDED_ALIGNED_STORAGE=1") - - # Increase stack limit to 8 MB - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8388608,1048576") - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /BASE:0x10000 /FIXED") -endif() - -if(USE_NATIVE_INSTRUCTIONS) - CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) - if(COMPILER_SUPPORTS_MARCH_NATIVE) - add_compile_options(-march=native) endif() endif() From 1fcf62fdf0ec4cda8d8c3ddf9ec05d7f3f6f1006 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Tue, 21 May 2019 14:08:23 -0700 Subject: [PATCH 02/11] asmjit cleaned up their cmake warnings (no code change) --- asmjit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asmjit b/asmjit index 1e550aa568da..fc251c914e77 160000 --- a/asmjit +++ b/asmjit @@ -1 +1 @@ -Subproject commit 1e550aa568da993acb742ac19f2ab691a2806ad5 +Subproject commit fc251c914e77cd079e58982cdab00a47539d7fc5 From 32f8f40a4aa13fb16eaf0a0f1b9f6fa1ed72633c Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Tue, 14 May 2019 21:33:01 -0700 Subject: [PATCH 03/11] Disable warnings for stb_image.cpp. Should this file be moved to 3rdparty? --- rpcs3/stb_image.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rpcs3/stb_image.cpp b/rpcs3/stb_image.cpp index 0cc9a34afe75..feeee513bac3 100644 --- a/rpcs3/stb_image.cpp +++ b/rpcs3/stb_image.cpp @@ -1,4 +1,28 @@ #include "stdafx.h" // Defines STB_IMAGE_IMPLEMENTATION *once* for stb_image.h includes (Should this be placed somewhere else?) #define STB_IMAGE_IMPLEMENTATION + +// This header generates lots of errors, so we ignore those (not rpcs3 code) +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Weverything" #include +#pragma clang diagnostic pop + +#elif defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wall" +#pragma GCC diagnostic ignored "-Wextra" +#include +#pragma GCC diagnostic pop + +#elif defined(_MSC_VER) +// TODO Turn off warnings for MSVC. Using the normal push warning levels simply +// creates a new warning about warnings being supressed (ie fuck msvc) +// #pragma warning( push, 4 ) +#include +// #pragma warning( pop ) + +#else +#include +#endif From be521ff0abf2e3b4849d8e1a88c871d0035a1542 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Fri, 5 Apr 2019 23:15:04 -0700 Subject: [PATCH 04/11] Fix warnings related to parentheses --- Utilities/Thread.cpp | 4 ++-- rpcs3/Emu/Cell/Modules/cellGem.cpp | 2 +- rpcs3/Emu/Cell/PPUTranslator.cpp | 2 +- rpcs3/Emu/Cell/SPUInterpreter.cpp | 14 +++++++------- rpcs3/Emu/Cell/SPUThread.cpp | 2 +- rpcs3/Emu/RSX/Common/ProgramStateCache.cpp | 2 +- rpcs3/Emu/RSX/RSXTexture.cpp | 8 ++++---- rpcs3/Emu/RSX/rsx_methods.cpp | 6 +++--- rpcs3/Emu/System.cpp | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index b07bbe232346..cd8033e87b68 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1160,7 +1160,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) } }; - if ((d_size | d_size + addr) >= 0x100000000ull) + if ((d_size | (d_size + addr)) >= 0x100000000ull) { LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size); report_opcode(); @@ -1170,7 +1170,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) // get length of data being accessed size_t a_size = get_x64_access_size(context, op, reg, d_size, i_size); - if ((a_size | a_size + addr) >= 0x100000000ull) + if ((a_size | (a_size + addr)) >= 0x100000000ull) { LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size); report_opcode(); diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index 2186fceee237..3427bfbbc232 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -853,7 +853,7 @@ s32 cellGemPrepareVideoConvert(vm::cptr vc_attribu const auto vc = *vc_attribute; if (!vc_attribute || vc.version == 0 || vc.output_format == 0 || - vc.conversion_flags & CELL_GEM_COMBINE_PREVIOUS_INPUT_FRAME && !vc.buffer_memory) + (vc.conversion_flags & CELL_GEM_COMBINE_PREVIOUS_INPUT_FRAME && !vc.buffer_memory)) { return CELL_GEM_ERROR_INVALID_PARAMETER; } diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index 5531bfa835c4..8d8f1d5ba5a5 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -1112,7 +1112,7 @@ void PPUTranslator::VMSUMUHS(ppu_opcode_t op) const auto mh = noncast((a >> 16) * (b >> 16)); const auto s = eval(ml + mh); const auto s2 = eval(s + c); - const auto x = eval(s < ml | s2 < s); + const auto x = eval((s < ml) | (s2 < s)); set_vr(op.vd, select(x, splat(-1), s2)); SetSat(IsNotZero(x.value)); } diff --git a/rpcs3/Emu/Cell/SPUInterpreter.cpp b/rpcs3/Emu/Cell/SPUInterpreter.cpp index c85faafc116b..3017f8940414 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/SPUInterpreter.cpp @@ -333,13 +333,13 @@ bool spu_interpreter::ROTI(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::ROTMI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srli_epi32(spu.gpr[op.ra].vi, 0-op.i7 & 0x3f); + spu.gpr[op.rt].vi = _mm_srli_epi32(spu.gpr[op.ra].vi, (0-op.i7) & 0x3f); return true; } bool spu_interpreter::ROTMAI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srai_epi32(spu.gpr[op.ra].vi, 0-op.i7 & 0x3f); + spu.gpr[op.rt].vi = _mm_srai_epi32(spu.gpr[op.ra].vi, (0-op.i7) & 0x3f); return true; } @@ -359,13 +359,13 @@ bool spu_interpreter::ROTHI(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::ROTHMI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srli_epi16(spu.gpr[op.ra].vi, 0-op.i7 & 0x1f); + spu.gpr[op.rt].vi = _mm_srli_epi16(spu.gpr[op.ra].vi, (0-op.i7) & 0x1f); return true; } bool spu_interpreter::ROTMAHI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srai_epi16(spu.gpr[op.ra].vi, 0-op.i7 & 0x1f); + spu.gpr[op.rt].vi = _mm_srai_epi16(spu.gpr[op.ra].vi, (0-op.i7) & 0x1f); return true; } @@ -708,7 +708,7 @@ bool spu_interpreter::ROTQMBY(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra].vi; alignas(64) const __m128i buf[3]{a, _mm_setzero_si128(), _mm_setzero_si128()}; - spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + (0 - spu.gpr[op.rb]._u32[3] & 0x1f))); + spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + ((0 - spu.gpr[op.rb]._u32[3]) & 0x1f))); return true; } @@ -789,7 +789,7 @@ bool spu_interpreter::ROTQBII(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::ROTQMBII(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra].vi; - const s32 n = 0-op.i7 & 0x7; + const s32 n = (0-op.i7) & 0x7; spu.gpr[op.rt].vi = _mm_or_si128(_mm_srli_epi64(a, n), _mm_slli_epi64(_mm_srli_si128(a, 8), 64 - n)); return true; } @@ -814,7 +814,7 @@ bool spu_interpreter::ROTQMBYI(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra].vi; alignas(64) const __m128i buf[3]{a, _mm_setzero_si128(), _mm_setzero_si128()}; - spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + (0 - op.i7 & 0x1f))); + spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + ((0 - op.i7) & 0x1f))); return true; } diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index d0c2b8ef3766..9ec8d3f6285c 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -2995,7 +2995,7 @@ bool spu_thread::stop_and_signal(u32 code) { if (spuq == v.first) { - if (queue = v.second.lock()) + if ((queue = v.second.lock())) { break; } diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp b/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp index 38c671825833..b79133375898 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp @@ -155,7 +155,7 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert } } - if (d3.end && (fast_exit || current_instrution >= instruction_range.second) || + if ((d3.end && (fast_exit || current_instrution >= instruction_range.second)) || (current_instrution + 1) == 512) { break; diff --git a/rpcs3/Emu/RSX/RSXTexture.cpp b/rpcs3/Emu/RSX/RSXTexture.cpp index 03b26077e46c..9672db597487 100644 --- a/rpcs3/Emu/RSX/RSXTexture.cpp +++ b/rpcs3/Emu/RSX/RSXTexture.cpp @@ -74,7 +74,7 @@ namespace rsx } else max_mipmap_count = floor_log2(static_cast(std::max(width(), height()))) + 1; - + return std::min(verify(HERE, mipmap()), max_mipmap_count); } @@ -167,7 +167,7 @@ namespace rsx if (remap_override) { auto r_component = (remap_ctl >> 2) & 3; - remap_ctl = remap_ctl & ~(3 << 4) | r_component << 4; + remap_ctl = (remap_ctl & ~(3 << 4)) | r_component << 4; } remap_ctl &= 0xFFFF; @@ -181,7 +181,7 @@ namespace rsx if (remap_override) { //Set remap lookup for A component to FORCE_ONE - remap_ctl = remap_ctl & ~(3 << 8) | (1 << 8); + remap_ctl = (remap_ctl & ~(3 << 8)) | (1 << 8); } break; } @@ -190,7 +190,7 @@ namespace rsx } //Remapping tables; format is A-R-G-B - //Remap input table. Contains channel index to read color from + //Remap input table. Contains channel index to read color from const std::array remap_inputs = { static_cast(remap_ctl & 0x3), diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 351683135175..39f11e92dbe7 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -1301,16 +1301,16 @@ namespace rsx void rsx_state::init() { // Special values set at initialization, these are not set by a context reset - registers[NV4097_SET_SHADER_PROGRAM] = (0 << 2) | CELL_GCM_LOCATION_LOCAL + 1; + registers[NV4097_SET_SHADER_PROGRAM] = (0 << 2) | (CELL_GCM_LOCATION_LOCAL + 1); for (u32 i = 0; i < 16; i++) { - registers[NV4097_SET_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_R5G6B5 | CELL_GCM_TEXTURE_SZ | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | CELL_GCM_LOCATION_LOCAL + 1; + registers[NV4097_SET_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_R5G6B5 | CELL_GCM_TEXTURE_SZ | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | (CELL_GCM_LOCATION_LOCAL + 1); } for (u32 i = 0; i < 4; i++) { - registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_X32_FLOAT | CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | CELL_GCM_LOCATION_LOCAL + 1; + registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_X32_FLOAT | CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | (CELL_GCM_LOCATION_LOCAL + 1); } registers[NV406E_SET_CONTEXT_DMA_SEMAPHORE] = CELL_GCM_CONTEXT_DMA_SEMAPHORE_R; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 909120786ad7..723ca8ea1cb7 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1347,7 +1347,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa elf_file.open(decrypted_path); } // Decrypt SELF - else if (elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data())) + else if ((elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data()))) { if (true) { From 23094b48bbb4743382bf361aa3c913ad883a6f4f Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Fri, 10 May 2019 22:36:16 -0700 Subject: [PATCH 05/11] Fix warnings related to -Wswitch Add default cases. Move default breaks to newline Add proper handling in some instances. Add missing enums to switches --- rpcs3/Emu/Cell/Modules/cellSysutil.cpp | 1 + rpcs3/Emu/Cell/lv2/lv2.cpp | 1 + rpcs3/Emu/RSX/GL/GLTextureCache.h | 2 ++ rpcs3/Emu/RSX/Overlays/overlay_osk.cpp | 2 ++ rpcs3/Emu/RSX/RSXThread.cpp | 12 ++++++++++++ rpcs3/Emu/RSX/VK/VKFormats.cpp | 26 ++++++++++++++++++++++++-- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 8 +++++++- rpcs3/Emu/RSX/VK/VKHelpers.cpp | 6 ++++++ rpcs3/Emu/RSX/VK/VKHelpers.h | 3 +++ rpcs3/Emu/RSX/VK/VKTexture.cpp | 3 +++ rpcs3/Emu/RSX/VK/VKTextureCache.h | 7 ++++++- rpcs3/Emu/RSX/rsx_methods.cpp | 2 ++ 12 files changed, 69 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp index 5080a2115eb7..db498b60b60c 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp @@ -124,6 +124,7 @@ void fmt_class_string::format(std::string& out, u64 arg) case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: return "ID_JAPANESE_KEYBOARD_ENTRY_METHOD"; case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: return "ID_CHINESE_KEYBOARD_ENTRY_METHOD"; case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: return "ID_PAD_AUTOOFF"; + case CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER: return "ID_MAGNETOMETER"; case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: return "ID_NICKNAME"; case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: return "ID_CURRENT_USERNAME"; } diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index 4c8121ce6435..cf9f2ac7348c 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -913,6 +913,7 @@ void fmt_class_string::format(std::string& out, u64 arg) STR_CASE(CELL_ETIMEDOUT); STR_CASE(CELL_EABORT); STR_CASE(CELL_EFAULT); + STR_CASE(CELL_ENOCHILD); STR_CASE(CELL_ESTAT); STR_CASE(CELL_EALIGN); STR_CASE(CELL_EKRESOURCE); diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index a70c51c4080e..564d7a29cb01 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -212,6 +212,8 @@ namespace gl case gl::texture::type::f32: gcm_format = CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT; break; + default: + break; } } } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index 9b8d44fd6cf4..43d11e0be519 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -397,6 +397,8 @@ namespace rsx } break; } + default: + break; } } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 5f87e8aafc7e..c5d2982b238c 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -118,6 +118,8 @@ namespace rsx return sizeof(u16) * size; case 3: return sizeof(u16) * 4; + default: + break; } fmt::throw_exception("Wrong vector size" HERE); case vertex_base_type::f: return sizeof(f32) * size; @@ -130,6 +132,8 @@ namespace rsx return sizeof(f16) * size; case 3: return sizeof(f16) * 4; + default: + break; } fmt::throw_exception("Wrong vector size" HERE); case vertex_base_type::ub: @@ -141,10 +145,14 @@ namespace rsx return sizeof(u8) * size; case 3: return sizeof(u8) * 4; + default: + break; } fmt::throw_exception("Wrong vector size" HERE); case vertex_base_type::cmp: return 4; case vertex_base_type::ub256: verify(HERE), (size == 4); return sizeof(u8) * 4; + default: + break; } fmt::throw_exception("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!" HERE, (u8)type); } @@ -2036,6 +2044,8 @@ namespace rsx // These are single byte formats, but inverted order (BGRA vs ARGB) when passed via registers to_swap_bytes = (layout.attribute_placement[index] == attribute_buffer_placement::transient); break; + default: + break; } if (to_swap_bytes) attrib1 |= swap_storage_mask; @@ -2451,6 +2461,8 @@ namespace rsx case frame_limit_type::_60: limit = 60.; break; case frame_limit_type::_30: limit = 30.; break; case frame_limit_type::_auto: limit = fps_limit; break; // TODO + default: + break; } if (limit) diff --git a/rpcs3/Emu/RSX/VK/VKFormats.cpp b/rpcs3/Emu/RSX/VK/VKFormats.cpp index 4b7cba6e18a6..4e7ce46a30fe 100644 --- a/rpcs3/Emu/RSX/VK/VKFormats.cpp +++ b/rpcs3/Emu/RSX/VK/VKFormats.cpp @@ -42,6 +42,8 @@ namespace vk if (support.d32_sfloat_s8) return VK_FORMAT_D32_SFLOAT_S8_UINT; fmt::throw_exception("No hardware support for z24s8" HERE); } + default: + break; } fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format); } @@ -57,6 +59,9 @@ namespace vk case rsx::texture_minify_filter::nearest_linear: return std::make_tuple(VK_FILTER_NEAREST, VK_SAMPLER_MIPMAP_MODE_LINEAR); case rsx::texture_minify_filter::linear_linear: return std::make_tuple(VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_LINEAR); case rsx::texture_minify_filter::convolution_min: return std::make_tuple(VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_LINEAR); + default: + ASSUME(0); + break; } fmt::throw_exception("Invalid max filter" HERE); } @@ -68,6 +73,9 @@ namespace vk case rsx::texture_magnify_filter::nearest: return VK_FILTER_NEAREST; case rsx::texture_magnify_filter::linear: return VK_FILTER_LINEAR; case rsx::texture_magnify_filter::convolution_mag: return VK_FILTER_LINEAR; + default: + ASSUME(0); + break; } fmt::throw_exception("Invalid mag filter (0x%x)" HERE, (u32)mag_filter); } @@ -119,6 +127,9 @@ namespace vk case rsx::texture_wrap_mode::mirror_once_clamp_to_edge: return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; case rsx::texture_wrap_mode::mirror_once_border: return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; case rsx::texture_wrap_mode::mirror_once_clamp: return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; + default: + ASSUME(0); + break; } fmt::throw_exception("unhandled texture clamp mode" HERE); } @@ -135,6 +146,9 @@ namespace vk case rsx::texture_max_anisotropy::x10: return 10.0f; case rsx::texture_max_anisotropy::x12: return 12.0f; case rsx::texture_max_anisotropy::x16: return 16.0f; + default: + ASSUME(0); + break; } fmt::throw_exception("Texture anisotropy error: bad max aniso (%d)" HERE, (u32)gcm_aniso); @@ -188,7 +202,7 @@ namespace vk case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: mapping = { VK_COMPONENT_SWIZZLE_A, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B }; break; - + case CELL_GCM_TEXTURE_D8R8G8B8: mapping = { VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_A }; break; @@ -209,7 +223,7 @@ namespace vk default: fmt::throw_exception("Invalid or unsupported component mapping for texture format (0x%x)" HERE, format); } - + return mapping; } @@ -244,6 +258,8 @@ namespace vk case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8: return VK_FORMAT_R8G8_SNORM; case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: return VK_FORMAT_B8G8R8A8_UNORM; case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return VK_FORMAT_B8G8R8A8_UNORM; + default: + break; } fmt::throw_exception("Invalid or unsupported sampler format for texture format (0x%x)" HERE, format); } @@ -305,6 +321,8 @@ namespace vk case VK_FORMAT_D32_SFLOAT_S8_UINT: //TODO: Translate to D24S8 case VK_FORMAT_D24_UNORM_S8_UINT: return 4; + default: + break; } fmt::throw_exception("Unexpected vkFormat 0x%X", (u32)format); @@ -364,6 +382,8 @@ namespace vk case VK_FORMAT_D32_SFLOAT_S8_UINT: case VK_FORMAT_D24_UNORM_S8_UINT: return{ 4, 1 }; + default: + break; } fmt::throw_exception("Unexpected vkFormat 0x%X", (u32)format); @@ -414,6 +434,8 @@ namespace vk case VK_FORMAT_D32_SFLOAT_S8_UINT: case VK_FORMAT_D24_UNORM_S8_UINT: return{ true, 4 }; + default: + break; } fmt::throw_exception("Unknown vkFormat 0x%x" HERE, (u32)format); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index a4ff930332ee..8fc11a2fd559 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -17,6 +17,9 @@ namespace { case rsx::surface_depth_format::z16: return 0xFFFF; case rsx::surface_depth_format::z24s8: return 0xFFFFFF; + default: + ASSUME(0); + break; } fmt::throw_exception("Unknown depth format" HERE); } @@ -27,6 +30,9 @@ namespace { case rsx::surface_depth_format::z16: return 2; case rsx::surface_depth_format::z24s8: return 4; + default: + ASSUME(0); + break; } fmt::throw_exception("Unknown depth format" HERE); } @@ -1068,7 +1074,7 @@ void VKGSRender::emit_geometry(u32 sub_index) } else if (draw_call.execute_pipeline_dependencies() & rsx::vertex_base_changed) { - // Rebase vertex bases instead of + // Rebase vertex bases instead of for (auto &info : m_vertex_layout.interleaved_blocks) { const auto vertex_base_offset = rsx::method_registers.vertex_data_base_offset(); diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.cpp b/rpcs3/Emu/RSX/VK/VKHelpers.cpp index d1dcad640527..47e55ed399fc 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.cpp +++ b/rpcs3/Emu/RSX/VK/VKHelpers.cpp @@ -504,6 +504,7 @@ namespace vk barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; dst_stage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; break; + default: case VK_IMAGE_LAYOUT_UNDEFINED: case VK_IMAGE_LAYOUT_PREINITIALIZED: fmt::throw_exception("Attempted to transition to an invalid layout"); @@ -575,6 +576,8 @@ namespace vk barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; src_stage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; break; + default: + break; //TODO Investigate what happens here } vkCmdPipelineBarrier(cmd, src_stage, dst_stage, 0, 0, nullptr, 0, nullptr, 1, &barrier); @@ -856,11 +859,14 @@ namespace vk switch (severity) { + default: case 0: fmt::throw_exception("Assertion Failed! Vulkan API call failed with unrecoverable error: %s%s", error_message.c_str(), faulting_addr); case 1: LOG_ERROR(RSX, "Vulkan API call has failed with an error but will continue: %s%s", error_message.c_str(), faulting_addr); break; + case 2: + break; } } diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index 9d5478396bce..02c10c52ecbb 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -1215,6 +1215,9 @@ namespace vk case VK_IMAGE_TYPE_3D: info.viewType = VK_IMAGE_VIEW_TYPE_3D; break; + default: + ASSUME(0); + break; } create_impl(); diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index 961c72d907c2..a4bfcd223916 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -476,6 +476,9 @@ namespace vk stretch_image_typeless_safe(src, dst, typeless_stencil->value, src_rect, dst_rect, depth_stencil, VK_IMAGE_ASPECT_STENCIL_BIT); break; } + default: + fmt::throw_exception("Unreachable" HERE); + break; } } } diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index 138aeb1f3617..d4bcf9bc421c 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -140,7 +140,7 @@ namespace vk return managed_texture.get(); } - std::unique_ptr& get_texture() + std::unique_ptr& get_texture() { return managed_texture; } @@ -914,6 +914,9 @@ namespace vk image_view_type = VK_IMAGE_VIEW_TYPE_3D; layer = 1; break; + default: + ASSUME(0); + break; } switch (gcm_format) @@ -991,6 +994,8 @@ namespace vk case VK_FORMAT_D24_UNORM_S8_UINT: subres_range.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; break; + default: + break; } change_image_layout(cmd, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subres_range); diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 39f11e92dbe7..33c791de7337 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -245,6 +245,8 @@ namespace rsx // Get BE data arg = be_t{arg}.raw(); break; + default: + break; } if (rsx->in_begin_end) From ebb1ae64087c7b0a535d2a5873e80aa197e12e7b Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Tue, 14 May 2019 23:52:40 -0700 Subject: [PATCH 06/11] Properly ignore SIMD macros to avoid warning --- rpcs3/Emu/Cell/PPUInterpreter.cpp | 2 +- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/Emu/Cell/PPUInterpreter.cpp index 56731f1d7737..201c915bf630 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -10,7 +10,7 @@ #include #if !defined(_MSC_VER) && !defined(__SSSE3__) -#define _mm_shuffle_epi8 +#define _mm_shuffle_epi8(opa, opb) opb #endif inline u64 dup32(u32 x) { return x | static_cast(x) << 32; } diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 8445b8c7941a..7c76f3e70c3f 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -15,7 +15,7 @@ const bool s_use_ssse3 = true; #else false; -#define _mm_shuffle_epi8 +#define _mm_shuffle_epi8(opa, opb) opb #endif namespace From 22917084d9181947876d2b99b0e495109014c291 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Sat, 11 May 2019 00:27:39 -0700 Subject: [PATCH 07/11] Explcitly mark overflow in various SIMD functions. Doing so silently created warnings. --- rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp | 2 +- rpcs3/Emu/Cell/SPUInterpreter.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp b/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp index e570326a4763..c7897d0362d8 100644 --- a/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp +++ b/rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp @@ -2817,7 +2817,7 @@ void spu_recompiler::FSMB(spu_opcode_t op) c->pshufd(va, va, 0xfa); } - c->movdqa(vm, XmmConst(_mm_set_epi8(128, 64, 32, 16, 8, 4, 2, 1, 128, 64, 32, 16, 8, 4, 2, 1))); + c->movdqa(vm, XmmConst(_mm_set_epi8(-128, 64, 32, 16, 8, 4, 2, 1, -128, 64, 32, 16, 8, 4, 2, 1))); c->pand(va, vm); c->pcmpeqb(va, vm); c->movdqa(SPU_OFF_128(gpr, op.rt), va); diff --git a/rpcs3/Emu/Cell/SPUInterpreter.cpp b/rpcs3/Emu/Cell/SPUInterpreter.cpp index 3017f8940414..a4b70806105f 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/SPUInterpreter.cpp @@ -572,7 +572,7 @@ bool spu_interpreter::FSMB(spu_thread& spu, spu_opcode_t op) { const auto vsrc = spu.gpr[op.ra].vi; const auto bits = _mm_shuffle_epi32(_mm_shufflehi_epi16(_mm_unpackhi_epi8(vsrc, vsrc), 0x50), 0xfa); - const auto mask = _mm_set_epi8(128, 64, 32, 16, 8, 4, 2, 1, 128, 64, 32, 16, 8, 4, 2, 1); + const auto mask = _mm_set_epi8(-128, 64, 32, 16, 8, 4, 2, 1, -128, 64, 32, 16, 8, 4, 2, 1); spu.gpr[op.rt].vi = _mm_cmpeq_epi8(_mm_and_si128(bits, mask), mask); return true; } @@ -1429,7 +1429,7 @@ bool spu_interpreter::FSMBI(spu_thread& spu, spu_opcode_t op) { const auto vsrc = _mm_set_epi32(0, 0, 0, op.i16); const auto bits = _mm_shuffle_epi32(_mm_shufflelo_epi16(_mm_unpacklo_epi8(vsrc, vsrc), 0x50), 0x50); - const auto mask = _mm_set_epi8(128, 64, 32, 16, 8, 4, 2, 1, 128, 64, 32, 16, 8, 4, 2, 1); + const auto mask = _mm_set_epi8(-128, 64, 32, 16, 8, 4, 2, 1, -128, 64, 32, 16, 8, 4, 2, 1); spu.gpr[op.rt].vi = _mm_cmpeq_epi8(_mm_and_si128(bits, mask), mask); return true; } From d0eae7bab195e8724f4dce6507927d6cf65382df Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Tue, 21 May 2019 20:47:47 -0700 Subject: [PATCH 08/11] Fix -Wsign-compare a little bit Explicitly mark loop types (per review) --- Utilities/address_range.h | 2 +- Utilities/cfmt.h | 8 +++++--- rpcs3/Emu/Cell/Modules/StaticHLE.cpp | 4 ++-- rpcs3/Emu/Cell/Modules/cellAdec.cpp | 2 +- rpcs3/Emu/Cell/Modules/cellL10n.cpp | 2 +- rpcs3/Emu/Cell/Modules/cellPngDec.cpp | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Utilities/address_range.h b/Utilities/address_range.h index 6c852f20ffc4..c1ae078c9b1e 100644 --- a/Utilities/address_range.h +++ b/Utilities/address_range.h @@ -589,4 +589,4 @@ namespace std { return (size_t{ k.start } << 32) | size_t{ k.end }; } }; -} \ No newline at end of file +} diff --git a/Utilities/cfmt.h b/Utilities/cfmt.h index da58eeec9570..34bd5115925c 100644 --- a/Utilities/cfmt.h +++ b/Utilities/cfmt.h @@ -7,6 +7,8 @@ #include #include +static const size_t size_dropped = std::numeric_limits::max(); + /* C-style format parser. Appends formatted string to `out`, returns number of characters written. `out`: mutable reference to std::string, std::vector or other compatible container @@ -41,7 +43,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) const auto drop_sequence = [&] { out.insert(out.end(), fmt - ctx.size, fmt); - ctx.size = -1; + ctx.size = size_dropped; }; const auto read_decimal = [&](uint result) -> uint @@ -112,7 +114,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) ctx = {0}; out.push_back(ch); } - else if (ctx.size == -1) + else if (ctx.size == size_dropped) { out.push_back(ch); } @@ -626,7 +628,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src) } // Handle unfinished sequence - if (ctx.size && ctx.size != -1) + if (ctx.size && ctx.size != size_dropped) { fmt--, drop_sequence(); } diff --git a/rpcs3/Emu/Cell/Modules/StaticHLE.cpp b/rpcs3/Emu/Cell/Modules/StaticHLE.cpp index a20d87ca6d3e..8af27f87923f 100644 --- a/rpcs3/Emu/Cell/Modules/StaticHLE.cpp +++ b/rpcs3/Emu/Cell/Modules/StaticHLE.cpp @@ -32,7 +32,7 @@ statichle_handler::~statichle_handler() bool statichle_handler::load_patterns() { - for (int i = 0; i < shle_patterns_list.size(); i++) + for (u32 i = 0; i < shle_patterns_list.size(); i++) { auto& pattern = shle_patterns_list[i]; @@ -77,7 +77,7 @@ bool statichle_handler::load_patterns() return (hv << 4) | lv; }; - for (int j = 0; j < 32; j++) + for (u32 j = 0; j < 32; j++) dapat.start_pattern[j] = char_to_u8(pattern[0][j * 2], pattern[0][(j * 2) + 1]); dapat.crc16_length = char_to_u8(pattern[1][0], pattern[1][1]); diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.cpp b/rpcs3/Emu/Cell/Modules/cellAdec.cpp index 8c6ea9054d65..5090063ee66c 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAdec.cpp @@ -428,7 +428,7 @@ int adecRead(void* opaque, u8* buf, int buf_size) if (adecIsAtracX(adec.type) && !adec.reader.init) { OMAHeader oma(1 /* atrac3p id */, adec.sample_rate, adec.ch_cfg, adec.frame_size); - if (buf_size < sizeof(oma)) + if (buf_size + 0u < sizeof(oma)) { cellAdec.error("adecRead(): OMAHeader writing failed"); Emu.Pause(); diff --git a/rpcs3/Emu/Cell/Modules/cellL10n.cpp b/rpcs3/Emu/Cell/Modules/cellL10n.cpp index 5b7a47a3d0a9..005f01fe624b 100644 --- a/rpcs3/Emu/Cell/Modules/cellL10n.cpp +++ b/rpcs3/Emu/Cell/Modules/cellL10n.cpp @@ -410,7 +410,7 @@ s32 jstrnchk(vm::cptr src, s32 src_len) { u8 r = 0; - for (u32 len = 0; len < src_len; len++) + for (s32 len = 0; len < src_len; len++) { if (src != vm::null) { diff --git a/rpcs3/Emu/Cell/Modules/cellPngDec.cpp b/rpcs3/Emu/Cell/Modules/cellPngDec.cpp index 4698cc26e199..41a187913e53 100644 --- a/rpcs3/Emu/Cell/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPngDec.cpp @@ -769,9 +769,9 @@ s32 pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::ptr d // todo: commandptr try { - for (int j = 0; j < stream->passes; j++) + for (u32 j = 0; j < stream->passes; j++) { - for (int i = 0; i < stream->out_param.outputHeight; ++i) + for (u32 i = 0; i < stream->out_param.outputHeight; ++i) { const u32 line = flip ? stream->out_param.outputHeight - i - 1 : i; png_read_row(stream->png_ptr, &data[line*bytes_per_line], nullptr); From a124ec4a26268070523fdca03ad46c51a9022d28 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Fri, 5 Apr 2019 23:48:58 -0700 Subject: [PATCH 09/11] Remove braces around shader source strings (warnings) --- rpcs3/Emu/RSX/GL/GLOverlays.h | 32 ++++++++----------------------- rpcs3/Emu/RSX/VK/VKCompute.h | 36 +++++++++-------------------------- rpcs3/Emu/RSX/VK/VKOverlays.h | 24 ++++++----------------- 3 files changed, 23 insertions(+), 69 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLOverlays.h b/rpcs3/Emu/RSX/GL/GLOverlays.h index 2de924e08e19..4c2207b3b7df 100644 --- a/rpcs3/Emu/RSX/GL/GLOverlays.h +++ b/rpcs3/Emu/RSX/GL/GLOverlays.h @@ -277,7 +277,6 @@ namespace gl depth_convert_pass() { vs_src = - { "#version 420\n\n" "uniform vec2 tex_scale;\n" "out vec2 tc0;\n" @@ -288,11 +287,9 @@ namespace gl " vec2 coords[] = {vec2(0., 0.), vec2(1., 0.), vec2(0., 1.), vec2(1., 1.)};\n" " gl_Position = vec4(positions[gl_VertexID % 4], 0., 1.);\n" " tc0 = coords[gl_VertexID % 4] * tex_scale;\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n\n" "in vec2 tc0;\n" "layout(binding=31) uniform sampler2D fs0;\n" @@ -301,8 +298,7 @@ namespace gl "{\n" " vec4 rgba_in = texture(fs0, tc0);\n" " gl_FragDepth = rgba_in.w * 0.99609 + rgba_in.x * 0.00389 + rgba_in.y * 0.00002;\n" - "}\n" - }; + "}\n"; } void run(const areai& src_area, const areai& dst_area, gl::texture* source, gl::texture* target) @@ -325,18 +321,15 @@ namespace gl rgba8_unorm_rg16_sfloat_convert_pass() { vs_src = - { "#version 420\n\n" "\n" "void main()\n" "{\n" " vec2 positions[] = {vec2(-1., -1.), vec2(1., -1.), vec2(-1., 1.), vec2(1., 1.)};\n" " gl_Position = vec4(positions[gl_VertexID % 4], 0., 1.);\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n\n" "layout(binding=31) uniform sampler2D fs0;\n" "layout(location=0) out vec4 ocol;\n" @@ -345,8 +338,7 @@ namespace gl "{\n" " uint value = packUnorm4x8(texelFetch(fs0, ivec2(gl_FragCoord.xy), 0).zyxw);\n" " ocol.xy = unpackHalf2x16(value);\n" - "}\n" - }; + "}\n"; } void run(u16 w, u16 h, GLuint target, GLuint source) @@ -371,7 +363,6 @@ namespace gl ui_overlay_renderer() { vs_src = - { "#version 420\n\n" "layout(location=0) in vec4 in_pos;\n" "layout(location=0) out vec2 tc0;\n" @@ -396,11 +387,9 @@ namespace gl " window_coord.y = (1. - window_coord.y); // Invert y axis\n" " vec4 pos = vec4(window_coord, 0., 1.);\n" " gl_Position = (pos + pos) - 1.;\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n\n" "layout(binding=31) uniform sampler2D fs0;\n" "layout(location=0) in vec2 tc0;\n" @@ -482,8 +471,7 @@ namespace gl " ocol = sample_image(fs0, tc0) * diff_color;\n" " else\n" " ocol = diff_color;\n" - "}\n" - }; + "}\n"; // Smooth filtering required for inputs input_filter = GL_LINEAR; @@ -682,7 +670,6 @@ namespace gl video_out_calibration_pass() { vs_src = - { "#version 420\n\n" "layout(location=0) out vec2 tc0;\n" "uniform float x_scale;\n" @@ -697,11 +684,9 @@ namespace gl " tc0 = coords[gl_VertexID % 4];\n" " vec2 pos = positions[gl_VertexID % 4] * vec2(x_scale, y_scale) + (2. * vec2(x_offset, y_offset));\n" " gl_Position = vec4(pos, 0., 1.);\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n\n" "layout(binding=31) uniform sampler2D fs0;\n" "layout(location=0) in vec2 tc0;\n" @@ -718,8 +703,7 @@ namespace gl " ocol = ((color * 220.) + 16.) / 255.;\n" " else\n" " ocol = color;\n" - "}\n" - }; + "}\n"; input_filter = GL_LINEAR; } diff --git a/rpcs3/Emu/RSX/VK/VKCompute.h b/rpcs3/Emu/RSX/VK/VKCompute.h index cf579ab10897..da3770f25c44 100644 --- a/rpcs3/Emu/RSX/VK/VKCompute.h +++ b/rpcs3/Emu/RSX/VK/VKCompute.h @@ -205,20 +205,14 @@ namespace vk cs_shuffle_base() { work_kernel = - { " value = data[index];\n" - " data[index] = %f(value);\n" - }; + " data[index] = %f(value);\n"; loop_advance = - { - " index++;\n" - }; + " index++;\n"; suffix = - { - "}\n" - }; + "}\n"; } void build(const char* function_name, u32 _kernel_size = 0) @@ -229,7 +223,6 @@ namespace vk kernel_size = _kernel_size? _kernel_size : optimal_kernel_size; m_src = - { "#version 430\n" "layout(local_size_x=%ws, local_size_y=1, local_size_z=1) in;\n" "layout(std430, set=0, binding=0) buffer ssbo{ uint data[]; };\n" @@ -254,8 +247,7 @@ namespace vk " uint index = gl_GlobalInvocationID.x * KERNEL_SIZE;\n" " uint value;\n" " %vars" - "\n" - }; + "\n"; const std::pair syntax_replace[] = { @@ -413,15 +405,13 @@ namespace vk uniform_inputs = true; variables = - { " uint block_length = params[0].x >> 2;\n" " uint z_offset = params[0].y >> 2;\n" " uint s_offset = params[0].z >> 2;\n" " uint depth;\n" " uint stencil;\n" " uint stencil_shift;\n" - " uint stencil_offset;\n" - }; + " uint stencil_offset;\n"; } void bind_resources() override @@ -450,7 +440,6 @@ namespace vk cs_gather_d24x8() { work_kernel = - { " if (index >= block_length)\n" " return;\n" "\n" @@ -460,8 +449,7 @@ namespace vk " stencil = data[stencil_offset + s_offset];\n" " stencil = (stencil >> stencil_shift) & 0xFF;\n" " value = (depth << 8) | stencil;\n" - " data[index] = value;\n" - }; + " data[index] = value;\n"; cs_shuffle_base::build(""); } @@ -472,7 +460,6 @@ namespace vk cs_gather_d32x8() { work_kernel = - { " if (index >= block_length)\n" " return;\n" "\n" @@ -482,8 +469,7 @@ namespace vk " stencil = data[stencil_offset + s_offset];\n" " stencil = (stencil >> stencil_shift) & 0xFF;\n" " value = (depth << 8) | stencil;\n" - " data[index] = value;\n" - }; + " data[index] = value;\n"; cs_shuffle_base::build(""); } @@ -494,7 +480,6 @@ namespace vk cs_scatter_d24x8() { work_kernel = - { " if (index >= block_length)\n" " return;\n" "\n" @@ -503,8 +488,7 @@ namespace vk " stencil_offset = (index / 4);\n" " stencil_shift = (index % 4) * 8;\n" " stencil = (value & 0xFF) << stencil_shift;\n" - " data[stencil_offset + s_offset] |= stencil;\n" - }; + " data[stencil_offset + s_offset] |= stencil;\n"; cs_shuffle_base::build(""); } @@ -515,7 +499,6 @@ namespace vk cs_scatter_d32x8() { work_kernel = - { " if (index >= block_length)\n" " return;\n" "\n" @@ -524,8 +507,7 @@ namespace vk " stencil_offset = (index / 4);\n" " stencil_shift = (index % 4) * 8;\n" " stencil = (value & 0xFF) << stencil_shift;\n" - " data[stencil_offset + s_offset] |= stencil;\n" - }; + " data[stencil_offset + s_offset] |= stencil;\n"; cs_shuffle_base::build(""); } diff --git a/rpcs3/Emu/RSX/VK/VKOverlays.h b/rpcs3/Emu/RSX/VK/VKOverlays.h index b85483c2a5c9..e382bdf0d6b3 100644 --- a/rpcs3/Emu/RSX/VK/VKOverlays.h +++ b/rpcs3/Emu/RSX/VK/VKOverlays.h @@ -384,7 +384,6 @@ namespace vk depth_convert_pass() { vs_src = - { "#version 450\n" "#extension GL_ARB_separate_shader_objects : enable\n" "layout(std140, set=0, binding=0) uniform static_data{ vec4 regs[8]; };\n" @@ -396,11 +395,9 @@ namespace vk " vec2 coords[] = {vec2(0., 0.), vec2(1., 0.), vec2(0., 1.), vec2(1., 1.)};\n" " gl_Position = vec4(positions[gl_VertexIndex % 4], 0., 1.);\n" " tc0 = coords[gl_VertexIndex % 4] * regs[0].xy;\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n" "#extension GL_ARB_separate_shader_objects : enable\n" "#extension GL_ARB_shader_stencil_export : enable\n\n" @@ -411,8 +408,7 @@ namespace vk "{\n" " vec4 rgba_in = texture(fs0, tc0);\n" " gl_FragDepth = rgba_in.w * 0.99609 + rgba_in.x * 0.00389 + rgba_in.y * 0.00002;\n" - "}\n" - }; + "}\n"; renderpass_config.set_depth_mask(true); renderpass_config.enable_depth_test(VK_COMPARE_OP_ALWAYS); @@ -463,7 +459,6 @@ namespace vk ui_overlay_renderer() { vs_src = - { "#version 450\n" "#extension GL_ARB_separate_shader_objects : enable\n" "layout(location=0) in vec4 in_pos;\n" @@ -490,11 +485,9 @@ namespace vk " vec4 pos = vec4((in_pos.xy * regs[0].zw) / regs[0].xy, 0.5, 1.);\n" " pos.xy = snap_to_grid(pos.xy);\n" " gl_Position = (pos + pos) - 1.;\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n" "#extension GL_ARB_separate_shader_objects : enable\n" "layout(set=0, binding=1) uniform sampler2D fs0;\n" @@ -576,8 +569,7 @@ namespace vk " ocol = texture(fs0, tc0).rrrr * diff_color;\n" " else\n" " ocol = sample_image(fs0, tc0, parameters2.x).bgra * diff_color;\n" - "}\n" - }; + "}\n"; renderpass_config.set_attachment_count(1); renderpass_config.set_color_mask(true, true, true, true); @@ -823,7 +815,6 @@ namespace vk attachment_clear_pass() { vs_src = - { "#version 450\n" "#extension GL_ARB_separate_shader_objects : enable\n" "layout(push_constant) uniform static_data{ vec4 regs[2]; };\n" @@ -839,11 +830,9 @@ namespace vk " color = regs[0];\n" " mask = regs[1];\n" " gl_Position = vec4(positions[gl_VertexIndex % 4], 0., 1.);\n" - "}\n" - }; + "}\n"; fs_src = - { "#version 420\n" "#extension GL_ARB_separate_shader_objects : enable\n" "layout(set=0, binding=1) uniform sampler2D fs0;\n" @@ -856,8 +845,7 @@ namespace vk "{\n" " vec4 original_color = texture(fs0, tc0);\n" " out_color = mix(original_color, color, bvec4(mask));\n" - "}\n" - }; + "}\n"; renderpass_config.set_depth_mask(false); renderpass_config.set_color_mask(true, true, true, true); From 948c1df96975c4620637439acd777c8d14b7c440 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Thu, 6 Jun 2019 20:42:18 -0700 Subject: [PATCH 10/11] Remove unecessary vulkan loader check var, per kd --- rpcs3/Emu/RSX/VK/VKHelpers.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index 02c10c52ecbb..38f0150011ba 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "stdafx.h" #include @@ -170,7 +170,7 @@ namespace vk void insert_buffer_memory_barrier(VkCommandBuffer cmd, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize length, VkPipelineStageFlags src_stage, VkPipelineStageFlags dst_stage, VkAccessFlags src_mask, VkAccessFlags dst_mask); - + void insert_image_memory_barrier(VkCommandBuffer cmd, VkImage image, VkImageLayout current_layout, VkImageLayout new_layout, VkPipelineStageFlags src_stage, VkPipelineStageFlags dst_stage, VkAccessFlags src_mask, VkAccessFlags dst_mask, const VkImageSubresourceRange& range); @@ -2313,7 +2313,6 @@ namespace vk PFN_vkCreateDebugReportCallbackEXT createDebugReportCallback = nullptr; VkDebugReportCallbackEXT m_debugger = nullptr; - bool loader_exists = false; bool extensions_loaded = false; public: @@ -2321,9 +2320,6 @@ namespace vk context() { m_instance = nullptr; - - //Check that some critical entry-points have been loaded into memory indicating presence of a loader - loader_exists = (vkCreateInstance != nullptr); } ~context() @@ -2370,8 +2366,6 @@ namespace vk uint32_t createInstance(const char *app_name, bool fast = false) { - if (!loader_exists) return 0; - //Initialize a vulkan instance VkApplicationInfo app = {}; @@ -2477,9 +2471,6 @@ namespace vk std::vector& enumerateDevices() { - if (!loader_exists) - return gpus; - uint32_t num_gpus; // This may fail on unsupported drivers, so just assume no devices if (vkEnumeratePhysicalDevices(m_instance, &num_gpus, nullptr) != VK_SUCCESS) From 232a35b6fcddfa39f22594cbc0650156c29b9327 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Thu, 6 Jun 2019 21:27:49 -0700 Subject: [PATCH 11/11] Various small warning fixes -Indentation warnings -prevent shift overflow -This was declared extern in all contexts. Remove this for initialization -Fix main return types. OH CANADA! -Silence extraneos 'unused expression' warning -Force use return value (warning) -Remove tautological compare copy-pasta (char always < 256) --- Utilities/Thread.cpp | 7 +++++-- rpcs3/Emu/Cell/Modules/cellOskDialog.cpp | 4 ++-- rpcs3/Emu/Cell/Modules/libmixer.cpp | 12 ++++++++---- rpcs3/Emu/RSX/Overlays/overlays.cpp | 2 +- rpcs3/Emu/RSX/VK/VKRenderPass.cpp | 2 +- rpcs3/main.cpp | 6 ++---- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index cd8033e87b68..e98c8b9d5a33 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1394,7 +1394,10 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) } // Reschedule - cpu->test_stopped(); + if (cpu->test_stopped()) + { + // + } if (Emu.IsStopped()) { @@ -1692,7 +1695,7 @@ const bool s_exception_handler_set = []() -> bool #endif // TODO -extern atomic_t g_thread_count(0); +atomic_t g_thread_count(0); thread_local DECLARE(thread_ctrl::g_tls_this_thread) = nullptr; diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index 96ba9eb7a085..e945db59420e 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -144,9 +144,9 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia vm::ptr string_to_send = vm::cast(vm::alloc(CELL_OSKDIALOG_STRING_SIZE * 2, vm::main)); atomic_t done = false; u32 return_value; - u32 i = 0; + u32 i; - for (i; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++) + for (i = 0; i < CELL_OSKDIALOG_STRING_SIZE - 1; i++) { string_to_send[i] = osk->osk_text[i]; if (osk->osk_text[i] == 0) break; diff --git a/rpcs3/Emu/Cell/Modules/libmixer.cpp b/rpcs3/Emu/Cell/Modules/libmixer.cpp index 61f8fa06c7b6..4ba14bbe3f0e 100644 --- a/rpcs3/Emu/Cell/Modules/libmixer.cpp +++ b/rpcs3/Emu/Cell/Modules/libmixer.cpp @@ -64,13 +64,17 @@ s32 cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, vm::ptr addr switch (type) { case CELL_SURMIXER_CHSTRIP_TYPE1A: - if (port >= g_surmx.ch_strips_1) type = 0; break; + if (port >= g_surmx.ch_strips_1) type = 0; + break; case CELL_SURMIXER_CHSTRIP_TYPE2A: - if (port >= g_surmx.ch_strips_2) type = 0; break; + if (port >= g_surmx.ch_strips_2) type = 0; + break; case CELL_SURMIXER_CHSTRIP_TYPE6A: - if (port >= g_surmx.ch_strips_6) type = 0; break; + if (port >= g_surmx.ch_strips_6) type = 0; + break; case CELL_SURMIXER_CHSTRIP_TYPE8A: - if (port >= g_surmx.ch_strips_8) type = 0; break; + if (port >= g_surmx.ch_strips_8) type = 0; + break; default: type = 0; break; } diff --git a/rpcs3/Emu/RSX/Overlays/overlays.cpp b/rpcs3/Emu/RSX/Overlays/overlays.cpp index 536eed477913..5eb722a66ad5 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlays.cpp @@ -143,7 +143,7 @@ std::u16string ascii8_to_utf16(const std::string& ascii_string) for (const auto& code : ascii_string) { - out.push_back(code > 0xFF ? '#' : (char16_t)code); + out.push_back((char16_t)code); } out.push_back(0); diff --git a/rpcs3/Emu/RSX/VK/VKRenderPass.cpp b/rpcs3/Emu/RSX/VK/VKRenderPass.cpp index c7f1d8d624f0..68956f64aeac 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderPass.cpp +++ b/rpcs3/Emu/RSX/VK/VKRenderPass.cpp @@ -52,7 +52,7 @@ namespace vk u64 get_renderpass_key(const std::vector& images, u64 previous_key) { // Partial update; assumes compatible renderpass keys - const u64 layout_mask = (0x7FFF << 22); + const u64 layout_mask = (0x7FFFull << 22); u64 key = previous_key & ~layout_mask; u64 layout_offset = 22; diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 5cbd1ee80075..501a76a3ac41 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -131,10 +131,8 @@ int main(int argc, char** argv) parser.process(app); // Don't start up the full rpcs3 gui if we just want the version or help. - if (parser.isSet(versionOption)) - return true; - if (parser.isSet(helpOption)) - return true; + if (parser.isSet(versionOption) || parser.isSet(helpOption)) + return 0; app.Init();