15 Commits
Author SHA1 Message Date
ExzapandGitHub a40b226e00 CubebInput: Avoid redundant CoInitializeEx (#449) 2022-11-03 18:29:21 +01:00
TillsunsetandGitHub 521f2fb707 MacOS: Workaround for Metal stride limitation (#445) 2022-11-03 12:51:32 +01:00
goeiecool9999andGitHub a129d22a57 Vulkan: Experimental fix for self-dependency barriers during renderpass (#431) 2022-11-03 00:43:26 +01:00
Adrian GraberandGitHub d4e14d2b05 Implement proper microphone support (#251) 2022-11-03 00:24:34 +01:00
goeiecool9999andGitHub dfa7774c4c Non-windows: Link fontawesome into executable. (#442) 2022-11-03 00:23:31 +01:00
goeiecool9999andGitHub c3182aedd9 GeneralSettings: Update vsync after settings close (#401) 2022-10-31 17:54:26 +01:00
Zhaohui ShiandGitHub f41f7b63e8 DSUController: fix crash when running on offline mode (#434) 2022-10-31 14:27:35 +01:00
TillsunsetandGitHub c143950dd1 Fix fullscreen on macos (#429) 2022-10-30 01:40:53 +02:00
jn64andGitHub 4e991d603a Add libpulse-dev to CI build (#430) 2022-10-30 01:39:39 +02:00
OatmealDomeandGitHub e0aaf631c4 macOS: Set values for empty keys in Info.plist (#425) 2022-10-28 16:57:14 +02:00
TillsunsetandGitHub 9ebbfb3ae2 Fix some compiler warnings (#416) 2022-10-26 14:47:44 +02:00
gurrgurandGitHub 3869b47c35 OpenGL: Bind back buffer before clearing (#222) (#414) 2022-10-26 14:07:34 +02:00
GaryOderNichtsandGitHub d303a7f502 coreinit: Implement OSGetSystemTick (#415) 2022-10-26 14:06:16 +02:00
GaryOderNichtsandGitHub 2461464ba7 FSA: Add missing path translations (#413) 2022-10-26 00:25:46 +02:00
gurrgurandGitHub 76c75f767b Use portable format specifiers (#411)
Fixes #387
2022-10-25 20:38:29 +02:00
43 changed files with 808 additions and 132 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ jobs:
- name: "Install system dependencies" - name: "Install system dependencies"
run: | run: |
sudo apt update -qq sudo apt update -qq
sudo apt install -y ninja-build cmake libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev freeglut3-dev clang-12 nasm sudo apt install -y clang-12 cmake freeglut3-dev libgcrypt20-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build
- name: "Bootstrap vcpkg" - name: "Bootstrap vcpkg"
run: | run: |
bash ./dependencies/vcpkg/bootstrap-vcpkg.sh bash ./dependencies/vcpkg/bootstrap-vcpkg.sh
+3 -3
View File
@@ -25,7 +25,7 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
### Installing dependencies ### Installing dependencies
#### For Ubuntu and derivatives: #### For Ubuntu and derivatives:
`sudo apt install -y git curl cmake ninja-build nasm libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev freeglut3-dev libpulse-dev` `sudo apt install -y cmake curl freeglut3-dev git libgcrypt20-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build`
*Additionally, for Ubuntu 22.04 only:* *Additionally, for Ubuntu 22.04 only:*
- `sudo apt install -y clang-12` - `sudo apt install -y clang-12`
@@ -33,10 +33,10 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
`cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja` `cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja`
#### For Arch and derivatives: #### For Arch and derivatives:
`sudo pacman -S --needed git cmake llvm clang ninja nasm base-devel linux-headers gtk3 libsecret libgcrypt systemd freeglut zip unzip libpulse` `sudo pacman -S --needed base-devel clang cmake freeglut git gtk3 libgcrypt libpulse libsecret linux-headers llvm nasm ninja systemd unzip zip`
#### For Fedora and derivatives: #### For Fedora and derivatives:
`sudo dnf install git cmake clang ninja-build nasm kernel-headers gtk3-devel libsecret-devel libgcrypt-devel systemd-devel freeglut-devel perl-core zlib-devel cubeb-devel` `sudo dnf install clang cmake cubeb-devel freeglut-devel git gtk3-devel kernel-headers libgcrypt-devel libsecret-devel nasm ninja-build perl-core systemd-devel zlib-devel`
### Build Cemu using cmake and clang ### Build Cemu using cmake and clang
1. `git clone --recursive https://github.com/cemu-project/Cemu` 1. `git clone --recursive https://github.com/cemu-project/Cemu`
+1 -1
View File
@@ -21,7 +21,7 @@ if (ENABLE_VCPKG)
endif() endif()
endif() endif()
project(Cemu VERSION 2.0) project(Cemu VERSION 2.0.0)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
+7
View File
@@ -75,6 +75,13 @@ if (MACOS_BUNDLE)
set(RESOURCE_FILES "${CMAKE_SOURCE_DIR}/src/resource/cemu.icns") set(RESOURCE_FILES "${CMAKE_SOURCE_DIR}/src/resource/cemu.icns")
target_sources(CemuBin PRIVATE "${RESOURCE_FILES}") target_sources(CemuBin PRIVATE "${RESOURCE_FILES}")
set(MACOSX_BUNDLE_ICON_FILE "cemu.icns")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "info.cemu.Cemu")
set(MACOSX_BUNDLE_BUNDLE_NAME "Cemu")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${CMAKE_PROJECT_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION})
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2022 Cemu Project")
set(MACOSX_BUNDLE_CATEGORY "public.app-category.games") set(MACOSX_BUNDLE_CATEGORY "public.app-category.games")
set_target_properties(CemuBin PROPERTIES set_target_properties(CemuBin PROPERTIES
+2
View File
@@ -5,6 +5,7 @@
#include "Cafe/HW/Espresso/Interpreter/PPCInterpreterInternal.h" #include "Cafe/HW/Espresso/Interpreter/PPCInterpreterInternal.h"
#include "Cafe/HW/Espresso/Recompiler/PPCRecompiler.h" #include "Cafe/HW/Espresso/Recompiler/PPCRecompiler.h"
#include "audio/IAudioAPI.h" #include "audio/IAudioAPI.h"
#include "audio/IAudioInputAPI.h"
#include "Cafe/HW/Espresso/Debugger/Debugger.h" #include "Cafe/HW/Espresso/Debugger/Debugger.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
@@ -402,6 +403,7 @@ void cemu_initForGame()
GraphicPack2::ActivateForCurrentTitle(); GraphicPack2::ActivateForCurrentTitle();
// print audio log // print audio log
IAudioAPI::PrintLogging(); IAudioAPI::PrintLogging();
IAudioInputAPI::PrintLogging();
// everything initialized // everything initialized
forceLog_printf("------- Run title -------"); forceLog_printf("------- Run title -------");
// wait till GPU thread is initialized // wait till GPU thread is initialized
+3 -3
View File
@@ -441,7 +441,7 @@ bool fsc_nextDir(FSCVirtualFile* fscFile, FSCDirEntry* dirEntry)
/* /*
* Create directory * Create directory
*/ */
bool fsc_createDir(char* path, sint32* fscStatus) bool fsc_createDir(const char* path, sint32* fscStatus)
{ {
fscDeviceC* fscDevice = NULL; fscDeviceC* fscDevice = NULL;
*fscStatus = FSC_STATUS_UNDEFINED; *fscStatus = FSC_STATUS_UNDEFINED;
@@ -461,7 +461,7 @@ bool fsc_createDir(char* path, sint32* fscStatus)
/* /*
* Rename file or directory * Rename file or directory
*/ */
bool fsc_rename(char* srcPath, char* dstPath, sint32* fscStatus) bool fsc_rename(const char* srcPath, const char* dstPath, sint32* fscStatus)
{ {
std::string srcDevicePath; std::string srcDevicePath;
std::string dstDevicePath; std::string dstDevicePath;
@@ -481,7 +481,7 @@ bool fsc_rename(char* srcPath, char* dstPath, sint32* fscStatus)
/* /*
* Delete file or subdirectory * Delete file or subdirectory
*/ */
bool fsc_remove(char* path, sint32* fscStatus) bool fsc_remove(const char* path, sint32* fscStatus)
{ {
std::string devicePath; std::string devicePath;
fscDeviceC* fscDevice = NULL; fscDeviceC* fscDevice = NULL;
+3 -3
View File
@@ -167,9 +167,9 @@ void fsc_unmountAll();
FSCVirtualFile* fsc_open(const char* path, FSC_ACCESS_FLAG accessFlags, sint32* fscStatus, sint32 maxPriority=FSC_PRIORITY_MAX); FSCVirtualFile* fsc_open(const char* path, FSC_ACCESS_FLAG accessFlags, sint32* fscStatus, sint32 maxPriority=FSC_PRIORITY_MAX);
FSCVirtualFile* fsc_openDirIterator(const char* path, sint32* fscStatus); FSCVirtualFile* fsc_openDirIterator(const char* path, sint32* fscStatus);
bool fsc_createDir(char* path, sint32* fscStatus); bool fsc_createDir(const char* path, sint32* fscStatus);
bool fsc_rename(char* srcPath, char* dstPath, sint32* fscStatus); bool fsc_rename(const char* srcPath, const char* dstPath, sint32* fscStatus);
bool fsc_remove(char* path, sint32* fscStatus); bool fsc_remove(const char* path, sint32* fscStatus);
bool fsc_nextDir(FSCVirtualFile* fscFile, FSCDirEntry* dirEntry); bool fsc_nextDir(FSCVirtualFile* fscFile, FSCDirEntry* dirEntry);
void fsc_close(FSCVirtualFile* fscFile); void fsc_close(FSCVirtualFile* fscFile);
uint32 fsc_getFileSize(FSCVirtualFile* fscFile); uint32 fsc_getFileSize(FSCVirtualFile* fscFile);
+2 -1
View File
@@ -11,6 +11,7 @@
#include "util/IniParser/IniParser.h" #include "util/IniParser/IniParser.h"
#include "util/helpers/StringHelpers.h" #include "util/helpers/StringHelpers.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include <cinttypes>
std::vector<GraphicPackPtr> GraphicPack2::s_graphic_packs; std::vector<GraphicPackPtr> GraphicPack2::s_graphic_packs;
std::vector<GraphicPackPtr> GraphicPack2::s_active_graphic_packs; std::vector<GraphicPackPtr> GraphicPack2::s_active_graphic_packs;
@@ -660,7 +661,7 @@ void GraphicPack2::LoadShaders()
uint64 shader_base_hash = 0; uint64 shader_base_hash = 0;
uint64 shader_aux_hash = 0; uint64 shader_aux_hash = 0;
wchar_t shader_type[256]{}; wchar_t shader_type[256]{};
if (filename.size() < 256 && swscanf(filename.c_str(), L"%I64x_%I64x_%ls", &shader_base_hash, &shader_aux_hash, shader_type) == 3) if (filename.size() < 256 && swscanf(filename.c_str(), L"%" SCNx64 "_%" SCNx64 "_%ls", &shader_base_hash, &shader_aux_hash, shader_type) == 3)
{ {
if (shader_type[0] == 'p' && shader_type[1] == 's') if (shader_type[0] == 'p' && shader_type[1] == 's')
m_custom_shaders.emplace_back(LoadShader(p, shader_base_hash, shader_aux_hash, GP_SHADER_TYPE::PIXEL)); m_custom_shaders.emplace_back(LoadShader(p, shader_base_hash, shader_aux_hash, GP_SHADER_TYPE::PIXEL));
+2 -2
View File
@@ -64,8 +64,8 @@ struct LatteGPUState_t
{ {
bool isEnabled; bool isEnabled;
MPTR physPtr; MPTR physPtr;
volatile uint32 flipRequestCount; std::atomic<uint32> flipRequestCount;
volatile uint32 flipExecuteCount; std::atomic<uint32> flipExecuteCount;
}screen[2]; }screen[2];
}osScreen; }osScreen;
}; };
+2 -1
View File
@@ -13,6 +13,7 @@
#include "util/Zir/EmitterGLSL/ZpIREmitGLSL.h" #include "util/Zir/EmitterGLSL/ZpIREmitGLSL.h"
#include "util/Zir/Core/ZpIRDebug.h" #include "util/Zir/Core/ZpIRDebug.h"
#include "util/containers/flat_hash_map.hpp" #include "util/containers/flat_hash_map.hpp"
#include <cinttypes>
struct _ShaderHashCache struct _ShaderHashCache
{ {
@@ -294,7 +295,7 @@ void LatteShader_CreateRendererShader(LatteDecompilerShader* shader, bool compil
{ {
if (shader->hasError ) if (shader->hasError )
{ {
forceLog_printf("Unable to compile shader %I64x", shader->baseHash); forceLog_printf("Unable to compile shader %" PRIx64, shader->baseHash);
return; return;
} }
+2 -2
View File
@@ -78,7 +78,7 @@ bool LatteHandleOSScreen_TV()
LatteRenderTarget_copyToBackbuffer(osScreenTVTex[bufferIndexTV]->baseTexture->baseView, false); LatteRenderTarget_copyToBackbuffer(osScreenTVTex[bufferIndexTV]->baseTexture->baseView, false);
if (LatteGPUState.osScreen.screen[0].flipExecuteCount != LatteGPUState.osScreen.screen[0].flipRequestCount) if (LatteGPUState.osScreen.screen[0].flipExecuteCount != LatteGPUState.osScreen.screen[0].flipRequestCount)
LatteGPUState.osScreen.screen[0].flipExecuteCount = LatteGPUState.osScreen.screen[0].flipRequestCount; LatteGPUState.osScreen.screen[0].flipExecuteCount.store(LatteGPUState.osScreen.screen[0].flipRequestCount);
return true; return true;
} }
@@ -101,7 +101,7 @@ bool LatteHandleOSScreen_DRC()
LatteRenderTarget_copyToBackbuffer(osScreenDRCTex[bufferIndexDRC]->baseTexture->baseView, true); LatteRenderTarget_copyToBackbuffer(osScreenDRCTex[bufferIndexDRC]->baseTexture->baseView, true);
if (LatteGPUState.osScreen.screen[1].flipExecuteCount != LatteGPUState.osScreen.screen[1].flipRequestCount) if (LatteGPUState.osScreen.screen[1].flipExecuteCount != LatteGPUState.osScreen.screen[1].flipRequestCount)
LatteGPUState.osScreen.screen[1].flipExecuteCount = LatteGPUState.osScreen.screen[1].flipRequestCount; LatteGPUState.osScreen.screen[1].flipExecuteCount.store(LatteGPUState.osScreen.screen[1].flipRequestCount);
return true; return true;
} }
@@ -352,14 +352,19 @@ void OpenGLRenderer::NotifyLatteCommandProcessorIdle()
glFlush(); glFlush();
} }
void OpenGLRenderer::EnableVSync(int state) void OpenGLRenderer::UpdateVSyncState()
{ {
int configValue = GetConfig().vsync.GetValue();
if(m_activeVSyncState != configValue)
{
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
if(wglSwapIntervalEXT) if(wglSwapIntervalEXT)
wglSwapIntervalEXT(state); // 1 = enabled, 0 = disabled wglSwapIntervalEXT(configValue); // 1 = enabled, 0 = disabled
#else #else
cemuLog_log(LogType::Force, "OpenGL vsync not implemented"); cemuLog_log(LogType::Force, "OpenGL vsync not implemented");
#endif #endif
m_activeVSyncState = configValue;
}
} }
bool IsRunningInWine(); bool IsRunningInWine();
@@ -438,6 +443,7 @@ void OpenGLRenderer::EnableDebugMode()
void OpenGLRenderer::SwapBuffers(bool swapTV, bool swapDRC) void OpenGLRenderer::SwapBuffers(bool swapTV, bool swapDRC)
{ {
GLCanvas_SwapBuffers(swapTV, swapDRC); GLCanvas_SwapBuffers(swapTV, swapDRC);
UpdateVSyncState();
if (swapTV) if (swapTV)
cleanupAfterFrame(); cleanupAfterFrame();
@@ -548,6 +554,9 @@ void OpenGLRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
renderstate_resetDepthControl(); renderstate_resetDepthControl();
attributeStream_reset(); attributeStream_reset();
// bind back buffer
rendertarget_bindFramebufferObject(nullptr);
if (clearBackground) if (clearBackground)
{ {
int windowWidth, windowHeight; int windowWidth, windowHeight;
@@ -559,9 +568,6 @@ void OpenGLRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
g_renderer->ClearColorbuffer(padView); g_renderer->ClearColorbuffer(padView);
} }
// bind back buffer
rendertarget_bindFramebufferObject(nullptr);
// calculate effective size // calculate effective size
sint32 effectiveWidth; sint32 effectiveWidth;
sint32 effectiveHeight; sint32 effectiveHeight;
@@ -30,7 +30,7 @@ public:
void Flush(bool waitIdle = false) override; void Flush(bool waitIdle = false) override;
void NotifyLatteCommandProcessorIdle() override; void NotifyLatteCommandProcessorIdle() override;
void EnableVSync(int state) override; void UpdateVSyncState();
void EnableDebugMode() override; void EnableDebugMode() override;
void SwapBuffers(bool swapTV = true, bool swapDRC = true) override; void SwapBuffers(bool swapTV = true, bool swapDRC = true) override;
@@ -168,6 +168,7 @@ private:
GLuint m_defaultFramebufferId; GLuint m_defaultFramebufferId;
GLuint m_pipeline = 0; GLuint m_pipeline = 0;
int m_activeVSyncState{};
bool m_isPadViewContext{}; bool m_isPadViewContext{};
// rendertarget viewport // rendertarget viewport
-1
View File
@@ -58,7 +58,6 @@ public:
virtual bool GetVRAMInfo(int& usageInMB, int& totalInMB) const; virtual bool GetVRAMInfo(int& usageInMB, int& totalInMB) const;
virtual void EnableDebugMode() {} virtual void EnableDebugMode() {}
virtual void EnableVSync(int state) = 0;
virtual void ClearColorbuffer(bool padView) = 0; virtual void ClearColorbuffer(bool padView) = 0;
virtual void DrawEmptyFrame(bool mainWindow) = 0; virtual void DrawEmptyFrame(bool mainWindow) = 0;
@@ -457,6 +457,12 @@ void PipelineCompiler::InitVertexInputState(const LatteContextRegister& latteReg
uint32 bufferStride = (latteRegister.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF; uint32 bufferStride = (latteRegister.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF;
VkVertexInputBindingDescription entry{}; VkVertexInputBindingDescription entry{};
#if BOOST_OS_MACOS
if (bufferStride % 4 != 0) {
forceLog_printf("MoltenVK error: vertex stride was %d, expected multiple of 4", bufferStride);
bufferStride = 0;
}
#endif
entry.stride = bufferStride; entry.stride = bufferStride;
if (!fetchType.has_value() || fetchType == LatteConst::VertexFetchType2::VERTEX_DATA) if (!fetchType.has_value() || fetchType == LatteConst::VertexFetchType2::VERTEX_DATA)
entry.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; entry.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
@@ -1382,22 +1382,22 @@ VkSurfaceFormatKHR VulkanRenderer::ChooseSwapSurfaceFormat(const std::vector<VkS
VkPresentModeKHR VulkanRenderer::ChooseSwapPresentMode(const std::vector<VkPresentModeKHR>& modes) VkPresentModeKHR VulkanRenderer::ChooseSwapPresentMode(const std::vector<VkPresentModeKHR>& modes)
{ {
m_vsync_state = (VSync)GetConfig().vsync.GetValue(); const auto vsyncState = (VSync)GetConfig().vsync.GetValue();
if (m_vsync_state == VSync::MAILBOX) if (vsyncState == VSync::MAILBOX)
{ {
if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_MAILBOX_KHR) != modes.cend()) if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_MAILBOX_KHR) != modes.cend())
return VK_PRESENT_MODE_MAILBOX_KHR; return VK_PRESENT_MODE_MAILBOX_KHR;
forceLog_printf("Vulkan: Can't find mailbox present mode"); forceLog_printf("Vulkan: Can't find mailbox present mode");
} }
else if (m_vsync_state == VSync::Immediate) else if (vsyncState == VSync::Immediate)
{ {
if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_IMMEDIATE_KHR) != modes.cend()) if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_IMMEDIATE_KHR) != modes.cend())
return VK_PRESENT_MODE_IMMEDIATE_KHR; return VK_PRESENT_MODE_IMMEDIATE_KHR;
forceLog_printf("Vulkan: Can't find immediate present mode"); forceLog_printf("Vulkan: Can't find immediate present mode");
} }
else if (m_vsync_state == VSync::SYNC_AND_LIMIT) else if (vsyncState == VSync::SYNC_AND_LIMIT)
{ {
LatteTiming_EnableHostDrivenVSync(); LatteTiming_EnableHostDrivenVSync();
// use immediate mode if available, other wise fall back to // use immediate mode if available, other wise fall back to
@@ -1991,19 +1991,6 @@ void VulkanRenderer::QueryAvailableFormats()
} }
} }
void VulkanRenderer::EnableVSync(int state)
{
if (m_vsync_state == (VSync)state)
return;
m_vsync_state = (VSync)state;
// recreate spawn chains (vsync state is checked from config in ChooseSwapPresentMode)
RecreateSwapchain(true);
if (m_padSwapchainInfo)
RecreateSwapchain(false);
}
bool VulkanRenderer::ImguiBegin(bool mainWindow) bool VulkanRenderer::ImguiBegin(bool mainWindow)
{ {
if (!Renderer::ImguiBegin(mainWindow)) if (!Renderer::ImguiBegin(mainWindow))
@@ -2962,6 +2949,16 @@ void VulkanRenderer::RecreateSwapchain(bool main_window)
ImguiInit(); ImguiInit();
} }
void VulkanRenderer::UpdateVSyncState(bool main_window)
{
auto& swapInfo = main_window ? *m_mainSwapchainInfo : *m_padSwapchainInfo;
const auto configValue = (VSync)GetConfig().vsync.GetValue();
if(swapInfo.m_activeVSyncState != configValue){
RecreateSwapchain(main_window);
swapInfo.m_activeVSyncState = configValue;
}
}
void VulkanRenderer::SwapBuffer(bool main_window) void VulkanRenderer::SwapBuffer(bool main_window)
{ {
auto& swapInfo = main_window ? *m_mainSwapchainInfo : *m_padSwapchainInfo; auto& swapInfo = main_window ? *m_mainSwapchainInfo : *m_padSwapchainInfo;
@@ -2999,6 +2996,8 @@ void VulkanRenderer::SwapBuffer(bool main_window)
} }
} }
UpdateVSyncState(main_window);
auto& swapinfo = main_window ? *m_mainSwapchainInfo : *m_padSwapchainInfo; auto& swapinfo = main_window ? *m_mainSwapchainInfo : *m_padSwapchainInfo;
AcquireNextSwapchainImage(main_window); AcquireNextSwapchainImage(main_window);
@@ -195,8 +195,6 @@ public:
void QueryMemoryInfo(); void QueryMemoryInfo();
void QueryAvailableFormats(); void QueryAvailableFormats();
void EnableVSync(int state) override;
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
static VkSurfaceKHR CreateWinSurface(VkInstance instance, HWND hwindow); static VkSurfaceKHR CreateWinSurface(VkInstance instance, HWND hwindow);
#endif #endif
@@ -466,6 +464,7 @@ private:
VkExtent2D swapchainExtend{}; VkExtent2D swapchainExtend{};
uint32 swapchainImageIndex = (uint32)-1; uint32 swapchainImageIndex = (uint32)-1;
uint32 m_acquireIndex = 0; // increases with every successful vkAcquireNextImageKHR uint32 m_acquireIndex = 0; // increases with every successful vkAcquireNextImageKHR
VSync m_activeVSyncState = VSync::Immediate;
struct AcquireInfo struct AcquireInfo
{ {
@@ -557,8 +556,8 @@ private:
static bool CheckDeviceExtensionSupport(const VkPhysicalDevice device, FeatureControl& info); static bool CheckDeviceExtensionSupport(const VkPhysicalDevice device, FeatureControl& info);
static std::vector<const char*> CheckInstanceExtensionSupport(FeatureControl& info); static std::vector<const char*> CheckInstanceExtensionSupport(FeatureControl& info);
void UpdateVSyncState(bool main_window);
void SwapBuffer(bool main_window); void SwapBuffer(bool main_window);
VSync m_vsync_state = VSync::Immediate;
struct SwapChainSupportDetails struct SwapChainSupportDetails
{ {
@@ -55,7 +55,7 @@ uint64 VulkanRenderer::draw_calculateGraphicsPipelineHash(const LatteFetchShader
// An alternative would be to use VK_EXT_vertex_input_dynamic_state but it comes with minor overhead // An alternative would be to use VK_EXT_vertex_input_dynamic_state but it comes with minor overhead
// Regardless, the extension is not well supported as of writing this (July 2021, only 10% of GPUs support it on Windows. Nvidia only) // Regardless, the extension is not well supported as of writing this (July 2021, only 10% of GPUs support it on Windows. Nvidia only)
cemu_assert_debug(fetchShader->key == fetchShader->key); // fetch shaders must be layout compatible, but may have different offsets cemu_assert_debug(vertexShader->compatibleFetchShader->key == fetchShader->key); // fetch shaders must be layout compatible, but may have different offsets
uint64 stateHash; uint64 stateHash;
stateHash = draw_calculateMinimalGraphicsPipelineHash(fetchShader, lcr); stateHash = draw_calculateMinimalGraphicsPipelineHash(fetchShader, lcr);
@@ -1196,30 +1196,15 @@ void VulkanRenderer::draw_setRenderPass()
// update self-dependency flag // update self-dependency flag
if (m_state.descriptorSetsChanged || m_state.activeRenderpassFBO != fboVk) if (m_state.descriptorSetsChanged || m_state.activeRenderpassFBO != fboVk)
{ {
bool hadDep = m_state.hasRenderSelfDependency;
m_state.hasRenderSelfDependency = fboVk->CheckForCollision(m_state.activeVertexDS, m_state.activeGeometryDS, m_state.activePixelDS); m_state.hasRenderSelfDependency = fboVk->CheckForCollision(m_state.activeVertexDS, m_state.activeGeometryDS, m_state.activePixelDS);
} }
auto vkObjRenderPass = fboVk->GetRenderPassObj(); auto vkObjRenderPass = fboVk->GetRenderPassObj();
auto vkObjFramebuffer = fboVk->GetFramebufferObj(); auto vkObjFramebuffer = fboVk->GetFramebufferObj();
if (m_state.hasRenderSelfDependency) bool overridePassReuse = m_state.hasRenderSelfDependency && (GetConfig().vk_accurate_barriers || m_state.activePipelineInfo->neverSkipAccurateBarrier);
{
bool triggerBarrier = GetConfig().vk_accurate_barriers || m_state.activePipelineInfo->neverSkipAccurateBarrier;
if (triggerBarrier)
{
VkMemoryBarrier memoryBarrier{};
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
memoryBarrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
memoryBarrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
VkPipelineStageFlags srcStage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
VkPipelineStageFlags dstStage = VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
vkCmdPipelineBarrier(m_state.currentCommandBuffer, srcStage, dstStage, 0, 1, &memoryBarrier, 0, nullptr, 0, nullptr);
performanceMonitor.vk.numDrawBarriersPerFrame.increment();
}
}
if (m_state.activeRenderpassFBO == fboVk) if (!overridePassReuse && m_state.activeRenderpassFBO == fboVk)
{ {
if (m_state.descriptorSetsChanged) if (m_state.descriptorSetsChanged)
sync_inputTexturesChanged(); sync_inputTexturesChanged();
+7 -7
View File
@@ -328,26 +328,26 @@ namespace iosu
FSStatus FSAProcessCmd_remove(FSAClient* client, FSAIpcCommand* cmd) FSStatus FSAProcessCmd_remove(FSAClient* client, FSAIpcCommand* cmd)
{ {
char* path = (char*)cmd->cmdRemove.path; std::string path = __FSATranslatePath(client, (char*)cmd->cmdRemove.path);
sint32 fscStatus = FSC_STATUS_FILE_NOT_FOUND; sint32 fscStatus = FSC_STATUS_FILE_NOT_FOUND;
fsc_remove(path, &fscStatus); fsc_remove(path.c_str(), &fscStatus);
return FSA_convertFSCtoFSStatus(fscStatus); return FSA_convertFSCtoFSStatus(fscStatus);
} }
FSStatus FSAProcessCmd_makeDir(FSAClient* client, FSAIpcCommand* cmd) FSStatus FSAProcessCmd_makeDir(FSAClient* client, FSAIpcCommand* cmd)
{ {
char* path = (char*)cmd->cmdMakeDir.path; std::string path = __FSATranslatePath(client, (char*)cmd->cmdMakeDir.path);
sint32 fscStatus = FSC_STATUS_FILE_NOT_FOUND; sint32 fscStatus = FSC_STATUS_FILE_NOT_FOUND;
fsc_createDir(path, &fscStatus); fsc_createDir(path.c_str(), &fscStatus);
return FSA_convertFSCtoFSStatus(fscStatus); return FSA_convertFSCtoFSStatus(fscStatus);
} }
FSStatus FSAProcessCmd_rename(FSAClient* client, FSAIpcCommand* cmd) FSStatus FSAProcessCmd_rename(FSAClient* client, FSAIpcCommand* cmd)
{ {
char* srcPath = (char*)cmd->cmdRename.srcPath; std::string srcPath = __FSATranslatePath(client, (char*)cmd->cmdRename.srcPath);
char* dstPath = (char*)cmd->cmdRename.dstPath; std::string dstPath = __FSATranslatePath(client, (char*)cmd->cmdRename.dstPath);
sint32 fscStatus = FSC_STATUS_FILE_NOT_FOUND; sint32 fscStatus = FSC_STATUS_FILE_NOT_FOUND;
fsc_rename(srcPath, dstPath, &fscStatus); fsc_rename(srcPath.c_str(), dstPath.c_str(), &fscStatus);
return FSA_convertFSCtoFSStatus(fscStatus); return FSA_convertFSCtoFSStatus(fscStatus);
} }
@@ -43,6 +43,11 @@ namespace coreinit
osLib_returnFromFunction64(hCPU, coreinit_getTimerTick()); osLib_returnFromFunction64(hCPU, coreinit_getTimerTick());
} }
void export_OSGetSystemTick(PPCInterpreter_t* hCPU)
{
osLib_returnFromFunction(hCPU, (uint32)coreinit_getTimerTick());
}
uint32 getLeapDaysUntilYear(uint32 year) uint32 getLeapDaysUntilYear(uint32 year)
{ {
if (year == 0) if (year == 0)
@@ -368,6 +373,7 @@ namespace coreinit
osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime); osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime);
osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy); osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy);
osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick); osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick);
osLib_addFunction("coreinit", "OSGetSystemTick", export_OSGetSystemTick);
cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder); cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder);
cafeExportRegister("coreinit", OSCalendarTimeToTicks, LogType::Placeholder); cafeExportRegister("coreinit", OSCalendarTimeToTicks, LogType::Placeholder);

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