mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-11-19 17:21:15 +01:00
misc: chore: Use explicit types & fix object creation
This commit is contained in:
1 parent
9d3fecf334
commit
76a123b81d
454 files changed
+3042
-2961
No files matched your search
@@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
size = DefaultLocalMemorySize;
|
||||
}
|
||||
|
||||
var lmem = new MemoryDefinition("local_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||
MemoryDefinition lmem = new("local_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||
|
||||
LocalMemoryId = Properties.AddLocalMemory(lmem);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
size = DefaultSharedMemorySize;
|
||||
}
|
||||
|
||||
var smem = new MemoryDefinition("shared_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||
MemoryDefinition smem = new("shared_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||
|
||||
SharedMemoryId = Properties.AddSharedMemory(smem);
|
||||
}
|
||||
@@ -273,16 +273,16 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
bool coherent,
|
||||
bool separate)
|
||||
{
|
||||
var dimensions = type == SamplerType.None ? 0 : type.GetDimensions();
|
||||
var dict = isImage ? _usedImages : _usedTextures;
|
||||
int dimensions = type == SamplerType.None ? 0 : type.GetDimensions();
|
||||
Dictionary<TextureInfo, TextureMeta> dict = isImage ? _usedImages : _usedTextures;
|
||||
|
||||
var usageFlags = TextureUsageFlags.None;
|
||||
TextureUsageFlags usageFlags = TextureUsageFlags.None;
|
||||
|
||||
if (intCoords)
|
||||
{
|
||||
usageFlags |= TextureUsageFlags.NeedsScaleValue;
|
||||
|
||||
var canScale = _stage.SupportsRenderScale() && arrayLength == 1 && !write && dimensions == 2;
|
||||
bool canScale = _stage.SupportsRenderScale() && arrayLength == 1 && !write && dimensions == 2;
|
||||
|
||||
if (!canScale)
|
||||
{
|
||||
@@ -304,9 +304,9 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
|
||||
// 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.
|
||||
var keyType = arrayLength > 1 ? type : SamplerType.None;
|
||||
var info = new TextureInfo(cbufSlot, handle, arrayLength, separate, keyType, format);
|
||||
var meta = new TextureMeta()
|
||||
SamplerType keyType = arrayLength > 1 ? type : SamplerType.None;
|
||||
TextureInfo info = new(cbufSlot, handle, arrayLength, separate, keyType, format);
|
||||
TextureMeta meta = new()
|
||||
{
|
||||
AccurateType = accurateType,
|
||||
Type = type,
|
||||
@@ -316,7 +316,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
int setIndex;
|
||||
int binding;
|
||||
|
||||
if (dict.TryGetValue(info, out var existingMeta))
|
||||
if (dict.TryGetValue(info, out TextureMeta existingMeta))
|
||||
{
|
||||
dict[info] = MergeTextureMeta(meta, existingMeta);
|
||||
setIndex = existingMeta.Set;
|
||||
@@ -373,7 +373,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
nameSuffix = cbufSlot < 0 ? $"{prefix}_tcb_{handle:X}" : $"{prefix}_cb{cbufSlot}_{handle:X}";
|
||||
}
|
||||
|
||||
var definition = new TextureDefinition(
|
||||
TextureDefinition definition = new(
|
||||
setIndex,
|
||||
binding,
|
||||
arrayLength,
|
||||
@@ -433,8 +433,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
{
|
||||
selectedMeta.UsageFlags |= TextureUsageFlags.NeedsScaleValue;
|
||||
|
||||
var dimensions = type.GetDimensions();
|
||||
var canScale = _stage.SupportsRenderScale() && selectedInfo.ArrayLength == 1 && dimensions == 2;
|
||||
int dimensions = type.GetDimensions();
|
||||
bool canScale = _stage.SupportsRenderScale() && selectedInfo.ArrayLength == 1 && dimensions == 2;
|
||||
|
||||
if (!canScale)
|
||||
{
|
||||
@@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
|
||||
public BufferDescriptor[] GetConstantBufferDescriptors()
|
||||
{
|
||||
var descriptors = new BufferDescriptor[_usedConstantBufferBindings.Count];
|
||||
BufferDescriptor[] descriptors = new BufferDescriptor[_usedConstantBufferBindings.Count];
|
||||
|
||||
int descriptorIndex = 0;
|
||||
|
||||
@@ -478,7 +478,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
|
||||
public BufferDescriptor[] GetStorageBufferDescriptors()
|
||||
{
|
||||
var descriptors = new BufferDescriptor[_sbSlots.Count];
|
||||
BufferDescriptor[] descriptors = new BufferDescriptor[_sbSlots.Count];
|
||||
|
||||
int descriptorIndex = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user