From c1e3fe6be6a721848b177808072a723cbb813317 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Mon, 28 Jul 2025 14:04:46 -0700 Subject: [PATCH 1/3] Fix Linux build --- CMakeLists.txt | 4 ++++ MarathonRecomp/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d239dfae..865e155e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,10 @@ if (APPLE) enable_language(OBJC OBJCXX) endif() +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + set(SDL_VULKAN_ENABLED ON CACHE BOOL "") +endif() + if (CMAKE_OSX_ARCHITECTURES) set(MARATHON_RECOMP_ARCHITECTURE ${CMAKE_OSX_ARCHITECTURES}) elseif(CMAKE_SYSTEM_PROCESSOR) diff --git a/MarathonRecomp/CMakeLists.txt b/MarathonRecomp/CMakeLists.txt index 40161d160..ca74c405f 100644 --- a/MarathonRecomp/CMakeLists.txt +++ b/MarathonRecomp/CMakeLists.txt @@ -374,7 +374,7 @@ if (MARATHON_RECOMP_METAL) target_compile_definitions(MarathonRecomp PRIVATE MARATHON_RECOMP_METAL) endif() -if (CMAKE_SYSTEM_NAME MATCHES "Linux") +if (SDL_VULKAN_ENABLED) target_compile_definitions(MarathonRecomp PRIVATE SDL_VULKAN_ENABLED) endif() From 4c07d4a6f3aeb3920172fe66128d688bb5f9bdeb Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Mon, 28 Jul 2025 14:23:59 -0700 Subject: [PATCH 2/3] Fix shader entry point names. --- MarathonRecomp/CMakeLists.txt | 4 ++-- .../gpu/shader/hlsl/blend_color_alpha_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl | 2 +- .../gpu/shader/hlsl/enhanced_motion_blur_ps.hlsl | 2 +- .../gpu/shader/hlsl/gamma_correction_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/gaussian_blur.hlsli | 2 +- MarathonRecomp/gpu/shader/hlsl/imgui_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/imgui_vs.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/movie_ps.hlsl | 2 +- MarathonRecomp/gpu/shader/hlsl/movie_vs.hlsl | 2 +- .../gpu/shader/hlsl/resolve_msaa_color.hlsli | 2 +- .../gpu/shader/hlsl/resolve_msaa_depth.hlsli | 2 +- MarathonRecomp/gpu/video.cpp | 10 +++++----- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/MarathonRecomp/CMakeLists.txt b/MarathonRecomp/CMakeLists.txt index ca74c405f..92f5aa820 100644 --- a/MarathonRecomp/CMakeLists.txt +++ b/MarathonRecomp/CMakeLists.txt @@ -470,14 +470,14 @@ function(compile_shader FILE_PATH TARGET_NAME) if (MARATHON_RECOMP_D3D12) add_custom_command( OUTPUT ${HLSL_FILE_PATH}.dxil.h - COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -Wno-ignored-attributes -Fh ${HLSL_FILE_PATH}.dxil.h ${HLSL_FILE_PATH} -Vn g_${HLSL_NAME}_dxil + COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -Wno-ignored-attributes -E shaderMain -Fh ${HLSL_FILE_PATH}.dxil.h ${HLSL_FILE_PATH} -Vn g_${HLSL_NAME}_dxil DEPENDS ${HLSL_FILE_PATH} ) target_sources(MarathonRecomp PRIVATE ${HLSL_FILE_PATH}.dxil.h) endif() add_custom_command( OUTPUT ${HLSL_FILE_PATH}.spirv.h - COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -spirv -fvk-use-dx-layout ${ARGN} -Fh ${HLSL_FILE_PATH}.spirv.h ${HLSL_FILE_PATH} -Vn g_${HLSL_NAME}_spirv + COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -spirv -fvk-use-dx-layout ${ARGN} -E shaderMain -Fh ${HLSL_FILE_PATH}.spirv.h ${HLSL_FILE_PATH} -Vn g_${HLSL_NAME}_spirv DEPENDS ${HLSL_FILE_PATH} ) target_sources(MarathonRecomp PRIVATE ${HLSL_FILE_PATH}.spirv.h) diff --git a/MarathonRecomp/gpu/shader/hlsl/blend_color_alpha_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/blend_color_alpha_ps.hlsl index edcdc4799..ee16fb4e9 100644 --- a/MarathonRecomp/gpu/shader/hlsl/blend_color_alpha_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/blend_color_alpha_ps.hlsl @@ -22,7 +22,7 @@ cbuffer SharedConstants : register(b2, space4) #endif -float4 main( +float4 shaderMain( in float4 iPos : SV_Position, in float4 iTexCoord0 : TEXCOORD0) : SV_Target0 { diff --git a/MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl index 0559557a8..95bd5c557 100644 --- a/MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl @@ -2,7 +2,7 @@ Texture2D g_Texture2DDescriptorHeap[] : register(t0, space0); -float4 main(in float4 position : SV_Position) : SV_Target +float4 shaderMain(in float4 position : SV_Position) : SV_Target { return g_Texture2DDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int3(position.xy, 0)); } diff --git a/MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl index 251f893a8..61d8328fb 100644 --- a/MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl @@ -2,7 +2,7 @@ Texture2D g_Texture2DDescriptorHeap[] : register(t0, space0); -float main(in float4 position : SV_Position) : SV_Depth +float shaderMain(in float4 position : SV_Position) : SV_Depth { return g_Texture2DDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int3(position.xy, 0)); } diff --git a/MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl b/MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl index 5a2576d7f..94943765b 100644 --- a/MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl @@ -1,4 +1,4 @@ -void main(in uint vertexId : SV_VertexID, out float4 position : SV_Position, out float2 texCoord : TEXCOORD) +void shaderMain(in uint vertexId : SV_VertexID, out float4 position : SV_Position, out float2 texCoord : TEXCOORD) { texCoord = float2((vertexId << 1) & 2, vertexId & 2); position = float4(texCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); diff --git a/MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl index 99424ce49..0e544a3c9 100644 --- a/MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl @@ -16,7 +16,7 @@ cbuffer SharedConstants : register(b2, space4) #endif -float4 main( +float4 shaderMain( in float4 iPosition : SV_Position, in float4 iTexCoord0 : TEXCOORD0, in float4 iTexCoord1 : TEXCOORD1) : SV_Target diff --git a/MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl b/MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl index 16eca7522..b8163b2e5 100644 --- a/MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl @@ -20,7 +20,7 @@ cbuffer SharedConstants : register(b2, space4) #endif -void main( +void shaderMain( [[vk::location(0)]] in float4 iPosition0 : POSITION0, [[vk::location(8)]] in float4 iColor0 : COLOR0, out float4 oPos : SV_Position, diff --git a/MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl b/MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl index 3ec425bf3..0cb283648 100644 --- a/MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl @@ -20,7 +20,7 @@ cbuffer SharedConstants : register(b2, space4) #endif -void main( +void shaderMain( [[vk::location(0)]] in float4 iPosition0 : POSITION0, [[vk::location(8)]] in float4 iColor0 : COLOR0, [[vk::location(4)]] in float4 iTexCoord0 : TEXCOORD0, diff --git a/MarathonRecomp/gpu/shader/hlsl/enhanced_motion_blur_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/enhanced_motion_blur_ps.hlsl index c96900dc9..3535b696b 100644 --- a/MarathonRecomp/gpu/shader/hlsl/enhanced_motion_blur_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/enhanced_motion_blur_ps.hlsl @@ -38,7 +38,7 @@ cbuffer SharedConstants : register(b2, space4) #endif -float4 main(in float4 position : SV_Position, in float4 texCoord : TEXCOORD0) : SV_Target +float4 shaderMain(in float4 position : SV_Position, in float4 texCoord : TEXCOORD0) : SV_Target { Texture2D sampColor = g_Texture2DDescriptorHeap[sampColor_Texture2DDescriptorIndex]; Texture2D sampVelocityMap = g_Texture2DDescriptorHeap[sampVelocityMap_Texture2DDescriptorIndex]; diff --git a/MarathonRecomp/gpu/shader/hlsl/gamma_correction_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/gamma_correction_ps.hlsl index 17577a08f..0c1d9361f 100644 --- a/MarathonRecomp/gpu/shader/hlsl/gamma_correction_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/gamma_correction_ps.hlsl @@ -20,7 +20,7 @@ cbuffer SharedConstants : register(b2, space4) #endif -float4 main(in float4 position : SV_Position) : SV_Target +float4 shaderMain(in float4 position : SV_Position) : SV_Target { Texture2D texture = g_Texture2DDescriptorHeap[g_TextureDescriptorIndex]; diff --git a/MarathonRecomp/gpu/shader/hlsl/gaussian_blur.hlsli b/MarathonRecomp/gpu/shader/hlsl/gaussian_blur.hlsli index 6f1bc58bf..a31c07c20 100644 --- a/MarathonRecomp/gpu/shader/hlsl/gaussian_blur.hlsli +++ b/MarathonRecomp/gpu/shader/hlsl/gaussian_blur.hlsli @@ -40,7 +40,7 @@ float ComputeWeight(float x) return exp(-(x * x) / (2.0 * std * std)) / (std * sqrt(2.0 * PI)); } -float4 main(in float4 iPosition : SV_Position, in float4 iTexCoord0 : TEXCOORD0) : SV_Target +float4 shaderMain(in float4 iPosition : SV_Position, in float4 iTexCoord0 : TEXCOORD0) : SV_Target { Texture2D texture = g_Texture2DDescriptorHeap[s0_Texture2DDescriptorIndex]; SamplerState samplerState = g_SamplerDescriptorHeap[s0_SamplerDescriptorIndex]; diff --git a/MarathonRecomp/gpu/shader/hlsl/imgui_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/imgui_ps.hlsl index 8bb19bdeb..94667cd5a 100644 --- a/MarathonRecomp/gpu/shader/hlsl/imgui_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/imgui_ps.hlsl @@ -90,7 +90,7 @@ float4 SampleSdfFont(float4 color, Texture2D texture, float2 uv, float2 return color; } -float4 main(in Interpolators interpolators) : SV_Target +float4 shaderMain(in Interpolators interpolators) : SV_Target { float4 color = interpolators.Color; color *= PixelAntialiasing(interpolators.Position.xy - g_PushConstants.ProceduralOrigin); diff --git a/MarathonRecomp/gpu/shader/hlsl/imgui_vs.hlsl b/MarathonRecomp/gpu/shader/hlsl/imgui_vs.hlsl index 50a53f4dc..747b41eaa 100644 --- a/MarathonRecomp/gpu/shader/hlsl/imgui_vs.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/imgui_vs.hlsl @@ -1,6 +1,6 @@ #include "imgui_common.hlsli" -void main(in float2 position : POSITION, in float2 uv : TEXCOORD, in float4 color : COLOR, out Interpolators interpolators) +void shaderMain(in float2 position : POSITION, in float2 uv : TEXCOORD, in float4 color : COLOR, out Interpolators interpolators) { if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_TEXT_SKEW) { diff --git a/MarathonRecomp/gpu/shader/hlsl/movie_ps.hlsl b/MarathonRecomp/gpu/shader/hlsl/movie_ps.hlsl index ec441a1d3..fc3c88770 100644 --- a/MarathonRecomp/gpu/shader/hlsl/movie_ps.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/movie_ps.hlsl @@ -1,6 +1,6 @@ #include "movie_common.hlsli" -PixelShaderOutput main(in Interpolators In) +PixelShaderOutput shaderMain(in Interpolators In) { Texture2D Tex0 = g_Texture2DDescriptorHeap[Tex0_ResourceDescriptorIndex]; Texture2D Tex1 = g_Texture2DDescriptorHeap[Tex1_ResourceDescriptorIndex]; diff --git a/MarathonRecomp/gpu/shader/hlsl/movie_vs.hlsl b/MarathonRecomp/gpu/shader/hlsl/movie_vs.hlsl index 6d00919e1..1ab5a364c 100644 --- a/MarathonRecomp/gpu/shader/hlsl/movie_vs.hlsl +++ b/MarathonRecomp/gpu/shader/hlsl/movie_vs.hlsl @@ -1,6 +1,6 @@ #include "movie_common.hlsli" -Interpolators main(in VertexShaderInput In) +Interpolators shaderMain(in VertexShaderInput In) { Interpolators Out; Out.ProjPos = In.ObjPos; diff --git a/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_color.hlsli b/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_color.hlsli index f9b029d9e..3b09d0cfc 100644 --- a/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_color.hlsli +++ b/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_color.hlsli @@ -4,7 +4,7 @@ Texture2DMS g_Texture2DMSDescriptorHeap[] : register(t0, space0); -float4 main(in float4 position : SV_Position) : SV_Target +float4 shaderMain(in float4 position : SV_Position) : SV_Target { float4 result = g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int2(position.xy), 0); diff --git a/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_depth.hlsli b/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_depth.hlsli index a06c7bac4..0d8f070e7 100644 --- a/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_depth.hlsli +++ b/MarathonRecomp/gpu/shader/hlsl/resolve_msaa_depth.hlsli @@ -4,7 +4,7 @@ Texture2DMS g_Texture2DMSDescriptorHeap[] : register(t0, space0); -float main(in float4 position : SV_Position) : SV_Depth +float shaderMain(in float4 position : SV_Position) : SV_Depth { float result = g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int2(position.xy), 0); diff --git a/MarathonRecomp/gpu/video.cpp b/MarathonRecomp/gpu/video.cpp index 389495660..7cfa692f7 100644 --- a/MarathonRecomp/gpu/video.cpp +++ b/MarathonRecomp/gpu/video.cpp @@ -1449,7 +1449,7 @@ static std::unique_ptr g_enhancedMotionBlurShader; g_device->createShader( \ (g_backend == Backend::VULKAN) ? g_##NAME##_spirv : g_##NAME##_dxil, \ (g_backend == Backend::VULKAN) ? sizeof(g_##NAME##_spirv) : sizeof(g_##NAME##_dxil), \ - "main", \ + "shaderMain", \ (g_backend == Backend::VULKAN) ? RenderShaderFormat::SPIRV : RenderShaderFormat::DXIL) #elif defined(MARATHON_RECOMP_METAL) @@ -1458,13 +1458,13 @@ static std::unique_ptr g_enhancedMotionBlurShader; g_device->createShader( \ (g_backend == Backend::VULKAN) ? g_##NAME##_spirv : g_##NAME##_air, \ (g_backend == Backend::VULKAN) ? sizeof(g_##NAME##_spirv) : sizeof(g_##NAME##_air), \ - (g_backend == Backend::VULKAN) ? "main" : "shaderMain", \ + "shaderMain", \ (g_backend == Backend::VULKAN) ? RenderShaderFormat::SPIRV : RenderShaderFormat::METAL) #else #define CREATE_SHADER(NAME) \ - g_device->createShader(g_##NAME##_spirv, sizeof(g_##NAME##_spirv), "main", RenderShaderFormat::SPIRV) + g_device->createShader(g_##NAME##_spirv, sizeof(g_##NAME##_spirv), "shaderMain", RenderShaderFormat::SPIRV) #endif @@ -4039,7 +4039,7 @@ static RenderShader* GetOrLinkShader(GuestShader* guestShader, uint32_t specCons bool result = smolv::Decode(compressedSpirvData, guestShader->shaderCacheEntry->spirvSize, decoded.data(), decoded.size()); assert(result); - guestShader->shader = g_device->createShader(decoded.data(), decoded.size(), "main", RenderShaderFormat::SPIRV); + guestShader->shader = g_device->createShader(decoded.data(), decoded.size(), "shaderMain", RenderShaderFormat::SPIRV); #ifdef _DEBUG guestShader->shader->setName(fmt::format("{}:{:x}", guestShader->shaderCacheEntry->filename, guestShader->shaderCacheEntry->hash)); #endif @@ -4048,7 +4048,7 @@ static RenderShader* GetOrLinkShader(GuestShader* guestShader, uint32_t specCons case Backend::D3D12: { guestShader->shader = g_device->createShader(g_shaderCache.get() + guestShader->shaderCacheEntry->dxilOffset, - guestShader->shaderCacheEntry->dxilSize, "main", RenderShaderFormat::DXIL); + guestShader->shaderCacheEntry->dxilSize, "shaderMain", RenderShaderFormat::DXIL); } case Backend::METAL: { From 1bbc7da9baa242b65be04707ef11deb93e0aa92c Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Mon, 28 Jul 2025 14:36:59 -0700 Subject: [PATCH 3/3] Fix Windows build --- tools/XenosRecomp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/XenosRecomp b/tools/XenosRecomp index 1e7664443..d641cb6b3 160000 --- a/tools/XenosRecomp +++ b/tools/XenosRecomp @@ -1 +1 @@ -Subproject commit 1e766444316fcddde7c833450c09e326905e9b30 +Subproject commit d641cb6b3427d13bb75eacb211e8276361353b61