Skip to content

Commit

Permalink
Merge pull request #6295 from smoogipoo/update-veldrid
Browse files Browse the repository at this point in the history
Update Veldrid
  • Loading branch information
peppy authored May 22, 2024
2 parents f8e09f1 + bc2cd1a commit 15ed11e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void EnsureCreated()
(uint)resourceSize.Y,
1,
1,
PixelFormat.R8_G8_B8_A8_UNorm,
PixelFormat.R8G8B8A8UNorm,
TextureUsage.Sampled | TextureUsage.RenderTarget)),
deferredFrameBuffer.renderer.Factory.CreateSampler(
new SamplerDescription(
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Veldrid/Buffers/VeldridFrameBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Vector2 Size
}
}

public VeldridFrameBuffer(VeldridRenderer renderer, PixelFormat[]? formats = null, SamplerFilter filteringMode = SamplerFilter.MinLinear_MagLinear_MipLinear)
public VeldridFrameBuffer(VeldridRenderer renderer, PixelFormat[]? formats = null, SamplerFilter filteringMode = SamplerFilter.MinLinearMagLinearMipLinear)
{
// todo: we probably want the arguments separated to "PixelFormat[] colorFormats, PixelFormat depthFormat".
if (formats?.Length > 1)
Expand Down Expand Up @@ -147,7 +147,7 @@ private class FrameBufferTexture : VeldridTexture
{
protected override TextureUsage Usages => base.Usages | TextureUsage.RenderTarget;

public FrameBufferTexture(VeldridRenderer renderer, SamplerFilter filteringMode = SamplerFilter.MinLinear_MagLinear_MipLinear)
public FrameBufferTexture(VeldridRenderer renderer, SamplerFilter filteringMode = SamplerFilter.MinLinearMagLinearMipLinear)
: base(renderer, 1, 1, true, filteringMode)
{
BypassTextureUploadQueueing = true;
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Veldrid/Pipelines/GraphicsPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ internal class GraphicsPipeline : BasicPipeline

private GraphicsPipelineDescription pipelineDesc = new GraphicsPipelineDescription
{
RasterizerState = RasterizerStateDescription.CullNone,
BlendState = BlendStateDescription.SingleOverrideBlend,
RasterizerState = RasterizerStateDescription.CULL_NONE,
BlendState = BlendStateDescription.SINGLE_OVERRIDE_BLEND,
ShaderSet = { VertexLayouts = new VertexLayoutDescription[1] }
};

Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Veldrid/Textures/VeldridTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected virtual TextureUsage Usages
/// <param name="manualMipmaps">Whether manual mipmaps will be uploaded to the texture. If false, the texture will compute mipmaps automatically.</param>
/// <param name="filteringMode">The filtering mode.</param>
/// <param name="initialisationColour">The colour to initialise texture levels with (in the case of sub region initial uploads). If null, no initialisation is provided out-of-the-box.</param>
public VeldridTexture(IVeldridRenderer renderer, int width, int height, bool manualMipmaps = false, SamplerFilter filteringMode = SamplerFilter.MinLinear_MagLinear_MipLinear,
public VeldridTexture(IVeldridRenderer renderer, int width, int height, bool manualMipmaps = false, SamplerFilter filteringMode = SamplerFilter.MinLinearMagLinearMipLinear,
Color4? initialisationColour = null)
{
this.manualMipmaps = manualMipmaps;
Expand Down Expand Up @@ -458,7 +458,7 @@ protected virtual void DoUpload(ITextureUpload upload)
{
texture?.Dispose();

var textureDescription = TextureDescription.Texture2D((uint)Width, (uint)Height, (uint)CalculateMipmapLevels(Width, Height), 1, PixelFormat.R8_G8_B8_A8_UNorm, Usages);
var textureDescription = TextureDescription.Texture2D((uint)Width, (uint)Height, (uint)CalculateMipmapLevels(Width, Height), 1, PixelFormat.R8G8B8A8UNorm, Usages);
texture = Renderer.Factory.CreateTexture(ref textureDescription);

// todo: we may want to look into not having to allocate chunks of zero byte region for initialising textures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ protected override void DoUpload(ITextureUpload upload)

resourceList[i] = new VeldridTextureResources
(
Renderer.Factory.CreateTexture(TextureDescription.Texture2D((uint)width, (uint)height, 1, 1, PixelFormat.R8_UNorm, Usages)),
Renderer.Factory.CreateTexture(TextureDescription.Texture2D((uint)width, (uint)height, 1, 1, PixelFormat.R8UNorm, Usages)),
Renderer.Factory.CreateSampler(new SamplerDescription
{
AddressModeU = SamplerAddressMode.Clamp,
AddressModeV = SamplerAddressMode.Clamp,
AddressModeW = SamplerAddressMode.Clamp,
Filter = SamplerFilter.MinLinear_MagLinear_MipLinear,
Filter = SamplerFilter.MinLinearMagLinearMipLinear,
MinimumLod = 0,
MaximumLod = IRenderer.MAX_MIPMAP_LEVELS,
MaximumAnisotropy = 0,
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Veldrid/VeldridDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using SixLabors.ImageSharp.Processing;
using Veldrid;
using Veldrid.OpenGL;
using Veldrid.OpenGLBinding;
using Veldrid.OpenGLBindings;

namespace osu.Framework.Graphics.Veldrid
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public VeldridDevice(IGraphicsSurface graphicsSurface)
var options = new GraphicsDeviceOptions
{
HasMainSwapchain = true,
SwapchainDepthFormat = PixelFormat.R16_UNorm,
SwapchainDepthFormat = PixelFormat.R16UNorm,
SyncToVerticalBlank = true,
ResourceBindingModel = ResourceBindingModel.Improved,
};
Expand Down
16 changes: 7 additions & 9 deletions osu.Framework/Graphics/Veldrid/VeldridExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
using SharpGen.Runtime;
using Veldrid;
using Veldrid.MetalBindings;
using Veldrid.OpenGLBinding;
using Veldrid.OpenGLBindings;
using Vortice.Direct3D11;
using Vortice.DXGI;
using Vulkan;
using GetPName = Veldrid.OpenGLBinding.GetPName;
using GraphicsBackend = Veldrid.GraphicsBackend;
using PrimitiveTopology = Veldrid.PrimitiveTopology;
using StencilOperation = Veldrid.StencilOperation;
using StringName = Veldrid.OpenGLBinding.StringName;
using VertexAttribPointerType = osuTK.Graphics.ES30.VertexAttribPointerType;

namespace osu.Framework.Graphics.Veldrid
Expand Down Expand Up @@ -125,19 +123,19 @@ public static PixelFormat[] ToPixelFormats(this RenderBufferFormat[] renderBuffe
switch (renderBufferFormats[i])
{
case RenderBufferFormat.D16:
pixelFormats[i] = PixelFormat.R16_UNorm;
pixelFormats[i] = PixelFormat.R16UNorm;
break;

case RenderBufferFormat.D32:
pixelFormats[i] = PixelFormat.R32_Float;
pixelFormats[i] = PixelFormat.R32Float;
break;

case RenderBufferFormat.D24S8:
pixelFormats[i] = PixelFormat.D24_UNorm_S8_UInt;
pixelFormats[i] = PixelFormat.D24UNormS8UInt;
break;

case RenderBufferFormat.D32S8:
pixelFormats[i] = PixelFormat.D32_Float_S8_UInt;
pixelFormats[i] = PixelFormat.D32FloatS8UInt;
break;

default:
Expand All @@ -153,10 +151,10 @@ public static SamplerFilter ToSamplerFilter(this TextureFilteringMode mode)
switch (mode)
{
case TextureFilteringMode.Linear:
return SamplerFilter.MinLinear_MagLinear_MipLinear;
return SamplerFilter.MinLinearMagLinearMipLinear;

case TextureFilteringMode.Nearest:
return SamplerFilter.MinPoint_MagPoint_MipPoint;
return SamplerFilter.MinPointMagPointMipPoint;

default:
throw new ArgumentOutOfRangeException(nameof(mode));
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework/osu.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="ppy.ManagedBass.Fx" Version="2022.1216.0" />
<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.11-ged7d28974e" />
<PackageReference Include="ppy.Veldrid" Version="4.9.58-gfe61932a71" />
<PackageReference Include="ppy.Veldrid.SPIRV" Version="1.0.15-gca6cec7843" />
<PackageReference Include="SharpFNT" Version="2.0.0" />
<!-- Preview version of ImageSharp causes NU5104. -->
Expand Down

0 comments on commit 15ed11e

Please sign in to comment.