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:
@@ -76,6 +76,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
|
||||
programInfo.Textures.Count,
|
||||
programInfo.Images.Count,
|
||||
programInfo.UsesInstanceId,
|
||||
programInfo.UsesRtLayer,
|
||||
programInfo.ClipDistancesWritten);
|
||||
CBuffers = programInfo.CBuffers.ToArray();
|
||||
SBuffers = programInfo.SBuffers.ToArray();
|
||||
@@ -89,7 +90,14 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache.Definition
|
||||
/// <returns>A new <see cref="ShaderProgramInfo"/> from this instance</returns>
|
||||
internal ShaderProgramInfo ToShaderProgramInfo()
|
||||
{
|
||||
return new ShaderProgramInfo(CBuffers, SBuffers, Textures, Images, Header.UsesInstanceId, Header.ClipDistancesWritten);
|
||||
return new ShaderProgramInfo(
|
||||
CBuffers,
|
||||
SBuffers,
|
||||
Textures,
|
||||
Images,
|
||||
Header.UseFlags.HasFlag(UseFlags.InstanceId),
|
||||
Header.UseFlags.HasFlag(UseFlags.RtLayer),
|
||||
Header.ClipDistancesWritten);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user