Skip to content

Commit

Permalink
Update framework and apply changes to support masking SSBO
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Aug 22, 2023
1 parent 2937dce commit e8337c5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
20 changes: 15 additions & 5 deletions osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public override void Draw(IRenderer renderer)
if (time - part.Time >= 1)
continue;

vertexBatch.Add(new TexturedTrailVertex
vertexBatch.Add(new TexturedTrailVertex(renderer)
{
Position = new Vector2(part.Position.X - size.X * originPosition.X, part.Position.Y + size.Y * (1 - originPosition.Y)),
TexturePosition = textureRect.BottomLeft,
Expand All @@ -295,7 +295,7 @@ public override void Draw(IRenderer renderer)
Time = part.Time
});

vertexBatch.Add(new TexturedTrailVertex
vertexBatch.Add(new TexturedTrailVertex(renderer)
{
Position = new Vector2(part.Position.X + size.X * (1 - originPosition.X), part.Position.Y + size.Y * (1 - originPosition.Y)),
TexturePosition = textureRect.BottomRight,
Expand All @@ -304,7 +304,7 @@ public override void Draw(IRenderer renderer)
Time = part.Time
});

vertexBatch.Add(new TexturedTrailVertex
vertexBatch.Add(new TexturedTrailVertex(renderer)
{
Position = new Vector2(part.Position.X + size.X * (1 - originPosition.X), part.Position.Y - size.Y * originPosition.Y),
TexturePosition = textureRect.TopRight,
Expand All @@ -313,7 +313,7 @@ public override void Draw(IRenderer renderer)
Time = part.Time
});

vertexBatch.Add(new TexturedTrailVertex
vertexBatch.Add(new TexturedTrailVertex(renderer)
{
Position = new Vector2(part.Position.X - size.X * originPosition.X, part.Position.Y - size.Y * originPosition.Y),
TexturePosition = textureRect.TopLeft,
Expand Down Expand Up @@ -362,12 +362,22 @@ public struct TexturedTrailVertex : IEquatable<TexturedTrailVertex>, IVertex
[VertexMember(1, VertexAttribPointerType.Float)]
public float Time;

[VertexMember(1, VertexAttribPointerType.Int)]
private readonly int maskingIndex;

public TexturedTrailVertex(IRenderer renderer)
{
this = default;
maskingIndex = renderer.CurrentMaskingIndex;
}

public bool Equals(TexturedTrailVertex other)
{
return Position.Equals(other.Position)
&& TexturePosition.Equals(other.TexturePosition)
&& Colour.Equals(other.Colour)
&& Time.Equals(other.Time);
&& Time.Equals(other.Time)
&& maskingIndex == other.maskingIndex;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tests/Resources/Shaders/sh_TestVertex.vs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ layout(location = 4) out mediump vec2 v_BlendRange;
void main(void)
{
// Transform from screen space to masking space.
highp vec3 maskingPos = g_ToMaskingSpace * vec3(m_Position, 1.0);
highp vec3 maskingPos = g_MaskingInfo.ToMaskingSpace * vec3(m_Position, 1.0);
v_MaskingPosition = maskingPos.xy / maskingPos.z;

v_Colour = m_Colour;
Expand Down
5 changes: 1 addition & 4 deletions osu.Game/Screens/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,9 @@ public partial class ShaderPrecompiler : Drawable
private void load(ShaderManager manager)
{
loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE));
loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.BLUR));

loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_2_NO_MASKING, FragmentShaderDescriptor.BLUR));
loadTargets.Add(manager.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE));

loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_2, "TriangleBorder"));

loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_3, FragmentShaderDescriptor.TEXTURE));
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game/osu.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="11.1.2" />
<PackageReference Include="ppy.osu.Framework" Version="2023.817.0" />
<PackageReference Include="ppy.osu.Framework" Version="2023.822.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.719.0" />
<PackageReference Include="Sentry" Version="3.28.1" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
Expand Down

0 comments on commit e8337c5

Please sign in to comment.