diff --git a/.ci/build-mac-arm64.sh b/.ci/build-mac-arm64.sh index 61bcf9cf50..0b7d554504 100644 --- a/.ci/build-mac-arm64.sh +++ b/.ci/build-mac-arm64.sh @@ -49,8 +49,8 @@ brew_arm64_install_packages 0mq aom aribb24 ca-certificates cjson dav1d ffmpeg@5 "$BREW_ARM64_PATH/bin/brew" link -f ffmpeg@5 ln -s "/opt/homebrew1/opt/llvm@$LLVM_COMPILER_VER/lib/unwind/libunwind.1.dylib" "/opt/homebrew1/opt/llvm@$LLVM_COMPILER_VER/lib/libunwind.1.dylib" -# moltenvk based on commit for 1.2.11 release -wget https://raw.githubusercontent.com/Homebrew/homebrew-core/6bfc8950c696d1f952425e8af2a6248603dc0df9/Formula/m/molten-vk.rb +# moltenvk based on commit for 1.3.0 release +wget https://raw.githubusercontent.com/Homebrew/homebrew-core/7255441cbcafabaa8950f67c7ec55ff499dbb2d3/Formula/m/molten-vk.rb /usr/local/bin/brew install -f --overwrite ./molten-vk.rb export CXX=clang++ export CC=clang diff --git a/.ci/build-mac.sh b/.ci/build-mac.sh index 2d87f9d60e..83ab07c1d9 100644 --- a/.ci/build-mac.sh +++ b/.ci/build-mac.sh @@ -16,8 +16,8 @@ arch -x86_64 /usr/local/bin/brew reinstall -f --build-from-source gnutls freetyp arch -x86_64 /usr/local/bin/brew install llvm@$LLVM_COMPILER_VER glew cmake sdl3 vulkan-headers coreutils arch -x86_64 /usr/local/bin/brew link -f llvm@$LLVM_COMPILER_VER ffmpeg@5 -# moltenvk based on commit for 1.2.11 release -wget https://raw.githubusercontent.com/Homebrew/homebrew-core/6bfc8950c696d1f952425e8af2a6248603dc0df9/Formula/m/molten-vk.rb +# moltenvk based on commit for 1.3.0 release +wget https://raw.githubusercontent.com/Homebrew/homebrew-core/7255441cbcafabaa8950f67c7ec55ff499dbb2d3/Formula/m/molten-vk.rb arch -x86_64 /usr/local/bin/brew install -f --overwrite ./molten-vk.rb export CXX=clang++ export CC=clang diff --git a/.ci/get_keys-windows.sh b/.ci/get_keys-windows.sh index 8c7ea9c14e..8384b4de5d 100644 --- a/.ci/get_keys-windows.sh +++ b/.ci/get_keys-windows.sh @@ -1,4 +1,3 @@ #!/bin/sh -ex curl -fLo "./llvm.lock" "https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-${LLVM_VER}/llvmlibs_mt.7z.sha256" -curl -fLo "./glslang.lock" "https://github.com/RPCS3/glslang/releases/download/custom-build-win/glslanglibs_mt.7z.sha256" diff --git a/.ci/setup-windows.sh b/.ci/setup-windows.sh index 78ec4d2348..8b6aaa6156 100755 --- a/.ci/setup-windows.sh +++ b/.ci/setup-windows.sh @@ -20,7 +20,6 @@ QT_TOOL_URL="${QT_HOST}${QT_PREFIX}${QT_PREFIX_2}qttools${QT_SUFFIX}" QT_MM_URL="${QT_HOST}${QT_PREFIX}addons.qtmultimedia.${QT_PREFIX_2}qtmultimedia${QT_SUFFIX}" QT_SVG_URL="${QT_HOST}${QT_PREFIX}${QT_PREFIX_2}qtsvg${QT_SUFFIX}" LLVMLIBS_URL="https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-${LLVM_VER}/llvmlibs_mt.7z" -GLSLANG_URL='https://github.com/RPCS3/glslang/releases/latest/download/glslanglibs_mt.7z' VULKAN_SDK_URL="https://www.dropbox.com/scl/fi/sjjh0fc4ld281pjbl2xzu/VulkanSDK-${VULKAN_VER}-Installer.exe?rlkey=f6wzc0lvms5vwkt2z3qabfv9d&dl=1" CCACHE_URL="https://github.com/ccache/ccache/releases/download/v4.11.2/ccache-4.11.2-windows-x86_64.zip" @@ -31,7 +30,6 @@ DEP_URLS=" \ $QT_MM_URL \ $QT_SVG_URL \ $LLVMLIBS_URL \ - $GLSLANG_URL \ $VULKAN_SDK_URL\ $CCACHE_URL" @@ -80,7 +78,6 @@ for url in $DEP_URLS; do case "$url" in *qt*) checksum=$(curl -fL "${url}.sha1"); algo="sha1"; outDir="$QTDIR/" ;; *llvm*) checksum=$(curl -fL "${url}.sha256"); algo="sha256"; outDir="./build/lib_ext/Release-x64" ;; - *glslang*) checksum=$(curl -fL "${url}.sha256"); algo="sha256"; outDir="./build/lib_ext/Release-x64" ;; *ccache*) checksum=$CCACHE_SHA; algo="sha256"; outDir="$CCACHE_BIN_DIR" ;; *Vulkan*) # Vulkan setup needs to be run in batch environment diff --git a/.github/workflows/rpcs3.yml b/.github/workflows/rpcs3.yml index 2f68adefd5..f09655cb76 100644 --- a/.github/workflows/rpcs3.yml +++ b/.github/workflows/rpcs3.yml @@ -159,7 +159,7 @@ jobs: uses: actions/cache@main with: path: ${{ env.DEPS_CACHE_DIR }} - key: "${{ runner.os }}-${{ env.COMPILER }}-${{ env.QT_VER }}-${{ env.VULKAN_SDK_SHA }}-${{ env.CCACHE_SHA }}-${{ hashFiles('llvm.lock') }}-${{ hashFiles('glslang.lock') }}" + key: "${{ runner.os }}-${{ env.COMPILER }}-${{ env.QT_VER }}-${{ env.VULKAN_SDK_SHA }}-${{ env.CCACHE_SHA }}-${{ hashFiles('llvm.lock') }}" restore-keys: ${{ runner.os }}-${{ env.COMPILER }}- - name: Download and unpack dependencies diff --git a/3rdparty/MoltenVK/CMakeLists.txt b/3rdparty/MoltenVK/CMakeLists.txt index 59959eecd5..ec9c2b802b 100644 --- a/3rdparty/MoltenVK/CMakeLists.txt +++ b/3rdparty/MoltenVK/CMakeLists.txt @@ -3,7 +3,7 @@ include(ExternalProject) ExternalProject_Add(moltenvk GIT_REPOSITORY https://github.com/KhronosGroup/MoltenVK.git - GIT_TAG 81541f6 + GIT_TAG 49b97f2 BUILD_IN_SOURCE 1 SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK CONFIGURE_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK/fetchDependencies" --macos diff --git a/3rdparty/glslang/glslang b/3rdparty/glslang/glslang index 36d08c0d94..fc9889c889 160000 --- a/3rdparty/glslang/glslang +++ b/3rdparty/glslang/glslang @@ -1 +1 @@ -Subproject commit 36d08c0d940cf307a23928299ef52c7970d8cee6 +Subproject commit fc9889c889561c5882e83819dcaffef5ed45529b diff --git a/3rdparty/glslang/glslang.vcxproj b/3rdparty/glslang/glslang.vcxproj index 762fff7622..298fd149c6 100644 --- a/3rdparty/glslang/glslang.vcxproj +++ b/3rdparty/glslang/glslang.vcxproj @@ -39,17 +39,15 @@ "Visual Studio $(VisualStudioVersion.Substring(0,2))" call vsdevcmd.bat -arch=amd64 - cmake -G $(CmakeGenerator) -A x64 -DCMAKE_BUILD_TYPE="Release" -DLLVM_USE_CRT_DEBUG=MDd -DLLVM_USE_CRT_RELEASE=MT -DENABLE_OPT=OFF -S glslang -B "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)" + cmake -G $(CmakeGenerator) -A x64 -DCMAKE_BUILD_TYPE="Release" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DGLSLANG_TESTS=OFF -DENABLE_GLSLANG_BINARIES=OFF -DBUILD_EXTERNAL=OFF -DENABLE_SPVREMAPPER=OFF -DENABLE_HLSL=OFF -DENABLE_OPT=OFF -S glslang -B "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)" call vsdevcmd.bat -arch=amd64 - cmake -G $(CmakeGenerator) -A x64 -DCMAKE_BUILD_TYPE="Debug" -DLLVM_USE_CRT_DEBUG=MDd -DLLVM_USE_CRT_RELEASE=MT -DENABLE_OPT=OFF -S glslang -B "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)" + cmake -G $(CmakeGenerator) -A x64 -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -DGLSLANG_TESTS=OFF -DENABLE_GLSLANG_BINARIES=OFF -DBUILD_EXTERNAL=OFF -DENABLE_SPVREMAPPER=OFF -DENABLE_HLSL=OFF -DENABLE_OPT=OFF -S glslang -B "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)" echo Copying.. mkdir "$(SolutionDir)build\lib\$(Configuration)-$(Platform)\$(ProjectName)" - copy "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)\hlsl\$(CONFIGURATION)\*.lib" "$(SolutionDir)build\lib\$(Configuration)-$(Platform)\$(ProjectName)" copy "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)\SPIRV\$(CONFIGURATION)\*.lib" "$(SolutionDir)build\lib\$(Configuration)-$(Platform)\$(ProjectName)" - copy "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)\OGLCompilersDLL\$(CONFIGURATION)\*.lib" "$(SolutionDir)build\lib\$(Configuration)-$(Platform)\$(ProjectName)" copy "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)\glslang\OSDependent\Windows\$(CONFIGURATION)\*.lib" "$(SolutionDir)build\lib\$(Configuration)-$(Platform)\$(ProjectName)" copy "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)\glslang\$(CONFIGURATION)\*.lib" "$(SolutionDir)build\lib\$(Configuration)-$(Platform)\$(ProjectName)" diff --git a/3rdparty/libsdl-org/SDL b/3rdparty/libsdl-org/SDL index 877399b2b2..5ac37a8ffc 160000 --- a/3rdparty/libsdl-org/SDL +++ b/3rdparty/libsdl-org/SDL @@ -1 +1 @@ -Subproject commit 877399b2b2cf21e67554ed9046410f268ce1d1b2 +Subproject commit 5ac37a8ffcf89da390404c1016833d56e2d67ae4 diff --git a/3rdparty/libsdl-org/SDL.vcxproj b/3rdparty/libsdl-org/SDL.vcxproj index e062060fab..81b7d853a5 100644 --- a/3rdparty/libsdl-org/SDL.vcxproj +++ b/3rdparty/libsdl-org/SDL.vcxproj @@ -532,8 +532,6 @@ SDL\include;SDL\include\build_config;%(AdditionalIncludeDirectories) ProgramDatabase MaxSpeed - SDL_HIDAPI_DISABLED;%(PreprocessorDefinitions) - SDL_HIDAPI_DISABLED;%(PreprocessorDefinitions) diff --git a/BUILDING.md b/BUILDING.md index d9131e5929..09f523d567 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -129,19 +129,17 @@ Start **Visual Studio**, click on `Open a project or solution` and select the `r **NOTE:** The recommended build configuration is `Release`. (On older revisions: `Release - LLVM`) -To speed up the compilation time, you may want to download and extract to `\build\lib_ext\<$(Configuration)>-x64` (e.g. `c:\rpcs3\build\lib_ext\Release-x64`; the path needs to be created) some of the following precompiled libs: +To speed up the compilation time, you may want to download and extract to `\build\lib_ext\<$(Configuration)>-x64` (e.g. `c:\rpcs3\build\lib_ext\Release-x64`; the path needs to be created) the following precompiled lib: - [LLVM libs](https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win-19.1.7/llvmlibs_mt.7z) -- [additional libs](https://github.com/RPCS3/glslang/releases/latest/download/glslanglibs_mt.7z) **NOTES:** - `<$(Configuration)>` can assume values `Release` or `Debug`. -- Unoptimised/debug libs are currently not available precompiled for both **LLVM** and **glslang**. Trying to use them when building the **RPCS3** application in `Debug` mode will provide a `cannot open file` error. +- Unoptimised/debug libs are currently not available precompiled for **LLVM**. Trying to use it when building the **RPCS3** application in `Debug` mode will provide a `cannot open file` error. If you're not using the precompiled libs, those dependency libs need to be compiled first. From the `Solution Explorer` panel: 1) expand `__BUILD_BEFORE` 2) from the `Solution Configurations` drop-down menu, select `Release` (select `Debug` if you want to build in `Debug` mode) -3) one after another, right-click on the following projects and then click on `Build` to build the selected lib: - - `glslang` +3) right-click one of the following projects and then click on `Build` to build the selected lib: - `llvm_build` - or `llvm_build_clang_cl` (if you have also the **clang** compiler installed on VS) diff --git a/Utilities/lockless.h b/Utilities/lockless.h index 63c2774bc8..5028b398c3 100644 --- a/Utilities/lockless.h +++ b/Utilities/lockless.h @@ -384,7 +384,7 @@ public: template class lf_queue final { -public: +private: struct fat_ptr { u64 ptr{}; @@ -392,7 +392,6 @@ public: u32 reserved{}; }; -private: atomic_t m_head{fat_ptr{}}; lf_queue_item* load(fat_ptr value) const noexcept @@ -439,8 +438,7 @@ public: return *this; } - delete load(m_head); - m_head.release(other.m_head.exchange(fat_ptr{})); + delete load(m_head.exchange(other.m_head.exchange(fat_ptr{}))); return *this; } @@ -453,10 +451,15 @@ public: { if (!operator bool()) { - utils::bless>(&m_head.raw().is_non_null)->wait(0); + get_wait_atomic().wait(0); } } + atomic_t &get_wait_atomic() + { + return *utils::bless>(&m_head.raw().is_non_null); + } + const volatile void* observe() const noexcept { return load(m_head); @@ -491,7 +494,7 @@ public: { if (force || operator bool()) { - utils::bless>(&m_head.raw().is_non_null)->notify_one(); + get_wait_atomic().notify_one(); } } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dec0cd190b..97970a521d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -105,7 +105,7 @@ jobs: # - task: Cache@2 # inputs: -# key: $(Agent.OS) | $(COMPILER) | "$(QT_VER)" | $(VULKAN_SDK_SHA) | $(CCACHE_SHA) | llvm.lock | glslang.lock +# key: $(Agent.OS) | $(COMPILER) | "$(QT_VER)" | $(VULKAN_SDK_SHA) | $(CCACHE_SHA) | llvm.lock # path: $(DEPS_CACHE_DIR) # displayName: Dependencies Cache diff --git a/rpcs3.sln b/rpcs3.sln index be1e9a6ec8..acc5528038 100644 --- a/rpcs3.sln +++ b/rpcs3.sln @@ -151,7 +151,9 @@ Global {60F89955-91C6-3A36-8000-13C592FEC2DF}.Release|x64.ActiveCfg = Release|x64 {60F89955-91C6-3A36-8000-13C592FEC2DF}.Release|x64.Build.0 = Release|x64 {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Debug|x64.ActiveCfg = Debug|x64 + {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Debug|x64.Build.0 = Debug|x64 {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Release|x64.ActiveCfg = Release|x64 + {8F85B6CC-250F-4ACA-A617-E820A74E3E3C}.Release|x64.Build.0 = Release|x64 {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Debug|x64.ActiveCfg = Debug|x64 {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Debug|x64.Build.0 = Debug|x64 {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D}.Release|x64.ActiveCfg = Release|x64 @@ -243,7 +245,7 @@ Global {EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8} {D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8} {60F89955-91C6-3A36-8000-13C592FEC2DF} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8} - {8F85B6CC-250F-4ACA-A617-E820A74E3E3C} = {B0AC29FD-7B01-4B5E-9C8D-0A081E4C5668} + {8F85B6CC-250F-4ACA-A617-E820A74E3E3C} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8} {3EE5F075-B546-42C4-B6A8-E3CCEF38B78D} = {10FBF193-D532-4CCF-B875-4C7091A7F6C2} {FDC361C5-7734-493B-8CFB-037308B35122} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8} {A107C21C-418A-4697-BB10-20C3AA60E2E4} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8} diff --git a/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp b/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp index ae1d5bd889..d73efc8e84 100644 --- a/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp +++ b/rpcs3/Emu/Cell/SPUCommonRecompiler.cpp @@ -7376,7 +7376,7 @@ struct spu_llvm_worker set_relax_flag = false; } - thread_ctrl::wait_on(utils::bless>(®istered)[1], 0); + thread_ctrl::wait_on(registered.get_wait_atomic(), 0); slice = registered.pop_all(); }()) { @@ -7491,7 +7491,7 @@ struct spu_llvm while (!registered && thread_ctrl::state() != thread_state::aborting) { // Wait for the first SPU block before launching any thread - thread_ctrl::wait_on(utils::bless>(®istered)[1], 0); + thread_ctrl::wait_on(registered.get_wait_atomic(), 0); } if (thread_ctrl::state() == thread_state::aborting) @@ -7594,7 +7594,7 @@ struct spu_llvm // Interrupt profiler thread and put it to sleep static_cast(prof_mutex.reset()); - thread_ctrl::wait_on(utils::bless>(®istered)[1], 0); + thread_ctrl::wait_on(registered.get_wait_atomic(), 0); std::fill(notify_compile.begin(), notify_compile.end(), 0); // Reset notification flags notify_compile_count = 0; compile_pending = 0; diff --git a/rpcs3/Emu/RSX/GL/GLDraw.cpp b/rpcs3/Emu/RSX/GL/GLDraw.cpp index c02f12c8c4..1a0515ef48 100644 --- a/rpcs3/Emu/RSX/GL/GLDraw.cpp +++ b/rpcs3/Emu/RSX/GL/GLDraw.cpp @@ -387,6 +387,16 @@ void GLGSRender::load_texture_env() { m_graphics_state |= rsx::fragment_program_state_dirty; } + + if (const auto texture_format = tex.format() & ~(CELL_GCM_TEXTURE_UN | CELL_GCM_TEXTURE_LN); + sampler_state->format_class != rsx::classify_format(texture_format) && + (texture_format == CELL_GCM_TEXTURE_A8R8G8B8 || texture_format == CELL_GCM_TEXTURE_D8R8G8B8)) + { + // Depth format redirected to BGRA8 resample stage. Do not filter to avoid bits leaking. + // If accurate graphics are desired, force a bitcast to COLOR as a workaround. + m_fs_sampler_states[i].set_parameteri(GL_TEXTURE_MIN_FILTER, GL_NEAREST); + m_fs_sampler_states[i].set_parameteri(GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } } } else diff --git a/rpcs3/Emu/RSX/Program/SPIRVCommon.cpp b/rpcs3/Emu/RSX/Program/SPIRVCommon.cpp index f40ff06161..501c0e6b51 100644 --- a/rpcs3/Emu/RSX/Program/SPIRVCommon.cpp +++ b/rpcs3/Emu/RSX/Program/SPIRVCommon.cpp @@ -13,6 +13,8 @@ #endif #endif #include "3rdparty/glslang/glslang/SPIRV/GlslangToSpv.h" +#include "3rdparty/glslang/glslang/glslang/Include/ResourceLimits.h" +#include "3rdparty/glslang/glslang/glslang/Public/ShaderLang.h" #ifdef _MSC_VER #pragma warning(pop) #else diff --git a/rpcs3/Emu/RSX/VK/VKDraw.cpp b/rpcs3/Emu/RSX/VK/VKDraw.cpp index 563ec9260f..3b760f103f 100644 --- a/rpcs3/Emu/RSX/VK/VKDraw.cpp +++ b/rpcs3/Emu/RSX/VK/VKDraw.cpp @@ -324,6 +324,12 @@ void VKGSRender::load_texture_env() // Most PS3-like formats can be linearly filtered without problem can_sample_linear = true; } + else if (sampler_state->format_class != rsx::classify_format(texture_format) && + (texture_format == CELL_GCM_TEXTURE_A8R8G8B8 || texture_format == CELL_GCM_TEXTURE_D8R8G8B8)) + { + // Depth format redirected to BGRA8 resample stage. Do not filter to avoid bits leaking + can_sample_linear = false; + } else { // Not all GPUs support linear filtering of depth formats diff --git a/rpcs3/Emu/RSX/VK/vkutils/device.cpp b/rpcs3/Emu/RSX/VK/vkutils/device.cpp index 9fbb4e743b..8aa6a6fed8 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/device.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/device.cpp @@ -150,15 +150,57 @@ namespace vk // v3dv and PanVK support BC1-BC3 which is all we require, support is reported as false since not all formats are supported optional_features_support.texture_compression_bc = features.textureCompressionBC || get_driver_vendor() == driver_vendor::V3DV || get_driver_vendor() == driver_vendor::PANVK; + + // Texel buffer UAB is reported to the trigger for some driver crashes on older NV cards + if (get_driver_vendor() == driver_vendor::NVIDIA && + get_chip_class() >= chip_class::NV_kepler && + get_chip_class() <= chip_class::NV_pascal) + { + // UBOs are unsupported on these cards anyway, disable texel buffers as well + descriptor_indexing_support.update_after_bind_mask &= ~(1ull << VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER); + } } - void physical_device::get_physical_device_properties(bool allow_extensions) + void physical_device::get_physical_device_properties_0(bool allow_extensions) { + // Core properties only vkGetPhysicalDeviceMemoryProperties(dev, &memory_properties); + vkGetPhysicalDeviceProperties(dev, &props); if (!allow_extensions) { - vkGetPhysicalDeviceProperties(dev, &props); + return; + } + + // Try to query driver properties if possible + supported_extensions instance_extensions(supported_extensions::instance); + supported_extensions device_extensions(supported_extensions::device, nullptr, dev); + + if (!instance_extensions.is_supported(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) || + !device_extensions.is_supported(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME)) + { + return; + } + + VkPhysicalDeviceProperties2KHR properties2; + properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; + properties2.pNext = nullptr; + + driver_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR; + driver_properties.pNext = properties2.pNext; + properties2.pNext = &driver_properties; + + auto _vkGetPhysicalDeviceProperties2KHR = reinterpret_cast(vkGetInstanceProcAddr(parent, "vkGetPhysicalDeviceProperties2KHR")); + ensure(_vkGetPhysicalDeviceProperties2KHR); + + _vkGetPhysicalDeviceProperties2KHR(dev, &properties2); + } + + void physical_device::get_physical_device_properties_1(bool allow_extensions) + { + // Extended properties. Call after checking for features + if (!allow_extensions) + { return; } @@ -167,67 +209,58 @@ namespace vk if (!instance_extensions.is_supported(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { - vkGetPhysicalDeviceProperties(dev, &props); + return; } - else + + VkPhysicalDeviceProperties2KHR properties2; + properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; + properties2.pNext = nullptr; + + VkPhysicalDeviceDescriptorIndexingPropertiesEXT descriptor_indexing_props{}; + VkPhysicalDeviceMultiDrawPropertiesEXT multidraw_props{}; + + if (descriptor_indexing_support) { - VkPhysicalDeviceProperties2KHR properties2; - properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; - properties2.pNext = nullptr; + descriptor_indexing_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT; + descriptor_indexing_props.pNext = properties2.pNext; + properties2.pNext = &descriptor_indexing_props; + } - VkPhysicalDeviceDescriptorIndexingPropertiesEXT descriptor_indexing_props{}; - VkPhysicalDeviceMultiDrawPropertiesEXT multidraw_props{}; + if (multidraw_support.supported) + { + multidraw_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; + multidraw_props.pNext = properties2.pNext; + properties2.pNext = &multidraw_props; + } - if (descriptor_indexing_support) + auto _vkGetPhysicalDeviceProperties2KHR = reinterpret_cast(vkGetInstanceProcAddr(parent, "vkGetPhysicalDeviceProperties2KHR")); + ensure(_vkGetPhysicalDeviceProperties2KHR); + + _vkGetPhysicalDeviceProperties2KHR(dev, &properties2); + props = properties2.properties; + + if (descriptor_indexing_support) + { + if (descriptor_indexing_props.maxUpdateAfterBindDescriptorsInAllPools < 800'000) { - descriptor_indexing_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT; - descriptor_indexing_props.pNext = properties2.pNext; - properties2.pNext = &descriptor_indexing_props; + rsx_log.error("Physical device does not support enough descriptors for deferred updates to work effectively. Deferred updates are disabled."); + descriptor_indexing_support.update_after_bind_mask = 0; } - - if (multidraw_support.supported) + else if (descriptor_indexing_props.maxUpdateAfterBindDescriptorsInAllPools < 2'000'000) { - multidraw_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; - multidraw_props.pNext = properties2.pNext; - properties2.pNext = &multidraw_props; + rsx_log.warning("Physical device reports a low amount of allowed deferred descriptor updates. Draw call threshold will be lowered accordingly."); + descriptor_max_draw_calls = 8192; } + } - if (device_extensions.is_supported(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME)) + if (multidraw_support.supported) + { + multidraw_support.max_batch_size = multidraw_props.maxMultiDrawCount; + + if (!multidraw_props.maxMultiDrawCount) { - driver_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR; - driver_properties.pNext = properties2.pNext; - properties2.pNext = &driver_properties; - } - - auto _vkGetPhysicalDeviceProperties2KHR = reinterpret_cast(vkGetInstanceProcAddr(parent, "vkGetPhysicalDeviceProperties2KHR")); - ensure(_vkGetPhysicalDeviceProperties2KHR); - - _vkGetPhysicalDeviceProperties2KHR(dev, &properties2); - props = properties2.properties; - - if (descriptor_indexing_support) - { - if (descriptor_indexing_props.maxUpdateAfterBindDescriptorsInAllPools < 800'000) - { - rsx_log.error("Physical device does not support enough descriptors for deferred updates to work effectively. Deferred updates are disabled."); - descriptor_indexing_support.update_after_bind_mask = 0; - } - else if (descriptor_indexing_props.maxUpdateAfterBindDescriptorsInAllPools < 2'000'000) - { - rsx_log.warning("Physical device reports a low amount of allowed deferred descriptor updates. Draw call threshold will be lowered accordingly."); - descriptor_max_draw_calls = 8192; - } - } - - if (multidraw_support.supported) - { - multidraw_support.max_batch_size = multidraw_props.maxMultiDrawCount; - - if (!multidraw_props.maxMultiDrawCount) - { - rsx_log.error("Physical device reports 0 support maxMultiDraw count. Multidraw support will be disabled."); - multidraw_support.supported = false; - } + rsx_log.error("Physical device reports 0 support maxMultiDraw count. Multidraw support will be disabled."); + multidraw_support.supported = false; } } } @@ -237,8 +270,9 @@ namespace vk dev = pdev; parent = context; + get_physical_device_properties_0(allow_extensions); get_physical_device_features(allow_extensions); - get_physical_device_properties(allow_extensions); + get_physical_device_properties_1(allow_extensions); rsx_log.always()("Found Vulkan-compatible GPU: '%s' running on driver %s", get_name(), get_driver_version()); diff --git a/rpcs3/Emu/RSX/VK/vkutils/device.h b/rpcs3/Emu/RSX/VK/vkutils/device.h index badff435ff..daf567ebfa 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/device.h +++ b/rpcs3/Emu/RSX/VK/vkutils/device.h @@ -106,7 +106,8 @@ namespace vk friend class render_device; private: void get_physical_device_features(bool allow_extensions); - void get_physical_device_properties(bool allow_extensions); + void get_physical_device_properties_0(bool allow_extensions); + void get_physical_device_properties_1(bool allow_extensions); public: diff --git a/rpcs3/Input/sdl_instance.cpp b/rpcs3/Input/sdl_instance.cpp index a27a8e40de..2cc434c006 100644 --- a/rpcs3/Input/sdl_instance.cpp +++ b/rpcs3/Input/sdl_instance.cpp @@ -40,6 +40,14 @@ void sdl_instance::pump_events() SDL_PumpEvents(); } +void sdl_instance::set_hint(const char* name, const char* value) +{ + if (!SDL_SetHint(name, value)) + { + sdl_log.error("Could not set hint '%s' to '%s': %s", name, value, SDL_GetError()); + } +} + bool sdl_instance::initialize() { const std::lock_guard lock(m_instance_mutex); @@ -52,10 +60,14 @@ bool sdl_instance::initialize() sdl_log.notice("Initializing SDL ..."); // Set non-dynamic hints before SDL_Init - if (!SDL_SetHint(SDL_HINT_JOYSTICK_THREAD, "1")) - { - sdl_log.error("Could not set SDL_HINT_JOYSTICK_THREAD: %s", SDL_GetError()); - } + set_hint(SDL_HINT_JOYSTICK_THREAD, "1"); + + // DS3 pressure sensitive buttons +#ifdef _WIN32 + set_hint(SDL_HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER, "1"); +#else + set_hint(SDL_HINT_JOYSTICK_HIDAPI_PS3, "1"); +#endif if (!SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD)) { @@ -96,6 +108,9 @@ bool sdl_instance::initialize() case SDL_LOG_CATEGORY_TEST: category_name = "test"; break; + case SDL_LOG_CATEGORY_GPU: + category_name = "gpu"; + break; default: category_name = fmt::format("unknown(%d)", category); break; diff --git a/rpcs3/Input/sdl_instance.h b/rpcs3/Input/sdl_instance.h index 8a1d1b6029..9463b36900 100644 --- a/rpcs3/Input/sdl_instance.h +++ b/rpcs3/Input/sdl_instance.h @@ -1,5 +1,7 @@ #pragma once +#ifdef HAVE_SDL3 + #include struct sdl_instance @@ -14,6 +16,10 @@ public: void pump_events(); private: + void set_hint(const char* name, const char* value); + bool m_initialized = false; std::mutex m_instance_mutex; }; + +#endif diff --git a/rpcs3/Input/sdl_pad_handler.cpp b/rpcs3/Input/sdl_pad_handler.cpp index 244cd6006a..a9f1f0dc02 100644 --- a/rpcs3/Input/sdl_pad_handler.cpp +++ b/rpcs3/Input/sdl_pad_handler.cpp @@ -32,6 +32,11 @@ sdl_pad_handler::sdl_pad_handler() : PadHandlerBase(pad_handler::sdl) { SDLKeyCodes::RS, "RS" }, { SDLKeyCodes::Guide, "Guide" }, { SDLKeyCodes::Misc1, "Misc 1" }, + { SDLKeyCodes::Misc2, "Misc 2" }, + { SDLKeyCodes::Misc3, "Misc 3" }, + { SDLKeyCodes::Misc4, "Misc 4" }, + { SDLKeyCodes::Misc5, "Misc 5" }, + { SDLKeyCodes::Misc6, "Misc 6" }, { SDLKeyCodes::RPaddle1, "R Paddle 1" }, { SDLKeyCodes::LPaddle1, "L Paddle 1" }, { SDLKeyCodes::RPaddle2, "R Paddle 2" }, @@ -51,6 +56,16 @@ sdl_pad_handler::sdl_pad_handler() : PadHandlerBase(pad_handler::sdl) { SDLKeyCodes::RSXPos, "RS X+" }, { SDLKeyCodes::RSYPos, "RS Y+" }, { SDLKeyCodes::RSYNeg, "RS Y-" }, + { SDLKeyCodes::PressureCross, "South" }, // Same name as non-pressure button + { SDLKeyCodes::PressureCircle, "East" }, // Same name as non-pressure button + { SDLKeyCodes::PressureSquare, "West" }, // Same name as non-pressure button + { SDLKeyCodes::PressureTriangle, "North" }, // Same name as non-pressure button + { SDLKeyCodes::PressureL1, "LB" }, // Same name as non-pressure button + { SDLKeyCodes::PressureR1, "RB" }, // Same name as non-pressure button + { SDLKeyCodes::PressureUp, "Up" }, // Same name as non-pressure button + { SDLKeyCodes::PressureDown, "Down" }, // Same name as non-pressure button + { SDLKeyCodes::PressureLeft, "Left" }, // Same name as non-pressure button + { SDLKeyCodes::PressureRight, "Right" }, // Same name as non-pressure button }; init_configs(); @@ -242,6 +257,7 @@ SDLDevice::sdl_info sdl_pad_handler::get_sdl_info(SDL_JoystickID id) } info.type = SDL_GetGamepadType(info.gamepad); + info.real_type = SDL_GetRealGamepadType(info.gamepad); info.vid = SDL_GetGamepadVendor(info.gamepad); info.pid = SDL_GetGamepadProduct(info.gamepad); info.product_version = SDL_GetGamepadProductVersion(info.gamepad); @@ -275,8 +291,8 @@ SDLDevice::sdl_info sdl_pad_handler::get_sdl_info(SDL_JoystickID id) } } - sdl_log.notice("Found game pad %d: type=%d, name='%s', path='%s', serial='%s', vid=0x%x, pid=0x%x, product_version=0x%x, firmware_version=0x%x, has_led=%d, has_player_led=%d, has_mono_led=%d, has_rumble=%d, has_rumble_triggers=%d, has_accel=%d, has_gyro=%d", - id, static_cast(info.type), info.name, info.path, info.serial, info.vid, info.pid, info.product_version, info.firmware_version, info.has_led, info.has_player_led, info.has_mono_led, info.has_rumble, info.has_rumble_triggers, info.has_accel, info.has_gyro); + sdl_log.notice("Found game pad %d: type=%d, real_type=%d, name='%s', path='%s', serial='%s', vid=0x%x, pid=0x%x, product_version=0x%x, firmware_version=0x%x, has_led=%d, has_player_led=%d, has_mono_led=%d, has_rumble=%d, has_rumble_triggers=%d, has_accel=%d, has_gyro=%d", + id, static_cast(info.type), static_cast(info.real_type), info.name, info.path, info.serial, info.vid, info.pid, info.product_version, info.firmware_version, info.has_led, info.has_player_led, info.has_mono_led, info.has_rumble, info.has_rumble_triggers, info.has_accel, info.has_gyro); if (info.has_accel) { @@ -326,6 +342,33 @@ SDLDevice::sdl_info sdl_pad_handler::get_sdl_info(SDL_JoystickID id) } } + // The DS3 may have extra pressure sensitive buttons as axis + if (info.real_type == SDL_GamepadType::SDL_GAMEPAD_TYPE_PS3) + { + if (SDL_Joystick* joystick = SDL_GetGamepadJoystick(info.gamepad)) + { + const int num_axes = SDL_GetNumJoystickAxes(joystick); + const int num_buttons = SDL_GetNumJoystickButtons(joystick); + + info.is_ds3_with_pressure_buttons = num_axes == 16 && num_buttons == 11; + + sdl_log.notice("DS3 device %d has %d axis and %d buttons (has_pressure_buttons=%d)", id, num_axes, num_buttons, info.is_ds3_with_pressure_buttons); + + if (info.is_ds3_with_pressure_buttons) + { + // Add pressure buttons + for (int i = SDL_GAMEPAD_AXIS_COUNT; i < num_axes; i++) + { + const SDL_GamepadAxis axis_id = static_cast(i); + //if (SDL_GamepadHasAxis(info.gamepad, axis_id)) // Always returns false for axis >= SDL_GAMEPAD_AXIS_COUNT + { + info.axis_ids.insert(axis_id); + } + } + } + } + } + return info; } @@ -623,7 +666,7 @@ void sdl_pad_handler::get_extended_info(const pad_ensemble& binding) { const f32 accel_x = dev->values_accel[0]; // Angular speed around the x axis (pitch) const f32 accel_y = dev->values_accel[1]; // Angular speed around the y axis (yaw) - const f32 accel_z = dev->values_accel[2]; // Angular speed around the z axis (roll + const f32 accel_z = dev->values_accel[2]; // Angular speed around the z axis (roll) // Convert to ds3. The ds3 resolution is 113/G. pad->m_sensors[0].m_value = Clamp0To1023((accel_x / SDL_STANDARD_GRAVITY) * -1 * MOTION_ONE_G + 512); @@ -873,18 +916,61 @@ std::unordered_map sdl_pad_handler::get_button_values(const std::share if (!dev || !dev->sdl.gamepad) return values; + std::set pressed_pressure_buttons; + for (SDL_GamepadButton button_id : dev->sdl.button_ids) { - const u8 value = SDL_GetGamepadButton(dev->sdl.gamepad, button_id); + const bool value = SDL_GetGamepadButton(dev->sdl.gamepad, button_id); const SDLKeyCodes key_code = get_button_code(button_id); - // TODO: SDL does not support DS3 button intensity in the current version + // NOTE: SDL does not simply support DS3 button intensity in the current version + // So we have to skip the normal buttons if a DS3 with pressure buttons was detected + if (dev->sdl.is_ds3_with_pressure_buttons) + { + switch (key_code) + { + case SDLKeyCodes::North: + case SDLKeyCodes::South: + case SDLKeyCodes::West: + case SDLKeyCodes::East: + case SDLKeyCodes::Left: + case SDLKeyCodes::Right: + case SDLKeyCodes::Up: + case SDLKeyCodes::Down: + case SDLKeyCodes::LB: + case SDLKeyCodes::RB: + { + static const std::map button_to_pressure = + { + { SDLKeyCodes::South, SDLKeyCodes::PressureCross }, + { SDLKeyCodes::East, SDLKeyCodes::PressureCircle }, + { SDLKeyCodes::West, SDLKeyCodes::PressureSquare }, + { SDLKeyCodes::North, SDLKeyCodes::PressureTriangle }, + { SDLKeyCodes::LB, SDLKeyCodes::PressureL1 }, + { SDLKeyCodes::RB, SDLKeyCodes::PressureR1 }, + { SDLKeyCodes::Up, SDLKeyCodes::PressureUp }, + { SDLKeyCodes::Down, SDLKeyCodes::PressureDown }, + { SDLKeyCodes::Left, SDLKeyCodes::PressureLeft }, + { SDLKeyCodes::Right, SDLKeyCodes::PressureRight } + }; + + if (value) + { + pressed_pressure_buttons.insert(::at32(button_to_pressure, key_code)); + } + continue; + } + default: + break; + } + } + values[key_code] = value ? 255 : 0; } for (SDL_GamepadAxis axis_id : dev->sdl.axis_ids) { - const s16 value = SDL_GetGamepadAxis(dev->sdl.gamepad, axis_id); + s16 value = SDL_GetGamepadAxis(dev->sdl.gamepad, axis_id); switch (axis_id) { @@ -911,8 +997,32 @@ std::unordered_map sdl_pad_handler::get_button_values(const std::share values[SDLKeyCodes::RSYPos] = value < 0 ? std::abs(value) - 1 : 0; break; default: + { + if (dev->sdl.is_ds3_with_pressure_buttons) + { + // Get pressure button value from axis + if (const int key_code = SDLKeyCodes::PressureBegin + 1 + axis_id - SDL_GAMEPAD_AXIS_COUNT; + key_code > SDLKeyCodes::PressureBegin && key_code < SDLKeyCodes::PressureEnd) + { + // We need to get the joystick value directly for axis >= SDL_GAMEPAD_AXIS_COUNT + if (SDL_Joystick* joystick = SDL_GetGamepadJoystick(dev->sdl.gamepad)) + { + value = SDL_GetJoystickAxis(joystick, axis_id); + } + + value = static_cast(ScaledInput(value, SDL_JOYSTICK_AXIS_MIN, SDL_JOYSTICK_AXIS_MAX, 0.0f, 255.0f)); + + if (value <= 0 && pressed_pressure_buttons.contains(static_cast(key_code))) + { + value = 1; + } + + values[key_code] = Clamp0To255(value); + } + } break; } + } } for (const SDLDevice::touchpad& touchpad : dev->sdl.touchpads) @@ -1006,6 +1116,11 @@ sdl_pad_handler::SDLKeyCodes sdl_pad_handler::get_button_code(SDL_GamepadButton case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_RIGHT_STICK: return SDLKeyCodes::RS; case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_GUIDE: return SDLKeyCodes::Guide; case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_MISC1: return SDLKeyCodes::Misc1; + case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_MISC2: return SDLKeyCodes::Misc2; + case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_MISC3: return SDLKeyCodes::Misc3; + case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_MISC4: return SDLKeyCodes::Misc4; + case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_MISC5: return SDLKeyCodes::Misc5; + case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_MISC6: return SDLKeyCodes::Misc6; case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1: return SDLKeyCodes::RPaddle1; case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_LEFT_PADDLE1: return SDLKeyCodes::LPaddle1; case SDL_GamepadButton::SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2: return SDLKeyCodes::RPaddle2; diff --git a/rpcs3/Input/sdl_pad_handler.h b/rpcs3/Input/sdl_pad_handler.h index 1e8dff73f2..58ddcfda63 100644 --- a/rpcs3/Input/sdl_pad_handler.h +++ b/rpcs3/Input/sdl_pad_handler.h @@ -35,6 +35,7 @@ public: { SDL_Gamepad* gamepad = nullptr; SDL_GamepadType type = SDL_GamepadType::SDL_GAMEPAD_TYPE_UNKNOWN; + SDL_GamepadType real_type = SDL_GamepadType::SDL_GAMEPAD_TYPE_UNKNOWN; int power_level = 0; int last_power_level = 0; @@ -47,6 +48,7 @@ public: u16 firmware_version = 0; bool is_virtual_device = false; + bool is_ds3_with_pressure_buttons = false; bool has_led = false; bool has_mono_led = false; @@ -98,6 +100,11 @@ class sdl_pad_handler : public PadHandlerBase Back, Guide, Misc1, + Misc2, + Misc3, + Misc4, + Misc5, + Misc6, RPaddle1, LPaddle1, RPaddle2, @@ -119,7 +126,21 @@ class sdl_pad_handler : public PadHandlerBase RSXNeg, RSXPos, RSYNeg, - RSYPos + RSYPos, + + // DS3 Pressure sensitive buttons (reported as axis) + PressureBegin, + PressureCross, // Cross axis 6 + PressureCircle, // Circle axis 7 + PressureSquare, // Square axis 8 + PressureTriangle, // Triangle axis 9 + PressureL1, // L1 axis 10 + PressureR1, // R1 axis 11 + PressureUp, // D-Pad Up axis 12 + PressureDown, // D-Pad Down axis 13 + PressureLeft, // D-Pad Left axis 14 + PressureRight, // D-Pad Right axis 15 + PressureEnd, }; public: diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 446a21c2b9..0f07b59a3f 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -40,7 +40,7 @@ Use - ..\3rdparty\miniupnp\miniupnp\miniupnpc\include;..\3rdparty\wolfssl\wolfssl;..\3rdparty\flatbuffers\include;..\3rdparty\libusb\libusb\libusb;..\3rdparty\yaml-cpp\yaml-cpp\include;..\3rdparty\SoundTouch\soundtouch\include;..\3rdparty\rtmidi\rtmidi;..\3rdparty\zlib\zlib;$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build\include;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\include;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm\include;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\include;$(VULKAN_SDK)\Include;..\3rdparty\zstd\zstd\lib;$(SolutionDir)3rdparty\fusion\fusion\Fusion;$(SolutionDir)3rdparty\wolfssl\extra\win32;$(SolutionDir)3rdparty\libsdl-org\SDL\include + ..\3rdparty\miniupnp\miniupnp\miniupnpc\include;..\3rdparty\wolfssl\wolfssl;..\3rdparty\flatbuffers\include;..\3rdparty\libusb\libusb\libusb;..\3rdparty\yaml-cpp\yaml-cpp\include;..\3rdparty\SoundTouch\soundtouch\include;..\3rdparty\rtmidi\rtmidi;..\3rdparty\zlib\zlib;$(SolutionDir)build\lib\$(Configuration)-$(Platform)\llvm_build\include;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\include;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm\include;$(SolutionDir)build\lib_ext\$(Configuration)-$(Platform)\llvm_build\include;$(VULKAN_SDK)\Include;..\3rdparty\zstd\zstd\lib;$(SolutionDir)3rdparty\fusion\fusion\Fusion;$(SolutionDir)3rdparty\wolfssl\extra\win32;$(SolutionDir)3rdparty\libsdl-org\SDL\include;$(SolutionDir)3rdparty\glslang\glslang MaxSpeed AL_LIBTYPE_STATIC;MINIUPNP_STATICLIB;HAVE_VULKAN;HAVE_SDL3;ZLIB_CONST;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) AL_LIBTYPE_STATIC;MINIUPNP_STATICLIB;HAVE_VULKAN;HAVE_SDL3;ZLIB_CONST;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) @@ -1074,4 +1074,4 @@ - + \ No newline at end of file diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 8e93263c1b..50ff807e12 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -87,7 +87,7 @@ TurnOffAllWarnings - opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;MachineIndependent.lib;GenericCodeGen.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Core.lib;Qt6Gui.lib;Qt6Widgets.lib;Qt6Concurrent.lib;Qt6Multimedia.lib;Qt6MultimediaWidgets.lib;Qt6Svg.lib;Qt6SvgWidgets.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) + opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslang.lib;OSDependent.lib;SPIRV.lib;MachineIndependent.lib;GenericCodeGen.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Core.lib;Qt6Gui.lib;Qt6Widgets.lib;Qt6Concurrent.lib;Qt6Multimedia.lib;Qt6MultimediaWidgets.lib;Qt6Svg.lib;Qt6SvgWidgets.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) $(SolutionDir)3rdparty\opencv\opencv\opencv410\build\x64\lib;$(SolutionDir)build\lib\$(Configuration)-$(Platform)\glslang;$(SolutionDir)build\lib_ext\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true @@ -147,7 +147,7 @@ $(IntDir)vc$(PlatformToolsetVersion).pdb - opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslangd.lib;OSDependentd.lib;OGLCompilerd.lib;SPIRVd.lib;MachineIndependentd.lib;GenericCodeGend.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Cored.lib;Qt6Guid.lib;Qt6Widgetsd.lib;Qt6Concurrentd.lib;Qt6Multimediad.lib;Qt6MultimediaWidgetsd.lib;Qt6Svgd.lib;Qt6SvgWidgetsd.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) + opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslangd.lib;OSDependentd.lib;SPIRVd.lib;MachineIndependentd.lib;GenericCodeGend.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Cored.lib;Qt6Guid.lib;Qt6Widgetsd.lib;Qt6Concurrentd.lib;Qt6Multimediad.lib;Qt6MultimediaWidgetsd.lib;Qt6Svgd.lib;Qt6SvgWidgetsd.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) $(SolutionDir)3rdparty\opencv\opencv\opencv410\build\x64\lib;$(SolutionDir)build\lib\$(Configuration)-$(Platform)\glslang;$(SolutionDir)build\lib\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERBOSE %(AdditionalOptions) true diff --git a/rpcs3/tests/rpcs3_test.vcxproj b/rpcs3/tests/rpcs3_test.vcxproj index 05ca115d7f..3351d9d8b8 100644 --- a/rpcs3/tests/rpcs3_test.vcxproj +++ b/rpcs3/tests/rpcs3_test.vcxproj @@ -48,7 +48,7 @@ $(IntDir)vc$(PlatformToolsetVersion).pdb - rpcs3.lib;opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;MachineIndependent.lib;GenericCodeGen.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Core.lib;Qt6Gui.lib;Qt6Widgets.lib;Qt6Concurrent.lib;Qt6Multimedia.lib;Qt6MultimediaWidgets.lib;Qt6Svg.lib;Qt6SvgWidgets.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) + rpcs3.lib;opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslang.lib;OSDependent.lib;SPIRV.lib;MachineIndependent.lib;GenericCodeGen.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Core.lib;Qt6Gui.lib;Qt6Widgets.lib;Qt6Concurrent.lib;Qt6Multimedia.lib;Qt6MultimediaWidgets.lib;Qt6Svg.lib;Qt6SvgWidgets.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) $(SolutionDir)3rdparty\opencv\opencv\opencv410\build\x64\lib;$(SolutionDir)build\lib\$(Configuration)-$(Platform)\glslang;$(SolutionDir)build\lib_ext\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) Console true @@ -70,7 +70,7 @@ $(IntDir)vc$(PlatformToolsetVersion).pdb - rpcs3d.lib;opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslangd.lib;OSDependentd.lib;OGLCompilerd.lib;SPIRVd.lib;MachineIndependentd.lib;GenericCodeGend.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Cored.lib;Qt6Guid.lib;Qt6Widgetsd.lib;Qt6Concurrentd.lib;Qt6Multimediad.lib;Qt6MultimediaWidgetsd.lib;Qt6Svgd.lib;Qt6SvgWidgetsd.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) + rpcs3d.lib;opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslangd.lib;OSDependentd.lib;SPIRVd.lib;MachineIndependentd.lib;GenericCodeGend.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Cored.lib;Qt6Guid.lib;Qt6Widgetsd.lib;Qt6Concurrentd.lib;Qt6Multimediad.lib;Qt6MultimediaWidgetsd.lib;Qt6Svgd.lib;Qt6SvgWidgetsd.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;fusion.lib;%(AdditionalDependencies) $(SolutionDir)3rdparty\opencv\opencv\opencv410\build\x64\lib;$(SolutionDir)build\lib\$(Configuration)-$(Platform)\glslang;$(SolutionDir)build\lib\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) Console true diff --git a/rpcs3/util/atomic.hpp b/rpcs3/util/atomic.hpp index 85c8b10482..80d9e34f9d 100644 --- a/rpcs3/util/atomic.hpp +++ b/rpcs3/util/atomic.hpp @@ -207,7 +207,7 @@ namespace atomic_wait static_assert(Index < Max); static_assert(sizeof(var) == sizeof(uptr) * 2); - m_info[Index].data = reinterpret_cast(&var) + offsetof(typename lf_queue::fat_ptr, is_non_null); + m_info[Index].data = std::bit_cast(&var.get_wait_atomic().raw()); m_info[Index].old = 0; } @@ -217,7 +217,7 @@ namespace atomic_wait static_assert(Index < Max); static_assert(sizeof(var) == sizeof(uptr) * 2); - m_info[Index].data = reinterpret_cast(&var) + offsetof(typename stx::atomic_ptr::fat_ptr, is_non_null); + m_info[Index].data = std::bit_cast(&var.get_wait_atomic().raw()); m_info[Index].old = 0; } diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index 375784e7dd..093d90ef7e 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -576,7 +576,7 @@ namespace stx template class atomic_ptr { - public: + private: struct fat_ptr { uptr ptr{}; @@ -584,8 +584,6 @@ namespace stx u32 ref_ctr{}; }; - private: - mutable atomic_t m_val{fat_ptr{}}; static shared_counter* d(fat_ptr val) noexcept @@ -1117,19 +1115,24 @@ namespace stx return static_cast(observe()) == r.get(); } + atomic_t &get_wait_atomic() + { + return *utils::bless>(&m_val.raw().is_non_null); + } + void wait(std::nullptr_t, atomic_wait_timeout timeout = atomic_wait_timeout::inf) { - utils::bless>(&m_val.raw().is_non_null)->wait(0, timeout); + get_wait_atomic().wait(0, timeout); } void notify_one() { - utils::bless>(&m_val.raw().is_non_null)->notify_one(); + get_wait_atomic().notify_one(); } void notify_all() { - utils::bless>(&m_val.raw().is_non_null)->notify_all(); + get_wait_atomic().notify_all(); } };