aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/Texture.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2020-12-03 19:34:27 +0000
committerGitHub <noreply@github.com>2020-12-03 20:34:27 +0100
commit24d316cc92787f2b42610d22e9780b160fb68d59 (patch)
treea4bc1e8c876f0a5c5181f05b38aed355909a6ff2 /Ryujinx.Graphics.Gpu/Image/Texture.cs
parentb479a43939b77b7f6d67f103f1fdc9126466f780 (diff)
Extract texture Target from Info for quick access (#1774)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Texture.cs18
1 files changed, 12 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs
index 45a27051..ae7fa6cf 100644
--- a/Ryujinx.Graphics.Gpu/Image/Texture.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs
@@ -31,6 +31,11 @@ namespace Ryujinx.Graphics.Gpu.Image
public Format Format => Info.FormatInfo.Format;
/// <summary>
+ /// Texture target.
+ /// </summary>
+ public Target Target { get; private set; }
+
+ /// <summary>
/// Texture information.
/// </summary>
public TextureInfo Info { get; private set; }
@@ -290,7 +295,7 @@ namespace Ryujinx.Graphics.Gpu.Image
width <<= _firstLevel;
height <<= _firstLevel;
- if (Info.Target == Target.Texture3D)
+ if (Target == Target.Texture3D)
{
depthOrLayers <<= _firstLevel;
}
@@ -532,7 +537,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
public void SynchronizeMemory()
{
- if (Info.Target == Target.TextureBuffer)
+ if (Target == Target.TextureBuffer)
{
return;
}
@@ -653,11 +658,11 @@ namespace Ryujinx.Graphics.Gpu.Image
data = decoded;
}
- else if (Info.Target == Target.Texture3D && Info.FormatInfo.Format.IsBc4())
+ else if (Target == Target.Texture3D && Info.FormatInfo.Format.IsBc4())
{
data = BCnDecoder.DecodeBC4(data, Info.Width, Info.Height, _depth, Info.Levels, _layers, Info.FormatInfo.Format == Format.Bc4Snorm);
}
- else if (Info.Target == Target.Texture3D && Info.FormatInfo.Format.IsBc5())
+ else if (Target == Target.Texture3D && Info.FormatInfo.Format.IsBc5())
{
data = BCnDecoder.DecodeBC5(data, Info.Width, Info.Height, _depth, Info.Levels, _layers, Info.FormatInfo.Format == Format.Bc5Snorm);
}
@@ -760,7 +765,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
}
- if (Info.Target != Target.TextureBuffer)
+ if (Target != Target.TextureBuffer)
{
if (Info.IsLinear)
{
@@ -903,7 +908,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>A view of this texture with the requested target, or null if the target is invalid for this texture</returns>
public ITexture GetTargetTexture(Target target)
{
- if (target == Info.Target)
+ if (target == Target)
{
return HostTexture;
}
@@ -1008,6 +1013,7 @@ namespace Ryujinx.Graphics.Gpu.Image
private void SetInfo(TextureInfo info)
{
Info = info;
+ Target = info.Target;
_depth = info.GetDepth();
_layers = info.GetLayers();