AcademySoftwareFoundation / OpenShadingLanguage

Advanced shading language for production GI renderers
BSD 3-Clause "New" or "Revised" License
2.05k stars 348 forks source link

RS::get_texture_info make robust to empty shaderglobals param #1731

Closed lgritz closed 10 months ago

lgritz commented 10 months ago

The unconditional dereferencing of the sg pointer is only necessary if texture_thread_info is not supplied. And for that matter, the texture_thread_info is only necessary if the texture_handle is not supplied.

So rearranging the nesting skips a bunch of the work, and the need for the caller to supply the sg if they have the texture_thread_info, nor for them to need texture_thread_info if they already have the handle.