mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-01 02:41:33 +00:00
[Ryujinx.Graphics.Gpu] Address dotnet-format issues (#5367)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA1069 warnings * Address or silence dotnet format CA2211 warnings * Address remaining dotnet format analyzer warnings * Address review comments * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Another rebase, another dotnet format run * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Replace MmeShadowScratch with Array256<uint> * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Address IDE0251 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First pass of dotnet format * Add unsafe dotnet format changes * Fix typos * Add trailing commas * Disable formatting for FormatTable * Address review feedback
This commit is contained in:
parent
2457cfc911
commit
3b46bb73f7
@ -10,6 +10,6 @@ namespace Ryujinx.Graphics.Gpu
|
||||
Compute = 0xb1c0,
|
||||
InlineToMemory = 0xa140,
|
||||
Dma = 0xb0b5,
|
||||
GPFifo = 0xb06f
|
||||
GPFifo = 0xb06f,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,4 +90,4 @@ namespace Ryujinx.Graphics.Gpu
|
||||
/// </summary>
|
||||
public const ulong MaxUnknownStorageSize = 0x100000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
using Ryujinx.Graphics.Device;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Gpu.Engine.InlineToMemory;
|
||||
using Ryujinx.Graphics.Gpu.Engine.Threed;
|
||||
using Ryujinx.Graphics.Gpu.Engine.Types;
|
||||
using Ryujinx.Graphics.Gpu.Image;
|
||||
using Ryujinx.Graphics.Gpu.Shader;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using System;
|
||||
@ -39,7 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
{
|
||||
{ nameof(ComputeClassState.LaunchDma), new RwCallback(LaunchDma, null) },
|
||||
{ nameof(ComputeClassState.LoadInlineData), new RwCallback(LoadInlineData, null) },
|
||||
{ nameof(ComputeClassState.SendSignalingPcasB), new RwCallback(SendSignalingPcasB, null) }
|
||||
{ nameof(ComputeClassState.SendSignalingPcasB), new RwCallback(SendSignalingPcasB, null) },
|
||||
});
|
||||
|
||||
_i2mClass = new InlineToMemoryClass(context, channel, initializeState: false);
|
||||
@ -128,12 +126,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
ulong samplerPoolGpuVa = ((ulong)_state.State.SetTexSamplerPoolAOffsetUpper << 32) | _state.State.SetTexSamplerPoolB;
|
||||
ulong texturePoolGpuVa = ((ulong)_state.State.SetTexHeaderPoolAOffsetUpper << 32) | _state.State.SetTexHeaderPoolB;
|
||||
|
||||
GpuChannelPoolState poolState = new GpuChannelPoolState(
|
||||
GpuChannelPoolState poolState = new(
|
||||
texturePoolGpuVa,
|
||||
_state.State.SetTexHeaderPoolCMaximumIndex,
|
||||
_state.State.SetBindlessTextureConstantBufferSlotSelect);
|
||||
|
||||
GpuChannelComputeState computeState = new GpuChannelComputeState(
|
||||
GpuChannelComputeState computeState = new(
|
||||
qmd.CtaThreadDimension0,
|
||||
qmd.CtaThreadDimension1,
|
||||
qmd.CtaThreadDimension2,
|
||||
@ -189,8 +187,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
cs = memoryManager.Physical.ShaderCache.GetComputeShader(_channel, poolState, computeState, shaderGpuVa);
|
||||
|
||||
_context.Renderer.Pipeline.SetProgram(cs.HostProgram);
|
||||
|
||||
info = cs.Shaders[0].Info;
|
||||
}
|
||||
|
||||
_channel.BufferManager.SetComputeBufferBindings(cs.Bindings);
|
||||
|
@ -98,24 +98,24 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
/// </summary>
|
||||
unsafe struct ComputeClassState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint SetObject;
|
||||
public int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public fixed uint Reserved04[63];
|
||||
public uint NoOperation;
|
||||
public uint SetNotifyA;
|
||||
public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
|
||||
public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
|
||||
public uint SetNotifyB;
|
||||
public uint Notify;
|
||||
public NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public readonly NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public uint WaitForIdle;
|
||||
public fixed uint Reserved114[7];
|
||||
public uint SetGlobalRenderEnableA;
|
||||
public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public uint SetGlobalRenderEnableB;
|
||||
public uint SetGlobalRenderEnableC;
|
||||
public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public uint SendGoIdle;
|
||||
public uint PmTrigger;
|
||||
public uint PmTriggerWfi;
|
||||
@ -126,34 +126,34 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint LineLengthIn;
|
||||
public uint LineCount;
|
||||
public uint OffsetOutUpper;
|
||||
public int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
|
||||
public readonly int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
|
||||
public uint OffsetOut;
|
||||
public uint PitchOut;
|
||||
public uint SetDstBlockSize;
|
||||
public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public readonly SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public uint SetDstWidth;
|
||||
public uint SetDstHeight;
|
||||
public uint SetDstDepth;
|
||||
public uint SetDstLayer;
|
||||
public uint SetDstOriginBytesX;
|
||||
public int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
|
||||
public readonly int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
|
||||
public uint SetDstOriginSamplesY;
|
||||
public int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
|
||||
public readonly int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
|
||||
public uint LaunchDma;
|
||||
public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
|
||||
public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
|
||||
public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
|
||||
public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
|
||||
public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
|
||||
public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
|
||||
public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
|
||||
public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
|
||||
public readonly LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
|
||||
public readonly LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
|
||||
public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
|
||||
public readonly LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
|
||||
public readonly bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
|
||||
public readonly LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
|
||||
public readonly LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
|
||||
public readonly bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
|
||||
public uint LoadInlineData;
|
||||
public fixed uint Reserved1B8[9];
|
||||
public uint SetI2mSemaphoreA;
|
||||
public int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
|
||||
public readonly int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
|
||||
public uint SetI2mSemaphoreB;
|
||||
public uint SetI2mSemaphoreC;
|
||||
public fixed uint Reserved1E8[2];
|
||||
@ -162,20 +162,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint SetI2mSpareNoop02;
|
||||
public uint SetI2mSpareNoop03;
|
||||
public uint SetValidSpanOverflowAreaA;
|
||||
public int SetValidSpanOverflowAreaAAddressUpper => (int)(SetValidSpanOverflowAreaA & 0xFF);
|
||||
public readonly int SetValidSpanOverflowAreaAAddressUpper => (int)(SetValidSpanOverflowAreaA & 0xFF);
|
||||
public uint SetValidSpanOverflowAreaB;
|
||||
public uint SetValidSpanOverflowAreaC;
|
||||
public uint SetCoalesceWaitingPeriodUnit;
|
||||
public uint PerfmonTransfer;
|
||||
public uint SetShaderSharedMemoryWindow;
|
||||
public uint SetSelectMaxwellTextureHeaders;
|
||||
public bool SetSelectMaxwellTextureHeadersV => (SetSelectMaxwellTextureHeaders & 0x1) != 0;
|
||||
public readonly bool SetSelectMaxwellTextureHeadersV => (SetSelectMaxwellTextureHeaders & 0x1) != 0;
|
||||
public uint InvalidateShaderCaches;
|
||||
public bool InvalidateShaderCachesInstruction => (InvalidateShaderCaches & 0x1) != 0;
|
||||
public bool InvalidateShaderCachesData => (InvalidateShaderCaches & 0x10) != 0;
|
||||
public bool InvalidateShaderCachesConstant => (InvalidateShaderCaches & 0x1000) != 0;
|
||||
public bool InvalidateShaderCachesLocks => (InvalidateShaderCaches & 0x2) != 0;
|
||||
public bool InvalidateShaderCachesFlushData => (InvalidateShaderCaches & 0x4) != 0;
|
||||
public readonly bool InvalidateShaderCachesInstruction => (InvalidateShaderCaches & 0x1) != 0;
|
||||
public readonly bool InvalidateShaderCachesData => (InvalidateShaderCaches & 0x10) != 0;
|
||||
public readonly bool InvalidateShaderCachesConstant => (InvalidateShaderCaches & 0x1000) != 0;
|
||||
public readonly bool InvalidateShaderCachesLocks => (InvalidateShaderCaches & 0x2) != 0;
|
||||
public readonly bool InvalidateShaderCachesFlushData => (InvalidateShaderCaches & 0x4) != 0;
|
||||
public uint SetReservedSwMethod00;
|
||||
public uint SetReservedSwMethod01;
|
||||
public uint SetReservedSwMethod02;
|
||||
@ -185,13 +185,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint SetReservedSwMethod06;
|
||||
public uint SetReservedSwMethod07;
|
||||
public uint SetCwdControl;
|
||||
public SetCwdControlSmSelection SetCwdControlSmSelection => (SetCwdControlSmSelection)(SetCwdControl & 0x1);
|
||||
public readonly SetCwdControlSmSelection SetCwdControlSmSelection => (SetCwdControlSmSelection)(SetCwdControl & 0x1);
|
||||
public uint InvalidateTextureHeaderCacheNoWfi;
|
||||
public InvalidateCacheLines InvalidateTextureHeaderCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureHeaderCacheNoWfi & 0x1);
|
||||
public int InvalidateTextureHeaderCacheNoWfiTag => (int)((InvalidateTextureHeaderCacheNoWfi >> 4) & 0x3FFFFF);
|
||||
public readonly InvalidateCacheLines InvalidateTextureHeaderCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureHeaderCacheNoWfi & 0x1);
|
||||
public readonly int InvalidateTextureHeaderCacheNoWfiTag => (int)((InvalidateTextureHeaderCacheNoWfi >> 4) & 0x3FFFFF);
|
||||
public uint SetCwdRefCounter;
|
||||
public int SetCwdRefCounterSelect => (int)(SetCwdRefCounter & 0x3F);
|
||||
public int SetCwdRefCounterValue => (int)((SetCwdRefCounter >> 8) & 0xFFFF);
|
||||
public readonly int SetCwdRefCounterSelect => (int)(SetCwdRefCounter & 0x3F);
|
||||
public readonly int SetCwdRefCounterValue => (int)((SetCwdRefCounter >> 8) & 0xFFFF);
|
||||
public uint SetReservedSwMethod08;
|
||||
public uint SetReservedSwMethod09;
|
||||
public uint SetReservedSwMethod10;
|
||||
@ -201,59 +201,59 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint SetReservedSwMethod14;
|
||||
public uint SetReservedSwMethod15;
|
||||
public uint SetGwcScgType;
|
||||
public SetGwcScgTypeScgType SetGwcScgTypeScgType => (SetGwcScgTypeScgType)(SetGwcScgType & 0x1);
|
||||
public readonly SetGwcScgTypeScgType SetGwcScgTypeScgType => (SetGwcScgTypeScgType)(SetGwcScgType & 0x1);
|
||||
public uint SetScgControl;
|
||||
public int SetScgControlCompute1MaxSmCount => (int)(SetScgControl & 0x1FF);
|
||||
public readonly int SetScgControlCompute1MaxSmCount => (int)(SetScgControl & 0x1FF);
|
||||
public uint InvalidateConstantBufferCacheA;
|
||||
public int InvalidateConstantBufferCacheAAddressUpper => (int)(InvalidateConstantBufferCacheA & 0xFF);
|
||||
public readonly int InvalidateConstantBufferCacheAAddressUpper => (int)(InvalidateConstantBufferCacheA & 0xFF);
|
||||
public uint InvalidateConstantBufferCacheB;
|
||||
public uint InvalidateConstantBufferCacheC;
|
||||
public int InvalidateConstantBufferCacheCByteCount => (int)(InvalidateConstantBufferCacheC & 0x1FFFF);
|
||||
public bool InvalidateConstantBufferCacheCThruL2 => (InvalidateConstantBufferCacheC & 0x80000000) != 0;
|
||||
public readonly int InvalidateConstantBufferCacheCByteCount => (int)(InvalidateConstantBufferCacheC & 0x1FFFF);
|
||||
public readonly bool InvalidateConstantBufferCacheCThruL2 => (InvalidateConstantBufferCacheC & 0x80000000) != 0;
|
||||
public uint SetComputeClassVersion;
|
||||
public int SetComputeClassVersionCurrent => (int)(SetComputeClassVersion & 0xFFFF);
|
||||
public int SetComputeClassVersionOldestSupported => (int)((SetComputeClassVersion >> 16) & 0xFFFF);
|
||||
public readonly int SetComputeClassVersionCurrent => (int)(SetComputeClassVersion & 0xFFFF);
|
||||
public readonly int SetComputeClassVersionOldestSupported => (int)((SetComputeClassVersion >> 16) & 0xFFFF);
|
||||
public uint CheckComputeClassVersion;
|
||||
public int CheckComputeClassVersionCurrent => (int)(CheckComputeClassVersion & 0xFFFF);
|
||||
public int CheckComputeClassVersionOldestSupported => (int)((CheckComputeClassVersion >> 16) & 0xFFFF);
|
||||
public readonly int CheckComputeClassVersionCurrent => (int)(CheckComputeClassVersion & 0xFFFF);
|
||||
public readonly int CheckComputeClassVersionOldestSupported => (int)((CheckComputeClassVersion >> 16) & 0xFFFF);
|
||||
public uint SetQmdVersion;
|
||||
public int SetQmdVersionCurrent => (int)(SetQmdVersion & 0xFFFF);
|
||||
public int SetQmdVersionOldestSupported => (int)((SetQmdVersion >> 16) & 0xFFFF);
|
||||
public readonly int SetQmdVersionCurrent => (int)(SetQmdVersion & 0xFFFF);
|
||||
public readonly int SetQmdVersionOldestSupported => (int)((SetQmdVersion >> 16) & 0xFFFF);
|
||||
public uint SetWfiConfig;
|
||||
public bool SetWfiConfigEnableScgTypeWfi => (SetWfiConfig & 0x1) != 0;
|
||||
public readonly bool SetWfiConfigEnableScgTypeWfi => (SetWfiConfig & 0x1) != 0;
|
||||
public uint CheckQmdVersion;
|
||||
public int CheckQmdVersionCurrent => (int)(CheckQmdVersion & 0xFFFF);
|
||||
public int CheckQmdVersionOldestSupported => (int)((CheckQmdVersion >> 16) & 0xFFFF);
|
||||
public readonly int CheckQmdVersionCurrent => (int)(CheckQmdVersion & 0xFFFF);
|
||||
public readonly int CheckQmdVersionOldestSupported => (int)((CheckQmdVersion >> 16) & 0xFFFF);
|
||||
public uint WaitForIdleScgType;
|
||||
public uint InvalidateSkedCaches;
|
||||
public bool InvalidateSkedCachesV => (InvalidateSkedCaches & 0x1) != 0;
|
||||
public readonly bool InvalidateSkedCachesV => (InvalidateSkedCaches & 0x1) != 0;
|
||||
public uint SetScgRenderEnableControl;
|
||||
public bool SetScgRenderEnableControlCompute1UsesRenderEnable => (SetScgRenderEnableControl & 0x1) != 0;
|
||||
public readonly bool SetScgRenderEnableControlCompute1UsesRenderEnable => (SetScgRenderEnableControl & 0x1) != 0;
|
||||
public fixed uint Reserved2A0[4];
|
||||
public uint SetCwdSlotCount;
|
||||
public int SetCwdSlotCountV => (int)(SetCwdSlotCount & 0xFF);
|
||||
public readonly int SetCwdSlotCountV => (int)(SetCwdSlotCount & 0xFF);
|
||||
public uint SendPcasA;
|
||||
public uint SendPcasB;
|
||||
public int SendPcasBFrom => (int)(SendPcasB & 0xFFFFFF);
|
||||
public int SendPcasBDelta => (int)((SendPcasB >> 24) & 0xFF);
|
||||
public readonly int SendPcasBFrom => (int)(SendPcasB & 0xFFFFFF);
|
||||
public readonly int SendPcasBDelta => (int)((SendPcasB >> 24) & 0xFF);
|
||||
public uint SendSignalingPcasB;
|
||||
public bool SendSignalingPcasBInvalidate => (SendSignalingPcasB & 0x1) != 0;
|
||||
public bool SendSignalingPcasBSchedule => (SendSignalingPcasB & 0x2) != 0;
|
||||
public readonly bool SendSignalingPcasBInvalidate => (SendSignalingPcasB & 0x1) != 0;
|
||||
public readonly bool SendSignalingPcasBSchedule => (SendSignalingPcasB & 0x2) != 0;
|
||||
public fixed uint Reserved2C0[9];
|
||||
public uint SetShaderLocalMemoryNonThrottledA;
|
||||
public int SetShaderLocalMemoryNonThrottledASizeUpper => (int)(SetShaderLocalMemoryNonThrottledA & 0xFF);
|
||||
public readonly int SetShaderLocalMemoryNonThrottledASizeUpper => (int)(SetShaderLocalMemoryNonThrottledA & 0xFF);
|
||||
public uint SetShaderLocalMemoryNonThrottledB;
|
||||
public uint SetShaderLocalMemoryNonThrottledC;
|
||||
public int SetShaderLocalMemoryNonThrottledCMaxSmCount => (int)(SetShaderLocalMemoryNonThrottledC & 0x1FF);
|
||||
public readonly int SetShaderLocalMemoryNonThrottledCMaxSmCount => (int)(SetShaderLocalMemoryNonThrottledC & 0x1FF);
|
||||
public uint SetShaderLocalMemoryThrottledA;
|
||||
public int SetShaderLocalMemoryThrottledASizeUpper => (int)(SetShaderLocalMemoryThrottledA & 0xFF);
|
||||
public readonly int SetShaderLocalMemoryThrottledASizeUpper => (int)(SetShaderLocalMemoryThrottledA & 0xFF);
|
||||
public uint SetShaderLocalMemoryThrottledB;
|
||||
public uint SetShaderLocalMemoryThrottledC;
|
||||
public int SetShaderLocalMemoryThrottledCMaxSmCount => (int)(SetShaderLocalMemoryThrottledC & 0x1FF);
|
||||
public readonly int SetShaderLocalMemoryThrottledCMaxSmCount => (int)(SetShaderLocalMemoryThrottledC & 0x1FF);
|
||||
public fixed uint Reserved2FC[5];
|
||||
public uint SetSpaVersion;
|
||||
public int SetSpaVersionMinor => (int)(SetSpaVersion & 0xFF);
|
||||
public int SetSpaVersionMajor => (int)((SetSpaVersion >> 8) & 0xFF);
|
||||
public readonly int SetSpaVersionMinor => (int)(SetSpaVersion & 0xFF);
|
||||
public readonly int SetSpaVersionMajor => (int)((SetSpaVersion >> 8) & 0xFF);
|
||||
public fixed uint Reserved314[123];
|
||||
public uint SetFalcon00;
|
||||
public uint SetFalcon01;
|
||||
@ -291,14 +291,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint SetShaderLocalMemoryWindow;
|
||||
public fixed uint Reserved780[4];
|
||||
public uint SetShaderLocalMemoryA;
|
||||
public int SetShaderLocalMemoryAAddressUpper => (int)(SetShaderLocalMemoryA & 0xFF);
|
||||
public readonly int SetShaderLocalMemoryAAddressUpper => (int)(SetShaderLocalMemoryA & 0xFF);
|
||||
public uint SetShaderLocalMemoryB;
|
||||
public fixed uint Reserved798[383];
|
||||
public uint SetShaderCacheControl;
|
||||
public bool SetShaderCacheControlIcachePrefetchEnable => (SetShaderCacheControl & 0x1) != 0;
|
||||
public readonly bool SetShaderCacheControlIcachePrefetchEnable => (SetShaderCacheControl & 0x1) != 0;
|
||||
public fixed uint ReservedD98[19];
|
||||
public uint SetSmTimeoutInterval;
|
||||
public int SetSmTimeoutIntervalCounterBit => (int)(SetSmTimeoutInterval & 0x3F);
|
||||
public readonly int SetSmTimeoutIntervalCounterBit => (int)(SetSmTimeoutInterval & 0x3F);
|
||||
public fixed uint ReservedDE8[87];
|
||||
public uint SetSpareNoop12;
|
||||
public uint SetSpareNoop13;
|
||||
@ -319,62 +319,62 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint SetSpareNoop11;
|
||||
public fixed uint Reserved1070[103];
|
||||
public uint InvalidateSamplerCacheAll;
|
||||
public bool InvalidateSamplerCacheAllV => (InvalidateSamplerCacheAll & 0x1) != 0;
|
||||
public readonly bool InvalidateSamplerCacheAllV => (InvalidateSamplerCacheAll & 0x1) != 0;
|
||||
public uint InvalidateTextureHeaderCacheAll;
|
||||
public bool InvalidateTextureHeaderCacheAllV => (InvalidateTextureHeaderCacheAll & 0x1) != 0;
|
||||
public readonly bool InvalidateTextureHeaderCacheAllV => (InvalidateTextureHeaderCacheAll & 0x1) != 0;
|
||||
public fixed uint Reserved1214[29];
|
||||
public uint InvalidateTextureDataCacheNoWfi;
|
||||
public InvalidateCacheLines InvalidateTextureDataCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureDataCacheNoWfi & 0x1);
|
||||
public int InvalidateTextureDataCacheNoWfiTag => (int)((InvalidateTextureDataCacheNoWfi >> 4) & 0x3FFFFF);
|
||||
public readonly InvalidateCacheLines InvalidateTextureDataCacheNoWfiLines => (InvalidateCacheLines)(InvalidateTextureDataCacheNoWfi & 0x1);
|
||||
public readonly int InvalidateTextureDataCacheNoWfiTag => (int)((InvalidateTextureDataCacheNoWfi >> 4) & 0x3FFFFF);
|
||||
public fixed uint Reserved128C[7];
|
||||
public uint ActivatePerfSettingsForComputeContext;
|
||||
public bool ActivatePerfSettingsForComputeContextAll => (ActivatePerfSettingsForComputeContext & 0x1) != 0;
|
||||
public readonly bool ActivatePerfSettingsForComputeContextAll => (ActivatePerfSettingsForComputeContext & 0x1) != 0;
|
||||
public fixed uint Reserved12AC[33];
|
||||
public uint InvalidateSamplerCache;
|
||||
public InvalidateCacheLines InvalidateSamplerCacheLines => (InvalidateCacheLines)(InvalidateSamplerCache & 0x1);
|
||||
public int InvalidateSamplerCacheTag => (int)((InvalidateSamplerCache >> 4) & 0x3FFFFF);
|
||||
public readonly InvalidateCacheLines InvalidateSamplerCacheLines => (InvalidateCacheLines)(InvalidateSamplerCache & 0x1);
|
||||
public readonly int InvalidateSamplerCacheTag => (int)((InvalidateSamplerCache >> 4) & 0x3FFFFF);
|
||||
public uint InvalidateTextureHeaderCache;
|
||||
public InvalidateCacheLines InvalidateTextureHeaderCacheLines => (InvalidateCacheLines)(InvalidateTextureHeaderCache & 0x1);
|
||||
public int InvalidateTextureHeaderCacheTag => (int)((InvalidateTextureHeaderCache >> 4) & 0x3FFFFF);
|
||||
public readonly InvalidateCacheLines InvalidateTextureHeaderCacheLines => (InvalidateCacheLines)(InvalidateTextureHeaderCache & 0x1);
|
||||
public readonly int InvalidateTextureHeaderCacheTag => (int)((InvalidateTextureHeaderCache >> 4) & 0x3FFFFF);
|
||||
public uint InvalidateTextureDataCache;
|
||||
public InvalidateCacheLines InvalidateTextureDataCacheLines => (InvalidateCacheLines)(InvalidateTextureDataCache & 0x1);
|
||||
public int InvalidateTextureDataCacheTag => (int)((InvalidateTextureDataCache >> 4) & 0x3FFFFF);
|
||||
public readonly InvalidateCacheLines InvalidateTextureDataCacheLines => (InvalidateCacheLines)(InvalidateTextureDataCache & 0x1);
|
||||
public readonly int InvalidateTextureDataCacheTag => (int)((InvalidateTextureDataCache >> 4) & 0x3FFFFF);
|
||||
public fixed uint Reserved133C[58];
|
||||
public uint InvalidateSamplerCacheNoWfi;
|
||||
public InvalidateCacheLines InvalidateSamplerCacheNoWfiLines => (InvalidateCacheLines)(InvalidateSamplerCacheNoWfi & 0x1);
|
||||
public int InvalidateSamplerCacheNoWfiTag => (int)((InvalidateSamplerCacheNoWfi >> 4) & 0x3FFFFF);
|
||||
public readonly InvalidateCacheLines InvalidateSamplerCacheNoWfiLines => (InvalidateCacheLines)(InvalidateSamplerCacheNoWfi & 0x1);
|
||||
public readonly int InvalidateSamplerCacheNoWfiTag => (int)((InvalidateSamplerCacheNoWfi >> 4) & 0x3FFFFF);
|
||||
public fixed uint Reserved1428[64];
|
||||
public uint SetShaderExceptions;
|
||||
public bool SetShaderExceptionsEnable => (SetShaderExceptions & 0x1) != 0;
|
||||
public readonly bool SetShaderExceptionsEnable => (SetShaderExceptions & 0x1) != 0;
|
||||
public fixed uint Reserved152C[9];
|
||||
public uint SetRenderEnableA;
|
||||
public int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
|
||||
public readonly int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
|
||||
public uint SetRenderEnableB;
|
||||
public uint SetRenderEnableC;
|
||||
public int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
|
||||
public readonly int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
|
||||
public uint SetTexSamplerPoolA;
|
||||
public int SetTexSamplerPoolAOffsetUpper => (int)(SetTexSamplerPoolA & 0xFF);
|
||||
public readonly int SetTexSamplerPoolAOffsetUpper => (int)(SetTexSamplerPoolA & 0xFF);
|
||||
public uint SetTexSamplerPoolB;
|
||||
public uint SetTexSamplerPoolC;
|
||||
public int SetTexSamplerPoolCMaximumIndex => (int)(SetTexSamplerPoolC & 0xFFFFF);
|
||||
public readonly int SetTexSamplerPoolCMaximumIndex => (int)(SetTexSamplerPoolC & 0xFFFFF);
|
||||
public fixed uint Reserved1568[3];
|
||||
public uint SetTexHeaderPoolA;
|
||||
public int SetTexHeaderPoolAOffsetUpper => (int)(SetTexHeaderPoolA & 0xFF);
|
||||
public readonly int SetTexHeaderPoolAOffsetUpper => (int)(SetTexHeaderPoolA & 0xFF);
|
||||
public uint SetTexHeaderPoolB;
|
||||
public uint SetTexHeaderPoolC;
|
||||
public int SetTexHeaderPoolCMaximumIndex => (int)(SetTexHeaderPoolC & 0x3FFFFF);
|
||||
public readonly int SetTexHeaderPoolCMaximumIndex => (int)(SetTexHeaderPoolC & 0x3FFFFF);
|
||||
public fixed uint Reserved1580[34];
|
||||
public uint SetProgramRegionA;
|
||||
public int SetProgramRegionAAddressUpper => (int)(SetProgramRegionA & 0xFF);
|
||||
public readonly int SetProgramRegionAAddressUpper => (int)(SetProgramRegionA & 0xFF);
|
||||
public uint SetProgramRegionB;
|
||||
public fixed uint Reserved1610[34];
|
||||
public uint InvalidateShaderCachesNoWfi;
|
||||
public bool InvalidateShaderCachesNoWfiInstruction => (InvalidateShaderCachesNoWfi & 0x1) != 0;
|
||||
public bool InvalidateShaderCachesNoWfiGlobalData => (InvalidateShaderCachesNoWfi & 0x10) != 0;
|
||||
public bool InvalidateShaderCachesNoWfiConstant => (InvalidateShaderCachesNoWfi & 0x1000) != 0;
|
||||
public readonly bool InvalidateShaderCachesNoWfiInstruction => (InvalidateShaderCachesNoWfi & 0x1) != 0;
|
||||
public readonly bool InvalidateShaderCachesNoWfiGlobalData => (InvalidateShaderCachesNoWfi & 0x10) != 0;
|
||||
public readonly bool InvalidateShaderCachesNoWfiConstant => (InvalidateShaderCachesNoWfi & 0x1000) != 0;
|
||||
public fixed uint Reserved169C[170];
|
||||
public uint SetRenderEnableOverride;
|
||||
public SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
|
||||
public readonly SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
|
||||
public fixed uint Reserved1948[57];
|
||||
public uint PipeNop;
|
||||
public uint SetSpare00;
|
||||
@ -383,20 +383,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public uint SetSpare03;
|
||||
public fixed uint Reserved1A40[48];
|
||||
public uint SetReportSemaphoreA;
|
||||
public int SetReportSemaphoreAOffsetUpper => (int)(SetReportSemaphoreA & 0xFF);
|
||||
public readonly int SetReportSemaphoreAOffsetUpper => (int)(SetReportSemaphoreA & 0xFF);
|
||||
public uint SetReportSemaphoreB;
|
||||
public uint SetReportSemaphoreC;
|
||||
public uint SetReportSemaphoreD;
|
||||
public SetReportSemaphoreDOperation SetReportSemaphoreDOperation => (SetReportSemaphoreDOperation)(SetReportSemaphoreD & 0x3);
|
||||
public bool SetReportSemaphoreDAwakenEnable => (SetReportSemaphoreD & 0x100000) != 0;
|
||||
public SetReportSemaphoreDStructureSize SetReportSemaphoreDStructureSize => (SetReportSemaphoreDStructureSize)((SetReportSemaphoreD >> 28) & 0x1);
|
||||
public bool SetReportSemaphoreDFlushDisable => (SetReportSemaphoreD & 0x4) != 0;
|
||||
public bool SetReportSemaphoreDReductionEnable => (SetReportSemaphoreD & 0x8) != 0;
|
||||
public SetReportSemaphoreDReductionOp SetReportSemaphoreDReductionOp => (SetReportSemaphoreDReductionOp)((SetReportSemaphoreD >> 9) & 0x7);
|
||||
public SetReportSemaphoreDReductionFormat SetReportSemaphoreDReductionFormat => (SetReportSemaphoreDReductionFormat)((SetReportSemaphoreD >> 17) & 0x3);
|
||||
public readonly SetReportSemaphoreDOperation SetReportSemaphoreDOperation => (SetReportSemaphoreDOperation)(SetReportSemaphoreD & 0x3);
|
||||
public readonly bool SetReportSemaphoreDAwakenEnable => (SetReportSemaphoreD & 0x100000) != 0;
|
||||
public readonly SetReportSemaphoreDStructureSize SetReportSemaphoreDStructureSize => (SetReportSemaphoreDStructureSize)((SetReportSemaphoreD >> 28) & 0x1);
|
||||
public readonly bool SetReportSemaphoreDFlushDisable => (SetReportSemaphoreD & 0x4) != 0;
|
||||
public readonly bool SetReportSemaphoreDReductionEnable => (SetReportSemaphoreD & 0x8) != 0;
|
||||
public readonly SetReportSemaphoreDReductionOp SetReportSemaphoreDReductionOp => (SetReportSemaphoreDReductionOp)((SetReportSemaphoreD >> 9) & 0x7);
|
||||
public readonly SetReportSemaphoreDReductionFormat SetReportSemaphoreDReductionFormat => (SetReportSemaphoreDReductionFormat)((SetReportSemaphoreD >> 17) & 0x3);
|
||||
public fixed uint Reserved1B10[702];
|
||||
public uint SetBindlessTexture;
|
||||
public int SetBindlessTextureConstantBufferSlotSelect => (int)(SetBindlessTexture & 0x7);
|
||||
public readonly int SetBindlessTextureConstantBufferSlotSelect => (int)(SetBindlessTexture & 0x7);
|
||||
public uint SetTrapHandler;
|
||||
public fixed uint Reserved2610[843];
|
||||
public Array8<uint> SetShaderPerformanceCounterValueUpper;
|
||||
@ -423,13 +423,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
public bool SetShaderPerformanceCounterControlBWindowed(int i) => (SetShaderPerformanceCounterControlB[i] & 0x8) != 0;
|
||||
public int SetShaderPerformanceCounterControlBFunc(int i) => (int)((SetShaderPerformanceCounterControlB[i] >> 4) & 0xFFFF);
|
||||
public uint SetShaderPerformanceCounterTrapControl;
|
||||
public int SetShaderPerformanceCounterTrapControlMask => (int)(SetShaderPerformanceCounterTrapControl & 0xFF);
|
||||
public readonly int SetShaderPerformanceCounterTrapControlMask => (int)(SetShaderPerformanceCounterTrapControl & 0xFF);
|
||||
public uint StartShaderPerformanceCounter;
|
||||
public int StartShaderPerformanceCounterCounterMask => (int)(StartShaderPerformanceCounter & 0xFF);
|
||||
public readonly int StartShaderPerformanceCounterCounterMask => (int)(StartShaderPerformanceCounter & 0xFF);
|
||||
public uint StopShaderPerformanceCounter;
|
||||
public int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF);
|
||||
public readonly int StopShaderPerformanceCounterCounterMask => (int)(StopShaderPerformanceCounter & 0xFF);
|
||||
public fixed uint Reserved33E8[6];
|
||||
public MmeShadowScratch SetMmeShadowScratch;
|
||||
public Array256<uint> SetMmeShadowScratch;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum DependentQmdType
|
||||
{
|
||||
Queue,
|
||||
Grid
|
||||
Grid,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum ReleaseMembarType
|
||||
{
|
||||
FeNone,
|
||||
FeSysmembar
|
||||
FeSysmembar,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
{
|
||||
L1None,
|
||||
L1Sysmembar,
|
||||
L1Membar
|
||||
L1Membar,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum Fp32NanBehavior
|
||||
{
|
||||
Legacy,
|
||||
Fp64Compatible
|
||||
Fp64Compatible,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum Fp32F2iNanBehavior
|
||||
{
|
||||
PassZero,
|
||||
PassIndefinite
|
||||
PassIndefinite,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum ApiVisibleCallLimit
|
||||
{
|
||||
_32,
|
||||
NoCheck
|
||||
NoCheck,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum SharedMemoryBankMapping
|
||||
{
|
||||
FourBytesPerBank,
|
||||
EightBytesPerBank
|
||||
EightBytesPerBank,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -74,7 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum Fp32NarrowInstruction
|
||||
{
|
||||
KeepDenorms,
|
||||
FlushDenorms
|
||||
FlushDenorms,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
{
|
||||
DirectlyAddressableMemorySize16kb,
|
||||
DirectlyAddressableMemorySize32kb,
|
||||
DirectlyAddressableMemorySize48kb
|
||||
DirectlyAddressableMemorySize48kb,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -99,7 +99,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
RedDec,
|
||||
RedAnd,
|
||||
RedOr,
|
||||
RedXor
|
||||
RedXor,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -108,7 +108,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum ReductionFormat
|
||||
{
|
||||
Unsigned32,
|
||||
Signed32
|
||||
Signed32,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
enum StructureSize
|
||||
{
|
||||
FourWords,
|
||||
OneWord
|
||||
OneWord,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -127,129 +127,129 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
{
|
||||
private fixed int _words[64];
|
||||
|
||||
public int OuterPut => BitRange(30, 0);
|
||||
public bool OuterOverflow => Bit(31);
|
||||
public int OuterGet => BitRange(62, 32);
|
||||
public bool OuterStickyOverflow => Bit(63);
|
||||
public int InnerGet => BitRange(94, 64);
|
||||
public bool InnerOverflow => Bit(95);
|
||||
public int InnerPut => BitRange(126, 96);
|
||||
public bool InnerStickyOverflow => Bit(127);
|
||||
public int QmdReservedAA => BitRange(159, 128);
|
||||
public int DependentQmdPointer => BitRange(191, 160);
|
||||
public int QmdGroupId => BitRange(197, 192);
|
||||
public bool SmGlobalCachingEnable => Bit(198);
|
||||
public bool RunCtaInOneSmPartition => Bit(199);
|
||||
public bool IsQueue => Bit(200);
|
||||
public bool AddToHeadOfQmdGroupLinkedList => Bit(201);
|
||||
public bool SemaphoreReleaseEnable0 => Bit(202);
|
||||
public bool SemaphoreReleaseEnable1 => Bit(203);
|
||||
public bool RequireSchedulingPcas => Bit(204);
|
||||
public bool DependentQmdScheduleEnable => Bit(205);
|
||||
public DependentQmdType DependentQmdType => (DependentQmdType)BitRange(206, 206);
|
||||
public bool DependentQmdFieldCopy => Bit(207);
|
||||
public int QmdReservedB => BitRange(223, 208);
|
||||
public int CircularQueueSize => BitRange(248, 224);
|
||||
public bool QmdReservedC => Bit(249);
|
||||
public bool InvalidateTextureHeaderCache => Bit(250);
|
||||
public bool InvalidateTextureSamplerCache => Bit(251);
|
||||
public bool InvalidateTextureDataCache => Bit(252);
|
||||
public bool InvalidateShaderDataCache => Bit(253);
|
||||
public bool InvalidateInstructionCache => Bit(254);
|
||||
public bool InvalidateShaderConstantCache => Bit(255);
|
||||
public int ProgramOffset => BitRange(287, 256);
|
||||
public int CircularQueueAddrLower => BitRange(319, 288);
|
||||
public int CircularQueueAddrUpper => BitRange(327, 320);
|
||||
public int QmdReservedD => BitRange(335, 328);
|
||||
public int CircularQueueEntrySize => BitRange(351, 336);
|
||||
public int CwdReferenceCountId => BitRange(357, 352);
|
||||
public int CwdReferenceCountDeltaMinusOne => BitRange(365, 358);
|
||||
public ReleaseMembarType ReleaseMembarType => (ReleaseMembarType)BitRange(366, 366);
|
||||
public bool CwdReferenceCountIncrEnable => Bit(367);
|
||||
public CwdMembarType CwdMembarType => (CwdMembarType)BitRange(369, 368);
|
||||
public bool SequentiallyRunCtas => Bit(370);
|
||||
public bool CwdReferenceCountDecrEnable => Bit(371);
|
||||
public bool Throttled => Bit(372);
|
||||
public Fp32NanBehavior Fp32NanBehavior => (Fp32NanBehavior)BitRange(376, 376);
|
||||
public Fp32F2iNanBehavior Fp32F2iNanBehavior => (Fp32F2iNanBehavior)BitRange(377, 377);
|
||||
public ApiVisibleCallLimit ApiVisibleCallLimit => (ApiVisibleCallLimit)BitRange(378, 378);
|
||||
public SharedMemoryBankMapping SharedMemoryBankMapping => (SharedMemoryBankMapping)BitRange(379, 379);
|
||||
public SamplerIndex SamplerIndex => (SamplerIndex)BitRange(382, 382);
|
||||
public Fp32NarrowInstruction Fp32NarrowInstruction => (Fp32NarrowInstruction)BitRange(383, 383);
|
||||
public int CtaRasterWidth => BitRange(415, 384);
|
||||
public int CtaRasterHeight => BitRange(431, 416);
|
||||
public int CtaRasterDepth => BitRange(447, 432);
|
||||
public int CtaRasterWidthResume => BitRange(479, 448);
|
||||
public int CtaRasterHeightResume => BitRange(495, 480);
|
||||
public int CtaRasterDepthResume => BitRange(511, 496);
|
||||
public int QueueEntriesPerCtaMinusOne => BitRange(518, 512);
|
||||
public int CoalesceWaitingPeriod => BitRange(529, 522);
|
||||
public int SharedMemorySize => BitRange(561, 544);
|
||||
public int QmdReservedG => BitRange(575, 562);
|
||||
public int QmdVersion => BitRange(579, 576);
|
||||
public int QmdMajorVersion => BitRange(583, 580);
|
||||
public int QmdReservedH => BitRange(591, 584);
|
||||
public int CtaThreadDimension0 => BitRange(607, 592);
|
||||
public int CtaThreadDimension1 => BitRange(623, 608);
|
||||
public int CtaThreadDimension2 => BitRange(639, 624);
|
||||
public bool ConstantBufferValid(int i) => Bit(640 + i * 1);
|
||||
public int QmdReservedI => BitRange(668, 648);
|
||||
public L1Configuration L1Configuration => (L1Configuration)BitRange(671, 669);
|
||||
public int SmDisableMaskLower => BitRange(703, 672);
|
||||
public int SmDisableMaskUpper => BitRange(735, 704);
|
||||
public int Release0AddressLower => BitRange(767, 736);
|
||||
public int Release0AddressUpper => BitRange(775, 768);
|
||||
public int QmdReservedJ => BitRange(783, 776);
|
||||
public ReductionOp Release0ReductionOp => (ReductionOp)BitRange(790, 788);
|
||||
public bool QmdReservedK => Bit(791);
|
||||
public ReductionFormat Release0ReductionFormat => (ReductionFormat)BitRange(793, 792);
|
||||
public bool Release0ReductionEnable => Bit(794);
|
||||
public StructureSize Release0StructureSize => (StructureSize)BitRange(799, 799);
|
||||
public int Release0Payload => BitRange(831, 800);
|
||||
public int Release1AddressLower => BitRange(863, 832);
|
||||
public int Release1AddressUpper => BitRange(871, 864);
|
||||
public int QmdReservedL => BitRange(879, 872);
|
||||
public ReductionOp Release1ReductionOp => (ReductionOp)BitRange(886, 884);
|
||||
public bool QmdReservedM => Bit(887);
|
||||
public ReductionFormat Release1ReductionFormat => (ReductionFormat)BitRange(889, 888);
|
||||
public bool Release1ReductionEnable => Bit(890);
|
||||
public StructureSize Release1StructureSize => (StructureSize)BitRange(895, 895);
|
||||
public int Release1Payload => BitRange(927, 896);
|
||||
public int ConstantBufferAddrLower(int i) => BitRange(959 + i * 64, 928 + i * 64);
|
||||
public int ConstantBufferAddrUpper(int i) => BitRange(967 + i * 64, 960 + i * 64);
|
||||
public int ConstantBufferReservedAddr(int i) => BitRange(973 + i * 64, 968 + i * 64);
|
||||
public bool ConstantBufferInvalidate(int i) => Bit(974 + i * 64);
|
||||
public int ConstantBufferSize(int i) => BitRange(991 + i * 64, 975 + i * 64);
|
||||
public int ShaderLocalMemoryLowSize => BitRange(1463, 1440);
|
||||
public int QmdReservedN => BitRange(1466, 1464);
|
||||
public int BarrierCount => BitRange(1471, 1467);
|
||||
public int ShaderLocalMemoryHighSize => BitRange(1495, 1472);
|
||||
public int RegisterCount => BitRange(1503, 1496);
|
||||
public int ShaderLocalMemoryCrsSize => BitRange(1527, 1504);
|
||||
public int SassVersion => BitRange(1535, 1528);
|
||||
public int HwOnlyInnerGet => BitRange(1566, 1536);
|
||||
public bool HwOnlyRequireSchedulingPcas => Bit(1567);
|
||||
public int HwOnlyInnerPut => BitRange(1598, 1568);
|
||||
public bool HwOnlyScgType => Bit(1599);
|
||||
public int HwOnlySpanListHeadIndex => BitRange(1629, 1600);
|
||||
public bool QmdReservedQ => Bit(1630);
|
||||
public bool HwOnlySpanListHeadIndexValid => Bit(1631);
|
||||
public int HwOnlySkedNextQmdPointer => BitRange(1663, 1632);
|
||||
public int QmdSpareE => BitRange(1695, 1664);
|
||||
public int QmdSpareF => BitRange(1727, 1696);
|
||||
public int QmdSpareG => BitRange(1759, 1728);
|
||||
public int QmdSpareH => BitRange(1791, 1760);
|
||||
public int QmdSpareI => BitRange(1823, 1792);
|
||||
public int QmdSpareJ => BitRange(1855, 1824);
|
||||
public int QmdSpareK => BitRange(1887, 1856);
|
||||
public int QmdSpareL => BitRange(1919, 1888);
|
||||
public int QmdSpareM => BitRange(1951, 1920);
|
||||
public int QmdSpareN => BitRange(1983, 1952);
|
||||
public int DebugIdUpper => BitRange(2015, 1984);
|
||||
public int DebugIdLower => BitRange(2047, 2016);
|
||||
public readonly int OuterPut => BitRange(30, 0);
|
||||
public readonly bool OuterOverflow => Bit(31);
|
||||
public readonly int OuterGet => BitRange(62, 32);
|
||||
public readonly bool OuterStickyOverflow => Bit(63);
|
||||
public readonly int InnerGet => BitRange(94, 64);
|
||||
public readonly bool InnerOverflow => Bit(95);
|
||||
public readonly int InnerPut => BitRange(126, 96);
|
||||
public readonly bool InnerStickyOverflow => Bit(127);
|
||||
public readonly int QmdReservedAA => BitRange(159, 128);
|
||||
public readonly int DependentQmdPointer => BitRange(191, 160);
|
||||
public readonly int QmdGroupId => BitRange(197, 192);
|
||||
public readonly bool SmGlobalCachingEnable => Bit(198);
|
||||
public readonly bool RunCtaInOneSmPartition => Bit(199);
|
||||
public readonly bool IsQueue => Bit(200);
|
||||
public readonly bool AddToHeadOfQmdGroupLinkedList => Bit(201);
|
||||
public readonly bool SemaphoreReleaseEnable0 => Bit(202);
|
||||
public readonly bool SemaphoreReleaseEnable1 => Bit(203);
|
||||
public readonly bool RequireSchedulingPcas => Bit(204);
|
||||
public readonly bool DependentQmdScheduleEnable => Bit(205);
|
||||
public readonly DependentQmdType DependentQmdType => (DependentQmdType)BitRange(206, 206);
|
||||
public readonly bool DependentQmdFieldCopy => Bit(207);
|
||||
public readonly int QmdReservedB => BitRange(223, 208);
|
||||
public readonly int CircularQueueSize => BitRange(248, 224);
|
||||
public readonly bool QmdReservedC => Bit(249);
|
||||
public readonly bool InvalidateTextureHeaderCache => Bit(250);
|
||||
public readonly bool InvalidateTextureSamplerCache => Bit(251);
|
||||
public readonly bool InvalidateTextureDataCache => Bit(252);
|
||||
public readonly bool InvalidateShaderDataCache => Bit(253);
|
||||
public readonly bool InvalidateInstructionCache => Bit(254);
|
||||
public readonly bool InvalidateShaderConstantCache => Bit(255);
|
||||
public readonly int ProgramOffset => BitRange(287, 256);
|
||||
public readonly int CircularQueueAddrLower => BitRange(319, 288);
|
||||
public readonly int CircularQueueAddrUpper => BitRange(327, 320);
|
||||
public readonly int QmdReservedD => BitRange(335, 328);
|
||||
public readonly int CircularQueueEntrySize => BitRange(351, 336);
|
||||
public readonly int CwdReferenceCountId => BitRange(357, 352);
|
||||
public readonly int CwdReferenceCountDeltaMinusOne => BitRange(365, 358);
|
||||
public readonly ReleaseMembarType ReleaseMembarType => (ReleaseMembarType)BitRange(366, 366);
|
||||
public readonly bool CwdReferenceCountIncrEnable => Bit(367);
|
||||
public readonly CwdMembarType CwdMembarType => (CwdMembarType)BitRange(369, 368);
|
||||
public readonly bool SequentiallyRunCtas => Bit(370);
|
||||
public readonly bool CwdReferenceCountDecrEnable => Bit(371);
|
||||
public readonly bool Throttled => Bit(372);
|
||||
public readonly Fp32NanBehavior Fp32NanBehavior => (Fp32NanBehavior)BitRange(376, 376);
|
||||
public readonly Fp32F2iNanBehavior Fp32F2iNanBehavior => (Fp32F2iNanBehavior)BitRange(377, 377);
|
||||
public readonly ApiVisibleCallLimit ApiVisibleCallLimit => (ApiVisibleCallLimit)BitRange(378, 378);
|
||||
public readonly SharedMemoryBankMapping SharedMemoryBankMapping => (SharedMemoryBankMapping)BitRange(379, 379);
|
||||
public readonly SamplerIndex SamplerIndex => (SamplerIndex)BitRange(382, 382);
|
||||
public readonly Fp32NarrowInstruction Fp32NarrowInstruction => (Fp32NarrowInstruction)BitRange(383, 383);
|
||||
public readonly int CtaRasterWidth => BitRange(415, 384);
|
||||
public readonly int CtaRasterHeight => BitRange(431, 416);
|
||||
public readonly int CtaRasterDepth => BitRange(447, 432);
|
||||
public readonly int CtaRasterWidthResume => BitRange(479, 448);
|
||||
public readonly int CtaRasterHeightResume => BitRange(495, 480);
|
||||
public readonly int CtaRasterDepthResume => BitRange(511, 496);
|
||||
public readonly int QueueEntriesPerCtaMinusOne => BitRange(518, 512);
|
||||
public readonly int CoalesceWaitingPeriod => BitRange(529, 522);
|
||||
public readonly int SharedMemorySize => BitRange(561, 544);
|
||||
public readonly int QmdReservedG => BitRange(575, 562);
|
||||
public readonly int QmdVersion => BitRange(579, 576);
|
||||
public readonly int QmdMajorVersion => BitRange(583, 580);
|
||||
public readonly int QmdReservedH => BitRange(591, 584);
|
||||
public readonly int CtaThreadDimension0 => BitRange(607, 592);
|
||||
public readonly int CtaThreadDimension1 => BitRange(623, 608);
|
||||
public readonly int CtaThreadDimension2 => BitRange(639, 624);
|
||||
public readonly bool ConstantBufferValid(int i) => Bit(640 + i * 1);
|
||||
public readonly int QmdReservedI => BitRange(668, 648);
|
||||
public readonly L1Configuration L1Configuration => (L1Configuration)BitRange(671, 669);
|
||||
public readonly int SmDisableMaskLower => BitRange(703, 672);
|
||||
public readonly int SmDisableMaskUpper => BitRange(735, 704);
|
||||
public readonly int Release0AddressLower => BitRange(767, 736);
|
||||
public readonly int Release0AddressUpper => BitRange(775, 768);
|
||||
public readonly int QmdReservedJ => BitRange(783, 776);
|
||||
public readonly ReductionOp Release0ReductionOp => (ReductionOp)BitRange(790, 788);
|
||||
public readonly bool QmdReservedK => Bit(791);
|
||||
public readonly ReductionFormat Release0ReductionFormat => (ReductionFormat)BitRange(793, 792);
|
||||
public readonly bool Release0ReductionEnable => Bit(794);
|
||||
public readonly StructureSize Release0StructureSize => (StructureSize)BitRange(799, 799);
|
||||
public readonly int Release0Payload => BitRange(831, 800);
|
||||
public readonly int Release1AddressLower => BitRange(863, 832);
|
||||
public readonly int Release1AddressUpper => BitRange(871, 864);
|
||||
public readonly int QmdReservedL => BitRange(879, 872);
|
||||
public readonly ReductionOp Release1ReductionOp => (ReductionOp)BitRange(886, 884);
|
||||
public readonly bool QmdReservedM => Bit(887);
|
||||
public readonly ReductionFormat Release1ReductionFormat => (ReductionFormat)BitRange(889, 888);
|
||||
public readonly bool Release1ReductionEnable => Bit(890);
|
||||
public readonly StructureSize Release1StructureSize => (StructureSize)BitRange(895, 895);
|
||||
public readonly int Release1Payload => BitRange(927, 896);
|
||||
public readonly int ConstantBufferAddrLower(int i) => BitRange(959 + i * 64, 928 + i * 64);
|
||||
public readonly int ConstantBufferAddrUpper(int i) => BitRange(967 + i * 64, 960 + i * 64);
|
||||
public readonly int ConstantBufferReservedAddr(int i) => BitRange(973 + i * 64, 968 + i * 64);
|
||||
public readonly bool ConstantBufferInvalidate(int i) => Bit(974 + i * 64);
|
||||
public readonly int ConstantBufferSize(int i) => BitRange(991 + i * 64, 975 + i * 64);
|
||||
public readonly int ShaderLocalMemoryLowSize => BitRange(1463, 1440);
|
||||
public readonly int QmdReservedN => BitRange(1466, 1464);
|
||||
public readonly int BarrierCount => BitRange(1471, 1467);
|
||||
public readonly int ShaderLocalMemoryHighSize => BitRange(1495, 1472);
|
||||
public readonly int RegisterCount => BitRange(1503, 1496);
|
||||
public readonly int ShaderLocalMemoryCrsSize => BitRange(1527, 1504);
|
||||
public readonly int SassVersion => BitRange(1535, 1528);
|
||||
public readonly int HwOnlyInnerGet => BitRange(1566, 1536);
|
||||
public readonly bool HwOnlyRequireSchedulingPcas => Bit(1567);
|
||||
public readonly int HwOnlyInnerPut => BitRange(1598, 1568);
|
||||
public readonly bool HwOnlyScgType => Bit(1599);
|
||||
public readonly int HwOnlySpanListHeadIndex => BitRange(1629, 1600);
|
||||
public readonly bool QmdReservedQ => Bit(1630);
|
||||
public readonly bool HwOnlySpanListHeadIndexValid => Bit(1631);
|
||||
public readonly int HwOnlySkedNextQmdPointer => BitRange(1663, 1632);
|
||||
public readonly int QmdSpareE => BitRange(1695, 1664);
|
||||
public readonly int QmdSpareF => BitRange(1727, 1696);
|
||||
public readonly int QmdSpareG => BitRange(1759, 1728);
|
||||
public readonly int QmdSpareH => BitRange(1791, 1760);
|
||||
public readonly int QmdSpareI => BitRange(1823, 1792);
|
||||
public readonly int QmdSpareJ => BitRange(1855, 1824);
|
||||
public readonly int QmdSpareK => BitRange(1887, 1856);
|
||||
public readonly int QmdSpareL => BitRange(1919, 1888);
|
||||
public readonly int QmdSpareM => BitRange(1951, 1920);
|
||||
public readonly int QmdSpareN => BitRange(1983, 1952);
|
||||
public readonly int DebugIdUpper => BitRange(2015, 1984);
|
||||
public readonly int DebugIdLower => BitRange(2047, 2016);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool Bit(int bit)
|
||||
private readonly bool Bit(int bit)
|
||||
{
|
||||
if ((uint)bit >= 64 * 32)
|
||||
{
|
||||
@ -260,7 +260,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private int BitRange(int upper, int lower)
|
||||
private readonly int BitRange(int upper, int lower)
|
||||
{
|
||||
if ((uint)lower >= 64 * 32)
|
||||
{
|
||||
@ -272,4 +272,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
|
||||
return (_words[lower >> 5] >> (lower & 31)) & mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@
|
||||
{
|
||||
False,
|
||||
True,
|
||||
Host
|
||||
Host,
|
||||
}
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
SrcLinear = 1 << 7,
|
||||
DstLinear = 1 << 8,
|
||||
MultiLineEnable = 1 << 9,
|
||||
RemapEnable = 1 << 10
|
||||
RemapEnable = 1 << 10,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Texture parameters for copy.
|
||||
/// </summary>
|
||||
private struct TextureParams
|
||||
private readonly struct TextureParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy region X coordinate.
|
||||
@ -109,7 +109,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
_3dEngine = threedEngine;
|
||||
_state = new DeviceState<DmaClassState>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(DmaClassState.LaunchDma), new RwCallback(LaunchDma, null) }
|
||||
{ nameof(DmaClassState.LaunchDma), new RwCallback(LaunchDma, null) },
|
||||
});
|
||||
}
|
||||
|
||||
@ -345,8 +345,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
// all be rewritten to use pooled arrays, but that gets complicated with packed data and strides
|
||||
Span<byte> dstSpan = memoryManager.GetSpan(dstGpuVa + (ulong)dstBaseOffset, dstSize).ToArray();
|
||||
|
||||
TextureParams srcParams = new TextureParams(srcRegionX, srcRegionY, srcBaseOffset, srcBpp, srcLinear, srcCalculator);
|
||||
TextureParams dstParams = new TextureParams(dstRegionX, dstRegionY, dstBaseOffset, dstBpp, dstLinear, dstCalculator);
|
||||
TextureParams srcParams = new(srcRegionX, srcRegionY, srcBaseOffset, srcBpp, srcLinear, srcCalculator);
|
||||
TextureParams dstParams = new(dstRegionX, dstRegionY, dstBaseOffset, dstBpp, dstLinear, dstCalculator);
|
||||
|
||||
// If remapping is enabled, we always copy the components directly, in order.
|
||||
// If it's enabled, but the mapping is just XYZW, we also copy them in order.
|
||||
@ -363,13 +363,26 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
|
||||
switch (srcBpp)
|
||||
{
|
||||
case 1: Copy<byte>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 2: Copy<ushort>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 4: Copy<uint>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 8: Copy<ulong>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 12: Copy<Bpp12Pixel>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 16: Copy<Vector128<byte>>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
default: throw new NotSupportedException($"Unable to copy ${srcBpp} bpp pixel format.");
|
||||
case 1:
|
||||
Copy<byte>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 2:
|
||||
Copy<ushort>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 4:
|
||||
Copy<uint>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 8:
|
||||
Copy<ulong>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 12:
|
||||
Copy<Bpp12Pixel>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 16:
|
||||
Copy<Vector128<byte>>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"Unable to copy ${srcBpp} bpp pixel format.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -378,11 +391,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
|
||||
switch (componentSize)
|
||||
{
|
||||
case 1: CopyShuffle<byte>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 2: CopyShuffle<ushort>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 3: CopyShuffle<UInt24>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
case 4: CopyShuffle<uint>(dstSpan, srcSpan, dstParams, srcParams); break;
|
||||
default: throw new NotSupportedException($"Unable to copy ${componentSize} component size.");
|
||||
case 1:
|
||||
CopyShuffle<byte>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 2:
|
||||
CopyShuffle<ushort>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 3:
|
||||
CopyShuffle<UInt24>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
case 4:
|
||||
CopyShuffle<uint>(dstSpan, srcSpan, dstParams, srcParams);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"Unable to copy ${componentSize} component size.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,28 +548,28 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
0 => _state.State.SetRemapComponentsDstX,
|
||||
1 => _state.State.SetRemapComponentsDstY,
|
||||
2 => _state.State.SetRemapComponentsDstZ,
|
||||
_ => _state.State.SetRemapComponentsDstW
|
||||
_ => _state.State.SetRemapComponentsDstW,
|
||||
};
|
||||
|
||||
switch (componentsDst)
|
||||
{
|
||||
case SetRemapComponentsDst.SrcX:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan, dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan, dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.SrcY:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>()), dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[Unsafe.SizeOf<T>()..], dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.SrcZ:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>() * 2), dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[(Unsafe.SizeOf<T>() * 2)..], dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.SrcW:
|
||||
Copy<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), srcSpan.Slice(Unsafe.SizeOf<T>() * 3), dst, src);
|
||||
Copy<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], srcSpan[(Unsafe.SizeOf<T>() * 3)..], dst, src);
|
||||
break;
|
||||
case SetRemapComponentsDst.ConstA:
|
||||
Fill<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstA));
|
||||
Fill<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstA));
|
||||
break;
|
||||
case SetRemapComponentsDst.ConstB:
|
||||
Fill<T>(dstSpan.Slice(Unsafe.SizeOf<T>() * i), dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstB));
|
||||
Fill<T>(dstSpan[(Unsafe.SizeOf<T>() * i)..], dst, Unsafe.As<uint, T>(ref _state.State.SetRemapConstB));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -179,49 +179,49 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
/// </summary>
|
||||
unsafe struct DmaClassState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public fixed uint Reserved00[64];
|
||||
public uint Nop;
|
||||
public fixed uint Reserved104[15];
|
||||
public uint PmTrigger;
|
||||
public fixed uint Reserved144[63];
|
||||
public uint SetSemaphoreA;
|
||||
public int SetSemaphoreAUpper => (int)(SetSemaphoreA & 0xFF);
|
||||
public readonly int SetSemaphoreAUpper => (int)(SetSemaphoreA & 0xFF);
|
||||
public uint SetSemaphoreB;
|
||||
public uint SetSemaphorePayload;
|
||||
public fixed uint Reserved24C[2];
|
||||
public uint SetRenderEnableA;
|
||||
public int SetRenderEnableAUpper => (int)(SetRenderEnableA & 0xFF);
|
||||
public readonly int SetRenderEnableAUpper => (int)(SetRenderEnableA & 0xFF);
|
||||
public uint SetRenderEnableB;
|
||||
public uint SetRenderEnableC;
|
||||
public int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
|
||||
public readonly int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
|
||||
public uint SetSrcPhysMode;
|
||||
public SetPhysModeTarget SetSrcPhysModeTarget => (SetPhysModeTarget)(SetSrcPhysMode & 0x3);
|
||||
public readonly SetPhysModeTarget SetSrcPhysModeTarget => (SetPhysModeTarget)(SetSrcPhysMode & 0x3);
|
||||
public uint SetDstPhysMode;
|
||||
public SetPhysModeTarget SetDstPhysModeTarget => (SetPhysModeTarget)(SetDstPhysMode & 0x3);
|
||||
public readonly SetPhysModeTarget SetDstPhysModeTarget => (SetPhysModeTarget)(SetDstPhysMode & 0x3);
|
||||
public fixed uint Reserved268[38];
|
||||
public uint LaunchDma;
|
||||
public LaunchDmaDataTransferType LaunchDmaDataTransferType => (LaunchDmaDataTransferType)(LaunchDma & 0x3);
|
||||
public bool LaunchDmaFlushEnable => (LaunchDma & 0x4) != 0;
|
||||
public LaunchDmaSemaphoreType LaunchDmaSemaphoreType => (LaunchDmaSemaphoreType)((LaunchDma >> 3) & 0x3);
|
||||
public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 5) & 0x3);
|
||||
public LaunchDmaMemoryLayout LaunchDmaSrcMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 7) & 0x1);
|
||||
public LaunchDmaMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 8) & 0x1);
|
||||
public bool LaunchDmaMultiLineEnable => (LaunchDma & 0x200) != 0;
|
||||
public bool LaunchDmaRemapEnable => (LaunchDma & 0x400) != 0;
|
||||
public bool LaunchDmaForceRmwdisable => (LaunchDma & 0x800) != 0;
|
||||
public LaunchDmaType LaunchDmaSrcType => (LaunchDmaType)((LaunchDma >> 12) & 0x1);
|
||||
public LaunchDmaType LaunchDmaDstType => (LaunchDmaType)((LaunchDma >> 13) & 0x1);
|
||||
public LaunchDmaSemaphoreReduction LaunchDmaSemaphoreReduction => (LaunchDmaSemaphoreReduction)((LaunchDma >> 14) & 0xF);
|
||||
public LaunchDmaSemaphoreReductionSign LaunchDmaSemaphoreReductionSign => (LaunchDmaSemaphoreReductionSign)((LaunchDma >> 18) & 0x1);
|
||||
public bool LaunchDmaSemaphoreReductionEnable => (LaunchDma & 0x80000) != 0;
|
||||
public LaunchDmaBypassL2 LaunchDmaBypassL2 => (LaunchDmaBypassL2)((LaunchDma >> 20) & 0x1);
|
||||
public readonly LaunchDmaDataTransferType LaunchDmaDataTransferType => (LaunchDmaDataTransferType)(LaunchDma & 0x3);
|
||||
public readonly bool LaunchDmaFlushEnable => (LaunchDma & 0x4) != 0;
|
||||
public readonly LaunchDmaSemaphoreType LaunchDmaSemaphoreType => (LaunchDmaSemaphoreType)((LaunchDma >> 3) & 0x3);
|
||||
public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 5) & 0x3);
|
||||
public readonly LaunchDmaMemoryLayout LaunchDmaSrcMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 7) & 0x1);
|
||||
public readonly LaunchDmaMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaMemoryLayout)((LaunchDma >> 8) & 0x1);
|
||||
public readonly bool LaunchDmaMultiLineEnable => (LaunchDma & 0x200) != 0;
|
||||
public readonly bool LaunchDmaRemapEnable => (LaunchDma & 0x400) != 0;
|
||||
public readonly bool LaunchDmaForceRmwdisable => (LaunchDma & 0x800) != 0;
|
||||
public readonly LaunchDmaType LaunchDmaSrcType => (LaunchDmaType)((LaunchDma >> 12) & 0x1);
|
||||
public readonly LaunchDmaType LaunchDmaDstType => (LaunchDmaType)((LaunchDma >> 13) & 0x1);
|
||||
public readonly LaunchDmaSemaphoreReduction LaunchDmaSemaphoreReduction => (LaunchDmaSemaphoreReduction)((LaunchDma >> 14) & 0xF);
|
||||
public readonly LaunchDmaSemaphoreReductionSign LaunchDmaSemaphoreReductionSign => (LaunchDmaSemaphoreReductionSign)((LaunchDma >> 18) & 0x1);
|
||||
public readonly bool LaunchDmaSemaphoreReductionEnable => (LaunchDma & 0x80000) != 0;
|
||||
public readonly LaunchDmaBypassL2 LaunchDmaBypassL2 => (LaunchDmaBypassL2)((LaunchDma >> 20) & 0x1);
|
||||
public fixed uint Reserved304[63];
|
||||
public uint OffsetInUpper;
|
||||
public int OffsetInUpperUpper => (int)(OffsetInUpper & 0xFF);
|
||||
public readonly int OffsetInUpperUpper => (int)(OffsetInUpper & 0xFF);
|
||||
public uint OffsetInLower;
|
||||
public uint OffsetOutUpper;
|
||||
public int OffsetOutUpperUpper => (int)(OffsetOutUpper & 0xFF);
|
||||
public readonly int OffsetOutUpperUpper => (int)(OffsetOutUpper & 0xFF);
|
||||
public uint OffsetOutLower;
|
||||
public uint PitchIn;
|
||||
public uint PitchOut;
|
||||
@ -231,38 +231,38 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
public uint SetRemapConstA;
|
||||
public uint SetRemapConstB;
|
||||
public uint SetRemapComponents;
|
||||
public SetRemapComponentsDst SetRemapComponentsDstX => (SetRemapComponentsDst)(SetRemapComponents & 0x7);
|
||||
public SetRemapComponentsDst SetRemapComponentsDstY => (SetRemapComponentsDst)((SetRemapComponents >> 4) & 0x7);
|
||||
public SetRemapComponentsDst SetRemapComponentsDstZ => (SetRemapComponentsDst)((SetRemapComponents >> 8) & 0x7);
|
||||
public SetRemapComponentsDst SetRemapComponentsDstW => (SetRemapComponentsDst)((SetRemapComponents >> 12) & 0x7);
|
||||
public SetRemapComponentsComponentSize SetRemapComponentsComponentSize => (SetRemapComponentsComponentSize)((SetRemapComponents >> 16) & 0x3);
|
||||
public SetRemapComponentsNumComponents SetRemapComponentsNumSrcComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 20) & 0x3);
|
||||
public SetRemapComponentsNumComponents SetRemapComponentsNumDstComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 24) & 0x3);
|
||||
public readonly SetRemapComponentsDst SetRemapComponentsDstX => (SetRemapComponentsDst)(SetRemapComponents & 0x7);
|
||||
public readonly SetRemapComponentsDst SetRemapComponentsDstY => (SetRemapComponentsDst)((SetRemapComponents >> 4) & 0x7);
|
||||
public readonly SetRemapComponentsDst SetRemapComponentsDstZ => (SetRemapComponentsDst)((SetRemapComponents >> 8) & 0x7);
|
||||
public readonly SetRemapComponentsDst SetRemapComponentsDstW => (SetRemapComponentsDst)((SetRemapComponents >> 12) & 0x7);
|
||||
public readonly SetRemapComponentsComponentSize SetRemapComponentsComponentSize => (SetRemapComponentsComponentSize)((SetRemapComponents >> 16) & 0x3);
|
||||
public readonly SetRemapComponentsNumComponents SetRemapComponentsNumSrcComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 20) & 0x3);
|
||||
public readonly SetRemapComponentsNumComponents SetRemapComponentsNumDstComponents => (SetRemapComponentsNumComponents)((SetRemapComponents >> 24) & 0x3);
|
||||
public uint SetDstBlockSize;
|
||||
public SetBlockSizeWidth SetDstBlockSizeWidth => (SetBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public SetBlockSizeHeight SetDstBlockSizeHeight => (SetBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public SetBlockSizeDepth SetDstBlockSizeDepth => (SetBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public SetBlockSizeGobHeight SetDstBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetDstBlockSize >> 12) & 0xF);
|
||||
public readonly SetBlockSizeWidth SetDstBlockSizeWidth => (SetBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public readonly SetBlockSizeHeight SetDstBlockSizeHeight => (SetBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public readonly SetBlockSizeDepth SetDstBlockSizeDepth => (SetBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public readonly SetBlockSizeGobHeight SetDstBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetDstBlockSize >> 12) & 0xF);
|
||||
public uint SetDstWidth;
|
||||
public uint SetDstHeight;
|
||||
public uint SetDstDepth;
|
||||
public uint SetDstLayer;
|
||||
public uint SetDstOrigin;
|
||||
public int SetDstOriginX => (int)(SetDstOrigin & 0xFFFF);
|
||||
public int SetDstOriginY => (int)((SetDstOrigin >> 16) & 0xFFFF);
|
||||
public readonly int SetDstOriginX => (int)(SetDstOrigin & 0xFFFF);
|
||||
public readonly int SetDstOriginY => (int)((SetDstOrigin >> 16) & 0xFFFF);
|
||||
public uint Reserved724;
|
||||
public uint SetSrcBlockSize;
|
||||
public SetBlockSizeWidth SetSrcBlockSizeWidth => (SetBlockSizeWidth)(SetSrcBlockSize & 0xF);
|
||||
public SetBlockSizeHeight SetSrcBlockSizeHeight => (SetBlockSizeHeight)((SetSrcBlockSize >> 4) & 0xF);
|
||||
public SetBlockSizeDepth SetSrcBlockSizeDepth => (SetBlockSizeDepth)((SetSrcBlockSize >> 8) & 0xF);
|
||||
public SetBlockSizeGobHeight SetSrcBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetSrcBlockSize >> 12) & 0xF);
|
||||
public readonly SetBlockSizeWidth SetSrcBlockSizeWidth => (SetBlockSizeWidth)(SetSrcBlockSize & 0xF);
|
||||
public readonly SetBlockSizeHeight SetSrcBlockSizeHeight => (SetBlockSizeHeight)((SetSrcBlockSize >> 4) & 0xF);
|
||||
public readonly SetBlockSizeDepth SetSrcBlockSizeDepth => (SetBlockSizeDepth)((SetSrcBlockSize >> 8) & 0xF);
|
||||
public readonly SetBlockSizeGobHeight SetSrcBlockSizeGobHeight => (SetBlockSizeGobHeight)((SetSrcBlockSize >> 12) & 0xF);
|
||||
public uint SetSrcWidth;
|
||||
public uint SetSrcHeight;
|
||||
public uint SetSrcDepth;
|
||||
public uint SetSrcLayer;
|
||||
public uint SetSrcOrigin;
|
||||
public int SetSrcOriginX => (int)(SetSrcOrigin & 0xFFFF);
|
||||
public int SetSrcOriginY => (int)((SetSrcOrigin >> 16) & 0xFFFF);
|
||||
public readonly int SetSrcOriginX => (int)(SetSrcOrigin & 0xFFFF);
|
||||
public readonly int SetSrcOriginY => (int)((SetSrcOrigin >> 16) & 0xFFFF);
|
||||
public fixed uint Reserved740[629];
|
||||
public uint PmTriggerEnd;
|
||||
public fixed uint Reserved1118[2490];
|
||||
|
@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
/// </summary>
|
||||
struct DmaTexture
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public MemoryLayout MemoryLayout;
|
||||
public int Width;
|
||||
public int Height;
|
||||
@ -17,4 +17,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
|
||||
public ushort RegionY;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
Grp0SetSubDevMask = 1,
|
||||
Grp0StoreSubDevMask = 2,
|
||||
Grp0UseSubDevMask = 3,
|
||||
Grp2NonIncMethod = 0
|
||||
Grp2NonIncMethod = Grp0IncMethod,
|
||||
}
|
||||
|
||||
enum SecOp
|
||||
@ -20,22 +20,22 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
ImmdDataMethod = 4,
|
||||
OneInc = 5,
|
||||
Reserved6 = 6,
|
||||
EndPbSegment = 7
|
||||
EndPbSegment = 7,
|
||||
}
|
||||
|
||||
struct CompressedMethod
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Method;
|
||||
#pragma warning restore CS0649
|
||||
public int MethodAddressOld => (int)((Method >> 2) & 0x7FF);
|
||||
public int MethodAddress => (int)(Method & 0xFFF);
|
||||
public int SubdeviceMask => (int)((Method >> 4) & 0xFFF);
|
||||
public int MethodSubchannel => (int)((Method >> 13) & 0x7);
|
||||
public TertOp TertOp => (TertOp)((Method >> 16) & 0x3);
|
||||
public int MethodCountOld => (int)((Method >> 18) & 0x7FF);
|
||||
public int MethodCount => (int)((Method >> 16) & 0x1FFF);
|
||||
public int ImmdData => (int)((Method >> 16) & 0x1FFF);
|
||||
public SecOp SecOp => (SecOp)((Method >> 29) & 0x7);
|
||||
public readonly int MethodAddressOld => (int)((Method >> 2) & 0x7FF);
|
||||
public readonly int MethodAddress => (int)(Method & 0xFFF);
|
||||
public readonly int SubdeviceMask => (int)((Method >> 4) & 0xFFF);
|
||||
public readonly int MethodSubchannel => (int)((Method >> 13) & 0x7);
|
||||
public readonly TertOp TertOp => (TertOp)((Method >> 16) & 0x3);
|
||||
public readonly int MethodCountOld => (int)((Method >> 18) & 0x7FF);
|
||||
public readonly int MethodCount => (int)((Method >> 16) & 0x1FFF);
|
||||
public readonly int ImmdData => (int)((Method >> 16) & 0x1FFF);
|
||||
public readonly SecOp SecOp => (SecOp)((Method >> 29) & 0x7);
|
||||
}
|
||||
}
|
||||
|
@ -36,20 +36,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
|
||||
struct GPEntry
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Entry0;
|
||||
#pragma warning restore CS0649
|
||||
public Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1);
|
||||
public int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF);
|
||||
public int Entry0Operand => (int)(Entry0);
|
||||
#pragma warning disable CS0649
|
||||
public readonly Entry0Fetch Entry0Fetch => (Entry0Fetch)(Entry0 & 0x1);
|
||||
public readonly int Entry0Get => (int)((Entry0 >> 2) & 0x3FFFFFFF);
|
||||
public readonly int Entry0Operand => (int)(Entry0);
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Entry1;
|
||||
#pragma warning restore CS0649
|
||||
public int Entry1GetHi => (int)(Entry1 & 0xFF);
|
||||
public Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1);
|
||||
public Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1);
|
||||
public int Entry1Length => (int)((Entry1 >> 10) & 0x1FFFFF);
|
||||
public Entry1Sync Entry1Sync => (Entry1Sync)((Entry1 >> 31) & 0x1);
|
||||
public Entry1Opcode Entry1Opcode => (Entry1Opcode)(Entry1 & 0xFF);
|
||||
public readonly int Entry1GetHi => (int)(Entry1 & 0xFF);
|
||||
public readonly Entry1Priv Entry1Priv => (Entry1Priv)((Entry1 >> 8) & 0x1);
|
||||
public readonly Entry1Level Entry1Level => (Entry1Level)((Entry1 >> 9) & 0x1);
|
||||
public readonly int Entry1Length => (int)((Entry1 >> 10) & 0x1FFFFF);
|
||||
public readonly Entry1Sync Entry1Sync => (Entry1Sync)((Entry1 >> 31) & 0x1);
|
||||
public readonly Entry1Opcode Entry1Opcode => (Entry1Opcode)(Entry1 & 0xFF);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
private readonly GPFifoProcessor _parent;
|
||||
private readonly DeviceState<GPFifoClassState> _state;
|
||||
|
||||
private int _previousSubChannel;
|
||||
private bool _createSyncPending;
|
||||
|
||||
private const int MacrosCount = 0x80;
|
||||
@ -45,7 +44,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
{ nameof(GPFifoClassState.SetReference), new RwCallback(SetReference, null) },
|
||||
{ nameof(GPFifoClassState.LoadMmeInstructionRam), new RwCallback(LoadMmeInstructionRam, null) },
|
||||
{ nameof(GPFifoClassState.LoadMmeStartAddressRam), new RwCallback(LoadMmeStartAddressRam, null) },
|
||||
{ nameof(GPFifoClassState.SetMmeShadowRamControl), new RwCallback(SetMmeShadowRamControl, null) }
|
||||
{ nameof(GPFifoClassState.SetMmeShadowRamControl), new RwCallback(SetMmeShadowRamControl, null) },
|
||||
});
|
||||
|
||||
_macros = new Macro[MacrosCount];
|
||||
|
@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
Release = 2,
|
||||
AcqGeq = 4,
|
||||
AcqAnd = 8,
|
||||
Reduction = 16
|
||||
Reduction = 16,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum SemaphoredAcquireSwitch
|
||||
{
|
||||
Disabled = 0,
|
||||
Enabled = 1
|
||||
Enabled = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum SemaphoredReleaseWfi
|
||||
{
|
||||
En = 0,
|
||||
Dis = 1
|
||||
Dis = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum SemaphoredReleaseSize
|
||||
{
|
||||
SixteenBytes = 0,
|
||||
FourBytes = 1
|
||||
FourBytes = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -55,7 +55,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
Or = 4,
|
||||
Add = 5,
|
||||
Inc = 6,
|
||||
Dec = 7
|
||||
Dec = 7,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -64,7 +64,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum SemaphoredFormat
|
||||
{
|
||||
Signed = 0,
|
||||
Unsigned = 1
|
||||
Unsigned = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum MemOpCTlbInvalidatePdb
|
||||
{
|
||||
One = 0,
|
||||
All = 1
|
||||
All = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -82,7 +82,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum MemOpCTlbInvalidateGpc
|
||||
{
|
||||
Enable = 0,
|
||||
Disable = 1
|
||||
Disable = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
{
|
||||
VidMem = 0,
|
||||
SysMemCoherent = 2,
|
||||
SysMemNoncoherent = 3
|
||||
SysMemNoncoherent = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
L2PeermemInvalidate = 13,
|
||||
L2SysmemInvalidate = 14,
|
||||
L2CleanComptags = 15,
|
||||
L2FlushDirty = 16
|
||||
L2FlushDirty = 16,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum SyncpointbOperation
|
||||
{
|
||||
Wait = 0,
|
||||
Incr = 1
|
||||
Incr = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum SyncpointbWaitSwitch
|
||||
{
|
||||
Dis = 0,
|
||||
En = 1
|
||||
En = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -132,7 +132,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
enum WfiScope
|
||||
{
|
||||
CurrentScgType = 0,
|
||||
All = 1
|
||||
All = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
Nop = 0,
|
||||
PbdmaTimeslice = 1,
|
||||
RunlistTimeslice = 2,
|
||||
Tsg = 3
|
||||
Tsg = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -151,44 +151,44 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
/// </summary>
|
||||
struct GPFifoClassState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint SetObject;
|
||||
public int SetObjectNvclass => (int)(SetObject & 0xFFFF);
|
||||
public int SetObjectEngine => (int)((SetObject >> 16) & 0x1F);
|
||||
public readonly int SetObjectNvclass => (int)(SetObject & 0xFFFF);
|
||||
public readonly int SetObjectEngine => (int)((SetObject >> 16) & 0x1F);
|
||||
public uint Illegal;
|
||||
public int IllegalHandle => (int)(Illegal);
|
||||
public readonly int IllegalHandle => (int)(Illegal);
|
||||
public uint Nop;
|
||||
public int NopHandle => (int)(Nop);
|
||||
public readonly int NopHandle => (int)(Nop);
|
||||
public uint Reserved0C;
|
||||
public uint Semaphorea;
|
||||
public int SemaphoreaOffsetUpper => (int)(Semaphorea & 0xFF);
|
||||
public readonly int SemaphoreaOffsetUpper => (int)(Semaphorea & 0xFF);
|
||||
public uint Semaphoreb;
|
||||
public int SemaphorebOffsetLower => (int)((Semaphoreb >> 2) & 0x3FFFFFFF);
|
||||
public readonly int SemaphorebOffsetLower => (int)((Semaphoreb >> 2) & 0x3FFFFFFF);
|
||||
public uint Semaphorec;
|
||||
public int SemaphorecPayload => (int)(Semaphorec);
|
||||
public readonly int SemaphorecPayload => (int)(Semaphorec);
|
||||
public uint Semaphored;
|
||||
public SemaphoredOperation SemaphoredOperation => (SemaphoredOperation)(Semaphored & 0x1F);
|
||||
public SemaphoredAcquireSwitch SemaphoredAcquireSwitch => (SemaphoredAcquireSwitch)((Semaphored >> 12) & 0x1);
|
||||
public SemaphoredReleaseWfi SemaphoredReleaseWfi => (SemaphoredReleaseWfi)((Semaphored >> 20) & 0x1);
|
||||
public SemaphoredReleaseSize SemaphoredReleaseSize => (SemaphoredReleaseSize)((Semaphored >> 24) & 0x1);
|
||||
public SemaphoredReduction SemaphoredReduction => (SemaphoredReduction)((Semaphored >> 27) & 0xF);
|
||||
public SemaphoredFormat SemaphoredFormat => (SemaphoredFormat)((Semaphored >> 31) & 0x1);
|
||||
public readonly SemaphoredOperation SemaphoredOperation => (SemaphoredOperation)(Semaphored & 0x1F);
|
||||
public readonly SemaphoredAcquireSwitch SemaphoredAcquireSwitch => (SemaphoredAcquireSwitch)((Semaphored >> 12) & 0x1);
|
||||
public readonly SemaphoredReleaseWfi SemaphoredReleaseWfi => (SemaphoredReleaseWfi)((Semaphored >> 20) & 0x1);
|
||||
public readonly SemaphoredReleaseSize SemaphoredReleaseSize => (SemaphoredReleaseSize)((Semaphored >> 24) & 0x1);
|
||||
public readonly SemaphoredReduction SemaphoredReduction => (SemaphoredReduction)((Semaphored >> 27) & 0xF);
|
||||
public readonly SemaphoredFormat SemaphoredFormat => (SemaphoredFormat)((Semaphored >> 31) & 0x1);
|
||||
public uint NonStallInterrupt;
|
||||
public int NonStallInterruptHandle => (int)(NonStallInterrupt);
|
||||
public readonly int NonStallInterruptHandle => (int)(NonStallInterrupt);
|
||||
public uint FbFlush;
|
||||
public int FbFlushHandle => (int)(FbFlush);
|
||||
public readonly int FbFlushHandle => (int)(FbFlush);
|
||||
public uint Reserved28;
|
||||
public uint Reserved2C;
|
||||
public uint MemOpC;
|
||||
public int MemOpCOperandLow => (int)((MemOpC >> 2) & 0x3FFFFFFF);
|
||||
public MemOpCTlbInvalidatePdb MemOpCTlbInvalidatePdb => (MemOpCTlbInvalidatePdb)(MemOpC & 0x1);
|
||||
public MemOpCTlbInvalidateGpc MemOpCTlbInvalidateGpc => (MemOpCTlbInvalidateGpc)((MemOpC >> 1) & 0x1);
|
||||
public MemOpCTlbInvalidateTarget MemOpCTlbInvalidateTarget => (MemOpCTlbInvalidateTarget)((MemOpC >> 10) & 0x3);
|
||||
public int MemOpCTlbInvalidateAddrLo => (int)((MemOpC >> 12) & 0xFFFFF);
|
||||
public readonly int MemOpCOperandLow => (int)((MemOpC >> 2) & 0x3FFFFFFF);
|
||||
public readonly MemOpCTlbInvalidatePdb MemOpCTlbInvalidatePdb => (MemOpCTlbInvalidatePdb)(MemOpC & 0x1);
|
||||
public readonly MemOpCTlbInvalidateGpc MemOpCTlbInvalidateGpc => (MemOpCTlbInvalidateGpc)((MemOpC >> 1) & 0x1);
|
||||
public readonly MemOpCTlbInvalidateTarget MemOpCTlbInvalidateTarget => (MemOpCTlbInvalidateTarget)((MemOpC >> 10) & 0x3);
|
||||
public readonly int MemOpCTlbInvalidateAddrLo => (int)((MemOpC >> 12) & 0xFFFFF);
|
||||
public uint MemOpD;
|
||||
public int MemOpDOperandHigh => (int)(MemOpD & 0xFF);
|
||||
public MemOpDOperation MemOpDOperation => (MemOpDOperation)((MemOpD >> 27) & 0x1F);
|
||||
public int MemOpDTlbInvalidateAddrHi => (int)(MemOpD & 0xFF);
|
||||
public readonly int MemOpDOperandHigh => (int)(MemOpD & 0xFF);
|
||||
public readonly MemOpDOperation MemOpDOperation => (MemOpDOperation)((MemOpD >> 27) & 0x1F);
|
||||
public readonly int MemOpDTlbInvalidateAddrHi => (int)(MemOpD & 0xFF);
|
||||
public uint Reserved38;
|
||||
public uint Reserved3C;
|
||||
public uint Reserved40;
|
||||
@ -196,7 +196,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
public uint Reserved48;
|
||||
public uint Reserved4C;
|
||||
public uint SetReference;
|
||||
public int SetReferenceCount => (int)(SetReference);
|
||||
public readonly int SetReferenceCount => (int)(SetReference);
|
||||
public uint Reserved54;
|
||||
public uint Reserved58;
|
||||
public uint Reserved5C;
|
||||
@ -205,17 +205,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
public uint Reserved68;
|
||||
public uint Reserved6C;
|
||||
public uint Syncpointa;
|
||||
public int SyncpointaPayload => (int)(Syncpointa);
|
||||
public readonly int SyncpointaPayload => (int)(Syncpointa);
|
||||
public uint Syncpointb;
|
||||
public SyncpointbOperation SyncpointbOperation => (SyncpointbOperation)(Syncpointb & 0x1);
|
||||
public SyncpointbWaitSwitch SyncpointbWaitSwitch => (SyncpointbWaitSwitch)((Syncpointb >> 4) & 0x1);
|
||||
public int SyncpointbSyncptIndex => (int)((Syncpointb >> 8) & 0xFFF);
|
||||
public readonly SyncpointbOperation SyncpointbOperation => (SyncpointbOperation)(Syncpointb & 0x1);
|
||||
public readonly SyncpointbWaitSwitch SyncpointbWaitSwitch => (SyncpointbWaitSwitch)((Syncpointb >> 4) & 0x1);
|
||||
public readonly int SyncpointbSyncptIndex => (int)((Syncpointb >> 8) & 0xFFF);
|
||||
public uint Wfi;
|
||||
public WfiScope WfiScope => (WfiScope)(Wfi & 0x1);
|
||||
public readonly WfiScope WfiScope => (WfiScope)(Wfi & 0x1);
|
||||
public uint CrcCheck;
|
||||
public int CrcCheckValue => (int)(CrcCheck);
|
||||
public readonly int CrcCheckValue => (int)(CrcCheck);
|
||||
public uint Yield;
|
||||
public YieldOp YieldOp => (YieldOp)(Yield & 0x3);
|
||||
public readonly YieldOp YieldOp => (YieldOp)(Yield & 0x3);
|
||||
// TODO: Eventually move this to per-engine state.
|
||||
public Array31<uint> Reserved84;
|
||||
public uint NoOperation;
|
||||
|
@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
private enum CommandBufferType
|
||||
{
|
||||
Prefetch,
|
||||
NoPrefetch
|
||||
NoPrefetch,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
/// <param name="memoryManager">The memory manager used to fetch the data</param>
|
||||
/// <param name="flush">If true, flushes potential GPU written data before reading the command buffer</param>
|
||||
/// <returns>The fetched data</returns>
|
||||
private ReadOnlySpan<int> GetWords(MemoryManager memoryManager, bool flush)
|
||||
private readonly ReadOnlySpan<int> GetWords(MemoryManager memoryManager, bool flush)
|
||||
{
|
||||
return MemoryMarshal.Cast<byte, int>(memoryManager.GetSpan(EntryAddress, (int)EntryCount * 4, flush));
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
/// <param name="memoryManager">The memory manager used to fetch the data</param>
|
||||
/// <param name="flush">If true, flushes potential GPU written data before reading the command buffer</param>
|
||||
/// <returns>The command buffer words</returns>
|
||||
public ReadOnlySpan<int> Fetch(MemoryManager memoryManager, bool flush)
|
||||
public readonly ReadOnlySpan<int> Fetch(MemoryManager memoryManager, bool flush)
|
||||
{
|
||||
return Words ?? GetWords(memoryManager, flush);
|
||||
}
|
||||
@ -85,7 +85,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
|
||||
private readonly ConcurrentQueue<CommandBuffer> _commandBufferQueue;
|
||||
|
||||
private CommandBuffer _currentCommandBuffer;
|
||||
private GPFifoProcessor _prevChannelProcessor;
|
||||
|
||||
private readonly bool _ibEnable;
|
||||
@ -129,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
Type = CommandBufferType.Prefetch,
|
||||
Words = commandBuffer,
|
||||
EntryAddress = ulong.MaxValue,
|
||||
EntryCount = (uint)commandBuffer.Length
|
||||
EntryCount = (uint)commandBuffer.Length,
|
||||
});
|
||||
}
|
||||
|
||||
@ -156,7 +155,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
Type = type,
|
||||
Words = null,
|
||||
EntryAddress = startAddress,
|
||||
EntryCount = (uint)entry.Entry1Length
|
||||
EntryCount = (uint)entry.Entry1Length,
|
||||
};
|
||||
}
|
||||
|
||||
@ -217,7 +216,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
flushCommandBuffer = false;
|
||||
}
|
||||
|
||||
_currentCommandBuffer = entry;
|
||||
ReadOnlySpan<int> words = entry.Fetch(entry.Processor.MemoryManager, flushCommandBuffer);
|
||||
|
||||
// If we are changing the current channel,
|
||||
|
@ -243,7 +243,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
|
||||
{
|
||||
0 => _3dClass,
|
||||
3 => _2dClass,
|
||||
_ => null
|
||||
_ => null,
|
||||
};
|
||||
|
||||
if (state != null)
|
||||
|
@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
_state = new DeviceState<InlineToMemoryClassState>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(InlineToMemoryClassState.LaunchDma), new RwCallback(LaunchDma, null) },
|
||||
{ nameof(InlineToMemoryClassState.LoadInlineData), new RwCallback(LoadInlineData, null) }
|
||||
{ nameof(InlineToMemoryClassState.LoadInlineData), new RwCallback(LoadInlineData, null) },
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
if (!_finished)
|
||||
{
|
||||
int copySize = Math.Min(data.Length, _buffer.Length - _offset);
|
||||
data.Slice(0, copySize).CopyTo(new Span<int>(_buffer).Slice(_offset, copySize));
|
||||
data[..copySize].CopyTo(new Span<int>(_buffer).Slice(_offset, copySize));
|
||||
|
||||
_offset += copySize;
|
||||
|
||||
@ -169,11 +169,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
{
|
||||
var memoryManager = _channel.MemoryManager;
|
||||
|
||||
var data = MemoryMarshal.Cast<int, byte>(_buffer).Slice(0, _size);
|
||||
var data = MemoryMarshal.Cast<int, byte>(_buffer)[.._size];
|
||||
|
||||
if (_isLinear && _lineCount == 1)
|
||||
{
|
||||
memoryManager.WriteTrackedResource(_dstGpuVa, data.Slice(0, _lineLengthIn));
|
||||
memoryManager.WriteTrackedResource(_dstGpuVa, data[.._lineLengthIn]);
|
||||
_context.AdvanceSequence();
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,7 @@
|
||||
// This file was auto-generated from NVIDIA official Maxwell definitions.
|
||||
|
||||
using Ryujinx.Common.Memory;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
{
|
||||
/// <summary>
|
||||
@ -111,24 +113,24 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
/// </summary>
|
||||
unsafe struct InlineToMemoryClassState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint SetObject;
|
||||
public int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public fixed uint Reserved04[63];
|
||||
public uint NoOperation;
|
||||
public uint SetNotifyA;
|
||||
public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
|
||||
public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
|
||||
public uint SetNotifyB;
|
||||
public uint Notify;
|
||||
public NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public readonly NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public uint WaitForIdle;
|
||||
public fixed uint Reserved114[7];
|
||||
public uint SetGlobalRenderEnableA;
|
||||
public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public uint SetGlobalRenderEnableB;
|
||||
public uint SetGlobalRenderEnableC;
|
||||
public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public uint SendGoIdle;
|
||||
public uint PmTrigger;
|
||||
public uint PmTriggerWfi;
|
||||
@ -139,34 +141,34 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
public uint LineLengthIn;
|
||||
public uint LineCount;
|
||||
public uint OffsetOutUpper;
|
||||
public int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
|
||||
public readonly int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
|
||||
public uint OffsetOut;
|
||||
public uint PitchOut;
|
||||
public uint SetDstBlockSize;
|
||||
public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public readonly SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public uint SetDstWidth;
|
||||
public uint SetDstHeight;
|
||||
public uint SetDstDepth;
|
||||
public uint SetDstLayer;
|
||||
public uint SetDstOriginBytesX;
|
||||
public int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
|
||||
public readonly int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
|
||||
public uint SetDstOriginSamplesY;
|
||||
public int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
|
||||
public readonly int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
|
||||
public uint LaunchDma;
|
||||
public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
|
||||
public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
|
||||
public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
|
||||
public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
|
||||
public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
|
||||
public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
|
||||
public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
|
||||
public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
|
||||
public readonly LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
|
||||
public readonly LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
|
||||
public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
|
||||
public readonly LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
|
||||
public readonly bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
|
||||
public readonly LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
|
||||
public readonly LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
|
||||
public readonly bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
|
||||
public uint LoadInlineData;
|
||||
public fixed uint Reserved1B8[9];
|
||||
public uint SetI2mSemaphoreA;
|
||||
public int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
|
||||
public readonly int SetI2mSemaphoreAOffsetUpper => (int)(SetI2mSemaphoreA & 0xFF);
|
||||
public uint SetI2mSemaphoreB;
|
||||
public uint SetI2mSemaphoreC;
|
||||
public fixed uint Reserved1E8[2];
|
||||
@ -175,7 +177,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
|
||||
public uint SetI2mSpareNoop02;
|
||||
public uint SetI2mSpareNoop03;
|
||||
public fixed uint Reserved200[3200];
|
||||
public MmeShadowScratch SetMmeShadowScratch;
|
||||
public Array256<uint> SetMmeShadowScratch;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,6 @@
|
||||
BitfieldReplace = 2,
|
||||
BitfieldExtractLslImm = 3,
|
||||
BitfieldExtractLslReg = 4,
|
||||
ReadImmediate = 5
|
||||
ReadImmediate = 5,
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@
|
||||
BitwiseOr = 9,
|
||||
BitwiseAnd = 10,
|
||||
BitwiseAndNot = 11,
|
||||
BitwiseNotAnd = 12
|
||||
BitwiseNotAnd = 12,
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@
|
||||
MoveAndSend = 4,
|
||||
FetchAndSetMaddr = 5,
|
||||
MoveAndSetMaddrThenFetchAndSend = 6,
|
||||
MoveAndSetMaddrThenSendHigh = 7
|
||||
MoveAndSetMaddrThenSendHigh = 7,
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
|
||||
if (_executionEngine == null)
|
||||
{
|
||||
if (GraphicsConfig.EnableMacroHLE && MacroHLETable.TryGetMacroHLEFunction(code.Slice(Position), context.Capabilities, out _hleFunction))
|
||||
if (GraphicsConfig.EnableMacroHLE && MacroHLETable.TryGetMacroHLEFunction(code[Position..], context.Capabilities, out _hleFunction))
|
||||
{
|
||||
_executionEngine = new MacroHLE(processor, _hleFunction);
|
||||
}
|
||||
@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
if (_executionPending)
|
||||
{
|
||||
_executionPending = false;
|
||||
_executionEngine?.Execute(code.Slice(Position), state, _argument);
|
||||
_executionEngine?.Execute(code[Position..], state, _argument);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
/// </summary>
|
||||
/// <param name="gpuVa">GPU virtual address where the command word is located</param>
|
||||
/// <param name="argument">Argument to be pushed</param>
|
||||
public void PushArgument(ulong gpuVa, int argument)
|
||||
public readonly void PushArgument(ulong gpuVa, int argument)
|
||||
{
|
||||
_executionEngine?.Fifo.Enqueue(new FifoWord(gpuVa, argument));
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
private const int ColorStructSize = 0x40;
|
||||
private const int ZetaLayerCountOffset = 0x1230;
|
||||
|
||||
private const int IndirectDataEntrySize = 0x10;
|
||||
private const int IndirectIndexedDataEntrySize = 0x14;
|
||||
|
||||
private readonly GPFifoProcessor _processor;
|
||||
@ -262,10 +261,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
for (int i = 0; i < maxDrawCount; i++)
|
||||
{
|
||||
var count = FetchParam();
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
var instanceCount = FetchParam();
|
||||
var firstIndex = FetchParam();
|
||||
var firstVertex = FetchParam();
|
||||
var firstInstance = FetchParam();
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
|
@ -11,6 +11,6 @@
|
||||
DrawArraysInstanced,
|
||||
DrawElementsInstanced,
|
||||
DrawElementsIndirect,
|
||||
MultiDrawElementsIndirectCount
|
||||
MultiDrawElementsIndirectCount,
|
||||
}
|
||||
}
|
||||
|
@ -46,12 +46,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
|
||||
private static readonly TableEntry[] _table = new TableEntry[]
|
||||
{
|
||||
new TableEntry(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28),
|
||||
new TableEntry(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24),
|
||||
new TableEntry(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48),
|
||||
new TableEntry(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c),
|
||||
new TableEntry(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c),
|
||||
new TableEntry(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C)
|
||||
new(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28),
|
||||
new(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24),
|
||||
new(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48),
|
||||
new(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c),
|
||||
new(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c),
|
||||
new(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
{
|
||||
ref var entry = ref _table[i];
|
||||
|
||||
var hash = XXHash128.ComputeHash(mc.Slice(0, entry.Length));
|
||||
var hash = XXHash128.ComputeHash(mc[..entry.Length]);
|
||||
if (hash == entry.Hash)
|
||||
{
|
||||
if (IsMacroHLESupported(caps, entry.Name))
|
||||
|
@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
/// </summary>
|
||||
public Queue<FifoWord> Fifo { get; }
|
||||
|
||||
private int[] _gprs;
|
||||
private readonly int[] _gprs;
|
||||
|
||||
private int _methAddr;
|
||||
private int _methIncr;
|
||||
@ -291,11 +291,16 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
|
||||
return (int)result;
|
||||
|
||||
case AluRegOperation.BitwiseExclusiveOr: return a ^ b;
|
||||
case AluRegOperation.BitwiseOr: return a | b;
|
||||
case AluRegOperation.BitwiseAnd: return a & b;
|
||||
case AluRegOperation.BitwiseAndNot: return a & ~b;
|
||||
case AluRegOperation.BitwiseNotAnd: return ~(a & b);
|
||||
case AluRegOperation.BitwiseExclusiveOr:
|
||||
return a ^ b;
|
||||
case AluRegOperation.BitwiseOr:
|
||||
return a | b;
|
||||
case AluRegOperation.BitwiseAnd:
|
||||
return a & b;
|
||||
case AluRegOperation.BitwiseAndNot:
|
||||
return a & ~b;
|
||||
case AluRegOperation.BitwiseNotAnd:
|
||||
return ~(a & b);
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Invalid operation \"{aluOp}\" on instruction 0x{_opCode:X8}.");
|
||||
@ -380,7 +385,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
/// <param name="state">Current GPU state</param>
|
||||
/// <param name="reg">Register offset to read</param>
|
||||
/// <returns>GPU register value</returns>
|
||||
private int Read(IDeviceState state, int reg)
|
||||
private static int Read(IDeviceState state, int reg)
|
||||
{
|
||||
return state.Read(reg * 4);
|
||||
}
|
||||
@ -397,4 +402,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
_methAddr += _methIncr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
/// </summary>
|
||||
class MacroJit : IMacroEE
|
||||
{
|
||||
private readonly MacroJitContext _context = new MacroJitContext();
|
||||
private readonly MacroJitContext _context = new();
|
||||
|
||||
/// <summary>
|
||||
/// Arguments FIFO.
|
||||
@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
{
|
||||
if (_execute == null)
|
||||
{
|
||||
MacroJitCompiler compiler = new MacroJitCompiler();
|
||||
MacroJitCompiler compiler = new();
|
||||
|
||||
_execute = compiler.Compile(code);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
/// <returns>Delegate of the host compiled code</returns>
|
||||
public MacroExecute Compile(ReadOnlySpan<int> code)
|
||||
{
|
||||
Dictionary<int, Label> labels = new Dictionary<int, Label>();
|
||||
Dictionary<int, Label> labels = new();
|
||||
|
||||
int lastTarget = 0;
|
||||
int i;
|
||||
|
@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
|
||||
/// <summary>
|
||||
/// Arguments FIFO.
|
||||
/// </summary>
|
||||
public Queue<FifoWord> Fifo { get; } = new Queue<FifoWord>();
|
||||
public Queue<FifoWord> Fifo { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Fetches a arguments from the arguments FIFO.
|
||||
|
@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
||||
[StructLayout(LayoutKind.Sequential, Size = 1024)]
|
||||
struct MmeShadowScratch
|
||||
{
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS0169 // The private field is never used
|
||||
private uint _e0;
|
||||
#pragma warning restore CS0169
|
||||
public ref uint this[int index] => ref AsSpan()[index];
|
||||
|
@ -10,4 +10,4 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
||||
MethodPassthrough = 2,
|
||||
MethodReplay = 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
||||
{
|
||||
return format switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
TextureFormat.R8Unorm => Format.R8Unorm,
|
||||
TextureFormat.R8Snorm => Format.R8Snorm,
|
||||
TextureFormat.R8Uint => Format.R8Uint,
|
||||
@ -104,7 +105,8 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
||||
TextureFormat.R10G10B10A2Unorm => Format.R10G10B10A2Unorm,
|
||||
TextureFormat.R10G10B10A2Uint => Format.R10G10B10A2Uint,
|
||||
TextureFormat.R11G11B10Float => Format.R11G11B10Float,
|
||||
_ => 0
|
||||
_ => 0,
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -209,14 +209,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
new AdvancedBlendUcode(AdvancedBlendOp.HslHue, AdvancedBlendOverlap.Conjoint, false, GenConjointHslHue),
|
||||
new AdvancedBlendUcode(AdvancedBlendOp.HslSaturation, AdvancedBlendOverlap.Conjoint, false, GenConjointHslSaturation),
|
||||
new AdvancedBlendUcode(AdvancedBlendOp.HslColor, AdvancedBlendOverlap.Conjoint, false, GenConjointHslColor),
|
||||
new AdvancedBlendUcode(AdvancedBlendOp.HslLuminosity, AdvancedBlendOverlap.Conjoint, false, GenConjointHslLuminosity)
|
||||
new AdvancedBlendUcode(AdvancedBlendOp.HslLuminosity, AdvancedBlendOverlap.Conjoint, false, GenConjointHslLuminosity),
|
||||
};
|
||||
|
||||
public static string GenTable()
|
||||
{
|
||||
// This can be used to generate the table on AdvancedBlendPreGenTable.
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.AppendLine($"private static Dictionary<Hash128, AdvancedBlendEntry> _entries = new()");
|
||||
sb.AppendLine("{");
|
||||
@ -4223,4 +4223,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
return new FixedFunctionAlpha(BlendOp.MaximumGl, BlendFactor.OneGl, BlendFactor.OneGl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
/// <returns>True if the function was found, false otherwise</returns>
|
||||
public bool TryGetAdvancedBlend(out AdvancedBlendDescriptor descriptor)
|
||||
{
|
||||
Span<uint> currentCode = new Span<uint>(_code);
|
||||
Span<uint> currentCode = new(_code);
|
||||
byte codeLength = (byte)_state.State.BlendUcodeSize;
|
||||
|
||||
if (currentCode.Length > codeLength)
|
||||
{
|
||||
currentCode = currentCode.Slice(0, codeLength);
|
||||
currentCode = currentCode[..codeLength];
|
||||
}
|
||||
|
||||
Hash128 hash = XXHash128.ComputeHash(MemoryMarshal.Cast<uint, byte>(currentCode));
|
||||
@ -112,4 +112,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
/// <summary>
|
||||
/// Advanced blend function entry.
|
||||
/// </summary>
|
||||
struct AdvancedBlendEntry
|
||||
readonly struct AdvancedBlendEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Advanced blend operation.
|
||||
@ -270,4 +270,4 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
{ new Hash128(0x8652300E32D93050, 0x9460E7B449132371), new AdvancedBlendEntry(AdvancedBlendOp.HslLuminosity, AdvancedBlendOverlap.Conjoint, false, new[] { new RgbFloat(0.3f, 0.59f, 0.11f) }, new FixedFunctionAlpha(BlendUcodeEnable.EnableRGB, BlendOp.MaximumGl, BlendFactor.OneGl, BlendFactor.OneGl)) },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
/// <summary>
|
||||
/// Fixed function alpha state used for a advanced blend function.
|
||||
/// </summary>
|
||||
struct FixedFunctionAlpha
|
||||
readonly struct FixedFunctionAlpha
|
||||
{
|
||||
/// <summary>
|
||||
/// Fixed function alpha state with alpha blending disabled.
|
||||
/// </summary>
|
||||
public static FixedFunctionAlpha Disabled => new FixedFunctionAlpha(BlendUcodeEnable.EnableRGBA, default, default, default);
|
||||
public static FixedFunctionAlpha Disabled => new(BlendUcodeEnable.EnableRGBA, default, default, default);
|
||||
|
||||
/// <summary>
|
||||
/// Individual enable bits for the RGB and alpha components.
|
||||
@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
/// <summary>
|
||||
/// Advanced blend microcode state.
|
||||
/// </summary>
|
||||
struct AdvancedBlendUcode
|
||||
readonly struct AdvancedBlendUcode
|
||||
{
|
||||
/// <summary>
|
||||
/// Advanced blend operation.
|
||||
@ -117,10 +117,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
Overlap = overlap;
|
||||
SrcPreMultiplied = srcPreMultiplied;
|
||||
|
||||
UcodeAssembler asm = new UcodeAssembler();
|
||||
UcodeAssembler asm = new();
|
||||
Alpha = genFunc(ref asm);
|
||||
Code = asm.GetCode();
|
||||
Constants = asm.GetConstants();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
Max = 3,
|
||||
Rcp = 4,
|
||||
Add = 5,
|
||||
Sub = 6
|
||||
Sub = 6,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
LT = 4,
|
||||
LE = 5,
|
||||
GT = 6,
|
||||
GE = 7
|
||||
GE = 7,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
Temp1 = 0xa,
|
||||
Temp2 = 0xb,
|
||||
PBR = 0xc,
|
||||
ConstantRGB = 0xd
|
||||
ConstantRGB = 0xd,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -64,7 +64,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
Temp0 = 4,
|
||||
Temp1 = 5,
|
||||
Temp2 = 6,
|
||||
PBR = 7
|
||||
PBR = 7,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -75,7 +75,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
Temp0 = 0,
|
||||
Temp1 = 1,
|
||||
Temp2 = 2,
|
||||
PBR = 3
|
||||
PBR = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
RRR = 2,
|
||||
GGG = 3,
|
||||
BBB = 4,
|
||||
RToA = 5
|
||||
RToA = 5,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -99,13 +99,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
RGB = 0,
|
||||
R = 1,
|
||||
G = 2,
|
||||
B = 3
|
||||
B = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floating-point RGB color values.
|
||||
/// </summary>
|
||||
struct RgbFloat
|
||||
readonly struct RgbFloat
|
||||
{
|
||||
/// <summary>
|
||||
/// Red component value.
|
||||
@ -139,24 +139,24 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
/// <summary>
|
||||
/// Blend microcode destination operand, including swizzle, write mask and condition code update flag.
|
||||
/// </summary>
|
||||
struct Dest
|
||||
readonly struct Dest
|
||||
{
|
||||
public static Dest Temp0 => new Dest(OpDst.Temp0, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest Temp1 => new Dest(OpDst.Temp1, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest Temp2 => new Dest(OpDst.Temp2, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest PBR => new Dest(OpDst.PBR, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest Temp0 => new(OpDst.Temp0, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest Temp1 => new(OpDst.Temp1, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest Temp2 => new(OpDst.Temp2, Swizzle.RGB, WriteMask.RGB, false);
|
||||
public static Dest PBR => new(OpDst.PBR, Swizzle.RGB, WriteMask.RGB, false);
|
||||
|
||||
public Dest GBR => new Dest(Dst, Swizzle.GBR, WriteMask, WriteCC);
|
||||
public Dest RRR => new Dest(Dst, Swizzle.RRR, WriteMask, WriteCC);
|
||||
public Dest GGG => new Dest(Dst, Swizzle.GGG, WriteMask, WriteCC);
|
||||
public Dest BBB => new Dest(Dst, Swizzle.BBB, WriteMask, WriteCC);
|
||||
public Dest RToA => new Dest(Dst, Swizzle.RToA, WriteMask, WriteCC);
|
||||
public Dest GBR => new(Dst, Swizzle.GBR, WriteMask, WriteCC);
|
||||
public Dest RRR => new(Dst, Swizzle.RRR, WriteMask, WriteCC);
|
||||
public Dest GGG => new(Dst, Swizzle.GGG, WriteMask, WriteCC);
|
||||
public Dest BBB => new(Dst, Swizzle.BBB, WriteMask, WriteCC);
|
||||
public Dest RToA => new(Dst, Swizzle.RToA, WriteMask, WriteCC);
|
||||
|
||||
public Dest R => new Dest(Dst, Swizzle, WriteMask.R, WriteCC);
|
||||
public Dest G => new Dest(Dst, Swizzle, WriteMask.G, WriteCC);
|
||||
public Dest B => new Dest(Dst, Swizzle, WriteMask.B, WriteCC);
|
||||
public Dest R => new(Dst, Swizzle, WriteMask.R, WriteCC);
|
||||
public Dest G => new(Dst, Swizzle, WriteMask.G, WriteCC);
|
||||
public Dest B => new(Dst, Swizzle, WriteMask.B, WriteCC);
|
||||
|
||||
public Dest CC => new Dest(Dst, Swizzle, WriteMask, true);
|
||||
public Dest CC => new(Dst, Swizzle, WriteMask, true);
|
||||
|
||||
public OpDst Dst { get; }
|
||||
public Swizzle Swizzle { get; }
|
||||
@ -182,7 +182,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
/// <summary>
|
||||
/// Blend microcode operaiton.
|
||||
/// </summary>
|
||||
struct UcodeOp
|
||||
readonly struct UcodeOp
|
||||
{
|
||||
public readonly uint Word;
|
||||
|
||||
@ -292,14 +292,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
|
||||
_constantIndex = index;
|
||||
}
|
||||
|
||||
public uint[] GetCode()
|
||||
public readonly uint[] GetCode()
|
||||
{
|
||||
return _code?.ToArray();
|
||||
}
|
||||
|
||||
public RgbFloat[] GetConstants()
|
||||
public readonly RgbFloat[] GetConstants()
|
||||
{
|
||||
return _constants;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
private ulong _ubFollowUpAddress = 0;
|
||||
private ulong _ubByteCount = 0;
|
||||
private int _ubIndex = 0;
|
||||
private int[] _ubData = new int[UniformDataCacheSize];
|
||||
private readonly int[] _ubData = new int[UniformDataCacheSize];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the constant buffer updater.
|
||||
|
@ -186,7 +186,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
int firstVertex = (int)_state.State.FirstVertex;
|
||||
|
||||
BufferRange br = new BufferRange(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
|
||||
BufferRange br = new(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
|
||||
|
||||
_channel.BufferManager.SetIndexBuffer(br, IndexType.UInt);
|
||||
|
||||
@ -200,7 +200,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
var drawState = _state.State.VertexBufferDrawState;
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
_context.Renderer.Pipeline.Draw(drawVertexCount, 1, drawFirstVertex, firstInstance);
|
||||
}
|
||||
@ -679,7 +681,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
if (indexedInline)
|
||||
{
|
||||
int inlineIndexCount = _drawState.IbStreamer.GetAndResetInlineIndexCount(_context.Renderer);
|
||||
BufferRange br = new BufferRange(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
|
||||
BufferRange br = new(_drawState.IbStreamer.GetInlineIndexBuffer(), 0, inlineIndexCount * 4);
|
||||
|
||||
_channel.BufferManager.SetIndexBuffer(br, IndexType.UInt);
|
||||
}
|
||||
@ -809,7 +811,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
Span<Rectangle<int>> scissors = stackalloc Rectangle<int>[]
|
||||
{
|
||||
new Rectangle<int>(scissorX, scissorY, scissorW, scissorH)
|
||||
new Rectangle<int>(scissorX, scissorY, scissorW, scissorH),
|
||||
};
|
||||
|
||||
_context.Renderer.Pipeline.SetScissors(scissors);
|
||||
@ -821,7 +823,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
var clearColor = _state.State.ClearColors;
|
||||
|
||||
ColorF color = new ColorF(clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha);
|
||||
ColorF color = new(clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha);
|
||||
|
||||
_context.Renderer.Pipeline.ClearRenderTargetColor(index, layer, layerCount, componentMask, color);
|
||||
}
|
||||
|
@ -60,6 +60,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// <summary>
|
||||
/// Index buffer data streamer for inline index buffer updates, such as those used in legacy OpenGL.
|
||||
/// </summary>
|
||||
public IbStreamer IbStreamer = new IbStreamer();
|
||||
public IbStreamer IbStreamer = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
@ -17,33 +16,35 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
private int _inlineIndexBufferSize;
|
||||
private int _inlineIndexCount;
|
||||
private uint[] _buffer;
|
||||
private int _bufferOffset;
|
||||
#pragma warning disable IDE0051 // Remove unused private member
|
||||
private readonly int _bufferOffset;
|
||||
#pragma warning restore IDE0051
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if any index buffer data has been pushed.
|
||||
/// </summary>
|
||||
public bool HasInlineIndexData => _inlineIndexCount != 0;
|
||||
public readonly bool HasInlineIndexData => _inlineIndexCount != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Total numbers of indices that have been pushed.
|
||||
/// </summary>
|
||||
public int InlineIndexCount => _inlineIndexCount;
|
||||
public readonly int InlineIndexCount => _inlineIndexCount;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the handle for the host buffer currently holding the inline index buffer data.
|
||||
/// </summary>
|
||||
/// <returns>Host buffer handle</returns>
|
||||
public BufferHandle GetInlineIndexBuffer()
|
||||
public readonly BufferHandle GetInlineIndexBuffer()
|
||||
{
|
||||
return _inlineIndexBuffer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of elements on the current inline index buffer,
|
||||
/// while also reseting it to zero for the next draw.
|
||||
/// while also resetting it to zero for the next draw.
|
||||
/// </summary>
|
||||
/// <param name="renderer">Host renderer</param>
|
||||
/// <returns>Inline index bufffer count</returns>
|
||||
/// <returns>Inline index buffer count</returns>
|
||||
public int GetAndResetInlineIndexCount(IRenderer renderer)
|
||||
{
|
||||
UpdateRemaining(renderer);
|
||||
@ -114,10 +115,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// <param name="value">Index value to be written</param>
|
||||
private void PushData(IRenderer renderer, int offset, uint value)
|
||||
{
|
||||
if (_buffer == null)
|
||||
{
|
||||
_buffer = new uint[BufferCapacity];
|
||||
}
|
||||
_buffer ??= new uint[BufferCapacity];
|
||||
|
||||
// We upload data in chunks.
|
||||
// If we are at the start of a chunk, then the buffer might be full,
|
||||
@ -155,7 +153,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
int baseOffset = (offset - count) * sizeof(uint);
|
||||
int length = count * sizeof(uint);
|
||||
BufferHandle buffer = GetInlineIndexBuffer(renderer, baseOffset, length);
|
||||
renderer.SetBufferData(buffer, baseOffset, MemoryMarshal.Cast<uint, byte>(_buffer).Slice(0, length));
|
||||
renderer.SetBufferData(buffer, baseOffset, MemoryMarshal.Cast<uint, byte>(_buffer)[..length]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
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>
|
||||
@ -33,6 +36,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// <summary>
|
||||
/// Draw count flag.
|
||||
/// </summary>
|
||||
Count = 1 << 1
|
||||
Count = 1 << 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// <summary>
|
||||
/// Default update flags for draw.
|
||||
/// </summary>
|
||||
UpdateAll = UseControl | UpdateDepthStencil
|
||||
UpdateAll = UseControl | UpdateDepthStencil,
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
@ -15,7 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
Release = 0,
|
||||
Acquire = 1,
|
||||
Counter = 2
|
||||
Counter = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -37,7 +36,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
ClipperInputPrimitives = 0x1c,
|
||||
ClipperOutputPrimitives = 0x1d,
|
||||
FragmentShaderInvocations = 0x1e,
|
||||
PrimitivesGenerated = 0x1f
|
||||
PrimitivesGenerated = 0x1f,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -64,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
TransformFeedbackOffset = 0x1a,
|
||||
TessControlShaderInvocations = 0x1b,
|
||||
TessEvaluationShaderInvocations = 0x1d,
|
||||
TessEvaluationShaderPrimitives = 0x1f
|
||||
TessEvaluationShaderPrimitives = 0x1f,
|
||||
}
|
||||
|
||||
private readonly GpuContext _context;
|
||||
@ -117,8 +116,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case SemaphoreOperation.Release: ReleaseSemaphore(); break;
|
||||
case SemaphoreOperation.Counter: ReportCounter(type); break;
|
||||
case SemaphoreOperation.Release:
|
||||
ReleaseSemaphore();
|
||||
break;
|
||||
case SemaphoreOperation.Counter:
|
||||
ReportCounter(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,10 +159,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
void resultHandler(object evt, ulong result)
|
||||
{
|
||||
CounterData counterData = new CounterData
|
||||
CounterData counterData = new()
|
||||
{
|
||||
Counter = result,
|
||||
Timestamp = ticks
|
||||
Timestamp = ticks,
|
||||
};
|
||||
|
||||
if (counter?.Invalid != true)
|
||||
|
@ -227,7 +227,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
VertexAttribType.Sint => AttributeType.Sint,
|
||||
VertexAttribType.Uint => AttributeType.Uint,
|
||||
_ => AttributeType.Float
|
||||
_ => AttributeType.Float,
|
||||
};
|
||||
|
||||
if (attributeTypes[location] != value)
|
||||
|
@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
private readonly ShaderProgramInfo[] _currentProgramInfo;
|
||||
private ShaderSpecializationState _shaderSpecState;
|
||||
private SpecializationStateUpdater _currentSpecState;
|
||||
private readonly SpecializationStateUpdater _currentSpecState;
|
||||
|
||||
private ProgramPipelineState _pipeline;
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
private uint _vbEnableMask;
|
||||
|
||||
private bool _prevDrawIndexed;
|
||||
private bool _prevDrawIndirect;
|
||||
private readonly bool _prevDrawIndirect;
|
||||
private IndexType _prevIndexType;
|
||||
private uint _prevFirstVertex;
|
||||
private bool _prevTfEnable;
|
||||
@ -448,7 +448,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
int samplesInY = msaaMode.SamplesInY();
|
||||
|
||||
var scissor = _state.State.ScreenScissorState;
|
||||
Size sizeHint = new Size((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
|
||||
Size sizeHint = new((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
|
||||
|
||||
int clipRegionWidth = int.MaxValue;
|
||||
int clipRegionHeight = int.MaxValue;
|
||||
@ -669,7 +669,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateDepthTestState()
|
||||
{
|
||||
DepthTestDescriptor descriptor = new DepthTestDescriptor(
|
||||
DepthTestDescriptor descriptor = new(
|
||||
_state.State.DepthTestEnable,
|
||||
_state.State.DepthWriteEnable,
|
||||
_state.State.DepthTestFunc);
|
||||
@ -739,7 +739,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
height *= scale;
|
||||
}
|
||||
|
||||
Rectangle<float> region = new Rectangle<float>(x, y, width, height);
|
||||
Rectangle<float> region = new(x, y, width, height);
|
||||
|
||||
ViewportSwizzle swizzleX = transform.UnpackSwizzleX();
|
||||
ViewportSwizzle swizzleY = transform.UnpackSwizzleY();
|
||||
@ -751,9 +751,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
if (transform.ScaleZ < 0)
|
||||
{
|
||||
float temp = depthNear;
|
||||
depthNear = depthFar;
|
||||
depthFar = temp;
|
||||
(depthFar, depthNear) = (depthNear, depthFar);
|
||||
}
|
||||
|
||||
viewports[index] = new Viewport(region, swizzleX, swizzleY, swizzleZ, swizzleW, depthNear, depthFar);
|
||||
@ -845,7 +843,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
backMask = test.FrontMask;
|
||||
}
|
||||
|
||||
StencilTestDescriptor descriptor = new StencilTestDescriptor(
|
||||
StencilTestDescriptor descriptor = new(
|
||||
test.Enable,
|
||||
test.FrontFunc,
|
||||
test.FrontSFail,
|
||||
@ -939,7 +937,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
VertexAttribType.Sint => Format.R32G32B32A32Sint,
|
||||
VertexAttribType.Uint => Format.R32G32B32A32Uint,
|
||||
_ => Format.R32G32B32A32Float
|
||||
_ => Format.R32G32B32A32Float,
|
||||
};
|
||||
}
|
||||
|
||||
@ -1017,8 +1015,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
switch (indexBuffer.Type)
|
||||
{
|
||||
case IndexType.UShort: size *= 2; break;
|
||||
case IndexType.UInt: size *= 4; break;
|
||||
case IndexType.UShort:
|
||||
size *= 2;
|
||||
break;
|
||||
case IndexType.UInt:
|
||||
size *= 4;
|
||||
break;
|
||||
}
|
||||
|
||||
_channel.BufferManager.SetIndexBuffer(gpuVa, size, indexBuffer.Type);
|
||||
@ -1338,7 +1340,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
_vtgWritesRtLayer = false;
|
||||
|
||||
ShaderAddresses addresses = new ShaderAddresses();
|
||||
ShaderAddresses addresses = new();
|
||||
Span<ulong> addressesSpan = addresses.AsSpan();
|
||||
|
||||
ulong baseAddress = _state.State.ShaderBaseAddress.Pack();
|
||||
@ -1453,7 +1455,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
// ScaleZ = (Far - Near) / 2
|
||||
// DepthNear/Far are sorted such as that Near is always less than Far.
|
||||
depthMode = extents.DepthNear != transform.TranslateZ &&
|
||||
extents.DepthFar != transform.TranslateZ
|
||||
extents.DepthFar != transform.TranslateZ
|
||||
? DepthMode.MinusOneToOne
|
||||
: DepthMode.ZeroToOne;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{ nameof(ThreedClassState.UniformBufferBindTessControl), new RwCallback(ConstantBufferBindTessControl, null) },
|
||||
{ nameof(ThreedClassState.UniformBufferBindTessEvaluation), new RwCallback(ConstantBufferBindTessEvaluation, null) },
|
||||
{ nameof(ThreedClassState.UniformBufferBindGeometry), new RwCallback(ConstantBufferBindGeometry, null) },
|
||||
{ nameof(ThreedClassState.UniformBufferBindFragment), new RwCallback(ConstantBufferBindFragment, null) }
|
||||
{ nameof(ThreedClassState.UniformBufferBindFragment), new RwCallback(ConstantBufferBindFragment, null) },
|
||||
});
|
||||
|
||||
_i2mClass = new InlineToMemoryClass(context, channel, initializeState: false);
|
||||
|
@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
TessellationControl,
|
||||
TessellationEvaluation,
|
||||
Geometry,
|
||||
Fragment
|
||||
Fragment,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct TessMode
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Packed;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the tessellation abstract patch type.
|
||||
/// </summary>
|
||||
/// <returns>Abtract patch type</returns>
|
||||
public TessPatchType UnpackPatchType()
|
||||
public readonly TessPatchType UnpackPatchType()
|
||||
{
|
||||
return (TessPatchType)(Packed & 3);
|
||||
}
|
||||
@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the spacing between tessellated vertices of the patch.
|
||||
/// </summary>
|
||||
/// <returns>Spacing between tessellated vertices</returns>
|
||||
public TessSpacing UnpackSpacing()
|
||||
public readonly TessSpacing UnpackSpacing()
|
||||
{
|
||||
return (TessSpacing)((Packed >> 4) & 3);
|
||||
}
|
||||
@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the primitive winding order.
|
||||
/// </summary>
|
||||
/// <returns>True if clockwise, false if counter-clockwise</returns>
|
||||
public bool UnpackCw()
|
||||
public readonly bool UnpackCw()
|
||||
{
|
||||
return (Packed & (1 << 8)) != 0;
|
||||
}
|
||||
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct TfBufferState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 Enable;
|
||||
public GpuVa Address;
|
||||
public int Size;
|
||||
@ -79,7 +79,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct TfState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int BufferIndex;
|
||||
public int VaryingsCount;
|
||||
public int Stride;
|
||||
@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct RtColorState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public GpuVa Address;
|
||||
public int WidthOrStride;
|
||||
public int Height;
|
||||
@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct ViewportTransform
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public float ScaleX;
|
||||
public float ScaleY;
|
||||
public float ScaleZ;
|
||||
@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks viewport swizzle of the position X component.
|
||||
/// </summary>
|
||||
/// <returns>Swizzle enum value</returns>
|
||||
public ViewportSwizzle UnpackSwizzleX()
|
||||
public readonly ViewportSwizzle UnpackSwizzleX()
|
||||
{
|
||||
return (ViewportSwizzle)(Swizzle & 7);
|
||||
}
|
||||
@ -140,7 +140,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks viewport swizzle of the position Y component.
|
||||
/// </summary>
|
||||
/// <returns>Swizzle enum value</returns>
|
||||
public ViewportSwizzle UnpackSwizzleY()
|
||||
public readonly ViewportSwizzle UnpackSwizzleY()
|
||||
{
|
||||
return (ViewportSwizzle)((Swizzle >> 4) & 7);
|
||||
}
|
||||
@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks viewport swizzle of the position Z component.
|
||||
/// </summary>
|
||||
/// <returns>Swizzle enum value</returns>
|
||||
public ViewportSwizzle UnpackSwizzleZ()
|
||||
public readonly ViewportSwizzle UnpackSwizzleZ()
|
||||
{
|
||||
return (ViewportSwizzle)((Swizzle >> 8) & 7);
|
||||
}
|
||||
@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks viewport swizzle of the position W component.
|
||||
/// </summary>
|
||||
/// <returns>Swizzle enum value</returns>
|
||||
public ViewportSwizzle UnpackSwizzleW()
|
||||
public readonly ViewportSwizzle UnpackSwizzleW()
|
||||
{
|
||||
return (ViewportSwizzle)((Swizzle >> 12) & 7);
|
||||
}
|
||||
@ -169,7 +169,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct ViewportExtents
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public ushort X;
|
||||
public ushort Width;
|
||||
public ushort Y;
|
||||
@ -184,7 +184,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct VertexBufferDrawState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int First;
|
||||
public int Count;
|
||||
#pragma warning restore CS0649
|
||||
@ -195,7 +195,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct ClearColors
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public float Red;
|
||||
public float Green;
|
||||
public float Blue;
|
||||
@ -208,7 +208,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct DepthBiasState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 PointEnable;
|
||||
public Boolean32 LineEnable;
|
||||
public Boolean32 FillEnable;
|
||||
@ -223,7 +223,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
Disabled = 0,
|
||||
EnableRGB = 1,
|
||||
EnableAlpha = 2,
|
||||
EnableRGBA = 3
|
||||
EnableRGBA = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct ScissorState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 Enable;
|
||||
public ushort X1;
|
||||
public ushort X2;
|
||||
@ -246,7 +246,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct StencilBackMasks
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int FuncRef;
|
||||
public int Mask;
|
||||
public int FuncMask;
|
||||
@ -258,7 +258,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct RtDepthStencilState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public GpuVa Address;
|
||||
public ZetaFormat Format;
|
||||
public MemoryLayout MemoryLayout;
|
||||
@ -271,7 +271,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct ScreenScissorState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public ushort X;
|
||||
public ushort Width;
|
||||
public ushort Y;
|
||||
@ -297,7 +297,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
Size16 = 0x1b,
|
||||
Size8 = 0x1d,
|
||||
Rgb10A2 = 0x30,
|
||||
Rg11B10 = 0x31
|
||||
Rg11B10 = 0x31,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -311,7 +311,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
Uint = 4,
|
||||
Uscaled = 5,
|
||||
Sscaled = 6,
|
||||
Float = 7
|
||||
Float = 7,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -319,7 +319,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct VertexAttribState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Attribute;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
@ -327,7 +327,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the index of the vertex buffer this attribute belongs to.
|
||||
/// </summary>
|
||||
/// <returns>Vertex buffer index</returns>
|
||||
public int UnpackBufferIndex()
|
||||
public readonly int UnpackBufferIndex()
|
||||
{
|
||||
return (int)(Attribute & 0x1f);
|
||||
}
|
||||
@ -336,7 +336,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the attribute constant flag.
|
||||
/// </summary>
|
||||
/// <returns>True if the attribute is constant, false otherwise</returns>
|
||||
public bool UnpackIsConstant()
|
||||
public readonly bool UnpackIsConstant()
|
||||
{
|
||||
return (Attribute & 0x40) != 0;
|
||||
}
|
||||
@ -345,7 +345,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the offset, in bytes, of the attribute on the vertex buffer.
|
||||
/// </summary>
|
||||
/// <returns>Attribute offset in bytes</returns>
|
||||
public int UnpackOffset()
|
||||
public readonly int UnpackOffset()
|
||||
{
|
||||
return (int)((Attribute >> 7) & 0x3fff);
|
||||
}
|
||||
@ -354,7 +354,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the Maxwell attribute format integer.
|
||||
/// </summary>
|
||||
/// <returns>Attribute format integer</returns>
|
||||
public uint UnpackFormat()
|
||||
public readonly uint UnpackFormat()
|
||||
{
|
||||
return Attribute & 0x3fe00000;
|
||||
}
|
||||
@ -363,7 +363,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the Maxwell attribute size.
|
||||
/// </summary>
|
||||
/// <returns>Attribute size</returns>
|
||||
public VertexAttribSize UnpackSize()
|
||||
public readonly VertexAttribSize UnpackSize()
|
||||
{
|
||||
return (VertexAttribSize)((Attribute >> 21) & 0x3f);
|
||||
}
|
||||
@ -372,7 +372,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the Maxwell attribute component type.
|
||||
/// </summary>
|
||||
/// <returns>Attribute component type</returns>
|
||||
public VertexAttribType UnpackType()
|
||||
public readonly VertexAttribType UnpackType()
|
||||
{
|
||||
return (VertexAttribType)((Attribute >> 27) & 7);
|
||||
}
|
||||
@ -383,7 +383,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct RtControl
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Packed;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
@ -391,7 +391,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the number of active draw buffers.
|
||||
/// </summary>
|
||||
/// <returns>Number of active draw buffers</returns>
|
||||
public int UnpackCount()
|
||||
public readonly int UnpackCount()
|
||||
{
|
||||
return (int)(Packed & 0xf);
|
||||
}
|
||||
@ -401,7 +401,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the draw buffer</param>
|
||||
/// <returns>Attachment index</returns>
|
||||
public int UnpackPermutationIndex(int index)
|
||||
public readonly int UnpackPermutationIndex(int index)
|
||||
{
|
||||
return (int)((Packed >> (4 + index * 3)) & 7);
|
||||
}
|
||||
@ -412,7 +412,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct Size3D
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int Width;
|
||||
public int Height;
|
||||
public int Depth;
|
||||
@ -424,7 +424,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct StencilTestState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 Enable;
|
||||
public StencilOp FrontSFail;
|
||||
public StencilOp FrontDpFail;
|
||||
@ -443,7 +443,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
enum YControl
|
||||
{
|
||||
NegateY = 1 << 0,
|
||||
TriangleRastFlip = 1 << 4
|
||||
TriangleRastFlip = 1 << 4,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -451,7 +451,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct RgbHalf
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint R;
|
||||
public uint G;
|
||||
public uint B;
|
||||
@ -462,7 +462,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the red color component as a 16-bit float value.
|
||||
/// </summary>
|
||||
/// <returns>The component value</returns>
|
||||
public Half UnpackR()
|
||||
public readonly Half UnpackR()
|
||||
{
|
||||
ushort value = (ushort)R;
|
||||
return Unsafe.As<ushort, Half>(ref value);
|
||||
@ -472,7 +472,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the green color component as a 16-bit float value.
|
||||
/// </summary>
|
||||
/// <returns>The component value</returns>
|
||||
public Half UnpackG()
|
||||
public readonly Half UnpackG()
|
||||
{
|
||||
ushort value = (ushort)G;
|
||||
return Unsafe.As<ushort, Half>(ref value);
|
||||
@ -482,7 +482,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks the blue color component as a 16-bit float value.
|
||||
/// </summary>
|
||||
/// <returns>The component value</returns>
|
||||
public Half UnpackB()
|
||||
public readonly Half UnpackB()
|
||||
{
|
||||
ushort value = (ushort)B;
|
||||
return Unsafe.As<ushort, Half>(ref value);
|
||||
@ -498,7 +498,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
Always,
|
||||
ResultNonZero,
|
||||
Equal,
|
||||
NotEqual
|
||||
NotEqual,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -506,7 +506,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct PoolState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public GpuVa Address;
|
||||
public int MaximumId;
|
||||
#pragma warning restore CS0649
|
||||
@ -517,7 +517,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct StencilBackTestState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 TwoSided;
|
||||
public StencilOp BackSFail;
|
||||
public StencilOp BackDpFail;
|
||||
@ -531,7 +531,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct PrimitiveRestartState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 Enable;
|
||||
public int Index;
|
||||
#pragma warning restore CS0649
|
||||
@ -543,7 +543,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct IndexBufferState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public GpuVa Address;
|
||||
public GpuVa EndAddress;
|
||||
public IndexType Type;
|
||||
@ -556,7 +556,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct FaceState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 CullEnable;
|
||||
public FrontFace FrontFace;
|
||||
public Face CullFace;
|
||||
@ -570,7 +570,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
enum ViewVolumeClipControl
|
||||
{
|
||||
ForceDepthRangeZeroToOne = 1 << 0,
|
||||
DepthClampDisabled = 1 << 11
|
||||
DepthClampDisabled = 1 << 11,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -578,7 +578,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct LogicalOpState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 Enable;
|
||||
public LogicalOp LogicalOp;
|
||||
#pragma warning restore CS0649
|
||||
@ -590,7 +590,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct RtColorMask
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Packed;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
@ -598,7 +598,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks red channel enable.
|
||||
/// </summary>
|
||||
/// <returns>True to write the new red channel color, false to keep the old value</returns>
|
||||
public bool UnpackRed()
|
||||
public readonly bool UnpackRed()
|
||||
{
|
||||
return (Packed & 0x1) != 0;
|
||||
}
|
||||
@ -607,7 +607,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks green channel enable.
|
||||
/// </summary>
|
||||
/// <returns>True to write the new green channel color, false to keep the old value</returns>
|
||||
public bool UnpackGreen()
|
||||
public readonly bool UnpackGreen()
|
||||
{
|
||||
return (Packed & 0x10) != 0;
|
||||
}
|
||||
@ -616,7 +616,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks blue channel enable.
|
||||
/// </summary>
|
||||
/// <returns>True to write the new blue channel color, false to keep the old value</returns>
|
||||
public bool UnpackBlue()
|
||||
public readonly bool UnpackBlue()
|
||||
{
|
||||
return (Packed & 0x100) != 0;
|
||||
}
|
||||
@ -625,7 +625,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Unpacks alpha channel enable.
|
||||
/// </summary>
|
||||
/// <returns>True to write the new alpha channel color, false to keep the old value</returns>
|
||||
public bool UnpackAlpha()
|
||||
public readonly bool UnpackAlpha()
|
||||
{
|
||||
return (Packed & 0x1000) != 0;
|
||||
}
|
||||
@ -636,7 +636,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct VertexBufferState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Control;
|
||||
public GpuVa Address;
|
||||
public int Divisor;
|
||||
@ -646,7 +646,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Vertex buffer stride, defined as the number of bytes occupied by each vertex in memory.
|
||||
/// </summary>
|
||||
/// <returns>Vertex buffer stride</returns>
|
||||
public int UnpackStride()
|
||||
public readonly int UnpackStride()
|
||||
{
|
||||
return (int)(Control & 0xfff);
|
||||
}
|
||||
@ -655,7 +655,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Vertex buffer enable.
|
||||
/// </summary>
|
||||
/// <returns>True if the vertex buffer is enabled, false otherwise</returns>
|
||||
public bool UnpackEnable()
|
||||
public readonly bool UnpackEnable()
|
||||
{
|
||||
return (Control & (1 << 12)) != 0;
|
||||
}
|
||||
@ -666,7 +666,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct BlendStateCommon
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 SeparateAlpha;
|
||||
public BlendOp ColorOp;
|
||||
public BlendFactor ColorSrcFactor;
|
||||
@ -683,7 +683,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct BlendState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public Boolean32 SeparateAlpha;
|
||||
public BlendOp ColorOp;
|
||||
public BlendFactor ColorSrcFactor;
|
||||
@ -700,7 +700,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct ShaderState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Control;
|
||||
public uint Offset;
|
||||
public uint Unknown0x8;
|
||||
@ -724,7 +724,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// Must be ignored for vertex shaders, those are always enabled.
|
||||
/// </summary>
|
||||
/// <returns>True if the stage is enabled, false otherwise</returns>
|
||||
public bool UnpackEnable()
|
||||
public readonly bool UnpackEnable()
|
||||
{
|
||||
return (Control & 1) != 0;
|
||||
}
|
||||
@ -735,7 +735,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
struct UniformBufferState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int Size;
|
||||
public GpuVa Address;
|
||||
public int Offset;
|
||||
@ -744,30 +744,30 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
unsafe struct ThreedClassState : IShadowState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint SetObject;
|
||||
public int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public fixed uint Reserved04[63];
|
||||
public uint NoOperation;
|
||||
public uint SetNotifyA;
|
||||
public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
|
||||
public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0xFF);
|
||||
public uint SetNotifyB;
|
||||
public uint Notify;
|
||||
public NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public readonly NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public uint WaitForIdle;
|
||||
public uint LoadMmeInstructionRamPointer;
|
||||
public uint LoadMmeInstructionRam;
|
||||
public uint LoadMmeStartAddressRamPointer;
|
||||
public uint LoadMmeStartAddressRam;
|
||||
public uint SetMmeShadowRamControl;
|
||||
public SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
|
||||
public readonly SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
|
||||
public fixed uint Reserved128[2];
|
||||
public uint SetGlobalRenderEnableA;
|
||||
public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public uint SetGlobalRenderEnableB;
|
||||
public uint SetGlobalRenderEnableC;
|
||||
public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public uint SendGoIdle;
|
||||
public uint PmTrigger;
|
||||
public uint PmTriggerWfi;
|
||||
@ -778,30 +778,30 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
public uint LineLengthIn;
|
||||
public uint LineCount;
|
||||
public uint OffsetOutUpper;
|
||||
public int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
|
||||
public readonly int OffsetOutUpperValue => (int)(OffsetOutUpper & 0xFF);
|
||||
public uint OffsetOut;
|
||||
public uint PitchOut;
|
||||
public uint SetDstBlockSize;
|
||||
public SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public readonly SetDstBlockSizeWidth SetDstBlockSizeWidth => (SetDstBlockSizeWidth)(SetDstBlockSize & 0xF);
|
||||
public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0xF);
|
||||
public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0xF);
|
||||
public uint SetDstWidth;
|
||||
public uint SetDstHeight;
|
||||
public uint SetDstDepth;
|
||||
public uint SetDstLayer;
|
||||
public uint SetDstOriginBytesX;
|
||||
public int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
|
||||
public readonly int SetDstOriginBytesXV => (int)(SetDstOriginBytesX & 0xFFFFF);
|
||||
public uint SetDstOriginSamplesY;
|
||||
public int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
|
||||
public readonly int SetDstOriginSamplesYV => (int)(SetDstOriginSamplesY & 0xFFFF);
|
||||
public uint LaunchDma;
|
||||
public LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
|
||||
public LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
|
||||
public LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
|
||||
public LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
|
||||
public bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
|
||||
public LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
|
||||
public LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
|
||||
public bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
|
||||
public readonly LaunchDmaDstMemoryLayout LaunchDmaDstMemoryLayout => (LaunchDmaDstMemoryLayout)(LaunchDma & 0x1);
|
||||
public readonly LaunchDmaCompletionType LaunchDmaCompletionType => (LaunchDmaCompletionType)((LaunchDma >> 4) & 0x3);
|
||||
public readonly LaunchDmaInterruptType LaunchDmaInterruptType => (LaunchDmaInterruptType)((LaunchDma >> 8) & 0x3);
|
||||
public readonly LaunchDmaSemaphoreStructSize LaunchDmaSemaphoreStructSize => (LaunchDmaSemaphoreStructSize)((LaunchDma >> 12) & 0x1);
|
||||
public readonly bool LaunchDmaReductionEnable => (LaunchDma & 0x2) != 0;
|
||||
public readonly LaunchDmaReductionOp LaunchDmaReductionOp => (LaunchDmaReductionOp)((LaunchDma >> 13) & 0x7);
|
||||
public readonly LaunchDmaReductionFormat LaunchDmaReductionFormat => (LaunchDmaReductionFormat)((LaunchDma >> 2) & 0x3);
|
||||
public readonly bool LaunchDmaSysmembarDisable => (LaunchDma & 0x40) != 0;
|
||||
public uint LoadInlineData;
|
||||
public fixed uint Reserved1B8[22];
|
||||
public Boolean32 EarlyZForce;
|
||||
@ -1042,7 +1042,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
public fixed uint Reserved260C[125];
|
||||
public Array4<Array32<uint>> TfVaryingLocations;
|
||||
public fixed uint Reserved2A00[640];
|
||||
public MmeShadowScratch SetMmeShadowScratch;
|
||||
public Array256<uint> SetMmeShadowScratch;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
_channel = channel;
|
||||
_state = new DeviceState<TwodClassState>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(TwodClassState.PixelsFromMemorySrcY0Int), new RwCallback(PixelsFromMemorySrcY0Int, null) }
|
||||
{ nameof(TwodClassState.PixelsFromMemorySrcY0Int), new RwCallback(PixelsFromMemorySrcY0Int, null) },
|
||||
});
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
/// <param name="lhsFormat">Format of the first texture</param>
|
||||
/// <param name="rhsFormat">Format of the second texture</param>
|
||||
/// <returns>True if the data is compatible, false otherwise</returns>
|
||||
private bool IsDataCompatible(TwodTexture lhs, TwodTexture rhs, FormatInfo lhsFormat, FormatInfo rhsFormat)
|
||||
private static bool IsDataCompatible(TwodTexture lhs, TwodTexture rhs, FormatInfo lhsFormat, FormatInfo rhsFormat)
|
||||
{
|
||||
if (lhsFormat.BytesPerPixel != rhsFormat.BytesPerPixel ||
|
||||
lhs.Height != rhs.Height ||
|
||||
@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
/// <param name="x2">Region end x</param>
|
||||
/// <param name="y2">Region end y</param>
|
||||
/// <returns>True if the region covers the full texture, false otherwise</returns>
|
||||
private bool IsCopyRegionComplete(TwodTexture texture, FormatInfo formatInfo, int x1, int y1, int x2, int y2)
|
||||
private static bool IsCopyRegionComplete(TwodTexture texture, FormatInfo formatInfo, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (x1 != 0 || y1 != 0 || y2 != texture.Height)
|
||||
{
|
||||
@ -172,7 +172,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
srcSpan.Slice(offset, lineSize).CopyTo(dstSpan.Slice(offset));
|
||||
srcSpan.Slice(offset, lineSize).CopyTo(dstSpan[offset..]);
|
||||
|
||||
offset += stride;
|
||||
}
|
||||
@ -364,13 +364,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
float scale = srcTexture.ScaleFactor;
|
||||
float dstScale = dstTexture.ScaleFactor;
|
||||
|
||||
Extents2D srcRegion = new Extents2D(
|
||||
Extents2D srcRegion = new(
|
||||
(int)Math.Ceiling(scale * (srcX1 / srcTexture.Info.SamplesInX)),
|
||||
(int)Math.Ceiling(scale * (srcY1 / srcTexture.Info.SamplesInY)),
|
||||
(int)Math.Ceiling(scale * (srcX2 / srcTexture.Info.SamplesInX)),
|
||||
(int)Math.Ceiling(scale * (srcY2 / srcTexture.Info.SamplesInY)));
|
||||
|
||||
Extents2D dstRegion = new Extents2D(
|
||||
Extents2D dstRegion = new(
|
||||
(int)Math.Ceiling(dstScale * (dstX1 / dstTexture.Info.SamplesInX)),
|
||||
(int)Math.Ceiling(dstScale * (dstY1 / dstTexture.Info.SamplesInY)),
|
||||
(int)Math.Ceiling(dstScale * (dstX2 / dstTexture.Info.SamplesInX)),
|
||||
|
@ -486,7 +486,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
/// </summary>
|
||||
struct RenderSolidPrimPoint
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint SetX;
|
||||
public uint Y;
|
||||
#pragma warning restore CS0649
|
||||
@ -497,30 +497,30 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
/// </summary>
|
||||
unsafe struct TwodClassState : IShadowState
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint SetObject;
|
||||
public int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public readonly int SetObjectClassId => (int)(SetObject & 0xFFFF);
|
||||
public readonly int SetObjectEngineId => (int)((SetObject >> 16) & 0x1F);
|
||||
public fixed uint Reserved04[63];
|
||||
public uint NoOperation;
|
||||
public uint SetNotifyA;
|
||||
public int SetNotifyAAddressUpper => (int)(SetNotifyA & 0x1FFFFFF);
|
||||
public readonly int SetNotifyAAddressUpper => (int)(SetNotifyA & 0x1FFFFFF);
|
||||
public uint SetNotifyB;
|
||||
public uint Notify;
|
||||
public NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public readonly NotifyType NotifyType => (NotifyType)(Notify);
|
||||
public uint WaitForIdle;
|
||||
public uint LoadMmeInstructionRamPointer;
|
||||
public uint LoadMmeInstructionRam;
|
||||
public uint LoadMmeStartAddressRamPointer;
|
||||
public uint LoadMmeStartAddressRam;
|
||||
public uint SetMmeShadowRamControl;
|
||||
public SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
|
||||
public readonly SetMmeShadowRamControlMode SetMmeShadowRamControlMode => (SetMmeShadowRamControlMode)(SetMmeShadowRamControl & 0x3);
|
||||
public fixed uint Reserved128[2];
|
||||
public uint SetGlobalRenderEnableA;
|
||||
public int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public readonly int SetGlobalRenderEnableAOffsetUpper => (int)(SetGlobalRenderEnableA & 0xFF);
|
||||
public uint SetGlobalRenderEnableB;
|
||||
public uint SetGlobalRenderEnableC;
|
||||
public int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public readonly int SetGlobalRenderEnableCMode => (int)(SetGlobalRenderEnableC & 0x7);
|
||||
public uint SendGoIdle;
|
||||
public uint PmTrigger;
|
||||
public fixed uint Reserved144[3];
|
||||
@ -528,54 +528,54 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
public uint SetInstrumentationMethodData;
|
||||
public fixed uint Reserved158[37];
|
||||
public uint SetMmeSwitchState;
|
||||
public bool SetMmeSwitchStateValid => (SetMmeSwitchState & 0x1) != 0;
|
||||
public int SetMmeSwitchStateSaveMacro => (int)((SetMmeSwitchState >> 4) & 0xFF);
|
||||
public int SetMmeSwitchStateRestoreMacro => (int)((SetMmeSwitchState >> 12) & 0xFF);
|
||||
public readonly bool SetMmeSwitchStateValid => (SetMmeSwitchState & 0x1) != 0;
|
||||
public readonly int SetMmeSwitchStateSaveMacro => (int)((SetMmeSwitchState >> 4) & 0xFF);
|
||||
public readonly int SetMmeSwitchStateRestoreMacro => (int)((SetMmeSwitchState >> 12) & 0xFF);
|
||||
public fixed uint Reserved1F0[4];
|
||||
public uint SetDstFormat;
|
||||
public SetDstFormatV SetDstFormatV => (SetDstFormatV)(SetDstFormat & 0xFF);
|
||||
public readonly SetDstFormatV SetDstFormatV => (SetDstFormatV)(SetDstFormat & 0xFF);
|
||||
public uint SetDstMemoryLayout;
|
||||
public SetDstMemoryLayoutV SetDstMemoryLayoutV => (SetDstMemoryLayoutV)(SetDstMemoryLayout & 0x1);
|
||||
public readonly SetDstMemoryLayoutV SetDstMemoryLayoutV => (SetDstMemoryLayoutV)(SetDstMemoryLayout & 0x1);
|
||||
public uint SetDstBlockSize;
|
||||
public SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0x7);
|
||||
public SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0x7);
|
||||
public readonly SetDstBlockSizeHeight SetDstBlockSizeHeight => (SetDstBlockSizeHeight)((SetDstBlockSize >> 4) & 0x7);
|
||||
public readonly SetDstBlockSizeDepth SetDstBlockSizeDepth => (SetDstBlockSizeDepth)((SetDstBlockSize >> 8) & 0x7);
|
||||
public uint SetDstDepth;
|
||||
public uint SetDstLayer;
|
||||
public uint SetDstPitch;
|
||||
public uint SetDstWidth;
|
||||
public uint SetDstHeight;
|
||||
public uint SetDstOffsetUpper;
|
||||
public int SetDstOffsetUpperV => (int)(SetDstOffsetUpper & 0xFF);
|
||||
public readonly int SetDstOffsetUpperV => (int)(SetDstOffsetUpper & 0xFF);
|
||||
public uint SetDstOffsetLower;
|
||||
public uint FlushAndInvalidateRopMiniCache;
|
||||
public bool FlushAndInvalidateRopMiniCacheV => (FlushAndInvalidateRopMiniCache & 0x1) != 0;
|
||||
public readonly bool FlushAndInvalidateRopMiniCacheV => (FlushAndInvalidateRopMiniCache & 0x1) != 0;
|
||||
public uint SetSpareNoop06;
|
||||
public uint SetSrcFormat;
|
||||
public SetSrcFormatV SetSrcFormatV => (SetSrcFormatV)(SetSrcFormat & 0xFF);
|
||||
public readonly SetSrcFormatV SetSrcFormatV => (SetSrcFormatV)(SetSrcFormat & 0xFF);
|
||||
public uint SetSrcMemoryLayout;
|
||||
public SetSrcMemoryLayoutV SetSrcMemoryLayoutV => (SetSrcMemoryLayoutV)(SetSrcMemoryLayout & 0x1);
|
||||
public readonly SetSrcMemoryLayoutV SetSrcMemoryLayoutV => (SetSrcMemoryLayoutV)(SetSrcMemoryLayout & 0x1);
|
||||
public uint SetSrcBlockSize;
|
||||
public SetSrcBlockSizeHeight SetSrcBlockSizeHeight => (SetSrcBlockSizeHeight)((SetSrcBlockSize >> 4) & 0x7);
|
||||
public SetSrcBlockSizeDepth SetSrcBlockSizeDepth => (SetSrcBlockSizeDepth)((SetSrcBlockSize >> 8) & 0x7);
|
||||
public readonly SetSrcBlockSizeHeight SetSrcBlockSizeHeight => (SetSrcBlockSizeHeight)((SetSrcBlockSize >> 4) & 0x7);
|
||||
public readonly SetSrcBlockSizeDepth SetSrcBlockSizeDepth => (SetSrcBlockSizeDepth)((SetSrcBlockSize >> 8) & 0x7);
|
||||
public uint SetSrcDepth;
|
||||
public uint TwodInvalidateTextureDataCache;
|
||||
public TwodInvalidateTextureDataCacheV TwodInvalidateTextureDataCacheV => (TwodInvalidateTextureDataCacheV)(TwodInvalidateTextureDataCache & 0x3);
|
||||
public readonly TwodInvalidateTextureDataCacheV TwodInvalidateTextureDataCacheV => (TwodInvalidateTextureDataCacheV)(TwodInvalidateTextureDataCache & 0x3);
|
||||
public uint SetSrcPitch;
|
||||
public uint SetSrcWidth;
|
||||
public uint SetSrcHeight;
|
||||
public uint SetSrcOffsetUpper;
|
||||
public int SetSrcOffsetUpperV => (int)(SetSrcOffsetUpper & 0xFF);
|
||||
public readonly int SetSrcOffsetUpperV => (int)(SetSrcOffsetUpper & 0xFF);
|
||||
public uint SetSrcOffsetLower;
|
||||
public uint SetPixelsFromMemorySectorPromotion;
|
||||
public SetPixelsFromMemorySectorPromotionV SetPixelsFromMemorySectorPromotionV => (SetPixelsFromMemorySectorPromotionV)(SetPixelsFromMemorySectorPromotion & 0x3);
|
||||
public readonly SetPixelsFromMemorySectorPromotionV SetPixelsFromMemorySectorPromotionV => (SetPixelsFromMemorySectorPromotionV)(SetPixelsFromMemorySectorPromotion & 0x3);
|
||||
public uint SetSpareNoop12;
|
||||
public uint SetNumProcessingClusters;
|
||||
public SetNumProcessingClustersV SetNumProcessingClustersV => (SetNumProcessingClustersV)(SetNumProcessingClusters & 0x1);
|
||||
public readonly SetNumProcessingClustersV SetNumProcessingClustersV => (SetNumProcessingClustersV)(SetNumProcessingClusters & 0x1);
|
||||
public uint SetRenderEnableA;
|
||||
public int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
|
||||
public readonly int SetRenderEnableAOffsetUpper => (int)(SetRenderEnableA & 0xFF);
|
||||
public uint SetRenderEnableB;
|
||||
public uint SetRenderEnableC;
|
||||
public int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
|
||||
public readonly int SetRenderEnableCMode => (int)(SetRenderEnableC & 0x7);
|
||||
public uint SetSpareNoop08;
|
||||
public uint SetSpareNoop01;
|
||||
public uint SetSpareNoop11;
|
||||
@ -585,29 +585,29 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
public uint SetClipWidth;
|
||||
public uint SetClipHeight;
|
||||
public uint SetClipEnable;
|
||||
public bool SetClipEnableV => (SetClipEnable & 0x1) != 0;
|
||||
public readonly bool SetClipEnableV => (SetClipEnable & 0x1) != 0;
|
||||
public uint SetColorKeyFormat;
|
||||
public SetColorKeyFormatV SetColorKeyFormatV => (SetColorKeyFormatV)(SetColorKeyFormat & 0x7);
|
||||
public readonly SetColorKeyFormatV SetColorKeyFormatV => (SetColorKeyFormatV)(SetColorKeyFormat & 0x7);
|
||||
public uint SetColorKey;
|
||||
public uint SetColorKeyEnable;
|
||||
public bool SetColorKeyEnableV => (SetColorKeyEnable & 0x1) != 0;
|
||||
public readonly bool SetColorKeyEnableV => (SetColorKeyEnable & 0x1) != 0;
|
||||
public uint SetRop;
|
||||
public int SetRopV => (int)(SetRop & 0xFF);
|
||||
public readonly int SetRopV => (int)(SetRop & 0xFF);
|
||||
public uint SetBeta1;
|
||||
public uint SetBeta4;
|
||||
public int SetBeta4B => (int)(SetBeta4 & 0xFF);
|
||||
public int SetBeta4G => (int)((SetBeta4 >> 8) & 0xFF);
|
||||
public int SetBeta4R => (int)((SetBeta4 >> 16) & 0xFF);
|
||||
public int SetBeta4A => (int)((SetBeta4 >> 24) & 0xFF);
|
||||
public readonly int SetBeta4B => (int)(SetBeta4 & 0xFF);
|
||||
public readonly int SetBeta4G => (int)((SetBeta4 >> 8) & 0xFF);
|
||||
public readonly int SetBeta4R => (int)((SetBeta4 >> 16) & 0xFF);
|
||||
public readonly int SetBeta4A => (int)((SetBeta4 >> 24) & 0xFF);
|
||||
public uint SetOperation;
|
||||
public SetOperationV SetOperationV => (SetOperationV)(SetOperation & 0x7);
|
||||
public readonly SetOperationV SetOperationV => (SetOperationV)(SetOperation & 0x7);
|
||||
public uint SetPatternOffset;
|
||||
public int SetPatternOffsetX => (int)(SetPatternOffset & 0x3F);
|
||||
public int SetPatternOffsetY => (int)((SetPatternOffset >> 8) & 0x3F);
|
||||
public readonly int SetPatternOffsetX => (int)(SetPatternOffset & 0x3F);
|
||||
public readonly int SetPatternOffsetY => (int)((SetPatternOffset >> 8) & 0x3F);
|
||||
public uint SetPatternSelect;
|
||||
public SetPatternSelectV SetPatternSelectV => (SetPatternSelectV)(SetPatternSelect & 0x3);
|
||||
public readonly SetPatternSelectV SetPatternSelectV => (SetPatternSelectV)(SetPatternSelect & 0x3);
|
||||
public uint SetDstColorRenderToZetaSurface;
|
||||
public bool SetDstColorRenderToZetaSurfaceV => (SetDstColorRenderToZetaSurface & 0x1) != 0;
|
||||
public readonly bool SetDstColorRenderToZetaSurfaceV => (SetDstColorRenderToZetaSurface & 0x1) != 0;
|
||||
public uint SetSpareNoop04;
|
||||
public uint SetSpareNoop15;
|
||||
public uint SetSpareNoop13;
|
||||
@ -615,18 +615,18 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
public uint SetSpareNoop14;
|
||||
public uint SetSpareNoop02;
|
||||
public uint SetCompression;
|
||||
public bool SetCompressionEnable => (SetCompression & 0x1) != 0;
|
||||
public readonly bool SetCompressionEnable => (SetCompression & 0x1) != 0;
|
||||
public uint SetSpareNoop09;
|
||||
public uint SetRenderEnableOverride;
|
||||
public SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
|
||||
public readonly SetRenderEnableOverrideMode SetRenderEnableOverrideMode => (SetRenderEnableOverrideMode)(SetRenderEnableOverride & 0x3);
|
||||
public uint SetPixelsFromMemoryDirection;
|
||||
public SetPixelsFromMemoryDirectionHorizontal SetPixelsFromMemoryDirectionHorizontal => (SetPixelsFromMemoryDirectionHorizontal)(SetPixelsFromMemoryDirection & 0x3);
|
||||
public SetPixelsFromMemoryDirectionVertical SetPixelsFromMemoryDirectionVertical => (SetPixelsFromMemoryDirectionVertical)((SetPixelsFromMemoryDirection >> 4) & 0x3);
|
||||
public readonly SetPixelsFromMemoryDirectionHorizontal SetPixelsFromMemoryDirectionHorizontal => (SetPixelsFromMemoryDirectionHorizontal)(SetPixelsFromMemoryDirection & 0x3);
|
||||
public readonly SetPixelsFromMemoryDirectionVertical SetPixelsFromMemoryDirectionVertical => (SetPixelsFromMemoryDirectionVertical)((SetPixelsFromMemoryDirection >> 4) & 0x3);
|
||||
public uint SetSpareNoop10;
|
||||
public uint SetMonochromePatternColorFormat;
|
||||
public SetMonochromePatternColorFormatV SetMonochromePatternColorFormatV => (SetMonochromePatternColorFormatV)(SetMonochromePatternColorFormat & 0x7);
|
||||
public readonly SetMonochromePatternColorFormatV SetMonochromePatternColorFormatV => (SetMonochromePatternColorFormatV)(SetMonochromePatternColorFormat & 0x7);
|
||||
public uint SetMonochromePatternFormat;
|
||||
public SetMonochromePatternFormatV SetMonochromePatternFormatV => (SetMonochromePatternFormatV)(SetMonochromePatternFormat & 0x1);
|
||||
public readonly SetMonochromePatternFormatV SetMonochromePatternFormatV => (SetMonochromePatternFormatV)(SetMonochromePatternFormat & 0x1);
|
||||
public uint SetMonochromePatternColor0;
|
||||
public uint SetMonochromePatternColor1;
|
||||
public uint SetMonochromePattern0;
|
||||
@ -662,52 +662,52 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
public uint SetRenderSolidPrimColor2;
|
||||
public uint SetRenderSolidPrimColor3;
|
||||
public uint SetMmeMemAddressA;
|
||||
public int SetMmeMemAddressAUpper => (int)(SetMmeMemAddressA & 0x1FFFFFF);
|
||||
public readonly int SetMmeMemAddressAUpper => (int)(SetMmeMemAddressA & 0x1FFFFFF);
|
||||
public uint SetMmeMemAddressB;
|
||||
public uint SetMmeDataRamAddress;
|
||||
public uint MmeDmaRead;
|
||||
public uint MmeDmaReadFifoed;
|
||||
public uint MmeDmaWrite;
|
||||
public uint MmeDmaReduction;
|
||||
public MmeDmaReductionReductionOp MmeDmaReductionReductionOp => (MmeDmaReductionReductionOp)(MmeDmaReduction & 0x7);
|
||||
public MmeDmaReductionReductionFormat MmeDmaReductionReductionFormat => (MmeDmaReductionReductionFormat)((MmeDmaReduction >> 4) & 0x3);
|
||||
public MmeDmaReductionReductionSize MmeDmaReductionReductionSize => (MmeDmaReductionReductionSize)((MmeDmaReduction >> 8) & 0x1);
|
||||
public readonly MmeDmaReductionReductionOp MmeDmaReductionReductionOp => (MmeDmaReductionReductionOp)(MmeDmaReduction & 0x7);
|
||||
public readonly MmeDmaReductionReductionFormat MmeDmaReductionReductionFormat => (MmeDmaReductionReductionFormat)((MmeDmaReduction >> 4) & 0x3);
|
||||
public readonly MmeDmaReductionReductionSize MmeDmaReductionReductionSize => (MmeDmaReductionReductionSize)((MmeDmaReduction >> 8) & 0x1);
|
||||
public uint MmeDmaSysmembar;
|
||||
public bool MmeDmaSysmembarV => (MmeDmaSysmembar & 0x1) != 0;
|
||||
public readonly bool MmeDmaSysmembarV => (MmeDmaSysmembar & 0x1) != 0;
|
||||
public uint MmeDmaSync;
|
||||
public uint SetMmeDataFifoConfig;
|
||||
public SetMmeDataFifoConfigFifoSize SetMmeDataFifoConfigFifoSize => (SetMmeDataFifoConfigFifoSize)(SetMmeDataFifoConfig & 0x7);
|
||||
public readonly SetMmeDataFifoConfigFifoSize SetMmeDataFifoConfigFifoSize => (SetMmeDataFifoConfigFifoSize)(SetMmeDataFifoConfig & 0x7);
|
||||
public fixed uint Reserved578[2];
|
||||
public uint RenderSolidPrimMode;
|
||||
public RenderSolidPrimModeV RenderSolidPrimModeV => (RenderSolidPrimModeV)(RenderSolidPrimMode & 0x7);
|
||||
public readonly RenderSolidPrimModeV RenderSolidPrimModeV => (RenderSolidPrimModeV)(RenderSolidPrimMode & 0x7);
|
||||
public uint SetRenderSolidPrimColorFormat;
|
||||
public SetRenderSolidPrimColorFormatV SetRenderSolidPrimColorFormatV => (SetRenderSolidPrimColorFormatV)(SetRenderSolidPrimColorFormat & 0xFF);
|
||||
public readonly SetRenderSolidPrimColorFormatV SetRenderSolidPrimColorFormatV => (SetRenderSolidPrimColorFormatV)(SetRenderSolidPrimColorFormat & 0xFF);
|
||||
public uint SetRenderSolidPrimColor;
|
||||
public uint SetRenderSolidLineTieBreakBits;
|
||||
public bool SetRenderSolidLineTieBreakBitsXmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x1) != 0;
|
||||
public bool SetRenderSolidLineTieBreakBitsXmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x10) != 0;
|
||||
public bool SetRenderSolidLineTieBreakBitsYmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x100) != 0;
|
||||
public bool SetRenderSolidLineTieBreakBitsYmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x1000) != 0;
|
||||
public readonly bool SetRenderSolidLineTieBreakBitsXmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x1) != 0;
|
||||
public readonly bool SetRenderSolidLineTieBreakBitsXmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x10) != 0;
|
||||
public readonly bool SetRenderSolidLineTieBreakBitsYmajXincYinc => (SetRenderSolidLineTieBreakBits & 0x100) != 0;
|
||||
public readonly bool SetRenderSolidLineTieBreakBitsYmajXdecYinc => (SetRenderSolidLineTieBreakBits & 0x1000) != 0;
|
||||
public fixed uint Reserved590[20];
|
||||
public uint RenderSolidPrimPointXY;
|
||||
public int RenderSolidPrimPointXYX => (int)(RenderSolidPrimPointXY & 0xFFFF);
|
||||
public int RenderSolidPrimPointXYY => (int)((RenderSolidPrimPointXY >> 16) & 0xFFFF);
|
||||
public readonly int RenderSolidPrimPointXYX => (int)(RenderSolidPrimPointXY & 0xFFFF);
|
||||
public readonly int RenderSolidPrimPointXYY => (int)((RenderSolidPrimPointXY >> 16) & 0xFFFF);
|
||||
public fixed uint Reserved5E4[7];
|
||||
public Array64<RenderSolidPrimPoint> RenderSolidPrimPoint;
|
||||
public uint SetPixelsFromCpuDataType;
|
||||
public SetPixelsFromCpuDataTypeV SetPixelsFromCpuDataTypeV => (SetPixelsFromCpuDataTypeV)(SetPixelsFromCpuDataType & 0x1);
|
||||
public readonly SetPixelsFromCpuDataTypeV SetPixelsFromCpuDataTypeV => (SetPixelsFromCpuDataTypeV)(SetPixelsFromCpuDataType & 0x1);
|
||||
public uint SetPixelsFromCpuColorFormat;
|
||||
public SetPixelsFromCpuColorFormatV SetPixelsFromCpuColorFormatV => (SetPixelsFromCpuColorFormatV)(SetPixelsFromCpuColorFormat & 0xFF);
|
||||
public readonly SetPixelsFromCpuColorFormatV SetPixelsFromCpuColorFormatV => (SetPixelsFromCpuColorFormatV)(SetPixelsFromCpuColorFormat & 0xFF);
|
||||
public uint SetPixelsFromCpuIndexFormat;
|
||||
public SetPixelsFromCpuIndexFormatV SetPixelsFromCpuIndexFormatV => (SetPixelsFromCpuIndexFormatV)(SetPixelsFromCpuIndexFormat & 0x3);
|
||||
public readonly SetPixelsFromCpuIndexFormatV SetPixelsFromCpuIndexFormatV => (SetPixelsFromCpuIndexFormatV)(SetPixelsFromCpuIndexFormat & 0x3);
|
||||
public uint SetPixelsFromCpuMonoFormat;
|
||||
public SetPixelsFromCpuMonoFormatV SetPixelsFromCpuMonoFormatV => (SetPixelsFromCpuMonoFormatV)(SetPixelsFromCpuMonoFormat & 0x1);
|
||||
public readonly SetPixelsFromCpuMonoFormatV SetPixelsFromCpuMonoFormatV => (SetPixelsFromCpuMonoFormatV)(SetPixelsFromCpuMonoFormat & 0x1);
|
||||
public uint SetPixelsFromCpuWrap;
|
||||
public SetPixelsFromCpuWrapV SetPixelsFromCpuWrapV => (SetPixelsFromCpuWrapV)(SetPixelsFromCpuWrap & 0x3);
|
||||
public readonly SetPixelsFromCpuWrapV SetPixelsFromCpuWrapV => (SetPixelsFromCpuWrapV)(SetPixelsFromCpuWrap & 0x3);
|
||||
public uint SetPixelsFromCpuColor0;
|
||||
public uint SetPixelsFromCpuColor1;
|
||||
public uint SetPixelsFromCpuMonoOpacity;
|
||||
public SetPixelsFromCpuMonoOpacityV SetPixelsFromCpuMonoOpacityV => (SetPixelsFromCpuMonoOpacityV)(SetPixelsFromCpuMonoOpacity & 0x1);
|
||||
public readonly SetPixelsFromCpuMonoOpacityV SetPixelsFromCpuMonoOpacityV => (SetPixelsFromCpuMonoOpacityV)(SetPixelsFromCpuMonoOpacity & 0x1);
|
||||
public fixed uint Reserved820[6];
|
||||
public uint SetPixelsFromCpuSrcWidth;
|
||||
public uint SetPixelsFromCpuSrcHeight;
|
||||
@ -722,45 +722,45 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
public uint PixelsFromCpuData;
|
||||
public fixed uint Reserved864[3];
|
||||
public uint SetBigEndianControl;
|
||||
public bool SetBigEndianControlX32Swap1 => (SetBigEndianControl & 0x1) != 0;
|
||||
public bool SetBigEndianControlX32Swap4 => (SetBigEndianControl & 0x2) != 0;
|
||||
public bool SetBigEndianControlX32Swap8 => (SetBigEndianControl & 0x4) != 0;
|
||||
public bool SetBigEndianControlX32Swap16 => (SetBigEndianControl & 0x8) != 0;
|
||||
public bool SetBigEndianControlX16Swap1 => (SetBigEndianControl & 0x10) != 0;
|
||||
public bool SetBigEndianControlX16Swap4 => (SetBigEndianControl & 0x20) != 0;
|
||||
public bool SetBigEndianControlX16Swap8 => (SetBigEndianControl & 0x40) != 0;
|
||||
public bool SetBigEndianControlX16Swap16 => (SetBigEndianControl & 0x80) != 0;
|
||||
public bool SetBigEndianControlX8Swap1 => (SetBigEndianControl & 0x100) != 0;
|
||||
public bool SetBigEndianControlX8Swap4 => (SetBigEndianControl & 0x200) != 0;
|
||||
public bool SetBigEndianControlX8Swap8 => (SetBigEndianControl & 0x400) != 0;
|
||||
public bool SetBigEndianControlX8Swap16 => (SetBigEndianControl & 0x800) != 0;
|
||||
public bool SetBigEndianControlI1X8Cga6Swap1 => (SetBigEndianControl & 0x1000) != 0;
|
||||
public bool SetBigEndianControlI1X8Cga6Swap4 => (SetBigEndianControl & 0x2000) != 0;
|
||||
public bool SetBigEndianControlI1X8Cga6Swap8 => (SetBigEndianControl & 0x4000) != 0;
|
||||
public bool SetBigEndianControlI1X8Cga6Swap16 => (SetBigEndianControl & 0x8000) != 0;
|
||||
public bool SetBigEndianControlI1X8LeSwap1 => (SetBigEndianControl & 0x10000) != 0;
|
||||
public bool SetBigEndianControlI1X8LeSwap4 => (SetBigEndianControl & 0x20000) != 0;
|
||||
public bool SetBigEndianControlI1X8LeSwap8 => (SetBigEndianControl & 0x40000) != 0;
|
||||
public bool SetBigEndianControlI1X8LeSwap16 => (SetBigEndianControl & 0x80000) != 0;
|
||||
public bool SetBigEndianControlI4Swap1 => (SetBigEndianControl & 0x100000) != 0;
|
||||
public bool SetBigEndianControlI4Swap4 => (SetBigEndianControl & 0x200000) != 0;
|
||||
public bool SetBigEndianControlI4Swap8 => (SetBigEndianControl & 0x400000) != 0;
|
||||
public bool SetBigEndianControlI4Swap16 => (SetBigEndianControl & 0x800000) != 0;
|
||||
public bool SetBigEndianControlI8Swap1 => (SetBigEndianControl & 0x1000000) != 0;
|
||||
public bool SetBigEndianControlI8Swap4 => (SetBigEndianControl & 0x2000000) != 0;
|
||||
public bool SetBigEndianControlI8Swap8 => (SetBigEndianControl & 0x4000000) != 0;
|
||||
public bool SetBigEndianControlI8Swap16 => (SetBigEndianControl & 0x8000000) != 0;
|
||||
public bool SetBigEndianControlOverride => (SetBigEndianControl & 0x10000000) != 0;
|
||||
public readonly bool SetBigEndianControlX32Swap1 => (SetBigEndianControl & 0x1) != 0;
|
||||
public readonly bool SetBigEndianControlX32Swap4 => (SetBigEndianControl & 0x2) != 0;
|
||||
public readonly bool SetBigEndianControlX32Swap8 => (SetBigEndianControl & 0x4) != 0;
|
||||
public readonly bool SetBigEndianControlX32Swap16 => (SetBigEndianControl & 0x8) != 0;
|
||||
public readonly bool SetBigEndianControlX16Swap1 => (SetBigEndianControl & 0x10) != 0;
|
||||
public readonly bool SetBigEndianControlX16Swap4 => (SetBigEndianControl & 0x20) != 0;
|
||||
public readonly bool SetBigEndianControlX16Swap8 => (SetBigEndianControl & 0x40) != 0;
|
||||
public readonly bool SetBigEndianControlX16Swap16 => (SetBigEndianControl & 0x80) != 0;
|
||||
public readonly bool SetBigEndianControlX8Swap1 => (SetBigEndianControl & 0x100) != 0;
|
||||
public readonly bool SetBigEndianControlX8Swap4 => (SetBigEndianControl & 0x200) != 0;
|
||||
public readonly bool SetBigEndianControlX8Swap8 => (SetBigEndianControl & 0x400) != 0;
|
||||
public readonly bool SetBigEndianControlX8Swap16 => (SetBigEndianControl & 0x800) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8Cga6Swap1 => (SetBigEndianControl & 0x1000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8Cga6Swap4 => (SetBigEndianControl & 0x2000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8Cga6Swap8 => (SetBigEndianControl & 0x4000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8Cga6Swap16 => (SetBigEndianControl & 0x8000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8LeSwap1 => (SetBigEndianControl & 0x10000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8LeSwap4 => (SetBigEndianControl & 0x20000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8LeSwap8 => (SetBigEndianControl & 0x40000) != 0;
|
||||
public readonly bool SetBigEndianControlI1X8LeSwap16 => (SetBigEndianControl & 0x80000) != 0;
|
||||
public readonly bool SetBigEndianControlI4Swap1 => (SetBigEndianControl & 0x100000) != 0;
|
||||
public readonly bool SetBigEndianControlI4Swap4 => (SetBigEndianControl & 0x200000) != 0;
|
||||
public readonly bool SetBigEndianControlI4Swap8 => (SetBigEndianControl & 0x400000) != 0;
|
||||
public readonly bool SetBigEndianControlI4Swap16 => (SetBigEndianControl & 0x800000) != 0;
|
||||
public readonly bool SetBigEndianControlI8Swap1 => (SetBigEndianControl & 0x1000000) != 0;
|
||||
public readonly bool SetBigEndianControlI8Swap4 => (SetBigEndianControl & 0x2000000) != 0;
|
||||
public readonly bool SetBigEndianControlI8Swap8 => (SetBigEndianControl & 0x4000000) != 0;
|
||||
public readonly bool SetBigEndianControlI8Swap16 => (SetBigEndianControl & 0x8000000) != 0;
|
||||
public readonly bool SetBigEndianControlOverride => (SetBigEndianControl & 0x10000000) != 0;
|
||||
public fixed uint Reserved874[3];
|
||||
public uint SetPixelsFromMemoryBlockShape;
|
||||
public SetPixelsFromMemoryBlockShapeV SetPixelsFromMemoryBlockShapeV => (SetPixelsFromMemoryBlockShapeV)(SetPixelsFromMemoryBlockShape & 0x7);
|
||||
public readonly SetPixelsFromMemoryBlockShapeV SetPixelsFromMemoryBlockShapeV => (SetPixelsFromMemoryBlockShapeV)(SetPixelsFromMemoryBlockShape & 0x7);
|
||||
public uint SetPixelsFromMemoryCorralSize;
|
||||
public int SetPixelsFromMemoryCorralSizeV => (int)(SetPixelsFromMemoryCorralSize & 0x3FF);
|
||||
public readonly int SetPixelsFromMemoryCorralSizeV => (int)(SetPixelsFromMemoryCorralSize & 0x3FF);
|
||||
public uint SetPixelsFromMemorySafeOverlap;
|
||||
public bool SetPixelsFromMemorySafeOverlapV => (SetPixelsFromMemorySafeOverlap & 0x1) != 0;
|
||||
public readonly bool SetPixelsFromMemorySafeOverlapV => (SetPixelsFromMemorySafeOverlap & 0x1) != 0;
|
||||
public uint SetPixelsFromMemorySampleMode;
|
||||
public SetPixelsFromMemorySampleModeOrigin SetPixelsFromMemorySampleModeOrigin => (SetPixelsFromMemorySampleModeOrigin)(SetPixelsFromMemorySampleMode & 0x1);
|
||||
public SetPixelsFromMemorySampleModeFilter SetPixelsFromMemorySampleModeFilter => (SetPixelsFromMemorySampleModeFilter)((SetPixelsFromMemorySampleMode >> 4) & 0x1);
|
||||
public readonly SetPixelsFromMemorySampleModeOrigin SetPixelsFromMemorySampleModeOrigin => (SetPixelsFromMemorySampleModeOrigin)(SetPixelsFromMemorySampleMode & 0x1);
|
||||
public readonly SetPixelsFromMemorySampleModeFilter SetPixelsFromMemorySampleModeFilter => (SetPixelsFromMemorySampleModeFilter)((SetPixelsFromMemorySampleMode >> 4) & 0x1);
|
||||
public fixed uint Reserved890[8];
|
||||
public uint SetPixelsFromMemoryDstX0;
|
||||
public uint SetPixelsFromMemoryDstY0;
|
||||
@ -808,9 +808,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
public uint SetFalcon31;
|
||||
public fixed uint Reserved960[291];
|
||||
public uint MmeDmaWriteMethodBarrier;
|
||||
public bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0;
|
||||
public readonly bool MmeDmaWriteMethodBarrierV => (MmeDmaWriteMethodBarrier & 0x1) != 0;
|
||||
public fixed uint ReservedDF0[2436];
|
||||
public MmeShadowScratch SetMmeShadowScratch;
|
||||
public Array256<uint> SetMmeShadowScratch;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
|
||||
/// </summary>
|
||||
struct TwodTexture
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public ColorFormat Format;
|
||||
public Boolean32 LinearLayout;
|
||||
public MemoryLayout MemoryLayout;
|
||||
|
@ -3,10 +3,10 @@
|
||||
/// <summary>
|
||||
/// Boolean value, stored as a 32-bits integer in memory.
|
||||
/// </summary>
|
||||
struct Boolean32
|
||||
readonly struct Boolean32
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
private uint _value;
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
private readonly uint _value;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
public static implicit operator bool(Boolean32 value)
|
||||
|
@ -9,58 +9,58 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
enum ColorFormat
|
||||
{
|
||||
R32G32B32A32Float = 0xc0,
|
||||
R32G32B32A32Sint = 0xc1,
|
||||
R32G32B32A32Uint = 0xc2,
|
||||
R32G32B32A32Sint = 0xc1,
|
||||
R32G32B32A32Uint = 0xc2,
|
||||
R32G32B32X32Float = 0xc3,
|
||||
R32G32B32X32Sint = 0xc4,
|
||||
R32G32B32X32Uint = 0xc5,
|
||||
R32G32B32X32Sint = 0xc4,
|
||||
R32G32B32X32Uint = 0xc5,
|
||||
R16G16B16X16Unorm = 0xc6,
|
||||
R16G16B16X16Snorm = 0xc7,
|
||||
R16G16B16X16Sint = 0xc8,
|
||||
R16G16B16X16Uint = 0xc9,
|
||||
R16G16B16X16Sint = 0xc8,
|
||||
R16G16B16X16Uint = 0xc9,
|
||||
R16G16B16A16Float = 0xca,
|
||||
R32G32Float = 0xcb,
|
||||
R32G32Sint = 0xcc,
|
||||
R32G32Uint = 0xcd,
|
||||
R32G32Float = 0xcb,
|
||||
R32G32Sint = 0xcc,
|
||||
R32G32Uint = 0xcd,
|
||||
R16G16B16X16Float = 0xce,
|
||||
B8G8R8A8Unorm = 0xcf,
|
||||
B8G8R8A8Srgb = 0xd0,
|
||||
R10G10B10A2Unorm = 0xd1,
|
||||
R10G10B10A2Uint = 0xd2,
|
||||
R8G8B8A8Unorm = 0xd5,
|
||||
R8G8B8A8Srgb = 0xd6,
|
||||
R8G8B8X8Snorm = 0xd7,
|
||||
R8G8B8X8Sint = 0xd8,
|
||||
R8G8B8X8Uint = 0xd9,
|
||||
R16G16Unorm = 0xda,
|
||||
R16G16Snorm = 0xdb,
|
||||
R16G16Sint = 0xdc,
|
||||
R16G16Uint = 0xdd,
|
||||
R16G16Float = 0xde,
|
||||
R11G11B10Float = 0xe0,
|
||||
R32Sint = 0xe3,
|
||||
R32Uint = 0xe4,
|
||||
R32Float = 0xe5,
|
||||
B8G8R8X8Unorm = 0xe6,
|
||||
B8G8R8X8Srgb = 0xe7,
|
||||
B5G6R5Unorm = 0xe8,
|
||||
B5G5R5A1Unorm = 0xe9,
|
||||
R8G8Unorm = 0xea,
|
||||
R8G8Snorm = 0xeb,
|
||||
R8G8Sint = 0xec,
|
||||
R8G8Uint = 0xed,
|
||||
R16Unorm = 0xee,
|
||||
R16Snorm = 0xef,
|
||||
R16Sint = 0xf0,
|
||||
R16Uint = 0xf1,
|
||||
R16Float = 0xf2,
|
||||
R8Unorm = 0xf3,
|
||||
R8Snorm = 0xf4,
|
||||
R8Sint = 0xf5,
|
||||
R8Uint = 0xf6,
|
||||
B5G5R5X1Unorm = 0xf8,
|
||||
R8G8B8X8Unorm = 0xf9,
|
||||
R8G8B8X8Srgb = 0xfa
|
||||
B8G8R8A8Unorm = 0xcf,
|
||||
B8G8R8A8Srgb = 0xd0,
|
||||
R10G10B10A2Unorm = 0xd1,
|
||||
R10G10B10A2Uint = 0xd2,
|
||||
R8G8B8A8Unorm = 0xd5,
|
||||
R8G8B8A8Srgb = 0xd6,
|
||||
R8G8B8X8Snorm = 0xd7,
|
||||
R8G8B8X8Sint = 0xd8,
|
||||
R8G8B8X8Uint = 0xd9,
|
||||
R16G16Unorm = 0xda,
|
||||
R16G16Snorm = 0xdb,
|
||||
R16G16Sint = 0xdc,
|
||||
R16G16Uint = 0xdd,
|
||||
R16G16Float = 0xde,
|
||||
R11G11B10Float = 0xe0,
|
||||
R32Sint = 0xe3,
|
||||
R32Uint = 0xe4,
|
||||
R32Float = 0xe5,
|
||||
B8G8R8X8Unorm = 0xe6,
|
||||
B8G8R8X8Srgb = 0xe7,
|
||||
B5G6R5Unorm = 0xe8,
|
||||
B5G5R5A1Unorm = 0xe9,
|
||||
R8G8Unorm = 0xea,
|
||||
R8G8Snorm = 0xeb,
|
||||
R8G8Sint = 0xec,
|
||||
R8G8Uint = 0xed,
|
||||
R16Unorm = 0xee,
|
||||
R16Snorm = 0xef,
|
||||
R16Sint = 0xf0,
|
||||
R16Uint = 0xf1,
|
||||
R16Float = 0xf2,
|
||||
R8Unorm = 0xf3,
|
||||
R8Snorm = 0xf4,
|
||||
R8Sint = 0xf5,
|
||||
R8Uint = 0xf6,
|
||||
B5G5R5X1Unorm = 0xf8,
|
||||
R8G8B8X8Unorm = 0xf9,
|
||||
R8G8B8X8Srgb = 0xfa,
|
||||
}
|
||||
|
||||
static class ColorFormatConverter
|
||||
@ -74,6 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
{
|
||||
return format switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
ColorFormat.R32G32B32A32Float => new FormatInfo(Format.R32G32B32A32Float, 1, 1, 16, 4),
|
||||
ColorFormat.R32G32B32A32Sint => new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16, 4),
|
||||
ColorFormat.R32G32B32A32Uint => new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16, 4),
|
||||
@ -127,7 +128,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
ColorFormat.B5G5R5X1Unorm => new FormatInfo(Format.B5G5R5A1Unorm, 1, 1, 2, 4),
|
||||
ColorFormat.R8G8B8X8Unorm => new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4),
|
||||
ColorFormat.R8G8B8X8Srgb => new FormatInfo(Format.R8G8B8A8Srgb, 1, 1, 4, 4),
|
||||
_ => FormatInfo.Default
|
||||
_ => FormatInfo.Default,
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
}
|
||||
|
||||
@ -157,9 +159,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
case ColorFormat.R8G8B8X8Unorm:
|
||||
case ColorFormat.R8G8B8X8Srgb:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// </summary>
|
||||
struct GpuVa
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint High;
|
||||
public uint Low;
|
||||
#pragma warning restore CS0649
|
||||
@ -14,7 +14,7 @@
|
||||
/// Packs the split address into a 64-bits address value.
|
||||
/// </summary>
|
||||
/// <returns>The 64-bits address value</returns>
|
||||
public ulong Pack()
|
||||
public readonly ulong Pack()
|
||||
{
|
||||
return Low | ((ulong)High << 32);
|
||||
}
|
||||
|
@ -5,31 +5,31 @@
|
||||
/// </summary>
|
||||
struct MemoryLayout
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Packed;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
public int UnpackGobBlocksInX()
|
||||
public readonly int UnpackGobBlocksInX()
|
||||
{
|
||||
return 1 << (int)(Packed & 0xf);
|
||||
}
|
||||
|
||||
public int UnpackGobBlocksInY()
|
||||
public readonly int UnpackGobBlocksInY()
|
||||
{
|
||||
return 1 << (int)((Packed >> 4) & 0xf);
|
||||
}
|
||||
|
||||
public int UnpackGobBlocksInZ()
|
||||
public readonly int UnpackGobBlocksInZ()
|
||||
{
|
||||
return 1 << (int)((Packed >> 8) & 0xf);
|
||||
}
|
||||
|
||||
public bool UnpackIsLinear()
|
||||
public readonly bool UnpackIsLinear()
|
||||
{
|
||||
return (Packed & 0x1000) != 0;
|
||||
}
|
||||
|
||||
public bool UnpackIsTarget3D()
|
||||
public readonly bool UnpackIsTarget3D()
|
||||
{
|
||||
return (Packed & 0x10000) != 0;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
LineStripAdjacency,
|
||||
TrianglesAdjacency,
|
||||
TriangleStripAdjacency,
|
||||
Patches
|
||||
Patches,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
LineStripAdjacency = 11,
|
||||
TrianglesAdjacency = 12,
|
||||
TriangleStripAdjacency = 13,
|
||||
Patches = 14
|
||||
Patches = 14,
|
||||
}
|
||||
|
||||
static class PrimitiveTypeConverter
|
||||
@ -53,6 +53,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
PrimitiveType.Points => PrimitiveTopology.Points,
|
||||
PrimitiveType.Lines => PrimitiveTopology.Lines,
|
||||
PrimitiveType.LineLoop => PrimitiveTopology.LineLoop,
|
||||
@ -68,7 +69,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
PrimitiveType.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency,
|
||||
PrimitiveType.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency,
|
||||
PrimitiveType.Patches => PrimitiveTopology.Patches,
|
||||
_ => PrimitiveTopology.Triangles
|
||||
_ => PrimitiveTopology.Triangles,
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
}
|
||||
|
||||
@ -81,6 +83,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
PrimitiveTypeOverride.Points => PrimitiveTopology.Points,
|
||||
PrimitiveTypeOverride.Lines => PrimitiveTopology.Lines,
|
||||
PrimitiveTypeOverride.LineStrip => PrimitiveTopology.LineStrip,
|
||||
@ -92,8 +95,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
PrimitiveTypeOverride.TrianglesAdjacency => PrimitiveTopology.TrianglesAdjacency,
|
||||
PrimitiveTypeOverride.TriangleStripAdjacency => PrimitiveTopology.TriangleStripAdjacency,
|
||||
PrimitiveTypeOverride.Patches => PrimitiveTopology.Patches,
|
||||
_ => PrimitiveTopology.Triangles
|
||||
_ => PrimitiveTopology.Triangles,
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
/// </summary>
|
||||
enum SamplerIndex
|
||||
{
|
||||
Independently = 0,
|
||||
ViaHeaderIndex = 1
|
||||
Independently = 0,
|
||||
ViaHeaderIndex = 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,14 @@
|
||||
/// </summary>
|
||||
struct SbDescriptor
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint AddressLow;
|
||||
public uint AddressHigh;
|
||||
public int Size;
|
||||
public int Padding;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
public ulong PackAddress()
|
||||
public readonly ulong PackAddress()
|
||||
{
|
||||
return AddressLow | ((ulong)AddressHigh << 32);
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
/// </summary>
|
||||
enum ZetaFormat
|
||||
{
|
||||
D32Float = 0xa,
|
||||
D16Unorm = 0x13,
|
||||
D32Float = 0xa,
|
||||
D16Unorm = 0x13,
|
||||
D24UnormS8Uint = 0x14,
|
||||
D24Unorm = 0x15,
|
||||
D24Unorm = 0x15,
|
||||
S8UintD24Unorm = 0x16,
|
||||
S8Uint = 0x17,
|
||||
D32FloatS8Uint = 0x19
|
||||
S8Uint = 0x17,
|
||||
D32FloatS8Uint = 0x19,
|
||||
}
|
||||
|
||||
static class ZetaFormatConverter
|
||||
@ -28,6 +28,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
{
|
||||
return format switch
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
ZetaFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4, 1),
|
||||
ZetaFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2, 1),
|
||||
ZetaFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2),
|
||||
@ -35,7 +36,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
|
||||
ZetaFormat.S8UintD24Unorm => new FormatInfo(Format.S8UintD24Unorm, 1, 1, 4, 2),
|
||||
ZetaFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1, 1),
|
||||
ZetaFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8, 2),
|
||||
_ => FormatInfo.Default
|
||||
_ => FormatInfo.Default,
|
||||
#pragma warning restore IDE0055
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ namespace Ryujinx.Graphics.Gpu
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
_context.DeferredActions.Enqueue(Destroy);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ namespace Ryujinx.Graphics.Gpu
|
||||
private bool _pendingSync;
|
||||
|
||||
private long _modifiedSequence;
|
||||
private ulong _firstTimestamp;
|
||||
private readonly ulong _firstTimestamp;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the GPU emulation context.
|
||||
@ -220,7 +220,7 @@ namespace Ryujinx.Graphics.Gpu
|
||||
/// <returns>The current GPU timestamp</returns>
|
||||
public ulong GetTimestamp()
|
||||
{
|
||||
// Guest timestamp will start at 0, instead of host value.
|
||||
// Guest timestamp will start at 0, instead of host value.
|
||||
ulong ticks = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds) - _firstTimestamp;
|
||||
|
||||
if (GraphicsConfig.FastGpuTime)
|
||||
@ -406,4 +406,4 @@ namespace Ryujinx.Graphics.Gpu
|
||||
Renderer.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
namespace Ryujinx.Graphics.Gpu
|
||||
{
|
||||
#pragma warning disable CA2211 // Non-constant fields should not be visible
|
||||
/// <summary>
|
||||
/// General GPU and graphics configuration.
|
||||
/// </summary>
|
||||
@ -67,4 +68,5 @@ namespace Ryujinx.Graphics.Gpu
|
||||
/// </summary>
|
||||
public static bool EnableTextureRecompression = false;
|
||||
}
|
||||
}
|
||||
#pragma warning restore CA2211
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
private HashSet<ShortTextureCacheEntry> _shortCacheBuilder;
|
||||
private HashSet<ShortTextureCacheEntry> _shortCache;
|
||||
|
||||
private Dictionary<TextureDescriptor, ShortTextureCacheEntry> _shortCacheLookup;
|
||||
private readonly Dictionary<TextureDescriptor, ShortTextureCacheEntry> _shortCacheLookup;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the automatic deletion cache.
|
||||
@ -295,4 +295,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return _textures.GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <summary>
|
||||
/// A default, generic RGBA8 texture format.
|
||||
/// </summary>
|
||||
public static FormatInfo Default { get; } = new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 4, 4);
|
||||
public static FormatInfo Default { get; } = new(Format.R8G8B8A8Unorm, 1, 1, 4, 4);
|
||||
|
||||
/// <summary>
|
||||
/// The format of the texture data.
|
||||
@ -57,16 +57,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <param name="bytesPerPixel">The number of bytes occupied by a single pixel in memory of the texture data</param>
|
||||
public FormatInfo(
|
||||
Format format,
|
||||
int blockWidth,
|
||||
int blockHeight,
|
||||
int bytesPerPixel,
|
||||
int components)
|
||||
int blockWidth,
|
||||
int blockHeight,
|
||||
int bytesPerPixel,
|
||||
int components)
|
||||
{
|
||||
Format = format;
|
||||
BlockWidth = blockWidth;
|
||||
BlockHeight = blockHeight;
|
||||
Format = format;
|
||||
BlockWidth = blockWidth;
|
||||
BlockHeight = blockHeight;
|
||||
BytesPerPixel = bytesPerPixel;
|
||||
Components = components;
|
||||
Components = components;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
@ -8,6 +9,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// </summary>
|
||||
static class FormatTable
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
private enum TextureFormat : uint
|
||||
{
|
||||
// Formats
|
||||
@ -244,6 +247,7 @@ 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
|
||||
@ -357,7 +361,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
A2B10G10R10Sscaled = (A2B10G10R10 << 21) | (Sscaled << 27), // 0x36000000
|
||||
}
|
||||
|
||||
private static readonly Dictionary<TextureFormat, FormatInfo> _textureFormats = new Dictionary<TextureFormat, FormatInfo>()
|
||||
private static readonly Dictionary<TextureFormat, FormatInfo> _textureFormats = new()
|
||||
{
|
||||
{ TextureFormat.R8Unorm, new FormatInfo(Format.R8Unorm, 1, 1, 1, 1) },
|
||||
{ TextureFormat.R8Snorm, new FormatInfo(Format.R8Snorm, 1, 1, 1, 1) },
|
||||
@ -464,10 +468,10 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{ TextureFormat.Astc2D10x10UnormSrgb, new FormatInfo(Format.Astc10x10Srgb, 10, 10, 16, 4) },
|
||||
{ TextureFormat.Astc2D12x10UnormSrgb, new FormatInfo(Format.Astc12x10Srgb, 12, 10, 16, 4) },
|
||||
{ TextureFormat.Astc2D12x12UnormSrgb, new FormatInfo(Format.Astc12x12Srgb, 12, 12, 16, 4) },
|
||||
{ TextureFormat.A5B5G5R1Unorm, new FormatInfo(Format.A1B5G5R5Unorm, 1, 1, 2, 4) }
|
||||
{ TextureFormat.A5B5G5R1Unorm, new FormatInfo(Format.A1B5G5R5Unorm, 1, 1, 2, 4) },
|
||||
};
|
||||
|
||||
private static readonly Dictionary<VertexAttributeFormat, Format> _attribFormats = new Dictionary<VertexAttributeFormat, Format>()
|
||||
private static readonly Dictionary<VertexAttributeFormat, Format> _attribFormats = new()
|
||||
{
|
||||
{ VertexAttributeFormat.R8Unorm, Format.R8Unorm },
|
||||
{ VertexAttributeFormat.R8Snorm, Format.R8Snorm },
|
||||
@ -547,8 +551,9 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{ VertexAttributeFormat.A2B10G10R10Snorm, Format.R10G10B10A2Snorm },
|
||||
{ VertexAttributeFormat.A2B10G10R10Sint, Format.R10G10B10A2Sint },
|
||||
{ VertexAttributeFormat.A2B10G10R10Uscaled, Format.R10G10B10A2Uscaled },
|
||||
{ VertexAttributeFormat.A2B10G10R10Sscaled, Format.R10G10B10A2Sscaled }
|
||||
{ VertexAttributeFormat.A2B10G10R10Sscaled, Format.R10G10B10A2Sscaled },
|
||||
};
|
||||
#pragma warning restore IDE0055
|
||||
|
||||
/// <summary>
|
||||
/// Try getting the texture format from an encoded format integer from the Maxwell texture descriptor.
|
||||
@ -575,4 +580,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return _attribFormats.TryGetValue((VertexAttributeFormat)encoded, out format);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
DescriptorCache = new T2[count];
|
||||
|
||||
Address = address;
|
||||
Size = size;
|
||||
Size = size;
|
||||
|
||||
_memoryTracking = physicalMemory.BeginGranularTracking(address, size, ResourceKind.Pool);
|
||||
_memoryTracking.RegisterPreciseAction(address, size, PreciseAction);
|
||||
@ -219,4 +219,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
_memoryTracking.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,4 +126,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
_pools.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
Average,
|
||||
Minimum,
|
||||
Maximum
|
||||
Maximum,
|
||||
}
|
||||
}
|
||||
|
@ -40,16 +40,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
AddressMode addressP = descriptor.UnpackAddressP();
|
||||
|
||||
CompareMode compareMode = descriptor.UnpackCompareMode();
|
||||
CompareOp compareOp = descriptor.UnpackCompareOp();
|
||||
CompareOp compareOp = descriptor.UnpackCompareOp();
|
||||
|
||||
ColorF color = new ColorF(
|
||||
ColorF color = new(
|
||||
descriptor.BorderColorR,
|
||||
descriptor.BorderColorG,
|
||||
descriptor.BorderColorB,
|
||||
descriptor.BorderColorA);
|
||||
|
||||
float minLod = descriptor.UnpackMinLod();
|
||||
float maxLod = descriptor.UnpackMaxLod();
|
||||
float minLod = descriptor.UnpackMinLod();
|
||||
float maxLod = descriptor.UnpackMaxLod();
|
||||
float mipLodBias = descriptor.UnpackMipLodBias();
|
||||
|
||||
float maxRequestedAnisotropy = descriptor.UnpackMaxAnisotropy();
|
||||
@ -112,4 +112,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
_anisoSampler?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,17 +43,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
0.45833334f,
|
||||
0.46153846f,
|
||||
0.4642857f,
|
||||
0.46666667f
|
||||
0.46666667f,
|
||||
};
|
||||
|
||||
private static readonly float[] _maxAnisotropyLut = new float[]
|
||||
{
|
||||
1, 2, 4, 6, 8, 10, 12, 16
|
||||
1, 2, 4, 6, 8, 10, 12, 16,
|
||||
};
|
||||
|
||||
private const float Frac8ToF32 = 1.0f / 256.0f;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Word0;
|
||||
public uint Word1;
|
||||
public uint Word2;
|
||||
@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the texture wrap mode along the X axis.
|
||||
/// </summary>
|
||||
/// <returns>The texture wrap mode enum</returns>
|
||||
public AddressMode UnpackAddressU()
|
||||
public readonly AddressMode UnpackAddressU()
|
||||
{
|
||||
return (AddressMode)(Word0 & 7);
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the texture wrap mode along the Y axis.
|
||||
/// </summary>
|
||||
/// <returns>The texture wrap mode enum</returns>
|
||||
public AddressMode UnpackAddressV()
|
||||
public readonly AddressMode UnpackAddressV()
|
||||
{
|
||||
return (AddressMode)((Word0 >> 3) & 7);
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the texture wrap mode along the Z axis.
|
||||
/// </summary>
|
||||
/// <returns>The texture wrap mode enum</returns>
|
||||
public AddressMode UnpackAddressP()
|
||||
public readonly AddressMode UnpackAddressP()
|
||||
{
|
||||
return (AddressMode)((Word0 >> 6) & 7);
|
||||
}
|
||||
@ -97,7 +97,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// This is only relevant for shaders with shadow samplers.
|
||||
/// </summary>
|
||||
/// <returns>The depth comparison mode enum</returns>
|
||||
public CompareMode UnpackCompareMode()
|
||||
public readonly CompareMode UnpackCompareMode()
|
||||
{
|
||||
return (CompareMode)((Word0 >> 9) & 1);
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// This is only relevant for shaders with shadow samplers.
|
||||
/// </summary>
|
||||
/// <returns>The depth comparison operation enum</returns>
|
||||
public CompareOp UnpackCompareOp()
|
||||
public readonly CompareOp UnpackCompareOp()
|
||||
{
|
||||
return (CompareOp)(((Word0 >> 10) & 7) + 1);
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks and converts the maximum anisotropy value used for texture anisotropic filtering.
|
||||
/// </summary>
|
||||
/// <returns>The maximum anisotropy</returns>
|
||||
public float UnpackMaxAnisotropy()
|
||||
public readonly float UnpackMaxAnisotropy()
|
||||
{
|
||||
return _maxAnisotropyLut[(Word0 >> 20) & 7];
|
||||
}
|
||||
@ -128,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// that is larger than the texture size.
|
||||
/// </summary>
|
||||
/// <returns>The magnification filter</returns>
|
||||
public MagFilter UnpackMagFilter()
|
||||
public readonly MagFilter UnpackMagFilter()
|
||||
{
|
||||
return (MagFilter)(Word1 & 3);
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// that is smaller than the texture size.
|
||||
/// </summary>
|
||||
/// <returns>The minification filter</returns>
|
||||
public MinFilter UnpackMinFilter()
|
||||
public readonly MinFilter UnpackMinFilter()
|
||||
{
|
||||
SamplerMinFilter minFilter = (SamplerMinFilter)((Word1 >> 4) & 3);
|
||||
SamplerMipFilter mipFilter = (SamplerMipFilter)((Word1 >> 6) & 3);
|
||||
@ -161,24 +161,30 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
case SamplerMipFilter.None:
|
||||
switch (minFilter)
|
||||
{
|
||||
case SamplerMinFilter.Nearest: return MinFilter.Nearest;
|
||||
case SamplerMinFilter.Linear: return MinFilter.Linear;
|
||||
case SamplerMinFilter.Nearest:
|
||||
return MinFilter.Nearest;
|
||||
case SamplerMinFilter.Linear:
|
||||
return MinFilter.Linear;
|
||||
}
|
||||
break;
|
||||
|
||||
case SamplerMipFilter.Nearest:
|
||||
switch (minFilter)
|
||||
{
|
||||
case SamplerMinFilter.Nearest: return MinFilter.NearestMipmapNearest;
|
||||
case SamplerMinFilter.Linear: return MinFilter.LinearMipmapNearest;
|
||||
case SamplerMinFilter.Nearest:
|
||||
return MinFilter.NearestMipmapNearest;
|
||||
case SamplerMinFilter.Linear:
|
||||
return MinFilter.LinearMipmapNearest;
|
||||
}
|
||||
break;
|
||||
|
||||
case SamplerMipFilter.Linear:
|
||||
switch (minFilter)
|
||||
{
|
||||
case SamplerMinFilter.Nearest: return MinFilter.NearestMipmapLinear;
|
||||
case SamplerMinFilter.Linear: return MinFilter.LinearMipmapLinear;
|
||||
case SamplerMinFilter.Nearest:
|
||||
return MinFilter.NearestMipmapLinear;
|
||||
case SamplerMinFilter.Linear:
|
||||
return MinFilter.LinearMipmapLinear;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -190,7 +196,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the seamless cubemap flag.
|
||||
/// </summary>
|
||||
/// <returns>The seamless cubemap flag</returns>
|
||||
public bool UnpackSeamlessCubemap()
|
||||
public readonly bool UnpackSeamlessCubemap()
|
||||
{
|
||||
return (Word1 & (1 << 9)) != 0;
|
||||
}
|
||||
@ -200,7 +206,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// This describes how the final value will be computed from neighbouring pixels.
|
||||
/// </summary>
|
||||
/// <returns>The reduction filter</returns>
|
||||
public ReductionFilter UnpackReductionFilter()
|
||||
public readonly ReductionFilter UnpackReductionFilter()
|
||||
{
|
||||
return (ReductionFilter)((Word1 >> 10) & 3);
|
||||
}
|
||||
@ -211,7 +217,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// which mipmap level to use from a given texture.
|
||||
/// </summary>
|
||||
/// <returns>The level-of-detail bias value</returns>
|
||||
public float UnpackMipLodBias()
|
||||
public readonly float UnpackMipLodBias()
|
||||
{
|
||||
int fixedValue = (int)(Word1 >> 12) & 0x1fff;
|
||||
|
||||
@ -224,7 +230,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the level-of-detail snap value.
|
||||
/// </summary>
|
||||
/// <returns>The level-of-detail snap value</returns>
|
||||
public float UnpackLodSnap()
|
||||
public readonly float UnpackLodSnap()
|
||||
{
|
||||
return _f5ToF32ConversionLut[(Word1 >> 26) & 0x1f];
|
||||
}
|
||||
@ -233,7 +239,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the minimum level-of-detail value.
|
||||
/// </summary>
|
||||
/// <returns>The minimum level-of-detail value</returns>
|
||||
public float UnpackMinLod()
|
||||
public readonly float UnpackMinLod()
|
||||
{
|
||||
return (Word2 & 0xfff) * Frac8ToF32;
|
||||
}
|
||||
@ -242,7 +248,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the maximum level-of-detail value.
|
||||
/// </summary>
|
||||
/// <returns>The maximum level-of-detail value</returns>
|
||||
public float UnpackMaxLod()
|
||||
public readonly float UnpackMaxLod()
|
||||
{
|
||||
return ((Word2 >> 12) & 0xfff) * Frac8ToF32;
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
enum SamplerMinFilter
|
||||
{
|
||||
Nearest = 1,
|
||||
Linear
|
||||
Linear,
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
None = 1,
|
||||
Nearest,
|
||||
Linear
|
||||
Linear,
|
||||
}
|
||||
}
|
||||
|
@ -159,4 +159,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
item?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return new SamplerPool(context, channel.MemoryManager.Physical, address, maximumId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
private bool _modifiedStale = true;
|
||||
|
||||
private ITexture _arrayViewTexture;
|
||||
private Target _arrayViewTarget;
|
||||
private Target _arrayViewTarget;
|
||||
|
||||
private ITexture _flushHostTexture;
|
||||
private ITexture _setHostTexture;
|
||||
@ -334,7 +334,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>The child texture</returns>
|
||||
public Texture CreateView(TextureInfo info, SizeInfo sizeInfo, MultiRange range, int firstLayer, int firstLevel)
|
||||
{
|
||||
Texture texture = new Texture(
|
||||
Texture texture = new(
|
||||
_context,
|
||||
_physicalMemory,
|
||||
info,
|
||||
@ -523,7 +523,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
if (ScaleFactor != scale)
|
||||
{
|
||||
Logger.Debug?.Print(LogClass.Gpu, $"Rescaling {Info.Width}x{Info.Height} {Info.FormatInfo.Format.ToString()} to ({ScaleFactor} to {scale}). ");
|
||||
Logger.Debug?.Print(LogClass.Gpu, $"Rescaling {Info.Width}x{Info.Height} {Info.FormatInfo.Format} to ({ScaleFactor} to {scale}). ");
|
||||
|
||||
ScaleFactor = scale;
|
||||
|
||||
@ -537,7 +537,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
foreach (var view in _views)
|
||||
{
|
||||
Logger.Debug?.Print(LogClass.Gpu, $" Recreating view {Info.Width}x{Info.Height} {Info.FormatInfo.Format.ToString()}.");
|
||||
Logger.Debug?.Print(LogClass.Gpu, $" Recreating view {Info.Width}x{Info.Height} {Info.FormatInfo.Format}.");
|
||||
view.ScaleFactor = scale;
|
||||
|
||||
TextureCreateInfo viewCreateInfo = TextureCache.GetCreateInfo(view.Info, _context.Capabilities, scale);
|
||||
@ -1254,7 +1254,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
FormatInfo formatInfo = TextureCompatibility.ToHostCompatibleFormat(Info, _context.Capabilities);
|
||||
|
||||
TextureCreateInfo createInfo = new TextureCreateInfo(
|
||||
TextureCreateInfo createInfo = new(
|
||||
Info.Width,
|
||||
Info.Height,
|
||||
target == Target.CubemapArray ? 6 : 1,
|
||||
@ -1274,7 +1274,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
ITexture viewTexture = HostTexture.CreateView(createInfo, 0, 0);
|
||||
|
||||
_arrayViewTexture = viewTexture;
|
||||
_arrayViewTarget = target;
|
||||
_arrayViewTarget = target;
|
||||
|
||||
return viewTexture;
|
||||
}
|
||||
@ -1317,29 +1317,21 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
case Target.Texture1D:
|
||||
case Target.Texture1DArray:
|
||||
return target == Target.Texture1D ||
|
||||
target == Target.Texture1DArray;
|
||||
|
||||
return target == Target.Texture1D || target == Target.Texture1DArray;
|
||||
case Target.Texture2D:
|
||||
case Target.Texture2DArray:
|
||||
return target == Target.Texture2D ||
|
||||
target == Target.Texture2DArray;
|
||||
|
||||
return target == Target.Texture2D || target == Target.Texture2DArray;
|
||||
case Target.Cubemap:
|
||||
case Target.CubemapArray:
|
||||
return target == Target.Cubemap ||
|
||||
target == Target.CubemapArray;
|
||||
|
||||
return target == Target.Cubemap || target == Target.CubemapArray;
|
||||
case Target.Texture2DMultisample:
|
||||
case Target.Texture2DMultisampleArray:
|
||||
return target == Target.Texture2DMultisample ||
|
||||
target == Target.Texture2DMultisampleArray;
|
||||
|
||||
return target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray;
|
||||
case Target.Texture3D:
|
||||
return target == Target.Texture3D;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1398,7 +1390,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
Height = info.Height;
|
||||
CanForceAnisotropy = CanTextureForceAnisotropy();
|
||||
|
||||
_depth = info.GetDepth();
|
||||
_depth = info.GetDepth();
|
||||
_layers = info.GetLayers();
|
||||
}
|
||||
|
||||
@ -1714,4 +1706,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <param name="flags">The texture's usage flags, indicating how it is used in the shader</param>
|
||||
public TextureBindingInfo(Target target, Format format, int binding, int cbufSlot, int handle, TextureUsageFlags flags)
|
||||
{
|
||||
Target = target;
|
||||
Format = format;
|
||||
Binding = binding;
|
||||
Target = target;
|
||||
Format = format;
|
||||
Binding = binding;
|
||||
CbufSlot = cbufSlot;
|
||||
Handle = handle;
|
||||
Flags = flags;
|
||||
Handle = handle;
|
||||
Flags = flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -70,4 +70,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
int stages = isCompute ? 1 : Constants.ShaderStages;
|
||||
|
||||
_textureBindings = new TextureBindingInfo[stages][];
|
||||
_imageBindings = new TextureBindingInfo[stages][];
|
||||
_imageBindings = new TextureBindingInfo[stages][];
|
||||
|
||||
_textureState = new TextureState[InitialTextureStateSize];
|
||||
_imageState = new TextureState[InitialImageStateSize];
|
||||
_imageState = new TextureState[InitialImageStateSize];
|
||||
|
||||
for (int stage = 0; stage < stages; stage++)
|
||||
{
|
||||
@ -418,6 +418,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0051 // Remove unused private member
|
||||
/// <summary>
|
||||
/// Counts the total number of texture bindings used by all shader stages.
|
||||
/// </summary>
|
||||
@ -426,16 +427,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < _textureBindings.Length; i++)
|
||||
foreach (TextureBindingInfo[] textureInfo in _textureBindings)
|
||||
{
|
||||
if (_textureBindings[i] != null)
|
||||
if (textureInfo != null)
|
||||
{
|
||||
count += _textureBindings[i].Length;
|
||||
count += textureInfo.Length;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#pragma warning restore IDE0051
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the texture bindings are visible to the host GPU.
|
||||
|
@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
|
||||
private const int OverlapsBufferInitialCapacity = 10;
|
||||
private const int OverlapsBufferMaxCapacity = 10000;
|
||||
private const int OverlapsBufferMaxCapacity = 10000;
|
||||
|
||||
private readonly GpuContext _context;
|
||||
private readonly PhysicalMemory _physicalMemory;
|
||||
@ -224,7 +224,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
for (int i = 0; i < overlapCount; i++)
|
||||
{
|
||||
var other = _textureOverlaps[i];
|
||||
|
||||
|
||||
if (texture != other &&
|
||||
(texture.IsViewCompatible(other.Info, other.Range, true, other.LayerSize, _context.Capabilities, out _, out _) != TextureViewCompatibility.Incompatible ||
|
||||
other.IsViewCompatible(texture.Info, texture.Range, true, texture.LayerSize, _context.Capabilities, out _, out _) != TextureViewCompatibility.Incompatible))
|
||||
@ -278,7 +278,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
width = copyTexture.Width;
|
||||
}
|
||||
|
||||
TextureInfo info = new TextureInfo(
|
||||
TextureInfo info = new(
|
||||
copyTexture.Address.Pack() + offset,
|
||||
GetMinimumWidthInGob(width, sizeHint.Width, formatInfo.BytesPerPixel, copyTexture.LinearLayout),
|
||||
copyTexture.Height,
|
||||
@ -371,16 +371,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
// so the width we get here is the aligned width.
|
||||
if (isLinear)
|
||||
{
|
||||
width = colorState.WidthOrStride / formatInfo.BytesPerPixel;
|
||||
width = colorState.WidthOrStride / formatInfo.BytesPerPixel;
|
||||
stride = colorState.WidthOrStride;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = colorState.WidthOrStride;
|
||||
width = colorState.WidthOrStride;
|
||||
stride = 0;
|
||||
}
|
||||
|
||||
TextureInfo info = new TextureInfo(
|
||||
TextureInfo info = new(
|
||||
colorState.Address.Pack(),
|
||||
GetMinimumWidthInGob(width, sizeHint.Width, formatInfo.BytesPerPixel, isLinear),
|
||||
colorState.Height,
|
||||
@ -449,7 +449,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
FormatInfo formatInfo = dsState.Format.Convert();
|
||||
|
||||
TextureInfo info = new TextureInfo(
|
||||
TextureInfo info = new(
|
||||
dsState.Address.Pack(),
|
||||
GetMinimumWidthInGob(size.Width, sizeHint.Width, formatInfo.BytesPerPixel, false),
|
||||
size.Height,
|
||||
@ -1136,14 +1136,14 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
}
|
||||
|
||||
int width = info.Width / info.SamplesInX;
|
||||
int width = info.Width / info.SamplesInX;
|
||||
int height = info.Height / info.SamplesInY;
|
||||
|
||||
int depth = info.GetDepth() * info.GetLayers();
|
||||
|
||||
if (scale != 1f)
|
||||
{
|
||||
width = (int)MathF.Ceiling(width * scale);
|
||||
width = (int)MathF.Ceiling(width * scale);
|
||||
height = (int)MathF.Ceiling(height * scale);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
Astc10x8,
|
||||
Astc10x10,
|
||||
Astc12x10,
|
||||
Astc12x12
|
||||
Astc12x12,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -629,7 +629,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
TextureMatchQuality.Perfect => TextureViewCompatibility.Full,
|
||||
TextureMatchQuality.FormatAlias => TextureViewCompatibility.FormatAlias,
|
||||
_ => TextureViewCompatibility.Incompatible
|
||||
_ => TextureViewCompatibility.Incompatible,
|
||||
};
|
||||
}
|
||||
|
||||
@ -783,80 +783,33 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>Format class</returns>
|
||||
private static FormatClass GetFormatClass(Format format)
|
||||
{
|
||||
switch (format)
|
||||
return format switch
|
||||
{
|
||||
case Format.Bc1RgbaSrgb:
|
||||
case Format.Bc1RgbaUnorm:
|
||||
return FormatClass.Bc1Rgba;
|
||||
case Format.Bc2Srgb:
|
||||
case Format.Bc2Unorm:
|
||||
return FormatClass.Bc2;
|
||||
case Format.Bc3Srgb:
|
||||
case Format.Bc3Unorm:
|
||||
return FormatClass.Bc3;
|
||||
case Format.Bc4Snorm:
|
||||
case Format.Bc4Unorm:
|
||||
return FormatClass.Bc4;
|
||||
case Format.Bc5Snorm:
|
||||
case Format.Bc5Unorm:
|
||||
return FormatClass.Bc5;
|
||||
case Format.Bc6HSfloat:
|
||||
case Format.Bc6HUfloat:
|
||||
return FormatClass.Bc6;
|
||||
case Format.Bc7Srgb:
|
||||
case Format.Bc7Unorm:
|
||||
return FormatClass.Bc7;
|
||||
case Format.Etc2RgbSrgb:
|
||||
case Format.Etc2RgbUnorm:
|
||||
return FormatClass.Etc2Rgb;
|
||||
case Format.Etc2RgbaSrgb:
|
||||
case Format.Etc2RgbaUnorm:
|
||||
return FormatClass.Etc2Rgba;
|
||||
case Format.Astc4x4Srgb:
|
||||
case Format.Astc4x4Unorm:
|
||||
return FormatClass.Astc4x4;
|
||||
case Format.Astc5x4Srgb:
|
||||
case Format.Astc5x4Unorm:
|
||||
return FormatClass.Astc5x4;
|
||||
case Format.Astc5x5Srgb:
|
||||
case Format.Astc5x5Unorm:
|
||||
return FormatClass.Astc5x5;
|
||||
case Format.Astc6x5Srgb:
|
||||
case Format.Astc6x5Unorm:
|
||||
return FormatClass.Astc6x5;
|
||||
case Format.Astc6x6Srgb:
|
||||
case Format.Astc6x6Unorm:
|
||||
return FormatClass.Astc6x6;
|
||||
case Format.Astc8x5Srgb:
|
||||
case Format.Astc8x5Unorm:
|
||||
return FormatClass.Astc8x5;
|
||||
case Format.Astc8x6Srgb:
|
||||
case Format.Astc8x6Unorm:
|
||||
return FormatClass.Astc8x6;
|
||||
case Format.Astc8x8Srgb:
|
||||
case Format.Astc8x8Unorm:
|
||||
return FormatClass.Astc8x8;
|
||||
case Format.Astc10x5Srgb:
|
||||
case Format.Astc10x5Unorm:
|
||||
return FormatClass.Astc10x5;
|
||||
case Format.Astc10x6Srgb:
|
||||
case Format.Astc10x6Unorm:
|
||||
return FormatClass.Astc10x6;
|
||||
case Format.Astc10x8Srgb:
|
||||
case Format.Astc10x8Unorm:
|
||||
return FormatClass.Astc10x8;
|
||||
case Format.Astc10x10Srgb:
|
||||
case Format.Astc10x10Unorm:
|
||||
return FormatClass.Astc10x10;
|
||||
case Format.Astc12x10Srgb:
|
||||
case Format.Astc12x10Unorm:
|
||||
return FormatClass.Astc12x10;
|
||||
case Format.Astc12x12Srgb:
|
||||
case Format.Astc12x12Unorm:
|
||||
return FormatClass.Astc12x12;
|
||||
}
|
||||
|
||||
return FormatClass.Unclassified;
|
||||
Format.Bc1RgbaSrgb or Format.Bc1RgbaUnorm => FormatClass.Bc1Rgba,
|
||||
Format.Bc2Srgb or Format.Bc2Unorm => FormatClass.Bc2,
|
||||
Format.Bc3Srgb or Format.Bc3Unorm => FormatClass.Bc3,
|
||||
Format.Bc4Snorm or Format.Bc4Unorm => FormatClass.Bc4,
|
||||
Format.Bc5Snorm or Format.Bc5Unorm => FormatClass.Bc5,
|
||||
Format.Bc6HSfloat or Format.Bc6HUfloat => FormatClass.Bc6,
|
||||
Format.Bc7Srgb or Format.Bc7Unorm => FormatClass.Bc7,
|
||||
Format.Etc2RgbSrgb or Format.Etc2RgbUnorm => FormatClass.Etc2Rgb,
|
||||
Format.Etc2RgbaSrgb or Format.Etc2RgbaUnorm => FormatClass.Etc2Rgba,
|
||||
Format.Astc4x4Srgb or Format.Astc4x4Unorm => FormatClass.Astc4x4,
|
||||
Format.Astc5x4Srgb or Format.Astc5x4Unorm => FormatClass.Astc5x4,
|
||||
Format.Astc5x5Srgb or Format.Astc5x5Unorm => FormatClass.Astc5x5,
|
||||
Format.Astc6x5Srgb or Format.Astc6x5Unorm => FormatClass.Astc6x5,
|
||||
Format.Astc6x6Srgb or Format.Astc6x6Unorm => FormatClass.Astc6x6,
|
||||
Format.Astc8x5Srgb or Format.Astc8x5Unorm => FormatClass.Astc8x5,
|
||||
Format.Astc8x6Srgb or Format.Astc8x6Unorm => FormatClass.Astc8x6,
|
||||
Format.Astc8x8Srgb or Format.Astc8x8Unorm => FormatClass.Astc8x8,
|
||||
Format.Astc10x5Srgb or Format.Astc10x5Unorm => FormatClass.Astc10x5,
|
||||
Format.Astc10x6Srgb or Format.Astc10x6Unorm => FormatClass.Astc10x6,
|
||||
Format.Astc10x8Srgb or Format.Astc10x8Unorm => FormatClass.Astc10x8,
|
||||
Format.Astc10x10Srgb or Format.Astc10x10Unorm => FormatClass.Astc10x10,
|
||||
Format.Astc12x10Srgb or Format.Astc12x10Unorm => FormatClass.Astc12x10,
|
||||
Format.Astc12x12Srgb or Format.Astc12x12Unorm => FormatClass.Astc12x12,
|
||||
_ => FormatClass.Unclassified,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// </summary>
|
||||
enum TextureComponent
|
||||
{
|
||||
Zero = 0,
|
||||
Red = 2,
|
||||
Zero = 0,
|
||||
Red = 2,
|
||||
Green = 3,
|
||||
Blue = 4,
|
||||
Blue = 4,
|
||||
Alpha = 5,
|
||||
OneSI = 6,
|
||||
OneF = 7
|
||||
OneF = 7,
|
||||
}
|
||||
|
||||
static class TextureComponentConverter
|
||||
@ -25,19 +25,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>Converted enum</returns>
|
||||
public static SwizzleComponent Convert(this TextureComponent component)
|
||||
{
|
||||
switch (component)
|
||||
return component switch
|
||||
{
|
||||
case TextureComponent.Zero: return SwizzleComponent.Zero;
|
||||
case TextureComponent.Red: return SwizzleComponent.Red;
|
||||
case TextureComponent.Green: return SwizzleComponent.Green;
|
||||
case TextureComponent.Blue: return SwizzleComponent.Blue;
|
||||
case TextureComponent.Alpha: return SwizzleComponent.Alpha;
|
||||
case TextureComponent.OneSI:
|
||||
case TextureComponent.OneF:
|
||||
return SwizzleComponent.One;
|
||||
}
|
||||
|
||||
return SwizzleComponent.Zero;
|
||||
TextureComponent.Zero => SwizzleComponent.Zero,
|
||||
TextureComponent.Red => SwizzleComponent.Red,
|
||||
TextureComponent.Green => SwizzleComponent.Green,
|
||||
TextureComponent.Blue => SwizzleComponent.Blue,
|
||||
TextureComponent.Alpha => SwizzleComponent.Alpha,
|
||||
TextureComponent.OneSI or TextureComponent.OneF => SwizzleComponent.One,
|
||||
_ => SwizzleComponent.Zero,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// </summary>
|
||||
struct TextureDescriptor : ITextureDescriptor, IEquatable<TextureDescriptor>
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public uint Word0;
|
||||
public uint Word1;
|
||||
public uint Word2;
|
||||
@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks Maxwell texture format integer.
|
||||
/// </summary>
|
||||
/// <returns>The texture format integer</returns>
|
||||
public uint UnpackFormat()
|
||||
public readonly uint UnpackFormat()
|
||||
{
|
||||
return Word0 & 0x8007ffff;
|
||||
}
|
||||
@ -33,43 +33,43 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the swizzle component for the texture red color channel.
|
||||
/// </summary>
|
||||
/// <returns>The swizzle component</returns>
|
||||
public TextureComponent UnpackSwizzleR()
|
||||
public readonly TextureComponent UnpackSwizzleR()
|
||||
{
|
||||
return(TextureComponent)((Word0 >> 19) & 7);
|
||||
return (TextureComponent)((Word0 >> 19) & 7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks the swizzle component for the texture green color channel.
|
||||
/// </summary>
|
||||
/// <returns>The swizzle component</returns>
|
||||
public TextureComponent UnpackSwizzleG()
|
||||
public readonly TextureComponent UnpackSwizzleG()
|
||||
{
|
||||
return(TextureComponent)((Word0 >> 22) & 7);
|
||||
return (TextureComponent)((Word0 >> 22) & 7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks the swizzle component for the texture blue color channel.
|
||||
/// </summary>
|
||||
/// <returns>The swizzle component</returns>
|
||||
public TextureComponent UnpackSwizzleB()
|
||||
public readonly TextureComponent UnpackSwizzleB()
|
||||
{
|
||||
return(TextureComponent)((Word0 >> 25) & 7);
|
||||
return (TextureComponent)((Word0 >> 25) & 7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks the swizzle component for the texture alpha color channel.
|
||||
/// </summary>
|
||||
/// <returns>The swizzle component</returns>
|
||||
public TextureComponent UnpackSwizzleA()
|
||||
public readonly TextureComponent UnpackSwizzleA()
|
||||
{
|
||||
return(TextureComponent)((Word0 >> 28) & 7);
|
||||
return (TextureComponent)((Word0 >> 28) & 7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks the 40-bits texture GPU virtual address.
|
||||
/// </summary>
|
||||
/// <returns>The GPU virtual address</returns>
|
||||
public ulong UnpackAddress()
|
||||
public readonly ulong UnpackAddress()
|
||||
{
|
||||
return Word1 | ((ulong)(Word2 & 0xffff) << 32);
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// This defines the texture layout, among other things.
|
||||
/// </summary>
|
||||
/// <returns>The texture descriptor type</returns>
|
||||
public TextureDescriptorType UnpackTextureDescriptorType()
|
||||
public readonly TextureDescriptorType UnpackTextureDescriptorType()
|
||||
{
|
||||
return (TextureDescriptorType)((Word2 >> 21) & 7);
|
||||
}
|
||||
@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Always 32-bytes aligned.
|
||||
/// </summary>
|
||||
/// <returns>The linear texture stride</returns>
|
||||
public int UnpackStride()
|
||||
public readonly int UnpackStride()
|
||||
{
|
||||
return (int)(Word3 & 0xffff) << 5;
|
||||
}
|
||||
@ -99,7 +99,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Must be always 1, ignored by the GPU.
|
||||
/// </summary>
|
||||
/// <returns>THe GOB block X size</returns>
|
||||
public int UnpackGobBlocksInX()
|
||||
public readonly int UnpackGobBlocksInX()
|
||||
{
|
||||
return 1 << (int)(Word3 & 7);
|
||||
}
|
||||
@ -109,7 +109,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Must be always a power of 2, with a maximum value of 32.
|
||||
/// </summary>
|
||||
/// <returns>THe GOB block Y size</returns>
|
||||
public int UnpackGobBlocksInY()
|
||||
public readonly int UnpackGobBlocksInY()
|
||||
{
|
||||
return 1 << (int)((Word3 >> 3) & 7);
|
||||
}
|
||||
@ -120,7 +120,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Must be 1 for any texture target other than 3D textures.
|
||||
/// </summary>
|
||||
/// <returns>The GOB block Z size</returns>
|
||||
public int UnpackGobBlocksInZ()
|
||||
public readonly int UnpackGobBlocksInZ()
|
||||
{
|
||||
return 1 << (int)((Word3 >> 6) & 7);
|
||||
}
|
||||
@ -130,7 +130,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// This is only used for sparse textures, should be 1 otherwise.
|
||||
/// </summary>
|
||||
/// <returns>The number of GOB blocks per tile</returns>
|
||||
public int UnpackGobBlocksInTileX()
|
||||
public readonly int UnpackGobBlocksInTileX()
|
||||
{
|
||||
return 1 << (int)((Word3 >> 10) & 7);
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the number of mipmap levels of the texture.
|
||||
/// </summary>
|
||||
/// <returns>The number of mipmap levels</returns>
|
||||
public int UnpackLevels()
|
||||
public readonly int UnpackLevels()
|
||||
{
|
||||
return (int)(Word3 >> 28) + 1;
|
||||
}
|
||||
@ -148,7 +148,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpack the base level texture width size.
|
||||
/// </summary>
|
||||
/// <returns>The texture width</returns>
|
||||
public int UnpackWidth()
|
||||
public readonly int UnpackWidth()
|
||||
{
|
||||
return (int)(Word4 & 0xffff) + 1;
|
||||
}
|
||||
@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpack the width of a buffer texture.
|
||||
/// </summary>
|
||||
/// <returns>The texture width</returns>
|
||||
public int UnpackBufferTextureWidth()
|
||||
public readonly int UnpackBufferTextureWidth()
|
||||
{
|
||||
return (int)((Word4 & 0xffff) | (Word3 << 16)) + 1;
|
||||
}
|
||||
@ -166,7 +166,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the texture sRGB format flag.
|
||||
/// </summary>
|
||||
/// <returns>True if the texture is sRGB, false otherwise</returns>
|
||||
public bool UnpackSrgb()
|
||||
public readonly bool UnpackSrgb()
|
||||
{
|
||||
return (Word4 & (1 << 22)) != 0;
|
||||
}
|
||||
@ -175,7 +175,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the texture target.
|
||||
/// </summary>
|
||||
/// <returns>The texture target</returns>
|
||||
public TextureTarget UnpackTextureTarget()
|
||||
public readonly TextureTarget UnpackTextureTarget()
|
||||
{
|
||||
return (TextureTarget)((Word4 >> 23) & 0xf);
|
||||
}
|
||||
@ -185,7 +185,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Should be ignored for 1D or buffer textures.
|
||||
/// </summary>
|
||||
/// <returns>The texture height or layers count</returns>
|
||||
public int UnpackHeight()
|
||||
public readonly int UnpackHeight()
|
||||
{
|
||||
return (int)(Word5 & 0xffff) + 1;
|
||||
}
|
||||
@ -195,7 +195,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// The meaning of this value depends on the texture target.
|
||||
/// </summary>
|
||||
/// <returns>The texture depth, layer or faces count</returns>
|
||||
public int UnpackDepth()
|
||||
public readonly int UnpackDepth()
|
||||
{
|
||||
return (int)((Word5 >> 16) & 0x3fff) + 1;
|
||||
}
|
||||
@ -207,7 +207,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// It must be set to false (by the guest driver) for rectangle textures.
|
||||
/// </summary>
|
||||
/// <returns>The texture coordinates normalized flag</returns>
|
||||
public bool UnpackTextureCoordNormalized()
|
||||
public readonly bool UnpackTextureCoordNormalized()
|
||||
{
|
||||
return (Word5 & (1 << 31)) != 0;
|
||||
}
|
||||
@ -216,7 +216,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Unpacks the base mipmap level of the texture.
|
||||
/// </summary>
|
||||
/// <returns>The base mipmap level of the texture</returns>
|
||||
public int UnpackBaseLevel()
|
||||
public readonly int UnpackBaseLevel()
|
||||
{
|
||||
return (int)(Word7 & 0xf);
|
||||
}
|
||||
@ -226,7 +226,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Usually equal to Levels minus 1.
|
||||
/// </summary>
|
||||
/// <returns>The maximum mipmap level (inclusive) of the texture</returns>
|
||||
public int UnpackMaxLevelInclusive()
|
||||
public readonly int UnpackMaxLevelInclusive()
|
||||
{
|
||||
return (int)((Word7 >> 4) & 0xf);
|
||||
}
|
||||
@ -236,7 +236,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// Must be ignored for non-multisample textures.
|
||||
/// </summary>
|
||||
/// <returns>The multisample counts enum</returns>
|
||||
public TextureMsaaMode UnpackTextureMsaaMode()
|
||||
public readonly TextureMsaaMode UnpackTextureMsaaMode()
|
||||
{
|
||||
return (TextureMsaaMode)((Word7 >> 8) & 0xf);
|
||||
}
|
||||
@ -269,5 +269,10 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
return Unsafe.As<TextureDescriptor, Vector256<byte>>(ref this).GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is TextureDescriptor descriptor && Equals(descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
LinearColorKey,
|
||||
Linear,
|
||||
BlockLinear,
|
||||
BlockLinearColorKey
|
||||
BlockLinearColorKey,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,11 +78,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
private int[] _allOffsets;
|
||||
private int[] _sliceSizes;
|
||||
private bool _is3D;
|
||||
private readonly bool _is3D;
|
||||
private bool _hasMipViews;
|
||||
private bool _hasLayerViews;
|
||||
private int _layers;
|
||||
private int _levels;
|
||||
private readonly int _layers;
|
||||
private readonly int _levels;
|
||||
|
||||
private MultiRange TextureRange => Storage.Range;
|
||||
|
||||
@ -96,9 +96,9 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <summary>
|
||||
/// Other texture groups that have incompatible overlaps with this one.
|
||||
/// </summary>
|
||||
private List<TextureIncompatibleOverlap> _incompatibleOverlaps;
|
||||
private readonly List<TextureIncompatibleOverlap> _incompatibleOverlaps;
|
||||
private bool _incompatibleOverlapsDirty = true;
|
||||
private bool _flushIncompatibleOverlaps;
|
||||
private readonly bool _flushIncompatibleOverlaps;
|
||||
|
||||
private BufferHandle _flushBuffer;
|
||||
private bool _flushBufferImported;
|
||||
@ -423,7 +423,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
int offsetIndex = GetOffsetIndex(info.BaseLayer + layer, info.BaseLevel + level);
|
||||
int offset = _allOffsets[offsetIndex];
|
||||
|
||||
ReadOnlySpan<byte> data = dataSpan.Slice(offset - spanBase);
|
||||
ReadOnlySpan<byte> data = dataSpan[(offset - spanBase)..];
|
||||
|
||||
SpanOrArray<byte> result = Storage.ConvertToHostCompatibleFormat(data, info.BaseLevel + level, true);
|
||||
|
||||
@ -1500,13 +1500,13 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
for (int i = 0; i < _allOffsets.Length; i++)
|
||||
{
|
||||
(int layer, int level) = GetLayerLevelForView(i);
|
||||
(_, int level) = GetLayerLevelForView(i);
|
||||
MultiRange handleRange = Storage.Range.Slice((ulong)_allOffsets[i], 1);
|
||||
ulong handleBase = handleRange.GetSubRange(0).Address;
|
||||
|
||||
for (int j = 0; j < other._handles.Length; j++)
|
||||
{
|
||||
(int otherLayer, int otherLevel) = other.GetLayerLevelForView(j);
|
||||
(_, int otherLevel) = other.GetLayerLevelForView(j);
|
||||
MultiRange otherHandleRange = other.Storage.Range.Slice((ulong)other._allOffsets[j], 1);
|
||||
ulong otherHandleBase = otherHandleRange.GetSubRange(0).Address;
|
||||
|
||||
|
@ -22,10 +22,10 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
private const int FlushBalanceMax = 60;
|
||||
private const int FlushBalanceMin = -10;
|
||||
|
||||
private TextureGroup _group;
|
||||
private readonly TextureGroup _group;
|
||||
private int _bindCount;
|
||||
private int _firstLevel;
|
||||
private int _firstLayer;
|
||||
private readonly int _firstLevel;
|
||||
private readonly int _firstLayer;
|
||||
|
||||
// Sync state for texture flush.
|
||||
|
||||
@ -463,8 +463,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
_group.HasCopyDependencies = true;
|
||||
other._group.HasCopyDependencies = true;
|
||||
|
||||
TextureDependency dependency = new TextureDependency(this);
|
||||
TextureDependency otherDependency = new TextureDependency(other);
|
||||
TextureDependency dependency = new(this);
|
||||
TextureDependency otherDependency = new(other);
|
||||
|
||||
dependency.Other = otherDependency;
|
||||
otherDependency.Other = dependency;
|
||||
|
@ -134,45 +134,45 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <param name="swizzleB">Swizzle for the blue color channel</param>
|
||||
/// <param name="swizzleA">Swizzle for the alpha color channel</param>
|
||||
public TextureInfo(
|
||||
ulong gpuAddress,
|
||||
int width,
|
||||
int height,
|
||||
int depthOrLayers,
|
||||
int levels,
|
||||
int samplesInX,
|
||||
int samplesInY,
|
||||
int stride,
|
||||
bool isLinear,
|
||||
int gobBlocksInY,
|
||||
int gobBlocksInZ,
|
||||
int gobBlocksInTileX,
|
||||
Target target,
|
||||
FormatInfo formatInfo,
|
||||
ulong gpuAddress,
|
||||
int width,
|
||||
int height,
|
||||
int depthOrLayers,
|
||||
int levels,
|
||||
int samplesInX,
|
||||
int samplesInY,
|
||||
int stride,
|
||||
bool isLinear,
|
||||
int gobBlocksInY,
|
||||
int gobBlocksInZ,
|
||||
int gobBlocksInTileX,
|
||||
Target target,
|
||||
FormatInfo formatInfo,
|
||||
DepthStencilMode depthStencilMode = DepthStencilMode.Depth,
|
||||
SwizzleComponent swizzleR = SwizzleComponent.Red,
|
||||
SwizzleComponent swizzleG = SwizzleComponent.Green,
|
||||
SwizzleComponent swizzleB = SwizzleComponent.Blue,
|
||||
SwizzleComponent swizzleA = SwizzleComponent.Alpha)
|
||||
SwizzleComponent swizzleR = SwizzleComponent.Red,
|
||||
SwizzleComponent swizzleG = SwizzleComponent.Green,
|
||||
SwizzleComponent swizzleB = SwizzleComponent.Blue,
|
||||
SwizzleComponent swizzleA = SwizzleComponent.Alpha)
|
||||
{
|
||||
GpuAddress = gpuAddress;
|
||||
Width = width;
|
||||
Height = height;
|
||||
DepthOrLayers = depthOrLayers;
|
||||
Levels = levels;
|
||||
SamplesInX = samplesInX;
|
||||
SamplesInY = samplesInY;
|
||||
Stride = stride;
|
||||
IsLinear = isLinear;
|
||||
GobBlocksInY = gobBlocksInY;
|
||||
GobBlocksInZ = gobBlocksInZ;
|
||||
GpuAddress = gpuAddress;
|
||||
Width = width;
|
||||
Height = height;
|
||||
DepthOrLayers = depthOrLayers;
|
||||
Levels = levels;
|
||||
SamplesInX = samplesInX;
|
||||
SamplesInY = samplesInY;
|
||||
Stride = stride;
|
||||
IsLinear = isLinear;
|
||||
GobBlocksInY = gobBlocksInY;
|
||||
GobBlocksInZ = gobBlocksInZ;
|
||||
GobBlocksInTileX = gobBlocksInTileX;
|
||||
Target = target;
|
||||
FormatInfo = formatInfo;
|
||||
Target = target;
|
||||
FormatInfo = formatInfo;
|
||||
DepthStencilMode = depthStencilMode;
|
||||
SwizzleR = swizzleR;
|
||||
SwizzleG = swizzleG;
|
||||
SwizzleB = swizzleB;
|
||||
SwizzleA = swizzleA;
|
||||
SwizzleR = swizzleR;
|
||||
SwizzleG = swizzleG;
|
||||
SwizzleB = swizzleB;
|
||||
SwizzleA = swizzleA;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -318,17 +318,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
// - If the parent format is not compressed, and the view is, the view
|
||||
// size is calculated as described on the first point, but the width and height
|
||||
// of the view must be also multiplied by the block width and height.
|
||||
int width = Math.Max(1, parent.Info.Width >> firstLevel);
|
||||
int width = Math.Max(1, parent.Info.Width >> firstLevel);
|
||||
int height = Math.Max(1, parent.Info.Height >> firstLevel);
|
||||
|
||||
if (parent.Info.FormatInfo.IsCompressed && !FormatInfo.IsCompressed)
|
||||
{
|
||||
width = BitUtils.DivRoundUp(width, parent.Info.FormatInfo.BlockWidth);
|
||||
width = BitUtils.DivRoundUp(width, parent.Info.FormatInfo.BlockWidth);
|
||||
height = BitUtils.DivRoundUp(height, parent.Info.FormatInfo.BlockHeight);
|
||||
}
|
||||
else if (!parent.Info.FormatInfo.IsCompressed && FormatInfo.IsCompressed)
|
||||
{
|
||||
width *= FormatInfo.BlockWidth;
|
||||
width *= FormatInfo.BlockWidth;
|
||||
height *= FormatInfo.BlockHeight;
|
||||
}
|
||||
|
||||
@ -408,4 +408,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
SwizzleA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
_context = context;
|
||||
_channel = channel;
|
||||
|
||||
TexturePoolCache texturePoolCache = new TexturePoolCache(context);
|
||||
SamplerPoolCache samplerPoolCache = new SamplerPoolCache(context);
|
||||
TexturePoolCache texturePoolCache = new(context);
|
||||
SamplerPoolCache samplerPoolCache = new(context);
|
||||
|
||||
float[] scales = new float[64];
|
||||
new Span<float>(scales).Fill(1f);
|
||||
@ -139,7 +139,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to check</param>
|
||||
/// <returns>True if the scale needs updating, false if the scale is up to date</returns>
|
||||
private bool ScaleNeedsUpdated(Texture texture)
|
||||
private static bool ScaleNeedsUpdated(Texture texture)
|
||||
{
|
||||
return texture != null && !(texture.ScaleMode == TextureScaleMode.Blacklisted || texture.ScaleMode == TextureScaleMode.Undesired) && texture.ScaleFactor != GraphicsConfig.ResScale;
|
||||
}
|
||||
@ -234,7 +234,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
void ConsiderTarget(Texture target)
|
||||
{
|
||||
if (target == null) return;
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float scale = target.ScaleFactor;
|
||||
|
||||
switch (target.ScaleMode)
|
||||
@ -445,7 +449,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// </remarks>
|
||||
public void UpdateRenderTargetDepthStencil()
|
||||
{
|
||||
new Span<ITexture>(_rtHostColors).Fill(null);
|
||||
new Span<ITexture>(_rtHostColors).Clear();
|
||||
_rtHostDs = _rtDepthStencil?.HostTexture;
|
||||
|
||||
_context.Renderer.Pipeline.SetRenderTargets(_rtHostColors, _rtHostDs);
|
||||
|
@ -4,6 +4,6 @@
|
||||
{
|
||||
NoMatch,
|
||||
FormatAlias,
|
||||
Perfect
|
||||
Perfect,
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
Ms2x2 = 2,
|
||||
Ms4x2 = 4,
|
||||
Ms2x1 = 5,
|
||||
Ms4x4 = 6
|
||||
Ms4x4 = 6,
|
||||
}
|
||||
|
||||
static class TextureMsaaModeConverter
|
||||
@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
TextureMsaaMode.Ms2x2 => 4,
|
||||
TextureMsaaMode.Ms4x2 => 8,
|
||||
TextureMsaaMode.Ms4x4 => 16,
|
||||
_ => 1
|
||||
_ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
TextureMsaaMode.Ms2x2 => 2,
|
||||
TextureMsaaMode.Ms4x2 => 4,
|
||||
TextureMsaaMode.Ms4x4 => 4,
|
||||
_ => 1
|
||||
_ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
@ -61,8 +61,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
TextureMsaaMode.Ms2x2 => 2,
|
||||
TextureMsaaMode.Ms4x2 => 2,
|
||||
TextureMsaaMode.Ms4x4 => 4,
|
||||
_ => 1
|
||||
_ => 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <summary>
|
||||
/// A request to dereference a texture from a pool.
|
||||
/// </summary>
|
||||
private struct DereferenceRequest
|
||||
private readonly struct DereferenceRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the dereference is due to a mapping change or not.
|
||||
@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
|
||||
private readonly GpuChannel _channel;
|
||||
private readonly ConcurrentQueue<DereferenceRequest> _dereferenceQueue = new ConcurrentQueue<DereferenceRequest>();
|
||||
private readonly ConcurrentQueue<DereferenceRequest> _dereferenceQueue = new();
|
||||
private TextureDescriptor _defaultDescriptor;
|
||||
|
||||
/// <summary>
|
||||
@ -379,10 +379,10 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <param name="descriptor">The texture descriptor</param>
|
||||
/// <param name="layerSize">Layer size for textures using a sub-range of mipmap levels, otherwise 0</param>
|
||||
/// <returns>The texture information</returns>
|
||||
private TextureInfo GetInfo(in TextureDescriptor descriptor, out int layerSize)
|
||||
private static TextureInfo GetInfo(in TextureDescriptor descriptor, out int layerSize)
|
||||
{
|
||||
int depthOrLayers = descriptor.UnpackDepth();
|
||||
int levels = descriptor.UnpackLevels();
|
||||
int levels = descriptor.UnpackLevels();
|
||||
|
||||
TextureMsaaMode msaaMode = descriptor.UnpackTextureMsaaMode();
|
||||
|
||||
@ -424,7 +424,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
|
||||
uint format = descriptor.UnpackFormat();
|
||||
bool srgb = descriptor.UnpackSrgb();
|
||||
bool srgb = descriptor.UnpackSrgb();
|
||||
|
||||
ulong gpuVa = descriptor.UnpackAddress();
|
||||
|
||||
@ -451,7 +451,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
// Linear textures don't support mipmaps, so we don't handle this case here.
|
||||
if ((minLod != 0 || maxLod + 1 != levels) && target != Target.TextureBuffer && !isLinear)
|
||||
{
|
||||
int depth = TextureInfo.GetDepth(target, depthOrLayers);
|
||||
int depth = TextureInfo.GetDepth(target, depthOrLayers);
|
||||
int layers = TextureInfo.GetLayers(target, depthOrLayers);
|
||||
|
||||
SizeInfo sizeInfo = SizeCalculator.GetBlockLinearTextureSize(
|
||||
@ -476,7 +476,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
// address if there is a overlapping texture on the cache that can contain the new texture.
|
||||
gpuVa += (ulong)sizeInfo.GetMipOffset(minLod);
|
||||
|
||||
width = Math.Max(1, width >> minLod);
|
||||
width = Math.Max(1, width >> minLod);
|
||||
height = Math.Max(1, height >> minLod);
|
||||
|
||||
if (target == Target.Texture3D)
|
||||
@ -608,4 +608,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,4 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return new TexturePool(context, channel, address, maximumId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
Eligible = 0,
|
||||
Scaled = 1,
|
||||
Blacklisted = 2,
|
||||
Undesired = 3
|
||||
Undesired = 3,
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
[Flags]
|
||||
enum TextureSearchFlags
|
||||
{
|
||||
None = 0,
|
||||
ForSampler = 1 << 1,
|
||||
ForCopy = 1 << 2,
|
||||
DepthAlias = 1 << 3,
|
||||
None = 0,
|
||||
ForSampler = 1 << 1,
|
||||
ForCopy = 1 << 2,
|
||||
DepthAlias = 1 << 3,
|
||||
WithUpscale = 1 << 4,
|
||||
NoCreate = 1 << 5
|
||||
NoCreate = 1 << 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
Texture2DArray,
|
||||
TextureBuffer,
|
||||
Texture2DRect,
|
||||
CubemapArray
|
||||
CubemapArray,
|
||||
}
|
||||
|
||||
static class TextureTargetConverter
|
||||
@ -33,23 +33,34 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
switch (target)
|
||||
{
|
||||
case TextureTarget.Texture2D: return Target.Texture2DMultisample;
|
||||
case TextureTarget.Texture2DArray: return Target.Texture2DMultisampleArray;
|
||||
case TextureTarget.Texture2D:
|
||||
return Target.Texture2DMultisample;
|
||||
case TextureTarget.Texture2DArray:
|
||||
return Target.Texture2DMultisampleArray;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (target)
|
||||
{
|
||||
case TextureTarget.Texture1D: return Target.Texture1D;
|
||||
case TextureTarget.Texture2D: return Target.Texture2D;
|
||||
case TextureTarget.Texture2DRect: return Target.Texture2D;
|
||||
case TextureTarget.Texture3D: return Target.Texture3D;
|
||||
case TextureTarget.Texture1DArray: return Target.Texture1DArray;
|
||||
case TextureTarget.Texture2DArray: return Target.Texture2DArray;
|
||||
case TextureTarget.Cubemap: return Target.Cubemap;
|
||||
case TextureTarget.CubemapArray: return Target.CubemapArray;
|
||||
case TextureTarget.TextureBuffer: return Target.TextureBuffer;
|
||||
case TextureTarget.Texture1D:
|
||||
return Target.Texture1D;
|
||||
case TextureTarget.Texture2D:
|
||||
return Target.Texture2D;
|
||||
case TextureTarget.Texture2DRect:
|
||||
return Target.Texture2D;
|
||||
case TextureTarget.Texture3D:
|
||||
return Target.Texture3D;
|
||||
case TextureTarget.Texture1DArray:
|
||||
return Target.Texture1DArray;
|
||||
case TextureTarget.Texture2DArray:
|
||||
return Target.Texture2DArray;
|
||||
case TextureTarget.Cubemap:
|
||||
return Target.Cubemap;
|
||||
case TextureTarget.CubemapArray:
|
||||
return Target.CubemapArray;
|
||||
case TextureTarget.TextureBuffer:
|
||||
return Target.TextureBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,17 +76,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
return target switch
|
||||
{
|
||||
TextureTarget.Texture1D => SamplerType.Texture1D,
|
||||
TextureTarget.Texture2D => SamplerType.Texture2D,
|
||||
TextureTarget.Texture3D => SamplerType.Texture3D,
|
||||
TextureTarget.Cubemap => SamplerType.TextureCube,
|
||||
TextureTarget.Texture1D => SamplerType.Texture1D,
|
||||
TextureTarget.Texture2D => SamplerType.Texture2D,
|
||||
TextureTarget.Texture3D => SamplerType.Texture3D,
|
||||
TextureTarget.Cubemap => SamplerType.TextureCube,
|
||||
TextureTarget.Texture1DArray => SamplerType.Texture1D | SamplerType.Array,
|
||||
TextureTarget.Texture2DArray => SamplerType.Texture2D | SamplerType.Array,
|
||||
TextureTarget.TextureBuffer => SamplerType.TextureBuffer,
|
||||
TextureTarget.Texture2DRect => SamplerType.Texture2D,
|
||||
TextureTarget.CubemapArray => SamplerType.TextureCube | SamplerType.Array,
|
||||
_ => SamplerType.Texture2D
|
||||
TextureTarget.TextureBuffer => SamplerType.TextureBuffer,
|
||||
TextureTarget.Texture2DRect => SamplerType.Texture2D,
|
||||
TextureTarget.CubemapArray => SamplerType.TextureCube | SamplerType.Array,
|
||||
_ => SamplerType.Texture2D,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,6 @@
|
||||
LayoutIncompatible,
|
||||
CopyOnly,
|
||||
FormatAlias,
|
||||
Full
|
||||
Full,
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
|
||||
private int _sequenceNumber;
|
||||
|
||||
private bool _useGranular;
|
||||
private readonly bool _useGranular;
|
||||
private bool _syncActionRegistered;
|
||||
|
||||
private int _referenceCount = 1;
|
||||
@ -80,10 +80,10 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
/// <param name="baseBuffers">Buffers which this buffer contains, and will inherit tracking handles from</param>
|
||||
public Buffer(GpuContext context, PhysicalMemory physicalMemory, ulong address, ulong size, IEnumerable<Buffer> baseBuffers = null)
|
||||
{
|
||||
_context = context;
|
||||
_context = context;
|
||||
_physicalMemory = physicalMemory;
|
||||
Address = address;
|
||||
Size = size;
|
||||
Address = address;
|
||||
Size = size;
|
||||
|
||||
Handle = context.Renderer.CreateBuffer((int)size, baseBuffers?.MaxBy(x => x.Size).Handle ?? BufferHandle.Null);
|
||||
|
||||
@ -252,10 +252,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
/// </summary>
|
||||
private void EnsureRangeList()
|
||||
{
|
||||
if (_modifiedRanges == null)
|
||||
{
|
||||
_modifiedRanges = new BufferModifiedRangeList(_context, this, Flush);
|
||||
}
|
||||
_modifiedRanges ??= new BufferModifiedRangeList(_context, this, Flush);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -326,7 +323,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
_syncActionRegistered = true;
|
||||
}
|
||||
|
||||
Action<ulong, ulong> registerRangeAction = (ulong address, ulong size) =>
|
||||
void registerRangeAction(ulong address, ulong size)
|
||||
{
|
||||
if (_useGranular)
|
||||
{
|
||||
@ -336,7 +333,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
_memoryTracking.RegisterAction(_externalFlushDelegate);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
EnsureRangeList();
|
||||
|
||||
@ -643,4 +640,4 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
DecrementReferenceCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,4 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
Flags = flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
class BufferCache : IDisposable
|
||||
{
|
||||
private const int OverlapsBufferInitialCapacity = 10;
|
||||
private const int OverlapsBufferMaxCapacity = 10000;
|
||||
private const int OverlapsBufferMaxCapacity = 10000;
|
||||
|
||||
private const ulong BufferAlignmentSize = 0x1000;
|
||||
private const ulong BufferAlignmentMask = BufferAlignmentSize - 1;
|
||||
@ -246,7 +246,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
Buffer buffer = _bufferOverlaps[index];
|
||||
|
||||
address = Math.Min(address, buffer.Address);
|
||||
address = Math.Min(address, buffer.Address);
|
||||
endAddress = Math.Max(endAddress, buffer.EndAddress);
|
||||
|
||||
lock (_buffers)
|
||||
@ -257,7 +257,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
|
||||
ulong newSize = endAddress - address;
|
||||
|
||||
Buffer newBuffer = new Buffer(_context, _physicalMemory, address, newSize, _bufferOverlaps.Take(overlapsCount));
|
||||
Buffer newBuffer = new(_context, _physicalMemory, address, newSize, _bufferOverlaps.Take(overlapsCount));
|
||||
|
||||
lock (_buffers)
|
||||
{
|
||||
@ -285,7 +285,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
else
|
||||
{
|
||||
// No overlap, just create a new buffer.
|
||||
Buffer buffer = new Buffer(_context, _physicalMemory, address, size);
|
||||
Buffer buffer = new(_context, _physicalMemory, address, size);
|
||||
|
||||
lock (_buffers)
|
||||
{
|
||||
@ -446,7 +446,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
/// </summary>
|
||||
/// <param name="dictionary">Dictionary to prune</param>
|
||||
/// <param name="toDelete">List used to track entries to delete</param>
|
||||
private void Prune(Dictionary<ulong, BufferCacheEntry> dictionary, ref List<ulong> toDelete)
|
||||
private static void Prune(Dictionary<ulong, BufferCacheEntry> dictionary, ref List<ulong> toDelete)
|
||||
{
|
||||
foreach (var entry in dictionary)
|
||||
{
|
||||
@ -504,4 +504,4 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
private readonly BuffersPerStage[] _gpUniformBuffers;
|
||||
|
||||
private BufferHandle _tfInfoBuffer;
|
||||
private int[] _tfInfoData;
|
||||
private readonly int[] _tfInfoData;
|
||||
|
||||
private bool _gpStorageBuffersDirty;
|
||||
private bool _gpUniformBuffersDirty;
|
||||
@ -777,11 +777,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
if (isStorage)
|
||||
{
|
||||
_context.Renderer.Pipeline.SetStorageBuffers(ranges.Slice(0, count));
|
||||
_context.Renderer.Pipeline.SetStorageBuffers(ranges[..count]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.Renderer.Pipeline.SetUniformBuffers(ranges.Slice(0, count));
|
||||
_context.Renderer.Pipeline.SetUniformBuffers(ranges[..count]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Pools;
|
||||
using Ryujinx.Common.Pools;
|
||||
using Ryujinx.Memory.Range;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -71,9 +70,9 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
private const int BackingInitialSize = 8;
|
||||
|
||||
private GpuContext _context;
|
||||
private Buffer _parent;
|
||||
private Action<ulong, ulong> _flushAction;
|
||||
private readonly GpuContext _context;
|
||||
private readonly Buffer _parent;
|
||||
private readonly Action<ulong, ulong> _flushAction;
|
||||
|
||||
private List<BufferMigration> _sources;
|
||||
private BufferMigration _migrationTarget;
|
||||
|
@ -34,11 +34,12 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
/// Adds a new counter to the counter cache, or updates a existing one.
|
||||
/// </summary>
|
||||
/// <param name="gpuVa">GPU virtual address where the counter will be written in memory</param>
|
||||
/// <param name="evt">The new counter</param>
|
||||
public void AddOrUpdate(ulong gpuVa, ICounterEvent evt)
|
||||
{
|
||||
int index = BinarySearch(gpuVa);
|
||||
|
||||
CounterEntry entry = new CounterEntry(gpuVa, evt);
|
||||
CounterEntry entry = new(gpuVa, evt);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
@ -127,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
_items[index].Event?.Flush();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -168,7 +169,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
|
||||
int middle = left + (range >> 1);
|
||||
|
||||
CounterEntry item = _items[middle];
|
||||
CounterEntry item = _items[middle];
|
||||
|
||||
if (item.Address == address)
|
||||
{
|
||||
|
@ -12,4 +12,4 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
|
||||
public IndexType Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user