aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-04-20 07:33:54 -0300
committerGitHub <noreply@github.com>2021-04-20 12:33:54 +0200
commit4770cfa920b606b1496ca9348c3dd69b476dbbbf (patch)
tree864a33b60a4bf30239e26f720026f4988e72d220 /Ryujinx.Graphics.Shader/Translation/EmitterContext.cs
parent89791ba68dba70999643c5d876e9329b385c6e8a (diff)
Only enable clip distance if written to on shader (#2217)
* Only enable clip distance if written to on shader * Signal InstanceId use through FeatureFlags * Shader cache version bump
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/EmitterContext.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Translation/EmitterContext.cs26
1 files changed, 25 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs
index a4c21c1d..9b220177 100644
--- a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs
+++ b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs
@@ -55,7 +55,11 @@ namespace Ryujinx.Graphics.Shader.Translation
public void FlagAttributeRead(int attribute)
{
- if (Config.Stage == ShaderStage.Fragment)
+ if (Config.Stage == ShaderStage.Vertex && attribute == AttributeConsts.InstanceId)
+ {
+ Config.SetUsedFeature(FeatureFlags.InstanceId);
+ }
+ else if (Config.Stage == ShaderStage.Fragment)
{
switch (attribute)
{
@@ -67,6 +71,26 @@ namespace Ryujinx.Graphics.Shader.Translation
}
}
+ public void FlagAttributeWritten(int attribute)
+ {
+ if (Config.Stage == ShaderStage.Vertex)
+ {
+ switch (attribute)
+ {
+ case AttributeConsts.ClipDistance0:
+ case AttributeConsts.ClipDistance1:
+ case AttributeConsts.ClipDistance2:
+ case AttributeConsts.ClipDistance3:
+ case AttributeConsts.ClipDistance4:
+ case AttributeConsts.ClipDistance5:
+ case AttributeConsts.ClipDistance6:
+ case AttributeConsts.ClipDistance7:
+ Config.SetClipDistanceWritten((attribute - AttributeConsts.ClipDistance0) / 4);
+ break;
+ }
+ }
+ }
+
public void MarkLabel(Operand label)
{
Add(Instruction.MarkLabel, label);