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:
parent
971c270bcf
commit
daee63c451
12 changed files with 709 additions and 453 deletions
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Metal.State;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using SharpMetal.Metal;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
@ -22,13 +23,13 @@ namespace Ryujinx.Graphics.Metal
|
|||
StencilRef = 1 << 7,
|
||||
Viewports = 1 << 8,
|
||||
Scissors = 1 << 9,
|
||||
Buffers = 1 << 10,
|
||||
VertexTextures = 1 << 11,
|
||||
FragmentTextures = 1 << 12,
|
||||
ComputeTextures = 1 << 13,
|
||||
Uniforms = 1 << 10,
|
||||
Storages = 1 << 11,
|
||||
Textures = 1 << 12,
|
||||
Images = 1 << 13,
|
||||
|
||||
RenderAll = RenderPipeline | DepthStencil | DepthClamp | DepthBias | CullMode | FrontFace | StencilRef | Viewports | Scissors | Buffers | VertexTextures | FragmentTextures,
|
||||
ComputeAll = ComputePipeline | Buffers | ComputeTextures,
|
||||
RenderAll = RenderPipeline | DepthStencil | DepthClamp | DepthBias | CullMode | FrontFace | StencilRef | Viewports | Scissors | Uniforms | Storages | Textures | Images,
|
||||
ComputeAll = ComputePipeline | Uniforms | Storages | Textures | Images,
|
||||
All = RenderAll | ComputeAll,
|
||||
}
|
||||
|
||||
|
@ -49,6 +50,20 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
}
|
||||
|
||||
record struct TextureRef
|
||||
{
|
||||
public ShaderStage Stage;
|
||||
public Texture Storage;
|
||||
public Sampler Sampler;
|
||||
|
||||
public TextureRef(ShaderStage stage, Texture storage, Sampler sampler)
|
||||
{
|
||||
Stage = stage;
|
||||
Storage = storage;
|
||||
Sampler = sampler;
|
||||
}
|
||||
}
|
||||
|
||||
struct PredrawState
|
||||
{
|
||||
public MTLCullMode CullMode;
|
||||
|
@ -73,17 +88,9 @@ namespace Ryujinx.Graphics.Metal
|
|||
public PipelineState Pipeline;
|
||||
public DepthStencilUid DepthStencilUid;
|
||||
|
||||
public TextureBase[] FragmentTextures = new TextureBase[Constants.MaxTexturesPerStage];
|
||||
public MTLSamplerState[] FragmentSamplers = new MTLSamplerState[Constants.MaxTexturesPerStage];
|
||||
|
||||
public TextureBase[] VertexTextures = new TextureBase[Constants.MaxTexturesPerStage];
|
||||
public MTLSamplerState[] VertexSamplers = new MTLSamplerState[Constants.MaxTexturesPerStage];
|
||||
|
||||
public TextureBase[] ComputeTextures = new TextureBase[Constants.MaxTexturesPerStage];
|
||||
public MTLSamplerState[] ComputeSamplers = new MTLSamplerState[Constants.MaxTexturesPerStage];
|
||||
|
||||
public BufferRef[] UniformBuffers = new BufferRef[Constants.MaxUniformBuffersPerStage];
|
||||
public BufferRef[] StorageBuffers = new BufferRef[Constants.MaxStorageBuffersPerStage];
|
||||
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 Auto<DisposableBuffer> IndexBuffer = default;
|
||||
public MTLIndexType IndexType = MTLIndexType.UInt16;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue