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
This commit is contained in:
gdkchan 2021-09-28 20:55:12 -03:00 committed by GitHub
parent 312be74861
commit fd7567a6b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 16 deletions

View file

@ -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;
}
}
}
}