Anotaciones de tipos actuales#
Las siguientes declaraciones utilizan los atributos actuales de autoría para vectores y matrices. Los metadatos de vectores se procesan actualmente. Los atributos de matrices existen, pero su presencia no implica que las operaciones matriciales y su conversión al backend estén implementadas.
using YotsubaShader.Language.Native.Types.Matrix;
using YotsubaShader.Language.Native.Types.Vector;
// Los tipos propios de tu proyecto, asociados a tipos nativos de la GPU con atributos.
// Los mismos structs pueden usarlos tu código de CPU y tus shaders.
[Vector]
public struct Vector2
{
[VectorComponent(0)] public float X;
[VectorComponent(1)] public float Y;
public Vector2(float x, float y) { X = x; Y = y; }
}
[Vector]
public struct Vector3
{
[VectorComponent(0)] public float X;
[VectorComponent(1)] public float Y;
[VectorComponent(2)] public float Z;
public Vector3(float x, float y, float z) { X = x; Y = y; Z = z; }
}
[Vector]
public struct Vector4
{
[VectorComponent(0)] public float X;
[VectorComponent(1)] public float Y;
[VectorComponent(2)] public float Z;
[VectorComponent(3)] public float W;
public Vector4(float x, float y, float z, float w) { X = x; Y = y; Z = z; W = w; }
}
[Vector]
public struct UInt3
{
[VectorComponent(0)] public uint X;
[VectorComponent(1)] public uint Y;
[VectorComponent(2)] public uint Z;
}
[Matrix]
public struct Matrix4
{
[MatrixColumn(0)] public Vector4 Column0;
[MatrixColumn(1)] public Vector4 Column1;
[MatrixColumn(2)] public Vector4 Column2;
[MatrixColumn(3)] public Vector4 Column3;
}
Texturas y samplers#
Los atributos de texturas están en YotsubaShader.Language.Native.Types.Texture; el atributo de sampler está en YotsubaShader.Language.Native.Types. Estas declaraciones describen tipos, no métodos de muestreo ni la creación de recursos GPU.
using YotsubaShader.Language.Native.Types;
using YotsubaShader.Language.Native.Types.Texture;
[Texture(TextureDimension.D2, TextureComponentTypes.Float)]
public struct Texture2D { }
[Sampler]
public struct SamplerState { }
La integración con un motor todavía necesita reglas explícitas de layout CPU/GPU, reflexión de bindings, compilación de shaders y carga en ejecución. En este checkout no hay un adaptador oficial para MonoGame, Godot o Unity.
