Format style

This commit is contained in:
Gabriel A 2023-10-27 21:33:25 -03:00
parent 419d61ef23
commit 29f3df5bd8
14 changed files with 23 additions and 27 deletions

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
{
struct RegisterBindlessSamplerCommand : IGALCommand, IGALCommand<RegisterBindlessSamplerCommand>
{
public CommandType CommandType => CommandType.RegisterBindlessSampler;
public readonly CommandType CommandType => CommandType.RegisterBindlessSampler;
private int _samplerId;
private TableRef<ISampler> _sampler;

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
{
struct RegisterBindlessTextureAndSamplerCommand : IGALCommand, IGALCommand<RegisterBindlessTextureAndSamplerCommand>
{
public CommandType CommandType => CommandType.RegisterBindlessTextureAndSampler;
public readonly CommandType CommandType => CommandType.RegisterBindlessTextureAndSampler;
private int _textureId;
private int _samplerId;
private TableRef<ITexture> _texture;

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
{
struct RegisterBindlessTextureCommand : IGALCommand, IGALCommand<RegisterBindlessTextureCommand>
{
public CommandType CommandType => CommandType.RegisterBindlessTexture;
public readonly CommandType CommandType => CommandType.RegisterBindlessTexture;
private int _textureId;
private TableRef<ITexture> _texture;
private float _textureScale;

View file

@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Unpacks the font filter width.
/// </summary>
/// <returns>Font filter width</returns>
public int UnpackFontFilterWidth()
public readonly int UnpackFontFilterWidth()
{
return (int)(Word0 >> 14) & 7;
}
@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Unpacks the font filter height.
/// </summary>
/// <returns>Font filter height</returns>
public int UnpackFontFilterHeight()
public readonly int UnpackFontFilterHeight()
{
return (int)(Word0 >> 17) & 7;
}

View file

@ -813,7 +813,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// Ensure that the buffer texture is using the correct buffer as storage.
// Buffers are frequently re-created to accomodate larger data, so we need to re-bind
// to ensure we're not using a old buffer that was already deleted.
TextureBindingInfo bindingInfo = new TextureBindingInfo(texture.Target, texture.Format, 0, 0, 0, TextureUsageFlags.None);
TextureBindingInfo bindingInfo = new(texture.Target, texture.Format, 0, 0, 0, TextureUsageFlags.None);
ulong address = texture.Range.GetSubRange(0).Address;
ulong size = texture.Size;
_channel.BufferManager.SetBufferTextureStorage(texture.HostTexture, address, size, bindingInfo, texture.Format, false, textureId);

View file

@ -275,7 +275,7 @@ namespace Ryujinx.Graphics.Gpu.Image
return null;
}
TextureInfo info = GetInfo(descriptor, out int layerSize);
TextureInfo info = GetInfo(descriptor, out _);
TextureValidationResult validationResult = TextureValidation.Validate(ref info);
if (validationResult != TextureValidationResult.Valid)

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.OpenGL
{
static class HwCapabilities
{
private static readonly Lazy<bool> _supportsArbBindlessTexture = new Lazy<bool>(() => HasExtension("GL_ARB_bindless_texture"));
private static readonly Lazy<bool> _supportsArbBindlessTexture = new(() => HasExtension("GL_ARB_bindless_texture"));
private static readonly Lazy<bool> _supportsAlphaToCoverageDitherControl = new(() => HasExtension("GL_NV_alpha_to_coverage_dither_control"));
private static readonly Lazy<bool> _supportsAstcCompression = new(() => HasExtension("GL_KHR_texture_compression_astc_ldr"));
private static readonly Lazy<bool> _supportsBlendEquationAdvanced = new(() => HasExtension("GL_NV_blend_equation_advanced"));
@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.OpenGL
private static readonly Lazy<bool> _supportsGeometryShaderPassthrough = new(() => HasExtension("GL_NV_geometry_shader_passthrough"));
private static readonly Lazy<bool> _supportsImageLoadFormatted = new(() => HasExtension("GL_EXT_shader_image_load_formatted"));
private static readonly Lazy<bool> _supportsIndirectParameters = new(() => HasExtension("GL_ARB_indirect_parameters"));
private static readonly Lazy<bool> _supportsNvBindlessTexture = new Lazy<bool>(() => HasExtension("GL_NV_bindless_texture"));
private static readonly Lazy<bool> _supportsNvBindlessTexture = new(() => HasExtension("GL_NV_bindless_texture"));
private static readonly Lazy<bool> _supportsParallelShaderCompile = new(() => HasExtension("GL_ARB_parallel_shader_compile"));
private static readonly Lazy<bool> _supportsPolygonOffsetClamp = new(() => HasExtension("GL_EXT_polygon_offset_clamp"));
private static readonly Lazy<bool> _supportsQuads = new(SupportsQuadsCheck);

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
private readonly Dictionary<int, (ITexture, float)> _separateTextures;
private readonly Dictionary<int, ISampler> _separateSamplers;
private readonly HashSet<long> _handles = new HashSet<long>();
private readonly HashSet<long> _handles = new();
public BindlessManager(OpenGLRenderer renderer)
{
@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
if (hasDeletedSamplers)
{
List<int> toRemove = new List<int>();
List<int> toRemove = new();
foreach ((int samplerId, ISampler sampler) in _separateSamplers)
{

View file

@ -1262,7 +1262,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
}
SpvInstruction pCoords = AssemblePVector(pCount);
SpvInstruction bindlessIndex = isBindless ? GenerateBindlessTextureHandleToIndex(context, bindlessHandle) : null;
_ = isBindless ? GenerateBindlessTextureHandleToIndex(context, bindlessHandle) : null;
SpvInstruction AssembleDerivativesVector(int count)
{

View file

@ -497,7 +497,7 @@ namespace Ryujinx.Graphics.Shader.Translation
}
}
private Operand GetBindlessScale(EmitterContext context, Operand nvHandle)
private static Operand GetBindlessScale(EmitterContext context, Operand nvHandle)
{
int bindlessTableBinding = SetBindingPair.Pack(Constants.BindlessTextureSetIndex, Constants.BindlessTableBinding);
int bindlessScalesBinding = SetBindingPair.Pack(Constants.BindlessTextureSetIndex, Constants.BindlessScalesBinding);

View file

@ -870,7 +870,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
// Try to detect a indexed access.
// The access is considered indexed if the handle is loaded with a LDC instruction
// from the driver reserved constant buffer used for texture handles.
if (!(texOp.GetSource(0).AsgOp is Operation handleAsgOp))
if (texOp.GetSource(0).AsgOp is not Operation handleAsgOp)
{
return false;
}

View file

@ -2,8 +2,8 @@ using Ryujinx.Common;
using Ryujinx.Graphics.GAL;
using Silk.NET.Vulkan;
using System;
using System.Numerics;
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Vulkan
@ -187,10 +187,7 @@ namespace Ryujinx.Graphics.Vulkan
int idMapBufferSizeInBytes = _idMap.Length * sizeof(int);
if (_idMapBuffer == null)
{
_idMapBuffer = gd.BufferManager.Create(gd, idMapBufferSizeInBytes);
}
_idMapBuffer ??= gd.BufferManager.Create(gd, idMapBufferSizeInBytes);
if (_idMapDataDirty)
{
@ -324,7 +321,7 @@ namespace Ryujinx.Graphics.Vulkan
}
}
private void Bind(
private static void Bind(
VulkanRenderer gd,
ShaderCollection program,
CommandBufferScoped cbs,

View file

@ -2,7 +2,7 @@ using System;
namespace Ryujinx.Graphics.Vulkan
{
struct PipelineLayoutUsageInfo : IEquatable<PipelineLayoutUsageInfo>
readonly struct PipelineLayoutUsageInfo : IEquatable<PipelineLayoutUsageInfo>
{
public readonly uint BindlessTexturesCount;
public readonly uint BindlessSamplersCount;
@ -20,14 +20,14 @@ namespace Ryujinx.Graphics.Vulkan
return obj is PipelineLayoutUsageInfo other && Equals(other);
}
public bool Equals(PipelineLayoutUsageInfo other)
public readonly bool Equals(PipelineLayoutUsageInfo other)
{
return BindlessTexturesCount == other.BindlessTexturesCount &&
BindlessSamplersCount == other.BindlessSamplersCount &&
UsePushDescriptors == other.UsePushDescriptors;
}
public override int GetHashCode()
public override readonly int GetHashCode()
{
return HashCode.Combine(BindlessTexturesCount, BindlessSamplersCount, UsePushDescriptors);
}

View file

@ -312,14 +312,12 @@ namespace Ryujinx.Graphics.Vulkan
}
public uint BindlessTexturesCount
{
get => (uint)((Internal.Id10 >> 0) & 0xFFFFFFFF);
{ readonly get => (uint)((Internal.Id10 >> 0) & 0xFFFFFFFF);
set => Internal.Id10 = (Internal.Id10 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
}
public uint BindlessSamplersCount
{
get => (uint)((Internal.Id10 >> 32) & 0xFFFFFFFF);
{ readonly get => (uint)((Internal.Id10 >> 32) & 0xFFFFFFFF);
set => Internal.Id10 = (Internal.Id10 & 0xFFFFFFFF) | ((ulong)value << 32);
}