-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: WebFreak001 <[email protected]>
- Loading branch information
1 parent
c7a32d6
commit f20da1b
Showing
2 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Runtime.InteropServices; | ||
using osu.Framework.Graphics.Rendering; | ||
using osu.Framework.Graphics.Shaders.Types; | ||
using osuTK; | ||
|
||
namespace osu.Framework.Graphics.Shaders; | ||
|
@@ -12,9 +14,21 @@ public class PixelShader : InternalShader, IHasTextureSize, IHasInflationPercent | |
|
||
public Vector2 Size { get; set; } = new(5); | ||
|
||
private IUniformBuffer<PixelParameters>? pixelParametersBuffer; | ||
|
||
public override void ApplyValue(IRenderer renderer) | ||
{ | ||
var size = Size; | ||
GetUniform<Vector2>(@"g_Size").UpdateValue(ref size); | ||
pixelParametersBuffer ??= renderer.CreateUniformBuffer<PixelParameters>(); | ||
|
||
pixelParametersBuffer.Data = new PixelParameters { Size = Size }; | ||
|
||
BindUniformBlock("m_PixelParameters", pixelParametersBuffer); | ||
} | ||
|
||
[StructLayout(LayoutKind.Sequential, Pack = 1)] | ||
private record struct PixelParameters | ||
{ | ||
public UniformVector2 Size; | ||
private readonly UniformPadding8 pad1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters