aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-29 14:41:50 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit654e617fe78b0f5cc86d0bcf0625301abff168f5 (patch)
tree01f2eba89039698bec583a3e29c4c50d0e20b8d1 /Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs
parentaf8498d6790ba83f1cf87eccf5f272f2ccbeb169 (diff)
Some code cleanup
Diffstat (limited to 'Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs')
-rw-r--r--Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs120
1 files changed, 0 insertions, 120 deletions
diff --git a/Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs b/Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs
deleted file mode 100644
index c6a73d91..00000000
--- a/Ryujinx.Graphics.GAL/Texture/TextureCreateInfo.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using Ryujinx.Common;
-using System;
-
-namespace Ryujinx.Graphics.GAL.Texture
-{
- public struct TextureCreateInfo
- {
- public int Width { get; }
- public int Height { get; }
- public int Depth { get; }
- public int Levels { get; }
- public int Samples { get; }
- public int BlockWidth { get; }
- public int BlockHeight { get; }
- public int BytesPerPixel { get; }
-
- public bool IsCompressed => (BlockWidth | BlockHeight) != 1;
-
- public Format Format { get; }
-
- public DepthStencilMode DepthStencilMode { get; }
-
- public Target Target { get; }
-
- public SwizzleComponent SwizzleR { get; }
- public SwizzleComponent SwizzleG { get; }
- public SwizzleComponent SwizzleB { get; }
- public SwizzleComponent SwizzleA { get; }
-
- public TextureCreateInfo(
- int width,
- int height,
- int depth,
- int levels,
- int samples,
- int blockWidth,
- int blockHeight,
- int bytesPerPixel,
- Format format,
- DepthStencilMode depthStencilMode,
- Target target,
- SwizzleComponent swizzleR,
- SwizzleComponent swizzleG,
- SwizzleComponent swizzleB,
- SwizzleComponent swizzleA)
- {
- Width = width;
- Height = height;
- Depth = depth;
- Levels = levels;
- Samples = samples;
- BlockWidth = blockWidth;
- BlockHeight = blockHeight;
- BytesPerPixel = bytesPerPixel;
- Format = format;
- DepthStencilMode = depthStencilMode;
- Target = target;
- SwizzleR = swizzleR;
- SwizzleG = swizzleG;
- SwizzleB = swizzleB;
- SwizzleA = swizzleA;
- }
-
- public int GetMipSize(int level)
- {
- return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level);
- }
-
- public int GetMipSize2D(int level)
- {
- return GetMipStride(level) * GetLevelHeight(level);
- }
-
- public int GetMipStride(int level)
- {
- return BitUtils.AlignUp(GetLevelWidth(level) * BytesPerPixel, 4);
- }
-
- private int GetLevelWidth(int level)
- {
- return BitUtils.DivRoundUp(GetLevelSize(Width, level), BlockWidth);
- }
-
- private int GetLevelHeight(int level)
- {
- return BitUtils.DivRoundUp(GetLevelSize(Height, level), BlockHeight);
- }
-
- private int GetLevelDepth(int level)
- {
- return Target == Target.Texture3D ? GetLevelSize(Depth, level) : GetLayers();
- }
-
- public int GetDepthOrLayers()
- {
- return Target == Target.Texture3D ? Depth : GetLayers();
- }
-
- public int GetLayers()
- {
- if (Target == Target.Texture2DArray ||
- Target == Target.Texture2DMultisampleArray ||
- Target == Target.CubemapArray)
- {
- return Depth;
- }
- else if (Target == Target.Cubemap)
- {
- return 6;
- }
-
- return 1;
- }
-
- private static int GetLevelSize(int size, int level)
- {
- return Math.Max(1, size >> level);
- }
- }
-}