mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-15 14:00:19 +00:00
* Stuff * More arg buffer stuff * Fixes * Rebase * Pass storage buffers to inline functions * Fix binding * Fix typo + Fix a couple shaders * Enforce ids * Dispose * Mark used buffers as resident * Update depth clear shader * Fix non-contiguous struct defs * Update ChangeBufferStride * Fix StorageBuffer assignments * Fix odyssey crash * Retain buffer bindings * Pad Std140 * Set texture data with safe buffers * Clone buffers * Always declare vert in * Stop clears from breaking OpenGL games * Fix depth clear * Use invariant position * Horribly inefficient texture & sampler arg buffers * Fix missing struct access * Minimise rebinds as much as possible * Build arg buffers on staging buffer
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using Ryujinx.Graphics.GAL;
|
|
using SharpMetal.Metal;
|
|
using System;
|
|
using System.Runtime.Versioning;
|
|
|
|
namespace Ryujinx.Graphics.Metal
|
|
{
|
|
[SupportedOSPlatform("macos")]
|
|
class Sampler : ISampler
|
|
{
|
|
private readonly MTLSamplerState _mtlSamplerState;
|
|
|
|
public Sampler(MTLDevice device, SamplerCreateInfo info)
|
|
{
|
|
(MTLSamplerMinMagFilter minFilter, MTLSamplerMipFilter mipFilter) = info.MinFilter.Convert();
|
|
|
|
var samplerState = device.NewSamplerState(new MTLSamplerDescriptor
|
|
{
|
|
BorderColor = MTLSamplerBorderColor.TransparentBlack,
|
|
MinFilter = minFilter,
|
|
MagFilter = info.MagFilter.Convert(),
|
|
MipFilter = mipFilter,
|
|
CompareFunction = info.CompareOp.Convert(),
|
|
LodMinClamp = info.MinLod,
|
|
LodMaxClamp = info.MaxLod,
|
|
LodAverage = false,
|
|
MaxAnisotropy = Math.Max((uint)info.MaxAnisotropy, 1),
|
|
SAddressMode = info.AddressU.Convert(),
|
|
TAddressMode = info.AddressV.Convert(),
|
|
RAddressMode = info.AddressP.Convert(),
|
|
SupportArgumentBuffers = true
|
|
});
|
|
|
|
_mtlSamplerState = samplerState;
|
|
}
|
|
|
|
public Sampler(MTLSamplerState samplerState)
|
|
{
|
|
_mtlSamplerState = samplerState;
|
|
}
|
|
|
|
public MTLSamplerState GetSampler()
|
|
{
|
|
return _mtlSamplerState;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_mtlSamplerState.Dispose();
|
|
}
|
|
}
|
|
}
|