diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-07-15 00:01:10 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-15 13:01:10 +1000 |
| commit | 788ca6a411762035a6a7a88100c4b582b47ee82d (patch) | |
| tree | d48bfb91aecaead2906ec2d390357546f8c0611f /Ryujinx.Graphics.Shader/CodeGen/Glsl/Varying.cs | |
| parent | 16dafe63166d065f40b57a9b7cf8017a6ba0b1ef (diff) | |
Initial transform feedback support (#1370)
* Initial transform feedback support
* Some nits and fixes
* Update ReportCounterType and Write method
* Can't change shader or TFB bindings while TFB is active
* Fix geometry shader input names with new naming
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Varying.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Varying.cs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Varying.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Varying.cs new file mode 100644 index 00000000..b9b2afb4 --- /dev/null +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Varying.cs @@ -0,0 +1,69 @@ +using Ryujinx.Graphics.Shader.Translation; + +namespace Ryujinx.Graphics.Shader.CodeGen.Glsl +{ + public static class Varying + { + public static string GetName(int offset) + { + offset <<= 2; + + if (offset >= AttributeConsts.UserAttributeBase && + offset < AttributeConsts.UserAttributeEnd) + { + offset -= AttributeConsts.UserAttributeBase; + + string name = $"{ DefaultNames.OAttributePrefix}{(offset >> 4)}"; + + name += "_" + "xyzw"[(offset >> 2) & 3]; + + return name; + } + + switch (offset) + { + case AttributeConsts.PositionX: + case AttributeConsts.PositionY: + case AttributeConsts.PositionZ: + case AttributeConsts.PositionW: + return "gl_Position"; + case AttributeConsts.PointSize: + return "gl_PointSize"; + case AttributeConsts.ClipDistance0: + return "gl_ClipDistance[0]"; + case AttributeConsts.ClipDistance1: + return "gl_ClipDistance[1]"; + case AttributeConsts.ClipDistance2: + return "gl_ClipDistance[2]"; + case AttributeConsts.ClipDistance3: + return "gl_ClipDistance[3]"; + case AttributeConsts.ClipDistance4: + return "gl_ClipDistance[4]"; + case AttributeConsts.ClipDistance5: + return "gl_ClipDistance[5]"; + case AttributeConsts.ClipDistance6: + return "gl_ClipDistance[6]"; + case AttributeConsts.ClipDistance7: + return "gl_ClipDistance[7]"; + case AttributeConsts.VertexId: + return "gl_VertexID"; + } + + return null; + } + + public static int GetSize(int offset) + { + switch (offset << 2) + { + case AttributeConsts.PositionX: + case AttributeConsts.PositionY: + case AttributeConsts.PositionZ: + case AttributeConsts.PositionW: + return 4; + } + + return 1; + } + } +}
\ No newline at end of file |
