Extensions

This commit is contained in:
Isaac Marovitz 2024-05-09 12:19:24 -04:00
parent 5d6d8a4311
commit 21c3dd3bcb
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
3 changed files with 77 additions and 71 deletions

View file

@ -39,6 +39,8 @@
<PackageVersion Include="shaderc.net" Version="0.1.0" /> <PackageVersion Include="shaderc.net" Version="0.1.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" /> <PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="Silk.NET.OpenGL.Legacy" Version="2.21.0" /> <PackageVersion Include="Silk.NET.OpenGL.Legacy" Version="2.21.0" />
<PackageVersion Include="Silk.NET.OpenGL.Legacy.Extensions.EXT" Version="2.21.0" />
<PackageVersion Include="Silk.NET.OpenGL.Legacy.Extensions.NV" Version="2.21.0" />
<PackageVersion Include="Silk.NET.Vulkan" Version="2.16.0" /> <PackageVersion Include="Silk.NET.Vulkan" Version="2.16.0" />
<PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.16.0" /> <PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.16.0" />
<PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.16.0" /> <PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.16.0" />

View file

@ -1,4 +1,6 @@
using Silk.NET.OpenGL.Legacy; using Silk.NET.OpenGL.Legacy;
using Silk.NET.OpenGL.Legacy.Extensions.NV;
using Silk.NET.OpenGL.Legacy.Extensions.EXT;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Shader; using Ryujinx.Graphics.Shader;
@ -16,11 +18,11 @@ namespace Ryujinx.Graphics.OpenGL
case AddressMode.Repeat: case AddressMode.Repeat:
return TextureWrapMode.Repeat; return TextureWrapMode.Repeat;
case AddressMode.MirrorClamp: case AddressMode.MirrorClamp:
return (TextureWrapMode)ExtTextureMirrorClamp.MirrorClampExt; return (TextureWrapMode)EXT.MirrorClampExt;
case AddressMode.MirrorClampToEdge: case AddressMode.MirrorClampToEdge:
return (TextureWrapMode)ExtTextureMirrorClamp.MirrorClampToEdgeExt; return (TextureWrapMode)EXT.MirrorClampToEdgeExt;
case AddressMode.MirrorClampToBorder: case AddressMode.MirrorClampToBorder:
return (TextureWrapMode)ExtTextureMirrorClamp.MirrorClampToBorderExt; return (TextureWrapMode)EXT.MirrorClampToBorderExt;
case AddressMode.ClampToBorder: case AddressMode.ClampToBorder:
return TextureWrapMode.ClampToBorder; return TextureWrapMode.ClampToBorder;
case AddressMode.MirroredRepeat: case AddressMode.MirroredRepeat:
@ -34,124 +36,124 @@ namespace Ryujinx.Graphics.OpenGL
return TextureWrapMode.Clamp; return TextureWrapMode.Clamp;
} }
public static NvBlendEquationAdvanced Convert(this AdvancedBlendOp op) public static NV Convert(this AdvancedBlendOp op)
{ {
switch (op) switch (op)
{ {
case AdvancedBlendOp.Zero: case AdvancedBlendOp.Zero:
return NvBlendEquationAdvanced.Zero; return NV.Zero;
case AdvancedBlendOp.Src: case AdvancedBlendOp.Src:
return NvBlendEquationAdvanced.SrcNv; return NV.SrcNV;
case AdvancedBlendOp.Dst: case AdvancedBlendOp.Dst:
return NvBlendEquationAdvanced.DstNv; return NV.DstNV;
case AdvancedBlendOp.SrcOver: case AdvancedBlendOp.SrcOver:
return NvBlendEquationAdvanced.SrcOverNv; return NV.SrcOverNV;
case AdvancedBlendOp.DstOver: case AdvancedBlendOp.DstOver:
return NvBlendEquationAdvanced.DstOverNv; return NV.DstOverNV;
case AdvancedBlendOp.SrcIn: case AdvancedBlendOp.SrcIn:
return NvBlendEquationAdvanced.SrcInNv; return NV.SrcInNV;
case AdvancedBlendOp.DstIn: case AdvancedBlendOp.DstIn:
return NvBlendEquationAdvanced.DstInNv; return NV.DstInNV;
case AdvancedBlendOp.SrcOut: case AdvancedBlendOp.SrcOut:
return NvBlendEquationAdvanced.SrcOutNv; return NV.SrcOutNV;
case AdvancedBlendOp.DstOut: case AdvancedBlendOp.DstOut:
return NvBlendEquationAdvanced.DstOutNv; return NV.DstOutNV;
case AdvancedBlendOp.SrcAtop: case AdvancedBlendOp.SrcAtop:
return NvBlendEquationAdvanced.SrcAtopNv; return NV.SrcAtopNV;
case AdvancedBlendOp.DstAtop: case AdvancedBlendOp.DstAtop:
return NvBlendEquationAdvanced.DstAtopNv; return NV.DstAtopNV;
case AdvancedBlendOp.Xor: case AdvancedBlendOp.Xor:
return NvBlendEquationAdvanced.XorNv; return NV.XorNV;
case AdvancedBlendOp.Plus: case AdvancedBlendOp.Plus:
return NvBlendEquationAdvanced.PlusNv; return NV.PlusNV;
case AdvancedBlendOp.PlusClamped: case AdvancedBlendOp.PlusClamped:
return NvBlendEquationAdvanced.PlusClampedNv; return NV.PlusClampedNV;
case AdvancedBlendOp.PlusClampedAlpha: case AdvancedBlendOp.PlusClampedAlpha:
return NvBlendEquationAdvanced.PlusClampedAlphaNv; return NV.PlusClampedAlphaNV;
case AdvancedBlendOp.PlusDarker: case AdvancedBlendOp.PlusDarker:
return NvBlendEquationAdvanced.PlusDarkerNv; return NV.PlusDarkerNV;
case AdvancedBlendOp.Multiply: case AdvancedBlendOp.Multiply:
return NvBlendEquationAdvanced.MultiplyNv; return NV.MultiplyNV;
case AdvancedBlendOp.Screen: case AdvancedBlendOp.Screen:
return NvBlendEquationAdvanced.ScreenNv; return NV.ScreenNV;
case AdvancedBlendOp.Overlay: case AdvancedBlendOp.Overlay:
return NvBlendEquationAdvanced.OverlayNv; return NV.OverlayNV;
case AdvancedBlendOp.Darken: case AdvancedBlendOp.Darken:
return NvBlendEquationAdvanced.DarkenNv; return NV.DarkenNV;
case AdvancedBlendOp.Lighten: case AdvancedBlendOp.Lighten:
return NvBlendEquationAdvanced.LightenNv; return NV.LightenNV;
case AdvancedBlendOp.ColorDodge: case AdvancedBlendOp.ColorDodge:
return NvBlendEquationAdvanced.ColordodgeNv; return NV.ColordodgeNV;
case AdvancedBlendOp.ColorBurn: case AdvancedBlendOp.ColorBurn:
return NvBlendEquationAdvanced.ColorburnNv; return NV.ColorburnNV;
case AdvancedBlendOp.HardLight: case AdvancedBlendOp.HardLight:
return NvBlendEquationAdvanced.HardlightNv; return NV.HardlightNV;
case AdvancedBlendOp.SoftLight: case AdvancedBlendOp.SoftLight:
return NvBlendEquationAdvanced.SoftlightNv; return NV.SoftlightNV;
case AdvancedBlendOp.Difference: case AdvancedBlendOp.Difference:
return NvBlendEquationAdvanced.DifferenceNv; return NV.DifferenceNV;
case AdvancedBlendOp.Minus: case AdvancedBlendOp.Minus:
return NvBlendEquationAdvanced.MinusNv; return NV.MinusNV;
case AdvancedBlendOp.MinusClamped: case AdvancedBlendOp.MinusClamped:
return NvBlendEquationAdvanced.MinusClampedNv; return NV.MinusClampedNV;
case AdvancedBlendOp.Exclusion: case AdvancedBlendOp.Exclusion:
return NvBlendEquationAdvanced.ExclusionNv; return NV.ExclusionNV;
case AdvancedBlendOp.Contrast: case AdvancedBlendOp.Contrast:
return NvBlendEquationAdvanced.ContrastNv; return NV.ContrastNV;
case AdvancedBlendOp.Invert: case AdvancedBlendOp.Invert:
return NvBlendEquationAdvanced.Invert; return NV.Invert;
case AdvancedBlendOp.InvertRGB: case AdvancedBlendOp.InvertRGB:
return NvBlendEquationAdvanced.InvertRgbNv; return NV.InvertRgbNV;
case AdvancedBlendOp.InvertOvg: case AdvancedBlendOp.InvertOvg:
return NvBlendEquationAdvanced.InvertOvgNv; return NV.InvertOvgNV;
case AdvancedBlendOp.LinearDodge: case AdvancedBlendOp.LinearDodge:
return NvBlendEquationAdvanced.LineardodgeNv; return NV.LineardodgeNV;
case AdvancedBlendOp.LinearBurn: case AdvancedBlendOp.LinearBurn:
return NvBlendEquationAdvanced.LinearburnNv; return NV.LinearburnNV;
case AdvancedBlendOp.VividLight: case AdvancedBlendOp.VividLight:
return NvBlendEquationAdvanced.VividlightNv; return NV.VividlightNV;
case AdvancedBlendOp.LinearLight: case AdvancedBlendOp.LinearLight:
return NvBlendEquationAdvanced.LinearlightNv; return NV.LinearlightNV;
case AdvancedBlendOp.PinLight: case AdvancedBlendOp.PinLight:
return NvBlendEquationAdvanced.PinlightNv; return NV.PinlightNV;
case AdvancedBlendOp.HardMix: case AdvancedBlendOp.HardMix:
return NvBlendEquationAdvanced.HardmixNv; return NV.HardmixNV;
case AdvancedBlendOp.Red: case AdvancedBlendOp.Red:
return NvBlendEquationAdvanced.RedNv; return NV.RedNV;
case AdvancedBlendOp.Green: case AdvancedBlendOp.Green:
return NvBlendEquationAdvanced.GreenNv; return NV.GreenNV;
case AdvancedBlendOp.Blue: case AdvancedBlendOp.Blue:
return NvBlendEquationAdvanced.BlueNv; return NV.BlueNV;
case AdvancedBlendOp.HslHue: case AdvancedBlendOp.HslHue:
return NvBlendEquationAdvanced.HslHueNv; return NV.HslHueNV;
case AdvancedBlendOp.HslSaturation: case AdvancedBlendOp.HslSaturation:
return NvBlendEquationAdvanced.HslSaturationNv; return NV.HslSaturationNV;
case AdvancedBlendOp.HslColor: case AdvancedBlendOp.HslColor:
return NvBlendEquationAdvanced.HslColorNv; return NV.HslColorNV;
case AdvancedBlendOp.HslLuminosity: case AdvancedBlendOp.HslLuminosity:
return NvBlendEquationAdvanced.HslLuminosityNv; return NV.HslLuminosityNV;
} }
Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(AdvancedBlendOp)} enum value: {op}."); Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(AdvancedBlendOp)} enum value: {op}.");
return NvBlendEquationAdvanced.Zero; return NV.Zero;
} }
public static All Convert(this AdvancedBlendOverlap overlap) public static NV Convert(this AdvancedBlendOverlap overlap)
{ {
switch (overlap) switch (overlap)
{ {
case AdvancedBlendOverlap.Uncorrelated: case AdvancedBlendOverlap.Uncorrelated:
return All.UncorrelatedNv; return NV.UncorrelatedNV;
case AdvancedBlendOverlap.Disjoint: case AdvancedBlendOverlap.Disjoint:
return All.DisjointNv; return NV.DisjointNV;
case AdvancedBlendOverlap.Conjoint: case AdvancedBlendOverlap.Conjoint:
return All.ConjointNv; return NV.ConjointNV;
} }
Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(AdvancedBlendOverlap)} enum value: {overlap}."); Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(AdvancedBlendOverlap)} enum value: {overlap}.");
return All.UncorrelatedNv; return NV.UncorrelatedNV;
} }
public static GLEnum Convert(this BlendFactor factor) public static GLEnum Convert(this BlendFactor factor)
@ -469,29 +471,29 @@ namespace Ryujinx.Graphics.OpenGL
return PrimitiveType.Points; return PrimitiveType.Points;
} }
public static TransformFeedbackPrimitiveType ConvertToTfType(this PrimitiveTopology topology) public static PrimitiveType ConvertToTfType(this PrimitiveTopology topology)
{ {
switch (topology) switch (topology)
{ {
case PrimitiveTopology.Points: case PrimitiveTopology.Points:
return TransformFeedbackPrimitiveType.Points; return PrimitiveType.Points;
case PrimitiveTopology.Lines: case PrimitiveTopology.Lines:
case PrimitiveTopology.LineLoop: case PrimitiveTopology.LineLoop:
case PrimitiveTopology.LineStrip: case PrimitiveTopology.LineStrip:
case PrimitiveTopology.LinesAdjacency: case PrimitiveTopology.LinesAdjacency:
case PrimitiveTopology.LineStripAdjacency: case PrimitiveTopology.LineStripAdjacency:
return TransformFeedbackPrimitiveType.Lines; return PrimitiveType.Lines;
case PrimitiveTopology.Triangles: case PrimitiveTopology.Triangles:
case PrimitiveTopology.TriangleStrip: case PrimitiveTopology.TriangleStrip:
case PrimitiveTopology.TriangleFan: case PrimitiveTopology.TriangleFan:
case PrimitiveTopology.TrianglesAdjacency: case PrimitiveTopology.TrianglesAdjacency:
case PrimitiveTopology.TriangleStripAdjacency: case PrimitiveTopology.TriangleStripAdjacency:
return TransformFeedbackPrimitiveType.Triangles; return PrimitiveType.Triangles;
} }
Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(PrimitiveTopology)} enum value: {topology}."); Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(PrimitiveTopology)} enum value: {topology}.");
return TransformFeedbackPrimitiveType.Points; return PrimitiveType.Points;
} }
public static Silk.NET.OpenGL.Legacy.StencilOp Convert(this GAL.StencilOp op) public static Silk.NET.OpenGL.Legacy.StencilOp Convert(this GAL.StencilOp op)
@ -588,31 +590,31 @@ namespace Ryujinx.Graphics.OpenGL
return TextureTarget.Texture2D; return TextureTarget.Texture2D;
} }
public static NvViewportSwizzle Convert(this ViewportSwizzle swizzle) public static NV Convert(this ViewportSwizzle swizzle)
{ {
switch (swizzle) switch (swizzle)
{ {
case ViewportSwizzle.PositiveX: case ViewportSwizzle.PositiveX:
return NvViewportSwizzle.ViewportSwizzlePositiveXNv; return NV.ViewportSwizzlePositiveXNV;
case ViewportSwizzle.PositiveY: case ViewportSwizzle.PositiveY:
return NvViewportSwizzle.ViewportSwizzlePositiveYNv; return NV.ViewportSwizzlePositiveYNV;
case ViewportSwizzle.PositiveZ: case ViewportSwizzle.PositiveZ:
return NvViewportSwizzle.ViewportSwizzlePositiveZNv; return NV.ViewportSwizzlePositiveZNV;
case ViewportSwizzle.PositiveW: case ViewportSwizzle.PositiveW:
return NvViewportSwizzle.ViewportSwizzlePositiveWNv; return NV.ViewportSwizzlePositiveWNV;
case ViewportSwizzle.NegativeX: case ViewportSwizzle.NegativeX:
return NvViewportSwizzle.ViewportSwizzleNegativeXNv; return NV.ViewportSwizzleNegativeXNV;
case ViewportSwizzle.NegativeY: case ViewportSwizzle.NegativeY:
return NvViewportSwizzle.ViewportSwizzleNegativeYNv; return NV.ViewportSwizzleNegativeYNV;
case ViewportSwizzle.NegativeZ: case ViewportSwizzle.NegativeZ:
return NvViewportSwizzle.ViewportSwizzleNegativeZNv; return NV.ViewportSwizzleNegativeZNV;
case ViewportSwizzle.NegativeW: case ViewportSwizzle.NegativeW:
return NvViewportSwizzle.ViewportSwizzleNegativeWNv; return NV.ViewportSwizzleNegativeWNV;
} }
Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(ViewportSwizzle)} enum value: {swizzle}."); Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(ViewportSwizzle)} enum value: {swizzle}.");
return NvViewportSwizzle.ViewportSwizzlePositiveXNv; return NV.ViewportSwizzlePositiveXNV;
} }
public static GLEnum Convert(this LogicalOp op) public static GLEnum Convert(this LogicalOp op)

View file

@ -7,6 +7,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Silk.NET.OpenGL.Legacy" /> <PackageReference Include="Silk.NET.OpenGL.Legacy" />
<PackageReference Include="Silk.NET.OpenGL.Legacy.Extensions.EXT" />
<PackageReference Include="Silk.NET.OpenGL.Legacy.Extensions.NV" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>