2019-10-13 06:02:07 +00:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Shader
|
|
|
|
{
|
|
|
|
[Flags]
|
2020-04-02 01:24:55 +00:00
|
|
|
enum InterpolationQualifier
|
2019-10-13 06:02:07 +00:00
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
|
|
|
|
Flat = 1,
|
|
|
|
NoPerspective = 2,
|
|
|
|
Smooth = 3,
|
|
|
|
|
|
|
|
Centroid = 1 << 16,
|
|
|
|
Sample = 1 << 17,
|
|
|
|
|
|
|
|
FlagsMask = Centroid | Sample
|
|
|
|
}
|
|
|
|
|
2020-04-02 01:24:55 +00:00
|
|
|
static class InterpolationQualifierExtensions
|
2019-10-13 06:02:07 +00:00
|
|
|
{
|
|
|
|
public static string ToGlslQualifier(this InterpolationQualifier iq)
|
|
|
|
{
|
2020-04-02 01:24:55 +00:00
|
|
|
string output = (iq & ~InterpolationQualifier.FlagsMask) switch
|
2019-10-13 06:02:07 +00:00
|
|
|
{
|
2020-04-02 01:24:55 +00:00
|
|
|
InterpolationQualifier.Flat => "flat",
|
|
|
|
InterpolationQualifier.NoPerspective => "noperspective",
|
|
|
|
InterpolationQualifier.Smooth => "smooth",
|
|
|
|
_ => string.Empty
|
|
|
|
};
|
2019-10-13 06:02:07 +00:00
|
|
|
|
|
|
|
if ((iq & InterpolationQualifier.Centroid) != 0)
|
|
|
|
{
|
|
|
|
output = "centroid " + output;
|
|
|
|
}
|
|
|
|
else if ((iq & InterpolationQualifier.Sample) != 0)
|
|
|
|
{
|
|
|
|
output = "sample " + output;
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|