1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

Apply IRenderer shader changes

This commit is contained in:
Dan Balasescu 2022-07-30 01:29:11 +09:00
parent 155dac55d0
commit e06f39a69f
2 changed files with 12 additions and 7 deletions

View File

@ -16,10 +16,12 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
@ -79,7 +81,7 @@ namespace osu.Game.Tests.Rulesets
dependencies.CacheAs<TextureStore>(ParentTextureStore = new TestTextureStore()); dependencies.CacheAs<TextureStore>(ParentTextureStore = new TestTextureStore());
dependencies.CacheAs<ISampleStore>(ParentSampleStore = new TestSampleStore()); dependencies.CacheAs<ISampleStore>(ParentSampleStore = new TestSampleStore());
dependencies.CacheAs<ShaderManager>(ParentShaderManager = new TestShaderManager()); dependencies.CacheAs<ShaderManager>(ParentShaderManager = new TestShaderManager(parent.Get<GameHost>().Renderer));
return new DrawableRulesetDependencies(new OsuRuleset(), dependencies); return new DrawableRulesetDependencies(new OsuRuleset(), dependencies);
} }
@ -148,8 +150,8 @@ namespace osu.Game.Tests.Rulesets
private class TestShaderManager : ShaderManager private class TestShaderManager : ShaderManager
{ {
public TestShaderManager() public TestShaderManager(IRenderer renderer)
: base(new ResourceStore<byte[]>()) : base(renderer, new ResourceStore<byte[]>())
{ {
} }

View File

@ -13,6 +13,7 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
@ -55,6 +56,8 @@ namespace osu.Game.Rulesets.UI
if (resources != null) if (resources != null)
{ {
var host = parent.Get<GameHost>();
TextureStore = new TextureStore(parent.Get<GameHost>().CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, @"Textures"))); TextureStore = new TextureStore(parent.Get<GameHost>().CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(resources, @"Textures")));
CacheAs(TextureStore = new FallbackTextureStore(TextureStore, parent.Get<TextureStore>())); CacheAs(TextureStore = new FallbackTextureStore(TextureStore, parent.Get<TextureStore>()));
@ -62,8 +65,8 @@ namespace osu.Game.Rulesets.UI
SampleStore.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY; SampleStore.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY;
CacheAs(SampleStore = new FallbackSampleStore(SampleStore, parent.Get<ISampleStore>())); CacheAs(SampleStore = new FallbackSampleStore(SampleStore, parent.Get<ISampleStore>()));
ShaderManager = new ShaderManager(new NamespacedResourceStore<byte[]>(resources, @"Shaders")); ShaderManager = new ShaderManager(host.Renderer, new NamespacedResourceStore<byte[]>(resources, @"Shaders"));
CacheAs(ShaderManager = new FallbackShaderManager(ShaderManager, parent.Get<ShaderManager>())); CacheAs(ShaderManager = new FallbackShaderManager(host.Renderer, ShaderManager, parent.Get<ShaderManager>()));
} }
RulesetConfigManager = parent.Get<IRulesetConfigCache>().GetConfigFor(ruleset); RulesetConfigManager = parent.Get<IRulesetConfigCache>().GetConfigFor(ruleset);
@ -191,8 +194,8 @@ namespace osu.Game.Rulesets.UI
private readonly ShaderManager primary; private readonly ShaderManager primary;
private readonly ShaderManager fallback; private readonly ShaderManager fallback;
public FallbackShaderManager(ShaderManager primary, ShaderManager fallback) public FallbackShaderManager(IRenderer renderer, ShaderManager primary, ShaderManager fallback)
: base(new ResourceStore<byte[]>()) : base(renderer, new ResourceStore<byte[]>())
{ {
this.primary = primary; this.primary = primary;
this.fallback = fallback; this.fallback = fallback;