fix: CI when metal is disabled

This commit is contained in:
Samuliak 2024-10-31 17:13:22 +01:00
parent e7ac19979d
commit 7eb8508db4
No known key found for this signature in database
11 changed files with 50 additions and 15 deletions

View File

@ -201,6 +201,8 @@ endif()
if (ENABLE_METAL)
include_directories(${CMAKE_SOURCE_DIR}/dependencies/metal-cpp)
add_definitions(-DENABLE_METAL=1)
endif()
if (ENABLE_DISCORD_RPC)

View File

@ -151,9 +151,6 @@ add_library(CemuCafe
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSLAttrDecoder.cpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSL.cpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitGLSLHeader.hpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSLAttrDecoder.cpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSL.cpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSLHeader.hpp
HW/Latte/LegacyShaderDecompiler/LatteDecompiler.h
HW/Latte/LegacyShaderDecompiler/LatteDecompilerInstructions.h
HW/Latte/LegacyShaderDecompiler/LatteDecompilerInternal.h
@ -579,6 +576,12 @@ if(ENABLE_METAL)
HW/Latte/Renderer/Metal/UtilityShaderSource.h
)
target_sources(CemuCafe PRIVATE
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSLAttrDecoder.cpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSL.cpp
HW/Latte/LegacyShaderDecompiler/LatteDecompilerEmitMSLHeader.hpp
)
#target_link_libraries(CemuCafe PRIVATE
# "-framework Metal"
# "-framework QuartzCore"

View File

@ -11,7 +11,7 @@
#include "HW/Latte/Renderer/Renderer.h"
#include "util/containers/LookupTableL3.h"
#include "util/helpers/fspinlock.h"
#if BOOST_OS_MACOS
#if ENABLE_METAL
#include "Cafe/HW/Latte/Renderer/Metal/LatteToMtl.h"
#endif
#include <openssl/sha.h> /* SHA1_DIGEST_LENGTH */
@ -166,6 +166,7 @@ void LatteFetchShader::CalculateFetchShaderVkHash()
void LatteFetchShader::CheckIfVerticesNeedManualFetchMtl(uint32* contextRegister)
{
#if ENABLE_METAL
for (sint32 g = 0; g < bufferGroups.size(); g++)
{
LatteParsedFetchShaderBufferGroup_t& group = bufferGroups[g];
@ -183,6 +184,7 @@ void LatteFetchShader::CheckIfVerticesNeedManualFetchMtl(uint32* contextRegister
mtlFetchVertexManually = true;
}
}
#endif
}
void _fetchShaderDecompiler_parseInstruction_VTX_SEMANTIC(LatteFetchShader* parsedFetchShader, uint32* contextRegister, const LatteClauseInstruction_VTX* instr)

View File

@ -14,7 +14,7 @@
#include "config/ActiveSettings.h"
#include "Cafe/GameProfile/GameProfile.h"
#include "util/containers/flat_hash_map.hpp"
#if BOOST_OS_MACOS
#if ENABLE_METAL
#include "Cafe/HW/Latte/Renderer/Metal/LatteToMtl.h"
#endif
#include <cinttypes>
@ -591,7 +591,7 @@ void LatteSHRC_UpdatePSBaseHash(uint8* pixelShaderPtr, uint32 pixelShaderSize, b
// get vertex shader
uint64 psHash = psHash1 + psHash2 + _activePSImportTable.key + (usesGeometryShader ? hashCacheGS.prevHash1 : 0ULL);
#if BOOST_OS_MACOS
#if ENABLE_METAL
if (g_renderer->GetType() == RendererAPI::Metal)
{
for (uint8 i = 0; i < LATTE_NUM_COLOR_TARGET; i++)

View File

@ -11,8 +11,10 @@
#include "Cafe/HW/Latte/Renderer/Renderer.h"
#include "Cafe/HW/Latte/Renderer/OpenGL/RendererShaderGL.h"
#include "Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.h"
#if ENABLE_METAL
#include "Cafe/HW/Latte/Renderer/Metal/RendererShaderMtl.h"
#include "Cafe/HW/Latte/Renderer/Metal/MetalPipelineCache.h"
#endif
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.h"
#include <imgui.h>
@ -163,8 +165,10 @@ void LatteShaderCache_finish()
RendererShaderVk::ShaderCacheLoading_end();
else if (g_renderer->GetType() == RendererAPI::OpenGL)
RendererShaderGL::ShaderCacheLoading_end();
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
RendererShaderMtl::ShaderCacheLoading_end();
#endif
}
uint32 LatteShaderCache_getShaderCacheExtraVersion(uint64 titleId)
@ -247,8 +251,11 @@ void LatteShaderCache_Load()
RendererShaderVk::ShaderCacheLoading_begin(cacheTitleId);
else if (g_renderer->GetType() == RendererAPI::OpenGL)
RendererShaderGL::ShaderCacheLoading_begin(cacheTitleId);
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
RendererShaderMtl::ShaderCacheLoading_begin(cacheTitleId);
#endif
// get cache file name
const auto pathGeneric = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}_shaders.bin", cacheTitleId);
const auto pathGenericPre1_25_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}.bin", cacheTitleId); // before 1.25.0
@ -508,14 +515,18 @@ void LatteShaderCache_LoadPipelineCache(uint64 cacheTitleId)
{
if (g_renderer->GetType() == RendererAPI::Vulkan)
g_shaderCacheLoaderState.pipelineFileCount = VulkanPipelineStableCache::GetInstance().BeginLoading(cacheTitleId);
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
g_shaderCacheLoaderState.pipelineFileCount = MetalPipelineCache::GetInstance().BeginLoading(cacheTitleId);
#endif
g_shaderCacheLoaderState.loadedPipelines = 0;
LatteShaderCache_ShowProgress(LatteShaderCache_updatePipelineLoadingProgress, true);
if (g_renderer->GetType() == RendererAPI::Vulkan)
VulkanPipelineStableCache::GetInstance().EndLoading();
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
MetalPipelineCache::GetInstance().EndLoading();
#endif
if(Latte_GetStopSignal())
LatteThread_Exit();
}
@ -525,8 +536,10 @@ bool LatteShaderCache_updatePipelineLoadingProgress()
uint32 pipelinesMissingShaders = 0;
if (g_renderer->GetType() == RendererAPI::Vulkan)
return VulkanPipelineStableCache::GetInstance().UpdateLoading(g_shaderCacheLoaderState.loadedPipelines, pipelinesMissingShaders);
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
return MetalPipelineCache::GetInstance().UpdateLoading(g_shaderCacheLoaderState.loadedPipelines, pipelinesMissingShaders);
#endif
return false;
}
@ -790,14 +803,18 @@ void LatteShaderCache_Close()
RendererShaderVk::ShaderCacheLoading_Close();
else if (g_renderer->GetType() == RendererAPI::OpenGL)
RendererShaderGL::ShaderCacheLoading_Close();
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
RendererShaderMtl::ShaderCacheLoading_Close();
#endif
// if Vulkan or Metal then also close pipeline cache
if (g_renderer->GetType() == RendererAPI::Vulkan)
VulkanPipelineStableCache::GetInstance().Close();
#if ENABLE_METAL
else if (g_renderer->GetType() == RendererAPI::Metal)
MetalPipelineCache::GetInstance().Close();
#endif
}
#include <wx/msgdlg.h>

