Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
hwsmm committed Sep 14, 2024
2 parents fe29690 + 3b74bd6 commit 28a59b0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions osu-framework.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ See the LICENCE file in the repository root for full licence text.
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework/Graphics/Containers/CompositeDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A drawable consisting of a composite of child drawables which are
/// manages by the composite object itself. Transformations applied to
/// managed by the composite object itself. Transformations applied to
/// a <see cref="CompositeDrawable"/> are also applied to its children.
/// Additionally, <see cref="CompositeDrawable"/>s support various effects, such as masking, edge effect,
/// padding, and automatic sizing depending on their children.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DeviceBufferPool(GraphicsPipeline pipeline, uint bufferSize, BufferUsage

public IPooledDeviceBuffer Get()
{
if (TryGet(_ => true, out IPooledDeviceBuffer? existing))
if (TryGet(out IPooledDeviceBuffer? existing))
return existing;

existing = new PooledDeviceBuffer(Pipeline, bufferSize, usage);
Expand Down
7 changes: 5 additions & 2 deletions osu.Framework/Graphics/Veldrid/VeldridStagingResourcePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ protected VeldridStagingResourcePool(GraphicsPipeline pipeline, string name)
pipeline.ExecutionFinished += executionFinished;
}

protected bool TryGet(Predicate<T> match, [NotNullWhen(true)] out T? resource)
protected bool TryGet([NotNullWhen(true)] out T? resource)
=> TryGet<object>(static (_, _) => true, null, out resource);

protected bool TryGet<TState>(Func<T, TState?, bool> match, TState? state, [NotNullWhen(true)] out T? resource)
{
// Reverse iteration is important to prefer reusing recently returned textures.
// This avoids the case of a large pool being constantly cycled and therefore never
Expand All @@ -41,7 +44,7 @@ protected bool TryGet(Predicate<T> match, [NotNullWhen(true)] out T? resource)
{
var existing = available[i];

if (match(existing.Resource))
if (match(existing.Resource, state))
{
existing.FrameUsageIndex = currentExecutionIndex;

Expand Down
7 changes: 6 additions & 1 deletion osu.Framework/Graphics/Veldrid/VeldridStagingTexturePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ public VeldridStagingTexturePool(GraphicsPipeline pipeline)

public Texture Get(int width, int height, PixelFormat format)
{
if (TryGet(t => t.Width >= width && t.Height >= height && t.Format == format, out var texture))
if (TryGet(match, new TextureLookup(width, height, format), out var texture))
return texture;

texture = Pipeline.Factory.CreateTexture(TextureDescription.Texture2D((uint)width, (uint)height, 1, 1, format, TextureUsage.Staging));
AddNewResource(texture);
return texture;
}

private static bool match(Texture texture, TextureLookup lookup)
=> texture.Width >= lookup.Width && texture.Height >= lookup.Height && texture.Format == lookup.Format;

private readonly record struct TextureLookup(int Width, int Height, PixelFormat Format);
}
}
4 changes: 2 additions & 2 deletions osu.Framework/osu.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<PackageReference Include="ppy.ManagedBass.Mix" Version="2022.1216.0" />
<PackageReference Include="ppy.ManagedBass.Wasapi" Version="2022.1216.0" />
<PackageReference Include="ppy.Veldrid" Version="4.9.62-gca0239da6b" />
<PackageReference Include="ppy.Veldrid.SPIRV" Version="1.0.15-g0c0fcee30c" />
<PackageReference Include="ppy.Veldrid.SPIRV" Version="1.0.15-gfbb03d21c2" />
<PackageReference Include="SharpFNT" Version="2.0.0" />
<!-- Preview version of ImageSharp causes NU5104. -->
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
Expand All @@ -47,7 +47,7 @@

<!-- DO NOT use ProjectReference for native packaging project.
See https://github.com/NuGet/Home/issues/4514 and https://github.com/dotnet/sdk/issues/765 . -->
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2024.809.1-nativelibs" />
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2024.912.0-nativelibs" />

<!-- Any version ahead of this will cause AOT issues with iOS
See https://github.com/mono/mono/issues/21188 -->
Expand Down

0 comments on commit 28a59b0

Please sign in to comment.