Jump to content

"cleanup" In Custom Vex Func


Recommended Posts

I've written my first custom vex function using the HDK. Seems to be working fine, but the "cleanup" function doesn't seem to get called. I put a cerr<< statement in the init and cleanup func to test if they were called. the Init is called right away and the cleanup doesn't seem to be called (using the vex func in a surface shader for testing).

Any ideas? I followed the example pretty much exactly. anyone get the cleanup to work properly?

thnx

daniel

Link to comment
Share on other sites

Hey Daniel,

I've asked about the Cleanup function wrt to Mantra, and the answer I have got before is that SESI allows the OS to perform the cleanup in Mantra - because apparently it does it very fast. Unfortunately this can be rather awkward for custom VEX ops that might want to call it but you can force a clean to be called by inserting a command into the IFD after the ray_raytrace command to force a reset:

ray_raytrace
ray_reset -l -a
ray_quit

(I hope I got the ray_reset arguments correct, this is all from memory...)

Link to comment
Share on other sites

Hey Daniel,

I've asked about the Cleanup function wrt to Mantra, and the answer I have got before is that SESI allows the OS to perform the cleanup in Mantra - because apparently it does it very fast. Unfortunately this can be rather awkward for custom VEX ops that might want to call it but you can force a clean to be called by inserting a command into the IFD after the ray_raytrace command to force a reset:

ray_raytrace
ray_reset -l -a
ray_quit

(I hope I got the ray_reset arguments correct, this is all from memory...)

18763[/snapback]

Hmm.. thanks for the response. I'll dig a bit further. I've built a vex function that uses the new sdf class.. I build the sdf and cache it in memory on the first lookup since build time is slow and geometry doesn't change during a rendered frame.. so looking up at each shading sample is quite fast once it's built and cached. This works fine in the shader context since in effect a cleanup happens when mantra finishes. My func is also accessable in the geometry context.. My sdf is cached on the first call, but there is no clear "end" of cook that I can find.. so I don't get a signal to free the cache. I assumed the cleanup would do this, but as I said it's not being called.

I'm sure I can find some other ways to trigger a cache cleanup.. I'll keep looking around and send a question to SESI

thnx

d

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...