aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Shader')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs6
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs9
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs16
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/GpuChannelGraphicsState.cs12
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs5
5 files changed, 40 insertions, 8 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs
index 7f01aca6..b5f9395e 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGpuAccessor.cs
@@ -248,6 +248,12 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
}
/// <inheritdoc/>
+ public bool QueryYNegateEnabled()
+ {
+ return _oldSpecState.GraphicsState.YNegateEnabled;
+ }
+
+ /// <inheritdoc/>
public void RegisterTexture(int handle, int cbufSlot)
{
if (!_oldSpecState.TextureRegistered(_stageIndex, handle, cbufSlot))
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
index 672b3b8d..4bab165d 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
- private const uint CodeGenVersion = 5266;
+ private const uint CodeGenVersion = 4675;
private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data";
@@ -141,6 +141,11 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
public ShaderStage Stage;
/// <summary>
+ /// Indicates if the fragment shader accesses the fragment coordinate built-in variable.
+ /// </summary>
+ public bool UsesFragCoord;
+
+ /// <summary>
/// Indicates if the shader accesses the Instance ID built-in variable.
/// </summary>
public bool UsesInstanceId;
@@ -781,6 +786,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
ShaderIdentification.None,
0,
dataInfo.Stage,
+ dataInfo.UsesFragCoord,
dataInfo.UsesInstanceId,
dataInfo.UsesDrawParameters,
dataInfo.UsesRtLayer,
@@ -807,6 +813,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
TexturesCount = (ushort)info.Textures.Count,
ImagesCount = (ushort)info.Images.Count,
Stage = info.Stage,
+ UsesFragCoord = info.UsesFragCoord,
UsesInstanceId = info.UsesInstanceId,
UsesDrawParameters = info.UsesDrawParameters,
UsesRtLayer = info.UsesRtLayer,
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
index ca9c883e..1fcc93c5 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
@@ -114,6 +114,13 @@ namespace Ryujinx.Graphics.Gpu.Shader
}
/// <inheritdoc/>
+ public bool QueryEarlyZForce()
+ {
+ _state.SpecializationState?.RecordEarlyZForce();
+ return _state.GraphicsState.EarlyZForce;
+ }
+
+ /// <inheritdoc/>
public AttributeType QueryFragmentOutputType(int location)
{
return _state.GraphicsState.FragmentOutputTypes[location];
@@ -276,16 +283,15 @@ namespace Ryujinx.Graphics.Gpu.Shader
}
/// <inheritdoc/>
- public bool QueryEarlyZForce()
+ public bool QueryViewportTransformDisable()
{
- _state.SpecializationState?.RecordEarlyZForce();
- return _state.GraphicsState.EarlyZForce;
+ return _state.GraphicsState.ViewportTransformDisable;
}
/// <inheritdoc/>
- public bool QueryViewportTransformDisable()
+ public bool QueryYNegateEnabled()
{
- return _state.GraphicsState.ViewportTransformDisable;
+ return _state.GraphicsState.YNegateEnabled;
}
/// <inheritdoc/>
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/GpuChannelGraphicsState.cs b/src/Ryujinx.Graphics.Gpu/Shader/GpuChannelGraphicsState.cs
index 544e689a..f392491c 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/GpuChannelGraphicsState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/GpuChannelGraphicsState.cs
@@ -98,6 +98,11 @@ namespace Ryujinx.Graphics.Gpu.Shader
public bool DualSourceBlendEnable;
/// <summary>
+ /// Indicates whether Y negate of the fragment coordinates is enabled.
+ /// </summary>
+ public bool YNegateEnabled;
+
+ /// <summary>
/// Creates a new GPU graphics state.
/// </summary>
/// <param name="earlyZForce">Early Z force enable</param>
@@ -116,7 +121,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <param name="hasConstantBufferDrawParameters">Indicates that the draw is writing the base vertex, base instance and draw index to Constant Buffer 0</param>
/// <param name="hasUnalignedStorageBuffer">Indicates that any storage buffer use is unaligned</param>
/// <param name="fragmentOutputTypes">Type of the fragment shader outputs</param>
- /// <param name="dualSourceBlendEnable">Type of the vertex attributes consumed by the shader</param>
+ /// <param name="dualSourceBlendEnable">Indicates whether dual source blend is enabled</param>
+ /// <param name="yNegateEnabled">Indicates whether Y negate of the fragment coordinates is enabled</param>
public GpuChannelGraphicsState(
bool earlyZForce,
PrimitiveTopology topology,
@@ -134,7 +140,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
bool hasConstantBufferDrawParameters,
bool hasUnalignedStorageBuffer,
ref Array8<AttributeType> fragmentOutputTypes,
- bool dualSourceBlendEnable)
+ bool dualSourceBlendEnable,
+ bool yNegateEnabled)
{
EarlyZForce = earlyZForce;
Topology = topology;
@@ -153,6 +160,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
HasUnalignedStorageBuffer = hasUnalignedStorageBuffer;
FragmentOutputTypes = fragmentOutputTypes;
DualSourceBlendEnable = dualSourceBlendEnable;
+ YNegateEnabled = yNegateEnabled;
}
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
index 775bfb2a..b33f96c5 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
@@ -540,6 +540,11 @@ namespace Ryujinx.Graphics.Gpu.Shader
return false;
}
+ if (graphicsState.YNegateEnabled != GraphicsState.YNegateEnabled)
+ {
+ return false;
+ }
+
return Matches(channel, ref poolState, checkTextures, isCompute: false);
}