View File

@ -1067,10 +1067,12 @@ void _LatteDecompiler_Process(LatteDecompilerShaderContext* shaderContext, uint8
// emit code
if (shaderContext->shader->hasError == false)
{
if (g_renderer->GetType() == RendererAPI::Metal)
LatteDecompiler_emitMSLShader(shaderContext, shaderContext->shader);
if (g_renderer->GetType() == RendererAPI::OpenGL || g_renderer->GetType() == RendererAPI::Vulkan)
LatteDecompiler_emitGLSLShader(shaderContext, shaderContext->shader);
#if ENABLE_METAL
else
LatteDecompiler_emitGLSLShader(shaderContext, shaderContext->shader);
LatteDecompiler_emitMSLShader(shaderContext, shaderContext->shader);
#endif
}
LatteDecompiler_cleanup(shaderContext);
// fast access

View File

@ -4,8 +4,6 @@ add_library(CemuGui
canvas/OpenGLCanvas.h
canvas/VulkanCanvas.cpp
canvas/VulkanCanvas.h
canvas/MetalCanvas.cpp
canvas/MetalCanvas.h
CemuApp.cpp
CemuApp.h
CemuUpdateWindow.cpp
@ -131,6 +129,13 @@ add_library(CemuGui
wxHelper.h
)
if(ENABLE_METAL)
target_sources(CemuGui PRIVATE
canvas/MetalCanvas.cpp
canvas/MetalCanvas.h
)
endif()
set_property(TARGET CemuGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

View File

@ -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",
#ifdef __APPLE__
#if ENABLE_METAL
"Metal"
#endif
};
@ -271,7 +271,7 @@ void GameProfileWindow::ApplyProfile()
if (!m_game_profile.m_graphics_api.has_value())
m_graphic_api->SetSelection(0); // selecting ""
else
m_graphic_api->SetSelection(1 + m_game_profile.m_graphics_api.value()); // "", OpenGL, Vulkan
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);
//// audio
@ -338,7 +338,7 @@ void GameProfileWindow::SaveProfile()
if (m_graphic_api->GetSelection() == 0)
m_game_profile.m_graphics_api = {};
else
m_game_profile.m_graphics_api = (GraphicAPI)(m_graphic_api->GetSelection() - 1); // "", OpenGL, Vulkan
m_game_profile.m_graphics_api = (GraphicAPI)(m_graphic_api->GetSelection() - 1); // "", OpenGL, Vulkan, Metal
// controller
for (int i = 0; i < 8; ++i)

View File

@ -314,7 +314,7 @@ wxPanel* GeneralSettings2::AddGraphicsPage(wxNotebook* notebook)
{
choices[api_size++] = "Vulkan";
}
#ifdef __APPLE__
#if ENABLE_METAL
choices[api_size++] = "Metal";
#endif

View File

@ -1570,8 +1570,10 @@ void MainWindow::CreateCanvas()
m_render_canvas = new VulkanCanvas(m_game_panel, wxSize(1280, 720), true);
else if (ActiveSettings::GetGraphicsAPI() == kOpenGL)
m_render_canvas = GLCanvas_Create(m_game_panel, wxSize(1280, 720), true);
#if ENABLE_METAL
else
m_render_canvas = new MetalCanvas(m_game_panel, wxSize(1280, 720), true);
#endif
// mouse events
m_render_canvas->Bind(wxEVT_MOTION, &MainWindow::OnMouseMove, this);

View File

@ -77,8 +77,10 @@ void PadViewFrame::InitializeRenderCanvas()
m_render_canvas = new VulkanCanvas(this, wxSize(854, 480), false);
else if (ActiveSettings::GetGraphicsAPI() == kOpenGL)
m_render_canvas = GLCanvas_Create(this, wxSize(854, 480), false);
#if ENABLE_METAL
else
m_render_canvas = new MetalCanvas(this, wxSize(854, 480), false);
#endif
sizer->Add(m_render_canvas, 1, wxEXPAND, 0, nullptr);
}
SetSizer(sizer);