mirror of
https://github.com/RPCS3/glslang.git
synced 2025-02-12 22:38:35 +00:00
![steve-lunarg](/assets/img/avatar_default.png)
HLSL can index arrays using operator[] with non-integer types, and inserts a conversion to a uint if needed.
10 lines
269 B
JavaScript
10 lines
269 B
JavaScript
static const float array[3] = { 1, 2, 3 };
|
|
|
|
float main(float input : IN) : SV_Target0
|
|
{
|
|
// non-integer indexes get converted to uints:
|
|
// uint(input) 3.0 2.0 1.0
|
|
return array[input] + array[2.0] + array[true] + array[false];
|
|
}
|
|
|