diff --git a/CMakeLists.txt b/CMakeLists.txt index f6f914bd..5ebfdca3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,7 +198,7 @@ endif() if (ENABLE_METAL) include_directories(${CMAKE_SOURCE_DIR}/dependencies/metal-cpp) - add_definitions(-DENABLE_METAL=1) + add_compile_definitions(ENABLE_METAL) endif() if (ENABLE_DISCORD_RPC) diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index f016773c..fc0d1ae6 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -251,7 +251,7 @@ void InfoLog_PrintActiveSettings() if (!GetConfig().vk_accurate_barriers.GetValue()) cemuLog_log(LogType::Force, "Accurate barriers are disabled!"); } -#if ENABLE_METAL +#ifdef ENABLE_METAL else if (ActiveSettings::GetGraphicsAPI() == GraphicAPI::kMetal) { cemuLog_log(LogType::Force, "Async compile: {}", GetConfig().async_compile.GetValue() ? "true" : "false"); diff --git a/src/Cafe/GameProfile/GameProfile.cpp b/src/Cafe/GameProfile/GameProfile.cpp index 9ee0a696..5c15d7c3 100644 --- a/src/Cafe/GameProfile/GameProfile.cpp +++ b/src/Cafe/GameProfile/GameProfile.cpp @@ -226,7 +226,7 @@ bool GameProfile::Load(uint64_t title_id) m_graphics_api = (GraphicAPI)graphicsApi.value; gameProfile_loadEnumOption(iniParser, "accurateShaderMul", m_accurateShaderMul); -#if ENABLE_METAL +#ifdef ENABLE_METAL gameProfile_loadBooleanOption2(iniParser, "shaderFastMath", m_shaderFastMath); gameProfile_loadEnumOption(iniParser, "metalBufferCacheMode2", m_metalBufferCacheMode); gameProfile_loadEnumOption(iniParser, "positionInvariance2", m_positionInvariance); @@ -311,7 +311,7 @@ void GameProfile::Save(uint64_t title_id) fs->writeLine("[Graphics]"); WRITE_ENTRY(accurateShaderMul); -#if ENABLE_METAL +#ifdef ENABLE_METAL WRITE_ENTRY(shaderFastMath); WRITE_ENTRY_NUMBERED(metalBufferCacheMode, 2); WRITE_ENTRY_NUMBERED(positionInvariance, 2); @@ -346,7 +346,7 @@ void GameProfile::ResetOptional() // graphic settings m_accurateShaderMul = AccurateShaderMulOption::True; -#if ENABLE_METAL +#ifdef ENABLE_METAL m_shaderFastMath = true; m_metalBufferCacheMode = MetalBufferCacheMode::Auto; m_positionInvariance = PositionInvariance::Auto; @@ -371,7 +371,7 @@ void GameProfile::Reset() // graphic settings m_accurateShaderMul = AccurateShaderMulOption::True; -#if ENABLE_METAL +#ifdef ENABLE_METAL m_shaderFastMath = true; m_metalBufferCacheMode = MetalBufferCacheMode::Auto; m_positionInvariance = PositionInvariance::Auto; diff --git a/src/Cafe/GameProfile/GameProfile.h b/src/Cafe/GameProfile/GameProfile.h index 5155beac..06c2a13b 100644 --- a/src/Cafe/GameProfile/GameProfile.h +++ b/src/Cafe/GameProfile/GameProfile.h @@ -29,7 +29,7 @@ public: [[nodiscard]] const std::optional& GetGraphicsAPI() const { return m_graphics_api; } [[nodiscard]] const AccurateShaderMulOption& GetAccurateShaderMul() const { return m_accurateShaderMul; } -#if ENABLE_METAL +#ifdef ENABLE_METAL [[nodiscard]] bool GetShaderFastMath() const { return m_shaderFastMath; } [[nodiscard]] MetalBufferCacheMode GetBufferCacheMode() const { return m_metalBufferCacheMode; } [[nodiscard]] PositionInvariance GetPositionInvariance() const { return m_positionInvariance; } @@ -57,7 +57,7 @@ private: // graphic settings std::optional m_graphics_api{}; AccurateShaderMulOption m_accurateShaderMul = AccurateShaderMulOption::True; -#if ENABLE_METAL +#ifdef ENABLE_METAL bool m_shaderFastMath = true; MetalBufferCacheMode m_metalBufferCacheMode = MetalBufferCacheMode::Auto; PositionInvariance m_positionInvariance = PositionInvariance::Auto; diff --git a/src/Cafe/HW/Latte/Core/FetchShader.cpp b/src/Cafe/HW/Latte/Core/FetchShader.cpp index 3018474d..4ea633ba 100644 --- a/src/Cafe/HW/Latte/Core/FetchShader.cpp +++ b/src/Cafe/HW/Latte/Core/FetchShader.cpp @@ -11,7 +11,7 @@ #include "HW/Latte/Renderer/Renderer.h" #include "util/containers/LookupTableL3.h" #include "util/helpers/fspinlock.h" -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "Cafe/HW/Latte/Renderer/Metal/LatteToMtl.h" #endif #include /* SHA1_DIGEST_LENGTH */ @@ -110,7 +110,7 @@ void LatteShader_calculateFSKey(LatteFetchShader* fetchShader) key = std::rotl(key, 8); switch(g_renderer->GetType()) { -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: { key += (uint64)attrib->offset; @@ -129,7 +129,7 @@ void LatteShader_calculateFSKey(LatteFetchShader* fetchShader) } // todo - also hash invalid buffer groups? -#if ENABLE_METAL +#ifdef ENABLE_METAL if (g_renderer->GetType() == RendererAPI::Metal) { for (sint32 g = 0; g < fetchShader->bufferGroups.size(); g++) @@ -178,7 +178,7 @@ void LatteFetchShader::CalculateFetchShaderVkHash() this->vkPipelineHashFragment = h; } -#if ENABLE_METAL +#ifdef ENABLE_METAL void LatteFetchShader::CheckIfVerticesNeedManualFetchMtl(uint32* contextRegister) { for (sint32 g = 0; g < bufferGroups.size(); g++) @@ -383,7 +383,7 @@ LatteFetchShader* LatteShaderRecompiler_createFetchShader(LatteFetchShader::Cach // these only make sense when vertex shader does not call FS? LatteShader_calculateFSKey(newFetchShader); newFetchShader->CalculateFetchShaderVkHash(); -#if ENABLE_METAL +#ifdef ENABLE_METAL newFetchShader->CheckIfVerticesNeedManualFetchMtl(contextRegister); #endif return newFetchShader; @@ -445,7 +445,7 @@ LatteFetchShader* LatteShaderRecompiler_createFetchShader(LatteFetchShader::Cach } LatteShader_calculateFSKey(newFetchShader); newFetchShader->CalculateFetchShaderVkHash(); -#if ENABLE_METAL +#ifdef ENABLE_METAL newFetchShader->CheckIfVerticesNeedManualFetchMtl(contextRegister); #endif diff --git a/src/Cafe/HW/Latte/Core/FetchShader.h b/src/Cafe/HW/Latte/Core/FetchShader.h index 54cf6ada..db72987b 100644 --- a/src/Cafe/HW/Latte/Core/FetchShader.h +++ b/src/Cafe/HW/Latte/Core/FetchShader.h @@ -55,7 +55,7 @@ struct LatteFetchShader void CalculateFetchShaderVkHash(); -#if ENABLE_METAL +#ifdef ENABLE_METAL void CheckIfVerticesNeedManualFetchMtl(uint32* contextRegister); #endif diff --git a/src/Cafe/HW/Latte/Core/LatteShader.cpp b/src/Cafe/HW/Latte/Core/LatteShader.cpp index bc379659..c2730821 100644 --- a/src/Cafe/HW/Latte/Core/LatteShader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShader.cpp @@ -17,7 +17,7 @@ #include "config/ActiveSettings.h" #include "Cafe/GameProfile/GameProfile.h" #include "util/containers/flat_hash_map.hpp" -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "Cafe/HW/Latte/Renderer/Metal/LatteToMtl.h" #endif #include @@ -529,7 +529,7 @@ void LatteSHRC_UpdateVSBaseHash(uint8* vertexShaderPtr, uint32 vertexShaderSize, if (LatteGPUState.contextNew.PA_CL_CLIP_CNTL.get_DX_CLIP_SPACE_DEF()) vsHash += 0x1537; -#if ENABLE_METAL +#ifdef ENABLE_METAL if (g_renderer->GetType() == RendererAPI::Metal) { bool isRectVertexShader = (primitiveType == Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE::RECTS); @@ -654,7 +654,7 @@ uint64 LatteSHRC_CalcPSAuxHash(LatteDecompilerShader* pixelShader, uint32* conte auxHash += (uint64)dim; } -#if ENABLE_METAL +#ifdef ENABLE_METAL if (g_renderer->GetType() == RendererAPI::Metal) { // Textures as render targets @@ -744,7 +744,7 @@ LatteDecompilerShader* LatteShader_CreateShaderFromDecompilerOutput(LatteDecompi shader->resourceMapping = decompilerOutput.resourceMappingVK; break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: shader->resourceMapping = decompilerOutput.resourceMappingMTL; break; @@ -770,7 +770,7 @@ LatteDecompilerShader* LatteShader_CreateShaderFromDecompilerOutput(LatteDecompi InitUniformLayoutFromDecompiler(shader, decompilerOutput); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: InitUniformLayoutFromDecompiler(shader, decompilerOutput); break; diff --git a/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp b/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp index 94dc838a..a1b0e777 100644 --- a/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp @@ -16,7 +16,7 @@ #include "Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.h" #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.h" #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "Cafe/HW/Latte/Renderer/Metal/RendererShaderMtl.h" #include "Cafe/HW/Latte/Renderer/Metal/MetalPipelineCache.h" #endif @@ -289,7 +289,7 @@ void LatteShaderCache_finish() RendererShaderGL::ShaderCacheLoading_end(); return; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: RendererShaderMtl::ShaderCacheLoading_end(); return; @@ -385,7 +385,7 @@ void LatteShaderCache_Load() RendererShaderGL::ShaderCacheLoading_begin(cacheTitleId); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: RendererShaderMtl::ShaderCacheLoading_begin(cacheTitleId); break; @@ -396,7 +396,7 @@ void LatteShaderCache_Load() fs::path pathGeneric; switch(g_renderer->GetType()) { -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: pathGeneric = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}_mtlshaders.bin", cacheTitleId); break; @@ -502,7 +502,7 @@ void LatteShaderCache_Load() #endif LatteShaderCache_finish(); // if Vulkan or Metal then also load pipeline cache -#if defined(ENABLE_VULKAN) || ENABLE_METAL +#if defined(ENABLE_VULKAN) || defined(ENABLE_METAL) if (g_renderer->GetType() == RendererAPI::Vulkan || g_renderer->GetType() == RendererAPI::Metal) LatteShaderCache_LoadPipelineCache(cacheTitleId); #endif @@ -674,7 +674,7 @@ void LatteShaderCache_LoadPipelineCache(uint64 cacheTitleId) g_shaderCacheLoaderState.pipelineFileCount = VulkanPipelineStableCache::GetInstance().BeginLoading(cacheTitleId); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: g_shaderCacheLoaderState.pipelineFileCount = MetalPipelineCache::GetInstance().BeginLoading(cacheTitleId); break; @@ -691,7 +691,7 @@ void LatteShaderCache_LoadPipelineCache(uint64 cacheTitleId) VulkanPipelineStableCache::GetInstance().EndLoading(); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: MetalPipelineCache::GetInstance().EndLoading(); break; @@ -708,7 +708,7 @@ bool LatteShaderCache_updatePipelineLoadingProgress() case RendererAPI::Vulkan: return VulkanPipelineStableCache::GetInstance().UpdateLoading(g_shaderCacheLoaderState.loadedPipelines, pipelinesMissingShaders); #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: return MetalPipelineCache::GetInstance().UpdateLoading(g_shaderCacheLoaderState.loadedPipelines, pipelinesMissingShaders); #endif @@ -984,7 +984,7 @@ void LatteShaderCache_Close() RendererShaderGL::ShaderCacheLoading_Close(); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: RendererShaderMtl::ShaderCacheLoading_Close(); break; @@ -999,7 +999,7 @@ void LatteShaderCache_Close() VulkanPipelineStableCache::GetInstance().Close(); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: MetalPipelineCache::GetInstance().Close(); break; diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompiler.cpp b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompiler.cpp index 028ac359..6b358150 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompiler.cpp +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompiler.cpp @@ -1083,7 +1083,7 @@ void _LatteDecompiler_Process(LatteDecompilerShaderContext* shaderContext, uint8 LatteDecompiler_emitGLSLShader(shaderContext, shaderContext->shader); break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: LatteDecompiler_emitMSLShader(shaderContext, shaderContext->shader); break; diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp index 18cba4b4..7739943b 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp @@ -10,7 +10,7 @@ #include "Cafe/HW/Latte/Renderer/Renderer.h" #include "Common/MemPtr.h" #include "HW/Latte/ISA/LatteReg.h" -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "HW/Latte/Renderer/Metal/MetalCommon.h" #endif @@ -403,7 +403,7 @@ void LatteDecompiler_analyzeExport(LatteDecompilerShaderContext* shaderContext, } else if (cfInstruction->exportType == 0 && cfInstruction->exportArrayBase == 61) { -#if ENABLE_METAL +#ifdef ENABLE_METAL // Only check for depth buffer mask on Metal, as its not in the PS hash on other backends if (g_renderer->GetType() != RendererAPI::Metal || LatteMRT::GetActiveDepthBufferMask(*shaderContext->contextRegistersNew)) shader->depthMask = true; @@ -512,7 +512,7 @@ namespace LatteDecompiler } } -#if ENABLE_METAL +#ifdef ENABLE_METAL void _initTextureBindingPointsMTL(LatteDecompilerShaderContext* decompilerContext) { // for Vulkan we use consecutive indices @@ -563,7 +563,7 @@ namespace LatteDecompiler { decompilerContext->hasUniformVarBlock = true; // uf_verticesPerInstance and uf_streamoutBufferBase* } -#if ENABLE_METAL +#ifdef ENABLE_METAL if (g_renderer->GetType() == RendererAPI::Metal) { bool usesGeometryShader = UseGeometryShader(*decompilerContext->contextRegistersNew, decompilerContext->options->usesGeometryShader); @@ -1113,7 +1113,7 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD shaderContext->output->resourceMappingVK.setIndex = 2; LatteDecompiler::_initTextureBindingPointsGL(shaderContext); LatteDecompiler::_initTextureBindingPointsVK(shaderContext); -#if ENABLE_METAL +#ifdef ENABLE_METAL LatteDecompiler::_initTextureBindingPointsMTL(shaderContext); #endif LatteDecompiler::_initUniformBindingPoints(shaderContext); diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerInternal.h b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerInternal.h index 4c6b158a..0b19bcae 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerInternal.h +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerInternal.h @@ -266,7 +266,7 @@ struct LatteDecompilerShaderContext void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteDecompilerShader* shader); void LatteDecompiler_analyzeDataTypes(LatteDecompilerShaderContext* shaderContext); void LatteDecompiler_emitGLSLShader(LatteDecompilerShaderContext* shaderContext, LatteDecompilerShader* shader); -#if ENABLE_METAL +#ifdef ENABLE_METAL void LatteDecompiler_emitMSLShader(LatteDecompilerShaderContext* shaderContext, LatteDecompilerShader* shader); #endif diff --git a/src/Cafe/HW/Latte/Renderer/RendererOuputShader.cpp b/src/Cafe/HW/Latte/Renderer/RendererOuputShader.cpp index 5fc6c176..1acb4f47 100644 --- a/src/Cafe/HW/Latte/Renderer/RendererOuputShader.cpp +++ b/src/Cafe/HW/Latte/Renderer/RendererOuputShader.cpp @@ -252,7 +252,7 @@ RendererOutputShader::RendererOutputShader(const std::string& vertex_source, con std::string finalFragmentSrc; switch(g_renderer->GetType()) { -#if defined(ENABLE_METAL) +#ifdef ENABLE_METAL case RendererAPI::Metal: finalFragmentSrc = fragment_source; break; @@ -497,7 +497,7 @@ void RendererOutputShader::InitializeStatic() { switch(g_renderer->GetType()) { -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: { std::string vertex_source = GetMetalVertexSource(false); diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index 097587f8..17a67af0 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -144,7 +144,7 @@ XMLConfigParser CemuConfig::Load(XMLConfigParser& parser) fullscreen_scaling = graphic.get("FullscreenScaling", kKeepAspectRatio); async_compile = graphic.get("AsyncCompile", async_compile); vk_accurate_barriers = graphic.get("vkAccurateBarriers", true); // this used to be "VulkanAccurateBarriers" but because we changed the default to true in 1.27.1 the option name had to be changed -#if ENABLE_METAL +#ifdef ENABLE_METAL force_mesh_shaders = graphic.get("ForceMeshShaders", false); #endif @@ -273,7 +273,7 @@ XMLConfigParser CemuConfig::Load(XMLConfigParser& parser) crash_dump = debug.get("CrashDumpUnix", crash_dump); #endif gdb_port = debug.get("GDBPort", 1337); -#if ENABLE_METAL +#ifdef ENABLE_METAL gpu_capture_dir = debug.get("GPUCaptureDir", ""); framebuffer_fetch = debug.get("FramebufferFetch", true); #endif @@ -368,7 +368,7 @@ XMLConfigParser CemuConfig::Save(XMLConfigParser& parser) graphic.set("OverrideGammaValue", overrideGammaValue); graphic.set("UserDisplayGamma", userDisplayGamma); graphic.set("GX2DrawdoneSync", gx2drawdone_sync); -#if ENABLE_METAL +#ifdef ENABLE_METAL graphic.set("ForceMeshShaders", force_mesh_shaders); #endif //graphic.set("PrecompiledShaders", precompiled_shaders.GetValue()); @@ -437,7 +437,7 @@ XMLConfigParser CemuConfig::Save(XMLConfigParser& parser) debug.set("CrashDumpUnix", crash_dump.GetValue()); #endif debug.set("GDBPort", gdb_port); -#if ENABLE_METAL +#ifdef ENABLE_METAL debug.set("GPUCaptureDir", gpu_capture_dir); debug.set("FramebufferFetch", framebuffer_fetch); #endif diff --git a/src/config/CemuConfig.h b/src/config/CemuConfig.h index 94f6c4ed..152c2c3f 100644 --- a/src/config/CemuConfig.h +++ b/src/config/CemuConfig.h @@ -444,7 +444,7 @@ struct CemuConfig ConfigValue gx2drawdone_sync { true }; ConfigValue render_upside_down{ false }; ConfigValue async_compile{ true }; -#if ENABLE_METAL +#ifdef ENABLE_METAL ConfigValue force_mesh_shaders{ false }; #endif @@ -510,7 +510,7 @@ struct CemuConfig // debug ConfigValueBounds crash_dump{ CrashDump::Disabled }; ConfigValue gdb_port{ 1337 }; -#if ENABLE_METAL +#ifdef ENABLE_METAL ConfigValue gpu_capture_dir{ "" }; ConfigValue framebuffer_fetch{ true }; #endif diff --git a/src/gui/wxgui/GameProfileWindow.cpp b/src/gui/wxgui/GameProfileWindow.cpp index 37fac6bc..5962133e 100644 --- a/src/gui/wxgui/GameProfileWindow.cpp +++ b/src/gui/wxgui/GameProfileWindow.cpp @@ -113,7 +113,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) first_row->Add(new wxStaticText(panel, wxID_ANY, _("Graphics API")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); wxString gapi_values[] = { "", "OpenGL", "Vulkan", -#if ENABLE_METAL +#ifdef ENABLE_METAL "Metal" #endif }; @@ -127,7 +127,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) m_shader_mul_accuracy->SetToolTip(_("EXPERT OPTION\nControls the accuracy of floating point multiplication in shaders.\n\nRecommended: true")); first_row->Add(m_shader_mul_accuracy, 0, wxALL, 5); -#if ENABLE_METAL +#ifdef ENABLE_METAL first_row->Add(new wxStaticText(panel, wxID_ANY, _("Shader fast math")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); wxString math_values[] = { _("false"), _("true") }; @@ -296,7 +296,7 @@ void GameProfileWindow::ApplyProfile() else m_graphic_api->SetSelection(1 + m_game_profile.m_graphics_api.value()); // "", OpenGL, Vulkan, Metal m_shader_mul_accuracy->SetSelection((int)m_game_profile.m_accurateShaderMul); -#if ENABLE_METAL +#ifdef ENABLE_METAL m_shader_fast_math->SetSelection((int)m_game_profile.m_shaderFastMath); m_metal_buffer_cache_mode->SetSelection((int)m_game_profile.m_metalBufferCacheMode); m_position_invariance->SetSelection((int)m_game_profile.m_positionInvariance); @@ -362,7 +362,7 @@ void GameProfileWindow::SaveProfile() m_game_profile.m_accurateShaderMul = (AccurateShaderMulOption)m_shader_mul_accuracy->GetSelection(); if (m_game_profile.m_accurateShaderMul != AccurateShaderMulOption::False && m_game_profile.m_accurateShaderMul != AccurateShaderMulOption::True) m_game_profile.m_accurateShaderMul = AccurateShaderMulOption::True; // force a legal value -#if ENABLE_METAL +#ifdef ENABLE_METAL m_game_profile.m_shaderFastMath = (bool)m_shader_fast_math->GetSelection(); m_game_profile.m_metalBufferCacheMode = (MetalBufferCacheMode)m_metal_buffer_cache_mode->GetSelection(); m_game_profile.m_positionInvariance = (PositionInvariance)m_position_invariance->GetSelection(); diff --git a/src/gui/wxgui/GameProfileWindow.h b/src/gui/wxgui/GameProfileWindow.h index 3cb381d9..fe6150dc 100644 --- a/src/gui/wxgui/GameProfileWindow.h +++ b/src/gui/wxgui/GameProfileWindow.h @@ -40,7 +40,7 @@ private: wxChoice* m_graphic_api; wxChoice* m_shader_mul_accuracy; -#if ENABLE_METAL +#ifdef ENABLE_METAL wxChoice* m_shader_fast_math; wxChoice* m_metal_buffer_cache_mode; wxChoice* m_position_invariance; diff --git a/src/gui/wxgui/GeneralSettings2.cpp b/src/gui/wxgui/GeneralSettings2.cpp index 12535eb8..f556809e 100644 --- a/src/gui/wxgui/GeneralSettings2.cpp +++ b/src/gui/wxgui/GeneralSettings2.cpp @@ -31,7 +31,7 @@ #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h" #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.h" #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "Cafe/HW/Latte/Renderer/Metal/MetalRenderer.h" #endif #include "Cafe/Account/Account.h" @@ -102,7 +102,7 @@ private: }; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL class wxMetalUUID : public wxClientData { public: @@ -370,7 +370,7 @@ wxPanel* GeneralSettings2::AddGraphicsPage(wxNotebook* notebook) m_api_map.push_back(GraphicAPI::kVulkan); } #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL choices[api_size++] = "Metal"; m_api_map.push_back(GraphicAPI::kMetal); #endif @@ -414,7 +414,7 @@ wxPanel* GeneralSettings2::AddGraphicsPage(wxNotebook* notebook) m_gx2drawdone_sync->SetToolTip(_("If synchronization is requested by the game, the emulated CPU will wait for the GPU to finish all operations.\nThis is more accurate behavior, but may cause lower performance")); graphic_misc_row->Add(m_gx2drawdone_sync, 0, wxALL, 5); -#if ENABLE_METAL +#ifdef ENABLE_METAL m_force_mesh_shaders = new wxCheckBox(box, wxID_ANY, _("Force mesh shaders")); m_force_mesh_shaders->SetToolTip(_("Force mesh shaders on all GPUs that support them. Mesh shaders are disabled by default on Intel GPUs due to potential stability issues.\nMetal only")); graphic_misc_row->Add(m_force_mesh_shaders, 0, wxALL, 5); @@ -1042,7 +1042,7 @@ wxPanel* GeneralSettings2::AddDebugPage(wxNotebook* notebook) debug_panel_sizer->Add(debug_row, 0, wxALL | wxEXPAND, 5); } -#if ENABLE_METAL +#ifdef ENABLE_METAL { auto* debug_row = new wxFlexGridSizer(0, 2, 0, 0); debug_row->SetFlexibleDirection(wxBOTH); @@ -1248,7 +1248,7 @@ void GeneralSettings2::StoreConfig() config.vk_graphic_device_uuid = {}; } #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL if (config.graphic_api == GraphicAPI::kMetal) { if (selection != wxNOT_FOUND) @@ -1266,7 +1266,7 @@ void GeneralSettings2::StoreConfig() config.gx2drawdone_sync = m_gx2drawdone_sync->IsChecked(); -#if ENABLE_METAL +#ifdef ENABLE_METAL config.force_mesh_shaders = m_force_mesh_shaders->IsChecked(); #endif config.async_compile = m_async_compile->IsChecked(); @@ -1297,7 +1297,7 @@ void GeneralSettings2::StoreConfig() // debug config.crash_dump = (CrashDump)m_crash_dump->GetSelection(); config.gdb_port = m_gdb_port->GetValue(); -#if ENABLE_METAL +#ifdef ENABLE_METAL config.gpu_capture_dir = m_gpu_capture_dir->GetValue().utf8_string(); config.framebuffer_fetch = m_framebuffer_fetch->IsChecked(); #endif @@ -1757,7 +1757,7 @@ void GeneralSettings2::HandleGraphicsApiSelection() m_gx2drawdone_sync->Enable(); m_async_compile->Disable(); -#if ENABLE_METAL +#ifdef ENABLE_METAL m_force_mesh_shaders->Disable(); #endif break; @@ -1769,7 +1769,7 @@ void GeneralSettings2::HandleGraphicsApiSelection() // Vulkan m_gx2drawdone_sync->Disable(); m_async_compile->Enable(); -#if ENABLE_METAL +#ifdef ENABLE_METAL m_force_mesh_shaders->Disable(); #endif @@ -1806,7 +1806,7 @@ void GeneralSettings2::HandleGraphicsApiSelection() break; } #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case GraphicAPI::kMetal: { // Metal @@ -1918,7 +1918,7 @@ void GeneralSettings2::ApplyConfig() } m_async_compile->SetValue(config.async_compile); m_gx2drawdone_sync->SetValue(config.gx2drawdone_sync); -#if ENABLE_METAL +#ifdef ENABLE_METAL m_force_mesh_shaders->SetValue(config.force_mesh_shaders); #endif m_upscale_filter->SetSelection(config.upscale_filter); @@ -2057,7 +2057,7 @@ void GeneralSettings2::ApplyConfig() // debug m_crash_dump->SetSelection((int)config.crash_dump.GetValue()); m_gdb_port->SetValue(config.gdb_port.GetValue()); -#if ENABLE_METAL +#ifdef ENABLE_METAL m_gpu_capture_dir->SetValue(wxString::FromUTF8(config.gpu_capture_dir.GetValue())); m_framebuffer_fetch->SetValue(config.framebuffer_fetch); #endif diff --git a/src/gui/wxgui/GeneralSettings2.h b/src/gui/wxgui/GeneralSettings2.h index 5615b433..2f7e3b68 100644 --- a/src/gui/wxgui/GeneralSettings2.h +++ b/src/gui/wxgui/GeneralSettings2.h @@ -73,7 +73,7 @@ private: wxCheckBox* m_userDisplayisSRGB; wxCheckBox *m_async_compile, *m_gx2drawdone_sync; -#if ENABLE_METAL +#ifdef ENABLE_METAL wxCheckBox *m_force_mesh_shaders; #endif wxRadioBox* m_upscale_filter, *m_downscale_filter, *m_fullscreen_scaling; @@ -101,7 +101,7 @@ private: // Debug wxChoice* m_crash_dump; wxSpinCtrl* m_gdb_port; -#if ENABLE_METAL +#ifdef ENABLE_METAL wxTextCtrl* m_gpu_capture_dir; wxCheckBox* m_framebuffer_fetch; #endif diff --git a/src/gui/wxgui/MainWindow.cpp b/src/gui/wxgui/MainWindow.cpp index 7dd8ed8f..94bdb004 100644 --- a/src/gui/wxgui/MainWindow.cpp +++ b/src/gui/wxgui/MainWindow.cpp @@ -17,7 +17,7 @@ #ifdef ENABLE_VULKAN #include "wxgui/canvas/VulkanCanvas.h" #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "wxgui/canvas/MetalCanvas.h" #endif #include "Cafe/OS/libs/nfc/nfc.h" @@ -72,7 +72,7 @@ #include "gamemode_client.h" #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "Cafe/HW/Latte/Renderer/Metal/MetalRenderer.h" #endif @@ -1043,7 +1043,7 @@ void MainWindow::OnDebugSetting(wxCommandEvent& event) if(!GetConfig().vk_accurate_barriers) wxMessageBox(_("Warning: Disabling the accurate barriers option will lead to flickering graphics but may improve performance. It is highly recommended to leave it turned on."), _("Accurate barriers are off"), wxOK); } -#if ENABLE_METAL +#ifdef ENABLE_METAL else if (event.GetId() == MAINFRAME_MENU_ID_DEBUG_GPU_CAPTURE) { cemu_assert_debug(g_renderer->GetType() == RendererAPI::Metal); @@ -1610,17 +1610,17 @@ void MainWindow::CreateCanvas() switch (ActiveSettings::GetGraphicsAPI()) { case kOpenGL: -#if defined(ENABLE_OPENGL) +#ifdef ENABLE_OPENGL m_render_canvas = GLCanvas_Create(m_game_panel, wxSize(1280, 720), true); break; #endif case kVulkan: -#if defined(ENABLE_VULKAN) +#ifdef ENABLE_VULKAN m_render_canvas = new VulkanCanvas(m_game_panel, wxSize(1280, 720), true); break; #endif case kMetal: -#if defined(ENABLE_METAL) +#ifdef ENABLE_METAL m_render_canvas = new MetalCanvas(m_game_panel, wxSize(1280, 720), true); break; #endif @@ -2370,7 +2370,7 @@ void MainWindow::RecreateMenu() auto accurateBarriers = debugMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_VK_ACCURATE_BARRIERS, _("&Accurate barriers (Vulkan)")); accurateBarriers->Check(GetConfig().vk_accurate_barriers); -#if ENABLE_METAL +#ifdef ENABLE_METAL auto gpuCapture = debugMenu->Append(MAINFRAME_MENU_ID_DEBUG_GPU_CAPTURE, _("&GPU capture (Metal)")); gpuCapture->Enable(m_game_launched && g_renderer->GetType() == RendererAPI::Metal); #endif diff --git a/src/gui/wxgui/PadViewFrame.cpp b/src/gui/wxgui/PadViewFrame.cpp index 6bcdb079..b2e55a92 100644 --- a/src/gui/wxgui/PadViewFrame.cpp +++ b/src/gui/wxgui/PadViewFrame.cpp @@ -12,7 +12,7 @@ #ifdef ENABLE_VULKAN #include "wxgui/canvas/VulkanCanvas.h" #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL #include "wxgui/canvas/MetalCanvas.h" #endif #include "config/CemuConfig.h" @@ -91,7 +91,7 @@ void PadViewFrame::InitializeRenderCanvas() m_render_canvas = GLCanvas_Create(this, wxSize(854, 480), false); #endif } -#if ENABLE_METAL +#ifdef ENABLE_METAL else m_render_canvas = new MetalCanvas(this, wxSize(854, 480), false); #endif diff --git a/src/gui/wxgui/wxWindowSystem.cpp b/src/gui/wxgui/wxWindowSystem.cpp index d35e0ee8..b9e760ed 100644 --- a/src/gui/wxgui/wxWindowSystem.cpp +++ b/src/gui/wxgui/wxWindowSystem.cpp @@ -105,7 +105,7 @@ void WindowSystem::UpdateWindowTitles(bool isIdle, bool isLoading, double fps) renderer = "[Vulkan]"; break; #endif -#if ENABLE_METAL +#ifdef ENABLE_METAL case RendererAPI::Metal: renderer = "[Metal]"; break;