OpenShadingLanguage
OpenShadingLanguage copied to clipboard
Free functions for texturing, point clouds, and trace
Description
Provides free function API for: texture, texture3d, environment, get_texture_info, pointcloud_search, pointcloud_get, pointcloud_write, and trace.
The fallback for each of these is to call the existing renderer services functions.
To achieve this, the helper structs TextureOpt, TraceOpt, NoiseOpt are removed from the host-only shading context, and are instead added into the LLVM generated code as stack allocations. These allocations only occur if the shader uses these features.
To allow these free functions to compile on GPUs, the texture per-thread context pointer is currently passed null. Future work will be needed to give this a proper home.
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.