microsoft / hlsl-specs

HLSL Specifications
MIT License
116 stars 29 forks source link

[Feature Request] Ability to use Ternary Operator to select structs #273

Open devshgraphicsprogramming opened 1 month ago

devshgraphicsprogramming commented 1 month ago

Is your feature request related to a problem? Please describe. Trying to compile the following code: https://godbolt.org/z/9cx4aMca1

Which "just works" in C++ https://godbolt.org/z/7adWze3dn

Describe the solution you'd like Just being able to ? between two variables of the same type.

Describe alternatives you've considered Right now I have to pack unpack structs when I want to do that, but its cumbersome.

Additional context Conditional swaps for FFTs and Bitonic Merge sorts are hard to make without this.

damyanp commented 1 month ago

This is something we should look into enabling, but it does require a language change so we need to think more carefully about how to approach this.