mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-10-25 07:34:25 +00:00
[ci skip] chore: Fix usage of var
This commit is contained in:
@@ -94,7 +94,7 @@ namespace Ryujinx.Common.Logging.Targets
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var signal = new ManualResetEventSlim(false);
|
using ManualResetEventSlim signal = new ManualResetEventSlim(false);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_messageQueue.Add(new FlushEventArgs(signal));
|
_messageQueue.Add(new FlushEventArgs(signal));
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
GpuChannelComputeState computeState,
|
GpuChannelComputeState computeState,
|
||||||
ulong gpuVa)
|
ulong gpuVa)
|
||||||
{
|
{
|
||||||
if (_cpPrograms.TryGetValue(gpuVa, out var cpShader) && IsShaderEqual(channel, poolState, computeState, cpShader, gpuVa))
|
if (_cpPrograms.TryGetValue(gpuVa, out CachedShaderProgram cpShader) && IsShaderEqual(channel, poolState, computeState, cpShader, gpuVa))
|
||||||
{
|
{
|
||||||
return cpShader;
|
return cpShader;
|
||||||
}
|
}
|
||||||
@@ -252,8 +252,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
{
|
{
|
||||||
channel.TextureManager.UpdateRenderTargets();
|
channel.TextureManager.UpdateRenderTargets();
|
||||||
|
|
||||||
var rtControl = state.RtControl;
|
RtControl rtControl = state.RtControl;
|
||||||
var msaaMode = state.RtMsaaMode;
|
TextureMsaaMode msaaMode = state.RtMsaaMode;
|
||||||
|
|
||||||
pipeline.SamplesCount = msaaMode.SamplesInX() * msaaMode.SamplesInY();
|
pipeline.SamplesCount = msaaMode.SamplesInX() * msaaMode.SamplesInY();
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
{
|
{
|
||||||
int rtIndex = rtControl.UnpackPermutationIndex(index);
|
int rtIndex = rtControl.UnpackPermutationIndex(index);
|
||||||
|
|
||||||
var colorState = rtColorStateSpan[rtIndex];
|
RtColorState colorState = rtColorStateSpan[rtIndex];
|
||||||
|
|
||||||
if (index >= count || colorState.Format == 0 || colorState.WidthOrStride == 0)
|
if (index >= count || colorState.Format == 0 || colorState.WidthOrStride == 0)
|
||||||
{
|
{
|
||||||
@@ -312,12 +312,12 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
ref GpuChannelGraphicsState graphicsState,
|
ref GpuChannelGraphicsState graphicsState,
|
||||||
ShaderAddresses addresses)
|
ShaderAddresses addresses)
|
||||||
{
|
{
|
||||||
if (_gpPrograms.TryGetValue(addresses, out var gpShaders) && IsShaderEqual(channel, ref poolState, ref graphicsState, gpShaders, addresses))
|
if (_gpPrograms.TryGetValue(addresses, out CachedShaderProgram gpShaders) && IsShaderEqual(channel, ref poolState, ref graphicsState, gpShaders, addresses))
|
||||||
{
|
{
|
||||||
return gpShaders;
|
return gpShaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_graphicsShaderCache.TryFind(channel, ref poolState, ref graphicsState, addresses, out gpShaders, out var cachedGuestCode))
|
if (_graphicsShaderCache.TryFind(channel, ref poolState, ref graphicsState, addresses, out gpShaders, out CachedGraphicsGuestCode cachedGuestCode))
|
||||||
{
|
{
|
||||||
_gpPrograms[addresses] = gpShaders;
|
_gpPrograms[addresses] = gpShaders;
|
||||||
return gpShaders;
|
return gpShaders;
|
||||||
@@ -590,7 +590,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
|
|
||||||
for (int i = 0; i < Constants.TotalTransformFeedbackBuffers; i++)
|
for (int i = 0; i < Constants.TotalTransformFeedbackBuffers; i++)
|
||||||
{
|
{
|
||||||
var tf = tfStateSpan[i];
|
TfState tf = tfStateSpan[i];
|
||||||
|
|
||||||
descs[i] = new TransformFeedbackDescriptor(
|
descs[i] = new TransformFeedbackDescriptor(
|
||||||
tf.BufferIndex,
|
tf.BufferIndex,
|
||||||
@@ -696,7 +696,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
/// <returns>The generated translator context</returns>
|
/// <returns>The generated translator context</returns>
|
||||||
public static TranslatorContext DecodeComputeShader(IGpuAccessor gpuAccessor, TargetApi api, ulong gpuVa)
|
public static TranslatorContext DecodeComputeShader(IGpuAccessor gpuAccessor, TargetApi api, ulong gpuVa)
|
||||||
{
|
{
|
||||||
var options = CreateTranslationOptions(api, DefaultFlags | TranslationFlags.Compute);
|
TranslationOptions options = CreateTranslationOptions(api, DefaultFlags | TranslationFlags.Compute);
|
||||||
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,7 +713,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
/// <returns>The generated translator context</returns>
|
/// <returns>The generated translator context</returns>
|
||||||
public static TranslatorContext DecodeGraphicsShader(IGpuAccessor gpuAccessor, TargetApi api, TranslationFlags flags, ulong gpuVa)
|
public static TranslatorContext DecodeGraphicsShader(IGpuAccessor gpuAccessor, TargetApi api, TranslationFlags flags, ulong gpuVa)
|
||||||
{
|
{
|
||||||
var options = CreateTranslationOptions(api, flags);
|
TranslationOptions options = CreateTranslationOptions(api, flags);
|
||||||
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,7 +739,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
{
|
{
|
||||||
ulong cb1DataAddress = channel.BufferManager.GetGraphicsUniformBufferAddress(0, 1);
|
ulong cb1DataAddress = channel.BufferManager.GetGraphicsUniformBufferAddress(0, 1);
|
||||||
|
|
||||||
var memoryManager = channel.MemoryManager;
|
MemoryManager memoryManager = channel.MemoryManager;
|
||||||
|
|
||||||
codeA ??= memoryManager.GetSpan(vertexA.Address, vertexA.Size).ToArray();
|
codeA ??= memoryManager.GetSpan(vertexA.Address, vertexA.Size).ToArray();
|
||||||
codeB ??= memoryManager.GetSpan(currentStage.Address, currentStage.Size).ToArray();
|
codeB ??= memoryManager.GetSpan(currentStage.Address, currentStage.Size).ToArray();
|
||||||
@@ -777,7 +777,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||||||
/// <returns>Compiled graphics shader code</returns>
|
/// <returns>Compiled graphics shader code</returns>
|
||||||
private static TranslatedShader TranslateShader(ShaderDumper dumper, GpuChannel channel, TranslatorContext context, byte[] code, bool asCompute)
|
private static TranslatedShader TranslateShader(ShaderDumper dumper, GpuChannel channel, TranslatorContext context, byte[] code, bool asCompute)
|
||||||
{
|
{
|
||||||
var memoryManager = channel.MemoryManager;
|
MemoryManager memoryManager = channel.MemoryManager;
|
||||||
|
|
||||||
ulong cb1DataAddress = context.Stage == ShaderStage.Compute
|
ulong cb1DataAddress = context.Stage == ShaderStage.Compute
|
||||||
? channel.BufferManager.GetComputeUniformBufferAddress(1)
|
? channel.BufferManager.GetComputeUniformBufferAddress(1)
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
size = DefaultLocalMemorySize;
|
size = DefaultLocalMemorySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lmem = new MemoryDefinition("local_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
MemoryDefinition lmem = new MemoryDefinition("local_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||||
|
|
||||||
LocalMemoryId = Properties.AddLocalMemory(lmem);
|
LocalMemoryId = Properties.AddLocalMemory(lmem);
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
size = DefaultSharedMemorySize;
|
size = DefaultSharedMemorySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
var smem = new MemoryDefinition("shared_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
MemoryDefinition smem = new MemoryDefinition("shared_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||||
|
|
||||||
SharedMemoryId = Properties.AddSharedMemory(smem);
|
SharedMemoryId = Properties.AddSharedMemory(smem);
|
||||||
}
|
}
|
||||||
@@ -273,16 +273,16 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
bool coherent,
|
bool coherent,
|
||||||
bool separate)
|
bool separate)
|
||||||
{
|
{
|
||||||
var dimensions = type == SamplerType.None ? 0 : type.GetDimensions();
|
int dimensions = type == SamplerType.None ? 0 : type.GetDimensions();
|
||||||
var dict = isImage ? _usedImages : _usedTextures;
|
Dictionary<TextureInfo, TextureMeta> dict = isImage ? _usedImages : _usedTextures;
|
||||||
|
|
||||||
var usageFlags = TextureUsageFlags.None;
|
TextureUsageFlags usageFlags = TextureUsageFlags.None;
|
||||||
|
|
||||||
if (intCoords)
|
if (intCoords)
|
||||||
{
|
{
|
||||||
usageFlags |= TextureUsageFlags.NeedsScaleValue;
|
usageFlags |= TextureUsageFlags.NeedsScaleValue;
|
||||||
|
|
||||||
var canScale = _stage.SupportsRenderScale() && arrayLength == 1 && !write && dimensions == 2;
|
bool canScale = _stage.SupportsRenderScale() && arrayLength == 1 && !write && dimensions == 2;
|
||||||
|
|
||||||
if (!canScale)
|
if (!canScale)
|
||||||
{
|
{
|
||||||
@@ -304,9 +304,9 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
// For array textures, we also want to use type as key,
|
// For array textures, we also want to use type as key,
|
||||||
// since we may have texture handles stores in the same buffer, but for textures with different types.
|
// since we may have texture handles stores in the same buffer, but for textures with different types.
|
||||||
var keyType = arrayLength > 1 ? type : SamplerType.None;
|
SamplerType keyType = arrayLength > 1 ? type : SamplerType.None;
|
||||||
var info = new TextureInfo(cbufSlot, handle, arrayLength, separate, keyType, format);
|
TextureInfo info = new TextureInfo(cbufSlot, handle, arrayLength, separate, keyType, format);
|
||||||
var meta = new TextureMeta()
|
TextureMeta meta = new TextureMeta()
|
||||||
{
|
{
|
||||||
AccurateType = accurateType,
|
AccurateType = accurateType,
|
||||||
Type = type,
|
Type = type,
|
||||||
@@ -316,7 +316,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
int setIndex;
|
int setIndex;
|
||||||
int binding;
|
int binding;
|
||||||
|
|
||||||
if (dict.TryGetValue(info, out var existingMeta))
|
if (dict.TryGetValue(info, out TextureMeta existingMeta))
|
||||||
{
|
{
|
||||||
dict[info] = MergeTextureMeta(meta, existingMeta);
|
dict[info] = MergeTextureMeta(meta, existingMeta);
|
||||||
setIndex = existingMeta.Set;
|
setIndex = existingMeta.Set;
|
||||||
@@ -373,7 +373,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
nameSuffix = cbufSlot < 0 ? $"{prefix}_tcb_{handle:X}" : $"{prefix}_cb{cbufSlot}_{handle:X}";
|
nameSuffix = cbufSlot < 0 ? $"{prefix}_tcb_{handle:X}" : $"{prefix}_cb{cbufSlot}_{handle:X}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var definition = new TextureDefinition(
|
TextureDefinition definition = new TextureDefinition(
|
||||||
setIndex,
|
setIndex,
|
||||||
binding,
|
binding,
|
||||||
arrayLength,
|
arrayLength,
|
||||||
@@ -433,8 +433,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
{
|
{
|
||||||
selectedMeta.UsageFlags |= TextureUsageFlags.NeedsScaleValue;
|
selectedMeta.UsageFlags |= TextureUsageFlags.NeedsScaleValue;
|
||||||
|
|
||||||
var dimensions = type.GetDimensions();
|
int dimensions = type.GetDimensions();
|
||||||
var canScale = _stage.SupportsRenderScale() && selectedInfo.ArrayLength == 1 && dimensions == 2;
|
bool canScale = _stage.SupportsRenderScale() && selectedInfo.ArrayLength == 1 && dimensions == 2;
|
||||||
|
|
||||||
if (!canScale)
|
if (!canScale)
|
||||||
{
|
{
|
||||||
@@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
public BufferDescriptor[] GetConstantBufferDescriptors()
|
public BufferDescriptor[] GetConstantBufferDescriptors()
|
||||||
{
|
{
|
||||||
var descriptors = new BufferDescriptor[_usedConstantBufferBindings.Count];
|
BufferDescriptor[] descriptors = new BufferDescriptor[_usedConstantBufferBindings.Count];
|
||||||
|
|
||||||
int descriptorIndex = 0;
|
int descriptorIndex = 0;
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
public BufferDescriptor[] GetStorageBufferDescriptors()
|
public BufferDescriptor[] GetStorageBufferDescriptors()
|
||||||
{
|
{
|
||||||
var descriptors = new BufferDescriptor[_sbSlots.Count];
|
BufferDescriptor[] descriptors = new BufferDescriptor[_sbSlots.Count];
|
||||||
|
|
||||||
int descriptorIndex = 0;
|
int descriptorIndex = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -242,8 +242,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
usedFeatures |= FeatureFlags.VtgAsCompute;
|
usedFeatures |= FeatureFlags.VtgAsCompute;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfgs = new ControlFlowGraph[functions.Length];
|
ControlFlowGraph[] cfgs = new ControlFlowGraph[functions.Length];
|
||||||
var frus = new RegisterUsage.FunctionRegisterUsage[functions.Length];
|
RegisterUsage.FunctionRegisterUsage[] frus = new RegisterUsage.FunctionRegisterUsage[functions.Length];
|
||||||
|
|
||||||
for (int i = 0; i < functions.Length; i++)
|
for (int i = 0; i < functions.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -266,14 +266,14 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
for (int i = 0; i < functions.Length; i++)
|
for (int i = 0; i < functions.Length; i++)
|
||||||
{
|
{
|
||||||
var cfg = cfgs[i];
|
ControlFlowGraph cfg = cfgs[i];
|
||||||
|
|
||||||
int inArgumentsCount = 0;
|
int inArgumentsCount = 0;
|
||||||
int outArgumentsCount = 0;
|
int outArgumentsCount = 0;
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
var fru = frus[i];
|
RegisterUsage.FunctionRegisterUsage fru = frus[i];
|
||||||
|
|
||||||
inArgumentsCount = fru.InArguments.Length;
|
inArgumentsCount = fru.InArguments.Length;
|
||||||
outArgumentsCount = fru.OutArguments.Length;
|
outArgumentsCount = fru.OutArguments.Length;
|
||||||
@@ -325,7 +325,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
FeatureFlags usedFeatures,
|
FeatureFlags usedFeatures,
|
||||||
byte clipDistancesWritten)
|
byte clipDistancesWritten)
|
||||||
{
|
{
|
||||||
var sInfo = StructuredProgram.MakeStructuredProgram(
|
StructuredProgramInfo sInfo = StructuredProgram.MakeStructuredProgram(
|
||||||
funcs,
|
funcs,
|
||||||
attributeUsage,
|
attributeUsage,
|
||||||
definitions,
|
definitions,
|
||||||
@@ -340,7 +340,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
_ => 1
|
_ => 1
|
||||||
};
|
};
|
||||||
|
|
||||||
var info = new ShaderProgramInfo(
|
ShaderProgramInfo info = new ShaderProgramInfo(
|
||||||
resourceManager.GetConstantBufferDescriptors(),
|
resourceManager.GetConstantBufferDescriptors(),
|
||||||
resourceManager.GetStorageBufferDescriptors(),
|
resourceManager.GetStorageBufferDescriptors(),
|
||||||
resourceManager.GetTextureDescriptors(),
|
resourceManager.GetTextureDescriptors(),
|
||||||
@@ -356,7 +356,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
clipDistancesWritten,
|
clipDistancesWritten,
|
||||||
originalDefinitions.OmapTargets);
|
originalDefinitions.OmapTargets);
|
||||||
|
|
||||||
var hostCapabilities = new HostCapabilities(
|
HostCapabilities hostCapabilities = new HostCapabilities(
|
||||||
GpuAccessor.QueryHostReducedPrecision(),
|
GpuAccessor.QueryHostReducedPrecision(),
|
||||||
GpuAccessor.QueryHostSupportsFragmentShaderInterlock(),
|
GpuAccessor.QueryHostSupportsFragmentShaderInterlock(),
|
||||||
GpuAccessor.QueryHostSupportsFragmentShaderOrderingIntel(),
|
GpuAccessor.QueryHostSupportsFragmentShaderOrderingIntel(),
|
||||||
@@ -367,7 +367,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
GpuAccessor.QueryHostSupportsTextureShadowLod(),
|
GpuAccessor.QueryHostSupportsTextureShadowLod(),
|
||||||
GpuAccessor.QueryHostSupportsViewportMask());
|
GpuAccessor.QueryHostSupportsViewportMask());
|
||||||
|
|
||||||
var parameters = new CodeGenParameters(attributeUsage, definitions, resourceManager.Properties, hostCapabilities, GpuAccessor, Options.TargetApi);
|
CodeGenParameters parameters = new CodeGenParameters(attributeUsage, definitions, resourceManager.Properties, hostCapabilities, GpuAccessor, Options.TargetApi);
|
||||||
|
|
||||||
return Options.TargetLanguage switch
|
return Options.TargetLanguage switch
|
||||||
{
|
{
|
||||||
@@ -486,10 +486,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
public ShaderProgram GenerateVertexPassthroughForCompute()
|
public ShaderProgram GenerateVertexPassthroughForCompute()
|
||||||
{
|
{
|
||||||
var attributeUsage = new AttributeUsage(GpuAccessor);
|
AttributeUsage attributeUsage = new AttributeUsage(GpuAccessor);
|
||||||
var resourceManager = new ResourceManager(ShaderStage.Vertex, GpuAccessor);
|
ResourceManager resourceManager = new ResourceManager(ShaderStage.Vertex, GpuAccessor);
|
||||||
|
|
||||||
var reservations = GetResourceReservations();
|
ResourceReservations reservations = GetResourceReservations();
|
||||||
|
|
||||||
int vertexInfoCbBinding = reservations.VertexInfoConstantBufferBinding;
|
int vertexInfoCbBinding = reservations.VertexInfoConstantBufferBinding;
|
||||||
|
|
||||||
@@ -508,7 +508,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
BufferDefinition vertexOutputBuffer = new(BufferLayout.Std430, 1, vertexDataSbBinding, "vb_input", vertexInputStruct);
|
BufferDefinition vertexOutputBuffer = new(BufferLayout.Std430, 1, vertexDataSbBinding, "vb_input", vertexInputStruct);
|
||||||
resourceManager.Properties.AddOrUpdateStorageBuffer(vertexOutputBuffer);
|
resourceManager.Properties.AddOrUpdateStorageBuffer(vertexOutputBuffer);
|
||||||
|
|
||||||
var context = new EmitterContext();
|
EmitterContext context = new EmitterContext();
|
||||||
|
|
||||||
Operand vertexIndex = Options.TargetApi == TargetApi.OpenGL
|
Operand vertexIndex = Options.TargetApi == TargetApi.OpenGL
|
||||||
? context.Load(StorageKind.Input, IoVariable.VertexId)
|
? context.Load(StorageKind.Input, IoVariable.VertexId)
|
||||||
@@ -553,13 +553,13 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var operations = context.GetOperations();
|
Operation[] operations = context.GetOperations();
|
||||||
var cfg = ControlFlowGraph.Create(operations);
|
ControlFlowGraph cfg = ControlFlowGraph.Create(operations);
|
||||||
var function = new Function(cfg.Blocks, "main", false, 0, 0);
|
Function function = new Function(cfg.Blocks, "main", false, 0, 0);
|
||||||
|
|
||||||
var transformFeedbackOutputs = GetTransformFeedbackOutputs(GpuAccessor, out ulong transformFeedbackVecMap);
|
TransformFeedbackOutput[] transformFeedbackOutputs = GetTransformFeedbackOutputs(GpuAccessor, out ulong transformFeedbackVecMap);
|
||||||
|
|
||||||
var definitions = new ShaderDefinitions(ShaderStage.Vertex, transformFeedbackVecMap, transformFeedbackOutputs)
|
ShaderDefinitions definitions = new ShaderDefinitions(ShaderStage.Vertex, transformFeedbackVecMap, transformFeedbackOutputs)
|
||||||
{
|
{
|
||||||
LastInVertexPipeline = true
|
LastInVertexPipeline = true
|
||||||
};
|
};
|
||||||
@@ -604,10 +604,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributeUsage = new AttributeUsage(GpuAccessor);
|
AttributeUsage attributeUsage = new AttributeUsage(GpuAccessor);
|
||||||
var resourceManager = new ResourceManager(ShaderStage.Geometry, GpuAccessor);
|
ResourceManager resourceManager = new ResourceManager(ShaderStage.Geometry, GpuAccessor);
|
||||||
|
|
||||||
var context = new EmitterContext();
|
EmitterContext context = new EmitterContext();
|
||||||
|
|
||||||
for (int v = 0; v < maxOutputVertices; v++)
|
for (int v = 0; v < maxOutputVertices; v++)
|
||||||
{
|
{
|
||||||
@@ -648,11 +648,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
context.EndPrimitive();
|
context.EndPrimitive();
|
||||||
|
|
||||||
var operations = context.GetOperations();
|
Operation[] operations = context.GetOperations();
|
||||||
var cfg = ControlFlowGraph.Create(operations);
|
ControlFlowGraph cfg = ControlFlowGraph.Create(operations);
|
||||||
var function = new Function(cfg.Blocks, "main", false, 0, 0);
|
Function function = new Function(cfg.Blocks, "main", false, 0, 0);
|
||||||
|
|
||||||
var definitions = new ShaderDefinitions(
|
ShaderDefinitions definitions = new ShaderDefinitions(
|
||||||
ShaderStage.Geometry,
|
ShaderStage.Geometry,
|
||||||
GpuAccessor.QueryGraphicsState(),
|
GpuAccessor.QueryGraphicsState(),
|
||||||
false,
|
false,
|
||||||
|
|||||||
@@ -904,8 +904,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
pattern.OffsetIndex.CopyTo(shaderParams[..pattern.OffsetIndex.Length]);
|
pattern.OffsetIndex.CopyTo(shaderParams[..pattern.OffsetIndex.Length]);
|
||||||
|
|
||||||
using var patternScoped = gd.BufferManager.ReserveOrCreate(gd, cbs, ParamsBufferSize);
|
using ScopedTemporaryBuffer patternScoped = gd.BufferManager.ReserveOrCreate(gd, cbs, ParamsBufferSize);
|
||||||
var patternBuffer = patternScoped.Holder;
|
BufferHolder patternBuffer = patternScoped.Holder;
|
||||||
|
|
||||||
patternBuffer.SetDataUnchecked<int>(patternScoped.Offset, shaderParams);
|
patternBuffer.SetDataUnchecked<int>(patternScoped.Offset, shaderParams);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Debugger
|
namespace Ryujinx.HLE.Debugger
|
||||||
{
|
{
|
||||||
@@ -52,7 +53,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var originalInstruction = new byte[length];
|
byte[] originalInstruction = new byte[length];
|
||||||
if (!ReadMemory(address, originalInstruction))
|
if (!ReadMemory(address, originalInstruction))
|
||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.GdbStub, $"Failed to read memory at 0x{address:X16} to set breakpoint.");
|
Logger.Error?.Print(LogClass.GdbStub, $"Failed to read memory at 0x{address:X16} to set breakpoint.");
|
||||||
@@ -65,7 +66,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var breakpoint = new Breakpoint(originalInstruction);
|
Breakpoint breakpoint = new(originalInstruction);
|
||||||
if (_breakpoints.TryAdd(address, breakpoint))
|
if (_breakpoints.TryAdd(address, breakpoint))
|
||||||
{
|
{
|
||||||
Logger.Debug?.Print(LogClass.GdbStub, $"Breakpoint set at 0x{address:X16}");
|
Logger.Debug?.Print(LogClass.GdbStub, $"Breakpoint set at 0x{address:X16}");
|
||||||
@@ -106,7 +107,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
foreach (var bp in _breakpoints)
|
foreach (KeyValuePair<ulong, Breakpoint> bp in _breakpoints)
|
||||||
{
|
{
|
||||||
if (!WriteMemory(bp.Key, bp.Value.OriginalData))
|
if (!WriteMemory(bp.Key, bp.Value.OriginalData))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -25,11 +26,11 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
|
|
||||||
public string GetMinidump()
|
public string GetMinidump()
|
||||||
{
|
{
|
||||||
var response = new StringBuilder();
|
StringBuilder response = new();
|
||||||
response.AppendLine("=== Begin Minidump ===\n");
|
response.AppendLine("=== Begin Minidump ===\n");
|
||||||
response.AppendLine(GetProcessInfo());
|
response.AppendLine(GetProcessInfo());
|
||||||
|
|
||||||
foreach (var thread in GetThreads())
|
foreach (KThread thread in GetThreads())
|
||||||
{
|
{
|
||||||
response.AppendLine($"=== Thread {thread.ThreadUid} ===");
|
response.AppendLine($"=== Thread {thread.ThreadUid} ===");
|
||||||
try
|
try
|
||||||
@@ -66,7 +67,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
if (Process is not { } kProcess)
|
if (Process is not { } kProcess)
|
||||||
return "No application process found\n";
|
return "No application process found\n";
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
StringBuilder sb = new();
|
||||||
|
|
||||||
sb.AppendLine($"Program Id: 0x{kProcess.TitleId:x16}");
|
sb.AppendLine($"Program Id: 0x{kProcess.TitleId:x16}");
|
||||||
sb.AppendLine($"Application: {(kProcess.IsApplication ? 1 : 0)}");
|
sb.AppendLine($"Application: {(kProcess.IsApplication ? 1 : 0)}");
|
||||||
@@ -81,7 +82,7 @@ namespace Ryujinx.HLE.Debugger
|
|||||||
$" Stack: 0x{kProcess.MemoryManager.StackRegionStart:x10} - 0x{kProcess.MemoryManager.StackRegionEnd - 1:x10}");
|
$" Stack: 0x{kProcess.MemoryManager.StackRegionStart:x10} - 0x{kProcess.MemoryManager.StackRegionEnd - 1:x10}");
|
||||||
|
|
||||||
sb.AppendLine("Modules:");
|
sb.AppendLine("Modules:");
|
||||||
var debugger = kProcess.Debugger;
|
HleProcessDebugger debugger = kProcess.Debugger;
|
||||||
if (debugger != null)
|
if (debugger != null)
|
||||||
{
|
{
|
||||||
foreach (HleProcessDebugger.Image image in debugger.GetLoadedImages())
|
foreach (HleProcessDebugger.Image image in debugger.GetLoadedImages())
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = new byte[len];
|
byte[] data = new byte[len];
|
||||||
Debugger.DebugProcess.CpuMemory.Read(addr, data);
|
Debugger.DebugProcess.CpuMemory.Read(addr, data);
|
||||||
Processor.Reply(Helpers.ToHex(data));
|
Processor.Reply(Helpers.ToHex(data));
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = new byte[len];
|
byte[] data = new byte[len];
|
||||||
for (ulong i = 0; i < len; i++)
|
for (ulong i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
data[i] = (byte)ss.ReadLengthAsHex(2);
|
data[i] = (byte)ss.ReadLengthAsHex(2);
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
{
|
{
|
||||||
moduleName = string.Empty;
|
moduleName = string.Empty;
|
||||||
|
|
||||||
var rodataStart = image.BaseAddress + image.Size;
|
ulong rodataStart = image.BaseAddress + image.Size;
|
||||||
|
|
||||||
KMemoryInfo roInfo = _owner.MemoryManager.QueryMemory(rodataStart);
|
KMemoryInfo roInfo = _owner.MemoryManager.QueryMemory(rodataStart);
|
||||||
if (roInfo.Permission != KMemoryPermission.Read)
|
if (roInfo.Permission != KMemoryPermission.Read)
|
||||||
@@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rwdataStart = roInfo.Address + roInfo.Size;
|
ulong rwdataStart = roInfo.Address + roInfo.Size;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -305,7 +305,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
}
|
}
|
||||||
|
|
||||||
pathLength = Math.Min(pathLength, rodataBuf.Length - 8);
|
pathLength = Math.Min(pathLength, rodataBuf.Length - 8);
|
||||||
var pathBuf = rodataBuf.Slice(8, pathLength);
|
Span<byte> pathBuf = rodataBuf.Slice(8, pathLength);
|
||||||
int lastSlash = pathBuf.LastIndexOfAny(new byte[] { (byte)'\\', (byte)'/' });
|
int lastSlash = pathBuf.LastIndexOfAny(new byte[] { (byte)'\\', (byte)'/' });
|
||||||
|
|
||||||
moduleName = Encoding.ASCII.GetString(pathBuf.Slice(lastSlash + 1).TrimEnd((byte)0));
|
moduleName = Encoding.ASCII.GetString(pathBuf.Slice(lastSlash + 1).TrimEnd((byte)0));
|
||||||
@@ -483,12 +483,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||||||
|
|
||||||
lock (_images)
|
lock (_images)
|
||||||
{
|
{
|
||||||
var image = new Image(textOffset, textSize, symbols.OrderBy(x => x.Value).ToArray());
|
Image image = new(textOffset, textSize, symbols.OrderBy(x => x.Value).ToArray());
|
||||||
|
|
||||||
string moduleName;
|
if (!GetModuleName(out string moduleName, image))
|
||||||
if (!GetModuleName(out moduleName, image))
|
|
||||||
{
|
{
|
||||||
var newIndex = _images.Count;
|
int newIndex = _images.Count;
|
||||||
moduleName = $"(unknown{newIndex})";
|
moduleName = $"(unknown{newIndex})";
|
||||||
}
|
}
|
||||||
image.Name = moduleName;
|
image.Name = moduleName;
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
if (HasConfiguration)
|
if (HasConfiguration)
|
||||||
{
|
{
|
||||||
var joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
JoyconConfigControllerStick<GamepadInputId, Common.Configuration.Hid.Controller.StickInputId> joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
||||||
|
|
||||||
if (joyconStickConfig != null)
|
if (joyconStickConfig != null)
|
||||||
{
|
{
|
||||||
@@ -398,7 +398,7 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
public bool IsPressed(GamepadButtonInputId inputId)
|
public bool IsPressed(GamepadButtonInputId inputId)
|
||||||
{
|
{
|
||||||
if (!_buttonsDriverMapping.TryGetValue(inputId, out var button))
|
if (!_buttonsDriverMapping.TryGetValue(inputId, out SDL_GameControllerButton button))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
private static (int leftIndex, int rightIndex) DetectJoyConPair(List<string> gamepadsIds)
|
private static (int leftIndex, int rightIndex) DetectJoyConPair(List<string> gamepadsIds)
|
||||||
{
|
{
|
||||||
var gamepadNames = gamepadsIds.Where(gamepadId => gamepadId != Id)
|
List<string> gamepadNames = gamepadsIds.Where(gamepadId => gamepadId != Id)
|
||||||
.Select((_, index) => SDL_GameControllerNameForIndex(index)).ToList();
|
.Select((_, index) => SDL_GameControllerNameForIndex(index)).ToList();
|
||||||
int leftIndex = gamepadNames.IndexOf(SDL2JoyCon.LeftName);
|
int leftIndex = gamepadNames.IndexOf(SDL2JoyCon.LeftName);
|
||||||
int rightIndex = gamepadNames.IndexOf(SDL2JoyCon.RightName);
|
int rightIndex = gamepadNames.IndexOf(SDL2JoyCon.RightName);
|
||||||
|
|||||||
@@ -848,7 +848,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
|||||||
|
|
||||||
TimeSpan temporary = TimeSpan.Zero;
|
TimeSpan temporary = TimeSpan.Zero;
|
||||||
|
|
||||||
foreach (var installedApplication in Applications.Items)
|
foreach (ApplicationData installedApplication in Applications.Items)
|
||||||
{
|
{
|
||||||
temporary += LoadAndSaveMetaData(installedApplication.IdString).TimePlayed;
|
temporary += LoadAndSaveMetaData(installedApplication.IdString).TimePlayed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Ryujinx.Ava.Systems
|
|||||||
WorkingDirectory = executableDirectory,
|
WorkingDirectory = executableDirectory,
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var arg in args)
|
foreach (string arg in args)
|
||||||
{
|
{
|
||||||
processStart.ArgumentList.Add(arg);
|
processStart.ArgumentList.Add(arg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Ryujinx.Ava.UI.Applet
|
|||||||
|
|
||||||
private string GetWindowsFontByLanguage()
|
private string GetWindowsFontByLanguage()
|
||||||
{
|
{
|
||||||
var culture = CultureInfo.CurrentUICulture;
|
CultureInfo culture = CultureInfo.CurrentUICulture;
|
||||||
string langCode = culture.Name;
|
string langCode = culture.Name;
|
||||||
|
|
||||||
return culture.TwoLetterISOLanguageName switch
|
return culture.TwoLetterISOLanguageName switch
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Models
|
|||||||
|
|
||||||
private static async Task<string> GetAllAsyncRequestImpl(HttpClient client = null)
|
private static async Task<string> GetAllAsyncRequestImpl(HttpClient client = null)
|
||||||
{
|
{
|
||||||
var ldnWebHost = ConfigurationState.Instance.Multiplayer.GetLdnWebServer();
|
string ldnWebHost = ConfigurationState.Instance.Multiplayer.GetLdnWebServer();
|
||||||
|
|
||||||
LocaleManager.Associate(LocaleKeys.LdnGameListRefreshToolTip, ldnWebHost);
|
LocaleManager.Associate(LocaleKeys.LdnGameListRefreshToolTip, ldnWebHost);
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
SortApply();
|
SortApply();
|
||||||
}
|
}
|
||||||
|
|
||||||
var filtered = _visibleEntries;
|
IEnumerable<LdnGameModel> filtered = _visibleEntries;
|
||||||
|
|
||||||
if (OnlyShowForOwnedGames)
|
if (OnlyShowForOwnedGames)
|
||||||
filtered = filtered.Where(x => _ownedGameTitleIds.ContainsIgnoreCase(x.Title.Id));
|
filtered = filtered.Where(x => _ownedGameTitleIds.ContainsIgnoreCase(x.Title.Id));
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
if (ts.HasValue)
|
if (ts.HasValue)
|
||||||
{
|
{
|
||||||
var formattedPlayTime = ValueFormatUtils.FormatTimeSpan(ts.Value);
|
string formattedPlayTime = ValueFormatUtils.FormatTimeSpan(ts.Value);
|
||||||
LocaleManager.Associate(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
LocaleManager.Associate(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
||||||
ShowTotalTimePlayed = formattedPlayTime != string.Empty;
|
ShowTotalTimePlayed = formattedPlayTime != string.Empty;
|
||||||
return;
|
return;
|
||||||
@@ -827,10 +827,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
private void RefreshGrid()
|
private void RefreshGrid()
|
||||||
{
|
{
|
||||||
var appsList = Applications.ToObservableChangeSet()
|
IObservableList<ApplicationData> appsList = Applications.ToObservableChangeSet()
|
||||||
.Filter(Filter)
|
.Filter(Filter)
|
||||||
.Sort(GetComparer())
|
.Sort(GetComparer())
|
||||||
.Bind(out var apps)
|
.Bind(out ReadOnlyObservableCollection<ApplicationData> apps)
|
||||||
.AsObservableList();
|
.AsObservableList();
|
||||||
|
|
||||||
AppsObservableList = apps;
|
AppsObservableList = apps;
|
||||||
|
|||||||
@@ -447,9 +447,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
_virtualFileSystem = virtualFileSystem;
|
_virtualFileSystem = virtualFileSystem;
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
|
|
||||||
if (gameIconData != null && gameIconData.Length > 0)
|
if (gameIconData is { Length: > 0 })
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream(gameIconData);
|
using MemoryStream ms = new(gameIconData);
|
||||||
_gameIcon = new Bitmap(ms);
|
_gameIcon = new Bitmap(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user