Metal: Better Bindings (#29)

* Tell GAL to use Vk model (and break everything)

* ResourceBindingSegments

* Set information on backend caps

* Get ready to break everything

* Refactor EncoderStateManager

* Remove padding from helper shaders

* Fix ref array sizes

* Seperate vert & frag buffers

* Shader-side changes

* Fixes

* Fix some helper shader resource layouts

* Sort by binding id

* Fix helper shader layouts

* Don’t do inline vertex buffer updates

* Check for null storage
This commit is contained in:
Isaac Marovitz 2024-07-01 18:24:10 +01:00
parent 971c270bcf
commit daee63c451
12 changed files with 709 additions and 453 deletions

View file

@ -12,6 +12,13 @@ namespace Ryujinx.Graphics.Metal
[SupportedOSPlatform("macos")]
public sealed class MetalRenderer : IRenderer
{
public const int TotalSets = 4;
public const int UniformSetIndex = 0;
public const int StorageSetIndex = 1;
public const int TextureSetIndex = 2;
public const int ImageSetIndex = 3;
private readonly MTLDevice _device;
private readonly MTLCommandQueue _queue;
private readonly Func<CAMetalLayer> _getMetalLayer;
@ -95,7 +102,7 @@ namespace Ryujinx.Graphics.Metal
public IProgram CreateProgram(ShaderSource[] shaders, ShaderInfo info)
{
return new Program(shaders, _device, info.ComputeLocalSize);
return new Program(shaders, info.ResourceLayout, _device, info.ComputeLocalSize);
}
public ISampler CreateSampler(SamplerCreateInfo info)
@ -188,10 +195,10 @@ namespace Ryujinx.Graphics.Metal
supportsViewportSwizzle: false,
supportsIndirectParameters: true,
supportsDepthClipControl: false,
uniformBufferSetIndex: 0,
storageBufferSetIndex: 1,
textureSetIndex: 2,
imageSetIndex: 3,
uniformBufferSetIndex: UniformSetIndex,
storageBufferSetIndex: StorageSetIndex,
textureSetIndex: TextureSetIndex,
imageSetIndex: ImageSetIndex,
extraSetBaseIndex: 0,
maximumExtraSets: 0,
maximumUniformBuffersPerStage: Constants.MaxUniformBuffersPerStage,