|
|
@@ -1,8 +1,28 @@
|
|
|
using System.Runtime.InteropServices;
|
|
|
-using Ryujinx.Graphics.Shader;
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// Flags indicating if the shader accesses certain built-ins, such as the instance ID.
|
|
|
+ /// </summary>
|
|
|
+ enum UseFlags : byte
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// None of the built-ins are used.
|
|
|
+ /// </summary>
|
|
|
+ None = 0,
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Indicates whenever the vertex shader reads the gl_InstanceID built-in.
|
|
|
+ /// </summary>
|
|
|
+ InstanceId = 1 << 0,
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Indicates whenever any of the VTG stages writes to the gl_Layer built-in.
|
|
|
+ /// </summary>
|
|
|
+ RtLayer = 1 << 1
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Host shader entry header used for binding information.
|
|
|
/// </summary>
|
|
|
@@ -30,10 +50,9 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
|
|
|
public int ImagesCount;
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Set to true if the shader uses instance id.
|
|
|
+ /// Flags indicating if the shader accesses certain built-ins, such as the instance ID.
|
|
|
/// </summary>
|
|
|
- [MarshalAs(UnmanagedType.I1)]
|
|
|
- public bool UsesInstanceId;
|
|
|
+ public UseFlags UseFlags;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Set to true if this entry is in use.
|
|
|
@@ -65,15 +84,22 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
|
|
|
int texturesCount,
|
|
|
int imagesCount,
|
|
|
bool usesInstanceId,
|
|
|
+ bool usesRtLayer,
|
|
|
byte clipDistancesWritten) : this()
|
|
|
{
|
|
|
CBuffersCount = cBuffersCount;
|
|
|
SBuffersCount = sBuffersCount;
|
|
|
TexturesCount = texturesCount;
|
|
|
ImagesCount = imagesCount;
|
|
|
- UsesInstanceId = usesInstanceId;
|
|
|
ClipDistancesWritten = clipDistancesWritten;
|
|
|
InUse = true;
|
|
|
+
|
|
|
+ UseFlags = usesInstanceId ? UseFlags.InstanceId : UseFlags.None;
|
|
|
+
|
|
|
+ if (usesRtLayer)
|
|
|
+ {
|
|
|
+ UseFlags |= UseFlags.RtLayer;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|