Xui.GPU.Shaders.Attributes

Assembly: Xui.Core · C# declarations · Assembly overview

Types

enum BuiltIn

Built-in shader semantics.

public enum BuiltIn
{
    Position,
    FragDepth,
    InstanceId,
    VertexId,
}

BuiltIn.FragDepth

FragDepth

Fragment depth value.

BuiltIn.InstanceId

InstanceId

Vertex instance ID.

BuiltIn.Position

Position

Vertex position in clip space.

BuiltIn.VertexId

VertexId

Vertex ID.

class BuiltInAttribute

Specifies that a field represents a built-in shader semantic.

[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class BuiltInAttribute : Attribute
{
    public BuiltIn Semantic { get; }

    public BuiltInAttribute(BuiltIn semantic);
}

BuiltInAttribute.BuiltInAttribute(BuiltIn semantic)

public BuiltInAttribute(BuiltIn semantic);

Initializes a new instance of the Xui.GPU.Shaders.Attributes.BuiltInAttribute class.

  • semantic — The built-in semantic.

BuiltIn BuiltInAttribute.Semantic

public BuiltIn Semantic { get; }

Gets the built-in semantic.

class FragmentShaderAttribute

Marks a type as a fragment shader stage.

[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
public sealed class FragmentShaderAttribute : Attribute
{
}

class InterpolationAttribute

Attribute to control how a varying (vertex shader output / fragment shader input) is interpolated.

This attribute maps to HLSL interpolation modifiers (linear, noperspective, nointerpolation), Metal's [[flat]], [[center_perspective]], etc., and Vulkan's interpolation decorations.

[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class InterpolationAttribute : Attribute
{
    public InterpolationMode Mode { get; }

    public InterpolationAttribute(InterpolationMode mode);
}

InterpolationAttribute.InterpolationAttribute(InterpolationMode mode)

public InterpolationAttribute(InterpolationMode mode);

Initializes a new instance of the Xui.GPU.Shaders.Attributes.InterpolationAttribute class.

  • mode — The interpolation mode to use for this varying.

InterpolationMode InterpolationAttribute.Mode

public InterpolationMode Mode { get; }

Gets the interpolation mode.

enum InterpolationMode

Specifies the interpolation mode for a shader varying (vertex output / fragment input).

public enum InterpolationMode
{
    Perspective,
    Linear,
    Flat
}

InterpolationMode.Flat

Flat

No interpolation - flat shading. The value from the provoking vertex is used for the entire primitive.

InterpolationMode.Linear

Linear

Linear interpolation without perspective correction. Values are interpolated linearly in screen space.

InterpolationMode.Perspective

Perspective

Default perspective-correct interpolation. Values are interpolated with perspective correction across the triangle.

class LocationAttribute

Specifies the location index for a vertex input or fragment output field.

[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class LocationAttribute : Attribute
{
    public int Index { get; }

    public LocationAttribute(int index);
}

LocationAttribute.LocationAttribute(int index)

public LocationAttribute(int index);

Initializes a new instance of the Xui.GPU.Shaders.Attributes.LocationAttribute class.

  • index — The location index.

int LocationAttribute.Index

public int Index { get; }

Gets the location index.

class ShaderProgramAttribute

Marks a type as a shader program definition. Used by source generators to discover and process shader programs.

[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
public sealed class ShaderProgramAttribute : Attribute
{
}

class VertexShaderAttribute

Marks a type as a vertex shader stage.

[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
public sealed class VertexShaderAttribute : Attribute
{
}