Skip to content

Commit 9a6413e

Browse files
authored
Fix Linux build (#19)
* Fix Linux build * Fix shader entry point names. * Fix Windows build
1 parent 5a6a8c3 commit 9a6413e

20 files changed

Lines changed: 29 additions & 25 deletions

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ if (APPLE)
2323
enable_language(OBJC OBJCXX)
2424
endif()
2525

26+
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
27+
set(SDL_VULKAN_ENABLED ON CACHE BOOL "")
28+
endif()
29+
2630
if (CMAKE_OSX_ARCHITECTURES)
2731
set(MARATHON_RECOMP_ARCHITECTURE ${CMAKE_OSX_ARCHITECTURES})
2832
elseif(CMAKE_SYSTEM_PROCESSOR)

MarathonRecomp/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ if (MARATHON_RECOMP_METAL)
374374
target_compile_definitions(MarathonRecomp PRIVATE MARATHON_RECOMP_METAL)
375375
endif()
376376

377-
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
377+
if (SDL_VULKAN_ENABLED)
378378
target_compile_definitions(MarathonRecomp PRIVATE SDL_VULKAN_ENABLED)
379379
endif()
380380

@@ -470,14 +470,14 @@ function(compile_shader FILE_PATH TARGET_NAME)
470470
if (MARATHON_RECOMP_D3D12)
471471
add_custom_command(
472472
OUTPUT ${HLSL_FILE_PATH}.dxil.h
473-
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
473+
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
474474
DEPENDS ${HLSL_FILE_PATH}
475475
)
476476
target_sources(MarathonRecomp PRIVATE ${HLSL_FILE_PATH}.dxil.h)
477477
endif()
478478
add_custom_command(
479479
OUTPUT ${HLSL_FILE_PATH}.spirv.h
480-
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
480+
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
481481
DEPENDS ${HLSL_FILE_PATH}
482482
)
483483
target_sources(MarathonRecomp PRIVATE ${HLSL_FILE_PATH}.spirv.h)

MarathonRecomp/gpu/shader/hlsl/blend_color_alpha_ps.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cbuffer SharedConstants : register(b2, space4)
2222

2323
#endif
2424

25-
float4 main(
25+
float4 shaderMain(
2626
in float4 iPos : SV_Position,
2727
in float4 iTexCoord0 : TEXCOORD0) : SV_Target0
2828
{

MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Texture2D<float4> g_Texture2DDescriptorHeap[] : register(t0, space0);
44

5-
float4 main(in float4 position : SV_Position) : SV_Target
5+
float4 shaderMain(in float4 position : SV_Position) : SV_Target
66
{
77
return g_Texture2DDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int3(position.xy, 0));
88
}

MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Texture2D<float> g_Texture2DDescriptorHeap[] : register(t0, space0);
44

5-
float main(in float4 position : SV_Position) : SV_Depth
5+
float shaderMain(in float4 position : SV_Position) : SV_Depth
66
{
77
return g_Texture2DDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int3(position.xy, 0));
88
}

MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
void main(in uint vertexId : SV_VertexID, out float4 position : SV_Position, out float2 texCoord : TEXCOORD)
1+
void shaderMain(in uint vertexId : SV_VertexID, out float4 position : SV_Position, out float2 texCoord : TEXCOORD)
22
{
33
texCoord = float2((vertexId << 1) & 2, vertexId & 2);
44
position = float4(texCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);

MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cbuffer SharedConstants : register(b2, space4)
1616

1717
#endif
1818

19-
float4 main(
19+
float4 shaderMain(
2020
in float4 iPosition : SV_Position,
2121
in float4 iTexCoord0 : TEXCOORD0,
2222
in float4 iTexCoord1 : TEXCOORD1) : SV_Target

MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cbuffer SharedConstants : register(b2, space4)
2020

2121
#endif
2222

23-
void main(
23+
void shaderMain(
2424
[[vk::location(0)]] in float4 iPosition0 : POSITION0,
2525
[[vk::location(8)]] in float4 iColor0 : COLOR0,
2626
out float4 oPos : SV_Position,

MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cbuffer SharedConstants : register(b2, space4)
2020

2121
#endif
2222

23-
void main(
23+
void shaderMain(
2424
[[vk::location(0)]] in float4 iPosition0 : POSITION0,
2525
[[vk::location(8)]] in float4 iColor0 : COLOR0,
2626
[[vk::location(4)]] in float4 iTexCoord0 : TEXCOORD0,

MarathonRecomp/gpu/shader/hlsl/enhanced_motion_blur_ps.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ cbuffer SharedConstants : register(b2, space4)
3838

3939
#endif
4040

41-
float4 main(in float4 position : SV_Position, in float4 texCoord : TEXCOORD0) : SV_Target
41+
float4 shaderMain(in float4 position : SV_Position, in float4 texCoord : TEXCOORD0) : SV_Target
4242
{
4343
Texture2D<float4> sampColor = g_Texture2DDescriptorHeap[sampColor_Texture2DDescriptorIndex];
4444
Texture2D<float4> sampVelocityMap = g_Texture2DDescriptorHeap[sampVelocityMap_Texture2DDescriptorIndex];

0 commit comments

Comments
 (0)