mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 01:57:11 +02:00
parent
417df486b1
commit
361d0c5632
622 changed files with 3080 additions and 2652 deletions
|
@ -85,8 +85,8 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
{
|
||||
_state.WriteWithRedundancyCheck(offset, value, out changed);
|
||||
}
|
||||
else if (shadowRamControl == SetMmeShadowRamControlMode.MethodTrack ||
|
||||
shadowRamControl == SetMmeShadowRamControlMode.MethodTrackWithFilter)
|
||||
else if (shadowRamControl is SetMmeShadowRamControlMode.MethodTrack or
|
||||
SetMmeShadowRamControlMode.MethodTrackWithFilter)
|
||||
{
|
||||
_shadowState.Write(offset, value);
|
||||
_state.WriteWithRedundancyCheck(offset, value, out changed);
|
||||
|
|
|
@ -290,6 +290,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
|||
_ilGen.Emit(OpCodes.Shl);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AluOperation.ReadImmediate:
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
{
|
||||
public static bool IsTrack(this SetMmeShadowRamControlMode mode)
|
||||
{
|
||||
return mode == SetMmeShadowRamControlMode.MethodTrack || mode == SetMmeShadowRamControlMode.MethodTrackWithFilter;
|
||||
return mode is SetMmeShadowRamControlMode.MethodTrack or SetMmeShadowRamControlMode.MethodTrackWithFilter;
|
||||
}
|
||||
|
||||
public static bool IsPassthrough(this SetMmeShadowRamControlMode mode)
|
||||
|
|
|
@ -285,6 +285,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
{
|
||||
data[index] = index;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.LineLoop:
|
||||
data[^1] = 0;
|
||||
|
@ -294,6 +295,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[index] = index >> 1;
|
||||
data[index + 1] = (index >> 1) + 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.LineStrip:
|
||||
for (int index = 0; index < ((data.Length - 1) & ~1); index += 2)
|
||||
|
@ -301,6 +303,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[index] = index >> 1;
|
||||
data[index + 1] = (index >> 1) + 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.TriangleStrip:
|
||||
int tsTrianglesCount = data.Length / 3;
|
||||
|
@ -330,6 +333,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[baseIndex + 2] = tsOutIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.TriangleFan:
|
||||
case PrimitiveTopology.Polygon:
|
||||
|
@ -342,6 +346,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[index + 1] = tfOutIndex;
|
||||
data[index + 2] = ++tfOutIndex;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.Quads:
|
||||
int qQuadsCount = data.Length / 6;
|
||||
|
@ -358,6 +363,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[index + 4] = qIndex + 2;
|
||||
data[index + 5] = qIndex + 3;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.QuadStrip:
|
||||
int qsQuadsCount = data.Length / 6;
|
||||
|
@ -384,6 +390,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[index + 4] = qIndex + 2;
|
||||
data[index + 5] = qIndex + 3;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.LineStripAdjacency:
|
||||
for (int index = 0; index < ((data.Length - 3) & ~3); index += 4)
|
||||
|
@ -395,6 +402,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[index + 2] = lIndex + 2;
|
||||
data[index + 3] = lIndex + 3;
|
||||
}
|
||||
|
||||
break;
|
||||
case PrimitiveTopology.TriangleStripAdjacency:
|
||||
int tsaTrianglesCount = data.Length / 6;
|
||||
|
@ -433,6 +441,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
data[baseIndex + 5] = tsaOutIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,8 +170,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
int vbStride = vertexBuffer.UnpackStride();
|
||||
ulong vbSize = GetVertexBufferSize(address, endAddress.Pack(), vbStride, _indexed, instanced, _firstVertex, _count);
|
||||
|
||||
ulong oldVbSize = vbSize;
|
||||
|
||||
ulong attributeOffset = (ulong)vertexAttrib.UnpackOffset();
|
||||
int componentSize = format.GetScalarSize();
|
||||
|
||||
|
@ -477,7 +475,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
|
|||
private readonly ulong GetVertexBufferSize(ulong vbAddress, ulong vbEndAddress, int vbStride, bool indexed, bool instanced, int firstVertex, int vertexCount)
|
||||
{
|
||||
IndexType indexType = _state.State.IndexBufferState.Type;
|
||||
bool indexTypeSmall = indexType == IndexType.UByte || indexType == IndexType.UShort;
|
||||
bool indexTypeSmall = indexType is IndexType.UByte or IndexType.UShort;
|
||||
ulong vbSize = vbEndAddress - vbAddress + 1;
|
||||
ulong size;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
/// <summary>
|
||||
/// Indirect draw type, which can be indexed or non-indexed, with or without a draw count.
|
||||
/// </summary>
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
enum IndirectDrawType
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -253,9 +253,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
{
|
||||
value |= AttributeType.Packed;
|
||||
|
||||
if (type == VertexAttribType.Snorm ||
|
||||
type == VertexAttribType.Sint ||
|
||||
type == VertexAttribType.Sscaled)
|
||||
if (type is VertexAttribType.Snorm or
|
||||
VertexAttribType.Sint or
|
||||
VertexAttribType.Sscaled)
|
||||
{
|
||||
value |= AttributeType.PackedRgb10A2Signed;
|
||||
}
|
||||
|
|
|
@ -1104,7 +1104,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
private void UpdateVertexBufferState()
|
||||
{
|
||||
IndexType indexType = _state.State.IndexBufferState.Type;
|
||||
bool indexTypeSmall = indexType == IndexType.UByte || indexType == IndexType.UShort;
|
||||
bool indexTypeSmall = indexType is IndexType.UByte or IndexType.UShort;
|
||||
|
||||
_drawState.IsAnyVbInstanced = false;
|
||||
|
||||
|
|
|
@ -91,13 +91,13 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// Support buffer updater.
|
||||
/// </summary>
|
||||
internal SupportBufferUpdater SupportBufferUpdater { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enabled dirty hacks.
|
||||
/// Used for workarounds to emulator bugs we can't fix/don't know how to fix yet.
|
||||
/// </summary>
|
||||
internal DirtyHacks DirtyHacks { get; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Host hardware capabilities.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
namespace Ryujinx.Graphics.Gpu
|
||||
{
|
||||
#pragma warning disable CA2211 // Non-constant fields should not be visible
|
||||
/// <summary>
|
||||
/// General GPU and graphics configuration.
|
||||
/// </summary>
|
||||
|
@ -9,25 +8,25 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// <summary>
|
||||
/// Resolution scale.
|
||||
/// </summary>
|
||||
public static float ResScale = 1f;
|
||||
public static float ResScale { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
|
||||
/// </summary>
|
||||
public static float MaxAnisotropy = -1;
|
||||
public static float MaxAnisotropy { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Base directory used to write shader code dumps.
|
||||
/// Set to null to disable code dumping.
|
||||
/// </summary>
|
||||
public static string ShadersDumpPath;
|
||||
public static string ShadersDumpPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fast GPU time calculates the internal GPU time ticks as if the GPU was capable of
|
||||
/// processing commands almost instantly, instead of using the host timer.
|
||||
/// This can avoid lower resolution on some games when GPU performance is poor.
|
||||
/// </summary>
|
||||
public static bool FastGpuTime = true;
|
||||
public static bool FastGpuTime { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables fast 2d engine texture copies entirely on CPU when possible.
|
||||
|
@ -35,43 +34,42 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// as textures will not need to be created for the copy, and the data does not need to be
|
||||
/// flushed from GPU.
|
||||
/// </summary>
|
||||
public static bool Fast2DCopy = true;
|
||||
public static bool Fast2DCopy { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the Just-in-Time compiler for GPU Macro code.
|
||||
/// </summary>
|
||||
public static bool EnableMacroJit = true;
|
||||
public static bool EnableMacroJit { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables high-level emulation of common GPU Macro code.
|
||||
/// </summary>
|
||||
public static bool EnableMacroHLE = true;
|
||||
|
||||
public static bool EnableMacroHLE { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Title id of the current running game.
|
||||
/// Used by the shader cache.
|
||||
/// </summary>
|
||||
public static string TitleId;
|
||||
public static string TitleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the shader cache.
|
||||
/// </summary>
|
||||
public static bool EnableShaderCache;
|
||||
public static bool EnableShaderCache { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables shader SPIR-V compilation.
|
||||
/// </summary>
|
||||
public static bool EnableSpirvCompilationOnVulkan = true;
|
||||
public static bool EnableSpirvCompilationOnVulkan { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables recompression of compressed textures that are not natively supported by the host.
|
||||
/// </summary>
|
||||
public static bool EnableTextureRecompression = false;
|
||||
public static bool EnableTextureRecompression { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables color space passthrough, if available.
|
||||
/// </summary>
|
||||
public static bool EnableColorSpacePassthrough = false;
|
||||
public static bool EnableColorSpacePassthrough { get; set; } = false;
|
||||
}
|
||||
#pragma warning restore CA2211
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
private const ulong TextureSizeCapacity8GiB = 6 * GiB;
|
||||
private const ulong TextureSizeCapacity12GiB = 12 * GiB;
|
||||
|
||||
|
||||
private const float MemoryScaleFactor = 0.50f;
|
||||
private ulong _maxCacheMemoryUsage = DefaultTextureSizeCapacity;
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
static class FormatTable
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
private enum TextureFormat : uint
|
||||
{
|
||||
// Formats
|
||||
|
@ -249,7 +248,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
A5B5G5R1Unorm = A5B5G5R1 | RUnorm | GUnorm | BUnorm | AUnorm, // 0x24913
|
||||
}
|
||||
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
private enum VertexAttributeFormat : uint
|
||||
{
|
||||
// Width
|
||||
|
|
|
@ -248,6 +248,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
|
||||
Items = null;
|
||||
}
|
||||
|
||||
_memoryTracking.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,6 +175,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
case SamplerMinFilter.Linear:
|
||||
return MinFilter.Linear;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SamplerMipFilter.Nearest:
|
||||
|
@ -185,6 +186,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
case SamplerMinFilter.Linear:
|
||||
return MinFilter.LinearMipmapNearest;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SamplerMipFilter.Linear:
|
||||
|
@ -195,6 +197,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
case SamplerMinFilter.Linear:
|
||||
return MinFilter.LinearMipmapLinear;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1355,7 +1355,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
/// <returns>True if anisotropic filtering can be forced, false otherwise</returns>
|
||||
private bool CanTextureForceAnisotropy()
|
||||
{
|
||||
if (!(Target == Target.Texture2D || Target == Target.Texture2DArray))
|
||||
if (Target is not (Target.Texture2D or Target.Texture2DArray))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1379,16 +1379,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
{
|
||||
case Target.Texture1D:
|
||||
case Target.Texture1DArray:
|
||||
return target == Target.Texture1D || target == Target.Texture1DArray;
|
||||
return target is Target.Texture1D or Target.Texture1DArray;
|
||||
case Target.Texture2D:
|
||||
case Target.Texture2DArray:
|
||||
return target == Target.Texture2D || target == Target.Texture2DArray;
|
||||
return target is Target.Texture2D or Target.Texture2DArray;
|
||||
case Target.Cubemap:
|
||||
case Target.CubemapArray:
|
||||
return target == Target.Cubemap || target == Target.CubemapArray;
|
||||
return target is Target.Cubemap or Target.CubemapArray;
|
||||
case Target.Texture2DMultisample:
|
||||
case Target.Texture2DMultisampleArray:
|
||||
return target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray;
|
||||
return target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray;
|
||||
case Target.Texture3D:
|
||||
return target == Target.Texture3D;
|
||||
default:
|
||||
|
|
|
@ -784,8 +784,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
samplerHandle = samplerWordOffset;
|
||||
}
|
||||
|
||||
if (handleType == TextureHandleType.SeparateSamplerId ||
|
||||
handleType == TextureHandleType.SeparateConstantSamplerHandle)
|
||||
if (handleType is TextureHandleType.SeparateSamplerId or
|
||||
TextureHandleType.SeparateConstantSamplerHandle)
|
||||
{
|
||||
samplerHandle <<= 20;
|
||||
}
|
||||
|
|
|
@ -207,8 +207,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
return false; // Flushing this format is not supported, as it may have been converted to another host format.
|
||||
}
|
||||
|
||||
if (info.Target == Target.Texture2DMultisample ||
|
||||
info.Target == Target.Texture2DMultisampleArray)
|
||||
if (info.Target is Target.Texture2DMultisample or
|
||||
Target.Texture2DMultisampleArray)
|
||||
{
|
||||
return false; // Flushing multisample textures is not supported, the host does not allow getting their data.
|
||||
}
|
||||
|
@ -758,43 +758,45 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
{
|
||||
case Target.Texture1D:
|
||||
case Target.Texture1DArray:
|
||||
result = rhs.Target == Target.Texture1D ||
|
||||
rhs.Target == Target.Texture1DArray;
|
||||
result = rhs.Target is Target.Texture1D or
|
||||
Target.Texture1DArray;
|
||||
break;
|
||||
|
||||
case Target.Texture2D:
|
||||
result = rhs.Target == Target.Texture2D ||
|
||||
rhs.Target == Target.Texture2DArray;
|
||||
result = rhs.Target is Target.Texture2D or
|
||||
Target.Texture2DArray;
|
||||
break;
|
||||
|
||||
case Target.Texture2DArray:
|
||||
result = rhs.Target == Target.Texture2D ||
|
||||
rhs.Target == Target.Texture2DArray;
|
||||
result = rhs.Target is Target.Texture2D or
|
||||
Target.Texture2DArray;
|
||||
|
||||
if (rhs.Target == Target.Cubemap || rhs.Target == Target.CubemapArray)
|
||||
if (rhs.Target is Target.Cubemap or Target.CubemapArray)
|
||||
{
|
||||
return caps.SupportsCubemapView ? TextureViewCompatibility.Full : TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
|
||||
break;
|
||||
case Target.Cubemap:
|
||||
case Target.CubemapArray:
|
||||
result = rhs.Target == Target.Cubemap ||
|
||||
rhs.Target == Target.CubemapArray;
|
||||
result = rhs.Target is Target.Cubemap or
|
||||
Target.CubemapArray;
|
||||
|
||||
if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray)
|
||||
if (rhs.Target is Target.Texture2D or Target.Texture2DArray)
|
||||
{
|
||||
return caps.SupportsCubemapView ? TextureViewCompatibility.Full : TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
|
||||
break;
|
||||
case Target.Texture2DMultisample:
|
||||
case Target.Texture2DMultisampleArray:
|
||||
if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray)
|
||||
if (rhs.Target is Target.Texture2D or Target.Texture2DArray)
|
||||
{
|
||||
return TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
|
||||
result = rhs.Target == Target.Texture2DMultisample ||
|
||||
rhs.Target == Target.Texture2DMultisampleArray;
|
||||
result = rhs.Target is Target.Texture2DMultisample or
|
||||
Target.Texture2DMultisampleArray;
|
||||
break;
|
||||
|
||||
case Target.Texture3D:
|
||||
|
|
|
@ -218,7 +218,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Flushes incompatible overlaps if the storage format requires it, and they have been modified.
|
||||
/// This allows unsupported host formats to accept data written to format aliased textures.
|
||||
|
@ -1133,7 +1132,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
SignalAllDirty();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes a view from the group, removing it from all overlap lists.
|
||||
/// </summary>
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
/// <returns>The number of texture layers</returns>
|
||||
public static int GetLayers(Target target, int depthOrLayers)
|
||||
{
|
||||
if (target == Target.Texture2DArray || target == Target.Texture2DMultisampleArray)
|
||||
if (target is Target.Texture2DArray or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
return depthOrLayers;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
/// <returns>The number of texture slices</returns>
|
||||
public int GetSlices()
|
||||
{
|
||||
if (Target == Target.Texture3D || Target == Target.Texture2DArray || Target == Target.Texture2DMultisampleArray)
|
||||
if (Target is Target.Texture3D or Target.Texture2DArray or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
return DepthOrLayers;
|
||||
}
|
||||
|
|
|
@ -454,6 +454,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
// If this is null, a request was already queued to decrement reference.
|
||||
texture.DecrementReferenceCount(this, request.ID);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -544,7 +545,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
int width = target == Target.TextureBuffer ? descriptor.UnpackBufferTextureWidth() : descriptor.UnpackWidth();
|
||||
int height = descriptor.UnpackHeight();
|
||||
|
||||
if (target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray)
|
||||
if (target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
// This is divided back before the backend texture is created.
|
||||
width *= samplesInX;
|
||||
|
@ -699,8 +700,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
{
|
||||
int maxSize = width;
|
||||
|
||||
if (target != Target.Texture1D &&
|
||||
target != Target.Texture1DArray)
|
||||
if (target is not Target.Texture1D and
|
||||
not Target.Texture1DArray)
|
||||
{
|
||||
maxSize = Math.Max(maxSize, height);
|
||||
}
|
||||
|
@ -761,8 +762,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
/// <returns>True if the swizzle component is equal to the red or green, false otherwise</returns>
|
||||
private static bool IsRG(SwizzleComponent component)
|
||||
{
|
||||
return component == SwizzleComponent.Red ||
|
||||
component == SwizzleComponent.Green;
|
||||
return component is SwizzleComponent.Red or
|
||||
SwizzleComponent.Green;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -705,7 +705,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
{
|
||||
BufferHandle handle = Handle;
|
||||
|
||||
return (ulong address, ulong size, ulong _) =>
|
||||
return (address, size, _) =>
|
||||
{
|
||||
FlushImpl(handle, address, size);
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
|
||||
// Backend managed is always auto, unified memory is always host.
|
||||
_desiredType = BufferBackingType.HostMemory;
|
||||
_canSwap = _systemMemoryType != SystemMemoryType.BackendManaged && _systemMemoryType != SystemMemoryType.UnifiedMemory;
|
||||
_canSwap = _systemMemoryType is not SystemMemoryType.BackendManaged and not SystemMemoryType.UnifiedMemory;
|
||||
|
||||
if (_canSwap)
|
||||
{
|
||||
|
|
|
@ -29,10 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
|
||||
StorageRead = 0x40,
|
||||
StorageWrite = 0x80,
|
||||
|
||||
#pragma warning disable CA1069 // Enums values should not be duplicated
|
||||
StorageAtomic = 0xc0
|
||||
#pragma warning restore CA1069 // Enums values should not be duplicated
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
BufferRange range = new(_handle, 0, data.Length);
|
||||
_renderer.Pipeline.SetUniformBuffers([new BufferAssignment(0, range)]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_renderer.SetBufferData(_handle, _startOffset, data[_startOffset.._endOffset]);
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
{
|
||||
_cpuMemory.GetSpan(currentRange.Address, size, tracked).CopyTo(data.Slice(offset, size));
|
||||
}
|
||||
|
||||
offset += size;
|
||||
}
|
||||
|
||||
|
@ -204,6 +205,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
{
|
||||
GetSpan(currentRange.Address, size).CopyTo(memorySpan.Slice(offset, size));
|
||||
}
|
||||
|
||||
offset += size;
|
||||
}
|
||||
|
||||
|
@ -339,6 +341,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
{
|
||||
writeCallback(currentRange.Address, data.Slice(offset, size));
|
||||
}
|
||||
|
||||
offset += size;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// <returns>True if pitch, false otherwise</returns>
|
||||
public static bool IsPitch(this PteKind kind)
|
||||
{
|
||||
return kind == PteKind.Pitch || kind == PteKind.PitchNoSwizzle;
|
||||
return kind is PteKind.Pitch or PteKind.PitchNoSwizzle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
{
|
||||
Logger.Error?.Print(LogClass.Gpu, $"Error writing shader to disk cache. {ioException.Message}");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
{
|
||||
offset += stream.Read(data[offset..]);
|
||||
}
|
||||
|
||||
stream.Dispose();
|
||||
break;
|
||||
case CompressionAlgorithm.Brotli:
|
||||
|
@ -211,6 +212,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
{
|
||||
offset += stream.Read(data[offset..]);
|
||||
}
|
||||
|
||||
stream.Dispose();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -379,8 +379,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
/// <param name="hash">Code and constant buffer data hash</param>
|
||||
/// <returns>Entry index</returns>
|
||||
private int WriteNewEntry(
|
||||
Stream tocFileStream,
|
||||
Stream dataFileStream,
|
||||
FileStream tocFileStream,
|
||||
FileStream dataFileStream,
|
||||
ref TocHeader header,
|
||||
ReadOnlySpan<byte> data,
|
||||
ReadOnlySpan<byte> cb1Data,
|
||||
|
|
|
@ -737,7 +737,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
/// <param name="magic">Magic value to be written</param>
|
||||
/// <param name="codegenVersion">Shader codegen version, only valid for the host file</param>
|
||||
/// <param name="timestamp">File creation timestamp</param>
|
||||
private static void CreateToc(Stream tocFileStream, ref TocHeader header, uint magic, uint codegenVersion, ulong timestamp)
|
||||
private static void CreateToc(FileStream tocFileStream, ref TocHeader header, uint magic, uint codegenVersion, ulong timestamp)
|
||||
{
|
||||
BinarySerializer writer = new(tocFileStream);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using Microsoft.IO;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
|
@ -12,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
{
|
||||
public static byte[] Pack(ShaderSource[] sources)
|
||||
{
|
||||
using MemoryStream output = MemoryStreamManager.Shared.GetStream();
|
||||
using RecyclableMemoryStream output = MemoryStreamManager.Shared.GetStream();
|
||||
|
||||
output.Write(sources.Length);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
};
|
||||
}
|
||||
|
||||
bool isQuad = Topology == PrimitiveTopology.Quads || Topology == PrimitiveTopology.QuadStrip;
|
||||
bool isQuad = Topology is PrimitiveTopology.Quads or PrimitiveTopology.QuadStrip;
|
||||
bool halvePrimitiveId = !hostSupportsQuads && !hasGeometryShader && isQuad;
|
||||
|
||||
return new GpuGraphicsState(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue