Start Texture region-based CopyTo

This commit is contained in:
Isaac Marovitz 2023-07-28 08:20:15 -04:00 committed by Isaac Marovitz
parent d2e9f1c7a9
commit 74626c282a
1 changed files with 8 additions and 3 deletions

View File

@ -11,6 +11,7 @@ namespace Ryujinx.Graphics.Metal
{ {
private readonly TextureCreateInfo _info; private readonly TextureCreateInfo _info;
private readonly Pipeline _pipeline; private readonly Pipeline _pipeline;
private readonly MTLDevice _device;
public MTLTexture MTLTexture; public MTLTexture MTLTexture;
public TextureCreateInfo Info => Info; public TextureCreateInfo Info => Info;
@ -19,6 +20,8 @@ namespace Ryujinx.Graphics.Metal
public Texture(MTLDevice device, Pipeline pipeline, TextureCreateInfo info, int firstLayer, int firstLevel) public Texture(MTLDevice device, Pipeline pipeline, TextureCreateInfo info, int firstLayer, int firstLevel)
{ {
_device = device;
_pipeline = pipeline;
_info = info; _info = info;
var descriptor = new MTLTextureDescriptor(); var descriptor = new MTLTextureDescriptor();
@ -38,8 +41,7 @@ namespace Ryujinx.Graphics.Metal
alpha = Info.SwizzleA.Convert() alpha = Info.SwizzleA.Convert()
}; };
MTLTexture = device.NewTexture(descriptor); MTLTexture = _device.NewTexture(descriptor);
_pipeline = pipeline;
} }
public void CopyTo(ITexture destination, int firstLayer, int firstLevel) public void CopyTo(ITexture destination, int firstLayer, int firstLevel)
@ -76,7 +78,10 @@ namespace Ryujinx.Graphics.Metal
public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter) public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter)
{ {
throw new NotImplementedException(); var samplerDescriptor = new MTLSamplerDescriptor();
samplerDescriptor.MinFilter = linearFilter ? MTLSamplerMinMagFilter.Linear : MTLSamplerMinMagFilter.Nearest;
samplerDescriptor.MagFilter = linearFilter ? MTLSamplerMinMagFilter.Linear : MTLSamplerMinMagFilter.Nearest;
var samplerState = _device.NewSamplerState(samplerDescriptor);
} }
public void CopyTo(BufferRange range, int layer, int level, int stride) public void CopyTo(BufferRange range, int layer, int level, int stride)