diff --git a/UnleashedRecomp/gpu/shader/msl/blend_color_alpha_ps.metal b/UnleashedRecomp/gpu/shader/msl/blend_color_alpha_ps.metal index 4071a0b..693fc10 100644 --- a/UnleashedRecomp/gpu/shader/msl/blend_color_alpha_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/blend_color_alpha_ps.metal @@ -12,12 +12,12 @@ struct Interpolators [[fragment]] float4 shaderMain(float4 iPos [[position]], Interpolators input [[stage_in]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(3)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap [[buffer(3)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - texture2d texture = g_Texture2DDescriptorHeap.g[s0_Texture2DDescriptorIndex]; - sampler samplerState = g_SamplerDescriptorHeap.g[s0_SamplerDescriptorIndex]; + texture2d texture = g_Texture2DDescriptorHeap[s0_Texture2DDescriptorIndex].tex; + sampler samplerState = g_SamplerDescriptorHeap[s0_SamplerDescriptorIndex].samp; float4 color = texture.sample(samplerState, input.iTexCoord0.xy); diff --git a/UnleashedRecomp/gpu/shader/msl/copy_color_ps.metal b/UnleashedRecomp/gpu/shader/msl/copy_color_ps.metal index 6628937..7532550 100644 --- a/UnleashedRecomp/gpu/shader/msl/copy_color_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/copy_color_ps.metal @@ -2,13 +2,13 @@ struct Texture2DDescriptorHeap { - array, 1> g [[id(0)]]; + texture2d tex; }; [[fragment]] float4 shaderMain(float4 position [[position]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - return g_Texture2DDescriptorHeap.g[g_PushConstants.ResourceDescriptorIndex].read(uint2(position.xy), 0); + return g_Texture2DDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].tex.read(uint2(position.xy), 0); } diff --git a/UnleashedRecomp/gpu/shader/msl/copy_depth_ps.metal b/UnleashedRecomp/gpu/shader/msl/copy_depth_ps.metal index bf9885a..c44364d 100644 --- a/UnleashedRecomp/gpu/shader/msl/copy_depth_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/copy_depth_ps.metal @@ -2,7 +2,7 @@ struct Texture2DDescriptorHeap { - array, 1> g [[id(0)]]; + texture2d tex; }; struct PixelShaderOutput @@ -12,12 +12,12 @@ struct PixelShaderOutput [[fragment]] PixelShaderOutput shaderMain(float4 position [[position]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { PixelShaderOutput output = PixelShaderOutput{}; - output.oDepth = g_Texture2DDescriptorHeap.g[g_PushConstants.ResourceDescriptorIndex].read(uint2(position.xy), 0).x; + output.oDepth = g_Texture2DDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].tex.read(uint2(position.xy), 0).x; return output; } diff --git a/UnleashedRecomp/gpu/shader/msl/csd_filter_ps.metal b/UnleashedRecomp/gpu/shader/msl/csd_filter_ps.metal index 53acea3..3f2ab2e 100644 --- a/UnleashedRecomp/gpu/shader/msl/csd_filter_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/csd_filter_ps.metal @@ -12,12 +12,12 @@ struct Interpolators [[fragment]] float4 shaderMain(Interpolators input [[stage_in]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(3)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap [[buffer(3)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - texture2d texture = g_Texture2DDescriptorHeap.g[s0_Texture2DDescriptorIndex]; - sampler samplerState = g_SamplerDescriptorHeap.g[s0_SamplerDescriptorIndex]; + texture2d texture = g_Texture2DDescriptorHeap[s0_Texture2DDescriptorIndex].tex; + sampler samplerState = g_SamplerDescriptorHeap[s0_SamplerDescriptorIndex].samp; uint2 dimensions = getTexture2DDimensions(texture); diff --git a/UnleashedRecomp/gpu/shader/msl/enhanced_motion_blur_ps.metal b/UnleashedRecomp/gpu/shader/msl/enhanced_motion_blur_ps.metal index 2c06829..84d30c3 100644 --- a/UnleashedRecomp/gpu/shader/msl/enhanced_motion_blur_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/enhanced_motion_blur_ps.metal @@ -20,17 +20,17 @@ struct Interpolators [[fragment]] float4 shaderMain(float4 position [[position]], Interpolators input [[stage_in]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(3)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap [[buffer(3)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - texture2d sampColor = g_Texture2DDescriptorHeap.g[sampColor_Texture2DDescriptorIndex]; - texture2d sampVelocityMap = g_Texture2DDescriptorHeap.g[sampVelocityMap_Texture2DDescriptorIndex]; - texture2d sampZBuffer = g_Texture2DDescriptorHeap.g[sampZBuffer_Texture2DDescriptorIndex]; + texture2d sampColor = g_Texture2DDescriptorHeap[sampColor_Texture2DDescriptorIndex].tex; + texture2d sampVelocityMap = g_Texture2DDescriptorHeap[sampVelocityMap_Texture2DDescriptorIndex].tex; + texture2d sampZBuffer = g_Texture2DDescriptorHeap[sampZBuffer_Texture2DDescriptorIndex].tex; - sampler sampColor_s = g_SamplerDescriptorHeap.g[sampColor_SamplerDescriptorIndex]; - sampler sampVelocityMap_s = g_SamplerDescriptorHeap.g[sampVelocityMap_SamplerDescriptorIndex]; - sampler sampZBuffer_s = g_SamplerDescriptorHeap.g[sampZBuffer_SamplerDescriptorIndex]; + sampler sampColor_s = g_SamplerDescriptorHeap[sampColor_SamplerDescriptorIndex].samp; + sampler sampVelocityMap_s = g_SamplerDescriptorHeap[sampVelocityMap_SamplerDescriptorIndex].samp; + sampler sampZBuffer_s = g_SamplerDescriptorHeap[sampZBuffer_SamplerDescriptorIndex].samp; float depth = sampZBuffer.sample(sampZBuffer_s, input.texCoord.xy, level(0)).x; float4 velocityMap = sampVelocityMap.sample(sampVelocityMap_s, input.texCoord.xy, level(0)); diff --git a/UnleashedRecomp/gpu/shader/msl/gamma_correction_ps.metal b/UnleashedRecomp/gpu/shader/msl/gamma_correction_ps.metal index e8fffad..6cfbf03 100644 --- a/UnleashedRecomp/gpu/shader/msl/gamma_correction_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/gamma_correction_ps.metal @@ -8,10 +8,10 @@ [[fragment]] float4 shaderMain(float4 position [[position]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - texture2d texture = g_Texture2DDescriptorHeap.g[g_TextureDescriptorIndex]; + texture2d texture = g_Texture2DDescriptorHeap[g_TextureDescriptorIndex].tex; int2 movedPosition = int2(position.xy) - g_ViewportOffset; bool boxed = any(movedPosition < 0) || any(movedPosition >= g_ViewportSize); diff --git a/UnleashedRecomp/gpu/shader/msl/gaussian_blur.metali b/UnleashedRecomp/gpu/shader/msl/gaussian_blur.metali index 7734aa8..3331e2b 100644 --- a/UnleashedRecomp/gpu/shader/msl/gaussian_blur.metali +++ b/UnleashedRecomp/gpu/shader/msl/gaussian_blur.metali @@ -27,12 +27,12 @@ struct Interpolators [[fragment]] float4 shaderMain(float4 iPosition [[position]], Interpolators input [[stage_in]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(3)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap [[buffer(3)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - texture2d texture = g_Texture2DDescriptorHeap.g[s0_Texture2DDescriptorIndex]; - sampler samplerState = g_SamplerDescriptorHeap.g[s0_SamplerDescriptorIndex]; + texture2d texture = g_Texture2DDescriptorHeap[s0_Texture2DDescriptorIndex].tex; + sampler samplerState = g_SamplerDescriptorHeap[s0_SamplerDescriptorIndex].samp; float scale; if ((g_ViewportSize.x * g_ViewportSize.w) >= (16.0 / 9.0)) diff --git a/UnleashedRecomp/gpu/shader/msl/imgui_common.metali b/UnleashedRecomp/gpu/shader/msl/imgui_common.metali index a103e7b..35cc10e 100644 --- a/UnleashedRecomp/gpu/shader/msl/imgui_common.metali +++ b/UnleashedRecomp/gpu/shader/msl/imgui_common.metali @@ -32,10 +32,10 @@ struct Interpolators struct Texture2DDescriptorHeap { - array, 1> g [[id(0)]]; + texture2d tex; }; struct SamplerDescriptorHeap { - array g [[id(0)]]; + sampler samp; }; \ No newline at end of file diff --git a/UnleashedRecomp/gpu/shader/msl/imgui_ps.metal b/UnleashedRecomp/gpu/shader/msl/imgui_ps.metal index 18e2fa8..a42cd63 100644 --- a/UnleashedRecomp/gpu/shader/msl/imgui_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/imgui_ps.metal @@ -79,10 +79,10 @@ float median(float r, float g, float b) } float4 SampleSdfFont(float4 color, texture2d texture, float2 uv, float2 screenTexSize, - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap, + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap, constant PushConstants& g_PushConstants) { - float4 textureColor = texture.sample(g_SamplerDescriptorHeap.g[0], uv); + float4 textureColor = texture.sample(g_SamplerDescriptorHeap[0].samp, uv); uint width = texture.get_width(); uint height = texture.get_height(); @@ -127,8 +127,8 @@ float4 SampleSdfFont(float4 color, texture2d texture, float2 uv, float2 s [[fragment]] float4 shaderMain(Interpolators interpolators [[stage_in]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(1)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap [[buffer(1)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { float4 color = interpolators.Color; @@ -136,7 +136,7 @@ float4 shaderMain(Interpolators interpolators [[stage_in]], if (g_PushConstants.Texture2DDescriptorIndex != 0) { - texture2d texture = g_Texture2DDescriptorHeap.g[g_PushConstants.Texture2DDescriptorIndex & 0x7FFFFFFF]; + texture2d texture = g_Texture2DDescriptorHeap[g_PushConstants.Texture2DDescriptorIndex & 0x7FFFFFFF].tex; if ((g_PushConstants.Texture2DDescriptorIndex & 0x80000000) != 0) { @@ -180,7 +180,7 @@ float4 shaderMain(Interpolators interpolators [[stage_in]], } else { - color *= texture.sample(g_SamplerDescriptorHeap.g[0], interpolators.UV); + color *= texture.sample(g_SamplerDescriptorHeap[0].samp, interpolators.UV); } } diff --git a/UnleashedRecomp/gpu/shader/msl/movie_ps.metal b/UnleashedRecomp/gpu/shader/msl/movie_ps.metal index e6288b2..36432bb 100644 --- a/UnleashedRecomp/gpu/shader/msl/movie_ps.metal +++ b/UnleashedRecomp/gpu/shader/msl/movie_ps.metal @@ -2,21 +2,21 @@ [[fragment]] PixelShaderOutput shaderMain(Interpolators In [[stage_in]], - constant Texture2DDescriptorHeap& g_Texture2DDescriptorHeap [[buffer(0)]], - constant SamplerDescriptorHeap& g_SamplerDescriptorHeap [[buffer(3)]], + constant Texture2DDescriptorHeap* g_Texture2DDescriptorHeap [[buffer(0)]], + constant SamplerDescriptorHeap* g_SamplerDescriptorHeap [[buffer(3)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - texture2d Tex0 = g_Texture2DDescriptorHeap.g[Tex0_ResourceDescriptorIndex]; - texture2d Tex1 = g_Texture2DDescriptorHeap.g[Tex1_ResourceDescriptorIndex]; - texture2d Tex2 = g_Texture2DDescriptorHeap.g[Tex2_ResourceDescriptorIndex]; - texture2d Tex3 = g_Texture2DDescriptorHeap.g[Tex3_ResourceDescriptorIndex]; - texture2d Tex4 = g_Texture2DDescriptorHeap.g[Tex4_ResourceDescriptorIndex]; + texture2d Tex0 = g_Texture2DDescriptorHeap[Tex0_ResourceDescriptorIndex].tex; + texture2d Tex1 = g_Texture2DDescriptorHeap[Tex1_ResourceDescriptorIndex].tex; + texture2d Tex2 = g_Texture2DDescriptorHeap[Tex2_ResourceDescriptorIndex].tex; + texture2d Tex3 = g_Texture2DDescriptorHeap[Tex3_ResourceDescriptorIndex].tex; + texture2d Tex4 = g_Texture2DDescriptorHeap[Tex4_ResourceDescriptorIndex].tex; - sampler Tex0_s = g_SamplerDescriptorHeap.g[Tex0_SamplerDescriptorIndex]; - sampler Tex1_s = g_SamplerDescriptorHeap.g[Tex1_SamplerDescriptorIndex]; - sampler Tex2_s = g_SamplerDescriptorHeap.g[Tex2_SamplerDescriptorIndex]; - sampler Tex3_s = g_SamplerDescriptorHeap.g[Tex3_SamplerDescriptorIndex]; - sampler Tex4_s = g_SamplerDescriptorHeap.g[Tex4_SamplerDescriptorIndex]; + sampler Tex0_s = g_SamplerDescriptorHeap[Tex0_SamplerDescriptorIndex].samp; + sampler Tex1_s = g_SamplerDescriptorHeap[Tex1_SamplerDescriptorIndex].samp; + sampler Tex2_s = g_SamplerDescriptorHeap[Tex2_SamplerDescriptorIndex].samp; + sampler Tex3_s = g_SamplerDescriptorHeap[Tex3_SamplerDescriptorIndex].samp; + sampler Tex4_s = g_SamplerDescriptorHeap[Tex4_SamplerDescriptorIndex].samp; PixelShaderOutput Out; float ValY = Tex0.sample(Tex0_s, In.UV).r; diff --git a/UnleashedRecomp/gpu/shader/msl/resolve_msaa_color.metali b/UnleashedRecomp/gpu/shader/msl/resolve_msaa_color.metali index 7064fa7..518089e 100644 --- a/UnleashedRecomp/gpu/shader/msl/resolve_msaa_color.metali +++ b/UnleashedRecomp/gpu/shader/msl/resolve_msaa_color.metali @@ -4,18 +4,18 @@ struct Texture2DMSDescriptorHeap { - array, 1> g [[id(0)]]; + texture2d_ms tex; }; [[fragment]] float4 shaderMain(float4 position [[position]], - constant Texture2DMSDescriptorHeap& g_Texture2DMSDescriptorHeap [[buffer(0)]], + constant Texture2DMSDescriptorHeap* g_Texture2DMSDescriptorHeap [[buffer(0)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { - float4 result = g_Texture2DMSDescriptorHeap.g[g_PushConstants.ResourceDescriptorIndex].read(uint2(position.xy), 0); + float4 result = g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].tex.read(uint2(position.xy), 0); for (int i = 1; i < SAMPLE_COUNT; i++) - result += g_Texture2DMSDescriptorHeap.g[g_PushConstants.ResourceDescriptorIndex].read(uint2(position.xy), i); + result += g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].tex.read(uint2(position.xy), i); return result / SAMPLE_COUNT; } diff --git a/UnleashedRecomp/gpu/shader/msl/resolve_msaa_depth.metali b/UnleashedRecomp/gpu/shader/msl/resolve_msaa_depth.metali index 5017dd2..8f9a14c 100644 --- a/UnleashedRecomp/gpu/shader/msl/resolve_msaa_depth.metali +++ b/UnleashedRecomp/gpu/shader/msl/resolve_msaa_depth.metali @@ -4,7 +4,7 @@ struct Texture2DMSDescriptorHeap { - array, 1> g [[id(0)]]; + texture2d_ms tex; }; struct PixelShaderOutput @@ -14,15 +14,15 @@ struct PixelShaderOutput [[fragment]] PixelShaderOutput shaderMain(float4 position [[position]], - constant Texture2DMSDescriptorHeap& g_Texture2DMSDescriptorHeap [[buffer(0)]], + constant Texture2DMSDescriptorHeap* g_Texture2DMSDescriptorHeap [[buffer(0)]], constant PushConstants& g_PushConstants [[buffer(4)]]) { PixelShaderOutput output = PixelShaderOutput{}; - float result = g_Texture2DMSDescriptorHeap.g[g_PushConstants.ResourceDescriptorIndex].read(uint2(position.xy), 0).x; + float result = g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].tex.read(uint2(position.xy), 0).x; for (int i = 1; i < SAMPLE_COUNT; i++) - result = min(result, g_Texture2DMSDescriptorHeap.g[g_PushConstants.ResourceDescriptorIndex].read(uint2(position.xy), i).x); + result = min(result, g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].tex.read(uint2(position.xy), i).x); output.oDepth = result;