Jump to content

Trouble writing recursive CVEX function


Recommended Posts

I have experience writing code in VEX and want to start writing some recursive functions. I've been searching thoroughly online, and found through this website that:

 

The functions are in-lined automatically by the compiler, so recursion will not work. To write a recursive algorithm, you should use shader calls instead.

 

 

So I have started looking into shader calls here and can see the Fibonacci sequence example. I am struggling to understand where to put this code for it to work. I've made a CVEX shader builder and put the code in here, but I get the error that "Invalid return type (cvex) for function fib."

 

Any help or insight into what I might be doing wrong would be greatly appreciated. Would it be easier/faster/less effort to just do it in HDK?

Thanks in advance :)

printFib.hipnc

Link to comment
Share on other sites

Remi, thank you for your quick reply. I'm afraid the fibonacci sequence is merely an example of what I would like to achieve through recursion as a demonstration :) any further insight you have into solving this kind of problem would be greatly appreciated. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...