mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 11:11:22 -08:00
Use correct swizzle on depth-stencil textures (#1196)
This commit is contained in:
parent
ea3d5fde73
commit
1758424208
@ -179,6 +179,22 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
swizzleB,
|
swizzleB,
|
||||||
swizzleA);
|
swizzleA);
|
||||||
|
|
||||||
|
if (IsDepthStencil(formatInfo.Format))
|
||||||
|
{
|
||||||
|
swizzleR = SwizzleComponent.Red;
|
||||||
|
swizzleG = SwizzleComponent.Red;
|
||||||
|
swizzleB = SwizzleComponent.Red;
|
||||||
|
|
||||||
|
if (depthStencilMode == DepthStencilMode.Depth)
|
||||||
|
{
|
||||||
|
swizzleA = SwizzleComponent.One;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swizzleA = SwizzleComponent.Red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new TextureInfo(
|
return new TextureInfo(
|
||||||
address,
|
address,
|
||||||
width,
|
width,
|
||||||
@ -252,6 +268,26 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||||||
component == SwizzleComponent.Green;
|
component == SwizzleComponent.Green;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the texture format is a depth, stencil or depth-stencil format.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="format">Texture format</param>
|
||||||
|
/// <returns>True if the format is a depth, stencil or depth-stencil format, false otherwise</returns>
|
||||||
|
private static bool IsDepthStencil(Format format)
|
||||||
|
{
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case Format.D16Unorm:
|
||||||
|
case Format.D24UnormS8Uint:
|
||||||
|
case Format.D24X8Unorm:
|
||||||
|
case Format.D32Float:
|
||||||
|
case Format.D32FloatS8Uint:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decrements the reference count of the texture.
|
/// Decrements the reference count of the texture.
|
||||||
/// This indicates that the texture pool is not using it anymore.
|
/// This indicates that the texture pool is not using it anymore.
|
||||||
|
Loading…
Reference in New Issue
Block a user