mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-22 00:53:35 +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)
|
||||
{
|
||||
if (!AttributeInfo.Validate(Config, attr, isOutAttr: false))
|
||||
{
|
||||
return GetConstant(type, new AstOperand(IrOperandType.Constant, 0));
|
||||
}
|
||||
|
||||
var elemPointer = GetAttributeElemPointer(attr, isOutAttr, index, out var elemType);
|
||||
return BitcastIfNeeded(type, elemType, Load(GetType(elemType), elemPointer));
|
||||
}
|
||||
|
|
|
@ -360,6 +360,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||
|
||||
foreach (int attr in info.Inputs)
|
||||
{
|
||||
if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isUserAttr = attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd;
|
||||
|
||||
if (iaIndexing && isUserAttr)
|
||||
|
@ -405,6 +410,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||
|
||||
foreach (int attr in info.Outputs)
|
||||
{
|
||||
if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isUserAttr = attr >= AttributeConsts.UserAttributeBase && attr < AttributeConsts.UserAttributeEnd;
|
||||
|
||||
if (oaIndexing && isUserAttr)
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||
context.AddExecutionMode(spvFunc, ExecutionMode.EarlyFragmentTests);
|
||||
}
|
||||
|
||||
if ((info.HelperFunctionsMask & HelperFunctionsMask.FSI) != 0 &&
|
||||
if ((info.HelperFunctionsMask & HelperFunctionsMask.FSI) != 0 &&
|
||||
context.Config.GpuAccessor.QueryHostSupportsFragmentShaderInterlock())
|
||||
{
|
||||
context.AddExecutionMode(spvFunc, ExecutionMode.PixelInterlockOrderedEXT);
|
||||
|
@ -331,8 +331,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||
}
|
||||
else if (dest.Type == OperandType.Attribute)
|
||||
{
|
||||
var elemPointer = context.GetAttributeElemPointer(dest.Value, true, null, out var elemType);
|
||||
context.Store(elemPointer, context.Get(elemType, assignment.Source));
|
||||
if (AttributeInfo.Validate(context.Config, dest.Value, isOutAttr: true))
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
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)
|
||||
{
|
||||
value &= ~3;
|
||||
|
|
Loading…
Reference in a new issue