Initial work
This commit is contained in:
parent
f617fb542a
commit
1876b346fe
518 changed files with 15170 additions and 12486 deletions
32
Ryujinx.Graphics.GAL/Blend/BlendDescriptor.cs
Normal file
32
Ryujinx.Graphics.GAL/Blend/BlendDescriptor.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
namespace Ryujinx.Graphics.GAL.Blend
|
||||
{
|
||||
public struct BlendDescriptor
|
||||
{
|
||||
public bool Enable { get; }
|
||||
|
||||
public BlendOp ColorOp { get; }
|
||||
public BlendFactor ColorSrcFactor { get; }
|
||||
public BlendFactor ColorDstFactor { get; }
|
||||
public BlendOp AlphaOp { get; }
|
||||
public BlendFactor AlphaSrcFactor { get; }
|
||||
public BlendFactor AlphaDstFactor { get; }
|
||||
|
||||
public BlendDescriptor(
|
||||
bool enable,
|
||||
BlendOp colorOp,
|
||||
BlendFactor colorSrcFactor,
|
||||
BlendFactor colorDstFactor,
|
||||
BlendOp alphaOp,
|
||||
BlendFactor alphaSrcFactor,
|
||||
BlendFactor alphaDstFactor)
|
||||
{
|
||||
Enable = enable;
|
||||
ColorOp = colorOp;
|
||||
ColorSrcFactor = colorSrcFactor;
|
||||
ColorDstFactor = colorDstFactor;
|
||||
AlphaOp = alphaOp;
|
||||
AlphaSrcFactor = alphaSrcFactor;
|
||||
AlphaDstFactor = alphaDstFactor;
|
||||
}
|
||||
}
|
||||
}
|
25
Ryujinx.Graphics.GAL/Blend/BlendFactor.cs
Normal file
25
Ryujinx.Graphics.GAL/Blend/BlendFactor.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
namespace Ryujinx.Graphics.GAL.Blend
|
||||
{
|
||||
public enum BlendFactor
|
||||
{
|
||||
Zero = 1,
|
||||
One,
|
||||
SrcColor,
|
||||
OneMinusSrcColor,
|
||||
SrcAlpha,
|
||||
OneMinusSrcAlpha,
|
||||
DstAlpha,
|
||||
OneMinusDstAlpha,
|
||||
DstColor,
|
||||
OneMinusDstColor,
|
||||
SrcAlphaSaturate,
|
||||
Src1Color = 0x10,
|
||||
OneMinusSrc1Color,
|
||||
Src1Alpha,
|
||||
OneMinusSrc1Alpha,
|
||||
ConstantColor = 0xc001,
|
||||
OneMinusConstantColor,
|
||||
ConstantAlpha,
|
||||
OneMinusConstantAlpha
|
||||
}
|
||||
}
|
11
Ryujinx.Graphics.GAL/Blend/BlendOp.cs
Normal file
11
Ryujinx.Graphics.GAL/Blend/BlendOp.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Ryujinx.Graphics.GAL.Blend
|
||||
{
|
||||
public enum BlendOp
|
||||
{
|
||||
Add = 1,
|
||||
Subtract,
|
||||
ReverseSubtract,
|
||||
Minimum,
|
||||
Maximum
|
||||
}
|
||||
}
|
21
Ryujinx.Graphics.GAL/BufferRange.cs
Normal file
21
Ryujinx.Graphics.GAL/BufferRange.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public struct BufferRange
|
||||
{
|
||||
private static BufferRange _empty = new BufferRange(null, 0, 0);
|
||||
|
||||
public BufferRange Empty => _empty;
|
||||
|
||||
public IBuffer Buffer { get; }
|
||||
|
||||
public int Offset { get; }
|
||||
public int Size { get; }
|
||||
|
||||
public BufferRange(IBuffer buffer, int offset, int size)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Offset = offset;
|
||||
Size = size;
|
||||
}
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.GAL/Capabilities.cs
Normal file
12
Ryujinx.Graphics.GAL/Capabilities.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public struct Capabilities
|
||||
{
|
||||
public bool SupportsAstcCompression { get; }
|
||||
|
||||
public Capabilities(bool supportsAstcCompression)
|
||||
{
|
||||
SupportsAstcCompression = supportsAstcCompression;
|
||||
}
|
||||
}
|
||||
}
|
18
Ryujinx.Graphics.GAL/Color/ColorF.cs
Normal file
18
Ryujinx.Graphics.GAL/Color/ColorF.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Graphics.GAL.Color
|
||||
{
|
||||
public struct ColorF
|
||||
{
|
||||
public float Red { get; }
|
||||
public float Green { get; }
|
||||
public float Blue { get; }
|
||||
public float Alpha { get; }
|
||||
|
||||
public ColorF(float red, float green, float blue, float alpha)
|
||||
{
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
Alpha = alpha;
|
||||
}
|
||||
}
|
||||
}
|
18
Ryujinx.Graphics.GAL/Color/ColorSI.cs
Normal file
18
Ryujinx.Graphics.GAL/Color/ColorSI.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Graphics.GAL.Color
|
||||
{
|
||||
public struct ColorSI
|
||||
{
|
||||
public int Red { get; }
|
||||
public int Green { get; }
|
||||
public int Blue { get; }
|
||||
public int Alpha { get; }
|
||||
|
||||
public ColorSI(int red, int green, int blue, int alpha)
|
||||
{
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
Alpha = alpha;
|
||||
}
|
||||
}
|
||||
}
|
18
Ryujinx.Graphics.GAL/Color/ColorUI.cs
Normal file
18
Ryujinx.Graphics.GAL/Color/ColorUI.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Graphics.GAL.Color
|
||||
{
|
||||
public struct ColorUI
|
||||
{
|
||||
public uint Red { get; }
|
||||
public uint Green { get; }
|
||||
public uint Blue { get; }
|
||||
public uint Alpha { get; }
|
||||
|
||||
public ColorUI(uint red, uint green, uint blue, uint alpha)
|
||||
{
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
Alpha = alpha;
|
||||
}
|
||||
}
|
||||
}
|
14
Ryujinx.Graphics.GAL/CompareOp.cs
Normal file
14
Ryujinx.Graphics.GAL/CompareOp.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum CompareOp
|
||||
{
|
||||
Never = 1,
|
||||
Less,
|
||||
Equal,
|
||||
LessOrEqual,
|
||||
Greater,
|
||||
NotEqual,
|
||||
GreaterOrEqual,
|
||||
Always
|
||||
}
|
||||
}
|
9
Ryujinx.Graphics.GAL/CounterType.cs
Normal file
9
Ryujinx.Graphics.GAL/CounterType.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum CounterType
|
||||
{
|
||||
SamplesPassed,
|
||||
PrimitivesGenerated,
|
||||
TransformFeedbackPrimitivesWritten
|
||||
}
|
||||
}
|
47
Ryujinx.Graphics.GAL/DepthStencil/DepthStencilState.cs
Normal file
47
Ryujinx.Graphics.GAL/DepthStencil/DepthStencilState.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
namespace Ryujinx.Graphics.GAL.DepthStencil
|
||||
{
|
||||
public struct DepthStencilState
|
||||
{
|
||||
public bool DepthTestEnable { get; }
|
||||
public bool DepthWriteEnable { get; }
|
||||
public bool StencilTestEnable { get; }
|
||||
|
||||
public CompareOp DepthFunc { get; }
|
||||
public CompareOp StencilFrontFunc { get; }
|
||||
public StencilOp StencilFrontSFail { get; }
|
||||
public StencilOp StencilFrontDpPass { get; }
|
||||
public StencilOp StencilFrontDpFail { get; }
|
||||
public CompareOp StencilBackFunc { get; }
|
||||
public StencilOp StencilBackSFail { get; }
|
||||
public StencilOp StencilBackDpPass { get; }
|
||||
public StencilOp StencilBackDpFail { get; }
|
||||
|
||||
public DepthStencilState(
|
||||
bool depthTestEnable,
|
||||
bool depthWriteEnable,
|
||||
bool stencilTestEnable,
|
||||
CompareOp depthFunc,
|
||||
CompareOp stencilFrontFunc,
|
||||
StencilOp stencilFrontSFail,
|
||||
StencilOp stencilFrontDpPass,
|
||||
StencilOp stencilFrontDpFail,
|
||||
CompareOp stencilBackFunc,
|
||||
StencilOp stencilBackSFail,
|
||||
StencilOp stencilBackDpPass,
|
||||
StencilOp stencilBackDpFail)
|
||||
{
|
||||
DepthTestEnable = depthTestEnable;
|
||||
DepthWriteEnable = depthWriteEnable;
|
||||
StencilTestEnable = stencilTestEnable;
|
||||
DepthFunc = depthFunc;
|
||||
StencilFrontFunc = stencilFrontFunc;
|
||||
StencilFrontSFail = stencilFrontSFail;
|
||||
StencilFrontDpPass = stencilFrontDpPass;
|
||||
StencilFrontDpFail = stencilFrontDpFail;
|
||||
StencilBackFunc = stencilBackFunc;
|
||||
StencilBackSFail = stencilBackSFail;
|
||||
StencilBackDpPass = stencilBackDpPass;
|
||||
StencilBackDpFail = stencilBackDpFail;
|
||||
}
|
||||
}
|
||||
}
|
20
Ryujinx.Graphics.GAL/DepthStencil/DepthTestDescriptor.cs
Normal file
20
Ryujinx.Graphics.GAL/DepthStencil/DepthTestDescriptor.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
namespace Ryujinx.Graphics.GAL.DepthStencil
|
||||
{
|
||||
public struct DepthTestDescriptor
|
||||
{
|
||||
public bool TestEnable { get; }
|
||||
public bool WriteEnable { get; }
|
||||
|
||||
public CompareOp Func { get; }
|
||||
|
||||
public DepthTestDescriptor(
|
||||
bool testEnable,
|
||||
bool writeEnable,
|
||||
CompareOp func)
|
||||
{
|
||||
TestEnable = testEnable;
|
||||
WriteEnable = writeEnable;
|
||||
Func = func;
|
||||
}
|
||||
}
|
||||
}
|
14
Ryujinx.Graphics.GAL/DepthStencil/StencilOp.cs
Normal file
14
Ryujinx.Graphics.GAL/DepthStencil/StencilOp.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace Ryujinx.Graphics.GAL.DepthStencil
|
||||
{
|
||||
public enum StencilOp
|
||||
{
|
||||
Keep = 1,
|
||||
Zero,
|
||||
Replace,
|
||||
IncrementAndClamp,
|
||||
DecrementAndClamp,
|
||||
Invert,
|
||||
IncrementAndWrap,
|
||||
DecrementAndWrap
|
||||
}
|
||||
}
|
56
Ryujinx.Graphics.GAL/DepthStencil/StencilTestDescriptor.cs
Normal file
56
Ryujinx.Graphics.GAL/DepthStencil/StencilTestDescriptor.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
namespace Ryujinx.Graphics.GAL.DepthStencil
|
||||
{
|
||||
public struct StencilTestDescriptor
|
||||
{
|
||||
public bool TestEnable { get; }
|
||||
|
||||
public CompareOp FrontFunc { get; }
|
||||
public StencilOp FrontSFail { get; }
|
||||
public StencilOp FrontDpPass { get; }
|
||||
public StencilOp FrontDpFail { get; }
|
||||
public int FrontFuncRef { get; }
|
||||
public int FrontFuncMask { get; }
|
||||
public int FrontMask { get; }
|
||||
public CompareOp BackFunc { get; }
|
||||
public StencilOp BackSFail { get; }
|
||||
public StencilOp BackDpPass { get; }
|
||||
public StencilOp BackDpFail { get; }
|
||||
public int BackFuncRef { get; }
|
||||
public int BackFuncMask { get; }
|
||||
public int BackMask { get; }
|
||||
|
||||
public StencilTestDescriptor(
|
||||
bool testEnable,
|
||||
CompareOp frontFunc,
|
||||
StencilOp frontSFail,
|
||||
StencilOp frontDpPass,
|
||||
StencilOp frontDpFail,
|
||||
int frontFuncRef,
|
||||
int frontFuncMask,
|
||||
int frontMask,
|
||||
CompareOp backFunc,
|
||||
StencilOp backSFail,
|
||||
StencilOp backDpPass,
|
||||
StencilOp backDpFail,
|
||||
int backFuncRef,
|
||||
int backFuncMask,
|
||||
int backMask)
|
||||
{
|
||||
TestEnable = testEnable;
|
||||
FrontFunc = frontFunc;
|
||||
FrontSFail = frontSFail;
|
||||
FrontDpPass = frontDpPass;
|
||||
FrontDpFail = frontDpFail;
|
||||
FrontFuncRef = frontFuncRef;
|
||||
FrontFuncMask = frontFuncMask;
|
||||
FrontMask = frontMask;
|
||||
BackFunc = backFunc;
|
||||
BackSFail = backSFail;
|
||||
BackDpPass = backDpPass;
|
||||
BackDpFail = backDpFail;
|
||||
BackFuncRef = backFuncRef;
|
||||
BackFuncMask = backFuncMask;
|
||||
BackMask = backMask;
|
||||
}
|
||||
}
|
||||
}
|
18
Ryujinx.Graphics.GAL/Extents2D.cs
Normal file
18
Ryujinx.Graphics.GAL/Extents2D.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public struct Extents2D
|
||||
{
|
||||
public int X1 { get; }
|
||||
public int Y1 { get; }
|
||||
public int X2 { get; }
|
||||
public int Y2 { get; }
|
||||
|
||||
public Extents2D(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
X1 = x1;
|
||||
Y1 = y1;
|
||||
X2 = x2;
|
||||
Y2 = y2;
|
||||
}
|
||||
}
|
||||
}
|
9
Ryujinx.Graphics.GAL/Face.cs
Normal file
9
Ryujinx.Graphics.GAL/Face.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum Face
|
||||
{
|
||||
Front = 0x404,
|
||||
Back = 0x405,
|
||||
FrontAndBack = 0x408
|
||||
}
|
||||
}
|
218
Ryujinx.Graphics.GAL/Format.cs
Normal file
218
Ryujinx.Graphics.GAL/Format.cs
Normal file
|
@ -0,0 +1,218 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum Format
|
||||
{
|
||||
R8Unorm,
|
||||
R8Snorm,
|
||||
R8Uint,
|
||||
R8Sint,
|
||||
R16Float,
|
||||
R16Unorm,
|
||||
R16Snorm,
|
||||
R16Uint,
|
||||
R16Sint,
|
||||
R32Float,
|
||||
R32Uint,
|
||||
R32Sint,
|
||||
R8G8Unorm,
|
||||
R8G8Snorm,
|
||||
R8G8Uint,
|
||||
R8G8Sint,
|
||||
R16G16Float,
|
||||
R16G16Unorm,
|
||||
R16G16Snorm,
|
||||
R16G16Uint,
|
||||
R16G16Sint,
|
||||
R32G32Float,
|
||||
R32G32Uint,
|
||||
R32G32Sint,
|
||||
R8G8B8Unorm,
|
||||
R8G8B8Snorm,
|
||||
R8G8B8Uint,
|
||||
R8G8B8Sint,
|
||||
R16G16B16Float,
|
||||
R16G16B16Unorm,
|
||||
R16G16B16Snorm,
|
||||
R16G16B16Uint,
|
||||
R16G16B16Sint,
|
||||
R32G32B32Float,
|
||||
R32G32B32Uint,
|
||||
R32G32B32Sint,
|
||||
R8G8B8A8Unorm,
|
||||
R8G8B8A8Snorm,
|
||||
R8G8B8A8Uint,
|
||||
R8G8B8A8Sint,
|
||||
R16G16B16A16Float,
|
||||
R16G16B16A16Unorm,
|
||||
R16G16B16A16Snorm,
|
||||
R16G16B16A16Uint,
|
||||
R16G16B16A16Sint,
|
||||
R32G32B32A32Float,
|
||||
R32G32B32A32Uint,
|
||||
R32G32B32A32Sint,
|
||||
S8Uint,
|
||||
D16Unorm,
|
||||
D24X8Unorm,
|
||||
D32Float,
|
||||
D24UnormS8Uint,
|
||||
D32FloatS8Uint,
|
||||
R8G8B8X8Srgb,
|
||||
R8G8B8A8Srgb,
|
||||
R4G4B4A4Unorm,
|
||||
R5G5B5X1Unorm,
|
||||
R5G5B5A1Unorm,
|
||||
R5G6B5Unorm,
|
||||
R10G10B10A2Unorm,
|
||||
R10G10B10A2Uint,
|
||||
R11G11B10Float,
|
||||
R9G9B9E5Float,
|
||||
Bc1RgbUnorm,
|
||||
Bc1RgbaUnorm,
|
||||
Bc2Unorm,
|
||||
Bc3Unorm,
|
||||
Bc1RgbSrgb,
|
||||
Bc1RgbaSrgb,
|
||||
Bc2Srgb,
|
||||
Bc3Srgb,
|
||||
Bc4Unorm,
|
||||
Bc4Snorm,
|
||||
Bc5Unorm,
|
||||
Bc5Snorm,
|
||||
Bc7Unorm,
|
||||
Bc7Srgb,
|
||||
Bc6HUfloat,
|
||||
Bc6HSfloat,
|
||||
R8Uscaled,
|
||||
R8Sscaled,
|
||||
R16Uscaled,
|
||||
R16Sscaled,
|
||||
R32Uscaled,
|
||||
R32Sscaled,
|
||||
R8G8Uscaled,
|
||||
R8G8Sscaled,
|
||||
R16G16Uscaled,
|
||||
R16G16Sscaled,
|
||||
R32G32Uscaled,
|
||||
R32G32Sscaled,
|
||||
R8G8B8Uscaled,
|
||||
R8G8B8Sscaled,
|
||||
R16G16B16Uscaled,
|
||||
R16G16B16Sscaled,
|
||||
R32G32B32Uscaled,
|
||||
R32G32B32Sscaled,
|
||||
R8G8B8A8Uscaled,
|
||||
R8G8B8A8Sscaled,
|
||||
R16G16B16A16Uscaled,
|
||||
R16G16B16A16Sscaled,
|
||||
R32G32B32A32Uscaled,
|
||||
R32G32B32A32Sscaled,
|
||||
R10G10B10A2Snorm,
|
||||
R10G10B10A2Sint,
|
||||
R10G10B10A2Uscaled,
|
||||
R10G10B10A2Sscaled,
|
||||
R8G8B8X8Unorm,
|
||||
R8G8B8X8Snorm,
|
||||
R8G8B8X8Uint,
|
||||
R8G8B8X8Sint,
|
||||
R16G16B16X16Float,
|
||||
R16G16B16X16Unorm,
|
||||
R16G16B16X16Snorm,
|
||||
R16G16B16X16Uint,
|
||||
R16G16B16X16Sint,
|
||||
R32G32B32X32Float,
|
||||
R32G32B32X32Uint,
|
||||
R32G32B32X32Sint,
|
||||
Astc4x4Unorm,
|
||||
Astc5x4Unorm,
|
||||
Astc5x5Unorm,
|
||||
Astc6x5Unorm,
|
||||
Astc6x6Unorm,
|
||||
Astc8x5Unorm,
|
||||
Astc8x6Unorm,
|
||||
Astc8x8Unorm,
|
||||
Astc10x5Unorm,
|
||||
Astc10x6Unorm,
|
||||
Astc10x8Unorm,
|
||||
Astc10x10Unorm,
|
||||
Astc12x10Unorm,
|
||||
Astc12x12Unorm,
|
||||
Astc4x4Srgb,
|
||||
Astc5x4Srgb,
|
||||
Astc5x5Srgb,
|
||||
Astc6x5Srgb,
|
||||
Astc6x6Srgb,
|
||||
Astc8x5Srgb,
|
||||
Astc8x6Srgb,
|
||||
Astc8x8Srgb,
|
||||
Astc10x5Srgb,
|
||||
Astc10x6Srgb,
|
||||
Astc10x8Srgb,
|
||||
Astc10x10Srgb,
|
||||
Astc12x10Srgb,
|
||||
Astc12x12Srgb,
|
||||
B5G6R5Unorm,
|
||||
B5G5R5X1Unorm,
|
||||
B5G5R5A1Unorm,
|
||||
A1B5G5R5Unorm,
|
||||
B8G8R8X8Unorm,
|
||||
B8G8R8A8Unorm,
|
||||
B8G8R8X8Srgb,
|
||||
B8G8R8A8Srgb
|
||||
}
|
||||
|
||||
public static class FormatExtensions
|
||||
{
|
||||
public static bool IsAstc(this Format format)
|
||||
{
|
||||
return format.IsAstcUnorm() || format.IsAstcSrgb();
|
||||
}
|
||||
|
||||
public static bool IsAstcUnorm(this Format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case Format.Astc4x4Unorm:
|
||||
case Format.Astc5x4Unorm:
|
||||
case Format.Astc5x5Unorm:
|
||||
case Format.Astc6x5Unorm:
|
||||
case Format.Astc6x6Unorm:
|
||||
case Format.Astc8x5Unorm:
|
||||
case Format.Astc8x6Unorm:
|
||||
case Format.Astc8x8Unorm:
|
||||
case Format.Astc10x5Unorm:
|
||||
case Format.Astc10x6Unorm:
|
||||
case Format.Astc10x8Unorm:
|
||||
case Format.Astc10x10Unorm:
|
||||
case Format.Astc12x10Unorm:
|
||||
case Format.Astc12x12Unorm:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsAstcSrgb(this Format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case Format.Astc4x4Srgb:
|
||||
case Format.Astc5x4Srgb:
|
||||
case Format.Astc5x5Srgb:
|
||||
case Format.Astc6x5Srgb:
|
||||
case Format.Astc6x6Srgb:
|
||||
case Format.Astc8x5Srgb:
|
||||
case Format.Astc8x6Srgb:
|
||||
case Format.Astc8x8Srgb:
|
||||
case Format.Astc10x5Srgb:
|
||||
case Format.Astc10x6Srgb:
|
||||
case Format.Astc10x8Srgb:
|
||||
case Format.Astc10x10Srgb:
|
||||
case Format.Astc12x10Srgb:
|
||||
case Format.Astc12x12Srgb:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
8
Ryujinx.Graphics.GAL/FrontFace.cs
Normal file
8
Ryujinx.Graphics.GAL/FrontFace.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum FrontFace
|
||||
{
|
||||
Clockwise = 0x900,
|
||||
CounterClockwise = 0x901
|
||||
}
|
||||
}
|
15
Ryujinx.Graphics.GAL/IBuffer.cs
Normal file
15
Ryujinx.Graphics.GAL/IBuffer.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IBuffer : IDisposable
|
||||
{
|
||||
void CopyTo(IBuffer destination, int srcOffset, int dstOffset, int size);
|
||||
|
||||
byte[] GetData(int offset, int size);
|
||||
|
||||
void SetData(Span<byte> data);
|
||||
|
||||
void SetData(int offset, Span<byte> data);
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.GAL/IComputePipeline.cs
Normal file
12
Ryujinx.Graphics.GAL/IComputePipeline.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IComputePipeline
|
||||
{
|
||||
void Dispatch(int groupsX, int groupsY, int groupsZ);
|
||||
|
||||
void SetProgram(IProgram program);
|
||||
|
||||
void SetStorageBuffer(int index, BufferRange buffer);
|
||||
void SetUniformBuffer(int index, BufferRange buffer);
|
||||
}
|
||||
}
|
69
Ryujinx.Graphics.GAL/IGraphicsPipeline.cs
Normal file
69
Ryujinx.Graphics.GAL/IGraphicsPipeline.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
using Ryujinx.Graphics.GAL.Blend;
|
||||
using Ryujinx.Graphics.GAL.Color;
|
||||
using Ryujinx.Graphics.GAL.DepthStencil;
|
||||
using Ryujinx.Graphics.GAL.InputAssembler;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IGraphicsPipeline
|
||||
{
|
||||
void BindBlendState(int index, BlendDescriptor blend);
|
||||
|
||||
void BindIndexBuffer(BufferRange buffer, IndexType type);
|
||||
|
||||
void BindProgram(IProgram program);
|
||||
|
||||
void BindSampler(int index, ShaderStage stage, ISampler sampler);
|
||||
void BindTexture(int index, ShaderStage stage, ITexture texture);
|
||||
|
||||
void BindStorageBuffers(int index, ShaderStage stage, BufferRange[] buffers);
|
||||
void BindUniformBuffers(int index, ShaderStage stage, BufferRange[] buffers);
|
||||
|
||||
void BindVertexAttribs(VertexAttribDescriptor[] vertexAttribs);
|
||||
void BindVertexBuffers(VertexBufferDescriptor[] vertexBuffers);
|
||||
|
||||
void ClearRenderTargetColor(int index, uint componentMask, ColorF color);
|
||||
void ClearRenderTargetColor(int index, uint componentMask, ColorSI color);
|
||||
void ClearRenderTargetColor(int index, uint componentMask, ColorUI color);
|
||||
|
||||
void ClearRenderTargetDepthStencil(
|
||||
float depthValue,
|
||||
bool depthMask,
|
||||
int stencilValue,
|
||||
int stencilMask);
|
||||
|
||||
void Draw(int vertexCount, int instanceCount, int firstVertex, int firstInstance);
|
||||
void DrawIndexed(
|
||||
int indexCount,
|
||||
int instanceCount,
|
||||
int firstIndex,
|
||||
int firstVertex,
|
||||
int firstInstance);
|
||||
void DrawIndirect (BufferRange buffer, ulong offset, int drawCount, int stride);
|
||||
void DrawIndexedIndirect(BufferRange buffer, ulong offset, int drawCount, int stride);
|
||||
|
||||
void SetBlendColor(ColorF color);
|
||||
|
||||
void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp);
|
||||
|
||||
void SetDepthTest(DepthTestDescriptor depthTest);
|
||||
|
||||
void SetFaceCulling(bool enable, Face face);
|
||||
|
||||
void SetFrontFace(FrontFace frontFace);
|
||||
|
||||
void SetPrimitiveRestart(bool enable, int index);
|
||||
|
||||
void SetPrimitiveTopology(PrimitiveTopology topology);
|
||||
|
||||
void SetRenderTargetColorMasks(uint[] componentMask);
|
||||
|
||||
void SetRenderTargets(ITexture color3D, ITexture depthStencil);
|
||||
void SetRenderTargets(ITexture[] colors, ITexture depthStencil);
|
||||
|
||||
void SetStencilTest(StencilTestDescriptor stencilTest);
|
||||
|
||||
void SetViewports(int first, Viewport[] viewports);
|
||||
}
|
||||
}
|
6
Ryujinx.Graphics.GAL/IProgram.cs
Normal file
6
Ryujinx.Graphics.GAL/IProgram.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IProgram : IDisposable { }
|
||||
}
|
33
Ryujinx.Graphics.GAL/IRenderer.cs
Normal file
33
Ryujinx.Graphics.GAL/IRenderer.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using Ryujinx.Graphics.GAL.Sampler;
|
||||
using Ryujinx.Graphics.GAL.Texture;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IRenderer
|
||||
{
|
||||
IComputePipeline ComputePipeline { get; }
|
||||
IGraphicsPipeline GraphicsPipeline { get; }
|
||||
|
||||
IWindow Window { get; }
|
||||
|
||||
IShader CompileShader(ShaderProgram shader);
|
||||
|
||||
IBuffer CreateBuffer(int size);
|
||||
|
||||
IProgram CreateProgram(IShader[] shaders);
|
||||
|
||||
ISampler CreateSampler(SamplerCreateInfo info);
|
||||
ITexture CreateTexture(TextureCreateInfo info);
|
||||
|
||||
void FlushPipelines();
|
||||
|
||||
Capabilities GetCapabilities();
|
||||
|
||||
ulong GetCounter(CounterType type);
|
||||
|
||||
void InitializeCounters();
|
||||
|
||||
void ResetCounter(CounterType type);
|
||||
}
|
||||
}
|
6
Ryujinx.Graphics.GAL/ISampler.cs
Normal file
6
Ryujinx.Graphics.GAL/ISampler.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface ISampler : IDisposable { }
|
||||
}
|
6
Ryujinx.Graphics.GAL/IShader.cs
Normal file
6
Ryujinx.Graphics.GAL/IShader.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IShader : IDisposable { }
|
||||
}
|
21
Ryujinx.Graphics.GAL/ITexture.cs
Normal file
21
Ryujinx.Graphics.GAL/ITexture.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using Ryujinx.Graphics.GAL.Texture;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface ITexture : IDisposable
|
||||
{
|
||||
int Handle { get; }
|
||||
|
||||
void CopyTo(ITexture destination);
|
||||
void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter);
|
||||
|
||||
ITexture CreateView(TextureCreateInfo info, int firstLayer, int firstLevel);
|
||||
|
||||
int GetStorageDebugId();
|
||||
|
||||
byte[] GetData(int face);
|
||||
|
||||
void SetData(Span<byte> data);
|
||||
}
|
||||
}
|
13
Ryujinx.Graphics.GAL/IWindow.cs
Normal file
13
Ryujinx.Graphics.GAL/IWindow.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public interface IWindow
|
||||
{
|
||||
void Present();
|
||||
|
||||
void QueueTexture(ITexture texture, ImageCrop crop, object context);
|
||||
|
||||
void RegisterTextureReleaseCallback(TextureReleaseCallback callback);
|
||||
}
|
||||
}
|
28
Ryujinx.Graphics.GAL/ImageCrop.cs
Normal file
28
Ryujinx.Graphics.GAL/ImageCrop.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public struct ImageCrop
|
||||
{
|
||||
public int Left { get; }
|
||||
public int Right { get; }
|
||||
public int Top { get; }
|
||||
public int Bottom { get; }
|
||||
public bool FlipX { get; }
|
||||
public bool FlipY { get; }
|
||||
|
||||
public ImageCrop(
|
||||
int left,
|
||||
int right,
|
||||
int top,
|
||||
int bottom,
|
||||
bool flipX,
|
||||
bool flipY)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Top = top;
|
||||
Bottom = bottom;
|
||||
FlipX = flipX;
|
||||
FlipY = flipY;
|
||||
}
|
||||
}
|
||||
}
|
9
Ryujinx.Graphics.GAL/IndexType.cs
Normal file
9
Ryujinx.Graphics.GAL/IndexType.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum IndexType
|
||||
{
|
||||
UByte,
|
||||
UShort,
|
||||
UInt
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
namespace Ryujinx.Graphics.GAL.InputAssembler
|
||||
{
|
||||
public struct VertexAttribDescriptor
|
||||
{
|
||||
public int BufferIndex { get; }
|
||||
public int Offset { get; }
|
||||
|
||||
public Format Format { get; }
|
||||
|
||||
public VertexAttribDescriptor(int bufferIndex, int offset, Format format)
|
||||
{
|
||||
BufferIndex = bufferIndex;
|
||||
Offset = offset;
|
||||
Format = format;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
namespace Ryujinx.Graphics.GAL.InputAssembler
|
||||
{
|
||||
public struct VertexBufferDescriptor
|
||||
{
|
||||
public BufferRange Buffer { get; }
|
||||
|
||||
public int Stride { get; }
|
||||
public int Divisor { get; }
|
||||
|
||||
public VertexBufferDescriptor(BufferRange buffer, int stride, int divisor)
|
||||
{
|
||||
Buffer = buffer;
|
||||
Stride = stride;
|
||||
Divisor = divisor;
|
||||
}
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.GAL/PolygonModeMask.cs
Normal file
12
Ryujinx.Graphics.GAL/PolygonModeMask.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
[Flags]
|
||||
public enum PolygonModeMask
|
||||
{
|
||||
Point = 1 << 0,
|
||||
Line = 1 << 1,
|
||||
Fill = 1 << 2
|
||||
}
|
||||
}
|
21
Ryujinx.Graphics.GAL/PrimitiveTopology.cs
Normal file
21
Ryujinx.Graphics.GAL/PrimitiveTopology.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum PrimitiveTopology
|
||||
{
|
||||
Points,
|
||||
Lines,
|
||||
LineLoop,
|
||||
LineStrip,
|
||||
Triangles,
|
||||
TriangleStrip,
|
||||
TriangleFan,
|
||||
Quads,
|
||||
QuadStrip,
|
||||
Polygon,
|
||||
LinesAdjacency,
|
||||
LineStripAdjacency,
|
||||
TrianglesAdjacency,
|
||||
TriangleStripAdjacency,
|
||||
Patches
|
||||
}
|
||||
}
|
18
Ryujinx.Graphics.GAL/RectangleF.cs
Normal file
18
Ryujinx.Graphics.GAL/RectangleF.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public struct RectangleF
|
||||
{
|
||||
public float X { get; }
|
||||
public float Y { get; }
|
||||
public float Width { get; }
|
||||
public float Height { get; }
|
||||
|
||||
public RectangleF(float x, float y, float width, float height)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj
Normal file
12
Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj
Normal file
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ryujinx.Graphics.Shader\Ryujinx.Graphics.Shader.csproj" />
|
||||
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
14
Ryujinx.Graphics.GAL/Sampler/AddressMode.cs
Normal file
14
Ryujinx.Graphics.GAL/Sampler/AddressMode.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace Ryujinx.Graphics.GAL.Sampler
|
||||
{
|
||||
public enum AddressMode
|
||||
{
|
||||
Repeat,
|
||||
MirroredRepeat,
|
||||
ClampToEdge,
|
||||
ClampToBorder,
|
||||
Clamp,
|
||||
MirrorClampToEdge,
|
||||
MirrorClampToBorder,
|
||||
MirrorClamp
|
||||
}
|
||||
}
|
8
Ryujinx.Graphics.GAL/Sampler/CompareMode.cs
Normal file
8
Ryujinx.Graphics.GAL/Sampler/CompareMode.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.Graphics.GAL.Sampler
|
||||
{
|
||||
public enum CompareMode
|
||||
{
|
||||
None,
|
||||
CompareRToTexture
|
||||
}
|
||||
}
|
8
Ryujinx.Graphics.GAL/Sampler/MagFilter.cs
Normal file
8
Ryujinx.Graphics.GAL/Sampler/MagFilter.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.Graphics.GAL.Sampler
|
||||
{
|
||||
public enum MagFilter
|
||||
{
|
||||
Nearest = 1,
|
||||
Linear
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.GAL/Sampler/MinFilter.cs
Normal file
12
Ryujinx.Graphics.GAL/Sampler/MinFilter.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Ryujinx.Graphics.GAL.Sampler
|
||||
{
|
||||
public enum MinFilter
|
||||
{
|
||||
Nearest = 1,
|
||||
Linear,
|
||||
NearestMipmapNearest,
|
||||
LinearMipmapNearest,
|
||||
NearestMipmapLinear,
|
||||
LinearMipmapLinear
|
||||
}
|
||||
}
|
52
Ryujinx.Graphics.GAL/Sampler/SamplerCreateInfo.cs
Normal file
52
Ryujinx.Graphics.GAL/Sampler/SamplerCreateInfo.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using Ryujinx.Graphics.GAL.Color;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL.Sampler
|
||||
{
|
||||
public struct SamplerCreateInfo
|
||||
{
|
||||
public MinFilter MinFilter { get; }
|
||||
public MagFilter MagFilter { get; }
|
||||
|
||||
public AddressMode AddressU { get; }
|
||||
public AddressMode AddressV { get; }
|
||||
public AddressMode AddressP { get; }
|
||||
|
||||
public CompareMode CompareMode { get; }
|
||||
public CompareOp CompareOp { get; }
|
||||
|
||||
public ColorF BorderColor { get; }
|
||||
|
||||
public float MinLod { get; }
|
||||
public float MaxLod { get; }
|
||||
public float MipLodBias { get; }
|
||||
public float MaxAnisotropy { get; }
|
||||
|
||||
public SamplerCreateInfo(
|
||||
MinFilter minFilter,
|
||||
MagFilter magFilter,
|
||||
AddressMode addressU,
|
||||
AddressMode addressV,
|
||||
AddressMode addressP,
|
||||
CompareMode compareMode,
|
||||
CompareOp compareOp,
|
||||
ColorF borderColor,
|
||||
float minLod,
|
||||
float maxLod,
|
||||
float mipLodBias,
|
||||
float maxAnisotropy)
|
||||
{
|
||||
MinFilter = minFilter;
|
||||
MagFilter = magFilter;
|
||||
AddressU = addressU;
|
||||
AddressV = addressV;
|
||||
AddressP = addressP;
|
||||
CompareMode = compareMode;
|
||||
CompareOp = compareOp;
|
||||
BorderColor = borderColor;
|
||||
MinLod = minLod;
|
||||
MaxLod = maxLod;
|
||||
MipLodBias = mipLodBias;
|
||||
MaxAnisotropy = maxAnisotropy;
|
||||
}
|
||||
}
|
||||
}
|
8
Ryujinx.Graphics.GAL/Texture/DepthStencilMode.cs
Normal file
8
Ryujinx.Graphics.GAL/Texture/DepthStencilMode.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.Graphics.GAL.Texture
|
||||
{
|
||||
public enum DepthStencilMode
|
||||
{
|
||||
Depth,
|
||||
Stencil
|
||||
}
|
||||
}
|
12
Ryujinx.Graphics.GAL/Texture/SwizzleComponent.cs
Normal file
12
Ryujinx.Graphics.GAL/Texture/SwizzleComponent.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Ryujinx.Graphics.GAL.Texture
|
||||
{
|
||||
public enum SwizzleComponent
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
Alpha
|
||||
}
|
||||
}
|
17
Ryujinx.Graphics.GAL/Texture/Target.cs
Normal file
17
Ryujinx.Graphics.GAL/Texture/Target.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
namespace Ryujinx.Graphics.GAL.Texture
|
||||
{
|
||||
public enum Target
|
||||
{
|
||||
Texture1D,
|
||||
Texture2D,
|
||||
Texture3D,
|
||||
Texture1DArray,
|
||||
Texture2DArray,
|
||||
Texture2DMultisample,
|
||||
Texture2DMultisampleArray,
|
||||
Rectangle,
|
||||
Cubemap,
|
||||
CubemapArray,
|
||||
TextureBuffer
|
||||
}
|
||||
}
|
115
Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs
Normal file
115
Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs
Normal file
|
@ -0,0 +1,115 @@
|
|||
using Ryujinx.Common;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL.Texture
|
||||
{
|
||||
public struct TextureCreateInfo
|
||||
{
|
||||
public int Width { get; }
|
||||
public int Height { get; }
|
||||
public int Depth { get; }
|
||||
public int Levels { get; }
|
||||
public int Samples { get; }
|
||||
public int BlockWidth { get; }
|
||||
public int BlockHeight { get; }
|
||||
public int BytesPerPixel { get; }
|
||||
|
||||
public bool IsCompressed => (BlockWidth | BlockHeight) != 1;
|
||||
|
||||
public Format Format { get; }
|
||||
|
||||
public DepthStencilMode DepthStencilMode { get; }
|
||||
|
||||
public Target Target { get; }
|
||||
|
||||
public SwizzleComponent SwizzleR { get; }
|
||||
public SwizzleComponent SwizzleG { get; }
|
||||
public SwizzleComponent SwizzleB { get; }
|
||||
public SwizzleComponent SwizzleA { get; }
|
||||
|
||||
public TextureCreateInfo(
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int levels,
|
||||
int samples,
|
||||
int blockWidth,
|
||||
int blockHeight,
|
||||
int bytesPerPixel,
|
||||
Format format,
|
||||
DepthStencilMode depthStencilMode,
|
||||
Target target,
|
||||
SwizzleComponent swizzleR,
|
||||
SwizzleComponent swizzleG,
|
||||
SwizzleComponent swizzleB,
|
||||
SwizzleComponent swizzleA)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
Depth = depth;
|
||||
Levels = levels;
|
||||
Samples = samples;
|
||||
BlockWidth = blockWidth;
|
||||
BlockHeight = blockHeight;
|
||||
BytesPerPixel = bytesPerPixel;
|
||||
Format = format;
|
||||
DepthStencilMode = depthStencilMode;
|
||||
Target = target;
|
||||
SwizzleR = swizzleR;
|
||||
SwizzleG = swizzleG;
|
||||
SwizzleB = swizzleB;
|
||||
SwizzleA = swizzleA;
|
||||
}
|
||||
|
||||
public int GetMipSize(int level)
|
||||
{
|
||||
return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level);
|
||||
}
|
||||
|
||||
public int GetMipStride(int level)
|
||||
{
|
||||
return BitUtils.AlignUp(GetLevelWidth(level) * BytesPerPixel, 4);
|
||||
}
|
||||
|
||||
private int GetLevelWidth(int level)
|
||||
{
|
||||
return BitUtils.DivRoundUp(GetLevelSize(Width, level), BlockWidth);
|
||||
}
|
||||
|
||||
private int GetLevelHeight(int level)
|
||||
{
|
||||
return BitUtils.DivRoundUp(GetLevelSize(Height, level), BlockHeight);
|
||||
}
|
||||
|
||||
private int GetLevelDepth(int level)
|
||||
{
|
||||
return Target == Target.Texture3D ? GetLevelSize(Depth, level) : GetLayers();
|
||||
}
|
||||
|
||||
public int GetDepthOrLayers()
|
||||
{
|
||||
return Target == Target.Texture3D ? Depth : GetLayers();
|
||||
}
|
||||
|
||||
public int GetLayers()
|
||||
{
|
||||
if (Target == Target.Texture2DArray ||
|
||||
Target == Target.Texture2DMultisampleArray ||
|
||||
Target == Target.CubemapArray)
|
||||
{
|
||||
return Depth;
|
||||
}
|
||||
else if (Target == Target.Cubemap)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int GetLevelSize(int size, int level)
|
||||
{
|
||||
return Math.Max(1, size >> level);
|
||||
}
|
||||
}
|
||||
}
|
4
Ryujinx.Graphics.GAL/TextureReleaseCallback.cs
Normal file
4
Ryujinx.Graphics.GAL/TextureReleaseCallback.cs
Normal file
|
@ -0,0 +1,4 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public delegate void TextureReleaseCallback(object context);
|
||||
}
|
33
Ryujinx.Graphics.GAL/Viewport.cs
Normal file
33
Ryujinx.Graphics.GAL/Viewport.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public struct Viewport
|
||||
{
|
||||
public RectangleF Region { get; }
|
||||
|
||||
public ViewportSwizzle SwizzleX { get; }
|
||||
public ViewportSwizzle SwizzleY { get; }
|
||||
public ViewportSwizzle SwizzleZ { get; }
|
||||
public ViewportSwizzle SwizzleW { get; }
|
||||
|
||||
public float DepthNear { get; }
|
||||
public float DepthFar { get; }
|
||||
|
||||
public Viewport(
|
||||
RectangleF region,
|
||||
ViewportSwizzle swizzleX,
|
||||
ViewportSwizzle swizzleY,
|
||||
ViewportSwizzle swizzleZ,
|
||||
ViewportSwizzle swizzleW,
|
||||
float depthNear,
|
||||
float depthFar)
|
||||
{
|
||||
Region = region;
|
||||
SwizzleX = swizzleX;
|
||||
SwizzleY = swizzleY;
|
||||
SwizzleZ = swizzleZ;
|
||||
SwizzleW = swizzleW;
|
||||
DepthNear = depthNear;
|
||||
DepthFar = depthFar;
|
||||
}
|
||||
}
|
||||
}
|
14
Ryujinx.Graphics.GAL/ViewportSwizzle.cs
Normal file
14
Ryujinx.Graphics.GAL/ViewportSwizzle.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public enum ViewportSwizzle
|
||||
{
|
||||
PositiveX,
|
||||
NegativeX,
|
||||
PositiveY,
|
||||
NegativeY,
|
||||
PositiveZ,
|
||||
NegativeZ,
|
||||
PositiveW,
|
||||
NegativeW
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue