Better viewport flipping and depth mode detection method (#1556)
* Use a better viewport flipping approach * New approach to detect depth mode * nit: Sort method on the OpenGL backend * Adjust spacing on comment * Unswap near and far parameters based on ScaleZ
This commit is contained in:
parent
4b1bed1b05
commit
1eea35554c
6 changed files with 101 additions and 136 deletions
|
@ -188,12 +188,6 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
/// <returns>True if the GPU and driver supports non-constant texture offsets, false otherwise</returns>
|
||||
public bool QuerySupportsNonConstantTextureOffset() => _context.Capabilities.SupportsNonConstantTextureOffset;
|
||||
|
||||
/// <summary>
|
||||
/// Queries host GPU viewport swizzle support.
|
||||
/// </summary>
|
||||
/// <returns>True if the GPU and driver supports viewport swizzle, false otherwise</returns>
|
||||
public bool QuerySupportsViewportSwizzle() => _context.Capabilities.SupportsViewportSwizzle;
|
||||
|
||||
/// <summary>
|
||||
/// Queries texture format information, for shaders using image load or store.
|
||||
/// </summary>
|
||||
|
@ -257,24 +251,6 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
};
|
||||
}
|
||||
|
||||
public int QueryViewportSwizzle(int component)
|
||||
{
|
||||
YControl yControl = _state.Get<YControl>(MethodOffset.YControl);
|
||||
|
||||
bool flipY = yControl.HasFlag(YControl.NegateY) ^ !yControl.HasFlag(YControl.TriangleRastFlip);
|
||||
|
||||
ViewportTransform transform = _state.Get<ViewportTransform>(MethodOffset.ViewportTransform, 0);
|
||||
|
||||
return component switch
|
||||
{
|
||||
0 => (int)(transform.UnpackSwizzleX() ^ (transform.ScaleX < 0 ? ViewportSwizzle.NegativeFlag : 0)),
|
||||
1 => (int)(transform.UnpackSwizzleY() ^ (transform.ScaleY < 0 ? ViewportSwizzle.NegativeFlag : 0) ^ (flipY ? ViewportSwizzle.NegativeFlag : 0)),
|
||||
2 => (int)(transform.UnpackSwizzleZ() ^ (transform.ScaleZ < 0 ? ViewportSwizzle.NegativeFlag : 0)),
|
||||
3 => (int)transform.UnpackSwizzleW(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(component))
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the texture descriptor for a given texture on the pool.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue