2019-12-29 17:41:50 +00:00
|
|
|
using Ryujinx.Graphics.GAL;
|
2019-10-13 06:02:07 +00:00
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gpu.Image
|
|
|
|
{
|
2019-12-29 23:26:37 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Texture target.
|
|
|
|
/// </summary>
|
2020-11-17 21:20:17 +00:00
|
|
|
enum TextureTarget : byte
|
2019-10-13 06:02:07 +00:00
|
|
|
{
|
|
|
|
Texture1D,
|
|
|
|
Texture2D,
|
|
|
|
Texture3D,
|
|
|
|
Cubemap,
|
|
|
|
Texture1DArray,
|
|
|
|
Texture2DArray,
|
|
|
|
TextureBuffer,
|
2019-12-16 04:59:46 +00:00
|
|
|
Texture2DRect,
|
2019-10-13 06:02:07 +00:00
|
|
|
CubemapArray
|
|
|
|
}
|
|
|
|
|
|
|
|
static class TextureTargetConverter
|
|
|
|
{
|
2019-12-29 23:26:37 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Converts the texture target enum to a host compatible, Graphics Abstraction Layer enum.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="target">The target enum to convert</param>
|
|
|
|
/// <param name="isMultisample">True if the texture is a multisampled texture</param>
|
|
|
|
/// <returns>The host compatible texture target</returns>
|
2019-10-13 06:02:07 +00:00
|
|
|
public static Target Convert(this TextureTarget target, bool isMultisample)
|
|
|
|
{
|
|
|
|
if (isMultisample)
|
|
|
|
{
|
|
|
|
switch (target)
|
|
|
|
{
|
|
|
|
case TextureTarget.Texture2D: return Target.Texture2DMultisample;
|
|
|
|
case TextureTarget.Texture2DArray: return Target.Texture2DMultisampleArray;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (target)
|
|
|
|
{
|
|
|
|
case TextureTarget.Texture1D: return Target.Texture1D;
|
|
|
|
case TextureTarget.Texture2D: return Target.Texture2D;
|
2019-12-16 04:59:46 +00:00
|
|
|
case TextureTarget.Texture2DRect: return Target.Texture2D;
|
2019-10-13 06:02:07 +00:00
|
|
|
case TextureTarget.Texture3D: return Target.Texture3D;
|
|
|
|
case TextureTarget.Texture1DArray: return Target.Texture1DArray;
|
|
|
|
case TextureTarget.Texture2DArray: return Target.Texture2DArray;
|
|
|
|
case TextureTarget.Cubemap: return Target.Cubemap;
|
|
|
|
case TextureTarget.CubemapArray: return Target.CubemapArray;
|
|
|
|
case TextureTarget.TextureBuffer: return Target.TextureBuffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Target.Texture1D;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|