mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-22 17:10:19 +00:00
SPIR-V: Workaround for Intel FrontFacing bug
This commit is contained in:
parent
ad081de56b
commit
f16b47114c
1 changed files with 19 additions and 7 deletions
|
@ -326,7 +326,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
var elemPointer = GetAttributeElemPointer(attr, isOutAttr, index, out var elemType);
|
var elemPointer = GetAttributeElemPointer(attr, isOutAttr, index, out var elemType);
|
||||||
var value = Load(GetType(elemType), elemPointer);
|
var value = Load(GetType(elemType), elemPointer);
|
||||||
|
|
||||||
if (Config.Stage == ShaderStage.Fragment && (attr == AttributeConsts.PositionX || attr == AttributeConsts.PositionY))
|
if (Config.Stage == ShaderStage.Fragment)
|
||||||
|
{
|
||||||
|
if (attr == AttributeConsts.PositionX || attr == AttributeConsts.PositionY)
|
||||||
{
|
{
|
||||||
var pointerType = TypePointer(StorageClass.Uniform, TypeFP32());
|
var pointerType = TypePointer(StorageClass.Uniform, TypeFP32());
|
||||||
var fieldIndex = Constant(TypeU32(), 3);
|
var fieldIndex = Constant(TypeU32(), 3);
|
||||||
|
@ -337,6 +339,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
|
|
||||||
value = FDiv(TypeFP32(), value, scale);
|
value = FDiv(TypeFP32(), value, scale);
|
||||||
}
|
}
|
||||||
|
else if (attr == AttributeConsts.FrontFacing && Config.GpuAccessor.QueryHostHasFrontFacingBug())
|
||||||
|
{
|
||||||
|
// Workaround for what appears to be a bug on Intel compiler.
|
||||||
|
var valueFloat = Select(TypeFP32(), value, Constant(TypeFP32(), 1f), Constant(TypeFP32(), 0f));
|
||||||
|
var valueAsInt = Bitcast(TypeS32(), valueFloat);
|
||||||
|
var valueNegated = SNegate(TypeS32(), valueAsInt);
|
||||||
|
|
||||||
|
value = SLessThan(TypeBool(), valueNegated, Constant(TypeS32(), 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return BitcastIfNeeded(type, elemType, value);
|
return BitcastIfNeeded(type, elemType, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue