OpenShadingLanguage icon indicating copy to clipboard operation
OpenShadingLanguage copied to clipboard

Share Shading Context when optimizing/jitting a shader…

Open AlexMWells opened this issue 8 months ago • 3 comments

… vs. grabbing an additi onal context.

Description

No need for a 2nd set of heaps/buffers when the existing context can be reused. Reduces memory footprint which increases cache efficiency, especially for threaded usage.

We can just swap the TexturePerThread info out for a null pointer and restore the previous one afterwards For completeness we also process the errors in the context.

Tests

Existing tests exercise the changes.

Checklist:

  • [x] I have read the contribution guidelines.
  • [x] I have updated the documentation, if applicable.
  • [x] 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.

AlexMWells avatar Mar 03 '25 21:03 AlexMWells