Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions MarathonRecomp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/blend_color_alpha_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/copy_color_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Texture2D<float4> 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));
}
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/copy_depth_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Texture2D<float> 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));
}
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/copy_vs.hlsl
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/csd_filter_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/csd_no_tex_vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/csd_vs.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<float4> sampColor = g_Texture2DDescriptorHeap[sampColor_Texture2DDescriptorIndex];
Texture2D<float4> sampVelocityMap = g_Texture2DDescriptorHeap[sampVelocityMap_Texture2DDescriptorIndex];
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/gamma_correction_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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<float4> texture = g_Texture2DDescriptorHeap[g_TextureDescriptorIndex];

Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/gaussian_blur.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -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<float4> texture = g_Texture2DDescriptorHeap[s0_Texture2DDescriptorIndex];
SamplerState samplerState = g_SamplerDescriptorHeap[s0_SamplerDescriptorIndex];
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/imgui_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ float4 SampleSdfFont(float4 color, Texture2D<float4> 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);
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/imgui_vs.hlsl
Original file line number Diff line number Diff line change
@@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/movie_ps.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "movie_common.hlsli"

PixelShaderOutput main(in Interpolators In)
PixelShaderOutput shaderMain(in Interpolators In)
{
Texture2D<float4> Tex0 = g_Texture2DDescriptorHeap[Tex0_ResourceDescriptorIndex];
Texture2D<float4> Tex1 = g_Texture2DDescriptorHeap[Tex1_ResourceDescriptorIndex];
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/movie_vs.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "movie_common.hlsli"

Interpolators main(in VertexShaderInput In)
Interpolators shaderMain(in VertexShaderInput In)
{
Interpolators Out;
Out.ProjPos = In.ObjPos;
Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/resolve_msaa_color.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Texture2DMS<float4, SAMPLE_COUNT> 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);

Expand Down
2 changes: 1 addition & 1 deletion MarathonRecomp/gpu/shader/hlsl/resolve_msaa_depth.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Texture2DMS<float, SAMPLE_COUNT> 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);

Expand Down
10 changes: 5 additions & 5 deletions MarathonRecomp/gpu/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ static std::unique_ptr<GuestShader> 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)
Expand All @@ -1458,13 +1458,13 @@ static std::unique_ptr<GuestShader> 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

Expand Down Expand Up @@ -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
Expand All @@ -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:
{
Expand Down
2 changes: 1 addition & 1 deletion tools/XenosRecomp
Loading