• Defines the samples of textures per-pass, as GLSL preprocessor macros.

    The macros define the minimal sampling of textures for the data the active pass's values derive from; creates a data list containing the samples; the samples list variable names are required as created by macroSamples.

    Handles sampling states in a flat array of textures, or merged in one texture (in both sampler2D, and sampler3D/sampler2DArray where supported). Merging allows shaders to access past steps by non-constant lookups; e.g: attributes cause sampler array index must be a literal expression on GLSL3 spec and other platforms (e.g: D3D); note these need texture repeat wrapping.

    They're set up as function-like macros that may be called from the shader to initialise the mappings arrays with a given name. Caches the result if macros generation is enabled, to help reuse shaders.

    Parameters

    • state: any

      Properties used to generate the macros. See toData.

    • Optionalon: string

      Any further macro hooks specifier; if given, both the hook key and this specifier are checked (e.g: key and key_on).

    Returns string

    The GLSL preprocessor macros defining the minimal sampling of textures, to suit how states are stored (array of textures, or all merged into one texture) and supported GLSL language features.