aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-05-14 11:47:16 -0300
committerGitHub <noreply@github.com>2024-05-14 16:47:16 +0200
commit3a3b51893ee272af49d762387da5b27743786d56 (patch)
treee37f41f9a6cd65f8c9f53359b378740b6fbe00af /src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
parent44dbab3848c8831d27e50f7252d759a2494ad556 (diff)
Add support for bindless textures from storage buffer on Vulkan (#6721)
* Halve primitive ID when converting quads to triangles * Shader cache version bump * Add support for bindless textures from storage buffer on Vulkan
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
index 63ce38e2..c704156b 100644
--- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
+++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
@@ -84,6 +84,10 @@ namespace Ryujinx.Graphics.Shader.Instructions
value = context.IConvertU32ToFP32(value);
}
}
+ else if (offset == AttributeConsts.PrimitiveId && context.TranslatorContext.Definitions.HalvePrimitiveId)
+ {
+ value = context.ShiftRightS32(value, Const(1));
+ }
context.Copy(Register(rd), value);
}
@@ -187,6 +191,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
}
}
+ else if (op.Imm10 == AttributeConsts.PrimitiveId && context.TranslatorContext.Definitions.HalvePrimitiveId)
+ {
+ // If quads are used, but the host does not support them, they need to be converted to triangles.
+ // Since each quad becomes 2 triangles, we need to compensate here and divide primitive ID by 2.
+ res = context.ShiftRightS32(res, Const(1));
+ }
else if (op.Imm10 == AttributeConsts.FrontFacing && context.TranslatorContext.GpuAccessor.QueryHostHasFrontFacingBug())
{
// gl_FrontFacing sometimes has incorrect (flipped) values depending how it is accessed on Intel GPUs.