Better IPA shader instruction implementation (#1082)

* Fix varying interpolation on fragment shader

* Some nits

* Alignment
This commit is contained in:
gdkchan 2020-04-02 21:20:47 -03:00 committed by GitHub
parent 2365ddfc36
commit e93ca84b14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 97 additions and 89 deletions

View file

@ -365,11 +365,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
foreach (int attr in info.IAttributes.OrderBy(x => x))
{
string iq = info.InterpolationQualifiers[attr].ToGlslQualifier();
string iq = string.Empty;
if (iq != string.Empty)
if (context.Config.Stage == ShaderStage.Fragment)
{
iq += " ";
iq = context.Config.ImapTypes[attr].GetFirstUsedType() switch
{
PixelImap.Constant => "flat ",
PixelImap.ScreenLinear => "noperspective ",
_ => string.Empty
};
}
context.AppendLine($"layout (location = {attr}) {iq}in vec4 {DefaultNames.IAttributePrefix}{attr}{suffix};");