mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 16:47:24 +08:00
Merge pull request #23228 from smoogipoo/shader-cache-stages
Apply framework changes to custom ShaderManager
This commit is contained in:
commit
cc96d275c2
@ -11,7 +11,7 @@
|
||||
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.417.1" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.418.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
||||
|
@ -164,7 +164,7 @@ namespace osu.Game.Tests.Rulesets
|
||||
this.parentManager = parentManager;
|
||||
}
|
||||
|
||||
public override byte[] LoadRaw(string name) => parentManager.LoadRaw(name);
|
||||
public override byte[] GetRawData(string fileName) => parentManager.GetRawData(fileName);
|
||||
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
|
@ -51,8 +51,8 @@ namespace osu.Game.Tests.Testing
|
||||
{
|
||||
AddStep("ruleset shaders retrieved without error", () =>
|
||||
{
|
||||
Dependencies.Get<ShaderManager>().LoadRaw(@"sh_TestVertex.vs");
|
||||
Dependencies.Get<ShaderManager>().LoadRaw(@"sh_TestFragment.fs");
|
||||
Dependencies.Get<ShaderManager>().GetRawData(@"sh_TestVertex.vs");
|
||||
Dependencies.Get<ShaderManager>().GetRawData(@"sh_TestFragment.fs");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -206,27 +206,11 @@ namespace osu.Game.Rulesets.UI
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
// When the debugger is attached, exceptions are expensive.
|
||||
// Manually work around this by caching failed lookups and falling back straight to parent.
|
||||
private readonly HashSet<(string, string)> failedLookups = new HashSet<(string, string)>();
|
||||
public override IShader? GetCachedShader(string vertex, string fragment) => base.GetCachedShader(vertex, fragment) ?? parent.GetCachedShader(vertex, fragment);
|
||||
|
||||
public override IShader Load(string vertex, string fragment)
|
||||
{
|
||||
if (!failedLookups.Contains((vertex, fragment)))
|
||||
{
|
||||
try
|
||||
{
|
||||
return base.Load(vertex, fragment);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Shader lookup is very non-standard. Rather than returning null on missing shaders, exceptions are thrown.
|
||||
failedLookups.Add((vertex, fragment));
|
||||
}
|
||||
}
|
||||
public override IShaderPart? GetCachedShaderPart(string name) => base.GetCachedShaderPart(name) ?? parent.GetCachedShaderPart(name);
|
||||
|
||||
return parent.Load(vertex, fragment);
|
||||
}
|
||||
public override byte[]? GetRawData(string fileName) => base.GetRawData(fileName) ?? parent.GetRawData(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.20.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.417.1" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.418.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.417.0" />
|
||||
<PackageReference Include="Sentry" Version="3.28.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||
|
@ -16,6 +16,6 @@
|
||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.417.1" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.418.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user