compile

actual fun compile(priority: Material.CompilerPriorityQueue, variants: Int, callback: () -> Unit?)

Asynchronously compile a subset of this Material's variants.

After issuing several compile() calls, it is recommended to call Engine.flush() so the backend can start compilation work as soon as possible. The provided callback is guaranteed to be called on the main thread after all specified variants are compiled. This can take hundreds of milliseconds.

If all variants are already compiled, the callback is scheduled as soon as possible, but this might take a few dozen milliseconds depending on backend queue depth.

If the same variant is scheduled for compilation multiple times, the first scheduling takes precedence; later scheduling is ignored.

Note: If you intend to override specialization constants on a per-MaterialInstance basis via MaterialInstance, the programs compiled here may not be reusable. Call MaterialInstance.compile() instead in those cases.

Parameters

priority

Which priority queue to use (CRITICAL, HIGH, or LOW).

variants

Variants to compile (bitmask of UserVariantFilterBit values, or UserVariantFilterBit.ALL).

callback

Optional callback invoked on main thread when compilation completes.

expect fun compile(priority: Material.CompilerPriorityQueue, variants: Int, callback: () -> Unit? = null)

Asynchronously compile a subset of this Material's variants.

After issuing several compile() calls, it is recommended to call Engine.flush() so the backend can start compilation work as soon as possible. The provided callback is guaranteed to be called on the main thread after all specified variants are compiled. This can take hundreds of milliseconds.

If all variants are already compiled, the callback is scheduled as soon as possible, but this might take a few dozen milliseconds depending on backend queue depth.

If the same variant is scheduled for compilation multiple times, the first scheduling takes precedence; later scheduling is ignored.

Note: If you intend to override specialization constants on a per-MaterialInstance basis via MaterialInstance, the programs compiled here may not be reusable. Call MaterialInstance.compile() instead in those cases.

Parameters

priority

Which priority queue to use (CRITICAL, HIGH, or LOW).

variants

Variants to compile (bitmask of UserVariantFilterBit values, or UserVariantFilterBit.ALL).

callback

Optional callback invoked on main thread when compilation completes.

actual fun compile(priority: Material.CompilerPriorityQueue, variants: Int, callback: () -> Unit?)

Asynchronously compile a subset of this Material's variants.

After issuing several compile() calls, it is recommended to call Engine.flush() so the backend can start compilation work as soon as possible. The provided callback is guaranteed to be called on the main thread after all specified variants are compiled. This can take hundreds of milliseconds.

If all variants are already compiled, the callback is scheduled as soon as possible, but this might take a few dozen milliseconds depending on backend queue depth.

If the same variant is scheduled for compilation multiple times, the first scheduling takes precedence; later scheduling is ignored.

Note: If you intend to override specialization constants on a per-MaterialInstance basis via MaterialInstance, the programs compiled here may not be reusable. Call MaterialInstance.compile() instead in those cases.

Parameters

priority

Which priority queue to use (CRITICAL, HIGH, or LOW).

variants

Variants to compile (bitmask of UserVariantFilterBit values, or UserVariantFilterBit.ALL).

callback

Optional callback invoked on main thread when compilation completes.

actual fun compile(priority: Material.CompilerPriorityQueue, variants: Int, callback: () -> Unit?)

Asynchronously compile a subset of this Material's variants.

After issuing several compile() calls, it is recommended to call Engine.flush() so the backend can start compilation work as soon as possible. The provided callback is guaranteed to be called on the main thread after all specified variants are compiled. This can take hundreds of milliseconds.

If all variants are already compiled, the callback is scheduled as soon as possible, but this might take a few dozen milliseconds depending on backend queue depth.

If the same variant is scheduled for compilation multiple times, the first scheduling takes precedence; later scheduling is ignored.

Note: If you intend to override specialization constants on a per-MaterialInstance basis via MaterialInstance, the programs compiled here may not be reusable. Call MaterialInstance.compile() instead in those cases.

Parameters

priority

Which priority queue to use (CRITICAL, HIGH, or LOW).

variants

Variants to compile (bitmask of UserVariantFilterBit values, or UserVariantFilterBit.ALL).

callback

Optional callback invoked on main thread when compilation completes.

actual fun compile(priority: Material.CompilerPriorityQueue, variants: Int, callback: () -> Unit?)

Asynchronously compile a subset of this Material's variants.

After issuing several compile() calls, it is recommended to call Engine.flush() so the backend can start compilation work as soon as possible. The provided callback is guaranteed to be called on the main thread after all specified variants are compiled. This can take hundreds of milliseconds.

If all variants are already compiled, the callback is scheduled as soon as possible, but this might take a few dozen milliseconds depending on backend queue depth.

If the same variant is scheduled for compilation multiple times, the first scheduling takes precedence; later scheduling is ignored.

Note: If you intend to override specialization constants on a per-MaterialInstance basis via MaterialInstance, the programs compiled here may not be reusable. Call MaterialInstance.compile() instead in those cases.

Parameters

priority

Which priority queue to use (CRITICAL, HIGH, or LOW).

variants

Variants to compile (bitmask of UserVariantFilterBit values, or UserVariantFilterBit.ALL).

callback

Optional callback invoked on main thread when compilation completes.