using System;
namespace ComputeSharp.D2D1.Shaders.Translation;
///
/// A container for ASCII encoded, null-terminated constant strings.
///
internal static class ASCII
{
///
/// Gets a with the "D2D_FUNCTION" ASCII text.
///
public static ReadOnlySpan D2D_FUNCTION => "D2D_FUNCTION"u8;
///
/// Gets a with the "D2D_FULL_SHADER" ASCII text.
///
public static ReadOnlySpan D2D_FULL_SHADER => "D2D_FULL_SHADER"u8;
///
/// Gets a with the '\0' ASCII character.
///
public static ReadOnlySpan NullTerminator => ""u8;
///
/// Gets a with the "D2D_ENTRY" ASCII text.
///
public static ReadOnlySpan D2D_ENTRY => "D2D_ENTRY"u8;
///
/// Gets a with the "Execute" ASCII text.
///
public static ReadOnlySpan Execute => "Execute"u8;
///
/// Gets a for a given shader profile, for a library.
///
/// The input shaader profile to use.
/// A for a given shader profile, for a library.
public static ReadOnlySpan GetLibraryProfile(D2D1ShaderProfile shaderProfile)
{
return shaderProfile switch
{
D2D1ShaderProfile.PixelShader40Level91 => "lib_4_0_level_9_1"u8,
D2D1ShaderProfile.PixelShader40Level93 => "lib_4_0_level_9_3"u8,
D2D1ShaderProfile.PixelShader40 => "lib_4_0"u8,
D2D1ShaderProfile.PixelShader41 => "lib_4_1"u8,
_ => "lib_5_0"u8
};
}
///
/// Gets a for a given shader profile, for a full shader.
///
/// The input shaader profile to use.
/// A for a given shader profile, for a full shader.
public static ReadOnlySpan GetPixelShaderProfile(D2D1ShaderProfile shaderProfile)
{
return shaderProfile switch
{
D2D1ShaderProfile.PixelShader40Level91 => "ps_4_0_level_9_1"u8,
D2D1ShaderProfile.PixelShader40Level93 => "ps_4_0_level_9_3"u8,
D2D1ShaderProfile.PixelShader40 => "ps_4_0"u8,
D2D1ShaderProfile.PixelShader41 => "ps_4_1"u8,
_ => "ps_5_0"u8
};
}
}