2024-05-18 22:54:55 +00:00
|
|
|
using Ryujinx.Graphics.GAL;
|
|
|
|
using SharpMetal.Metal;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.Versioning;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Metal
|
|
|
|
{
|
2024-05-19 06:08:12 +00:00
|
|
|
public struct DirtyFlags
|
|
|
|
{
|
|
|
|
public bool Pipeline = false;
|
|
|
|
public bool DepthStencil = false;
|
|
|
|
|
|
|
|
public DirtyFlags() { }
|
2024-05-19 07:10:14 +00:00
|
|
|
|
|
|
|
public void MarkAll() {
|
|
|
|
Pipeline = true;
|
|
|
|
DepthStencil = true;
|
2024-05-19 15:05:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Clear()
|
|
|
|
{
|
|
|
|
Pipeline = false;
|
|
|
|
DepthStencil = false;
|
2024-05-19 07:10:14 +00:00
|
|
|
}
|
2024-05-19 06:08:12 +00:00
|
|
|
}
|
|
|
|
|
2024-05-18 22:54:55 +00:00
|
|
|
[SupportedOSPlatform("macos")]
|
|
|
|
public struct EncoderState
|
|
|
|
{
|
|
|
|
public MTLFunction? VertexFunction = null;
|
|
|
|
public MTLFunction? FragmentFunction = null;
|
|
|
|
|
|
|
|
public Dictionary<ulong, MTLTexture> FragmentTextures = new();
|
|
|
|
public Dictionary<ulong, MTLSamplerState> FragmentSamplers = new();
|
|
|
|
|
|
|
|
public Dictionary<ulong, MTLTexture> VertexTextures = new();
|
|
|
|
public Dictionary<ulong, MTLSamplerState> VertexSamplers = new();
|
|
|
|
|
|
|
|
public List<BufferInfo> UniformBuffers = [];
|
|
|
|
public List<BufferInfo> StorageBuffers = [];
|
|
|
|
|
|
|
|
public MTLBuffer IndexBuffer = default;
|
|
|
|
public MTLIndexType IndexType = MTLIndexType.UInt16;
|
|
|
|
public ulong IndexBufferOffset = 0;
|
|
|
|
|
|
|
|
public MTLDepthStencilState? DepthStencilState = null;
|
|
|
|
|
2024-05-19 01:29:46 +00:00
|
|
|
public MTLDepthClipMode DepthClipMode = MTLDepthClipMode.Clip;
|
2024-05-18 22:54:55 +00:00
|
|
|
public MTLCompareFunction DepthCompareFunction = MTLCompareFunction.Always;
|
|
|
|
public bool DepthWriteEnabled = false;
|
|
|
|
|
|
|
|
public MTLStencilDescriptor BackFaceStencil = new();
|
|
|
|
public MTLStencilDescriptor FrontFaceStencil = new();
|
2024-05-18 23:59:38 +00:00
|
|
|
public bool StencilTestEnabled = false;
|
2024-05-18 22:54:55 +00:00
|
|
|
|
|
|
|
public PrimitiveTopology Topology = PrimitiveTopology.Triangles;
|
|
|
|
public MTLCullMode CullMode = MTLCullMode.None;
|
|
|
|
public MTLWinding Winding = MTLWinding.Clockwise;
|
|
|
|
|
|
|
|
public MTLViewport[] Viewports = [];
|
|
|
|
public MTLScissorRect[] Scissors = [];
|
|
|
|
|
|
|
|
// Changes to attachments take recreation!
|
|
|
|
public MTLTexture DepthStencil = default;
|
2024-05-20 15:28:00 +00:00
|
|
|
public MTLTexture[] RenderTargets = new MTLTexture[Constants.MaxColorAttachments];
|
2024-05-19 01:20:15 +00:00
|
|
|
public Dictionary<int, BlendDescriptor> BlendDescriptors = new();
|
|
|
|
public ColorF BlendColor = new();
|
2024-05-18 22:54:55 +00:00
|
|
|
|
2024-05-19 02:06:53 +00:00
|
|
|
public VertexBufferDescriptor[] VertexBuffers = [];
|
|
|
|
public VertexAttribDescriptor[] VertexAttribs = [];
|
|
|
|
|
2024-05-19 06:08:12 +00:00
|
|
|
// Dirty flags
|
|
|
|
public DirtyFlags Dirty = new();
|
|
|
|
|
2024-05-18 22:54:55 +00:00
|
|
|
public EncoderState() { }
|
|
|
|
}
|
|
|
|
}
|