State and cache optimization (#27)
* WIP pipeline/depth state cache rework * Fix some issues * Fix some more default values * Reduce allocations for state changes * fix helpershader stuff * explanation comment * fix depth bias
This commit is contained in:
parent
9d26aa8d06
commit
e02df72323
14 changed files with 1142 additions and 565 deletions
|
@ -12,9 +12,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
{
|
||||
public Texture(MTLDevice device, MetalRenderer renderer, Pipeline pipeline, TextureCreateInfo info) : base(device, renderer, pipeline, info)
|
||||
{
|
||||
MTLPixelFormat pixelFormat = FormatTable.GetFormat(Info.Format);
|
||||
|
||||
var descriptor = new MTLTextureDescriptor
|
||||
{
|
||||
PixelFormat = FormatTable.GetFormat(Info.Format),
|
||||
PixelFormat = pixelFormat,
|
||||
Usage = MTLTextureUsage.Unknown,
|
||||
SampleCount = (ulong)Info.Samples,
|
||||
TextureType = Info.Target.Convert(),
|
||||
|
@ -35,6 +37,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
descriptor.Swizzle = GetSwizzle(info, descriptor.PixelFormat);
|
||||
|
||||
_mtlTexture = _device.NewTexture(descriptor);
|
||||
MtlFormat = pixelFormat;
|
||||
}
|
||||
|
||||
public Texture(MTLDevice device, MetalRenderer renderer, Pipeline pipeline, TextureCreateInfo info, MTLTexture sourceTexture, int firstLayer, int firstLevel) : base(device, renderer, pipeline, info)
|
||||
|
@ -51,6 +54,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
var swizzle = GetSwizzle(info, pixelFormat);
|
||||
|
||||
_mtlTexture = sourceTexture.NewTextureView(pixelFormat, textureType, levels, slices, swizzle);
|
||||
MtlFormat = pixelFormat;
|
||||
}
|
||||
|
||||
private MTLTextureSwizzleChannels GetSwizzle(TextureCreateInfo info, MTLPixelFormat pixelFormat)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue