Page MenuHome

Fix: OSL warnings during build
ClosedPublic

Authored by Ray molenkamp (LazyDodo) on Feb 11 2020, 4:35 PM.

Details

Summary

Ever since the OSL version bump it has been emitting an number of warnings
about things being redefined during build.

The origin of this is we copied the OSL headers stdosl.h, oslutil.h,
vector2.h and vector4.h from the OSL codebase into our tree rather
than using the ones OSL shipped. oslc by default reads the stdosl.h
from the shaders folder even if you don't include it. And the #include
in our shaders read our file, so that was bound to make trouble.

Now to make things worse, we added the cycles specific closures to
stdosl.h so keeping up with upstream is now 'difficult'

This patch changes:

  • Introduce a new header called stdcycles.h that has the cycles specific modifications we previously did to stdosl.h
  • Removal of any OSL headers from our code tree
  • Find the upstream headers and copy those to the output folder during the install phase.

Not entirely sure about the copyright header in stdcycles.h but since it is technically a derivative of stdosl.h I left the original header in place.

Diff Detail

Repository
rB Blender

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.Feb 11 2020, 4:51 PM

This breaks compatibility for user OSL scripts that use our closures.

I think what you could do is, change OSLShaderManager::osl_compile to use stdcycles.h instead of stdosl.h. And then include stdosl.h from stdcycles.h?

This revision now requires changes to proceed.Feb 11 2020, 4:51 PM
  • fix compatibility with existing shaders

heh that actually worked nicely, thanks for the tip!

This revision is now accepted and ready to land.Feb 11 2020, 5:23 PM