aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs
index a7ee12bc..1994d226 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs
@@ -300,8 +300,9 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
/// <param name="parent">The parent texture</param>
/// <param name="firstLevel">The first level of the texture view</param>
+ /// <param name="parentFormat">True if the parent format should be inherited</param>
/// <returns>The adjusted texture information with the new size</returns>
- public TextureInfo CreateInfoForLevelView(Texture parent, int firstLevel)
+ public TextureInfo CreateInfoForLevelView(Texture parent, int firstLevel, bool parentFormat)
{
// When the texture is used as view of another texture, we must
// ensure that the sizes are valid, otherwise data uploads would fail
@@ -370,7 +371,36 @@ namespace Ryujinx.Graphics.Gpu.Image
GobBlocksInZ,
GobBlocksInTileX,
target,
- FormatInfo,
+ parentFormat ? parent.Info.FormatInfo : FormatInfo,
+ DepthStencilMode,
+ SwizzleR,
+ SwizzleG,
+ SwizzleB,
+ SwizzleA);
+ }
+
+ /// <summary>
+ /// Creates texture information for a given format and this information.
+ /// </summary>
+ /// <param name="formatInfo">Format for the new texture info</param>
+ /// <returns>New info with the specified format</returns>
+ public TextureInfo CreateInfoWithFormat(FormatInfo formatInfo)
+ {
+ return new TextureInfo(
+ GpuAddress,
+ Width,
+ Height,
+ DepthOrLayers,
+ Levels,
+ SamplesInX,
+ SamplesInY,
+ Stride,
+ IsLinear,
+ GobBlocksInY,
+ GobBlocksInZ,
+ GobBlocksInTileX,
+ Target,
+ formatInfo,
DepthStencilMode,
SwizzleR,
SwizzleG,