aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-09-28 20:55:12 -0300
committerGitHub <noreply@github.com>2021-09-29 01:55:12 +0200
commitfd7567a6b56fcb82a52b85097582fc0a67038457 (patch)
tree175c9992d0cca4c05b80857d66af4bbdce09cba7 /Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs
parent312be74861dae16311f4376e32195f8a4fd372c6 (diff)
Only make render target 2D textures layered if needed (#2646)
* Only make render target 2D textures layered if needed * Shader cache version bump * Ensure topology is updated on channel swap
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs36
1 files changed, 31 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs b/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs
index 7f27124f..4b8b15bc 100644
--- a/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs
+++ b/Ryujinx.Graphics.Gpu/Shader/Cache/Definition/HostShaderCacheEntryHeader.cs
@@ -1,9 +1,29 @@
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>
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x14)]
@@ -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;
+ }
}
}
}