From 32764f95602611e9daa50362330d760e8ed83fda Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 29 Dec 2019 20:26:37 -0300 Subject: Add XML documentation to Ryujinx.Graphics.Gpu.Image --- Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs b/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs index 00b4ecb4..80b1b70f 100644 --- a/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs +++ b/Ryujinx.Graphics.Gpu/Image/SamplerDescriptor.cs @@ -2,6 +2,10 @@ using Ryujinx.Graphics.GAL; namespace Ryujinx.Graphics.Gpu.Image { + /// + /// Maxwell sampler descriptor structure. + /// This structure defines the sampler descriptor as it is packed on the GPU sampler pool region. + /// struct SamplerDescriptor { private static readonly float[] _f5ToF32ConversionLut = new float[] @@ -56,41 +60,81 @@ namespace Ryujinx.Graphics.Gpu.Image public uint BorderColorB; public uint BorderColorA; + /// + /// Unpacks the texture wrap mode along the X axis. + /// + /// The texture wrap mode enum public AddressMode UnpackAddressU() { return (AddressMode)(Word0 & 7); } + // + /// Unpacks the texture wrap mode along the Y axis. + /// + /// The texture wrap mode enum public AddressMode UnpackAddressV() { return (AddressMode)((Word0 >> 3) & 7); } + // + /// Unpacks the texture wrap mode along the Z axis. + /// + /// The texture wrap mode enum public AddressMode UnpackAddressP() { return (AddressMode)((Word0 >> 6) & 7); } + /// + /// Unpacks the compare mode used for depth comparison on the shader, for + /// depth buffer texture. + /// This is only relevant for shaders with shadow samplers. + /// + /// The depth comparison mode enum public CompareMode UnpackCompareMode() { return (CompareMode)((Word0 >> 9) & 1); } + /// + /// Unpacks the compare operation used for depth comparison on the shader, for + /// depth buffer texture. + /// This is only relevant for shaders with shadow samplers. + /// + /// The depth comparison operation enum public CompareOp UnpackCompareOp() { return (CompareOp)(((Word0 >> 10) & 7) + 1); } + /// + /// Unpacks and converts the maximum anisotropy value used for texture anisotropic filtering. + /// + /// The maximum anisotropy public float UnpackMaxAnisotropy() { return _maxAnisotropyLut[(Word0 >> 20) & 7]; } + /// + /// Unpacks the texture magnification filter. + /// This defines the filtering used when the texture covers an area on the screen + /// that is larger than the texture size. + /// + /// The magnification filter public MagFilter UnpackMagFilter() { return (MagFilter)(Word1 & 3); } + /// + /// Unpacks the texture minification filter. + /// This defines the filtering used when the texture covers an area on the screen + /// that is smaller than the texture size. + /// + /// The minification filter public MinFilter UnpackMinFilter() { SamplerMinFilter minFilter = (SamplerMinFilter)((Word1 >> 4) & 3); @@ -99,6 +143,13 @@ namespace Ryujinx.Graphics.Gpu.Image return ConvertFilter(minFilter, mipFilter); } + /// + /// Converts two minification and filter enum, to a single minification enum, + /// including mipmap filtering information, as expected from the host API. + /// + /// The minification filter + /// The mipmap level filter + /// The combined, host API compatible filter enum private static MinFilter ConvertFilter(SamplerMinFilter minFilter, SamplerMipFilter mipFilter) { switch (mipFilter) @@ -131,11 +182,22 @@ namespace Ryujinx.Graphics.Gpu.Image return MinFilter.Nearest; } + /// + /// Unpacks the reduction filter, used with texture minification linear filtering. + /// This describes how the final value will be computed from neighbouring pixels. + /// + /// The reduction filter public ReductionFilter UnpackReductionFilter() { return (ReductionFilter)((Word1 >> 10) & 3); } + /// + /// Unpacks the level-of-detail bias value. + /// This is a bias added to the level-of-detail value as computed by the GPU, used to select + /// which mipmap level to use from a given texture. + /// + /// The level-of-detail bias value public float UnpackMipLodBias() { int fixedValue = (int)(Word1 >> 12) & 0x1fff; @@ -145,16 +207,28 @@ namespace Ryujinx.Graphics.Gpu.Image return fixedValue * Frac8ToF32; } + /// + /// Unpacks the level-of-detail snap value. + /// + /// The level-of-detail snap value public float UnpackLodSnap() { return _f5ToF32ConversionLut[(Word1 >> 26) & 0x1f]; } + /// + /// Unpacks the minimum level-of-detail value. + /// + /// The minimum level-of-detail value public float UnpackMinLod() { return (Word2 & 0xfff) * Frac8ToF32; } + /// + /// Unpacks the maximum level-of-detail value. + /// + /// The maximum level-of-detail value public float UnpackMaxLod() { return ((Word2 >> 12) & 0xfff) * Frac8ToF32; -- cgit v1.2.3