aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/StructuredIr
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Shader/StructuredIr')
-rw-r--r--Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs6
-rw-r--r--Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs35
2 files changed, 38 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs
index 85049abb..7678a4bf 100644
--- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs
+++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs
@@ -71,12 +71,12 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
var locations = config.GpuAccessor.QueryTransformFeedbackVaryingLocations(tfbIndex);
var stride = config.GpuAccessor.QueryTransformFeedbackStride(tfbIndex);
- for (int j = 0; j < locations.Length; j++)
+ for (int i = 0; i < locations.Length; i++)
{
- byte location = locations[j];
+ byte location = locations[i];
if (location < 0xc0)
{
- context.Info.TransformFeedbackOutputs[location] = new TransformFeedbackOutput(tfbIndex, j * 4, stride);
+ context.Info.TransformFeedbackOutputs[location] = new TransformFeedbackOutput(tfbIndex, i * 4, stride);
}
}
}
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs
index 43bdfaba..57253148 100644
--- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs
+++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs
@@ -42,5 +42,40 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
TransformFeedbackOutputs = new TransformFeedbackOutput[0xc0];
}
+
+ public TransformFeedbackOutput GetTransformFeedbackOutput(int attr)
+ {
+ int index = attr / 4;
+ return TransformFeedbackOutputs[index];
+ }
+
+ public int GetTransformFeedbackOutputComponents(int attr)
+ {
+ int index = attr / 4;
+ int baseIndex = index & ~3;
+
+ int count = 1;
+
+ for (; count < 4; count++)
+ {
+ ref var prev = ref TransformFeedbackOutputs[baseIndex + count - 1];
+ ref var curr = ref TransformFeedbackOutputs[baseIndex + count];
+
+ int prevOffset = prev.Offset;
+ int currOffset = curr.Offset;
+
+ if (!prev.Valid || !curr.Valid || prevOffset + 4 != currOffset)
+ {
+ break;
+ }
+ }
+
+ if (baseIndex + count <= index)
+ {
+ return 1;
+ }
+
+ return count;
+ }
}
} \ No newline at end of file