Add rs_allocate_closure free function.
Description
Adds a new free function rs_allocate_closure which allows the renderer services to provide memory for closure storage, for both inbuilt (add/mul) and user defined closures.
The existing osl_* closure handling functions now use this new free function.
The CPU side fallback is to call through to the existing closure pool implementation. The GPU side fallback returns null.
testshade/testrender provide an example implementation showing how to implement a stack based closure pool for the GPU.
Tests
Checklist:
- [x] I have read the contribution guidelines.
- [ ] I have updated the documentation, if applicable.
- [ ] I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
- [x] My code follows the prevailing code style of this project. If I haven't already run clang-format v17 before submitting, I definitely will look at the CI test that runs clang-format and fix anything that it highlights as being nonconforming.
The changes to the CUDA code look like a nice simplification. Perhaps it would make sense for the pool size to be a template parameter, but given that we've been hobbling along with the fixed-size allocations that's obviously not a requirement. LGTM.
What's the status here, @curtisblack ? This seems to still be broadly failing CI.
I was holding this approved PR because of the CI failures, but I just rebased it myself and sent it through CI, and it was fine, so I will merge it now.