Skip to content
This repository was archived by the owner on Jun 6, 2021. It is now read-only.

Loops #27

Open
Vengarioth opened this issue Oct 1, 2017 · 1 comment
Open

Loops #27

Vengarioth opened this issue Oct 1, 2017 · 1 comment

Comments

@Vengarioth
Copy link
Member

Vengarioth commented Oct 1, 2017

Syntax proposal : Loops

Summary

On GPUs loops can quickly cause performance issues by branching or diverging kernels. To avoid such issues xshade limits the power of loop constructs. One of those limitations is the number of iterations needs to be known at compile time.

Examples

for i in 0..16 {
    samples[i] = sample(i);
}

References

  • to be added
@BoneCrasher
Copy link
Collaborator

Usually the number of iterations will be known in advance!
If not, a redesign of the shader was recommended, since the abort-criteria of an unbound for loop will be another condition-test in most of the cases.

I agree on your proposal, avoiding the above situation preliminarily.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants