mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-22 17:10:19 +00:00
Ignore unsupported attributes rather than throwing (matches current GLSL behaviour)
This commit is contained in:
parent
d5e2cc2f9b
commit
070996ad6d
4 changed files with 26 additions and 3 deletions
|
@ -308,6 +308,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
|
|
||||||
public Instruction GetAttribute(AggregateType type, int attr, bool isOutAttr, Instruction index = null)
|
public Instruction GetAttribute(AggregateType type, int attr, bool isOutAttr, Instruction index = null)
|
||||||
{
|
{
|
||||||
|
if (!AttributeInfo.Validate(Config, attr, isOutAttr: false))
|
||||||
|
{
|
||||||
|
return GetConstant(type, new AstOperand(IrOperandType.Constant, 0));
|
||||||
|
}
|
||||||
|
|
||||||
var elemPointer = GetAttributeElemPointer(attr, isOutAttr, index, out var elemType);
|
var elemPointer = GetAttributeElemPointer(attr, isOutAttr, index, out var elemType);
|
||||||
return BitcastIfNeeded(type, elemType, Load(GetType(elemType), elemPointer));
|
return BitcastIfNeeded(type, elemType, Load(GetType(elemType), elemPointer));
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,6 +360,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
|
|
||||||
foreach (int attr in info.Inputs)
|
foreach (int attr in info.Inputs)
|
||||||
{
|
{
|
||||||
|
if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool isUserAttr = attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd;
|
bool isUserAttr = attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd;
|
||||||
|
|
||||||
if (iaIndexing && isUserAttr)
|
if (iaIndexing && isUserAttr)
|
||||||
|
@ -405,6 +410,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
|
|
||||||
foreach (int attr in info.Outputs)
|
foreach (int attr in info.Outputs)
|
||||||
{
|
{
|
||||||
|
if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: true))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool isUserAttr = attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd;
|
bool isUserAttr = attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd;
|
||||||
|
|
||||||
if (oaIndexing && isUserAttr)
|
if (oaIndexing && isUserAttr)
|
||||||
|
|
|
@ -331,8 +331,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
}
|
}
|
||||||
else if (dest.Type == OperandType.Attribute)
|
else if (dest.Type == OperandType.Attribute)
|
||||||
{
|
{
|
||||||
var elemPointer = context.GetAttributeElemPointer(dest.Value, true, null, out var elemType);
|
if (AttributeInfo.Validate(context.Config, dest.Value, isOutAttr: true))
|
||||||
context.Store(elemPointer, context.Get(elemType, assignment.Source));
|
{
|
||||||
|
var elemPointer = context.GetAttributeElemPointer(dest.Value, true, null, out var elemType);
|
||||||
|
context.Store(elemPointer, context.Get(elemType, assignment.Source));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (dest.Type == OperandType.Argument)
|
else if (dest.Type == OperandType.Argument)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
return (Value - BaseValue) / 4;
|
return (Value - BaseValue) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool Validate(ShaderConfig config, int value, bool isOutAttr)
|
||||||
|
{
|
||||||
|
return From(config, value, isOutAttr).IsValid;
|
||||||
|
}
|
||||||
|
|
||||||
public static AttributeInfo From(ShaderConfig config, int value, bool isOutAttr)
|
public static AttributeInfo From(ShaderConfig config, int value, bool isOutAttr)
|
||||||
{
|
{
|
||||||
value &= ~3;
|
value &= ~3;
|
||||||
|
|
Loading…
Reference in a new issue