IfAttribute

Description

sealed class Tinman.Gpu.Semantic.IfAttribute

Derived from

Attribute abstract

Indicates that the annotated method or field shall be included in the source code for compilation only if the given preprocessor symbol is defined / not defined.

Public / Constructors

If​Attribute


public constructor IfAttribute → (1)

symbol in : string

The preprocessor symbol to check, not including the GX_ prefix. Defined will be true unless the value of this parameter is prefixed with '!'. The empty string will always exclude the annotated member (inclusion is impossible), whereas the sole prefix will always include it (exclusion is impossible).

Creates a new instance of If.

The following default preprocessor symbols are defined by the Gpu-X code generator, depending on the enclosing shader:

The programming language and target identifier are encoded as the following preprocessor symbols, for example:

  • GX_HLSL_DX9 : using HLSL with Direct3D 9

  • GX_HLSL_DX11 : using HLSL with Direct3D 11

  • GX_HLSL_DX12 : using HLSL with Direct3D 12

  • GX_GLSL_GL41 : using GLSL with OpenGL 4.1 or newer

  • GX_GLSL_GLES30 : using GLSL with OpenGLES 3.0 or newer

Public / Methods

Check


[Pure]
public method Check → (1)

symbols in : IEnumerable<string>

[not-null]
The defined preprocessor symbols.

returns → bool

true if the member shall be included,
false if it shall be excluded.

Checks if the annotated member shall be included.

Public / Attributes

Defined


public readonly attribute Defined → (bool)

Include member if Symbol is defined (true) or if Symbol is not defined (false)?

Symbol


public readonly attribute Symbol → (string)

The preprocessor symbol to check.

In the source code, the 'GX_' prefix is prepended to this symbol.