shiftLeft
Provides an efficient 'bitwise left shift' function in TSL for performing high-performance integer bitwise operations on the GPU, equivalent to the `<<` operator in GLSL.
Core Advantages
Directly leverages the GPU's native bitwise operation capabilities for extremely fast execution. It is more efficient than traditional floating-point multiplication when performing 'multiply by a power of 2' operations.
Common Uses
Procedural hash functions and noise generation
Flag management and state encoding
Efficient integer multiplication (by powers of 2)
How to adjust
Adjusting input parameters 'a' (the base bit pattern) and 'b' (the shift amount) directly manipulates the integer result at the bit level, often used for algorithmic switching or generating structured patterns rather than smooth visual transitions.
Code Examples
1// Perform a bitwise left shift operation: a << b
2// 5 << 2 => 0101 << 2 => 010100 (binary) => 20 (decimal)
3const shiftNode = shiftLeft( a, b );