aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/IGpuAccessor.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-08-13 22:26:42 -0300
committerGitHub <noreply@github.com>2023-08-13 22:26:42 -0300
commitb423197619dd8d9dda1c255a76105bf30e255dae (patch)
treee3898b3b1672f022b5de4522b51bd21583043996 /src/Ryujinx.Graphics.Shader/IGpuAccessor.cs
parent8edfb2bc7b8507d0ef51f0544eb32a65f0bf54a1 (diff)
Delete ShaderConfig and organize shader resources/definitions better (#5509)1.1.985
* Move some properties out of ShaderConfig * Stop using ShaderConfig on backends * Replace ShaderConfig usages on Translator and passes * Move remaining properties out of ShaderConfig and delete ShaderConfig * Remove ResourceManager property from TranslatorContext * Move Rewriter passes to separate transform pass files * Fix TransformPasses.RunPass on cases where a node is removed * Move remaining ClipDistancePrimitivesWritten and UsedFeatures updates to decode stage * Reduce excessive parameter passing a bit by using structs more * Remove binding parameter from ShaderProperties methods since it is redundant * Replace decoder instruction checks with switch statement * Put GLSL on the same plan as SPIR-V for input/output declaration * Stop mutating TranslatorContext state when Translate is called * Pass most of the graphics state using a struct instead of individual query methods * Auto-format * Auto-format * Add backend logging interface * Auto-format * Remove unnecessary use of interpolated strings * Remove more modifications of AttributeUsage after decode * PR feedback * gl_Layer is not supported on compute
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/IGpuAccessor.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/IGpuAccessor.cs161
1 files changed, 7 insertions, 154 deletions
diff --git a/src/Ryujinx.Graphics.Shader/IGpuAccessor.cs b/src/Ryujinx.Graphics.Shader/IGpuAccessor.cs
index a47791d3..4c0adc3b 100644
--- a/src/Ryujinx.Graphics.Shader/IGpuAccessor.cs
+++ b/src/Ryujinx.Graphics.Shader/IGpuAccessor.cs
@@ -1,22 +1,14 @@
-using System;
+using Ryujinx.Graphics.Shader.CodeGen;
+using System;
namespace Ryujinx.Graphics.Shader
{
/// <summary>
/// GPU state access interface.
/// </summary>
- public interface IGpuAccessor
+ public interface IGpuAccessor : ILogger
{
/// <summary>
- /// Prints a log message.
- /// </summary>
- /// <param name="message">Message to print</param>
- void Log(string message)
- {
- // No default log output.
- }
-
- /// <summary>
/// Reads data from the constant buffer 1.
/// </summary>
/// <param name="offset">Offset in bytes to read from</param>
@@ -35,44 +27,6 @@ namespace Ryujinx.Graphics.Shader
ReadOnlySpan<ulong> GetCode(ulong address, int minimumSize);
/// <summary>
- /// Queries the alpha test comparison operator that is being used currently.
- /// If alpha test is disabled, it should be set to <see cref="AlphaTestOp.Always"/>.
- /// </summary>
- /// <returns>Current alpha test comparison</returns>
- AlphaTestOp QueryAlphaTestCompare()
- {
- return AlphaTestOp.Always;
- }
-
- /// <summary>
- /// Queries the current alpha test reference value used by the comparison.
- /// </summary>
- /// <returns>Current alpha test reference value</returns>
- float QueryAlphaTestReference()
- {
- return 0f;
- }
-
- /// <summary>
- /// Queries the type of the vertex shader input attribute at the specified <paramref name="location"/>.
- /// </summary>
- /// <param name="location">Location of the input attribute</param>
- /// <returns>Input type</returns>
- AttributeType QueryAttributeType(int location)
- {
- return AttributeType.Float;
- }
-
- /// <summary>
- /// Queries whenever the alpha-to-coverage dithering feature is enabled.
- /// </summary>
- /// <returns>True if the feature is enabled, false otherwise</returns>
- bool QueryAlphaToCoverageDitherEnable()
- {
- return false;
- }
-
- /// <summary>
/// Queries the binding number of a constant buffer.
/// </summary>
/// <param name="index">Constant buffer index</param>
@@ -115,16 +69,6 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries output type for fragment shaders.
- /// </summary>
- /// <param name="location">Location of the framgent output</param>
- /// <returns>Output location</returns>
- AttributeType QueryFragmentOutputType(int location)
- {
- return AttributeType.Float;
- }
-
- /// <summary>
/// Queries Local Size X for compute shaders.
/// </summary>
/// <returns>Local Size X</returns>
@@ -179,12 +123,12 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries if host state forces early depth testing.
+ /// Queries specialized GPU graphics state that the shader depends on.
/// </summary>
- /// <returns>True if early depth testing is forced</returns>
- bool QueryEarlyZForce()
+ /// <returns>GPU graphics state</returns>
+ GpuGraphicsState QueryGraphicsState()
{
- return false;
+ return default;
}
/// <summary>
@@ -224,15 +168,6 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries dual source blend state.
- /// </summary>
- /// <returns>True if blending is enabled with a dual source blend equation, false otherwise</returns>
- bool QueryDualSourceBlendEnable()
- {
- return false;
- }
-
- /// <summary>
/// Queries host about the presence of the FrontFacing built-in variable bug.
/// </summary>
/// <returns>True if the bug is present on the host device used, false otherwise</returns>
@@ -413,25 +348,6 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries the point size from the GPU state, used when it is not explicitly set on the shader.
- /// </summary>
- /// <returns>Current point size</returns>
- float QueryPointSize()
- {
- return 1f;
- }
-
- /// <summary>
- /// Queries the state that indicates if the program point size should be explicitly set on the shader
- /// or read from the GPU state.
- /// </summary>
- /// <returns>True if the shader is expected to set the point size explicitly, false otherwise</returns>
- bool QueryProgramPointSize()
- {
- return true;
- }
-
- /// <summary>
/// Queries sampler type information.
/// </summary>
/// <param name="handle">Texture handle</param>
@@ -454,42 +370,6 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries current primitive topology for geometry shaders.
- /// </summary>
- /// <returns>Current primitive topology</returns>
- InputTopology QueryPrimitiveTopology()
- {
- return InputTopology.Points;
- }
-
- /// <summary>
- /// Queries the tessellation evaluation shader primitive winding order.
- /// </summary>
- /// <returns>True if the primitive winding order is clockwise, false if counter-clockwise</returns>
- bool QueryTessCw()
- {
- return false;
- }
-
- /// <summary>
- /// Queries the tessellation evaluation shader abstract patch type.
- /// </summary>
- /// <returns>Abstract patch type</returns>
- TessPatchType QueryTessPatchType()
- {
- return TessPatchType.Triangles;
- }
-
- /// <summary>
- /// Queries the tessellation evaluation shader spacing between tessellated vertices of the patch.
- /// </summary>
- /// <returns>Spacing between tessellated vertices of the patch</returns>
- TessSpacing QueryTessSpacing()
- {
- return TessSpacing.EqualSpacing;
- }
-
- /// <summary>
/// Queries texture format information, for shaders using image load or store.
/// </summary>
/// <remarks>
@@ -505,15 +385,6 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries depth mode information from the GPU state.
- /// </summary>
- /// <returns>True if current depth mode is -1 to 1, false if 0 to 1</returns>
- bool QueryTransformDepthMinusOneToOne()
- {
- return false;
- }
-
- /// <summary>
/// Queries transform feedback enable state.
/// </summary>
/// <returns>True if the shader uses transform feedback, false otherwise</returns>
@@ -543,24 +414,6 @@ namespace Ryujinx.Graphics.Shader
}
/// <summary>
- /// Queries if host state disables the viewport transform.
- /// </summary>
- /// <returns>True if the viewport transform is disabled</returns>
- bool QueryViewportTransformDisable()
- {
- return false;
- }
-
- /// <summary>
- /// Queries Y negate enable state.
- /// </summary>
- /// <returns>True if Y negate of the fragment coordinates is enabled, false otherwise</returns>
- bool QueryYNegateEnabled()
- {
- return false;
- }
-
- /// <summary>
/// Registers a texture used by the shader.
/// </summary>
/// <param name="handle">Texture handle word offset</param>