CrossGL / crosstl

Translates native shader languages into CrossGL universal shader language and vice versa.
https://crossgl.net
Apache License 2.0
35 stars 39 forks source link

Support for Complex Conditional Branching #62

Open aarthiab opened 3 weeks ago

aarthiab commented 3 weeks ago

Ternary Operator Support: In addition to else if, you can add support for ternary operators (condition ? true_value : false_value) in the Metal backend. This allows for more compact and efficient conditional expressions, especially in cases where simple assignments are made based on a condition. Example: output[id] = (value > 0.5) ? value * 2.0 : value / 2.0;

Multiple Conditional Evaluations Implement support for compound Boolean expressions combining and (&&), or (||), and not (!). This would allow users to write more complex conditions in a single statement, reducing the need for deep chains of else if conditions. if (condition1 && condition2 || !condition3) { // Perform action }

Pattern Matching Introduce pattern matching in the backend, similar to what languages like Swift or Rust offer. Pattern matching allows more concise and powerful ways to deal with multiple conditions, especially when working with ranges or data patterns. match (value) { case 0...10: // Handle values between 0 and 10 break; case 11...20: // Handle values between 11 and 20 break; default: // Handle everything else break; }

samthakur587 commented 3 weeks ago

Hii @aarthiab thanks for your valuable suggestion feel free to work on this i have assigned this issue to you

can you please break down this task into small subtasks with a single backend and create a issue and start working on it.

aarthiab commented 3 weeks ago

Ok sir Regards,

Aarthi +91 9600194720

On Wed, 21 Aug, 2024, 12:58 samunder singh, @.***> wrote:

Hii @aarthiab https://github.com/aarthiab thanks for your valuable suggestion feel free to work on this i have assigned this issue to you

can you please break down this task into and small subtask with a single backend and create a issue and start working on it.

— Reply to this email directly, view it on GitHub https://github.com/CrossGL/crosstl/issues/62#issuecomment-2301333567, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFBZB2FZVW4KPEKE6KP65GTZSQ6RTAVCNFSM6AAAAABM3HZI26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRGMZTGNJWG4 . You are receiving this because you were mentioned.Message ID: @.***>

aarthiab commented 3 weeks ago

Sir, when is the deadline for this task Regards,

Aarthi +91 9600194720

On Wed, 21 Aug, 2024, 12:58 samunder singh, @.***> wrote:

Hii @aarthiab https://github.com/aarthiab thanks for your valuable suggestion feel free to work on this i have assigned this issue to you

can you please break down this task into and small subtask with a single backend and create a issue and start working on it.

— Reply to this email directly, view it on GitHub https://github.com/CrossGL/crosstl/issues/62#issuecomment-2301333567, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFBZB2FZVW4KPEKE6KP65GTZSQ6RTAVCNFSM6AAAAABM3HZI26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRGMZTGNJWG4 . You are receiving this because you were mentioned.Message ID: @.***>

samthakur587 commented 3 weeks ago

Sir, when is the deadline for this task Regards, Aarthi +91 9600194720 On Wed, 21 Aug, 2024, 12:58 samunder singh, @.> wrote: Hii @aarthiab https://github.com/aarthiab thanks for your valuable suggestion feel free to work on this i have assigned this issue to you can you please break down this task into and small subtask with a single backend and create a issue and start working on it. — Reply to this email directly, view it on GitHub <#62 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFBZB2FZVW4KPEKE6KP65GTZSQ6RTAVCNFSM6AAAAABM3HZI26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRGMZTGNJWG4 . You are receiving this because you were mentioned.Message ID: @.>

there is no specific deadline for this task you can create a small subtasks make issue and start working on it will be helpful to complete this task in small chunks not everything at once .

thanks sam

aarthiab commented 3 weeks ago

Thank you sir Regards,

Aarthi +91 9600194720

On Wed, 21 Aug, 2024, 14:05 samunder singh, @.***> wrote:

Sir, when is the deadline for this task Regards, Aarthi +91 9600194720 … <#m7254641328177093803> On Wed, 21 Aug, 2024, 12:58 samunder singh, @.> wrote: Hii @aarthiab https://github.com/aarthiab https://github.com/aarthiab https://github.com/aarthiab thanks for your valuable suggestion feel free to work on this i have assigned this issue to you can you please break down this task into and small subtask with a single backend and create a issue and start working on it. — Reply to this email directly, view it on GitHub <#62 (comment) https://github.com/CrossGL/crosstl/issues/62#issuecomment-2301333567>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFBZB2FZVW4KPEKE6KP65GTZSQ6RTAVCNFSM6AAAAABM3HZI26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRGMZTGNJWG4 https://github.com/notifications/unsubscribe-auth/BFBZB2FZVW4KPEKE6KP65GTZSQ6RTAVCNFSM6AAAAABM3HZI26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRGMZTGNJWG4 . You are receiving this because you were mentioned.Message ID: @.>

there is no specific deadline for this task you can create a small subtasks make issue and start working on it will be helpful complete this in small chunk not everything at once .

thanks sam

— Reply to this email directly, view it on GitHub https://github.com/CrossGL/crosstl/issues/62#issuecomment-2301480846, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFBZB2GZLK2NUJ6BKDNSYULZSRGOHAVCNFSM6AAAAABM3HZI26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBRGQ4DAOBUGY . You are receiving this because you were mentioned.Message ID: @.***>