2019-12-29 18:41:50 +01:00
|
|
|
using Ryujinx.Graphics.GAL;
|
2019-10-13 08:02:07 +02:00
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gpu.Image
|
|
|
|
{
|
2019-12-30 00:26:37 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Texture swizzle color component.
|
|
|
|
/// </summary>
|
2019-10-13 08:02:07 +02:00
|
|
|
enum TextureComponent
|
|
|
|
{
|
2023-07-02 02:47:54 +02:00
|
|
|
Zero = 0,
|
|
|
|
Red = 2,
|
2019-10-13 08:02:07 +02:00
|
|
|
Green = 3,
|
2023-07-02 02:47:54 +02:00
|
|
|
Blue = 4,
|
2019-10-13 08:02:07 +02:00
|
|
|
Alpha = 5,
|
|
|
|
OneSI = 6,
|
2023-07-02 02:47:54 +02:00
|
|
|
OneF = 7,
|
2019-10-13 08:02:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static class TextureComponentConverter
|
|
|
|
{
|
2019-12-30 00:26:37 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Converts the texture swizzle color component enum to the respective Graphics Abstraction Layer enum.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="component">Texture swizzle color component</param>
|
|
|
|
/// <returns>Converted enum</returns>
|
2019-10-13 08:02:07 +02:00
|
|
|
public static SwizzleComponent Convert(this TextureComponent component)
|
|
|
|
{
|
2023-07-02 02:47:54 +02:00
|
|
|
return component switch
|
2019-10-13 08:02:07 +02:00
|
|
|
{
|
2023-07-02 02:47:54 +02:00
|
|
|
TextureComponent.Zero => SwizzleComponent.Zero,
|
|
|
|
TextureComponent.Red => SwizzleComponent.Red,
|
|
|
|
TextureComponent.Green => SwizzleComponent.Green,
|
|
|
|
TextureComponent.Blue => SwizzleComponent.Blue,
|
|
|
|
TextureComponent.Alpha => SwizzleComponent.Alpha,
|
|
|
|
TextureComponent.OneSI or TextureComponent.OneF => SwizzleComponent.One,
|
|
|
|
_ => SwizzleComponent.Zero,
|
|
|
|
};
|
2019-10-13 08:02:07 +02:00
|
|
|
}
|
|
|
|
}
|
2023-07-02 02:47:54 +02:00
|
|
|
}
|