Image Constant Fixes

Allows Mario Party Superstars to boot
This commit is contained in:
Isaac Marovitz 2024-08-01 11:52:14 +01:00
parent 95318b9abe
commit c30c609624
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
5 changed files with 19 additions and 24 deletions

View File

@ -7,9 +7,12 @@ namespace Ryujinx.Graphics.Metal
public const int MaxUniformBuffersPerStage = 18;
public const int MaxStorageBuffersPerStage = 16;
public const int MaxTexturesPerStage = 64;
public const int MaxImagesPerStage = 16;
public const int MaxUniformBufferBindings = MaxUniformBuffersPerStage * MaxShaderStages;
public const int MaxStorageBufferBindings = MaxStorageBuffersPerStage * MaxShaderStages;
public const int MaxTextureBindings = MaxTexturesPerStage * MaxShaderStages;
public const int MaxImageBindings = MaxImagesPerStage * MaxShaderStages;
public const int MaxColorAttachments = 8;
public const int MaxViewports = 16;
// TODO: Check this value

View File

@ -106,8 +106,8 @@ namespace Ryujinx.Graphics.Metal
public readonly BufferRef[] UniformBufferRefs = new BufferRef[Constants.MaxUniformBufferBindings];
public readonly BufferRef[] StorageBufferRefs = new BufferRef[Constants.MaxStorageBufferBindings];
public readonly TextureRef[] TextureRefs = new TextureRef[Constants.MaxTextureBindings];
public readonly ImageRef[] ImageRefs = new ImageRef[Constants.MaxTextureBindings];
public readonly TextureRef[] TextureRefs = new TextureRef[Constants.MaxTextureBindings * 2];
public readonly ImageRef[] ImageRefs = new ImageRef[Constants.MaxImageBindings * 2];
public ArrayRef<TextureArray>[] TextureArrayRefs = [];
public ArrayRef<ImageArray>[] ImageArrayRefs = [];

View File

@ -802,7 +802,7 @@ namespace Ryujinx.Graphics.Metal
SignalDirty(DirtyFlags.StencilRef);
}
public readonly void UpdateTextureAndSampler(ShaderStage stage, ulong binding, TextureBase texture, Sampler sampler)
public readonly void UpdateTextureAndSampler(ShaderStage stage, int binding, TextureBase texture, Sampler sampler)
{
if (texture != null)
{
@ -816,9 +816,9 @@ namespace Ryujinx.Graphics.Metal
SignalDirty(DirtyFlags.Textures);
}
public readonly void UpdateImage(ShaderStage stage, ulong binding, TextureBase texture)
public readonly void UpdateImage(ShaderStage stage, int binding, TextureBase image)
{
if (texture is Texture view)
if (image is Texture view)
{
_currentState.ImageRefs[binding] = new(stage, view);
}
@ -830,9 +830,9 @@ namespace Ryujinx.Graphics.Metal
SignalDirty(DirtyFlags.Images);
}
public void UpdateTextureArray(ShaderStage stage, ulong binding, TextureArray array)
public void UpdateTextureArray(ShaderStage stage, int binding, TextureArray array)
{
ref EncoderState.ArrayRef<TextureArray> arrayRef = ref GetArrayRef(ref _currentState.TextureArrayRefs, (int)binding, ArrayGrowthSize);
ref EncoderState.ArrayRef<TextureArray> arrayRef = ref GetArrayRef(ref _currentState.TextureArrayRefs, binding, ArrayGrowthSize);
if (arrayRef.Stage != stage || arrayRef.Array != array)
{
@ -854,9 +854,9 @@ namespace Ryujinx.Graphics.Metal
}
}
public void UpdateImageArray(ShaderStage stage, ulong binding, ImageArray array)
public void UpdateImageArray(ShaderStage stage, int binding, ImageArray array)
{
ref EncoderState.ArrayRef<ImageArray> arrayRef = ref GetArrayRef(ref _currentState.ImageArrayRefs, (int)binding, ArrayGrowthSize);
ref EncoderState.ArrayRef<ImageArray> arrayRef = ref GetArrayRef(ref _currentState.ImageArrayRefs, binding, ArrayGrowthSize);
if (arrayRef.Stage != stage || arrayRef.Array != array)
{

View File

@ -197,7 +197,7 @@ namespace Ryujinx.Graphics.Metal
maximumUniformBuffersPerStage: Constants.MaxUniformBuffersPerStage,
maximumStorageBuffersPerStage: Constants.MaxStorageBuffersPerStage,
maximumTexturesPerStage: Constants.MaxTexturesPerStage,
maximumImagesPerStage: Constants.MaxTextureBindings,
maximumImagesPerStage: Constants.MaxImagesPerStage,
maximumComputeSharedMemorySize: (int)_device.MaxThreadgroupMemoryLength,
maximumSupportedAnisotropy: 0,
shaderSubgroupSize: 256,

View File

@ -540,13 +540,11 @@ namespace Ryujinx.Graphics.Metal
_encoderStateManager.UpdateIndexBuffer(buffer, type);
}
public void SetImage(ShaderStage stage, int binding, ITexture texture, Format imageFormat)
public void SetImage(ShaderStage stage, int binding, ITexture image, Format imageFormat)
{
if (texture is TextureBase tex)
if (image is TextureBase img)
{
var index = (ulong)binding;
_encoderStateManager.UpdateImage(stage, index, tex);
_encoderStateManager.UpdateImage(stage, binding, img);
}
}
@ -554,9 +552,7 @@ namespace Ryujinx.Graphics.Metal
{
if (array is ImageArray imageArray)
{
var index = (ulong)binding;
_encoderStateManager.UpdateImageArray(stage, index, imageArray);
_encoderStateManager.UpdateImageArray(stage, binding, imageArray);
}
}
@ -665,9 +661,7 @@ namespace Ryujinx.Graphics.Metal
{
if (sampler == null || sampler is Sampler)
{
var index = (ulong)binding;
_encoderStateManager.UpdateTextureAndSampler(stage, index, tex, (Sampler)sampler);
_encoderStateManager.UpdateTextureAndSampler(stage, binding, tex, (Sampler)sampler);
}
}
}
@ -676,9 +670,7 @@ namespace Ryujinx.Graphics.Metal
{
if (array is TextureArray textureArray)
{
var index = (ulong)binding;
_encoderStateManager.UpdateTextureArray(stage, index, textureArray);
_encoderStateManager.UpdateTextureArray(stage, binding, textureArray);
}
}