Compare commits

...
798 Commits
Author SHA1 Message Date
Larry Gritz ab7b8cea3c build: check for the bad combo of Cuda >= 13.2 but LLVM < 22.1.2 (#2133)
Fixes #2129

CUDA 13.2+ requires LLVM 22.1.2+ for the _NV_RSQRT_SPECIFIER fix.

Assisted-by: Claude Code / sonnet-4.6

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-07-10 15:02:02 -07:00
Silvia Lopez e5552e0097 osltoy: improved readability of cursor highlighted line (#2067)
* osltoy code editor: make cursor highlighted line text always black for readability in dark mode

Signed-off-by: silvialpz <74107990+silvialpz@users.noreply.github.com>
2026-07-10 15:01:20 -07:00
Larry Gritz ac508f91b7 admin: Clarify securty policy on what is not a vulnerability (#2128)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-06-19 08:47:08 -07:00
Larry Gritz 0428618794 testing: Cut render-* test resolution in half to speed up testing (#2131)
The time it takes to run a full testsuite was slowly creeping up to an
inconvenient time on CI. The most expensive test are the `render-*`
tests. Cut all of their resolutions in half to speed up CI runs.

Update a lot of reference images.

But after updating the ref images we need to fully pass CI (and pass
on my work machine and my personal laptop), I could see that there
were a number of `testsuite/render-*/ref/*.exr` files that did NOT
get updated in this process -- we must conclude that they are old
references that are no longer needed, so I deleted them.

I also noticed that testsuite/render-material-layer had no ref images
updated, and some git investigation reveals that this test that was
added in 2017 was NEVER in testing.cmake and thus never ran in CI
at all. So just remove it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-06-19 08:46:27 -07:00
Larry Gritz 45ae428d47 testing: Reduce output precision of geomath and trig, collapse variants (#2126)
Analyzing the geomath and trig testsuite entires, each of them had
multiple reference outputs due to small precision differences between
platforms and optimization levels. By printing only 4 digits of
precision (and in one case of an unstable value to pass to tan, just
picking a different value), we are able to collapse those tests to one
reference output each.

only flushes near-zero values, not precision. With the reduced precision every
platform/backend produces identical text, so the four variant references are
removed and a single ref/out.txt remains. The JIT and C++
(OSL_DEBUG_OUTPUT_CPP=3) backends now produce byte-identical output and both
pass against it.

Assisted-by: Claude Code / Claude Opus 4.8

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-06-16 19:33:30 -07:00
Larry Gritz 10d121cc90 deps: Bump minimum OpenImageIO to 3.0, adjust some CI configs (#2123)
In main only, i.e. for OSL 1.16 release late in 2026, raise the
minimum OpenImageIO supported to 3.0.

That means that the mostly-2027 version of OSL will support building
against OIIO 3.2 (2027), 3.1 (2026), or 3.0 (2025), which I think is
enough range.

In the process, I shuffled some CI variants around. Removed a couple
variants that used OIIO 2.5, and bumped the job we use for testing a
debug build from being based on 2023 containers to 2026, and the job
we use for checking ABI to 2025.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-06-16 13:51:43 -07:00
Larry Gritz 3c9af6495c refactor: Reduce redundancy of argument code logic (#2125)
Some of the translation of type codes to the abbreviations we use
internally for argument type signatures and internal function naming,
like 'f' for float, 'c' for color, etc., were repeated in various
place. This tries to remove some of the duplication.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-06-16 13:50:32 -07:00
Larry Gritz b7fff57a2a admin: Fix some minor discrepancies in project admin docs (#2127)
- According to ASWF, the technical charter should not be stored in
  our repo, but just linked to its canonical ASWF home.
- Security addres in CONTRIBUTING had a bad copy/paste error and
  incorrectly had the address for the openimageio security reporting.
- GOVERNANCE did not have the link to the meeting notes.
- README had a bad link, and did not link to the calendar. Spruced
  up some related info and the section title.
- Typo fixes

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-06-15 10:56:27 -07:00
Sergey Sharybin 1a72c471fe build: Fix compilation and runtime errors with LLVM 22 (#2124)
This commit fixes compilation and runtime errors of the OSL against
specific builds of LLVM 22.

When LLVM is compiled with LLVM_LINK_LLVM_DYLIB=OFF (default value) an
extra set of libraries needs to be used for Clang:

- The clangOptions library is needed because getDriverOptTable() used
  from clangFrontend was moved from clangDriver to clangOptions.

- Similarly, printStats() used from clangSema has been moved to
  clangAnalysisLifetimeSafety.

This linking error could be reproduced when LLVM is compiled with the
following options:

```
cmake \
  -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_INCLUDE_TESTS=OFF \
  -DLLVM_INCLUDE_EXAMPLES=OFF \
  -DLLVM_BUILD_LLVM_C_DYLIB=OFF \
  -DLLVM_ENABLE_UNWIND_TABLES=OFF \
  -DLLVM_ENABLE_ZSTD=OFF \
  -DLLVM_ENABLE_ZLIB=OFF \
  -DLLVM_ENABLE_PROJECTS=clang \
  -DCMAKE_INSTALL_PREFIX=/opt/local/llvm/22.1.7 \
  ../llvm
```

A couple of notes:

- The linking issue can not be reproduced when using Homebrew's
  LLVM 22 because it uses LLVM_LINK_LLVM_DYLIB=ON. This seems to be
  leading to a situation when the linker issue is side-steps because
  of the symbols that are pulled by the dynamic LLVM library.

- Passing LLVM_STATIC does not help with this case, since this flag
  only affects the way LLVM libraries are handled and does not change
  the way Clang libraries are handled:
  `llvm-config --libfiles --link-static` does not print any
  Clang-related libraries.

Since LLVM version 22 the VFS is to be explicitly created for the
CompilerInstance. Prior to version 22 this was done implicitly by the
LLVM when calling createFileManager(), but now this is no longer the
case, and LLVM has an assertion for it. The createVirtualFileSystem()
with default arguments solves this problem, and initializes
CompilerInstance's VFS the same way how it was done implicitly in the
older versions of LLVM. Without this, compilation of OSO triggers an
assert() in LLVM:

```
Assertion failed: (VFS && "CompilerInstance needs a VFS for creating FileManager"), function
createFileManager, file CompilerInstance.cpp, line 387.
```

It is unclear whether this was causing any actual issue with release
builds of LLVM, but it is better to use the API in the way it is
expected to be used and create the VFS.

Last but not least, this change also fixes the following assert on the
LLVM side when running OSL's test suite on macOS:

```
Assertion failed: ((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && "Invalid size"), function emitIntValue, file MCStreamer.cpp, line 135.
```

The value that trips on this assert statement comes from the
DW_AT_APPLE_major_runtime_vers that the code in DwarfDebug.cpp, and it
comes from the RuntimeVersion (RV) argument of the createCompileUnit().
This runtime value is supposed to indicate Obj-C runtime version which
is either 1 or 2 (value 2 is for Objective-C 2.0). Passing OSL version
as the runtime version does not fit single byte, and that is why the
assertion trips. This change follows Clang's code which sets the
runtime version to 0 for non-Objective-C languages. It is unclear what
side-effects this change could bring, but it is also a bit strange to
use OSL version for things that distinguish system runtime.

In order to be able to run OSL regression tests with LLVM compiled in
debug mode, LLVM_LINK_LLVM_DYLIB=ON had to be used. Without this, the
following assert in the LLVM triggers upon testrender startup:

```
: CommandLine Error: Option 'openmp-ir-builder-optimistic-attributes' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
```

This is to do with the way how LLVM registers command line arguments.
It uses static variable initialization for this, and having LLVM as a
static library that is pulled via CLang into both oslcomp and oslexec
that are then pulled into testrender causes this situation to happen.
For some reason, it does not happen if LLVM is compiled as static but
release library.

The need of debug versions of OSL and LLVM libraries comes from the
need to compile Blender on Windows in Debug mode, and libraries need
to be compiled with a different CRT ABI.

Tested with the ctest with both LLVM 20 and 22 compiled in release.
With all these changes the test suite passes to the same degree for
LLVM 20 and 22, both Debug and Release. The only failing tests are
related to Python module, and those I did not yet manage to get passing
on a local development machine.

Signed-off-by: Sergey Sharybin <sergey@blender.org>
2026-06-05 10:18:14 -07:00
Larry Gritz 0abda7e635 admin: Add AI coding assistant configuration (#2122)
Adds agent configuration supporting Claude Code, Cursor, GitHub
Copilot, OpenAI Codex, and Opencode. A single AGENTS.md and contents
of .agents subdirectory serve as the canonical source for
instructions, skills, and other things that can be used across
multiple tools.

A script can be invoked by users to do the local setup of links or
references to allow them to use a particular tool:
`.agents/setup-agent TOOL` Currently supported tools by this script
include Claude Code, Codex, Cursor, GitHub Copilot, and OpenCode.

This initial commit includes two skills that I wrote and have used for
the last couple monthly releases: release-notes-update and
prepare-patch-release. I assume that we will add more over time as we
discover tasks that we want to make standard skill automation for.

Assisted-by: Claude Code / claude-sonnet-4-6

The AGENTS.md, Claude skills, and general scheme are entirely from me.
I used Claude to help me establish the setup script for the other
tools I don't happen to use.

This basic structure was first prototyped on OIIO and then copied to
OSL.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-05-29 15:18:05 -07:00
Chris Hellmuth 1f8d3948f1 fix: error when an interactive param is also connected (#2121)
When a parameter is interactive and connected, the connection should
win. OSL was incorrectly treating the interactive trait as taking
precedence, attempting to write into the read-only interactive buffer
during shader execution.

Fixed both single point and batch modes.

---------

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2026-05-28 17:57:53 -07:00
Larry Gritz 6f7b968690 feat: Report per-ShaderGroup complexity statistics leaderboard (#2120)
Store the new compile-time complexity metrics that were added by PR
#2085 (but only printed the the log as each group compiles) as fields
on ShaderGroup so they survive after optimization.

Expose them via getattribute(group, "stat:compiled_active_layers")
etc., and extend getstats() to emit a "Shader compilation stats,
post-optimized" section listing min/max/median and a leaderboard with
a ranked top-N list for each metric (controlled by the existing
"stat:rank_groups" option).

Tests: testsuite/compstats/ test covering both the getstats output and
the getattribute keys. Added a testshade --print-group-stats flag for
querying per-group stat keys.

Assisted-by: Claude Code / claude-sonnet-4-6

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-05-26 11:09:55 -07:00
Larry Gritz 6f7e47f872 testing: reduce sampling on volume tests to make them faster (#2119)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-05-21 16:55:00 -07:00
Larry Gritz bdab36793d ci: Lock down 2023 container to prevent build breaks for OCIO (#2117)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-05-20 13:38:23 -07:00
Larry Gritz 0c0f22893c ci: Remove deprecated windows-2025 runner (#2114)
We test on 3 Windows runner configurations currently -- Windows 2022
with VS2022, Windows 2025 with VS2022, and Windows 2025 with
VS2026. GitHub says the middle one will go away imminently (actually,
it won't "break", but it will redirect to Windows 2025 with VS2026,
which we already test). So take it out of our lineup, it's just waste.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-05-14 13:34:04 -07:00
Owen O'Malley 179771698a feat: Add testrender volumes (#2053)
Alongside the rest of the initialization for subpixel_radiance, an empty MediumStack is initialized. It stores the medium params with pointers in two arrays. One tracks the entry order and the other sorted based on priority. There is a priority handling scheme that will shuffle the incumbent medium pointers to give high priority (lower integer priorities) mediums lower indices. When processing BSDF closures, intersections with MxDielectric or MxGeneralizedSchlick may only be added when priority < current_priority or are both 0 (the precious priority). MediumStack exposes an integrate method that operates on aggregated parameters from all media sharing the same priority as the topmost medium; these aggregated parameters are stored on the stack and updated whenever media are added. A CDF built from these parameters is then sampled to select one of the overlapping media for scattering. At present, only Henyey–Greenstein phase functions are supported, implemented as a BSDF subclass and wraps the implementation in BSDL.

Signed-off-by: Owen O'Malley <theowen@email.com>
2026-05-12 12:40:01 -07:00
Larry Gritz b6f08c8fd6 admin: Update security instructions to emphasize reporting via GitHub (#2112)
docs: Update security instructions to emphasize reporting via GitHub

The security@openshadinglanguage.org is still fine, but we prefer that
true vulnerability reports come via the GitHub security advisory
mechanism.  (That makes it easy for us to turn them into CVEs when
needed, among other administrative niceties.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-05-05 14:47:53 -07:00
Sergey Sharybin c3be3c6c4e fix: crash in exception handling after OSL JIT (#2113)
This change fixes crashes that could be observed on Ubuntu 24.04.
The crash happens in exception handling after rendering a scene
with OSL shaders.

This seems to be a bug in libgcc which was fixed in 14.3, but
Ubuntu 24.04 is shipped with 14.2. There is a report in the GCC
bug tracker:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119151

Note that this is a runtime dependency, so it doesn't really matter
that a different GCC version was using during compilation as the
EH frames registration happens at runtime.

The easiest solution is to simply disable EH frames registration
in OSL's MemoryManager. This should not affect any runtime exception
unwinding as this MemoryManager is only used during JIT, so all the
EH frames are unregistered from the process when the JIT code is
actually executed.

The issue was originally noticed in Blender, here is the report with
some extra investigation and details:

  https://projects.blender.org/blender/blender/issues/156348

Signed-off-by: Sergey Sharybin <sergey@blender.org>
2026-04-23 16:13:48 -07:00
Larry Gritz 2e38787c27 ci: port OIIO improvements - shared steps, upgrade to new actions (#2107)
OpenImageIO and OSL have similar CI infrastructure, mostly share a
design of such, and copy the files back and forth to synchronize from
time to time. Turns out it's been a while since the last sync, and a
lot of small improvements have accumulated on the OIIO side.

* Bump our CI workflow externally-hosted actions to the latest versions.
* Use shared-steps workflow for the old aswf container jobs.
* Split some of the steps of the shared-steps workflow into "old" and
  "new" in cases where the 2022 ASWF docker containers containers cannot
  run the latest actions, only update those to the most recent that are
  able for those containers.
* Restore bleeding edge test to pybind11 master -- the reason we locked
  it down has since been fixed on the OIIO side.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-11 10:49:57 -07:00
Larry Gritz 9fe3a0b256 build: port many recent build improvements from OpenImageIO (#2106)
Periodic re-synchronization of build system components between the two
projects.

dependency_utils.cmake:

* Make dependency report more clear to read.

* Infastructure related to auto-build of missing dependencies, which
  we don't yet do in the OSL side, but will eventually institute that
  like we did on the OIIO side.

compiler.cmake:

* Warnings about clang versions so old that we no longer test them.
* Imroved ccache finding logic.
* Fix TIME_COMMANDS.
* Turn on CMAKE_EXPORT_COMPIE_COMMANDS to make a compile_commands.json.
* Various other insubstantial changes just to keep the two projects in
  sync to make future diffs easier to understand.

gh-win-installdeps.bash:

* Accommodate newer python releases on Windows.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-11 10:49:38 -07:00
Larry Gritz 9d9ccd09dc int: minor simplification of some formatting (#2110)
It's ok to directly pass ustring or ustringhash to fmt formatting,
don't need to take c_str().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-11 10:48:58 -07:00
Larry Gritz 37bf53b756 admin: Rename the repo's top level doc/ subdir to docs/ (#2105)
Mostly for conformance with OpenImageIO, since we share so many
scripts and management docmentation. But looking across ASWF project,
they almost all use "docs/" (OSL and OpenVDB were the only outliers).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-09 14:49:34 -07:00
Larry Gritz d9dfaa2ee2 ci: fix windows 2025 w/ msvs2022 -- used wrong runner name (#2108)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-04 18:37:59 -07:00
Larry Gritz 3d22bcc582 docs: correctly refer to the readthedocs page for current docs (#2104)
I found some places that still referred to the old PDF document in the
repo, but we haven't used that for a while and no longer build it.

Also remove some chunks of the Makefile that used to be responsible
for building the LaTeX docs, since those don't even exist in the repo
any more.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-04 13:53:47 -07:00
Larry Gritz 6f2dfd1710 ci: optimize openexr build time, don't run nightly on forks (#2097)
* When building openexr as a dependency for OSL, there is no need
  to build the openexr command line utilities, saving a bit of build
  time.

* Fix an error from PR #2074 where we tried to disable nightly CI runs
  on forks -- we didn't make the right change to the Windows jobs, so
  they were still running.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-04 13:51:57 -07:00
Larry Gritz 11e8baa294 ci: fix breakage because fmtlib changed 'master' to 'main' (#2103)
fmtlib renamed its "master" branch to "main" yesterday. So our "bleeding edge" test that requests fmt "master" now fails.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-03 18:22:56 -07:00
Larry Gritz 84b696da7c docs: AI contribution policy and other docs touch-ups (#2099)
We've discussed AI code assistant policy in multiple TSC meetings,
and on the OpenImageIO slack (technically it was a shared OIIO+OSL
discussion, but we had to pick a single place to have it). We iterated
on the policy document as an OIIO PR, so this PR here in OSL land is
just checking that same document into our repo.

* Duplicate the OIIO document. We will keep them in sync until such
  time as the needs of the projects diverge or their communities have
  different ideas about what policies to articulate.
* Appropriate references/pointers in supporting documents: README,
  CONTRIBUTING, and PULL_REQUEST_TEMPLAGE.

I took the time to diff some of those documents and port other recent
changes from the OIIO side to OSL. These are mostly minor fixes or
improvements in wording, nothing substantive.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-03 10:50:49 -07:00
Larry Gritz f2cd0ff4a8 Update CHANGES and other minor docs fixes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-02 17:24:14 -07:00
Larry Gritz 9a1a8e2e9a ci: Repair broken CI from OIIO locking down dependency hashes (#2102)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-01 22:41:28 -07:00
Larry Gritz 0a8278d509 ci: Update certificates to be able to install Intel compilers (#2101)
Spontaneously broke several days ago.

This fix is identical to one we did for OIIO.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-04-01 21:22:41 -07:00
Larry Gritz 481852f8a9 ci: Add Windows 2025 w/ MSVS 2026 job variant to CI (#2093)
ci: Add Windows 2025 w/ MSVS 2026

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-21 11:37:16 -07:00
Larry Gritz f9121bb666 ci: Some minor llvm dependency improvements (#2090)
While debugging some CI failures on Windows, I went down some wrong
roads that turned out not to be related to the actual problem...  but
nevertheless are improvements I wish to keep. Here they are:

* Attempt to use the install-llvm-action from Windows wasn't able to
  work (among other reasons) because we weren't passing along the
  llvm_action_ver variable.

* For reasons I never quite understood, the llvm install action works
  a lot better on Windows if done before the "build setup" step. So
  I just moved that action earlier in the sequence.

* Some status messages about how we are installing LLVM.

* A correction in how we detect and print the pkg_ROOT environment
  variable in the log generated by handle_package_notfound.

* Allow LLVM_PATH (set by that action) to be a proper hint for
  FindLLVM.cmake.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-20 14:09:38 -07:00
Larry Gritz 1627fe394e ci: For security, replace some workflow substitutions with safer env substitutions (#2088)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-20 14:08:43 -07:00
Larry Gritz 70f542fc19 ci: fix using fmt master with OIIO main build (#2095)
A recent change in OIIO main is to check that any auto-built
dependencies have a SHA-1 hash that matches what we think it should be
for that version. That works fine for a fixed version, but if we are
asking for OIIO to build from dependency master/main, as we do from
its "bleeding edge" CI variant, we need to tell it that it's ok to not
match the expected hash by setting
OpenImageIO_DEPENDENCY_BUILD_ALLOW_UNVERIFIED_TAGS=ON.  So we need to
do this in the OSL bleeding edge variant, too.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-19 22:33:08 -07:00
Larry Gritz 259ba8c143 ci: fix broken Mac CI with full path to compiler (#2096)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-19 21:10:25 -07:00
Sv. Lockal d282e12a7c build: Fix compilation with ld.lld (#2094)
When using Clang 18<->22 with ld.lld, build fails with:
```
clang++ -Wl,--version-script=.../hidesymbols.map -o lib/liboslcomp.so.1.13.7 ...
ld.lld: error: version script assignment of 'global' to symbol 'test_shade' failed: symbol not defined
```

The issue is that test_shade does not belong to liboslcomp, instead it belongs to libtestshade,
and ld.lld actually checks that and fails. The minimal fix is to remove test_shade from hidesymbols.map,
the slightly better way is to create a separate symbols map for libtestshade.

See also: https://bugs.gentoo.org/929091

Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
2026-03-19 13:14:14 -07:00
Alejandro Conty a2a7fb49ed Incorporate diffuse MaterialX BSDFs to BSDL (#2092)
* Implement get_albedo() for BSDL imported BSDFs

We forgot to forward the albedo function to BSDL and also to
implement it for the latest MaterialX components added to BSDL
recently. This led to not very good sampling quality.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>

* Incorporate diffuse MaterialX BSDFs to BSDL

This is just a code movement. The implementation was already there. Just
relocated to the BSDL framework the following items:
- burley_diffuse_bsdf
- oren_nayar_diffuse_bsdf
- translucent_bsdf

There are sampling noise differences that require updating the tests,
but otherwise images look identical.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>

* Update testsuite refs and thresholds

Due to the last two commits (BSDL albedo fix and diffuse MTX code
movement) some references had to be updated due to noise differences.
I'm also following the policy of keeping as few refs as possible and
opening the thresholds so different platforms LSB differences are
accepted.

---------

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2026-03-18 09:58:36 -07:00
Larry Gritz 3dd1d94fe0 ci: Fix and speed up Mac CI dependency installations via homebrew (#2091)
* Refactor install_homebrew_deps to match recent changes in the
  version that's part of OIIO.

* Exclude building Qt and OpenVDB from the Intel Mac CI variant --
  they seem to be hit or miss these days whether it is pre-built, and
  if not, makes our CI on that variant take forever. We don't need it,
  we test those packages on other platforms, including newer Macs.

* Bump llvm to 18 for the troublesome Intel case.

* Need to make sure OSL sets the OpenImageIO_CI variable also, so that
  OIIO, when building, knows it's a CI run.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-06 12:06:32 -08:00
Larry Gritz 603b03b978 testing: Check in ref images for Mac ARM debug case (#2083)
We don't test this in CI so it's probably gone undetected for a while,
but there are a few tests that differ slightly for the combination of
ARM-based Mac for debug builds. So check in a few more ref images so
that devs using that platform don't get spurious testsuite failures
for debug builds.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-05 16:22:54 -08:00
Larry Gritz 14840fd6e5 ci: fix Windows curl llvm download failure (#2089)
For a few days now, the Windows CI variants have been almost always
failing due to unexplained inability to curl download the pre-built
LLVM that we stashed on a Google drive, which has worked flawlessly
for over a year.

J.F. Panisset suggested:

> Could be a wild goose chase, but a direction to look in with your
> Windows / curl issue would be SSL certificate verification. Windows
> uses some kind of magic process to update its store of recognized CA
> root certs, but since a Windows runner is a "fresh" Windows VM every
> time, it could be that it is missing an updated cert required to
> verify the https URL you are downloading from (assuming that's using
> a cert anchored to a root CA not in that base WIndows image). I've
> seen issues like that on Windows systems with limited Internet
> access. If you try curl --insecure to (temporarily) bypass
> certificate verification, are you able to download what you need?

And sure enough, adding --insecure clears it right up.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-05 16:22:31 -08:00
Alejandro Conty 3985c0fa62 Move MaterialX sheen BSDF into BSDL (#2084)
Consolidate sheen implementation from testrender and SPI into a single
BSDL-backed MaterialX lobe (`mtx::SheenLobe`), so sheen behavior is defined
in one place and reused consistently across paths.

- Move sheen logic into BSDL/MTX and wire it through the BSDL closure path
- Replace ad-hoc testrender-side handling with the new BSDL implementation
- Keep Conty/Zeltner mode selection inside the unified sheen lobe
- Update sheen tests and references to validate the new path
- Turn the furnace sheen test into a true energy-conservation check
  (sheen layered over white diffuse should converge to flat gray)

AI Disclaimer: AI has been used to code review and bug hunt, but all the
code and fixes have been written by huomans.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2026-03-05 16:31:52 +01:00
Larry Gritz 7bcf83eb85 build: Support llvm 22, clang 22 for building (#2086)
Fix the minor API changes that came with LLVM 22.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-04 20:29:28 -08:00
Larry Gritz a0eb54e611 feat: add more shader group diagnostics to compile_report (#2085)
When compile_report >= 1, report several new post-optimization stats for the shader group:

* Number of active (non-unused) layers
* Maximum connection depth of the shader network (node count along the longest layer-to-layer chain, so a single unconnected node = 1 and a chain A->B->C = 3)
* Number of texture ops (texture, environment, gettextureinfo, texture3d)
* Number of noise ops

Note that these stats (number of layers, texture ops, noise ops) are the total number in the post-optimized shader, but not the number that will be run on any particular execution of the shader. Trivial example: the noise calls may all be inside an "if" statement with a condition that is never true in practice, but that can't be known ahead of time. In the other direction, a loop with noise calls in the body will underestimate how many calls are made in each shader run. So take with a grain of salt -- these stats are related overall shader code complexity, but not necessarily to execution cost.

Coded via pair programming with Claude Code, using the Claude Sonnet 4.6 model.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-04 16:17:28 -08:00
Larry Gritz 344fded69a ci: add MacOS 26 (ARM) to the CI lineup (#2079)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-03 11:36:01 -08:00
Larry Gritz 11739968de build: Remove support for deprecated Intel icc compiler (#2075)
Intel icc is deprecated and hasn't had a release for a few years. It's
holding us back, both by making us work around an ever growing number
of icc bugs and limitation that will never be fixed, as well as not
allowing us to upgrade minimum versions of certain dependencies,
because icc can't correctly compile newer versions (as an example, it
cannot use a 'fmt' library newer than the oldest we support, 7.0).

So it's time to thank icc for its service and put it on the ice floe
for the polar bears to eat. This is of course in main (future OSL
1.16), and will not be backported to release branches, since we never
stop support of a dependency or toolchain of existing releases. People
requiring icc for whatever reason may keep using OSL 1.15 or older.

We will continue to support and test icx, the fully supported Intel
LLVM-based compiler.

This PR also removes some test reference output that was only needed
for icc.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-02 09:26:21 -08:00
roelandschoukens 3ac1fb39f7 fix: Make linearstep definitely return 1 for x > edge1 (#2064)
The division (xclamped - edge0) / (edge1 - edge0) is not guaranteed
to be exactly 1 for xclamped == edge1 if the backend floating point
math has higher than expected error bounds. Eg. it is common on GPU
backends to use faster but less precise instructions for division.

The modified code is mathematically equivalent and it logically
guarantees the returned value is exactly 1.0 for x > edge1 > edge0.

Signed-off-by: Roeland Schoukens <roelandschoukens@hotmail.com>
2026-03-01 18:10:13 -08:00
Larry Gritz 5f6bb88677 testshade: use renderer's error handler, convert raw pointers to unique_ptr (#2082)
Replace the standalone global ErrorHandler with the renderer's own
errhandler() so that error output is properly routed through the
renderer rather than a disconnected handler. This ensures errors during
shading are visible in the same context as the renderer that owns the
ShadingSystem.

Also replace some raw pointers with `new`/`delete` with
std::unique_ptr.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-03-01 16:24:04 -08:00
Larry Gritz 8265a0705a Change default to JIT without fma (#2076)
The ShadingSystem option "llvm_jit_fma" seems to advertise that it
switches between no fused multiply-add (the default, 0), versus
allowing fma to be generated in the JIT.

The underlying LLVM option is actually a 3-way switch about how to
utilized fused ops: Strict (no fused ops), Standard (allow fma but not
other fused ops), or Fast (allow other fused ops when it will speed
things up). Aside: "standard" is really confusing, as one might think
it means original standard IEEE 754 definitions that lacked fma.

These are not the same! We were using llvm_jit_fma to switch between
Standard and Fast, but upon closer examination, we now believe that it
should control a switch between Strict and Standard, and Strict should
be the default.

This seems to directly change the pesky render-microfacet test, which
has always seemed to have an unusual sensitivity to the specific
processor. Hopefully, users will find that across the board, it leads
to their renderers having fewer minor pixel differences from one
platform to another.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-02-27 23:08:40 -08:00
Larry Gritz 12474fd6b5 ci: Stop nightly CI workflows on user forks (#2074)
ci: Stop nightly analysis and scorecard workflows on user forks

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-02-26 23:50:16 -08:00
Alejandro Conty bd96957b2c Clamp BSDL/MTX Fresnel inputs and fix bootstrap Imath link (#2081)
Clamp generalized Schlick F0/F90 to [0, 1] in the MTX Schlick Fresnel
constructor, and clamp the MTX conductor average-Fresnel fit to [0, 1]
to avoid invalid albedo estimates from the approximation.

Also update BSDL bootstrap linking to use Imath::Imath directly instead of
${ARNOLD_IMATH_TARGETS}.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2026-02-26 11:09:27 +01:00
Alejandro Conty ae8fa4e7f0 Move GeneralizedSchlick lobe from testrender to BSDL library (#2078)
Unify DielectricRefl and DielectricBoth into a single DielectricBSDF<Fresnel>
template that handles both reflection-only and reflection+refraction modes
via a runtime `dorefr` flag. This replaces the old union of two separate
structs in DielectricLobe with a single `spec` member, simplifying the
code and enabling reuse with alternative Fresnel models.

Key changes:

- Merge DielectricRefl and DielectricBoth into DielectricBSDF<Fresnel>,
  parameterized on the Fresnel type. The eval/sample methods branch on
  `dorefr` internally. The existing DielectricReflFront, DielectricBothFront,
  and DielectricBothBack now inherit from DielectricBSDF<DielectricFresnel>
  for table-baking purposes.

- Propagate colored Fresnel through the dielectric eval/sample paths:
  Fresnel eval() now returns Power instead of float, so reflection and
  refraction weights carry the spectral information directly (needed for
  Schlick's colored F0/F90).

- Add refraction_eta() accessor to DielectricFresnel so the templated
  code can obtain the refraction IOR uniformly across Fresnel types.

- Introduce SchlickFresnel (inheriting DielectricFresnel) with generalized
  Schlick F0/F90/exponent parametrization and TIR handling. SchlickLobe
  reuses DielectricBSDF<SchlickFresnel> directly. The refraction IOR is
  derived from F0 via the inverse Schlick approximation.

- Add BSDL_WRAP macro in testrender/shading.cpp to eliminate boilerplate
  for wrapping BSDL lobes (MxConductor, MxDielectric, MxGeneralizedSchlick).
  The old per-class MxGeneralizedSchlick via CLOSURE_*_PARAM macros is
  replaced by the BSDL auto-registration path.

- Update test references and bump AA samples for the schlick-glass test
  to reduce noise with the new implementation.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2026-02-23 21:12:11 -08:00
Taraash 826b75e6bc docs: fix typo (#2077)
fix typo

Signed-off-by: Taraash <110958862+T-Cent@users.noreply.github.com>
2026-02-15 12:07:23 -08:00
Larry Gritz 354ece3415 admin: Fix link to icon used for Slack release announcements (#2070)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-02-02 15:29:11 -08:00
Larry Gritz 46627c701b CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-02-02 08:02:52 -08:00
Larry Gritz 9b4487f111 ci: lock bleeding edge to pybind11 latest version (#2069)
Identical to AcademySoftwareFoundation/OpenImageIO/pulls/5024

There's something in pybind11 master at the moment that is crashing in
its destructors. It's been causing our "bleeding edge" test to fail for
over a week now. I'm tired of our test failing, so I'm locking down to
the last known working version. Will check back periodically and return
to testing against pybind11 master after they have fixed it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-02-01 22:57:00 -08:00
Alexandru Biscoveanu 66c4dcb34b build: Add Conda environment setup and dependency installation script (#2023)
Update INSTALL.md and add configure_conda_env.bash script

Signed-off-by: Alexandru Biscoveanu <alex.biscoveanu.gfx@gmail.com>
2026-01-26 12:24:11 -08:00
Larry Gritz b5f2069e22 admin: TSC roster changes (#2065)
Swap Adrien Herubel -> Thiago Ize for Autodesk (approved by TSC on
2025-12-04), and Clint Hanson -> Alexey Smolenchuk for DNEG (approved
by TSC on 2026-01-15).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-01-19 12:32:34 -08:00
Silvia f2f70f329d feat(osltoy): autodetect output color variable (#2051)
Allow other names, and radio box to select which output variable to display.

---------

Signed-off-by: silvialpz <74107990+silvialpz@users.noreply.github.com>
Signed-off-by: Silvia <hello@silvialopez.me>
2026-01-19 12:20:30 -08:00
Larry Gritz 44eba69f7e ci: Bump python we test on Windows runners (#2066)
They got rid of 3.9 on the runners this week and broke CI.

Also I took the opportunity to update INSTALL.md to refect the
correct dependency versions we have tested.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-01-17 17:22:11 -08:00
Alexey SmolenchukandLarry Gritz d4e959aa1f testrender: Fix uv derivatives for testrender [#1978] (#2037)
Fix dudx, dudy, dvdx, dvdy, as well as dpdx, dpdy in testrender. Now, bump mapping from both UV-based mapping and 3D-based patterns works well. Mip-Map selection also works fine now. Images in Issue: #1978
This PR is intended to validate math and discuss tests.

Fixes #1978

This fix could potentially affect many other tests since dpdx, dpdy are changed.
I'm going to add tests representing bump and mipmapping in this PR.

---------

Signed-off-by: Alexey Smolenchuk <alexey.smolenchuk@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2026-01-12 12:01:25 -08:00
Larry Gritz 693ed85fdd ci: save time by not redundantly installing gif library (#2049)
Fixes #2046

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-01-01 21:59:19 -08:00
Larry Gritz f7fc1c3ed8 docs: Update SECURITY and minor release notes tweaks (#2062)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2026-01-01 21:58:47 -08:00
Larry Gritz 3a343a5fac ci: switch all containers from aswftesting to aswf (#2061)
aswftesting is no longer maintained.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-12-09 16:08:30 -08:00
Larry Gritz c29399433f ci: Update reference commit for ABI check for 1.16 development branch (#2060)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-12-09 00:13:25 -08:00
Larry Gritz 6ab45815c4 admin: Prepare main branch to move on to 1.16 development (#2058)
Prepare main branch to move on to 1.16 development

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-12-08 12:01:02 -08:00
Larry Gritz 00a5e6d65c Update CHANGES before branch (#2056)
CHANGES

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-12-07 13:13:07 -08:00
Larry Gritz 2c491a7606 ci: Address tight disk space on GHA runners (#2055)
- Mount the host's root under /host/root so it's visible in the
  containers.
- Remove stuff we don't need to free lots of disk space.
- Tentatively go back to the free runner for the icx test.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-12-07 05:18:46 -08:00
Larry Gritz 998479f843 ci: Fix change deprecated sonarqube action, improve run conditions (#2052)
Swap out deprecated sonar related action for the new one.

Also make some tweaks to the analysis workflow run conditions,
and update the actions/cache version.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-30 11:12:45 -08:00
Larry Gritz 190c3f08a9 ci: Fix failing render-microfacet.opt test (#2048)
This test started failing sporadically recently, with output images
that looked plausible, but differed slightly from the rest of the
checked-in reference images for this test. It only failed maybe 5% of
the time, so sometimes a CI run would pass, or sometimes fail just one
job variation, or very occasional two. Rerunning the failed job would
generally succeed, but sometimes fail again.

I'll cut to the chase: We were able to trace it to all failures
happening on GitHub runners that identified themselves as "Intel(R)
Xeon(R) Platinum 8370C CPU @ 2.80GHz". When subsequent runs of the
same job variation succeded, it was always because it landed on a
runner that identified itself as "AMD EPYC 7763 64-Core Processor".

We presume that some minor HW or SW differences (perhaps in a library
with an ISA-specific code path) resulted in LSB errors that conspire
to sample different light paths on a minority of pixels, leading to a
different pattern of specular "fireflies".

The expedient fix herein is simply to commit yet another reference
image that is considered to be a "pass".

Along for the ride, discovered during my debugging:
* Rename the label of one job variant, which was incorrect.
* Add comments to the test thresholding parameters (comments ported
  from the analogous script in OIIO, making it easier to understand
  next time one of us is figuring out this code).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-24 12:35:27 -08:00
Larry Gritz 2ebca7b7d6 ci: Use bigger runner for icx job variation, needs more disk space (#2047)
A week or two ago, the icx job variation stopped working, not enough
space to finish installing the packages containing icx and related
material. We didn't change, the Intel package (pegged to a specific
version from a couple years ago) didn't change, the ASWF docker
container (also old) didn't change, so we're assuming that the GHA
runner itself changed, leaving us less disk space, which is now not
enough.

The easiest way out of this for now is for the icx job variation to
use a paid bigger GHA runner with more "disk space". This means it can
only be enabled when running on the main repo, which uses the ASWF's
account that has paid runners. Sorry, CI can't currently test with icx
you people's individual forks until we figure out a way to require
less space. Until then, developers who don't have icx locally will
need to submit the PR to see how it does on icx.

A little bit of workflow magic was needed to ensure that this job
variation doesn't run at all on a developer's fork -- we don't want it
to run, and look like a failed test just because they don't have an
account that doesn't allow use of the big paid runners.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-20 10:54:09 -08:00
Larry Gritz 4b5fc375f3 ci: Bump 'latest' test dependency versions (#2038)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-07 20:27:38 -08:00
Chris Hellmuth 18fa4cfd01 fix(testrender): Default to identity for unknown testrender xforms (#2043)
Default to identity for unknown testrender xforms.

This is a quick workaround for a testrender crash due to missing object transforms, as observed in MaterialX's OSL codegen testsuite: https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXRenderOsl/OslRenderer.cpp#L490

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2025-11-07 20:25:12 -08:00
Larry Gritz 8725c3c65e fix: Use more modern span-based set_pixels with OIIO 3.1. (#2042)
Switch CI back to the aswf/ci-osl:2025-clang18.3 container that
has OIIO 3.1, it will work fine with this change.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-07 09:39:02 -08:00
Larry Gritz a1761c7901 batch: suppress warning for SIMD loop vectorization failure with clang (#2032)
batch: relax SIMD loop for certain operations

When building with a newer version of clang, I uncovered a few more
SIMD pragma loops fail to vectorize on clang.

Since it seems to depend on the compiler version, and I don't want to
disable attempted vectorization, I thought a better strategy was just
to disable the warnings when it fails to vectorize in those specific
places.

Add a "latest dependencies with clang" test, that's how I stumbled
across these in the first place.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-03 13:58:07 -08:00
Larry Gritz 1cfaf7712f ci: unbreak optix jubs by locking down container (#2041)
In all branches, the OptiX test job started failing several days ago,
corresponding to an update of the aswf/ci-osl:2025-clang18.3 container.
Reverting to aswf/ci-osl:2025-clang18.2 passes again!

Let's merge this fix so that our CI passes, and separately iterate
to figure out what went wrong with the newer container.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-03 13:57:22 -08:00
Larry Gritz c4860f0b1f build: Fix compiler warnings with clang 21 + C++20 (#2033)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-11-01 15:58:12 -07:00
Alex Fuller 29f14845d3 build: small fixups for LLVM 21 support (#2034)
Signed-off-by: Alex Fuller <boberfly@gmail.com>
2025-10-29 12:34:15 -07:00
Christian HeuselandLarry Gritz e9a8ec55c2 build: Add compatibility with LLVM 21 (#2030)
This adds LLVM 21 compatibility by adding the relevant code changes
guarded by `#ifdev`-statements for backwards compatibility.

Avoid deprecated LLVM calls for 21+

Additionally also add CI checks for this.

---------

Signed-off-by: Christian Heusel <christian@heusel.eu>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2025-10-26 18:07:31 -07:00
Curtis Black c7d7ec272a feat: Add rs_allocate_closure free function. (#1944)
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.

---------

Signed-off-by: Curtis Black <curtis.w.black@gmail.com>
2025-10-25 13:44:55 -07:00
Larry Gritz ee5ae28cfa ci: drop deprecated macos-13 (intel) platform, add macos-15-intel (#2031)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-10-23 18:27:48 -07:00
Alex Fuller 9da2d792be build(windows): Ensure 'lib' prefix is on the dynamicaly loaded batched shading libraries for windows (#2025)
When the ISA-specific dll is loaded dynamically by the batched shading system,
it was expecting the lib prefix to be there. 

Signed-off-by: Alex Fuller <boberfly@gmail.com>
2025-10-15 10:34:28 -07:00
Alex Fuller d7591f047b build: Use generator expressions to find oslc and compile shaders with it (#2026)
Signed-off-by: Alex Fuller <boberfly@gmail.com>
2025-10-15 10:28:38 -07:00
Sergey Sharybin 233a54a056 fix: LLVM_Util::supports_isa is not thread-safe (#2029)
The supports_isa() function might be called from threads, and prior
to this change it might have added entries to the global sCpuFeatures
variable. This happened when detect_cpu_features() is called with
TargetISA::UNKNOWN and the code was looking for the best ISA. This
could lead to situation when the host CPU is ARM, and the probing
happens for AVX512.

This change ensures that the supports_isa() accesses sCpuFeatures
in the read-only manner.

This was originally noticed as unreliable OSL render tests in Blender
reported at https://projects.blender.org/blender/blender/issues/147642

Signed-off-by: Sergey Sharybin <sergey@blender.org>
2025-10-09 12:34:32 -07:00
Larry Gritz 7c77f05683 ci: Adjust test matrix for recent OIIO and OCIO releases (#2028)
ci: Adjust for recent OIIO and OCIO releases

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-10-05 22:31:07 -07:00
Larry Gritz 749e8c6d6a ci: Adjust comparison threshold for render-microfacet test (#2027)
Something must have changed on the GHA runners? Or a compiler version?
On one test job, we started failing this one test, the noise pattern
changed a few days ago, independently of any change to OSL repo.

Bumping up the comparison thresholds slightly appears to do the trick.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-10-05 22:30:20 -07:00
Larry Gritz 2a3f9436f1 fix: batch shading compiler directives were wrong (#2015)
I spotted two places where we used a *nonexistant* OSL_GCCVERSION
macro. This is never defined.

In platform.h, I think it's a simple typo and should be
OSL_GNUC_VERSION, which is the macro we actually use to hold the GCC
version, or 0 if it's not being compiled by GCC.

In wide_opcolor.cpp, it's odder and seems like also a cut-and-paste
error. At the very least it should be OSL_CLANG_VERSION since it's
part of a clause that also tests that clang < 14.0. But upon staring
at it, I can't help but wonder if this spot should *also* have a
clause `OSL_GNUC_VERSION ||` to make this simd loop macro work properly
for GCC, as it did in the other one in platform.h?

And should the one in platform.h include clang, or no?

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-09-30 20:57:57 -07:00
Larry Gritz b8eb28d141 cleanup: Simplify some clauses involving old compilers (#2016)
Our minimum gcc 9 and clang 5 lets us simplify a few preprocessor
conditionals.

Also give more clear cmake messages when too-old compilers are
encountered, for gcc, clang, and Apple clang.

Define OSL_GCC_ONLY_PRAGMA, which is handy in the future.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-08-29 09:06:55 -07:00
Larry Gritz 5d8dc32adf ci: Add a VFX 2026 platform test (#2020)
And some minor tweaks for gcc14 + C++20 warnings

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-08-15 12:51:19 -07:00
Larry Gritz 04307c7488 deps: Raise llvm minimum to 14.0 (#2019)
Drop support for llvm 11, 12, 13.

Simplify lots of conditional compilation.

With 14 as the minimum, the new pass manager and opaque pointers are
both supported, so we are able to get rid of all code related to
support of the legacy pass manager, as well as typed pointers. This
is a lot of removed code!

We also simplify the testing matrix as a result of having a less
expansive range of LLVM versions to consider.

When updating INSTALL.md, I noticed that we still had **bold** for
"new minimum dependencies" left over from when we first released 1.14.
So I'm unbolding them now, except for the ones we actually have
changed for 1.15.

I had originally intended to pull the minimum to 15, but actually that
makes it more difficult to continue CI testing vs VFX Platform 2022,
since the ASWF-docker container for 2022 only support up to LLVM 14.
And simultaneously, once I removed the code for legacy PM and typed
pointers, there was, in comparison, only a small amount of additional
simplification we could squeeze out of moving the minimum to llvm 15.
So for OSL 1.15, we will have a minimum llvm 14, and then for OSL 1.16
when we would feel more comfortable droping all VFX Platform 2022
support and move to the 2023 containers as our oldest testing
environment, we can bump to llvm 15.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-08-11 07:27:37 -07:00
Larry Gritz 89fc3a24d3 deps: Raise minimum supported Python version from 3.7 to 3.9 (#2017)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-08-06 12:49:22 -07:00
Larry Gritz 4d7b8d82c8 CHANGES updates
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-08-02 19:23:58 -07:00
Jean-Francois Panisset 818be8e5ed build: Serialize builds in testshade (#2012)
When building with:

- OptiX enabled (OSL_USE_OPTIX)
- Code Coverage disabled (NOT CODECOV)
- a parallel build

various components of the clang toolchain are likely to crash
as the testshade and libtestshade builds run in parallel and
can overwrite each other's intermediate results.

This chain adds explicit dependencies to serialize these builds,
avoiding toolchain crashes at a minimal performance cost.

---

Signed-off-by: Jean-Francois Panisset <panisset@gmail.com>
2025-07-28 14:46:43 -07:00
Larry Gritz 30b690b300 ci: Fix Windows CI with special LLVM pre-build (#2011)
ci: Fix Windows CI

Recap: GHA Windows runners recently upgraded their MSVS to a version
whose std headers no longer get along with the LLVM 18 we had been
using for CI (which we download from the LLVM project's hosted binary
builds). But upgrading to LLVM 19 or 20 didn't help, because all of
the LLVM-hosted binaries of those releases were built with the flags
selecting the static runtime library, which is different from the
dynamic choice that's a more common default and which we used for both
our build of OSL and its other dependencies. You can't mix and match.
(The reason for this switch is related to their changing to build by
default using a certain malloc repacement library, which somehow leads
to needing the static runtime.)

To dig us out of this, Chris Kulla was kind enough to build us an
LLVM 20.1 from source, using the old dynamic runtime choice, and host
that as a zip file on a google drive.

This PR makes use of that as the LLVM we us for our Windows CI jobs,
and now we pass CI again.

This doesn't seem like a sustainable long-term solution, because if
the LLVM project is changing the default linkage, we don't want to
need to maintain separate custom builds just for us, surely we can
adapt by changing how compile flags on OSL and all of our
dependencies. But at least this gets us unstuck for right now.

Also as a reminder, our OSL Windows CI at the moment just does the
build, not a testsuite run. We'll tackle that separately.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-07-28 12:03:36 -07:00
Larry Gritz 02df65d643 build: Test C++20 and gcc14 + fixes needed (#2010)
We weren't testing against gcc-14 nor against C++20 in our test
matrix.  Add them.

The fixes required were:

* Had to suppress some warnings gcc-14 complains about in LLVM's
  headers.

* There were some tricky interactions between C++20 and fmtlib, which
  is because when being compiled with C++ >= 20, fmt switches to a
  bunch of tricky runtime checking that has different needs for
  constexpr and consteval. I had to rearrange some things a bit to
  make it happy simultaneously with both old and new.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-07-27 23:38:12 -07:00
Alejandro Conty a76c42d522 Add BSDF for MaterialX dielectric with Multiple Scattering (#2009)
This moves the dielectric implementation to BSDL and adds energy
conservation via Turquin style multiple scattering. That is, we create a
microfacet based reflection refraction model where we precumpute the
energy loss to a lookup table. Then at render time we renormalize the
lobe to remove the energy loss.

In addition we use Bounded Visible Normal sampling to avoid rejecting
reflection samples. This improves noise significantly at the cost of
losing valid refracted directions. This doesn't produce energy loss
thanks to the renormalization, but biases the the refraction for high
roughness and low IOR. The result is still plausible and very hard to
see which one is correct.

Also keeping the ability to layer a reflection only coating on top of
other BSDFs via layer().

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2025-07-27 21:01:58 -07:00
Larry Gritz d6e49796f8 deps: test against pybind11 3.0 and minor fixes (#2007)
Add pybind11 3.0 to the CI test matrix.

Found a place where we defined a python method twice, fixed that.

Ran into some trouble where the Mac runners which used a pre-built
OIIO supplied by Homebrew, and apparently compiled against pybind11
2.x.  I think maybe there are some corner cases where if you have two
python modules that share types (TypeDesc and a few more, in this
case), they should not be built with pre-3.0 and post-3.0 versions of
pybind11?

The quick fix was to switch to having OSL CI on Mac just build an OIIO
from scratch to ensure that it was using the same pybind11. But that
identified yet another problem (which I also think is a runner issue)
that required some minor adjustment to how OIIO auto-builds libpng.

There is a patch in review on the OIIO side for this. But since that's
not merged yet, I have doctored this PR to pull OIIO from my own
fork, the branch containing the fix, just to show that it works. After
the merge on the OIIO side, I will remove those customizations from
here before this PR is merged. (And delete this paragraph.)

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-07-23 21:22:50 -07:00
Alex Wells 532053ee97 perf: Share Shading Context when optimizing/jitting a shader (#1952)
Share Shading Context when optimizing/jitting a shader vs. grabbing an additional context.

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.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2025-07-08 15:15:39 -07:00
Larry Gritz 67693b9a75 fix: pass the real number of channels to rs_texture and rs_texture3d on gpu (#2004)
These were discovered when moving SPI's renderer to the the current
release and switching to use the rs_ functions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-07-02 09:46:08 -07:00
Sven-Hendrik HaaseandLarry Gritz 8599942486 build: Add compatibility with LLVM 20.1 (#1993)
This adds LLVM 20 compatibility. 
Fixes #1963.

Signed-off-by: Sven-Hendrik Haase <svenstaro@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2025-06-16 15:18:26 -07:00
Alejandro Conty 87f71d19e7 Change MX conductor to sample bounded visible normals (#2000)
Turquin style multiple scattering is very simple, but also way noiser
than using a diffuse lobe for MS. This is because sampling microfacets
for reflection, the way we do now, is far from ideal at high roughnesses.

Switching to the reflection optimized sampling technique from "Bounded
VNDF Sampling for Smith–GGX Reflections" fixes all the trouble. This
sampling avoids sampling micronormals that are going to reflect the ray
under the surface (and therefore throwing away samples).

Paper:
https://gpuopen.com/download/publications/Bounded_VNDF_Sampling_for_Smith-GGX_Reflections.pdf

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2025-06-15 14:56:43 +02:00
Larry Gritz 6c7fc6fd0b ci: add vp2025 test (#1995)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-13 08:29:31 -07:00
cmstein 2f6507d52b build: update include directives for OpenImageIO_ROOT (#1997)
Adds directives to prioritize the includes from $OpenImageIO_ROOT in case there is an older (or newer!) system install of OpenImageIO. Without this, OSL might use the includes in /usr/include/OpenImageIO yet link to the libraries in OpenImageIO_ROOT thus producing namespace clashes.

Signed-off-by: Clifford Stein <cstein@imageworks.com>
2025-06-12 17:15:57 -07:00
cmstein 8bc38f4996 fix: check for errors in ShadingSystem::ReParameter() (#1998)
ShadingSystem() wasn't checking whether the offset returned by interactive_param_offset() was valid or not before performing the ReParameter() memcpy(). So, we could copy data to a location outside of a valid memory block and cause a crash.

Signed-off-by: Clifford Stein <cstein@imageworks.com>
2025-06-12 16:54:56 -07:00
Larry Gritz c71d804f74 ci: improve CI caching scheme (#1994)
I recently discovered that the caching of our ccache was either not
working at all, or was much less efficient/helpful than I thought. So
there are a number of improvements here:

- Split caching into separate restore/save, and rearrange the step
  order so we save cache before tests run. This allows us to save the
  ccache even for jobs with failed tests (where the job fails), or for
  jobs that we purposely end early (maybe because we see failing
  tests), not only when all tests finish and succeed. This makes
  subsequent builds, that we do on the same branch while attempting to
  fix failures, go faster by using the cache.

- Make subsequent pushes to the same PR or REF to cancel any previous
  jobs, so if we push updates before the last CI run of the same
  branch completes, it won't keep those going as useless zombie jobs.

- Change the cache key names we use to remove the github ref to
  encourage cache reuse across different commits or branches (I
  think), and to fix a couple errors where we had mis-named things and
  were sharing caches between jobs when we shouldn't or vice versa.

- Be more careful about the location of the cache, making sure we were
  for sure telling the GHA cache action to be saving/restoring the
  same directory location that we told ccache to use as its cache.

- Use CCACHE_COMPRESSION env var to be extra sure we're using
  compressed caches to be sure we get the best bang for buck on the
  limited cache storage we're allowed.

In all, there were a number of subtle things broken. Give it a good
scrubbing.  I'm not really sure exactly which one of these, or which
combination, was most responsible for getting things unstuck, but it
definitely works!  Some results from two test pushes in a row I did
after these changes:

                              build deps     build osl
    VFXP 2024 / cold            4:12            6:11
    VFXP 2024 / cached          1:42 (2.5x)     0:48 (7x)

    ABI check / cold            4:11            6:14 + 5:38(abi ref)
    ABI check / cached          0:57 (4.4x)     0:46 + 0:16 (11.5x)

    bleeding edge / cold        8:12            9:57
    bleeding edge / cached      1:39 (5x)       0:44 (13.6x)

It varies across jobs and from run to run, but let's call it something
in the neighbourhood of 4x speedup building dependencies and 10x
building OSL itself. It's not better because it doesn't speed up
linking, and not all of the dependencies' build systems are doing
things in a way that is amenable to ccache inserting itself into the
process. Still, this should be a big help in reducing the time of
our CI runs.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-10 11:17:00 -07:00
Larry Gritz 915b3fa55a testing: Add optix ref output for new test added in PR 1991 (#1996)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-09 11:14:35 -07:00
Alejandro Conty 36b14526c9 bsdl: Implement MX conductor with multiple scattering (#1991)
This moves the BSDF to libbsdl so we use the albedo tables
infrastructure. Adds roughness regularization and energy
compensation (multiple scattering, Turquin style).

I removed the thinfilm options that were not implemented and
don't exist in the MaterialX spec. Also I propose thinfilm to
be implemented as a decoration via vertical layering so we
don't repeat the parameters in every BSDF/closure.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2025-06-05 20:16:17 -07:00
Larry Gritz 7294115c2f ci: GPU/OptiX full build and test (#1992)
At long last, turn on full execution and testing for OptiX in our CI,
using the GitHub GPU-enabled runners.

This should greatly reduce the possibility of build breaks from not
actually testing OptiX rendering, not to mention making it possible to
make changes on the OptiX code path and have it confirmed by our usual
CI.

Previously, we were building against the OptiX headers, so at least we
wouldn't make an obvious build break, but we weren't executing the
testsuite on GPUs. So it was still possible to merge code that broke
that code path in practice. For PRs that looked obviously risky, I
would pull them to my work machine, build and test with real GPUs to
confirm. But this was a big pain, extra trouble for me, and very error
prone -- sometimes I didn't recognize that a PR needed that extra
testing, or sometimes I forgot entirely, and merged broken code.

Note that this depends on PAID GitHub runners with GPUs. The bill is
paid by ASWF, but it means those runners are only available on the
ASWF GitHub account -- that is, they will run for PRs once submitted,
but not when you merely push to your own account's fork, sorry. When
running on a non-ASWF account, it will select an ordinary free runner
and build OSL against the OptiX headers, but will not run the
testsuite since there is no GPU.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-05 12:40:59 -07:00
Larry Gritz fe52953331 ci: Remove Windows-2019 job (#1990)
ci: Remove Windows-2019 case, those runners are about to be removed by GH

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-04 10:00:05 -07:00
Larry Gritz f1f80784d1 build: Get OptiX headers from new improved location (#1989)
NVIDIA recently set up a GitHub repo with the OptiX headers (with
version tags!), which is much better than the unreliable semi-secret
location we used to use.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-04 09:01:38 -07:00
Larry Gritz 3d164fe82d build: Simplify FindOptiX.cmake a bit now that OptiX 7 is the minimum (#1988)
There was still some logic that was only needed during the period that
we supported both OptiX 6 and 7+.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-06-04 09:00:08 -07:00
Alejandro Conty 05deead9b6 Open-sourcing Imageworks BSDF library (#1986)
Sony Pictures Imageworks BSDF library (working title BSDL) is here
published and introduced to testrender. It is a header only library
where everything is inlined and can be used on GPU. Although we haven't
kept the BSDFs up to date with the latest research in the last couple of
years, I hope you, at least, like the infrastructure. There are three
main items in this PR
  1. Put BSDL as an INTERFACE cmake library in src/libbsdl.
  2. Introduce the switch/case automatic pseudo virtual methods in
     testrender to handle all the existing BSDFs.
  3. As an example integrate SPI's ThinLayer BSDF in testrender and add
     a test for it.

BSDL is a self-contained lib depending only on Imath. There is not even
a need to link to OSL and it can be used as a build only dependency.

Inside libbsdl directory there is a README with further information, but
documentation is the usual weak point with production code. We use this
code as-is directly for making movies with our in-house render, and we
welcome everybody to contribute theirs. The name "BSDL" is one of my
half-broken name ideas and I'm very much open to suggestions.

I recommend to first look at my changes to testrender, integration was
very easy. Then dive in the internals if you want. Credits for this code
go mainly to Chris Kulla and me (Alejandro Conty), but there are also
other smaller contributions from other Imageworks members, including
alumni Laura Lediaev who wrote the LTC sheen implementation.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2025-05-25 08:54:28 -07:00
John Haddon 96a307dbb2 build: Link batched libraries with liboslexec (#1987)
The batched libraries seem to require at least one symbol provided by liboslexec : `OSL::v1_14::Strings::null`. If this is not available, then attempts to do batch shading result in the following error at runtime :

```
ERROR: /home/john/dev/build/gaffer-1.6/lib/lib_b16_AVX512_noFMA_oslexec.so could not be loaded with error "/home/john/dev/build/gaffer-1.6/lib/lib_b16_AVX512_noFMA_oslexec.so: undefined symbol: _ZN3OSL5v1_147Strings4nullE"
LLVM_Util::call_function(osl_b16_AVX512_noFMA_allocate_weighted_closure_component_masked, args), requested function name doesn't exist in the current module!
/home/john/dev/gafferDependencies/OpenShadingLanguage/working/OpenShadingLanguage-1.14.5.1/src/liboslexec/llvm_util.cpp:4370: call_function: Assertion 'func' failed.
```

This came up in Gaffer, where we have a plugin that uses `liboslexec` to do geometry and image processing. Why does Gaffer require this fix but other clients such as `testshade` don't? My theory is that this is because `testshade` is an application, and since it links to `liboslexec` itself, the symbols are available to the batched library when it is opened. Whereas Gaffer does not link to `liboslexec`, but loads a plugin which does, meaning that `liboslexec` symbols do not become generally available. Using LD_PRELOAD to load `liboslexec` upfront also works, and I suspect loading the plugin with `DYLD_GLOBAL` probably would too, but both are more drastic than fixing the linking at source.

I don't know too much about how the batched libraries are loaded, so if there are better solutions I'm all ears.

Signed-off-by: John Haddon <jhaddon@cinesite.com>
2025-05-22 15:56:49 -07:00
Larry Gritz f009086b2e admin: Set up new issue templates (#1981)
It had escaped my notice that last month, GitHub ended support for a
single ISSUE_TEMPLATE.md, and now only supports an ISSUE_TEMPLATE
directory with individual templates. I can't imagine the engineering
reason for not being able to continue to support having just one
template as always.

Anyway, so this PR conforms to what they support, by copying (and
lightly modifying) the issue templates that OIIO has used for some
time.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-05-03 17:06:39 -07:00
Larry Gritz e8b32a28da build: Remove unused symbol that was removed from OIIO main (#1984)
This symbol was for an architecture that never shipped mainstream,
we don't need to look for it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-05-02 22:23:50 -07:00
Larry Gritz 96d0131cd9 build: Fix various MacOS problems with GitHub and CMake (#1982)
The combination of cmake 4.0, changing homebrew default package
versions, and slight changes rolled out to the GitHub Actions runner
images conspired to break our CI for 2 of 3 Mac variants. Fixes:

* Apple: only add the -isysroot to the bitcode-generating clang++
  command if CMAKE_OSX_SYSROOT is defined.
  Plot twist -- this is no longer set by cmake  starting with cmake 4.0!

* Fix incorrect warning message for apple clang vs newish llvm
  in externalpackages.cmake.

* Remove homebrew unlinking of python@3.10 that warned in
  install_homebrew_deps.bash. On the GHA runners, it was giving us
  warnings because we were asking this package to be unlinked but it
  wasn't installed.  For future needs, add an env variable based way
  to unlink individual packges.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-22 10:04:16 -07:00
Larry Gritz b1b77ef2a8 CHANGES, and pull v1.14 release docs tweaks into main
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-06 15:54:07 -07:00
Larry Gritz 7b79649b54 docs: Get rid of old LaTeX documentation (#1970)
Only use markdown -> readthedocs for the language specification.  No
need to continue maintaining the LaTeX version, it only makes it
confusing for people who don't know which they should be updating.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-06 09:39:53 -07:00
Larry Gritz b094ed4e7e docs: Document the optional "colorspace" parameter for texture funcs (#1969)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-05 17:15:33 -07:00
Larry Gritz 04f37e95a4 feat: Optional texture argument for colorspace (part 1 -- don't reject) (#1966)
Optional texture argument for colorspace (part 1 -- don't reject)

A while back, we proposed a new optional token/value parameter for the
texture functions: "colorspace", followed by a color space name, which
indicates that the texture name referenced is understood to be in that
colorspace (this is passed to the TextureSystem, which has known for
some time how to ensure the right transformations are applied as tile
data is read in).

We do not fully implement this yet! It's more involved than I have
time to get right by the scheduled OSL 1.14 non-beta release (which
was supposed to have been on Apr 1, oh no). Not wanting to delay
things further, this change at least causes the use of the new
parameter (which apparently, MaterialX has been using) to be silently
accepted and ignored, rather than generating runtime errors. We'll
come back right away for a more complete working implementation.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-05 16:53:58 -07:00
Larry Gritz b00e03d7d9 build: Unbreak CI on Mac by not letting it install llvm 20 (#1962)
We're not LLVM 20 compatible yet, we'll deal with that separately
and not under the time pressure of a major releases that's overdue.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-03 14:08:03 -07:00
Larry Gritz 323c1c1a4b build: Support for CMake 4.0 (#1960)
The tricky part is that several dependencies break because of cmake
4.0 dropping support for strict compatbility with cmake < 3.5. Have to
resort to some trickery with CMAKE_POLICY_VERSION_MINIMUM overriding
what those packages declare via their own cmake_minimum_required(),
and hope it works.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-02 21:44:41 -07:00
Larry Gritz 9948e5839f ci: bump dependencies for "latest versions" CI test (#1958)
Bump to the latest in several cases. Also make sure the INSTALL.md
is in line with what we support and/or test.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-04-01 09:03:19 -07:00
Alexey Smolenchuk 5c342f6280 docs: Fix typo in substr documentation (#1956)
Signed-off-by: Alexey Smolenchuk <alexey.smolenchuk@gmail.com>
2025-03-26 11:49:25 -07:00
Chris Hellmuth 73e420999e fix: Include entry layer name in PTX cache key (#1954)
The ptx cache key introduced in #1938 didn't include a shader's entry layer name in its cache key. The direct callable function generated during llvm construction includes this layer name, so we could get false positive cache hits when two identical networks with matching group names had different entry layer names. The end result is an optix compilation error. This PR extends the cache key to handle this scenario.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2025-03-07 10:34:22 -08:00
Larry Gritz c48d7170a9 CHANGES
Sync with v1.14.4.0-beta1

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-03-06 13:26:08 -08:00
Larry Gritz 392f0f809f ci: Update cache action to modern version (#1953)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-03-04 11:16:46 -08:00
Larry Gritz 3a85f7a3c4 ci: improve clang-format check (#1950)
ci: improve clang-format

Make a new run-clang-format.bash utility to issue the commands
for the right files. No "build" is requred, and the only dependencies
we need are the minimum it takes to run clang-format itself.

These changes reduce the approximate total elapsed time of a CI
clang-format job from 8:00+ to under 0:30.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-03-01 21:05:33 -08:00
Larry Gritz 6f2b3f6b4c int: Proper forwarding (#1923)
Proper forwarding (for C++20?)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-03-01 21:04:02 -08:00
Larry Gritz 0043bf9421 Re-remove device decoration from some osl_ functions (#1951)
Recent PR 1852 (Free functions for texturing, point clouds, and trace)
added host/device decorations to certain `osl_` functions that
previously were replicated in OptiX-based renderers. This means that
now the ones in those renderers will be seen as duplicate symbols.

The more clear intent that we'd like to work towards is that all the
`osl_` functions are meant to be "internal" to the liboslexec or the
bitcode it provides, and the `rs_` functions are the customization
points that the renderer is expected to supply.

Except... a bunch of the `osl_` functions that set parameters for
subsequent texture and trace calls do not yet have `rs_` customization
points. So we're actually not quite ready to change things.

To unbreak, then, this PR removes the `__device__` decorations (so
they are again safe/expected for GPU renderers to override them).
To keep testshade/testrender working, we add copies of them to
testshade/testrender specifically.

Like I said, eventually we'll add `rs_` customization points, and at
that point, we'll truly expect the `osl_` functions to be only supplied
by oslexec itself and not the renderers.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-03-01 21:02:59 -08:00
Alex Wells d7a48ed159 fix: interpolated int attributes wrong for batch shading (#1949)
Fix issue #1929 with batched execution forcing interpolated integer arguments to be boolean when their default value is 0 or 1.
In actuality the renderer could assign any integer value, we update BatchedAnalysis to track the interpolated value as a write event
which will disqualify forcing of boolean as well as ensure future writes are masked properly.

Added new lockgeom test that reproduces the issue and verifies its fixed.

---------

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2025-03-01 21:02:30 -08:00
Larry Gritz c048a332c6 build: Fix libclang link order (#1946)
Apparently, in LLVM 18, some things shifted between libraries and that
requires a slightly different link order. But only on Linux, or maybe
only with static libraries, so even though our Mac and Windows CI
tests have used LLVM 18, it wasn't symptomatic there.

We didn't discover this earlier because we didn't actually test
against LLVM 18 on any of the Linux CI runs. So we add that.

Also, to alleviate the pain in adjusting LLVM versions and often
needing to modify our build_llvm.bash script, I'm trying out a GHA
marketplace action KyleMayes/install-llvm-action, and it works well
and saved me time, so we may switch to that for other cases over time
as well.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-26 15:47:34 -08:00
Alex Wells 6cfa9724d8 fix: false positives when utilizing OSL's "debug_uninit" feature (#1947)
It was checking a "while" loops condition variable before the condition had executed causing false positive.

It was checking all elements of arrays causing false positives when only a subset of the array is actually being read from in "pointcloud_get", "spline", "splineinverse" calls. Implementation detail: in batched mode, to handle a varying count or knot count parameters a new version of osl_uninit_check_values_offset was added.

Fix message formatting for batched debug_uninit messages which was printing out pointer to the string instead of the strings themselves.

debug-uninit in testsuite was update to check for false positives for while(condition), spline, and splineinverse as well as correctly identifying uninitialized use of partially initialized arrays with spline and splineinverse.
Adding test for pointcloud_get was omitted due to local build configuration.

---------

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2025-02-25 13:27:16 -08:00
Larry Gritz 43f649be57 ci: Update reference commit for ABI stability check (#1945)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-21 18:33:26 -08:00
Larry Gritz 4b2f330d96 ci: Move away from soon-to-be-deprecated ubuntu-20.04 GHA runner (#1941)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-21 16:44:59 -08:00
Larry Gritz e3aa2cf5a1 admin: Bump main release designation after 1.14 release branching (#1943)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-16 10:07:58 -08:00
Larry Gritz 8b71d4d613 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-11 14:20:17 -08:00
Sparsh Nair cc3de84492 docs: Fix typo in Arrays and better document 1D arrays only (#1939)
Signed-off-by: Sparsh-N <nairspar@iu.edu>
2025-02-11 11:30:13 -08:00
Chris Hellmuth d0d4a06069 API for renderer to cache OptiX ptx (#1938)
This change adds a caching layer to the OptiX PTX pipeline that can skip LLVM generation and optimization. This helps improve scene build times for re-renders of scenes with large shader counts.

We generate a hash key from the optimized shadergroup, and depend on the renderer to provide a cache backend implementation. There is no overhead if the renderer doesn't explicitly opt-in to ptx caching.

A simple backend will be added to testshade/testrender in a follow-up PR.

As background information:

The sequence at runtime is group oso ->1-> runtime optimize by liboslexec ->2-> JIT to PTX via LLVM ->3-> driver converts PTX to actual executable GPU code on that hardware.

The "OptiX Cache" (part of OptiX & driver) speed up step (3) by not having the last step for optimized/JITed shaders it's encountered before.

This PR adds another cache to step (2), managed by OSL and/or the renderer internals, to allow you to skip the bulk of the work for that step for optimized shaders you've encountered already.

You still pay full price the very first time a shader is encountered, and that leads to terrible TTFP (time to first pixel). But this should take a big bite out of that in practice since it's very common to have encountered most shader configuration before. If the implementation the renderer provides is to store the cache persistently on disk or in a real database, it will be shared from run to run and possibly from user to user.

---------

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2025-02-10 18:44:16 -08:00
Larry Gritz 4ce094f6ab testing: update some optix ref images and comparison thresholds (#1937)
Determined by trying a couple GPU configurations at work.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-10 11:08:59 -08:00
Larry Gritz 3e7b51f950 deps: Adjust osltoy for Qt 6.8 (#1936)
Qt 6.8 deprecates QCheckBox::stateChanged().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-07 13:46:04 -08:00
Jonathan StoneandLarry Gritz ac63a5a1f9 testrender: Improvements to energy conservation between layered BSDFs (#1935)
This changelist proposes improvements to the energy conservation between layered BSDFs in OSL.

The rational quadratic fit for GGX directional albedo from the MaterialX project has been integrated into `dielectric_bsdf` and `generalized_schlick_bsdf`, improving visual parity with MaterialX GLSL and MDL.

Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>

---------

Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2025-02-07 13:45:03 -08:00
Larry Gritz ffc5b903c8 testing: env variable OSL_TESTSUITE_THRESH_SCALE scales test thresholds (#1934)
For any individual test running, the OSL_TESTSUITE_THRESH_SCALE
environment variable, if set, will scale the image comparison
thresholds used to decide if a test passes.

Furthermore, a special OSL_TESTSUITE_OPTIX_THRESH_SCALE environment
variable, if set, will cause *all* OptiX related tests to be set up
with scaled thresholds.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-02-04 10:13:11 -08:00
AidanWelch ddb959e38a Docs: Fix typo in the name of the argument "maxdist" of trace (#1933)
Docs: Fix typo in the name of the argument maxdist of trace

Signed-off-by: Aidan Welch <aidan@freedwave.com>
2025-01-31 12:32:05 -08:00
Curtis Black e2caeb0080 api: Add ShadingSystem query to ask if attribute derivatives are requested. (#1932)
This PR adds an API to ask the shading system if derivatives are required for attributes needed by a shader group.

Signed-off-by: Curtis Black <curtis.w.black@gmail.com>
2025-01-30 16:46:06 -08:00
Larry Gritz b795e3e92a testing: fix shell command quoting to work the same on Unix and Windows (#1925)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-25 08:44:56 -08:00
Larry Gritz 121638e4ce testing: for CI only, trim PWD from the oslc -M output (#1924)
I think this stems from libclang (doing the C preprocessing step
for us) giving us relative paths on all platforms but Windows,
where it gives absolute paths -- with backslaches and C:\ and all.

I'm going to be conservative and not switch to relative paths accross
the board on Windows, but for now just restrict it to the builds we do
for CI, in order to make the related tests pass for Windows on our CI
(where we obviously don't want to have the reference output need to
bake in absolute paths of the place they may happen to execute on the
GHA runners).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-25 08:44:20 -08:00
Larry GritzandBrecht Van Lommel 669bea1cec ci: Windows CI (take 1) (#1930)
First step at getting full Windows CI: This PR gets us as far as doing
a Windows build of OSL for each Windows flavor on GHA.  This is an
important part of making it much harder for us to inadvertently break
the build on Windows.

We currently only build, but we don't run the testsuite. This is
in progress and we don't pass all tests quite yet, but I didn't want
to wait any longer to get this much in our CI.

This is just about getting our own CI runs for Windows and still relies
on helper scripts being run as part of the CI to build or install the
dependencies before the main build starts. We want eventually to get
to the point where OSL's build system can itself auto-build all the
important dependencies if not found and it's not something most
users need to worry about.

A few notes about specific changes in this patch that came along
for the ride:

* Port many build_blah.bash scripts (or recent changes thereto) from
  OIIO to OSL to synchronize them between the two projects and move
  improvements made on the OIIO side to OSL's versions.
* Augment the build_llvm.bash script with logic to work on Windows,
  too, using pre-built binaries associated with LLVM releases. Note
  that not all of their releases have Windows binaries pre-built,
  so you have to pick one of the right releases for it to work.
* Fix a problem with the way we propagate C++ std level flags from the
  main build to the bitcode-generating pass. On Linux and Mac,
  `-std=c++17` works identically on gcc/clang that we use for OSL
  itself and the clang we use to generate precompiled bitcode. But on
  Windows, the standard-setting flags for MSVC we use to build the cpp
  is different from the flags needed for clang when compiling to
  bicode.
* Modify the ci.yml to allow special branch names to exclude platforms,
  to simplify iterating over many CI runs when only caring about one
  platform. If the branch name contains the substring "windows-only",
  the Linux and Mac CI test variants will be skipped, and analogously
  for "macos-only" and "linux-only".

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2025-01-25 08:42:09 -08:00
Larry Gritz 5ad18693ec testing: Update ref output for render-microfacet with OptiX (#1927)
A while back, the changes of PR 1897 slightly changed the output
of this test under OptiX, so we're belatedly getting around to
updating the reference output.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-22 21:42:59 -08:00
Brecht Van Lommel d5e04dc38a build: Use macOS sysroot, arch, minversion for generating bitcode (#1928)
To solve a problem finding system headers when building with command line
tools instead of Xcode. Replaces some commented out code, as this should
be a more general solution to the same problem.

Adding arch and minversion for completeness, not because of a particular
known problem, but better to be sure everything matches up.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2025-01-22 21:18:03 -08:00
Christopher Kulla 907ddce3c5 testing: testrender: Implement basic displacement shader support (#1898)
Associate an (optional) displacement shader with each material. On startup, we execute
the displacement for each face-vertex that has a valid displacement shader assigned.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2025-01-21 10:01:10 -08:00
Larry Gritz edcd505a3d fix: unbreak osl-unittest.h for OptiX (#1926)
Ugh, I broke the testsuite under OptiX a while back and it took me a
while to notice. When I added new unit tests for color[24] and
vector[24], I used the format() call, and that's not supported in
OptiX mode. But printf is, so in this patch, I fix it all up and
now the tests pass in OptiX.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-20 23:50:58 -08:00
Larry Gritz 4176a6f6f5 ci: Update ABI standard
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-16 10:16:49 -08:00
Larry Gritz 42ccf223af api: Switch to a 2-level namespace (#1922)
Related OIIO PR: https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4567

Like in the corresponding OIIO PR, I'm proposing switching to a
2-level namespace scheme (basically, `OSL::v1_14` instead of the
current `OSL_v1_14) because that opens the door to possible future
schemes to preserve better ABI compatibility between minor releases.

I would like to squeeze this in before I finalize a 1.14 beta, so that
it doesn't change again during the beta period.

Also, I changed some macro names.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-16 10:15:04 -08:00
Larry Gritz 5446c1d17f ci: break out reusable build steps (#1919)
Modeled after what we recently did for OIIO.

Now the new build-steps.yml contains all the logic for the sequence
of how to build and test for any configuration, and the main ci.yml
has the specifications of all the different testing configurations.

The different platforms share the same build steps, so there's a lot
less needless repetition (and opportunity for divergence and mistakes).

Also add MacOS 15 to the CI suite.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-15 10:41:01 -08:00
Larry Gritz 8d523a8170 ci: bump to latest version of upload-artifact action (#1915)
ci: bump to latest version of upload-artifact aaction

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-07 19:03:37 -08:00
Larry Gritz 635d156771 deps: Raise dependencies: cmake 3.19, OIIO 2.5, LLVM 11 (#1914)
Some last minute dependency adjustments before I cut a beta
for OSL 1.14.

* Raise CMake minimum to 3.19 (from 3.15). This is still very
  conservative -- 4 years old, even more lax than our usual "3 years
  back" rule.

  Raising to 3.18 matches OIIO 3.0, and compared to 3.15, it adds Cuda
  support as well as the `--debug-find` flag.  Further raising to 3.19
  -- which in 2025 seems prudent, even though it's beyond the version
  chosen by OIIO 6 months ago -- adds more helpful features, including
  presets, and Apple Silicon support.

* Raise OpenImageIO to 2.5 (from 2.4). The current release is 3.0, FYI.

* Bump LLVM minimum to 11.0 (from 9.0). This is a pretty conservative
  move, still gives several years of back support, but brings a little
  code simplification. I expect that next year's OSL will raise the
  LLVM minimum by several more versions.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-06 20:04:30 -08:00
Brecht Van Lommel 33173501ae fix: Link error on Windows due to shared symbols (#1918)
After reduction of shared dependencies in #1890, there is an unresolved
OSLCompiler constructor symbol when linking liboslexec. Avoid including
the oslcomp_pvt.h header that causes this.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2025-01-06 15:34:20 -08:00
Lukas Stockner 016a4689f8 Generate symbol derivatives for outputs when requested (#1916)
Signed-off-by: Lukas Stockner <lukas@lukasstockner.de>
2025-01-06 15:22:58 -08:00
Larry Gritz 71dd75945f admin: Sign release artifacts (#1913)
Closes #1857

Same approach that was taken by OpenEXR and OpenImageIO.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-01 22:52:41 -08:00
Larry Gritz b6055bf93e docs: Improve release related docs (#1911)
* Move RELEASING.md into the dev docs area
* Document signed release tags, which we will start doing now
* Document release note generation
* Add git-cliff config file
* Update SECURITY version documentation

Closes #1856

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2025-01-01 22:18:14 -08:00
Larry Gritz d18141619c build: add option for build profiling with clang -ftime-trace (#1909)
(Ported from OIIO)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-12-24 16:58:21 -08:00
Larry Gritz 6ea0a2f929 admin: Add code reviewing guide (#1908)
Ported from OIIO, with minor changes in some areas that differ between
the two projects.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-12-24 16:57:16 -08:00
Mitch Prater ac2402075e Updated README.md Documentation section. (#1907)
Updated README.md

Updated Documentation section with latest Siggraph course and companion repo links. Also added a sentence about the SWinOSL book.

Signed-off-by: Mitch Prater <mprater@laika.com>
2024-12-14 08:22:09 -08:00
Larry Gritz 6a5c866193 docs: Update some URLs to our new vanity URLs (#1902)
Also a little be of typo fixing and docs updating, mostly from
comparing to the same docs in OIIO and picking the more thorough
description.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-12-04 12:08:37 -08:00
Larry Gritz 541e870b0f ci: Fix broken CI for ASWF 2021 and 2022 containers (#1905)
Identical in spirit to the coresponding PR for OpenImageIO.

The background here takes some explaining...

The ASWF's prepared Docker containers that reproduce a CentOS7-based
environment corresponding to VFX Platform 2021 and 2022 years contain
a glibc that is too old to run a newer version of "node" -- which
GitHub Actions themselves use. The old one is no longer receiving
support, and GitHub finally changed the policy that was allowing its
GHA runners to still run the old version that worked with those ASWF
containers.  The new node version that is happy on the GHA runners
requires a glibc newer than the one in the containers. So that breaks
all our CI runs in 2021 and 2022 VFX Platform configurations.

See this thread, if you dare:
https://academysoftwarefdn.slack.com/archives/C0169RX7MMK/p1732574400981949

Anyway, Jean-Francois Panisset proposed and tested a fix, which lets
us continue working (for now) by downloading an old node implemenation
(which is happy with the old glibc) and installing it atop the
conainers, so it's this old one that the GH actions will use. It feels
like it's all held together by chewing gum and duct tape, but it
unbreaks our CI and hopefully it will keep working until all the
studios have switched fully to RHEL/Alma/Rocky 9.x and we no longer
care about testing on CentOS-7 based containers or supporting the VFX
Platform years that are too old to be relevant to the new OS that the
studios are using.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-11-29 09:22:27 -08:00
Larry Gritz bcb5adbc29 ci: Bump to latest upload-artifact action. (#1900)
The upload-artifact v3 will soon be retired.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-11-13 11:53:46 -08:00
Christopher Kulla 416410dae6 Add hair_chiang_bsdf closure definition from MaterialX (#1891)
Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-11-13 11:53:20 -08:00
Larry Gritz 453d25b290 ci: Various adjustments for OIIO 3.0 becoming the release (#1901)
Some of the changes are specifically related to OIIO 3.0 requiring
OCIO and raising the minimum version it needs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-11-13 11:52:04 -08:00
Tim Grant bda74950bc OptiX testrender overhaul (take two) (#1897)
This PR is a continuation of #1829, updated to include the recently added triangle mesh support. It enables full path tracing support for the OptiX backend in testrender. We have tried to share code between the CPU and OptiX backends where practical. There is more sharing in this PR than there was in #1829, which should reduce the maintenance burden a bit.
ID-based dispatch

Virtual function calls aren't well supported in OptiX, so rather than using regular C++ polymorphism to invoke the sample(), eval(), and get_albedo() functions for each of the BSDF sub-types, we manually invoke the correct function based on the closure ID (which we have added as a member of the BSDF class).

```
#define BSDF_CAST(BSDF_TYPE, bsdf) reinterpret_cast<const BSDF_TYPE*>(bsdf)

OSL_HOSTDEVICE Color3
CompositeBSDF::get_albedo(const BSDF* bsdf, const Vec3& wo) const
{
    Color3 albedo(0);
    switch (bsdf->id) {
    case DIFFUSE_ID:
        albedo = BSDF_CAST(Diffuse<0>, bsdf)->get_albedo(wo);
        break;
    case TRANSPARENT_ID:
    case MX_TRANSPARENT_ID:
        albedo = BSDF_CAST(Transparent, bsdf)->get_albedo(wo);
        break;
```

Iterative closure evaluation

Another key change is the non-recursive closure evaluation. We apply the same style of iterative tree traversal used in the previous OptiX version of process_closure() to the shared implementations of process_closure(), evaluate_layer_opacity(), process_medium_closure(), and process_background_closure().
Background sampling

We've included support for background closures. This includes an OptiX implementation of the Background::prepare() function. We've broken that function into three phases, where phases 1 and 3 are parallelized across a warp and phase 2 is executed on a single thread. This offers a decent speedup over a single-threaded implementation without the complexity of a more sophisticated implementation.

```
    // from background.h
    
    template<typename F>
    OSL_HOSTDEVICE void prepare_cuda(int stride, int idx, F cb)
    {
        prepare_cuda_01(stride, idx, cb);
        if (idx == 0)
            prepare_cuda_02();
        prepare_cuda_03(stride, idx);
    }
```

Tests

I have enabled the render-* tests for OptiX mode. I've added alternative reference images, since the GPU output exceeds the difference threshold on many of the tests. But in most cases the difference between the CPU and GPU output is very small.

---------

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2024-11-12 19:13:17 -08:00
Larry Gritz 0d3e9d2781 fix: Bugs in vector2.h, vector4.h, color2.h, color4.h, docs (#1892)
Fix a variety of typos in the 2- and 4-component color and vector
helper structs. Very embarrassing!

Also embarrassing, a typo in the docs had said that the way to
overload the `!=` operator was with a function called
`__operator__ne__` while actually, all along it had been
`__operator__neq__`.

Comprehensive test of color2, color4, vector2, vector4.

New testing header: testsuite/common/shaders/osl-unittest.h
This has utilities to make it easier to make unit tests for shader
functions in our testsuite.

Various other minor fixes to these headers.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-29 20:18:40 -07:00
Tim Grant 2a4c40199e Fix the OptiX path in testrender and testshade (#1896)
The recent free function change (#1852) put the OptiX paths in testrender and testshade in a non-working state (issue #1894). The bitcode for the free functions wasn't plumbed through for OptiX. This PR rolls the free function definitions into the existing "rendlib" bitcode and PTX. This is somewhat of a stopgap fix; eventually we'll want to handle the free function more explicitly.

Fixes #1894 

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2024-10-29 15:08:31 -07:00
Christopher Kulla 96745ede0a Update ABI reference hash for CI (#1893)
Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-10-27 20:29:48 -07:00
Christopher Kulla 35b12e4420 Reduce shared dependencies between liboslcomp and liboslexec (#1890)
* Reduce shared dependencies between liboslcomp and liboslexec by extracting some common utility functions to more standalone classes

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-10-27 16:57:11 -07:00
Larry Gritz cb082880ad build(deps): Adjust to OIIO changes to TextureOpt structure (#1888)
OIIO 3.0 changes the TextureOpt structure a bit, and we need to
adjust on the OSL end, too.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-25 08:54:36 -07:00
Larry Gritz 98adc799a1 test: Add another microfacet ref image for different fireflies at work (#1887)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-14 13:26:22 -07:00
Larry Gritz 4c1d4e9825 ci: Bump latest and bleeding edge versions, also build against OIIO 3.0 beta (#1886)
We'll eventually remove the dev-3.0 specific test, once that's the
release.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-13 17:27:52 -07:00
Larry Gritz 8e247c7f43 build(deps): Fixes to using OIIO::ArgParse for OIIO 3.0 (#1885)
OIIO 3.0 will finally warn aggressviely about some long-deprecated
ArgParse methods. Switch to the newer ones.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-12 20:50:01 -07:00
Larry Gritz 7210aa5ed0 deps: Add include to deal with OIIO 3.0 deprecations (#1884)
OIIO 3.0 shifs some things around slightly and requires us to
include fmath.h directly in a place where we had been inadvertently
relying on it getting included transitively (but now is not).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-12 17:04:32 -07:00
Larry Gritz 2c8c9d42d6 fix: Work around Imath UB in bvh code was problematic using icx (#1882)
The primary problem was that Imath's implementation of `operator[]`
took the address of just the `x` component and then used pointer
arithmetic. But that's undefined behavior in C++! Specifically, because
only vec.x is accessed, the compiler may see that .y and .z are never
accessed and not even bother materializing them in memory where the
pointer offset will access it. The fix (for now) is to cast to the whole vec
and take its address, which at least prompts the compilers to make sure
the entire vec is materialized in memory.

Once it was not failing with NaNs or infinite loops, there were still
3 tests that differed every so slightly in a few values for icx (more
lax math, maybe?). So had to add a few alternate reference images.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-11 11:41:11 -07:00
Larry Gritz ec26af3253 ci: fixup to broken clang-format test (#1883)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-11 10:32:58 -07:00
Larry Gritz 75d1ce2f41 ci: Update ABI reference
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-11 08:59:44 -07:00
Larry Gritz fabc3fbb7c Admin: Bump version after ABI changes of PR #1852
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-11 08:59:20 -07:00
Larry Gritz 172af6489b build: Prepare for OIIO 3.0 by replacing long-deprecated ASSERT (#1881)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-10-08 16:04:14 -07:00
Curtis Black 48c0b16c89 Free functions for texturing, point clouds, and trace (#1852)
Provides free function API for:

* rs_texture
* rs_texture3d
* rs_environment
* rs_get_texture_info
* rs_get_texture_info_st
* rs_pointcloud_search
* rs_pointcloud_get
* rs_pointcloud_write
* rs_trace

Each of these match the existing signatures of the renderer services equivalents. A new function rs_trace_get is added to retrieve trace results and is intended to replace getmessage("trace", ...) which is currently not available on GPUs.

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.

To make the pointcloud functions GPU friendly, they had to modified to not use variadic arguments and to avoid dynamic alloca.

---------

Signed-off-by: Curtis Black <curtis.w.black@gmail.com>
2024-10-08 13:52:05 -07:00
Maxwell Iverson a97387a50b feat: osltoy - Add command line and GUI ways to adjust include search paths (#1876)
For Dev Days

#1862 

Addressing a osltoy feature request, I've added the ability to specify custom search paths. 
The changes consist of the following:

- Added a command line option `-I <path>` to specify search paths (`OIIO::ArgParse` unfortunately can't mirror `OSLCompiler`'s `-Ipath` syntax)
- OSLToyMainWindow now stores an array of `OSLCompiler` options alongside a flag indicating whether or not they should be regenerated before compilation. The only option currently able to be specified is `-Ipath`, but this should ease any future extension.
- Added a GUI component consiting of a window with a mutable list of the current set of search paths. This list is initially populated with any paths passed via the command line, but any modifications to the list will be reflected when the shader is next recompiled. Modifying this list does not currently force recompilation.
- Added an entry to the Tools menu to open the new GUI component.
- Added a line of output to the error window indicating what options the compiler was invoked with. I've defaulted to having it print for every run, but this may want to only print on failure.

## Tests

I did not add any automated tests for this feature, as is consistent with the rest of osltoy. I did, however, do some manual testing to make sure the functionality works as expected.

Shaders that failed to `#include` some file instead succeeded when the parent directory of that file was added to the list of search paths via both the command line and the GUI component. Respectively, when said search path is then removed via
the GUI component, any subsequent compilation attempts fail again. The GUI component otherwise behaves as expected.


---------

Signed-off-by: Maxwell Iverson <miverson@imageworks.com>
2024-10-01 18:40:56 -07:00
Alexey Smolenchuk f769afd1e0 docs: Fix typo in stdlib.md (#1877)
Update stdlib.md

fix typo

Signed-off-by: Alexey Smolenchuk <alexey.smolenchuk@gmail.com>
2024-09-30 13:59:47 -07:00
Larry Gritz d65c589166 fix: prevent NaN from cropping up in testshade for icx (or anyone else) (#1874)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-24 21:36:39 -07:00
Tim Grant 185a3a8210 Fix testrender OptiX build (#1869)
* Adapt OptixRaytracer to use triangle meshes.
 * Refactor the accel build and pipeline creation.
 * Remove the old quad & sphere code.
 * Change globals_from_hit to use the mesh data.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Update the OptiX reference images. Also, fix the outdated output for test_str_ops, which has been broken since the change to string hashes.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* clang-format

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Fix build issue when using OptiX 7.0.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

---------

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2024-09-24 10:12:00 -07:00
Larry Gritz 35a4ef87f6 build: Support for LLVM 19 (#1873)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-24 08:25:49 -07:00
Larry Gritz d8c6f9a004 fix: Typo in dual.h made invalid template DualStorage (#1871)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-23 16:34:37 -07:00
Christopher Kulla 00473ce1b2 fix: anisotropic_vdf closure should not set IOR (#1870)
The MaterialX team noticed this issue here: AcademySoftwareFoundation/MaterialX#2016

Basically, if you add a medium through the anisotropic_vdf closure, it should not force the ior back to 1.0 as this IOR might have been changed by one of the microfacet closures. The IOR already defaults to 1.0 so cases that do not involve a microfacet closure are not affected.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-09-22 18:28:41 -07:00
Christopher Kulla 78e539204e feat: Modify testrender to work with triangle meshes (#1865)
testrender was originally envisioned as a tiny example renderer that should only handle spheres/planes. Over time several groups have expressed the wish for it to handle arbitrary geometry instead. This PR replaces the sphere and quad primitives with triangle meshes.

I am making use of the (embedded) rapidobj library to load models in the .obj format. The original .xml scene format remains, so that you can combine several models together as well as declare and assign the osl shader networks you want to these meshes. For backwards compatibility, spheres and planes are still supported via tessellation (you specify how many subdivisions you want). In the case of .obj scenes, the shader assignment can be done either by the mesh name or the material name.

I am submitting this to get the review kickstarted. The history of commits includes some fairly large test scenes that should be squashed away to go into the main repo. Files over 50Mb are recommended to use git lfs, but we probably want to figure that out as a different task (possibly handle it via a separate repo).

The handling of derivatives is not totally correct yet, but the behavior is compatible with the previous (incorrect) handling of derivatives we had before.


---------

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-09-20 16:56:31 -07:00
Larry Gritz 709c5ff6b2 ci: Deal with OIIO renaming its master -> main (#1867)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-18 16:29:46 -07:00
Sergey Sharybin 2fd6b384b4 build: Fix LLVM find package picking up system-wide libraries (#1866)
This change fixes LLVM find package ignoring the library path provided
by LLVM_CONFIG and picking up a system-wide library instead.

This happens when a custom LLVM is compiled statically, and there is a
system-wide LLVM of the version which OSL expects.

The solution is to pass NO_DEFAULT_PATH to the find_library so that
the function only considers paths explicitly coming from the LLVM's
configuration executable.

It is a bit unclear what is the expected behavior of this module when
LLVM_CONFIG is not available. It is possible to limit possible side
effects of this change by only ignoring default paths if the LLVM
CONFIG executable is found.

In practice this issue happened in Blender's build environment where
HIP is used for OpenImageDenoiser: HIP toolchain pulls in LLVM system
wide. While it is not an issue on itself (as it is only a compile time
dependency for HIP support in OIDN) in conflicts with the logic in the
OSL's find_package(LLVM).

Signed-off-by: Sergey Sharybin <sergey@blender.org>
2024-09-16 15:32:13 -07:00
Larry Gritz df49a401b0 ci: Advance ABI check commit after version bump
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-09 09:09:31 -07:00
Larry Gritz f598155c64 Bump version to reflect changes in major dependencies
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-09 08:41:22 -07:00
Larry Gritz 4686f6b7ea CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-09 08:40:55 -07:00
Chris Hellmuth 3ecfd64952 fix(gpu): Mock gpu pointcloud_search calls with empty custom attributes (#1859)
The GPU calling convention for variadic shadeops is to pass a pointer to the extra parameters as the op's final argument. Currently calls to osl_pointcloud_search don't follow this convention, so their ptx fails to compile due to argument count mismatches.

This PR doesn't implement the full correct behavior, it just adds a nullptr to the end of OptiX calls to osl_pointcloud_search. This makes everything at least compile, so scenes that have pointcloud operations can fail more gracefully on GPU (for now).

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-09-09 08:04:40 -07:00
Larry Gritz b472adccf1 build: Raise Python minimum to 3.7, pybind11 to 2.7 (#1855)
Drop Python 2.7 support.

Upgrade from very old cmake FindPython to findPython3, update idioms.

Simplify a lot of cruft that was supporting python2, as well as
supporting build features we don't use (long ago, I needed some
special library naming conventions at SPI, etc., that we no longer
use).

Change the module filename from "OSL" to "oslquery" to reflect that
it's only covering oslquery and make room for other python bindings in
the future.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-04 22:27:09 -07:00
Larry Gritz 7738e2366d Fix minor CI breaks after #1825
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-09-03 18:02:26 -07:00
johnfea bd71665232 feat(batch): Add support for b4_SSE2 batched mode. (#1825)
Add support for b4_SSE2 batched mode, enabling batched execution for all x86-64 CPUs that don't support AVX.

Quick tests were run to see that output with procedural and texture based materials looked ok and proper SSE2 batched code was being generated for wide/ functions. EDIT: Additionally, all tests pass now.

---------

Signed-off-by: Tuomas Tonteri <e90@tuomastonteri.fi>
2024-09-03 17:07:51 -07:00
Larry Gritz f5cfcc2862 ci: Add VFX Platform 2024 to CI (#1854)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-08-24 17:55:17 -07:00
Larry Gritz 2c7fbf30d7 build(deps): Raise Imath minimum to 3.1 (#1853)
Cull a whole lot of things that were necessarily only for
older Imath/OpenEXR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-08-23 18:09:39 -07:00
Larry Gritz 9f4aa5ee5d Adjust to OIIO change to IC/TS API (#1850)
Didn't catch them all in #1848 -- missed the BatchedRendererServices side.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-08-18 04:57:52 -07:00
Larry Gritz 5ee978dcd5 build(deps): Adjust to OIIO change to IC/TS API (#1848)
On the OIIO side, there's a PR in review that changes the ImageCache
and TextureSystem APIs to return shared_ptr instead of raw.
(https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4377)
This is destined for the upcoming OIIO 3.0 release.

This patch on the OSL side ensures that we build cleanly against both
OIIO 2.x and 3.0.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-08-17 09:10:40 -07:00
sfriedmapixar 28b71e7c85 fix(batched): Assume BatchedRendererServices texture derivatives are in st space. (#1828)
The convention in the single-point RendererServices is that the texture call returns
derivatives in st space, and they are transformed to xy space before returning
from the wrapper to RenderServices.  This change makes BatchedRendererServices
follow the same convention.

---------

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2024-08-15 10:58:32 -07:00
Larry Gritz f1aa00951b ci: unbreak CI for OIIO auto-build of OCIO for icx case (#1849)
Some explanation is needed:

OIIO master recently added the ability to auto-build OCIO when a new
enough one is not found at its build time, and bumped the minimum OCIO
to 2.2.

Sometimes this is triggered by OSL's CI, when OCIO < 2.2, so building
OIIO also triggers building of OCIO.

All fine, except for the case when we are testing Intel's icx
compiler, which OCIO's build system does not recognize and fails to
build. So we make a little modification here that lets us, just for
that case, ensure that OCIO is pre-built with gcc even though we're
building OIIO and OSL with icx.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-08-15 10:57:25 -07:00
Larry Gritz 269a8977ce build: raise C++ to 17, gcc min to 9.3, clang min to 5.0 (#1847)
It's time. This is for main (1.14), and will not be backported.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-08-14 09:15:01 -07:00
Larry Gritz b865cb0258 build: port set_utils and dependency_utils from oiio cmake scripts (#1845)
For those who didn't see this get added in OIIO land a few months
back, the highlights are:

* set_utils.cmake -- variable setting utilities, including
  replacements/wrappers for set(CACHE) and option() that have a few
  extra bells and whistles, including that they allow environment
  variables of the same name to override the default values.

* dependency_utils.cmake -- moved the prior contents of
  checked_find_package.cmake here, added more features, including...

* An end-of-config dependency report that prints which dependencies
  were found and their versions, which were found but were too old,
  which were missing.

* The skeleton of an automatic local dependency build facility.  The
  short story is that if a dependency is not found or is too old AND
  it can find a file called src/cmake/build_PACKAGE.cmake, it will run
  that file and expect it to download and build the dependency on the
  fly. I haven't added any of those scripts here yet, but on the OIIO
  side we already have a few to build certain critical dependencies.
  Future PRs to OSL will also add the missing pieces to build the
  dependencies.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-29 08:27:03 -07:00
Larry Gritz 64000b4c8f build: CMake: replace deprecated add_definitions with preferred add_compile_definitions (#1821)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-25 09:25:00 -07:00
Larry Gritz 3a42777a7c CHANGES updates
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-23 00:21:53 -04:00
Larry Gritz 074baf4bf2 fix: fix warnings and deal with recent OIIO deprecations (#1844)
* fix: Handle OIIO deprecations
* int: Use ustring::strhash if it exists (not Strutil::strhash)
   If it exists, ustring::strhash has some planned special properties.
* Deal with OIIO deprecations

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-22 07:05:05 -07:00
Larry Gritz 8913eed603 build: Make finding bison work better on Apple Silicon Macs + homebrew (#1822)
Homebrew changes location by default on the new ARM-based Macs.
Check the new paths, too.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-21 11:18:58 -07:00
Larry Gritz e4781703d5 cleanup: Some modernization of osl.imageio (#1840)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-21 11:17:37 -07:00
Larry Gritz 20461f1622 build: llvm 18 compat issue - include libclangAPINotes (#1812)
Fixes #1809

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-21 11:17:04 -07:00
Larry Gritz fe38c321e4 api: Switch shade_image to use current OIIO::paropt (#1843)
... instead of long-deprecated parallel_options.

This is an API compatible change because OIIO itself has a paropt
constructor that takes a parallel_options, and I'll leave that
deprecated but present for a bit longer in OIIO.

For the sake of link compatibility, we leave the old function defined
in shade_image.cpp, so this should not present an ABI change. We'll
remove the old version later when it's safe.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-11 13:53:03 -07:00
Larry Gritz 142426d62b cleanup: Switch away from a long-deprecated OIIO method (#1842)
cleanup: Switch away from some long-deprecated OIIO functions

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-10 20:33:17 -07:00
Larry Gritz 152bbc9386 Bump version to stage developer snapshot 2024-07-09 09:25:13 -07:00
Chris Hellmuth 7f3ff8ce38 fix: reparameter string needed to be ustringhash (#1841)
This patch fixes a regression that went unnoticed during the ustringhash conversion.

Right now OSL expects strings to be represented at runtime as ustringhashes, but interactive parameters' values are still being stored as ustrings. This requires fixing in two locations, first the code that sets the initial value of an interactive parameter, and second the code that copies updated parameters into the interactive buffer.

Tests: New reparameter-strings test.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-07-09 08:52:12 -07:00
Larry Gritz 27a8bdebca ci: deal with CentOS 7 EOL and disappearance of yum mirrors (#1839)
This was breaking CI for us. Hard break for icc/icx tests, since those
REQUIRED a yum install of the intel compilers. Softer undetected break
for all the ASWF <= 2022 containers based on CentOS 7, which were not
failing outright but were failing to install certain optional
packages.

The solution (for now) is to configure yum to exclude the missing repo.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-07 16:16:38 -07:00
Larry Gritz 0fd14170a8 cleanup: Switch away from deprecated OIIO function names (#1838)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-07 09:04:06 -07:00
Larry Gritz b0b3cf998e Fix GHA CI after they upgraded nodejs (#1837)
They upgraded to a version that requires a glibc newer than is in
the pre-2023 ASWF containers.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-07-06 22:35:14 -07:00
John Mertic 321c803d78 admin: Change release notice icon to use the icon vs the normal logo so it shows up better (#1777)
Signed-off-by: John Mertic <jmertic@linuxfoundation.org>
2024-06-25 11:58:12 -07:00
Larry Gritz b20a55e8b0 cleanup: OIIO deprecations (#1834)
Various minor changes to eliminate reference to some long-ago
deprecated OIIO items (mostly which simply alias to std versions)
before then disappear for real.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-06-23 21:05:18 -07:00
Larry Gritz 2362523726 ci: Mods to CI to deal with OIIO master raising dependency mins (#1833)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-06-22 22:24:41 -07:00
Larry Gritz 10f444f25d build: Default to C++17 mode (#1818)
This does not change the minimum C++ standard, which is still C++14,
even in main. But it does change the default in main to build in C++17
mode, and to get 14 you have to say so explicitly.

We do anticipate bumping the minimum before this fall's release, and
this is just a half step to get us ready. Maybe it will help shake
loose any compatibility problems and remind people on main that they
are using a branch that in a few months will have a new minimum C++.

This will not be backported to the release.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-06-22 16:50:56 -07:00
Christopher Kulla 65024b0e6a Implement OpenPBR's sheen BRDF (#1819)
Add Zeltner-Burley sheen BSDF as a new mode of the MaterialX sheen closure.

Simplify math for computing tangent frame aligned with a specified tangent vector.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-06-21 09:18:25 -07:00
Christopher Kulla 02e2bc3c73 Fix the subsurface_bssrdf parameters (#1823)
Fix the subsurface_bssrdf parameters to use effective color and radius instead of single scattering parameters

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-06-11 01:18:49 -07:00
sfriedmapixar b284a8b850 fix: make backfacing shadeop indicate backfacing shader-global is needed (#1827)
The backfacing shadeop now directly accesses the backfacing field
on the shader globals rather than calculating it from N and I.
This updates the shader-globals-needed query to reflect that
change.

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2024-06-10 09:43:49 -07:00
Chris Hellmuth ba775bf890 Remove unnecessary ustring lookup (#1824)
Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-06-07 08:47:38 -07:00
Larry Gritz 0d122e781c docs: Fixes to documentation of new oren_nayar_diffuse_bsdf parameters (#1820)
Fixes to documentation of new oren_nayar_diffuse_bsdf parameters

* The new parameter was explained, but not added to the function
  prototype in the docs.
* The semi-deprecated languagespec.tex was fixed, but it slipped our minds
  that we've shifted the docs to markdown for ReadTheDocs (the real place
  we should have changed was stdlib.md).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-06-01 18:47:57 -07:00
Christopher Kulla 9e3d7e4e50 Implement new Oren-Nayar model from OpenPBR (#1817)
* Implement new EON mode for Oren-Nayar closures (via an opt-in keyword arg for backwards compatibility)
* Add test for energy conserving Oren-Nayar (on half the sphere so we keep checking the old mode as well)

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-05-24 17:07:15 -07:00
Larry Gritz e0f7b4e115 testing: Update ref output for OptiX execution order variance (#1816)
Was spuriously failing tests only because on GPU, the points
didn't always execute in the same order.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-10 17:16:05 -07:00
Chris Hellmuth 056ba1802e Add lazytrace option to avoid combinatoric optixTrace inlining (#1815)
OptiX inlines all calls to optixTrace at module compilation time. Due to OSL's
lazy layer evaluation, if layer A calls layer B M times, and layer B calls
layer C N times, that can lead to M*N inlines of optixTrace if layer C contains
a trace operation.

In practice we've observed single trace ops being inlined hundreds of times,
leading to minutes-long shader compilations.

This patch adds a new option, lazytrace, to run layers with trace ops
unconditionally at the start of shader evaluation. This costs some potential
performance in cases where the trace layer would never be evaluated, but
removes all the compilation penalties that the inlining was presenting.

---------

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-05-09 16:48:01 -07:00
Larry Gritz f6b88b9053 fix: Fix testrender GPU regression with bad destruction order (#1814)
A few months back, PR #1733 seems to have switched the order that
testrender destroys the shading system versus the renderer (services).

This made some subtle bugs that were only symptomatic for GPU renders,
but it's because of the destructor order, where the shadingsystem's
dtr still references the renderer, which cannot be destroyed yet.

The clue is that the SS's constructor takes the RS pointer as an
argument. The RS, then, must have been constructed before the SS, and
therefore we should expect it to be a requirement for the RS to
outlast the lifetime of the SS. (Complex objects should be destroyed
in the opposite order that they were constructed, if they contain
references to each other.)

One code change is needed to avoid the sanitizer errors that the
incorrect change was originally meant to address: clear shaders when
SimpleRayTracer clears.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-08 16:19:50 -07:00
Larry Gritz bba9b353c2 docs: fix outdated or wrong repo URLs (#1811)
* Fix references to old OIIO home
* Fix embarrassing release notes generating script botch that
  accidentally used OpenImageIO URLs where OSL URLs were needed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-08 11:13:34 -07:00
Larry Gritz b859317915 cleanup: Switch some deprecated TypeDesc names to modern ones (#1806)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-04 21:58:44 -07:00
Christopher Kulla 3ff5d5d91d build: Remove remaining traces of boost (#1808)
Replace the last few uses of boost with robin-map (which is already a dependency for OIIO, although it is new for OSL itself) and functions in OIIO.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-05-03 18:20:56 -07:00
Larry Gritz eb9b08789c Suppress leak sanitizer warnings about internals of robin_hash (#1807)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-29 11:02:26 -07:00
Larry Gritz ca136d78a7 cleanup: change OSL_CONSTEXPR14 to constexpr (#1805)
We've been C++14 minimum for a long time now, we can just say constexpr.

Change a couple of stray OIIO_CONSTEXPR14 occurrences as well.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-29 11:02:13 -07:00
Larry Gritz bc55bed795 fix: Fix ifdef typo (#1804)
fix: Fix typo

This is the only way that makes any sense -- define OIIO_HIDE_FORMAT
if it ISN'T already defined.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-29 11:01:57 -07:00
Larry Gritz a21ba65a2c build: print commit hash of locally built dependencies (#1798)
Especially for our "bleeding edge" test that builds from the current
master of several dependencies, sometimes our tests fail not because
of anything we've done, but because of a change in one of the
dependencies.  To help track down exactly which change broke the
dependency, make sure our CI build logs print the specific commit hash
of those packages that we built.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-28 17:11:19 -07:00
Larry Gritz 312d79454e Add full LLVM 18 support (#1803)
Some methods and enums got renamed from LLVM 17 -> 18, etc.

Also some adjustment to warning messages about version mixing
between clang and llvm.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-28 17:10:56 -07:00
Christopher Kulla 33f24ec557 Remove the only use of boost::thread_specific_ptr (#1802)
Remove the only use of boost::thread_specific_ptr.

This had already been marked as deprecated, and there is concensus that the overhead does not outweight the slight inconvenience of creating one object per thread

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2024-04-28 17:10:32 -07:00
Larry Gritz 633b3d3599 ci: Lock down to OIIO 2.5 for icc tests (#1799)
Background: Intel's icc is essentially discontinued and we think all
the renderers using OSL have moved on to the newer icx, but Alex Wells
still likes to sometime use icc for its better facilities for some
SIMD code generation sleuthing that he does. So we keep it in our CI
matrix to esure we don't break it for OSL until it is truly
unavoidable or he doesn't feel like he needs it anymore.

Some recent changes to OIIO's simd.h, from PR 4187 in that project,
seem to tweak what appears to be a compiler bug in icc -- bugs were
also noted in OIIO in the course of this PR and some workarounds were
put there just for icc to make OIIO's own tests pass. Well, once that
went in, OSL's CI tests for the icc case also started failing.  It's
only texture derivatives that are broken, and in a weird wy that
smells like a compiler icc bug with SIMD generation similar to what we
discovered on the OIIO side.

Like I said, this is a discontinued compiler that no major renderers
are still using, so it doesn't seem worth tracking it down any further
to find a true fix. So let's just lock that one test case down to OIIO
2.5 (the current release) to avoid the changes that will eventually be
in OIIO 2.6/3.0 and hope that we fully retire icc before OIIO 2.5 is
no longer supported by OSL.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-27 10:01:38 -07:00
Larry Gritz 44fccbdda4 build: Propagate cpp version (#1797)
OIIO recently pushed its master to be C++17 minimum. When using a C++17-minimum OIIO, you need to build OSL with C++17 as well. This broke a couple CI cases for OSL.

There were a few spots where we were hard-coded to C++14 on the OSL side rather than even using the C++ version specified for the OSL build, so these are some fixes here to address this.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-17 19:44:37 -07:00
sfriedmapixar b6c8dde7b9 Make isconnected() work with downstream renderer "connections." (#1782)
The isconnected() returns 2 when used on an output that is connected to another downstream shader node -- this can be used to limit computation to only the outputs used.  However, that misses the important case of where the renderer has declared a shader node output as a renderer output, which happens often when using OSL purely for pattern generation purposes.  This change makes that case also return 2.

The isconnected test has been updated to include testing this functionality.

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2024-04-05 08:28:53 -07:00
Larry Gritz 477d979347 docs: More detail about supported platforms in INSTALL.md (#1796)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-04 12:36:15 -07:00
Larry Gritz a987aa9e8d oslquery: Simplify include and link needs (#1787)
The (should be) tiny oslquery library was over-including and
over-linking beyond its actual needs.

* Remove`#include <OSL/oslconfig.h>`, which is a lot of setup, type
  definitions, and many transitive header includes.  Instead, just
  include the very small number of headers and types actually needed
  by the OSLQuery class definition.
* In particular, this removes includes of OpenEXR/Imath headers and
  references to Imath types, the OIIO TextureSystem (!), and other
  big things, from what oslquery.h needs to see.
* liboslquery can link against libOpenImageIO_Util (which it uses
  primarily for ustring and TypeDesc), it doesn't need the full
  libOpenImageIO, since it doesn't read or write image files.
* Remove some link references to Boost which isn't actually needed for
  this library.
* This also lightens the load for the Python module for oslquery.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-02 17:33:06 -07:00
Chris Hellmuth 7fe43cec6e fix: GPU interpolated param initialization (#1791)
Currently, the GPU will crash when initializing non-string interpolated parameters with default values.

It looks like this is a regression from the ustringhash conversion in 12530f1 (#1732). I believe that before the phase 3 commit, we had global variables on GPU that we memcpy'd the defaults values from. Now after their removal, we're memcpy'ing from an illegal address.

As a proposed fix I removed the entire memcpy branch of the code and let interpolated parameters fall back to the default code path that stores the values directly. I'm open to instead guarding the removed block with "&& !gpu" making the patch have no effect on cpu, but leaned towards having unified code paths. Still, it's not an area of the code I'm very familiar with, any feedback would be appreciated.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-03-28 15:25:55 -07:00
Chris Hellmuth b08abb8d03 Use new OIIO ustringhash decode methods when available (#1792)
This eliminates some pointless and costly hash -> ustring round trips.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-03-28 15:23:50 -07:00
Larry Gritz b210ab4def cleanup: Change long-deprecated OIIO macro to new one (#1788)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-25 16:37:58 -07:00
sfriedmapixar fefeb5a099 fix: Print closure missing error message at compile time instead of run time. (#1781)
Prevent complications on the GPU by printing error messages at compile time instead of generating code to print them at runtime when a closure doesn't exist.

---------

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2024-03-09 14:34:17 -08:00
sfriedmapixar 4738a0fdf5 fix: calculatenormal needs fliphandedness (#1783)
* Have OSL indicate when it needs fliphandedness in shader globals.

* Add testsuite test to check that calculatenormal() triggers a globals_needed flipHandedness value.

---------

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2024-03-08 15:39:50 -08:00
Larry Gritz 0ed60f93ba ci: Allow triggering CI workflow from web (#1779)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-07 20:55:08 -08:00
Larry Gritz 50f3adf0f8 ci: Fix broken Macos-13 CI (#1780)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-07 20:54:04 -08:00
Larry Gritz 6432f9bb87 build: Remove a lot of old SPI build cruft (#1778)
Sweep away some SPI-specific build customization that hasn't been
relevant for a long time.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-07 20:52:56 -08:00
Alex Wells baa9a093b6 fix(batched): codegen bug for compref with varying index (#1776)
Fix bug in batched codegen of compref when the index is varying.
The loadvalue was left to defaulted to uniform load, which we can't store into a varying/wide result.
Fixed similar bug in getmessage, and added check for spline knotcount to be uniform (although varying support could be added).

This bug exposed a missed optimization in BatchedAnalyser where a early out (return) needs to change the conditional to be varying to support masking.  However no check was being done to see if the loop control existed higher in the callstack.  So now the execution scope tracks loop nesting depth to see if the current function is really in a loop or not.  This allows the loop control flow to remain uniform (avoiding masking and more complex control flow).

Added nestloop-reg to testsuite to reproduce bug and verify its fixed.

---------

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2024-03-02 09:23:23 -08:00
olegul 58aec3decf fix: Mute partio error prints (#1774)
Signed-off-by: Ole Gulbrandsen <olecgi@gmail.com>
2024-02-29 11:47:35 -08:00
Larry Gritz 5d666faf5e ci: Increase timeout for slow MacOS-13 runner (#1775)
We didn't change anything on our end, but in the last few days, I
believe the GHA MacOS-13 runners have slowed done somehow, and so now
a few test are failing only because they don't complete within the
ctest timeout period for "small tests". So this just bumps up the
limit on this runner platform to allow the tests to pass.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-29 10:20:04 -08:00
Larry Gritz 8468d7dae7 docs: Clarify behavior of round() (#1767)
Pointed out in MaterialX discussions, our spec was not clear what
round() should do in cases where the input value is exactly half way
between two integers. Our design (and implementaton) uses "round away
from zero" policy for that case, matching C/C++ standard round(). But
we were not clear about it in the docs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-24 11:45:15 -08:00
Larry Gritz 86fd9f9082 ci: Test with Mac ARM runner (#1770)
Tweak results for ARM tests that have minor numerical differences and
update references.

Set parallel build level to nprocs+2 instead of hard-coding to be
better for the new runners having more cores than they used to.

Speed up macosx build of deps by using unity build of OIIO.

Fix runtest, was clobbering parameters to oiiodiff

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-24 11:44:54 -08:00
مهدي شينون (Mehdi Chinoune) bdf9f24f2a build(deps): Initial support for LLVM-18 (#1773)
Signed-off-by: مهدي شينون (Mehdi Chinoune) <mehdi.chinoune@hotmail.com>
2024-02-24 11:44:26 -08:00
Larry Gritz 77ceebb335 build: add options to use static Cuda libraries (#1772)
* New build option `CUDA_PREFER_STATIC_LIBS` tries to use Cuda's static
  libraries if they can be found.
* Remove code related to nvrt library, it's no longer needed in OptiX 7.
* Changes in checked_find_package to allow a PREFER_STATIC_LIBS
  optional argument. Turns out we didn't use this, but I think it's
  useful functionality to keep now that I've written it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-20 17:11:28 -08:00
Larry Gritz e8a5c1f737 ci: Reset ABI compatibility reference commit
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-15 13:37:59 -08:00
Larry Gritz b206b16054 Bump version to reflect ABI compatibility change
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-15 13:37:17 -08:00
Thibault Vergne 7316669cd4 feat(api): Add API for building interpolated getter free functions. (#1765)
Adds a new RendererServices API build_interpolated_getter which allows for building custom free functions that provide values for interpolated datas.

The new API is involved at material compilation time and allow the developers to provide specialized functions leveraging the information known at compile time. It will allow for many optimization opportunities for the compiler by replacing runtime branch with direct memory reads.

This PR is a followup to the API build_attribute_getter proposed in this PR: #1704

TestShade provides an example implementation showing how this compile time information can be used to select an appropriate function to use as the attribute provider, and how to configure the function signature.
Since the feature is enable by default when rs_bitcode is used, the existing testsuite ensure the feature is generating the same result as the previous API.

---------

Signed-off-by: uedaki <thiver.96@gmail.com>
2024-02-15 13:31:46 -08:00
Larry Gritz becc03d390 docs: Fix links to RTD docs from github landing page (#1768)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-15 13:29:31 -08:00
Larry Gritz 35820fc99b admin: Switch release announcement workflow to jmertic's awesome action (#1766)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-01 10:30:50 -08:00
Tim Grant 8a1242f75b fix: Fix NVPTX TargetMachine leak, etc. (#1763)
* Delete the NVPTX target machine in the LLVM_Util destructor.

* Initalize m_nvptx_target_machine to nullptr.

* Workaround clang/CUDA12 texref issue.

* Remove the unnecessary null check before deleting the NVPTX TargetMachine.

---------

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2024-01-22 22:23:51 -08:00
Larry Gritz d4b372b1bb fix(build): Remove unused ustrings (#1764)
A recent change in OIIO master made some of the ustring methods
"trivial", and somehow that makes these variables warn about being
unused, which it did not do before.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-18 14:00:43 -08:00
Larry Gritz 7fd9c3f88c admin: git blame ignore for recent formatting change
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-09 20:36:27 -08:00
Larry Gritz a9ce35135e style: Reformat with clang-format 17 (#1761)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-09 20:34:21 -08:00
Larry Gritz efd139aef8 style: Raise our formatting standard to clang-format 17 (#1761)
We had been using clang-format 14. Bump to 17 as our official
reference standard for formatting.

Moved the clang-format CI test from an aswf container to bare Ubuntu
to make it run faster -- it doesn't need to do a real build, so
there's no point wasting 2 minutes or so downloading a container holding
library dependencies it won't need.

Also fix a duplicate line in .clang-format that newer clang-format
complained about.

Document that it's specifically clang-format 17 that is our formatting
standard

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-09 20:34:21 -08:00
Larry Gritz 378f056033 ci: test against LLVM 17 (#1760)
Bump the "bleeding edge" test to LLVM 17, the "stable latest releases"
test to 16.

Cover clang 17 compilation with MacOS-13 build

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-09 20:21:06 -08:00
Larry Gritz f4f3342857 admin: Account for duplicate emails in the .mailmap (#1759)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-28 13:18:30 -08:00
Larry Gritz 70a9beb912 ci: Bump ABI reference commit for 1.14
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-20 22:56:21 -08:00
Steena MonteiroandLarry Gritz 12530f115d api: Ustringhash phase 3 (#1732)
Move OSL library functions and remaining execution time interface from ustring to ustringhash.
Intent is all code for cpu or device just use ustringhash only.  This allows us to remove
STRING_PARAM, ustringrep, and OSL_USTRINGREP_IS_HASH.  All interfaces and library code
should explicitly use ustringhash or ustring,
or for library functions llvm can call ustringhash_pod or ustring_pod

Compile time strings used in the OSL Library are represented in strdecls.h
and will be available as ustring variables in the Strings namespace as well as
available as unstringhash constexpr variables in the Hashes namespace.

Compile time strings used by the Renderer should adopt a similiar strategy as
exemplified by TestShade which keeps its strings in rs_strdecls.h
and made available as ustring variables in the RS::Strings namespace as well as
available as unstringhash constexpr variables in the RS::Hashes namespace.

Added helper utility functions to generate ustring from ustringhash_pods

Constant string arrays: Previously, array copys required copying data via address
of symbol on host. To enable working on device, replaced memcpy with array allocation
and loading of values. Constant arrays are now present as
global arrays in final llvm module.

On the Batched side compatability/integration:
Batched OSL Library functions continue to use ustrings (not ustringhashes to reduce scope/risk).
Batched OSL library functions that call their scalar counterparts were adjusted
to pass arguments as ustringhash_pods and store results as ustrings

STRING_PARAMS, device_string.h, and string_hash.h: Built-in strings on the CUDA side are now accessed via Hashes namespace, instead of STRING_PARAMS and are
evaluated as ustringhashes. Similarly, DeviceString, StringParams, HDSTR are obsolete, and device_string.h is eliminated.
Hashes.h, which only contains OIIO's strhash and pvtstrlen functions (both formerly in string_hash.h), replaces all inclusions of device_string.h. Namespace Hashes in hashes.h
contains pre-compiled ustringhashes representing strings from strdecls.h.

Texture, dictionary, closure: Helper implementation functions are used by both scalar and batched versions. However, since scalar uses ustringhashes and
the batched version uses ustrings added a flag to inform functions on treating TypeDesc::STRING has either a ustring or a ustringhash

testing: Added testing of bitcode rendereservices for unoptimized OSL shader.
array-copy tests regression: Added new test to verify copying of arrays of unequal lengths

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Deleted liboslexec/string_hash.h

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Modified rs_get_attribute to use OpaqueExecutionContext and ustringhash.
 Changed example programs--testshade, testrenderer, and osltoy--to use device friendly constexpr (RS|OSL)::Hashes and (RS|OSL)::Strings
 variables with rs_strdecls.h vs constructing ustrings on the fly.

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Fixed clang format issues; added uint64_t casts for constant64; removed unused variable; added array-copy to testsuite

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Fixed clang format issues in llvm_instance.cpp

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Added fix in llvm_assign_impl for assignment of non-constant scalar to an array

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Fixed clang-format in simplerend.cpp.

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Addressed review comments -- (1) Added ll.constant(ustring().cstr()) in llvm_gen and batched_llvm_gen and (2) Added comments for boolean arguments that indicate ustrings are treated as hashes

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Addressed comments on Optix build failures

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Resolved merge conflicts

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Fixed clang-format

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Fixed split-reg for batched

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

* Replaced llvm_load_stringhash with llvm_const_hash; Changed format string to ustringhash_pod in osl_printf, osl_fprintf, osl_warning, osl_error stubs; Fixed ShaderGlobals' position, u, and v in optix_grid_renderer.cu.

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>

---------

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2023-12-20 22:29:40 -08:00
Larry Gritz 253c4105ed After 1.13 branch, reset main for 1.14 development
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-20 12:39:55 -08:00
Larry Gritz cf31311c3a Stage for v1.13.6.0 (readjusted for main)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-20 12:33:00 -08:00
Larry Gritz 3d52f3906b build: handle case where OIIO uses a different Imath than OSL (#1758)
This can come up if, for example, you build an OIIO using a static
Imath library that's more recent than what you're forced to use for
your OSL build. (Don't ask, you don't want to know.) So we need
to see half.h before we include any OIIO headers. But it's the OIIO
headers that adjudicated where we get half.h from, so we need to
be a little more explicit in, of all places, rend_lib.h of testrender.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-03 00:32:42 -08:00
Alex Wells e154a220b6 fix(build): Partio build errors on pointcloud functions for MSVC (#1757)
Fixes #1755: Build error on MSVC with Partio

Explicitly mark unsupported/unused PointCould copy/move constructors and assignment operators as deleted.
Change SortedPointRecord index type from int to uint32_t and add static_cast during construction to avoid a warning.

Change SortedPointRecord index type from uint32_t to Partio::ParticleIndex to handle 64bit indices (where we can)
clang-format changes

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2023-11-27 18:57:40 -08:00
Rasmus Bonnedal da8f2be156 build: Fix struct align/pack for MSVC (#1754)
Signed-off-by: Rasmus Bonnedal <rasmus.bonnedal@gmail.com>
2023-11-20 13:56:04 -08:00
Alex Wells bc864771df build: refactor icc/icx specific pragma macros (#1756)
Added OSL_INTEL_CLASSIC_PRAGMA(...) which only emits for Intel(r) Classic C++ Compiler, previously OSL_INTEL_PRAGMA did that.
As many Intel compiler specicif pragmas are now supported by icx and icc,
redefined OSL_INTEL_PRAGMA to emit for the classic and llvm based Intel compilers (icc and icx).
Updated some uses of OSL_INTEL_PRAGMA to OSL_INTEL_CLASSIC_PRAGMA as appropriate.

Fixed long icx 2023.1.0, 2023.2.0, 2023.2.1 build times for certain files by removing the "-mllvm -inline-threshold=100000" flag for all but 1 file avoiding the overhead of optimization passes being applied to inlined code that wasn't actually part of the SIMD loop that we truly needed inlined.  icx now supports "#pragma forceinline recursive" which allows us to target just the SIMD loops to be inlined (as we did for icc).

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2023-11-20 13:54:22 -08:00
Larry Gritz b38487532d ci: Test ABI compliance (#1748)
This patch adds a new test to the CI matrix: verifying that we do not
break the ABI during releases. This is based on similar work done a
couple months ago in OpenImageIO.

Basically, in addition to building the current checkout, it also
builds a checkout of the designated "ABI standard" (generally, the
first non-beta release of a major version), then generates ABI dumps
of both versions and runs the ABI compliance checker using the tools
from https://github.com/lvc

Making two builds sounds expensive, but both builds are rigged to be
minimal, since only the libraries are needed for ABI checks (we can
turn off the binary tools, unit tests, python bindings, etc.), and of
course the test suite need not run. So actually, it's less expensive
than most of the test matrix entries, and it helps ensure that we
don't accidentally break ABI when we don't mean to.

I'm not sure how many false positives we'll have. We might need to
adjust the methodology slightly as we gain experience with this.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-17 15:27:53 -08:00
Larry Gritz 7985893a76 build: Better cmake verbose behavior (#1752)
When we bumped to cmake 3.15 minimum recently, we changed lots of
constructs like this:

    if (VERBOSE)
        message (STATUS "blah")
    endif ()

to this:

    message (VERBOSE "blah")

but I didn't realize that this was not enough, and to do it right
requires CMAKE_MESSAGE_LOG_LEVEL. So even when VERBOSE=ON, we weren't
actually getting all the verbose messages. Here, we fix it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-17 12:50:11 -08:00
Alex Wells 58ae6a1551 fix: batched pointcloud if "index" is not passed (#1753)
Fixes #1750

Batched shading crashes in point_cloud search if "index" is not passed as an attribute.
Fixed by allocating space for indices on stack before calling into underlying search algorithm which requires them (thus crashed if not provided).

Added 2 new tests to exercise it with no indices provided and with indices array provided but not long enough.

    testsuite/pointcloud/rdcloud_varying_mismatch.osl
    testsuite/pointcloud/rdcloud_varying_no_index.osl

Added alternative test results for
testsuite/pointcloud/ref/out_rdcloud_varying_mismatch.macos.tif
testsuite/geomath/ref/out.icx.alt.txt

Format change for wide_oppointcloud.cpp

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2023-11-17 11:44:05 -08:00
Rasmus Bonnedal 9320db9f2a testrender: Fix wrong offset of MxSheen param (#1751)
Signed-off-by: Rasmus Bonnedal <rasmus.bonnedal@gmail.com>
2023-11-15 16:42:10 -08:00
Larry Gritz 4d39f8099f admin: Fix typo in slack-release-notifier version (#1749)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-01 19:50:56 -07:00
Larry Gritz 41a45b68ea docs: Regenerate PDF docs before 1.13 release (#1747)
This is probably the last time we'll regen the PDF docs, since we
are mid-transition to ReadTheDocs. We will probably not directly
distribute a PDF version with 1.14 or subsequent releases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-27 15:18:51 -07:00
Larry Gritz 8374278a07 ci: For clarity, use the term 'runner' instead of 'os' (#1743)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-27 14:13:33 -07:00
Larry Gritz 78b861f34a ci: Skip analysis and scorecard workflows on push if only docs changed (#1744)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-26 18:04:40 -07:00
Larry Gritz 7710b1be46 fix: SymOverrideInfo bitfields should be the same type (#1745)
Stephen Friedman alerted me to the fact that on Windows, bit fields
within a struct will only be combined if they are the same type.  We
were a bit sloppy in the defintion of SymOverrideInfo, and that was
causing the struct to end up a different size in Windows.  I think the
solution is that all those bit fields should be `unsigned int`.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-26 15:50:17 -07:00
Larry Gritz 0e55efbd99 ci: Disable MacOS-11 CI (#1746)
The MacOS 11 CI seems to be broken on GitHub's runners. I'm not sure
why, but since it's old and getting various deprecation warnings from
Homebrew and GH, I'm inclined to just disable it rather than work hard
to keep this old version of the OS running.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-26 15:49:27 -07:00
Larry Gritz 0d4c343759 docs: First stab at ReadTheDocs (#1736)
Convert the LaTeX docs to Sphinx + Myst Markdown extension

I think this is in decent shape. It's going to need a lot of thorough
proofreading to ensure that thing got lost or mangled on the way from
the original docs. I suspect we will have several follow-up PRs to fix
thing.

After we're reasonably happy with it, we'll eventually remove the
.tex and the pdf.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-05 12:10:57 -07:00
Larry Gritz 9636c8c66c admin: Update pull request template (#1741)
It gave a VERY old link to the SPI CLA, which we no longer use.  In
fact, because we have CLA enforcement through the CLA bot, there is
not really a need to have it in the checklist... nobody can forget.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-05 10:20:01 -07:00
Larry Gritz 784bf53e88 admin: Alert slack "release-announcements" channel upon OSL release (#1740)
Add a GHA workflow that is triggered up on drafting a release, which
will echo a notice to the ASWF slack `#release-announcements` channel.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-05 10:19:13 -07:00
cdfec4f31d LLVM 16 and 17 support (#1730)
* Bump minimum supported LLVM version to 17
* Rename `makeArrayRef` to `toArrayRef` to avoid `llvm::makeArrayRef`
  deprecation warnings.
* Minor required changes related to `llvm::Align`.
* Disable `initializeInstrumentation` and `createPruneEHPass` which
  were remove and appear to serve no purpose now.
* Add assert when using default optimization levels with legacy pass
  manager, which is no longer supported.

This depends on both opaque pointers and new pass manager support.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Keep CMAKE_CXX_STANDARD warning for LLVM 16

* Enable LLVM 17 too, adjust for changes in new pass manager PR

* Fix OptiX data layout mismatch with LLVM 16+

i128:128 was already in the NVPTX backend since LLVM 6, the docs
this was taken from seem outdated. Unclear it started failing now,
but the data layout seems clearly incomplete without this.

* Modify CI to run the bleeding edge test on LLVM 16

* Manually make global variable names valid for PTX

* Fix build with older LLVM

---------

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Tim Grant <tgrant@nvidia.com>
2023-10-03 19:26:30 -07:00
Larry Gritz 3567aac515 build(deps): Raise OpenEXR min to 2.4 (#1734)
Only for OSL 1.13. Will not be backported to the current release.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-03 10:47:54 -07:00
Larry GritzandBrecht Van Lommel 00ea8a80fd build: Bump Cuda minimum to 9.0 (#1737)
Based on Brecht's tests, we realize that OSL doesn't work at all with
Cuda 8.0 (which didn't support the C++14 that we use), so we're
raising the minimum to 9.0. And there are some flaky tests with 9 and
10, so we're making the recommended minimum be 11.0.

It's not our policy to change the minimum versions of dependencies on
release branches, but I think we should backport this to the release
branch. I believe what this change is doing is not removing actual
support for old versions, but rather, correctly documenting what has
been working (or not) for quite some time.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2023-10-02 22:39:26 -07:00
Brecht Van Lommel a95116f793 ci: Fix python-oslquery test failure on macOS (#1739)
Use the absolute path to the Python executable to avoid picking up
a different executable with the same version.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2023-10-02 22:37:31 -07:00
Brecht Van Lommel b8a100e427 ci: Fix GPU job not actually enabling OptiX (#1738)
In #1668 USE_OPTIX changed to OSL_USE_OPTIX, but CI was not updated.

Also fix use of CPU SIMD flags for compiling CUDA bitcode

---------

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2023-10-02 22:34:49 -07:00
Brecht Van Lommel 0210c88374 testing: Fix tests passing when test commands fail (#1733)
PR #1563 accidentally changed tests to accept failing commands by
default. (This seems to have been a mistake -- a temporary change
added when debugging that LG neglected to remove before submitting
the PR.)

This can cause tests to pass even though the program crashed, when
a previous run created the correct output file.

---------

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2023-09-28 15:17:34 -07:00
Brecht Van Lommel baca4c2de6 LLVM new pass manager support (#1729)
LLVM 16 removes support for default optimizations levels (O1, O2, O3)
from the legacy pass manager, which are used by OSL. This adds supports
for the new pass manager while keeping the legacy pass manager working
for older LLVM versions.

* Enable new pass manager for LLVM 15+
* Both default and custom optimization levels have been implemented
* But the performance and correctness beyond passing tests has not been
  verified
* `ptx_compile_group` still uses the legacy pass manager

* Fix unecessary alias analysis and wrong #endif placement

* Fix LLVM 16 compatibility

* Ensure running prevent bitmasks pass is reentrant, and initialize once

* Make compiling with the new and legacy pass manager mutually exclusive

LLVM 17 removes even more legacy pass manager functions. With these
changes LLVM 17 works as well.

* OptiX fix, avoid using legacy pass manager for opt command since it does
not support default -O levels anymore

* Only enable new pass manager for LLVM 16+

---------

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2023-09-28 12:00:54 -07:00
Brecht Van Lommel e4766b4516 LLVM opaque pointers support (#1728)
* LLVM opaque pointers support

New LLVM versions require opaque pointers, that is you can no longer tell
from a pointer value which data type it points to.

* Remove deprecated GEP and op_load methods without type, and refactor
  code to always pass the type.
* Add element type argument to op_scatter and op_gather.
* Eliminate pointer type comparison which no longer work with
  opaque pointers.
* Keep interactive params marked as uniform in batched analysis, so
  we can deduce uniform/varying correctly from just the symbol
* Enable opaque pointers on LLVM 15, except when using OptiX

OptiX opaque pointers were not tested yet and left disabled. It is
likely broken due to the sneaky conversion in
`BackendLLVM::llvm_store_value` between `int64` and `char*`, but we
can no longer compare the pointer type. This function is called from
many places and it's unclear to me when this happens.

According to a4e779c4 this code is only temporary, so this may resolve
itself as the ustring refactoring gets completed.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Fix debug_uninit and pointcloud batched testsß

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Variable renaming and comment for clarity

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Add/restore debug names for groupdata access

Make batched backend more consistent with the regular backend.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Rename scalar_type to component_type

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Alternative interactive param fix based on feedback from Alex

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* OptiX fixes

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

* Use opaque pointers only for LLVM 16+

To avoid potentially breaking LLVM 15 with OptiX.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>

---------

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2023-09-27 22:09:15 -07:00
Larry Gritz f00da4f788 RS::get_texture_info make robust to empty shaderglobals param (#1731)
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.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-25 19:55:09 -07:00
Alex Wells e327241a30 fix(batch): Fix Force LLVM Boolean (#1717)
Fixes #1716:  Crash assigning boolean expression to int in batched mode

Modifying BatchedAnalysis::establish_symbols_forced_llvm_bool to excluded renderer outputs to fix the issue.
Added new test compassign-bool to recreate the issue and verify it is fixed.

Comprehensive Fix for Issue 1716:  Crash assigning boolean expression to int in batched mode

Rearchitected BatchedAnalysis::establish_symbols_forced_llvm_bool to track a BoolStatus per Symbol evaluating all operations that write to the symbol. Only if all ops that write to it always produce a logically boolean result will the BoolStatus be set to Yes.

There is another set of ops that could produce a logically boolean result if their inputs were also boolean.  In that case the BoolStatus is set to Maybe and its input symbols tracked (as they may not have a known BoolStatus yet) and deferred for a follow on pass.

After the initial pass is made, if there were any deferred Symbols, we can check their dependencies to see if they have a known BoolStatus and we can set the Symbol's BoolStatus to Yes or No depending on those input dependencies.  If the BoolStatus of any dependencies is still Unknown, we just defer it again.  We continue making passes over deferred Symbols until we have established a known BoolStatus for them all.  Afterwards we use forced_llvm_bool(true) on the Symbols where BoolStatus is Yes.

Improved support for storing forced_llvm_bool Symbol values by automatically converting from int->bool and then a vector of bools (mask) to the platforms native mask type (might be vector of integers on platforms without native mask support).

Fixed bug in BatchedAnalysis where arrays of closures were not being marked as varying, only closures where.
Allow GroupData to hold actual boolean or native mask data type vs. integers when a Symbol is forced_llvm_bool.
Improved batched GroupData layout calculation to use llvm offset and alignment calculations based on the actual DataLayout (might consider upgrading the scalar code gen to do the same).

Fixed bug where results of partial results from RendererServices::get_userdata allowed initops to execute unmasked effectively overwriting the results from RendererServices::get_userdata.  Issue stemmed from op_useparam not being modelled properly by BatchedAnalysis.

Added new test compassign-bool to recreate the issue and verify it is fixed.
Added new test closure-layered to recreate the issue and verify it is fixed.
Added new test userdata-partial recreate the issue and verify it is fixed.

Fixed bug in analysis of forced_llvm_bool for getattribute, whose return value is always a bool but result parameter when it is an integer should NOT be forced_llvm_bool.
Added test getattribute-shading to recreate the issue and verify its fixed.

Added testsuite/getattribute-shading/ref/out-scalar.txt to support builds that exclude batched.

---------

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2023-09-21 08:11:39 -07:00
Larry Gritz a569d4f0be CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-15 12:47:56 -07:00
Larry Gritz 46250b4c10 build(deps): Raise minimum CMake dependency from 3.12 to 3.15 (#1724)
This bump brings access to the following interesting features (not a
comprehensive list):

- 3.13  Nov 21, 2018

    - -B, -S let you specify source and build directories without the "cd" dance
    - target_link_options()
    - ctest --progress / CTEST_PROGRESS_OUTPUT

- 3.14  Mar 14, 2019

    - cmake --build now supports -v/--verbose
    - file(CREATE_LINK )

- 3.15  Jul 17, 2019

    - env CMAKE_GENERATOR can be used instead of -G
    - when using --build, the --target can now list multiple targets (and also can be `-t`)
    - --install can be used separately without running through the whole build
    - message() now supports NOTICE, VERBOSE, DEBUG and TRACE.
    - CMAKE_FIND_PACKAGE_PREFER_CONFIG variable
    - Enable C++20 for Apple Clang

Make sure all CI cases have a new enough cmake

Use message(VERBOSE ...) feature to simplify lots of `if` blocks.

Clean up code for older cmake versions

Freshen some of our CI build_<dependency>.bash scripts.

Note that this will NOT be backported to the current release branch,
but it will be part of the upcoming 1.13 family of releases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-15 09:20:02 -07:00
Larry Gritz e235661479 Change RendererServices::get_texture_handle back to ustring (#1726)
We were overzealous in switching everything to ustringhash.  The
filename argument to get_texture_handle should allow taking a ustring.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-12 10:45:11 -07:00
Larry Gritz fdc0579931 The recently added SS::find_symloc can have const args (#1723)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-12 10:44:30 -07:00
Chris Hellmuth d4faecd79d perf(gpu): Move qualifying GroupData params onto stack (#1710)
On SPI Arnold, we are seeing GroupData as a bottleneck for GPU performance. Regardless of whether the buffer is backed by local or global memory, it's off-chip and slow to access.

This change moves qualifying parameters out of the GroupData struct and onto the stack. On GPU this makes those parameters more likely to be stored in registers, leading to better performance.
Qualifying parameter details

The qualifying parameters are all the output parameters minus three exceptions.

A typical output parameter's lifetime is scoped to the execution of the instance it is associated with. The parameter is initialized at the beginning of instance execution, accessed during the body of the instance, and after the instance body its final state is broadcast to all its downstream connections. This lifetime makes output parameters a good fit for stack storage.

The three exceptions:

  - output parameters can be connected upstream and written to before instance execution
  - output closures are initialized at the beginning of shader execution
  - output parameters can be renderer outputs and read after instance execution

These are all identifiable at code generation time and can be flagged as disqualifying.

Improvements

On internal scenes, this change improves performance by about 15% on GPU. On CPU there aren't any performance regressions, but we don't see significant gains either. It also improves ptx generation and compilation by about 10%, and slightly lowers our memory footprint due to the GroupData size reduction.
Tests

Exceptions 2 & 3 are covered by existing tests. A new test is added for exception 1, and for the case of successful optimization. This patch was also run through our internal shading testsuite.

---------

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-09-11 10:06:30 -07:00
Tim Grant f449749f24 OptiX PTX pipeline overhaul (#1680)
## Description

This PR is an overhaul of PTX compilation in OSL. The goal is to minimize the size of the generated PTX to help reduce time spent in subsequent stages (e.g., module creation, pipeline linking, etc.).

### rend_lib

The main functional change is in how the functions defined in rend_lib.cu are handled. In the current setup, rend_lib.cu is compiled to a standalone PTX file using nvcc. The functions are considered `extern` in generated shaders, and the dependencies are satisfied when the final pipeline is linked together. Since the functions are `extern`, they are not available for optimization when each shader is generated. This prevents the inlining of small functions, which incurs a lot of function call overhead in terms of PTX size and run-time cost.

So instead of compiling rend_lib.cu separately, it is compiled to LLVM bitcode along with the rest of the "shadeops" sources. This bitcode is used to seed the LLVM Module for each shader. This makes the definitions available when each shader is being generated and optimized, which allows the optimizer to make better decisions. It also allows for better control of inlining decisions which affect the size and quality of the generated PTX.

### shadeops

Another significant functional change is in how the shadeops functions (including those defined in rend_lib.cu) are treated. In the current pipeline, each shader must carry along with it definitions for all non-inlined shadeops functions that are used. This bloats the size of the PTX for each shader, and results in many duplicate copies of those functions existing in the final linked pipeline.

In the new pipeline, the unified shadeops+rend_lib bitcode is compiled to PTX using the offline `llc` tool. This PTX is used by the renderer to create a single "shadeops" module that provides the definitions for those functions. This makes it possible to drop the definitions for those functions from the PTX for each shader, which can significantly reduce the size of the generated PTX.

### quirks

This PR contains some interesting "quirks" which are largely fallout from compiling rend_lib.cu using clang instead of nvcc:

- The clang-generated PTX is processed by a Python script to transform some function & symbol declarations to better match what was generated by nvcc. It might be possible to add the right decorators to the C++/CUDA code to get the correct visibility for these symbols, but I was not successful in doing so.
- It was necessary to change the function signatures for some of the rend_lib functions to use `void*` instead of the actual OSL types (e.g., `OSL::Color3*`). Trying to use the actual types produces an LLVM assertion failure, for reasons that I don't understand.
- I have enabled flush-to-zero (FTZ) for clang-compiled code, to better match the behavior of nvcc. I added a CMake variable to enable or disable FTZ in the event that somebody wants to disable it.
- I have added some alignment hints on pointer accesses in rend_lib.cu. clang does not appear to be able to deduce the alignment of pointers in many cases, which turns things like `memcpy` and `memset` into long series of byte operations. Functions like `osl_get_matrix` are bloated substantially if the hints aren't provided.

---------

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2023-09-08 13:03:32 -07:00
Larry Gritz 8c2d8c03b4 Fix default fmt logic changing in latest openimageio release (#1725)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-05 18:37:28 -07:00
Larry Gritz 373e359b49 build(deps): Raise minimum OpenImageIO version to 2.4 (#1722)
This is just for future-looking OSL 1.13 releases, it won't be
backported to the 1.12 release branch.

Remember that by the time we release OSL 1.13 as a supported release
family, OIIO will also have done its annual release, of 2.5. So our
minimum of OIIO 2.4 means that we will be supporting the current
release, as well as the prior year's release (and, of course, we
always stay compatible with OIIO's trunk as it evolves). So we're
really keeping compatibility with 3 major releases, which seems like
plenty to juggle.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-03 18:50:36 -07:00
Curtis Black 7afd948737 feat: Add API for building attribute getter free functions. (#1704)
Adds a new RendererServices API build_attribute_getter which allows for building custom free functions that provide values for attributes, effectively replacing both get_attribute and get_array_attribute.

This new API is invoked at material compilation time to allow render developers to provide specialized functions capable of taking advantage of known compile time information. This will allow for many optimization opportunities, such as replacing run-time map lookups with direct memory reads from known locations, remove brancing required for checking if derivatives are needed, branching on type-conversions if required, etc.

This PR currently implements this approach for attributes, a future PR could do the same for user-data.
Tests

TestShade provides an example implementation showing how this compile time information can be used to select an appropriate function to use as the attribute provider, and how to configure the function signature.

---------

Signed-off-by: Curtis Black <curtis.w.black@gmail.com>
2023-09-01 09:44:44 -07:00
Larry Gritz 473bbfcdbd ci: Fix broken CI from new OIIO that needs newer cmake and openexr (#1719)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-26 14:23:49 -07:00
Tim Grant 05f4acee5b fix: Add missing members to ShaderGlobals in rend_lib.h (#1721)
* Add the missing thread_index and shade_index members to the copy of ShaderGlobals in testshade/cuda/rend_lib.h.

* Reorder the ShaderGlobals members in rend_lib.h to match the definition in shaderglobals.h.

---------

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2023-08-25 14:33:07 -07:00
Larry Gritz a4e779c44f fix: Handle mixed string casting that plagues optix codegen (#1718)
The string situation is still a bit tricky on the OptiX side.  There's
a full overhaul of that coming separately as we continue to shift to
an all-ustringhash world.

But in the mean time, we were getting some testsuite failures that
were because of a mismatch between times we think of a gpu-side
ustring as a char* and when it's a uint64. IN FACT, they are always
the hashes, but we backed ourselves into a corner where sometimes that
64 bit pattern is passed around as a pointer, ugh.

This small patch attempts to catch this case and just do the
appropriate cast to compensate. It's a band-aid, a more comprehensive
fix is coming, as I said.

This gets us down to just ONE filing optix test case, which I will
tackle separately.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-23 21:11:49 -07:00
Larry Gritz 271f8bc30e fix: Recent journaling changes break with some fmtlib versions (#1715)
Certain fmt library versions don't automatically know how to format
atomics. Explicitly load them to turn into regular ints to avoid new
build errors introduced by the recent journaling changes.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-22 17:47:52 -07:00
Larry Gritz 9e30a4e6df ci: Lock down icx version (#1706)
Intel's servers have again updated the default icx that you get when
you install from their yum repository, and the new one seems
incompatible with our libstdc++ toolchain. So lock down on 2023.1.0
for now so that our CI can pass.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-17 23:00:34 -07:00
Larry Gritz 3df1aa2f98 docs: Move logos and add an icon-only logo (#1707)
Move from cryptically named ASWF/images to more descriptive ASWF/logos.

Add an icon only version of the logo.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-17 23:00:04 -07:00
Larry Gritz afc44289fc ci: Simplify build_llvm.bash script (#1703)
* Remove leftover logic from when we used TravisCI.
* Pick a default for LLVM_DISTRO_NAME so it works when the script is run
  standalone when not on GitHub Actions CI.
* Switch the logic about file location to enumerate only the couple of
  old versions that uses the old download location, rather than trying
  to enumerate an ever-growing set of modern releases that use the current
  download location.
* Comment o say that when LLVM 10+ is the floor, the old case can go away
  entirely.

Also bump the CI "bleeding edge" test to use LLVM 15.0.6.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-17 22:59:08 -07:00
Larry Gritz 3bf59982e5 Restore stubs for printf (fixes OptiX problems with 1702) (#1711)
The recently merged PR 1702 fails all the OptiX tests. I tracked down
the problem and it's that the patch was a bit too aggressive about
removing things no longer needed. The intent was that even if you
don't use the new journaling, nothing should break. But it does break
for OptiX, and this patch restores some of the functions 1702 removed
(like the implementation of osl_printf) and some other necessary
stubs.

This takes us from failing all ~150 OptiX oriented tests to failing
only 4, which I believe are unrelated to 1702 and are merely revealed
by them. I will fix those in a separate PR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-17 21:12:54 -07:00
Steena Monteiro cce40c38b8 Rs fmt specification - Journaling Algorithm for error, warning, fprintf (#1702)
* Journaling Algorithm for error, warning, fprintf

Removes dependence on ShadingContext and OIIO for logging error, warning, printf, and fprintf calls
for use on CPU and device, and tracks logging calls per thread index and shade index.
All calls to shader execution track thread index; ShaderGlobals contains shade_index (for processing
fmt specification calls) and thread_index for allocating memory per thread.

* Add new customization points in RendererServices for reporting errors, warnings, printf, and fprintf.
These customization points accept a fmtlib style format specifier (vs. printf style) whose argument types are represented as EncodedTypes (encodedtypes.h) and can be subsequently decoded via a utility function.

Removes dependence on ShadingContext and OSL::ErrorHandler for logging error, warning, printf, and fprintf calls
for use on CPU and device during Shader execution.  ShadingContext and OSL::ErrorHandler remain utilized during shader compilation/JIT.

Journal Buffer approach:  each thread gets its own chain of pages within the shared journal buffer for recording errors, warnings, etc.  By maintaining a separate chain per thread we can record errors (etc.) in a non-blocking fashion. Shade index is recorded for use by error reporter to sort messages but it is not used at present.
Using a Journal buffer is up to a Renderer.  The Renderer use the new customization points (rs_errorfmt, rs_filefmt, rs_printfmt, rs_warningfmt or their virtual function equivalents) to interact with a journal::Writer and journal buffer owned by its RenderState.  The Renderer would of have to allocate and initialized the journal buffer with the requested page size and number of threads before executing a shader. After a shader is done executing, the contents of the journal buffer can be transfered back to the host and processed with a journal::Reader, which reports them through a journal::Reporter's virtual interface. Intent is for Renderers's to use the Journal buffer and provide their own overriden version of the journal::Reporter.  Testshade provides example usage.  For legacy purposes, the default virtual RendererServices will route errors to ShadingSystem's OSL::ErrorHandler, but intent is for Renderer's to switch over to using a Journal buffer or their own custom logging.

NOTE:  OSL library functions as well use Renderer Service free functions can directly call OSL::filefmt, OSL::printfmt, OSL::errorfmt, OSL::warningfmt which wrappers to the underlying free functions (who may record the messages into a journal buffer).

Added a new hashcode datatype in typespec.cpp; represented as "h" in function arguments in builtindecl.
To print closures added a new OSL function osl_closure_to_ustringhash to return a ustringhash_pod value directly.

Shader execute functions now require a zero-based thread_index to identify the calling thread; used for journalling.
RendererServices::get_texture_info parameter ShadingContext * changed to ShaderGlobals * (aka ExecutionContext).

ShaderGlobals now tracks both shade_index and thread_index.
As we look to hide/remove ShaderGlobals in the future, we still need a context object to replace the role the ShaderGlobals struct is currently serving (just minus the actual shader global variables).  As a first step towards this goal, we introduce the concept of an ExecutionContext and OpaqueExecutionContext.  These just alias to ShaderGlobals currently, but start to establish the idea of hiding its contents.  Instead of direct memory access to the ExecutionContext/ShaderGlobals new getter functions have been added that accept an OpaqueExecutionContext and provide the requested data.  When inlined there should be no performance penalty, and reliance on the ShaderGlobals implementation detail will be reduced.  IE:
    inline const Vec3 & get_P(OpaqueExecContextPtr oec);
    template<typename RenderStateT> RenderStateT* get_rs(OpaqueExecContextPtr oec);
    inline int get_raytype(OpaqueExecContextPtr oec);
Updated free function renderer services and opcolor to use the ExecContext, but left the rest alone to minimize size of this PR.

We introduce opfmt.cpp that provides shim function for llvm_gen to call, where the shim adapts datatypes from llvm to c++ forwarding calls to the free function renderer service error, warning, print, fileprint functions.

Split llvm_gen_printf into llvm_gen_printf_legacy, for string format calls or when using optix, and the new llvm_gen_print_fmt which will convert the printf style specifier to the fmtlib format that the Renderer Service customization points are expecting.

fprintf by default no longer writes out to a file, is routed to journal::Reporter::report_file_print which could be overriden (example in TestShade to maintain existing behavior).  However for security reasons, we do not recommend allowing OSL shader's direct file system but instead just an annotated log entry.

To maintain existing behavior of disallowing output of repeated errors/warnings over a history window, we have provided 2 classes that could be used during reporting: TrackRecentlyReported and Report2ErrorHandler.  TrackRecentlyReported can turn on/off limitting errors and warnings and control the history capacity.  Report2ErrorHandler simply reports errors to an existing OSL::ErrorHandler to allow for easy integration.  However we expect Renderers to not use Report2ErrorHandler and provide their own to directly interact with their logging systems.


---------

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>
2023-08-17 16:31:34 -07:00
Larry Gritz 1863d04edc admin: Add missing copyright notice to many files (#1708)
Our latest license scan from LF reveailed that the usual copyright and
license declaration was missing on many shader source files in
testsuite. This was never intentional, it was simply overlooked for
certain test files. Just add the standard notice to those files.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-17 15:36:16 -07:00
Brecht Van Lommel 06c42d5c18 fix(build): duplicate osl lexing symbols when building as static libraries (#1709)
Like other oslcomp source files that are duplicated in oslexec, this
duplication should only be done for shared library builds where the
symbols are hidden from each other.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2023-08-11 00:06:25 -07:00
Larry Gritz 8dae508b4f docs: Update logos (#1705)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-20 22:00:58 -07:00
Alejandro Conty b4f0517f0c fix: Zero derivs for interactive params when needed (#1700)
Sometimes an interactive param is used in a way that gets
flagged as needing derivs. But we were neither allocating space
for that nor zeroing them. This resulted on memory corruption.

This fixes incorrect renders in a production context where params are
often tagged as needing derivs.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2023-06-20 10:50:42 -07:00
Larry Gritz 5e10537608 ci: Switch OIIO dev-2.3 branch to using v2.3.21.0 tag (#1701)
OIIO's 2.3 family is obsolete and no longer updating, so we removed
the branch marker. (Branch markers should always indicate places where
development may happen.)

But we still reference that named branch in a couple places for OSL's CI,
so just replace it with the immutable tag of the last release in the 2.3
family.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-19 13:15:02 -07:00
Larry Gritz 4962ac2a1b fix: Avoid deprecated OSLQuery ctr in test example (#1699)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 17:47:12 -07:00
Chris Hellmuth 1956e83954 gpu: OptiX direct callable API that owns groupdata buffer (#1683)
On gpu, the renderer currently owns a shader's groupdata params buffer so that it can pass its pointer to both the init and entry functions.

The downside of this approach is that in order to avoid dynamic memory allocation, the renderer must commit to a buffer size at build time. Using a conservative size to accommodate potentially large shaders can lead to gigabytes of unnecessary memory footprint.

This patch adds a new OptiX direct callable alternative to the existing init and entry callables. This new function allocates a perfectly-sized groupdata params buffer, so that the gpu only pays for the memory it needs, and then it calls init and entry.

Particularly large shaders can require larger buffers than there is space on the cuda stack. To handle this case, there is a new option, "max_optix_groupdata_alloc". Any shader requiring a groupdata buffer larger than this value will not allocate its own buffer, and instead use the pointer passed in by the renderer (presumably coming from a global memory pool).

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-06-14 13:04:02 -07:00
Larry Gritz 50ccc8736f docs: Amend the filmography (#1695)
docs: Update the filmography

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 11:09:42 -07:00
Larry Gritz 6a5c50e3f3 build: Fix for Apple clang 14+ warnings (#1697)
build: Fix for Apple clang 14 warnings

Add a MacOS 13 test to the CI matrix.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 11:09:05 -07:00
Larry Gritz 49aac8740d fix: Have ReParameter only copy data when it changes (#1698)
For GPU in particular, this prevents needless transfers to the device
when no values actually change.

Also, keep track of some statistics about how much ReParameter is
being used. (Which also help to verify that this change works as
intended.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 11:08:22 -07:00
Larry Gritz c06df65331 ci: Add VFX Platform 2023 tests using new ASWF containers (#1696)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-13 14:59:15 -07:00
Alejandro Conty 4e9e640e5b fix: Don't try to ReParameter symbols not in the group (#1693)
Sometimes, after optimization, symbols tagged as interactive
get removed because they are unused. But ReParameter is failing
with errors because it goes looking for the removed symbol to
master, which is, of course, not interactive. This patch avoids
that so the symbol is not found and we just return false.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2023-06-09 10:34:13 -07:00
Mitch Prater b76a53a779 docs: Fixed booboos from the previous README commit. (#1694)
Fixed booboos from the previous commit.
2023-06-09 08:58:41 -07:00
Mitch Prater 4e958e92c1 docs: README.md: added filmography and Siggraph OSL course info. (#1692)
Updated README.md to include LAIKA films and added Siggraph OSL course info to Documentation.
2023-06-06 16:38:08 -07:00
Larry Gritz 188ec977a5 build: Changes to support fmt 10.0 (#1691)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 18:25:53 -07:00
Larry Gritz 417088e91a docs: Update CONTRIBUTING (#1689)
Tighten up some of the explanations and update obsolete parts of the
CONTRIBUTING document.

This doesn't change any of our policies or procedures. But some advice
was out of date or no longer applicable (for example, now that we use
clang-format, we do not need to detail all the formatting rules, they
are enforced automatically).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 07:35:52 -07:00
Larry Gritz 16d217a21f ci: Fix package name for icc (#1690)
The Intel yum repo renamed this package a couple weeks ago, and it
broke our CI. Update to the new name.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 07:31:41 -07:00
Larry Gritz 6a2e2960ef admin: Fix incorrect links in CONTRIBUTING (#1688)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-25 16:53:37 -07:00
Chris Hellmuth 606beade27 testing: interactive parameter initialization in optix testrender (#1687)
This change updates testrender's optix implementation of reparameter,
and adds a new test.

Previously we were grabbing the pointers from incorrect SBT records, so
this moves them into a global lookup table.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-05-25 16:41:48 -07:00
Larry Gritz 71a9310f0b feat(gpu)!: GPU/OptiX support of ReParameter (#1686)
BREAKING CHANGE: to RendererServices ABI (including for CPU) and to
the renderer-side setup when using OptiX.

This overhauls the implementation of how interactively-editable
parameters work, where they live in memory, and get it all working on
GPU/OptiX so that renderers can support interactive adjustment of
those params without recompiling shaders.

The basic gist is as follows:

* We continue work to finish making a clean separation between
  "interpolated" parameters and "interactive" (editable) parameters.

* Interpolated params are collected and put into a separate memory
  area -- a separate per-group allocation on both the CPU and GPU
  (where applicable). It needs to remember the offset into this arena
  where each of the interpolated parameters resides. These allocations
  and eventual release are taken care of by the OSL shading system,
  they live in the ShaderGroup. When the group is set up, this block
  of memory is initialized with the correct initial values of the
  params and are ready to go.

* The implementation of ReParameter writes to this special memory
  area also, that's how it works now (both CPU and GPU).

* How does the OSL library know how to allocate, free, and copy to the
  device memory? It doesn't! Instead, we add new RendererServices
  methods `device_alloc()`, `device_free()`, and
  `copy_to_device()`. It's up to the renderer to provide those, so
  that the OSL library doesn't itself need to know about the Cuda
  runtime. These are trivial, there's really only one implementation
  that makes sense, and you can copy it from the ones in testshade and
  testrender.

* Interactive parameters are NOT constant folded during runtime
  optimization.

* The shader entry points themselves now take an extra parameter in
  the main call -- this will be the pointer to the beginning of the
  shader group's interactive parameter arena.

* When JITing, references to interactive parameters know to retrieve
  them from their designated offset into the interactive parameter
  area.

* This means that the renderer-side OptiX/Cuda code is responsible for
  adding this extra pointer parameter to the call to the shader entry
  points. You can see how this is done in the testshade and testrender
  Cuda code.

* It's up to the renderer to figure out how to make the OptiX hit program
  aware of the interactive parameter pointer for that particular material,
  in order to pass it to the osl shader entry point. The way I did it in
  testshade and testrender is using a field in the struct that's given
  to each entry of the shader binding table and can be retrieved on the
  OptiX side via optixGetSbtDataPointer(). In testshade/testrender, a
  data pointer already existed which wasn't used. In a real renderer, you
  may need to add a field or come up with whatever other way you want
  to somehow get this pointer, which can be retrieved via

      shadingsys->getattribute(shadergroupptr, "device_interactive_params",
                               TypeDesc::PTR, &myptr);

  you can see how I do that in optixraytracer.cpp (testrender) and in
  optixgridrender.cpp (testshade).

A number of other things you will see that's worth calling out:

I added a device_ptr utility template that is just a wrapper around a
device side pointer that makes it hard to accidentally dereference it
on the host side.

Since I was changing RendererServices anyway, I also remove unused
register_global, fetch_global, global_map which were unused. They were
leftovers from the way we handled strings in OptiX 6.x.

Encapsulate cuda global symbol name mangling into
BackendLLVM::global_unique_symname(). I did this early on, turns out
it wasn't necessary, but I still like that encapsulation, so I'm
keeping it.

I bumped the 3rd set of digits in the version to reflect that the
changes in RendererServices break ABI. This is only in main, it
obviously cannot be backported to a release branch.

All tests pass for scalar and batch and optix.

I added a new simple reparam test, and renamed the old reparem to
reparam-array. Oddly, the reparam-array test doesn't work properly on
optix (it had never been tried before), but it also failed in optix at
main -- so it's not related to this patch! Putting that on my list of
other oddities to investigate later. It may just be a quirk of
testshade, I'm not really sure yet.

Added to BackendLLVM (and batched) a llvm_ptr_type(TypeSpec) method
that returns the LLVM type of a pointer to the specified type.

Note: This patch doesn't account for the face that a parameter marked
"interactive" could prevent a shader from correctly building for the GPU
because it used the kind of construct that is fine in shader source code but
only will work on GPU if it can be resolved to be a constant by the time
we get done with the runtime optimization (as pointed out by Stephen
Friedman. We'll come back to the problem later with a more robust and
automatic fix -- and if we are lucky, Stephen will have the opportunity to
upstream the approach he already has.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-23 13:25:28 -07:00
Pascal LecocqandPascal Lecocq 5c49a7c6b5 fix(optix): fix userdata derivatives for interpolated params on GPU (#1685)
Following #1657, it turns out we forgot to zero initialize the userdata derivatives for the optix path.
This leads to some rendering glitches caused by the memory garbage left in those derivatives.

Signed-off-by: Pascal Lecocq <pascal.lecocq@gmail.com>
Co-authored-by: Pascal Lecocq <plecocq@imageworks.com>
2023-05-20 11:25:03 -07:00
Larry Gritz abdc966a19 Give ShadingSystemImpl a handy use_optix() method (#1682)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-10 21:48:46 -07:00
Larry Gritz 374543f040 cleanup: switch deprecated oiio simd names to modern (#1679)
Oops, I noticed that OSL was still using deprecated OIIO::simd type
aliases (float4, int4, bool4) instead of the modern vfloat4, vint4,
vbool4.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-10 14:06:53 -07:00
Larry Gritz 089268b87d build(cmake): Fix incorrect variable name to control symbol visibility (#1681)
As Fabrice Macagno pointed out on the oiio-dev mail list, we weren't
setting the correct variable name CMAKE_CXX_VISIBILITY_PRESET.

And, oops, this also revealed that there were some things that needed
to be declared public that were not (because, specifically, they
needed to be called across library boundaries by the per-ISA dynamic
libraries used by batch shading!).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-09 19:25:00 -07:00
Larry Gritz 74b2b30669 refactor: Get rid of needless error check (#1677)
This was apparently something I put in to track down a possible
llvm-side problem many years ago. I haven't seen the error message in
recent memory (and it was only enabled at SPI anway), so I guess it
was a red herring or has long since been fixed. Get this cruft out of
here.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-09 18:24:03 -07:00
Larry Gritz 91699ba7d3 docs: Update (and typo fixes) to project intake checklist (#1676)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-06 08:27:49 -07:00
Larry Gritz 4afe9244e8 Remove extra pdf file that should not have been checked in
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-02 18:35:18 -07:00
Larry Gritz ed9857c416 build: Change cmake option USE_OPTIX -> OSL_USE_OPTIX (#1668)
This avoids some possible confusion with other projects, or if this
is built as a subproject.

Also, change from the C++ side having an OSL_USE_OPTIX defined -- only
for building OSL itself -- to having it always defined in oslconfig.h
and set to 0 or 1 depending on whether OptiX support was turned on at
build time. This allows app-side use of OSL headers to know if it's
dealing with an OptiX-capable OSL build.

Clean up OSL_USE_OPTIX and OSL_USE_BATCHED symbol defs

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-02 18:02:59 -07:00
AidanWelch cd22f602a4 Docs: Improve documentation of trace function (#1671)
Improve the documentation of optional parameters of trace to more accurately describe behavior.

Signed-off-by: Aidan Welch <aidan@freedwave.com>
2023-05-02 15:09:39 -07:00
Declan Russell 17d211a3d3 Fix constant float values being converted to ints (#1674)
This issue was caused by 8c52d48 . The problem is that the constant float values are being turned into ints. The PR restores the previous behavior and preserves the float format.

Note from LG explaining:

When outputting the oso and using fmt library to write the value, {} (equivalent to {:g}) prints the "simplest" text representation that, when re-parsed as a float, will give you the SAME binary float value. So the "true" value of -9.99999996e+11 is printed as -1000000000000, which when reparsed will give you the closest float to that, which is the original value. (Remember that the value of -1e12 is not exactly representable as a float.)

But if both will parse to the same float, why does the shader print -2147483648.000000 instead of -999999995904.000000? That's the interesting part.

The answer, and the real core of the problem, is that when we parse the oso file it sees -1000000000000 and thinks it's an int, lexically. Now, once it gets to figuring out what to do with that, if the initial value of a float parameter looks like an int, it's still no problem, it will convert the int to the equivalent float.

Except that in this case, because the text that looked lexically like an int is out of range for a 32 bit int, it gets INT_MIN, so by the time it's converted back to float, it's -2147483648.000000

Your fix works (at least in this instance) because it forces the value to print in a way that lexically can only be a float and not an int.

Signed-off-by: Declan Russell <declan.russell@autodesk.com>
2023-05-02 10:46:28 -07:00
Declan Russell 20299563ee build: Fix builds when USE_PYTHON=OFF (#1675)
This issue was caused by 5efe15a. Essentially, we now use Python_EXECUTABLE to execute the serialize-bc.py script. Therefore, we have to run find_package(python) so that the Python_EXECUTABLE variable gets setup.

Signed-off-by: Declan Russell <declan.russell@autodesk.com>
2023-05-02 09:23:35 -07:00
Alejandro Conty 5600d020a0 Fix userdata binding corner case (#1673)
This includes two fixes:

 1) When registering symbols that need user data, sort the entries in
 the set so the layer number is ignored. A needed udata iteam shouldn't
 depend on the layer and separating them makes find_userdata_index()
 sometimes find an index with different derivs status.

 2) osl_bind_interpolated_param() is memcpy'ing derivs that might not
 be there, yielding corrupted derivs and possibly a crash.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2023-04-24 10:59:10 -07:00
Chris Hellmuth 37f4bbc1a2 Make recent run-layer optimizations optional, and fix init ops-related false positive (#1672)
My initial implementation of the run layer check optimizations didn’t account for the fact that init ops for symbols have their llvm code generated before we build basic blocks from the OSL IR.

This caused the code to be wrong in two ways: 1) the set of known run layer calls was being reset between instances too late in the pipeline, so a useparam inside an init op would actually be checking the previously compiled layer’s set, and 2) even when reset earlier, it assumed valid basic block ids existed for the init ops when they did not.

So, if a layer had a useparam inside one of its init ops that generally matched the same code location as a useparam in the previously compiled layer, the run layer check could be incorrectly omitted.

I’ve updated the code so that the default optimization behavior is reverted to the way it was before #1665, and added a new option opt_useparam that can be turned on to enable a fixed, restricted version of the optimization that only applies to code in the main section.

I'm working on a test that properly triggers the issue.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-04-20 10:37:46 -07:00
cmstein b13b7f08b0 fix for ReParameterization corner case (#1670)
Take into account whether a parameter can change due to interactivity
when comparing parameters for "mergeability".

This proposed patch fixes a corner case we were seeing during live rendering with ReParameterization.

We were experiencing a problem when ss->ReParameterize() wasn't successfully applying parameter changes for us.

In our situation, a shader's parameter, "A", was marked with lockgeom=0 (ie. "live" or "editable") and was set via ss->Parameter(). This parameter was connected (through a series of copies and network links) to another shader's parameter, "B", downstream whose initialized value (ie. the one specified in the .osl/.oso file) matched A's set value. When this happened, A's shading layer was getting marked as "mergeable" and deleted, and we wouldn't see any updates to A via "reparameterization" take effect.

Signed-off-by: Clifford Stein <cstein@imageworks.com>
2023-04-13 11:22:45 -07:00
Chris Hellmuth 7ebfbc4a05 Apply recent run layer call optimization to batched execution (#1669)
Copy-paste the run layer call checks from #1665 into the batched execution mode.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-04-12 09:43:56 -07:00
Larry Gritz e402988611 Fix type ambiguity that was giving warnings (#1667)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-04-11 16:24:05 -07:00
Larry Gritz 88be276ec1 Clean up OptiX comments (#1666)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-04-11 16:14:51 -07:00
Curtis Black 6f1fedb08d Add type information for needed attributes. (#1650)
We can currently query which attribute names and scopes are requested in a shader. This PR extends that idea to also allow querying the attribute types. This now more closely matches the equivalent available queries for user data.

For example, this shader:

```
shader Shader
{
  color c;
  getattribute("user_color", c);
  
  string s;
  getattribute("user_string", s);
}
```

allows us to do this:

```
int nattr = 0;
if (shadingSys->getattribute(shaderRef.get(), "num_attributes_needed", nattr) && nattr)
{
  // this already works
  OIIO::ustring* names = nullptr;
  shadingSys->getattribute(shaderRef.get(), "attributes_needed", OSL::TypeDesc::PTR, &names);
  
  // this is the added feature
  OIIO::TypeDesc* types = nullptr;
  shadingSys->getattribute(shaderRef.get(), "attribute_types", OSL::TypeDesc::PTR, &types);
  
  // nattr: 2
  // names: ["user_color", "user_string"]
  // types: [OIIO::TypeColor, OIIO::TypeString]
}
```

The motivation behind this feature is to perform additional type validation at material compile time when determining what primvars can be provided to the shader.

One side-effect of this change to be aware of is that, as mentioned in the code comments, if the same name is requested multiple times with different types, it will now be reported multiple times. Hopefully this is not too much of an issue as the same behaviour also occurs when an attribute is requested in multiple scopes, or when user data is requested with multiple types.

Signed-off-by: Curtis Black <curtis.w.black@gmail.com>
2023-04-10 18:38:59 -07:00
Larry Gritz 0bd014cfe2 Switch lockgeom to interpolated and interactive (#1662)
* Switch lockgeom to interpolated and interactive

Establish two new metadata hints about shader parameters:

  - "interpolated" means that the parameter comes from the geometry
    somehow and may be bound with a different value at different
    points on the surfaces, or different values for different
    primitives that share the material. This corresponds to concepts
    known variously as "geometric primitive data/variables", "user
    data", or "vertex variables", depending on the renderer.

  - "interactive" means that the user desires the parameter to be
    allowed to change when the scene is interactively rerendered,
    without incurring a full recompile of the shader. (Variables not
    so marked might still be capable of being changed, but not
    necessarily without a re-JIT of the shaders.)

Both of these require that the parameter not be fully constant-folded
or optimized away during runtime optimizeation or JIT, and thus
supplant the old "lockgeom=0" hint. But their semantics may differ in
other ways, so we thought it was worth introducing a separation, and
at the same time, finally fixing the mis-design of "lockgeom" (which
in retrospect is both a confusing name and also has the 0|1 sense
backwards, thwarting even my own intuition every time I use it).

We introduce new variants of `ShadingSystem::Parameter()` that changes
the optional `bool lockgeom` parameter for a new enum `ParamHints`
that allows for future expansion with more hinted properties.  For
now, the old calls still work (lockgeom=false is the same as passing
ParamHints::interpolated) and this does not introduce any break to
backwards ABI compatibility at this time.

In this PR, "interpolated" is basically the replacement for the old
lockgeom (though the sense is reversed). The "interactive" hint is put
in place but doesn't do anything especially useful at the moment that
is different from interpolated.  A few more things are coming down the
pike in subsequent PRs: (1) Make interactive work and fully hook it up
to ReParameter(), including on GPU. (2) Make a new global SS option
that says if you're building shaders for an interactive render or an
offline render. (If offline, the even "interactive" hinted params
should be constant-folded.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-04-08 15:34:26 -07:00
Chris Hellmuth 209c672b0b Don't insert redundant run layer calls inside a basic block (#1665)
This patch is a very simple part one of work to optimize the number of conditional run layer calls that OSL makes, which take the form:

    if (!groupdata->run[parentlayer])
        parent_layer([...]);

After examining our slowest JIT’ing shaders on gpu, @tgrant-nv showed us that these run layer calls were significantly bloating our ptx and slowing down their compilation. Many of them are unnecessary because static analysis can show we are guaranteed to have already run the layer in question.

For example, reading different fields from a connected struct like below will often generate multiple conditional run layer calls:

```
struct Pair {
    float x;
    float y;
};

shader example_shader(Pair p = {})
{
    if ([…]) {
        float xx = p.x;
        float yy = p.y;
        […]
    }
}
```

Since this is not really a performance issue on cpu (runtime overhead is just checking the conditional bit), OSL doesn’t make a huge effort to optimize away these redundant cases. Each useparam op will be careful not to insert more than one per layer, and code that is called unconditionally in the main section of the shader will also not have redundant checks, but there are plenty of examples like above that are not currently removed.

This patch takes a basic first step, adding metrics to track run layer call counts and removing duplicate run layer calls inside a basic block, covering cases like the example above.

On my set of production test scenes, this alone removes anywhere from 20-50% of total run layer calls, with our biggest shaders seeing the most improvement. Total ptx line reduction varies between 3-20%, and optix module compilation (jit time) is reduced between 1-15%.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-04-08 11:28:31 -07:00
Larry Gritz 49cda0a472 Build: verify that OSL can build with clang16 (#1664)
But note: OSL does not yet work with LLVM 16.

Because homebrew recently upgraded its default llvm to 16.0, there may
be users for whom builds now break. The solution is:

    brew install llvm@14
    cmake ... -DLLVM_ROOT=/usr/local/opt/llvm@14

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-04-05 09:00:48 -07:00
Larry Gritz 787d8ce94e ci: Bump 'latest dependencies' tests to OpenEXR 3.1.7 (#1663)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-31 23:46:34 -07:00
Larry Gritz 89f1e69d88 Fix warnings about Qt compilation and enums (#1661)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-31 11:29:14 -07:00
Massimo Paladin fff0c5985d Remove SonarCloud cache setup as it is now offered by default (#1660)
Signed-off-by: Massimo Paladin <massimo.paladin@gmail.com>

No need to configure the cache anymore, SonarCloud now has an automatic analysis caching.
See https://docs.sonarcloud.io/advanced-setup/languages/c-c-objective-c/#analysis-cache.
2023-03-27 16:06:28 -07:00
Larry Gritz a047c065b7 Build: Fix cuda compilation flags for LLVM 15 (#1659)
For LLVM 15+, we need to disable opaque pointers. We did this for
regular bitcode generation in llvm_macros.cmake, but neglected to make
the corresponding change for copmiling to ptx in cuda_macros.cmake.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-27 11:22:27 -07:00
Larry Gritz bc735d02cf build: proper warnings about LLVM 16 (#1658)
LLVM 16 was just released. I'm pretty sure we won't build properly
against it because of the phase-out of typed pointers in LLVM IR, so
warn prominently so that anybody building against it who has problems
will know why.

Also, LLVM itself has bumped their toolchain requirements with the
release of 16. Technically, I'm not sure if that extends to projects
using the LLVM APIs, but warn anyway and hope for the best. If it
fails, at least the warning will supply an explanation.

At a later time, we'll need to upgrade the code on our side to have the
option of using opaque pointers so we can run with LLVM 16+.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-22 00:03:32 -07:00
Chris Hellmuth f64f6effc0 Enable userdata derivatives for interpolated params on GPU (#1657)
When generating calls to osl_bind_interpolated_param in llvm_instance.cpp, the userdata_has_derivs field is set to true if the parameter's derivatives are needed, but the code does not take into account that on gpu there is no space allocated for these derivatives.

This leads to an incorrect derivatives pointer getting passed into the renderer, which the renderer will use to write into unrelated groupdata fields.

For our renders, getting the correct image was worth the 1-2% inflation of groupdata struct size that we observed by simply re-enabling gpu userdata derivatives. If desired, adding an option to turn them on/off is straightforward, but I didn't want to preemptively bloat the code if it's not necessary.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-03-22 00:02:38 -07:00
Larry Gritz a620231929 Qt6 compatibility (#1655)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-18 10:23:29 -07:00
Larry Gritz df818a7045 Be more careful about paths to look for llvm (#1656)
In particular, `${LLVM_ROOT}/bin` will end up being (incorrectly!)
`/bin` if LLVM_ROOT is empty. That is bad if some other llvm-config
happens to be in /bin.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-18 10:23:03 -07:00
Larry Gritz bee79468e0 oslc: simple constant folding of binary expressions on the oslc side (#1653)
The runtime optimization does a great job of constant folding, and
we'd pushed it there because, with instance parameter values and
shader network connections known, it can find so much more opportunity
to optimize than we could in oslc.

However, there is one pesky problem, which is that shader parameters
that are initialized to even simple expressions such as 3+1 end up
with "init ops", which although later constant folded by the time the
shader is JITed, make it impossible to know the value via OSLQuery.

So this patch just takes the simplest cases -- certain `int OP int`
and `float OP float` expressions involving literal constants, and
performs the operation as it's parsing the code. So

         int val = 3 + 1;

actually just immediately is turned into `val = 4` instead of making
an "add".

To reiterate, the add would never have happened while executing the
shader -- at runtime in the renderer, when it's time to optimize and
JIT the shader, it would know it's a constant 4 value. This is
strictly about making oslc directly output an .oso file that knows
that parameter `val` has default value 4 instead of throwing up its
hands and saying "it's math code that will be evaluated later."

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-15 11:57:25 -07:00
Larry Gritz f8ad0281aa Make compile_report attribute an int instead of just 0/1 (#1654)
In particular, 1 prints a short version of the compile report (just
the fact that it happened and the time), >1 prints more verbose info.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-15 11:56:45 -07:00
Larry Gritz b9cb0ae74c ci: update runners (#1651)
* Stop using the deprecated, soon to be removed, ubuntu-18.04 runners
  and switch to 20.04.
* Bump the "latest" test openexr to 3.1.6
* Update INSTALL.md to document some things we're already testing and
  are known to work.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-13 15:38:22 -07:00
Larry Gritz 5879868561 Fix missing // clang-format on in oslc.c (#1652)
We had turned it off in one function to preserve formatting, but
failed to turn it on at the end of the function. This led to several
small functions not being clang-formatted, now fixed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-13 11:15:52 -07:00
Larry Gritz c5fe678c9e Update ref images from 1649
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-03-01 00:52:18 -08:00
Christopher Kulla dbe8c214e4 testrender: Don't use the cached background map on the first bounce (#1649)
* testrender: Don't use the cached background map on the first bounce (camera ray)

* testrender: Change the default resolution of the background so that importance sampling is enabled by default

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2023-03-01 00:36:47 -08:00
Larry Gritz fbe141b42b fix: add missing fmod variants (#1643)
Apparently some varieties of fmod(triple,float) -- which were not
documented in the spec but were intended to work and did allow that
combination in oslc -- were not fully implemented in the runtime.

* Add all these tests to the arithmetic-reg test, to fully test all
  possible argument type and unif/vary/const combinations once and for
  all for fmod. Also add some more rudimentary testing to miscmath.

* Implement the missing bits and/or avoid the code paths that rely
  on the unimplemented parts.

The implementation of fmod for funny -- both for batch and non-batch,
it's got one code path that just directly generates code and doesn't
need any functional implementation in llvm_ops at all, and a second
code path that uses the functional implementations to work around
(different, in each case!) what appears to be bugs or limitations in
long-ago LLVM versions we don't need any more.  I'm trying to assess
whether those are still needed at all in the oldest versions of LLVM
we are using, and if not, I may amend even more simplification to this
whole thing.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-27 16:33:09 -08:00
Larry Gritz a68a972602 Set up ray types for testrender (#1648)
Try to set ray types correctly for rays -- a little naive now, only
using "camera", "shadow", and "diffuse" for all rays (leave
distinguishing between reflection, refraction, diffuse, glossy for
another day, and currently testrender doesn't support subsurface or
displacement, but maybe someday).

Also, for testshade, improve efficency -- don't decode raytype on
every point.  For each individual shade, testshade was converting the
name of the raytype from a string to a ustring, then decoding to a
bitfield. Pull it all out of the loops by computing the bitfield once.

Adjust glass shaders to not change behavior based on raytype:
The code path that was supposed to suppress noisy caustic rays never
worked properly before because we never set the ray type in
testrender. Now that testrender sets it -- but does not distinguish
between the different types of secondary rays -- the code path is
active, but incorrect, and causes tests to fail. Just remove the
offending clause for now and return to the old behavior of the shader
(no attempt to eliminate caustic rays). Later, we should revamp the
glass shader entirely by switching to the newer MaterialX-inspired
closures.

Note: when you specify a resolution in the Background command in our 
scene xml, it will  run the shader out of any ray context at all (therefore
having no raytype) in order to populate an environment map that will be
used as needed. If you omit the resolution, no importance sampling is
used at all, so it's much noisier. I think the right approach is to do both --
populate the map for importance sampling, but run the shader on the rays
themselves to get higher quality visible results.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-27 14:41:00 -08:00
Larry Gritz 23edc185a0 Fix mismatched strides when calling OCIO for transformc with derivs (#1646)
We were getting an exception thrown on the OCIO side, because we were
passing 0 for the y stride (which, us humans know, should have been fine
since there was only one row, so the stride shouldn't have mattered).
Now pass the right stride even though we don't need to step from row
to row.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-20 13:40:44 -08:00
Larry Gritz 203dcecafe ci: Fix broken Mac CI (#1647)
Make sure LLVM_ROOT/bin (either as a cmake var or as an env var) end
up in the hints list when searching for llvm-config.

Without this, one of our Mac CI jobs was ending up with clang 14 and
llvm 15, and that was causing problems. The particular test was
supposed to be using 14 for both.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-17 23:35:45 -08:00
Larry Gritz bbbc28d2ff docs: Update credits
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-17 23:04:33 -08:00
Larry Gritz 649f0b86a3 Typo in test shaders (#1644)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-08 18:21:39 -08:00
Larry Gritz 31e92ddc06 RendererServices API for letting get_texture_handle consider colorspace (#1641)
This makes some minor changes to the RS APIs to add an additional
optional parameter to get_texture_handle so it takes a `TextureOpt*`
to accommodate a similar change on the OIIO TextureSystem side
from https://github.com/OpenImageIO/oiio/pull/3761

The purpose here is to add color management options to texture calls.
However, please note that this PR only reserves a public API change we
know we'll want, but it does not fully implement the color management.
Further work will be needed, as follows:

* Current calls to RS::get_texture_handle should be updated to pass
  the TextureOpt*. (This is a formality for future-proofing in case
  future TS or alternate TS implementations want to bake the color
  space choice into the texture handle itself. But the OIIO change
  doesn't currently rely on that at the moment.)

* When the texture.h symbol `OIIO_TEXTURESYSTEM_SUPPORTS_COLORSPACE`
  exists, we are building against an OIIO that has the new int field
  `colortransformid` in the TextureOpt and TextureOptBatch structures.
  We should fill this in with a nonzero value when we want the texture
  call to be doing a color transformation as it reads texture tiles.

* Use the new TextureSystem:get_colortransform_id() to get that color
  transform ID given two named from/to color spaces. We agreed that
  it's a reasonable restriction that the color space names should be
  known by the end of runtime optimization, so that should be constant
  foldable.

* Recognize new optional argument(s) to the texture() call family that
  lets the caller specify the presumed color space of the texture,
  and use that value (with constant folded lookup of the ID, above)
  to set the value in the TextureOpt.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-02-04 14:49:48 -08:00
Chris Hellmuth 9ae5b69fd8 Expose llvm groupdata size as a shadergroup attribute (#1642)
Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2023-02-04 14:48:59 -08:00
Declan Russell 3bd3778610 Fix some windows GPU build errors (#1638)
Signed-off-by: Declan Russell <declan.russell@autodesk.com>
2023-01-30 08:56:50 -08:00
pellerington a8d3ac06e6 Changed snprintf formatting to satisfy some compilers. (#1640)
Signed-off-by: Peter Ellerington <elleringtonp@gmail.com>
2023-01-27 15:58:39 -08:00
cmstein c0a5998c19 adding relaxed type-equivalency to ReParameter() (#1639)
Signed-off-by: Clifford Stein <cstein@imageworks.com>
2023-01-25 14:27:24 -08:00
danieldresser-ie 5dad5076bc Fix bug with masked wide llvm_gen_closure() (#1637)
Signed-off-by: Daniel Dresser <danield@image-engine.com>
2023-01-25 11:47:10 -08:00
Larry Gritz 317c59ed73 Fix doc typo
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-01-25 09:58:08 -08:00
Larry Gritz 66c9b61d72 platform.h: fully define bitcast template (#1635)
Ported from OIIO. This lets us not have to depend on the specific
definition in OIIO's fmath.h, and in particular not worry about
whether it's a new enough version of OIIO that the old bit_cast is now
marked as deprecated.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-01-12 22:48:55 -08:00
Larry Gritz 8036e174fb Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-01-12 15:18:10 -08:00
danieldresser-ie b064b25721 Remove unnecessary setting of locale::global (#1636)
Signed-off-by: Daniel Dresser <danield@image-engine.com>
2023-01-12 15:14:14 -08:00
Larry Gritz 8d1d9f0cf6 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-01-03 17:02:40 -08:00
Larry Gritz 1c196d935c Temp workaround for botched aswftesting container yum (#1633)
It seems something in the latest builds of the aswftesting/ci-osl:2022
containers has changed, and explicitly running /usr/bin/yum (instead of
the broken /usr/local/bin/yum) fixes it for now. This was completely
breaking the icc & icx tests, which require yum to install the Intel
compilers.

Also, bump up to the -clang14 containers for those tests, just to
get to a more recent LLVM.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-01-02 17:08:20 -08:00
Larry Gritz a878883eeb CI: Fix build break by adjusting fmt version (#1631)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-12-20 12:28:50 -08:00
Alex Wells 1b3c96603c Fix batched support for closures with array types (#1630)
Fixed batched support for closures with array types.
Enabled testsuite/userdata-custom/BATCHED (follow up to PR1620/PR1621).

Added modified version of PR1625 (Fix Issues with Derivative of getattribute) from danieldresser-ie
changing default behavior of MaskedData<DataT>::assign_all_from_scalar(const void *) to zero out Dx Dy when DataT has derviatives.
Added testsuite/userdata-custom
Fixed bug in testshades handling of userdata with derivatives.

Added bool LLVM_Util::is_type_array(llvm::Type* type)
      llvm::Type* LLVM_Util::element_type_of(llvm::Type* array_type)

Fixed icx compiler warning with src/liboslexec/osogram.y
Fixed unreferenced function warning in src/testrender/shading.cpp

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-12-17 12:13:52 -08:00
Larry Gritz e468ef7595 CI: Fix Mac CI breakage (#1629)
To save build time, we had OSL's Mac CI tests use the homebrew
installation of openimageio. But... Homebrew recently switched its
default python to 3.11, which didn't match the versions we're testing
OSL against here and broke the python bindings, so need to make a few
adjustments.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-12-16 13:39:32 -08:00
Patrick Mours fae61e699f Remove dependency on OptiX SDK for building core OSL with OptiX support (#1627)
Signed-off-by: Patrick Mours <pmours@nvidia.com>
2022-12-16 12:20:24 -08:00
Larry Gritz 7b6854823d CMake: Adjust how version overrides work (#1617)
Related to https://github.com/OpenImageIO/oiio/pull/3653

Kai Pastor (dg0yt) points out that the recent change I made both in
OIIO and OSL to make the version a cache variable has some unexpected
side effects that can lead to unexpeted behavior by inadvertently
retaining a version number upon recompiles if the cache itself was not
cleared, and this can happen unexpectedly even when the user isn't
trying to override the version.

This patch changes the behavior as follows:

You must use the special `-DOSL_VERSION_OVERRIDE=...` to override the
version.

  * if you do so, you are playing with fire and get what you deserve
    if you misuse it or change branches and don't remember to clear
    the cache.

If you do a normal build (without trying to override the version),

  * you will get the real version number because it IS NOT cached
  * if you switch branches, you'll always get the right version number
  * ...but switching branches without clearing the cache can still, as
    always, have other subtle behavior differences versus doing a
    truly fresh build from scratch.

So in short, it still allows a way to override the version if you
really want to, but if you are not trying to do that, you can no
longer get yourself inadvertently into unexpected trouble.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-12-03 11:10:30 -08:00
danieldresser-ie f84126fb3e Fix Batched Mode Crash When Adding A Default Initialized Closure (#1624)
This is another fix I'm attempting without really understanding all this LLVM stuff.

I started by adding a simple test case that attempts to add two closure parameters, where one has not been set.  This crashes or returns random values from uninitialized memory, matching a problem I ran into while trying to get batched mode working in Gaffer.

I investigated some, and found that add_closure_closure is assuming closure pointers are stored with the width of the current batch, but build_llvm_init is creating uniform closures.  I checked with @sfriedmapixar, who confirmed that all the batched closure code is assuming wide closures, so it seems build_llvm_init is what needs fixing.

Adding a `sym.make_varying();` to build_llvm_init appears to fix the problem ... I really don't know enough about the overall structure to know if this is the right place to make this fix, or if it could have other consequences, but it's enough to get this test passing, so hopefully someone who does know the background can review it.

Signed-off-by: Daniel Dresser <danield@image-engine.com>
2022-11-30 16:32:25 -08:00
Larry Gritz 395e58d6bf CI: No longer add the ppa:ubuntu-toolchain-r/test repository (#1618)
Lately, it has been experiencing intermittent availability problems
that causes our CI to fail while setting up dependencies.

What happens if we don't use the problematic ubuntu-toolchain-r at all?

Nothing, it seems. So eliminate it.

I think that once upon a time, it was necessary to add this repo to
get certain new packages? But maybe they are mainstream enough now
that it's not necessary to add this repo? In any case, it doesn't seem
to hurt anything, it's one less moving part that can't fail if it's
not there.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-11-29 16:23:31 -08:00
danieldresser-ie 75401bda4c Add new testshade closure to allow testing all parameter types (#1621)
Signed-off-by: Daniel Dresser <danield@image-engine.com>
2022-11-23 13:44:26 -08:00
danieldresser-ie 8530aa059a Fix issue with closure keyparams batched (#1619) (#1620)
When evaluating varying closure keyword parameters in batched execution,
the value of the first lane in the batch would be used for the whole
batch.

Signed-off-by: Daniel Dresser <danield@image-engine.com>
2022-11-23 09:08:06 -08:00
Larry Gritz bd7fd4cf8c Checkpoint to phase 2 of the great ustringhash conversion (#1612)
Reminder: phase 1 changed the RendererServices APIs to be based
completely on ustringhash for public method calls, not ustring.

This PR starts along the path of phase 2.

In oslconfig.h, I define a new type `ustringrep` which is the
in-memory/in-shader CPU-side representation of a ustring. Currently,
it's still equivalent to a ustring.

I also define a type called `ustring_pod`, which is the "plain old
data" representation inside a ustringrep (i.e., a const char* when
it's a ustring, and a uint64_t when it's a ustringhash). For reasons
not important, it's exceedingly hard to pass a true
ustring/ustringhash as parameters to or from LLVM-jitted code without
running afoul of LLVM's type checking, so it's just easier to pass the
underlying data type.

So the main work of phase 2 is to change everything related to shader
data from a ustring into a ustringrep, and things passed as const
char* into passing a ustring_pod. In some sense, it's just renaming
and type conversion plumbing.  When that's done, phase 3 is to throw
the switch and change the definition of ustringrep to ustringhash (and
of course fix everything that's broken).

This PR does not complete phase 2, but takes a big bite out of it.
It's an arbitrary bite, not much rhyme or reason to which specific
parts I did so far. Just working on it piece by piece and felt that
this was a place where much has been done, everything still works, and
it's a reviewable chunk without getting too much out of control.

Areas I worked on are related to range_check, raytype, getattribute,
bind_interpolated_param, uninit_check, range_check, naninf_check,
getmessage/setmessage, some texture setup, pointcloud.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-11-04 14:42:03 -07:00
Larry Gritz 61ea4c9a31 CI: Test against OpenColorIO 2.2 (#1616)
Also fix ocio brew install on Mac

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-11-04 00:49:59 -07:00
Larry Gritz afec48ebde CI: Adjust when jobs are run to cut needless CI (#1615)
Changes:
* Scorecards and analysis -- allow new to cancel running old
* Scorecard only runs on main repo, no need to run on forks
* Nightly CI only runs on main repo, no need to run on forks

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-11-03 23:11:03 -07:00
Dieter De Baets 9ef1741056 Add clangSupport as dependency to fix linker error (#1613)
Signed-off-by: Dieter De Baets <dieter.baets@unity3d.com>
2022-11-02 08:29:43 -07:00
Larry Gritz 1e8ef316ac Try to have more optix-only parts hidden behind OSL_USE_OPTIX (#1608)
This seems to have shifted just enough things around to make
clang-format want to re-jigger a few things.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-23 19:18:38 -07:00
Larry Gritz aafb5cb74e Testing: run pointcloud tests when partio is found (#1611)
Wow, this has been lurking for a while. Our Findpartio.cmake tries
looking for a partio exported config, but if not found, falls back
to a simple code to find it manually.

All was fine with the fallback code, which if found would set both
"partio_FOUND" and "PARTIO_FOUND". But the config file, if found --
only for the newer partio versions -- only set partio_FOUND. And in
that circumstance, we were not seting up the pointcloud tests!

Although the partio tests were running in CI (thankfully), I was not
running them locally on my machine with a new-ish partio.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-20 08:43:27 -07:00
Damien Courtois d0e49675e5 fixed broken links to Isotropix products (#1598)
Signed-off-by: Damien Courtois <dcourtois@isotropix.com>
2022-10-19 09:16:34 -07:00
Larry Gritz dde0a3451a OSL::bitcast utility (#1610)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-19 08:08:52 -07:00
Chris Hellmuth 3187864f9b Fix ptx symbol visibility regression (#1609)
* Address -Winconsistent-missing-override clang warning

* Fix ptx definitions of OSL_CONSTANT_DATA arrays

LLVM 14 introduced two ptx regressions to our file-scoped static variables:
1) They gained the .visible directive
2) They stopped being optimized out when unused

This lead to duplicate symbol errors when building an OptiX pipeline with
multiple shaders.

We attempted a fix using anonymous namespaces in #1561, but kept the static
keyword, resulting in a partial solution.

Removing static generates ptx that matches LLVM 12 for the affected variable
definitions.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2022-10-17 16:23:28 -07:00
Larry Gritz 66747ac1e6 Move string representation entirely to ustringhash -- phase I (#1603)
The first step of the great ustringhash conversion: This changes all
RendererServices methods (i.e., callbacks to the renderer from the
shader JITed code) that used to take ustring parameters, switched to
take ustringhash instead.

The second step -- which I will tackle after this part is merged --
will be to fully switch the in-memory representation of strings during
shading execution to ustringhash on the CPU (thus matching how we've
been doing it on GPU and making a number of data stuctures and
representations identical/shared for CPU and GPU).

But in the mean time, this lets renderers get started changing their
RendererServices specializations. Just like with OSL's internal
implementation, it may be easier for renderers to break the job into
phase I (rendererservices) and phase II (in-memory rep).

Some notes and guideposts:

* In oslconfig.h, define ustringrep to alias to either ustring or
  ustringhash, depending on a new (but temporary) CMake variable
  `OSL_USTRINGREP_IS_HASH`, which is OFF for now, meaning that
  ustringrep is still ustring.

* Also in oslconfig.h, several helper conversion functions among
  ustring, ustringhash, ustringrip.

* RendererServices and BatchedRendererServices (and their various
  subclasses in testshade and testrender): change the method
  signatures from ustring to ustringhash for all methods that are
  reachable from shader code.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-11 15:54:23 -07:00
Larry Gritz d867d98a50 Improve testing coverage (#1607)
Looking at the code coverage report and trying to get a higher
coverage amount, employing two strategies: (a) remove unused code
that is not covered because it's... unused; and (b) test things
that are used but aren't in the test run. Details follow.

Remove deprecated version of LLVM_Util::make_function.

Disable contents of dump_struct_data_layout when OSL_DEV is not
defined, it will never be called in any other circumstances -- it's
strictly a debugging tool, not part of the shipping library.

When OSL_USE_OPTIX is not enabled, exclude compiling contents of
ptx_compile_group.

get_alignment can also be OSL_DEV only as well as simplified

Arbitrarily pick a couple of render tests to use llvm_opt levels 12
and 13 to verify that they work correctly. (That's a couple hundred
lines of pass setup code that wouldn't otherwise be included in the
coverage analysis, nor tested in the testsuite.) This also required us
to add the --llvm_opt command to testrender, as it is in testshade.

Make the analysis run build for avx512 as well for more code coverage.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-11 14:46:55 -07:00
Larry Gritz 6069b7cfc0 Fully deprecate LLVM_Util::internalize_module_functions (#1606)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 18:04:57 -07:00
Dan Horák 41cc6d78db include the immintrin.h header only when needed (#1605)
The immintrin.h header is required for the implementation of the
popcount and coutr_zero function only when the Intel compiler is used.
Move the inclusion accordingly. The current state breaks build on
platforms that don't provide the header, but provide the alternative
means (gcc/clang built-ins, etc).

Signed-off-by: Dan Horák <dan@danny.cz>
2022-10-10 14:08:13 -07:00
Larry Gritz 8561a817ea Disabling dso testshade to fix coverage missing testshade.cpp (#1604)
We compile testshade.cpp twice -- one for a special "does it compile
as a DSO" check but that isn't run from the testsuite. This was
causing the coverage analysis to think nothing in testshade.cpp (at
least one copy of it) was getting run, which is technically true, and
counting all of its lines as untested for the coverage analysis. Just
exclude that funny dso build from the coverage case.

Also exclude anything in src/build-scripts from coverage analysis,
that's not code that ships, so to speak.

We're trying to chip away at untested code bit by bit to get our
coverage to over 80% of lines. We're getting close.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 00:06:55 -07:00
Larry Gritz cfaf643d0e Remove unused cuda variable that was warning (#1602)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-07 12:13:13 -07:00
Larry Gritz c505c4ca5f Hashing cleanup for ustrings (#1599)
Define std::hash for ustring and ustringhash, when not using an OIIO
new enough to do so.

Define std::less for ustringhash, when not using an OIIO new enough
to have operator< defined for ustringhash (will be fixed separately).

No need now for ustringHash, which is also unwisely similar to
ustringhash, just use std::hash instead.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-06 17:14:41 -07:00
Larry Gritz 318f0e488e CHANGES and bump version to 1.13.1.0 after ShaderGlobals change
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-06 15:36:14 -07:00
Steena Monteiro b22c9b7c84 Shading state uniform (#1585)
* Reduce dependency on ShadingContext and ShadingSystem objects
for accessing the ShadingSystem and consequently the ColorSystem. In its current form
it is not device-friendly.

We introduce a self-contained pvt::ShadingStateUniform that maintains a proper
state and is independent of the ShadingContext and ShadingSystem. We add an
opaque pointer to ShadingStateUniform in the ShaderGlobals structure.
Update uses of ColorSystem in opcolor.cpp to go through
ShaderGlobals::shadingStateUniform.  Also update uses of m_commonspace_synonym
and m_unknown_coordsys_error in opmatrix.cpp to go through
ShaderGlobals::shadingStateUniform.

NOTE: The ShadingStateUniform is private and an OSL implementation detail and
does not change the public interface other than adding an opaque pointer to
ShaderGlobals.

* Fixed LLVM representation to accommodate ShaderGlobals::shadingStateUniform.

* Added missing Copyright Contributors license to shading_state_uniform.h

* Removed m_commonspace_synonym data member
Moved ShadingStateUniform closer to its use in osl_prepend_matrix_from

* Fixed clang-format diffs. Added void* shadingStateUniform to ShaderGlobals in rend_lib.h. Needed for proper working.

* Added shadingStateUniform to wide_opmatrix and batched_shader_globals.h
Adjusted batched struct data layout check in codegen.

* Reordered headers to include shading_state_uniform.h with the other headers
from liboslexec

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>
2022-10-06 15:29:55 -07:00
Larry Gritz bd491d025e Git rid of the last remnants of the Cuda string_table (#1600)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-06 14:59:13 -07:00
Alex Wells 6140c72aa6 CI: address regressions with new icx compiler (#1601)
Some explicit SIMD loops were technically illegal because each lane was not truly independent, fixed by adding "reduction" clause.  Some Mask objects had to be replaced with just "int" to allow it to be specified in the reduction clause.

icx v2022.2.0 does apppear to have some regressions for large amounts of Dual code in a couple use cases, added alternative(improved) Single Statement Assignment (SSA) version of OIIO::fast_sincos which allowed unit tests to pass.  Consider updating OIIO fmath.h to use SSA coding style (which would allow this workaround to be removed).
Another regression with transform_normals was avoiding by introducing an OSL_UNLIKELY(condition) to generate a branch vs. masked execution, this change is a general improvement and should be left in.

Avoid flex_bison produced warning in osogram.cpp "variable 'osonerrs' set but not used".

Due to a number of regressions that appear to be fixed in next revision, choose to skip icx 2022.2 and continue CI for the time being with icx 2022.1 until the next release.

Because multiple (possibly newer) versions of oneapi may be installed, use a config file to specific a specific compiler and tbb version NOTE: Individual oneapi components may independent version numbering.

For centos images, use a config file to specificy a specific oneapi compiler and tbb version

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-10-06 09:44:58 -07:00
Larry Gritz 7fcdc3f71c Run analysis upon push to main
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-05 11:19:35 -07:00
Larry Gritz 22feb208c2 CI: fix analysis run after OIIO upgrade
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-05 09:27:36 -07:00
Larry Gritz ab65bbad4b CHANGES and other minor docs adjustments after the 1.12 release
Also belatedly bump the version in main to 1.13.0.3

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-02 15:45:15 -07:00
Larry Gritz 64c66949e7 CI: Improvements to the coverage analysis (#1596)
* For analysis, USE_QT=0 will disable osltoy from building (since we
  don't/can't test it in the testsuite, it's unexecuted but really
  shouldn't count against our code coverage metric).

* Exclude Imath duplicate headers from Sonar analysis.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-02 15:42:18 -07:00
Larry Gritz 2fe18079a3 Raise OIIO minimum to 2.3 (#1591)
Traditionally, OSL has supported building against the current and also
the previous supported version of OIIO, but not necessarily any older.

With OIIO 2.4 released (any day now), and OSL "main" is actually going
to be next year's supported release, it seems reasonable to change the
forward-looking development of OSL to have a minimum of OIIO 2.3,
which means that OSL-next will support OIIO 2.3, 2.4, and the
currently-in-progress 2.5 (or whatever it's called by that point).

The main reason to do this bump is because we'd like to depend on the
ustringhash class, and possibly other things we will probably be able
to easily backport to 2.3 but not to 2.2.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-30 18:23:09 -07:00
Larry Gritz e0a66c7bc6 Fix LPE leak in error condition (#1594)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-30 17:03:31 -07:00
Larry Gritz e4e5088ed6 LLVM 15.0 support (#1592)
* A variety of changes to get a clean build and passing tests when
  using LLVM 15.0.

* I've noticed problems when using LLVM 15 but building with earlier
  clang, so the cmake scripts now print a warning in that case, so if
  users encounter trouble they have a hint about what to do to fix it.

* For our CI tests on Mac, force the MacOS-11 test to use llvm 14,
  and the MacOS-12 test to use llvm 15.

IMPORTANT TO-DO / CAVEATS:

1. When doing JIT at optlevel 12 or 13, I had to disable a number of
   passes that don't seem to exist anymore in LLVM 15. This is enough
   to get it working, and to be honest, I don't know if anybody uses
   these opt levels.  But we need to revisit this, because I don't
   know if there these are cases where the names of the passes merely
   changed or that new passes take their place (in which case we
   should add the new passes, not stop after merely disabling the
   deprecated ones). For that matter, optlevel modes 11, 12, 13 are
   supposed to match what clang does for -O1, -O2, -O3, and that
   changes from one release to the next, so we should probably revisit
   this list and make sure it's matching clang's current choices
   (which I assume are crafted and periodically revised by clang's
   authors).

2. LLVM 15 switches to "opaque pointers". It still supports typed
   pointers...  for now. But as you can see in the diffs, I had to
   disable a variety of deprecation warnings and take some other
   actions to put LLVM 15 in the old "opaque ptr" mode to match our
   use of LLVM <= 14. But this is only temporary, because the typed
   pointer mode is expected to be removed entirely in LLVM 16. So at
   some point in the next few months, we are going to need to support
   opaque pointers in our use of LLVM. (Also note: for a while, we're
   going to have a bunch of ugly `#if` guards or other logic to
   support both opaque pointers for users with llvm >= 16 and also
   typed pointers for users with llvm <= 14, until such time as our
   LLVM minimum is at least 15, which I expect is not a reasonable
   assumption for at least a couple years.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-29 10:10:58 -07:00
Larry Gritz aea281dcad Fix memory leaks found by static analysis in leparse.cpp (#1593)
Several places in leparse.cpp were found by static analysis to have
memory leaks -- results of calling _parse() that, in the case of
early exists in error conditions, never got deleted.

I also did some other modernization: changed NULL to nullptr, changed
some loops to more compact range-for, utilize some Strutil helpers
that will be more efficient than the alternative std::string
manipulation.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-29 09:57:19 -07:00
Larry Gritz b5aba16147 OSL_ALLOCA (#1589)
We use OIIO_ALLOCA in many places. Make an OSL version and put it
in platform.h.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-27 15:31:12 -07:00
Larry Gritz 4ba1678561 Fixes to compile with clang 15 (#1586)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-27 14:55:29 -07:00
Larry Gritz 8417f8eb04 CI: Move clang-format test to main section (#1588)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-27 11:24:39 -07:00
Larry Gritz 55029e388f Make testshade --help print texturesystem options and hardware info (#1584)
This was meant to work all along, which is why this patch is so small!

But a tiny detail -- not explicitly passing info about the `--help`
argument -- made ArgParse substitute its own default, which exits
after printing the usage info. But, as I apparently meant to do all
along, if you specify it explicitly, you get to handle it, and the way
we handled it alsp printed the extra information.

Anyway, with this patch, `testshade --help` not only prints all the
testshade command options, but also it prints some information at the
end about some of the build settings of OSL, versions of key
dependencies, hardware info, and a run-down of the ShadingSystem
options. This can be helpful for debugging.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-21 17:13:34 -07:00
Larry Gritz 89c033bda9 Docs: Some minor updates to CONTRIBUTIONS and INSTALL docs (#1582)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-21 16:33:13 -07:00
Mark Sisson 0b57ae6b03 add .envrc to .gitignore (#1583)
direnv (https://github.com/direnv/direnv) can be used for local developer workflow enhancements.  direnv uses .envrc file for configuration.  Because .envrc is usually specific to a developer workflow, it is generally not committed.

Signed-off-by: Mark Sisson <5761292+marksisson@users.noreply.github.com>
2022-09-20 15:59:32 -07:00
Larry Gritz 6588caafa6 CI: Set up a dynamic analysis test using address and leak sanitizers (#1581)
- There are a handful of tests we disable entirely with because they
  are irrelevant or just cannot be made to be clean (and that's ok).

- Tests with sanitizers run slow, so we increase timeouts, and also
  set AA to 1 for render tests to speed them up.  We rig it so a
  non-matching output won't fail, and that's ok because every other CI
  test is checking the results; here we have no reason to believe
  results will differ from other tests, we just need to run with
  sanitizers turned on.

- In testing.cmake, we rig texture tests to disable the leak
  sanitizer, because we can't eliminate some completely benign leaks
  from the texture system, and because they are called from JITed
  code, we don't get a clean stack trace of things that happen in OIIO
  and therefore we just can't enumerate the allowed exceptions. So we
  trust that OIIO itself tests the texture system adequately and is
  able to ignore the benign "leaks."

- We already submitted PRs and merged the little fixes that were
  discovered by enabling address and leak sanitizers. This is just the
  final bit to turn it on for CI runs from here on out.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-19 18:28:56 -07:00
Chris Hellmuth b11fb97626 Docs: Minor spec typos (#1580)
* Fix minor spec typos

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2022-09-15 13:47:53 -07:00
Larry Gritz 7a885c68b6 CHANGES and designate this spot as 1.13.0.2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-13 15:25:10 -07:00
Larry Gritz 32278d3f77 Build: Make the version number be a cmake cache variable (#1579)
Rather than specify the version in the usual project() statement,

    project (OSL VERSION 1.13.0.0 ...)

this patch decouples it

    set (OSL_VERSION "1.13.0.0" CACHE STRING "Version")
    project (OSL VERSION ${OSLVERSION} ...)

thus allowing the possibility of overriding the version number at
build confuguration time (`cmake -DOSL_VERSION=3.1.4.1`).

This should be used with extreme caution. Probably never used by most
people. I don't need to describe all the ways that things can go
sideways if you make your build of x.y.z.w actually be arbitrarily
different from the x.y.z.w that everyone else uses and that is
documented.

That said, there are two scenarios I have in mind for which this
ability is very useful:

1. Sometimes, we add or deprecate API features "in advance" by having
   an `#if` enable or disable code based on the version, essentially
   putting in place changes that can't be enabled yet because they
   would break compatibility rules, but we want to integrate the code
   now and have it become active upon reaching a particular future
   version in which that incompatibility will be allowed. The version
   number override makes it easy to test this by quickly doing a build
   "as if" we had already bumped the version number to see what will
   happen when we actually do.

2. Every once in a while we need to do an internal build that, to
   conform to version compatibility rules, needs to appear to still be
   part of a past version family. This lets individual sites play some
   games with version number overrides rather than have to create new
   branches and tags for certain one-off internal releases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-13 15:06:49 -07:00
Larry Gritz c8dd33f5a3 Bug fix: assigning init-op param its default value as instance got lost (#1578)
This is a tricky situation to describe. Consider this shader:

    shader test (float A = 0.5,
                 float B = A)
    {
        printf("A = %g, B = %g\n", A, B);
    }

By default, A is 0.5 and B gets A's value, also 0.5. If you give A a
different instance value, like 1.0, then B will also get the same
value, they'll both be 1.0.  If you give B an instance value, that
will be used for B rather than copying A's value, like this:

    $ testshade  -param B 1.0 -shader test test
    A = 0.5, B = 1

But there is a corner case bug: if we assign B an instance value of
0.0, it will incorrectly fall into a special case where it thinks it
gets a default value, only coincidentally because 0.0 is in an unused
slot for the default value (unused because it has no default -- its
default comes from "init ops", that assignment).

    $ testshade  -param B 0.0 -shader test test
    A = 0.5, B = 0.5

!!!

Reading the patch should be self-explanatory for what the bug is and
how we fix it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-12 16:49:49 -07:00
Larry Gritz 1a7670600c Fix memory leak in ASTvariable_declaration (#1576)
* Fix memory leak in ASTvariable_declaration

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-08 21:02:15 -07:00
Larry Gritz a6ff40b0b2 Docs: RELEASING.md (#1572)
I've tried to write a complete set of step-by-step instructions for
everything about how to coordinate and deploy a release. This is a
living document, we will amend over time. I'm sure there must be
things I've forgotten.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-08 18:50:49 -07:00
Larry GritzandAlex Wells 54cf8b209c Fix overrunning allocation region in debug common_ancestor_between (#1577)
Signed-off-by: Alex Wells <alex.m.wells@intel.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Alex Wells <alex.m.wells@intel.com>
2022-09-08 10:12:21 -07:00
Larry Gritz 2e941e612f Batched analysis: ReadEvent remove uninitialized members (#1575)
The little ReadEvent class had two members that are never set when
OSL_DEV is not defined, nor are they accessible (the accessor
functions also are disabled based on OSL_DEV). It looked to the static
analyzer like the data members were uninitialized, which they
were. Add OSL_DEV guards around the declarations of those members as
well, so they aren't even present in the struct when not needed for
this debugging mode.

Food for thought: another alternative is to keep the members but just
remove the OSL_DEV guards entirely -- just let the two int data
members be used all the time, not just for OSL_DEV. It's too small to
have any perf penalty, and it unclutters the declaration by removing
all those `#ifdef` lines.

For that matter, I also wonder if there's any real point to having
private members and accessor functions for this tiny internal-only
class, and maybe it's better to just let it be compact declaration
of a simple `struct` with three directly accessible data members.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-07 22:54:01 -07:00
Larry Gritz 051f2bfe2f Rewrite confusing loop in testshade for clarity (#1574)
In testshade, there was a "loop" that wasn't really a loop, and it
was getting flagged by static analysis as being fishy. This patch
rewrites it as an "if".

Also take the opportunity to change from stream output to OSL::print
formatted output.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-06 11:23:48 -07:00
Larry Gritz f13463e6b6 Build/test: parameterize the timeout for expensive tests (#1571)
We had hard-coded longer allowable timeouts for particular testsuite
tests. But for the static analysis runs, it takes extra long and we
need a way to tell it to increase the timeouts even more, and to
exclude the longest running tests from the analysis coverage run (it's
not necessary to run those tests, they don't increase coverage enough
to justify being an hours long run).

Signed-off-by: Larry Gritz <lg@larrygritz.com>

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-04 18:00:50 -07:00
Larry Gritz cd2fa1650d Rename compiler-generated constants non-sequentially (#1570)
In the course of our runtime optimization of shader networks, we
generate lots of new constant symbols (for example, as we optimize an
"a = b + c" into "a = newconst" if b and c can be determined to be
constants). The new constants are named with a numerical suffix doled
out in a sequental manner.

I've always thought that maybe it would be helpful for me when
debugging optimizer output if the name of the symbol also revealed the
value of the constant it held (when possible). Never did anything
about it.

Now it turns out that this has an application for JIT to PTX, where
the PTX cache can save compilation-to-PTX time if it encounters LLVM
IR that is exactly the same as it has seen before and is cache.  If
the constants are generated in a different order, it generates
non-functional, purely text differences in the code we generate, and
this means the PTX cache doesn't function as efficiently as possible.

So this change alters the compiler-generated constant naming for two
cases: int constants, and string constants. The int constants append
the value of the integer (using '_' instead of '-' for negatives), and
the string constants append the hexidecimal value of the ustring hash
for that string. In both cases it does this without using or
incrementing the `m_next_newconst` counter that it uses to
sequentially name the other types that can't easily encode the value
to generate a unique name.

It's really to help the PTX cache, but as a side benefit, it will
be slightly easier for me to make sense of the optimized code when
I need to read it with my own eyes while debugging.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-02 10:07:13 -07:00
Larry Gritz c23da3df34 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-01 18:39:03 -07:00
Larry Gritz 95c1408d27 Rebuild PDF docs
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-01 18:33:19 -07:00
Larry Gritz e278f4c24a Deal with deprecated bit_cast function in OIIO 2.5 (#1569)
Today's branching of OIIO 2.4 and subsequent changing of its master
branch to think it's "2.5" seems to have triggered an automatic fuse
that annotates a particular function in OIIO as deprecated for version
2.5 and beyond. OSL was still calling the old version, so some
immediate changes are necessary to call the correct new name when
using a new OIIO.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-09-01 15:32:42 -07:00
Larry Gritz 365f2c4b2b Sonar static analysis improvements (#1567)
* Exclude osltoy from coverage analysis, since we don't have a way to
  run it from CI
* Run batch shading for analysis to get better code coverage
* llvm_gen_select: extra check that we can't overrun memory of cond[]

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-31 16:56:19 -07:00
Larry Gritz ac59af9bd1 Make sure all clang-format changes are in .git-blame-ignore-revs (#1568)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-31 16:55:48 -07:00
Larry Gritz 9d5d6203b9 New closure docs (#1564)
* Change the languagespec to document the new MaterialX-synchronized
  closures.

* Document the old ones as "deprecated" -- still supported for 1.x but
  assumed to be on the slate for removal in OSL 2.x.

* Change stdosl.h so that the new closures, instead of being seen only
  if MATERIALX_CLOSURES is defined, to being enabled by default, but
  (for now) can be disabled if NO_MATERIALX_CLOSURES is defined.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-31 14:22:06 -07:00
Larry Gritz 1a66a2b8dd CI: test against python 3.10, gcc 12, latest fmt, update INSTALL (#1565)
Mostly, updating the "latest versions" test to the current latest
versions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-31 14:21:08 -07:00
Chris Hellmuth 3b97ecef47 Generate deterministic ptx for OptiX cache hits (#1566)
Removing the suffix ids and callseq comments generated by global counters
leads to deterministic ptx in a multithreaded environment.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2022-08-30 10:56:55 -07:00
Larry Gritz ed5b5a2a0c Simplify clang-format call now that we include virtually everything (#1562)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-28 12:52:48 -07:00
Larry Gritz 37cbab5bad Sonar warning fixes and improvements (#1563)
* Minor changes to fix a couple more warnings given by SonarCloud
  static analysis.

* Get the code coverage enabled, it wasn't running properly.

* testrender: allow secret TESTRENDER_AA to override command line --aa

* runtest.py: allow secret OSL_TESTSUITE_SKIP_DIFF to force skipping
  the reference comparison step.

* For analysis run, set TESTRENDER_AA=1 to keep the tests from being
  prohibitively expensive, and OSL_TESTSUITE_SKIP_DIFF=1 to keep it
  from failing because the aa=1 images are different.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-28 12:52:07 -07:00
Larry Gritz 11127b72b5 Fix OptiX + clang14 issue with duplicate symbols (#1561)
We had been using clang/llvm 12 and when trying out 14 I started
getting test failures with OptiX complaining about duplicate
symbols. They all seemed to be the things we declared as
OSL_CONSTANT_DATA. It looks like there's a difference in llvm 12 vs 14
in how the generated PTX marks its symbol visibility.

The solution (thanks to a clever suggestion by Alex Conty) was just to
enclose those declarations in anonymous namespaces. Works like a
charm!

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-27 15:47:47 -07:00
Larry Gritz d5d87f1e64 More detailed messages when encountering failed OptiX calls (#1560)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-26 18:22:54 -07:00
Larry Gritz fa6f228b87 Fix minor bugs and warnings uncovered by SonarCloud (#1556)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-26 14:01:05 -07:00
Larry Gritz 21f1a2f47e Fixes needed to support OptiX 7.4 (#1559)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-24 11:34:17 -07:00
Larry Gritz 5be7c6bd4e clang-format: the very last piece of the puzzle (#1555)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-23 13:32:31 -07:00
Christopher Kulla 9f8e92ce93 Add missing cases for MaterilaX closure refraction index detection (#1557)
This allows the refraction index to be detected even if a medium closure
is not present. Additionally, the medium detection now traverses layer()
closures.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-08-23 00:03:59 -07:00
Larry Gritz 4bbaca7fe5 Testing: Try to fix testsuite/render-microfacet failures (#1558)
There seems to be just a teensy bit of nondeterminism or
platform-variance in this one test that we haven't tracked down the
source of yet, that moves some specular fireflies around. Smells like
maybe an uninitialized variable somewhere in testrender? Because it
doesn't happen on any other test and we haven't detected it in our
real renderer, we don't currently suspect that it's an actual error
in oslexec.

Big hack: Re-run failed "render" tests up to 5 additional times before
giving up.

This makes me feel dirty. But it makes tests pass for now. Eventually we
will find the embarrassing testrender bug that is responsible for the
occasionally different specular sampling noise.

Also slightly bump up the error tolerance for this test.

Also add one alternative that seems to frequently pop up.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-22 14:38:27 -07:00
Larry Gritz cf1b4ef3e6 CI: For Mac, test python 3.9 for MacOS11, and 3.10 for MacOS12 (#1554)
This cleans up some recently-failing CI tests.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-20 22:23:16 -07:00
Larry Gritz c3e36affa8 CHANGES and other misc docs fixups
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-20 17:16:11 -07:00
Larry Gritz e9a614ba53 Bump patch level 2022-08-19 19:10:20 -07:00
Larry Gritz d57a462462 GPU string fix -- needed missing cast (#1553)
Fix slightly incorrect code generation when getting a string address
for GPU.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-19 14:21:57 -07:00
Larry Gritz ac114aded4 Fix typo error that prevented correct typecheck of ternary (#1552)
Didn't properly detect the disallowed use of arrays for the false
clause because we checked `t` twice.

Yay for static analysis!

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-14 22:08:51 -07:00
Larry Gritz 74fc27de12 Try to enable Sonar Cloud static analysis (#1551)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-12 08:25:13 -07:00
Larry Gritz 826b6767c9 Spell check comments (#1550)
Yay for "codespell"

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-03 20:44:27 -07:00
Larry Gritz 89d5db2b5c Another round of clang-format (#1540)
* Another round of clang-format

* Bump the standard clang-format we use for CI from clang11 to clang14.
  This will make some minor additional changes.

* Due to a mismatched target name, we weren't actually checking the
  formatting in CI on all the files we thought we were, and therefore
  not assuring that certain code was correctly formatted. So there is
  some fixup needed, which is included here.

* And a bunch of files we didn't try to do before, either.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-03 10:05:33 -07:00
Alejandro Conty 1dd33050da Switch testrender to cone tracing (#1543)
The idea is to stop propagating derivs through BSDFs, which we
never did properly. Instead we trace rays with radius + spread,
which we turn into OSL derivs in SG when we hit a surface. Then
when bouncing off a surface we use the BSDF roughness to set the
spread. In addition we also:

  * Return BSDF samples/eval as a small struct Sample(). This
    avoids output parameters in the methods.
  * Stop passing a full ShaderGlobals to the BSDF methods. Pass
    a viewing direction wo instead so they could run in a simpler
    context.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>
2022-08-02 10:56:07 -07:00
Larry Gritz 0879638dda Testing: Adjust comparison thresholds to account for platform diffs (#1549)
Also fix a CI test label -- we had a duplicate.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-02 09:46:35 -07:00
Christopher Kulla 8a7b9b96ba Implement MaterialX medium closure and use it to drive the refraction closures (#1547)
This simplifies the logic around the ior which drives reflection/transmission (fresnel effect)
from the ior which drives refraction (and total internal reflection). Setting both iors equal to each other
gives the expected physical behavior.

Also tweak the bsdf constructor to support variadic arguments which simplifies a bunch of code.

Add a new test to validate the refractive version of generalized_schlick_bsdf.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-08-02 06:09:25 -07:00
Christopher Kulla 23ea0644f8 Add furnace tests for MaterialX closures (#1542)
Implement get_albedo for the sheen closure, based on fit derived by the MaterialX team

Add optional mode to testrender to visualize the result of the get_albedo method. This can be useful for validation of the get_albedo method.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-08-01 15:25:31 -07:00
Larry Gritz bd6d856b0e Increase error threshold for tests (#1546)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-08-01 07:46:26 -07:00
Christopher Kulla 6424177e3a Implement microfacet based MaterialX closures (#1541)
* Implement reflective microfacet based MaterialX closures

Add test cases for dielectric, conductor and generalized schlick closures

Signed-off-by: Chris Kulla <ckulla@gmail.com>

* Implement refraction case in microfacet closures

Signed-off-by: Chris Kulla <ckulla@gmail.com>

* Update reference images

Signed-off-by: Chris Kulla <ckulla@gmail.com>

* Relax diff threshold on render tests

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-08-01 07:09:28 -07:00
Larry Gritz 0b92d2b03b Label ci jobs better (#1545)
This was resulting in confusing artifact names for the Intel compiler
cases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-07-31 16:29:58 -07:00
Larry Gritz bf04610296 Fix error message for texture-errormsg test (#1544)
It printed the u,v coordinates where the error was first discovered.
This is not necessarily deterministic, of course!

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-07-30 04:32:56 -07:00
Adrien Herubel ff9560f401 Layer closure implementation in testrender (#1538)
* Add support for layer closure with dielectric reflections as top layers, and a test with nested layer closures

* Add support for sheen in the layer closure

Signed-off-by: Adrien Herubel <adrien.herubel@autodesk.com>
2022-07-24 14:27:56 -07:00
Adrien Herubel e0d6a21438 Missing documentation for the exponent parameter in the generalized_schlick_bsdf, and missing storage for the parameter (#1539)
Signed-off-by: Adrien Herubel <adrien.herubel@autodesk.com>
2022-07-24 11:29:40 -07:00
Christopher Kulla da794de6fd Implement MaterialX closure sheen_bsdf (#1537)
Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-07-20 14:12:46 -07:00
Christopher Kulla a1e941c43b Implement MaterialX closure burley_diffuse_bsdf (#1536)
Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-07-20 10:52:55 -07:00
Christopher Kulla 3bb41960fd Implement basic support for MaterialX closures in testrender (#1533)
* Extend the bsdf interface in testrender to use Color3 instead of float in preparation for MaterialX closures which are almost all tinted

  * Add stub parameters and IDs for all MaterialX closures

  * Register all MaterialX closure types

  * Implement most MaterialX closures, reusing the existing implementations for now

This commit is mainly intended to do the busy work of adding the new closures, no new BSDFs are actually implemented yet. This means that some of
the closures are handled in a very rudimentary way, ignoring some key parameters. The intent is to improve support for these over time.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-07-19 09:05:20 -07:00
Christopher Kulla 95fa78d3fd Modernize sampler in testrender (#1534)
The sampler implementation in testrender was very close to the 2020 article from Brent Burley. This patch
catches up to best practices, including a faster owen scrambler from Nathan Vegdahl and recognizing that
the index scrambling can be achived by the same owen scrambler method (which saves a bunch of logic and runs
faster). Finally, avoid the redundant bit reversals and use compiler intrinsics when available to benefit
from hardware instructions (for ARM or GPUs). Finally the integer hash constants were updated to the latest
from the hash prospector project.

While more optimizations are certainly possible, this is a reasonable balance between quality and speed.

Update reference images for new sampler

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-07-18 23:22:51 -07:00
Larry Gritz eff3dede3a Mark DCO task as long since done (#1532)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-07-18 08:53:45 -07:00
Larry Gritz 7b4c7cffd7 GPU string overhaul (#1531)
* GPU string overhaul

Big string cleanup, yet again, for GPU. We still had this tricky
double indirection happening with strings for OptiX -- the string was
a pointer to a "global", which in turn held the hash. No, throw all
that out.  Just directly store strings as the ustring hash on
OptiX. No extra indirection. Many fewer differences between how things
are handled on OptiX versus CPU (except for the fact itself that the
"string" holds the hash rather than the char*).

Some details worth noting:

* LLVM_Util loses "type_string()" and calls it "type_ustring()" to
  emphasize it's the type we're using to represent a ustring, and
  definitely not a C or C++std string. Also, LLVM_Util itself now lets
  the caller tell it whether it prefers that the representation of a
  ustring be the charptr or the hash, and then handles most of the
  details internally. The BackendLLVM, then, makes that decision early
  on, charptr for CPU and hash for GPU.

* Several more spots in LLVM_Util and BackendLLVM have been plumbed to
  pass around llvm IR SSA variable names to try to make the resulting
  LLVM IR more readable when I'm trying to debug it. (This was
  strictly debugging scaffalding aid for me, but comes along for the
  ride because it's useful to keep.) I also added a
  BackendLLVM::llnamefmt to format strings, which only does the
  formatting when the shading system knows it's going to save the IR
  for inspection, and otherwise (that is, in production) it does not
  do the string formatting or pass the names along, so it's not doing
  all that string manipulation when no human is going to be looking at
  the IR dumps.

* A lot of clunky OptiX-only code disappears.

* Some side effects of my reducing complexity of the IR as I debugged:
  there were times we were generating redundant pointer casting in the
  IR, such as grabbing a pointer, then casting it to a void*, then
  casting back to some other kind of pointer. In some cases I reduced
  that quite a bit. Again, this was mostly just a scramble to make the
  IR more readable while I debugged, but it probably has a minor
  performance gain as well since it reduced somewhat the sheer amount
  of IR we generate and pass to the optimizer and JIT.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

* Remove register_string entirely from RendererServices

Signed-off-by: Larry Gritz <lg@larrygritz.com>

* Remove more register_string remnants

Signed-off-by: Larry Gritz <lg@larrygritz.com>

* comment typo

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-07-13 08:36:12 -07:00
Adrien Herubel 8281721bde Fix permission error and build errors when running serialize-bc.py on Linux (#1527)
Signed-off-by: Adrien Herubel <adrien.herubel@autodesk.com>
2022-07-06 08:55:50 -07:00
Larry Gritz 2ece55aa97 Security policy fixes (#1529)
* Set up a SECURITY.md explaining how to confidentially report
  vulnerabilities.

* Create scorecards.yml workflow to run OSSF scorecard to check supply
  chain security issues.

* Use exact SHA's for actions versions to guard against hijacked
  actions repos that might try to substutite something else at the
  version tag we use.

* Make sure actions we use don't get write perms on our repo.

* Tried to use harden-runner action to ensure no actions on the runner
  overwrite source code or have unauthorized outgoing net connections
  during the GHA run, but currently leaving it disabled because of too
  many false positives -- it flags every dependency download as a case
  of altering source code. Which it technically is, but it doesn't
  matter for any jobs that aren't producing any artifacts that will be
  consumed or relied on by users.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-30 17:23:39 -07:00
Larry Gritz 88c471a315 Allow naming of llvm symbols for many ops (#1530)
Most LLVM API IR calls that generate ops allow an optional name of the
llvm symbol that will hold the result of the operation. By default, it
will make one up, such as "%37", "%38", etc. Needless to say, these
are difficult to understand when reading volumes of IR dumped for
debugging purposes.

So in this patch, I'm starting to expose the ability for our own code
to pass names through our wrapper functions. I needed this for some
deep debugging.

I haven't instrumented the entire set, just trying it on for some of
the specific areas I needed to debug. But this is a useful first step.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-30 16:03:53 -07:00
Adrien Herubel 11afddc8da Remove unwanted characters causing compilation errors in the MaterialX closure definitions (#1528)
Signed-off-by: Adrien Herubel <adrien.herubel@autodesk.com>
2022-06-24 11:15:59 -07:00
Larry Gritz f7cac87979 Remove OptiX 6 support (#1524)
This makes OptiX 7.0 the minimum version we accept, and greatly
simplifies a lot of code we were separately maintaining for 6 and 7.

This will go into main AFTER the release branch for 1.12 is split off.
The dropping of OptiX 6 will be a 1.13 (or whatever we call it) change.

Don't build the optix modules at all when not USE_OPTIX.
Totally remove stringtable.
Other simplifications stemming from these.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-20 16:18:40 -07:00
Larry Gritz 5401e8417b Bump version to 1.13 after branching for 1.12 (#1523)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-20 11:14:38 -07:00
Larry Gritz c61a85e217 Remove confusing licensing comment (#1521)
The implementation of simplex noise we've been using is public domain,
but looks like when we pasted the license notice into our repo, there
was one stray sentence (probably left over from an earlier license
scheme Stefan Gustavson used?) that makes reference to GPL. But the
software and its repo are NOT -- it's very clear that it's public
domain: https://github.com/stegu/perlin-noise/blob/master/LICENSE.md

So remove this confusing sentence.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-20 11:09:01 -07:00
Larry Gritz 08cda36387 Fix recent ArgParse change (#1520)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-15 10:11:41 -07:00
Larry Gritz caa8a2d252 Change OSL's ArgParse use to the modern syntax (#1519)
We'd been waiting until the minimum OIIO requirement was high enough
to include support for the newer syntax.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-10 11:15:17 -07:00
Larry Gritz 21eac9d921 Revert some formatting (#1518)
In a few of my big clang-format revisions, I was over-zealous, and did
not realize that I was making the command line option parsing unreadable.
Revert those secions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-08 11:26:58 -07:00
Larry Gritz d75384da6d ci: Bump OpenColorIO for 'latest' tests (#1516)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-05 22:05:49 -07:00
Larry Gritz 008907161d Typo fix in assertions (#1517)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-05 22:05:11 -07:00
Larry Gritz 102430c835 style: more clang-format (#1515)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-05 20:44:35 -07:00
Larry Gritz ce0e6e1d4f Regularize output formatting to avoid per-platform discrepancies (#1514)
Recent OIIO and fmt changes slightly changed this one place's output
with some version/platform combinations. Also make it match exactly
between the example-deformer and example-batch-deformer tests.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-05 19:05:09 -07:00
Larry Gritz 8c6ffdd911 More clang-format (#1512)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-05 12:37:05 -07:00
Larry Gritz a5a8f9d745 Fix incorrect m44*v4 in vector4.h (#1513)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-06-03 09:27:51 -07:00
Larry Gritz 1c715483b4 Adjust string formatters after change in fmt master (#1510)
fmt master seems to have just deprecated the default ability of
fmt::sprintf("%s") to printing anything that allows stream
output. This breaks use of Strutil::sprintf formatting of ustrings.

This isn't yet in any tagged release of fmtlib, but I'm trying to get
ahead of it.

The quick fix is to just change those handful of places that still use
sprintf convention with nonstandard types to use std::format style
calls, which we are slowly converting to anyway. (And maybe a couple
other spots while I was at it.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-25 22:39:41 -07:00
Larry Gritz 08706b7cba More clang-format (this time, testrender and liboslnoise) (#1511)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-25 21:52:04 -07:00
Larry Gritz c1045f2c28 clang-format
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-22 00:00:36 -07:00
Alex Wells 46d451ce74 Turn on clang-format
Signed-off-by: Alex Wells <alex.m.wells@intel.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-22 00:00:36 -07:00
Tim Grant 1c57fc61d8 clang-format
Signed-off-by: Tim Grant <tgrant@nvidia.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-22 00:00:36 -07:00
cmstein e56851056d clang-format
Signed-off-by: cmstein <cstein@imageworks.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-22 00:00:36 -07:00
Larry Gritz 28399fefc8 Add files to the clang-format list
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-16 12:42:28 -07:00
Larry Gritz 7f2e83794e clang-format (general)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-16 12:42:28 -07:00
sfriedmapixar 1f73b075c9 clang-format
Signed-off-by: sfriedmapixar <sfriedma@pixar.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-16 12:42:28 -07:00
Alex Wells b4026fd169 Turn on clang-format
Signed-off-by: Alex Wells <alex.m.wells@intel.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-16 12:42:28 -07:00
Larry Gritz efeb577933 More printf -> fmt conversion (#1506)
Banish the last of the sprintf calls (except the handful that need
to be there, because such formatting is still supported in shaders
themselves, so something needs to understand them).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-13 13:34:22 -07:00
Larry Gritz fdd8ff04a3 Constant folding of startswith() (#1507)
We have constant folded endswith() for a long time. Dunno why we
overlooked startswith, but here it is.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-12 22:47:03 -07:00
Larry Gritz 89cc2374c7 More conversion of old printf style to std::format style (#1504)
Another semi-random collection of conversions. Bit by bit.

These are all internals, none of it involves public interfaces.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-11 11:12:45 -07:00
Larry Gritz 5fc4ee50f6 A couple tweaks in how we build OIIO for OSL's CI (#1505)
* Use unity build to speed up OIIO build (for sufficiently new OIIO).
* Build OIIO with STOP_ON_WARNING=OFF, so that if a compiler upgrades
  and makes new warnings for OIIO, that doesn't break OSL's CI build.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-11 08:03:17 -07:00
sfriedmapixar d8a9993f63 Batched closures (#1500)
Add support for closures to the batched interface.

The renderer interface for closures, including registering
and processing them remains unchanged.

The Ci variable in BatchedShaderGlobals has moved from
the uniform portion to the varying portion, which may
require changes to any renderer code that was utilizing
the BatchedShaderGlobals.

To utilize closures with the batched interface, you register
the closures per usual, then once shading has finished,
the Ci in BatchedShaderGlobals will contain an Block of pointers
to the roots of a closure trees that can be processed
independently just like in the normal single-point interface.

This initial implementation is largely functional, however,
there may be more optimization gains available in the code
that copies the run-time SIMD values and scatters them
to the separate closure-data locations.

One remaining un-implemented feature is passing
_closures_ via get/setmessage() when using the batched
shading interface, and the locations where that would
need to be implemented are marked in the source.

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>

* Address batched closures review comments:
* Remove unneded Block specializations for pointers.
* Rename null variable to null_value.
* remove a 0 default param to rop.llvm_void_ptr in batched_llvm_gen.cpp:llvm_gen_mul
* Optimizations to masking and loading in wide_opclosure.cpp
* Fix LLVM11+ builds by using llvm_vecor_type instead of llvm::VectorType::get

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>

* Remove unneeded oslclosure.h in wide.h now that we aren't explicitly instantiating the templates.

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2022-05-11 07:11:20 -07:00
Larry Gritz 96fe1eff44 CHANGES and bump version in advance of next developer preview
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-10 22:15:26 -07:00
Larry Gritz 033dae3772 CI: adjust to upgrading Intel Clang compiler to 2022.1.0 (#1501)
The Intel OneAPI LLVM-based C++ compiler, as we download it from Intel
for our CI, bumped from 2022.0.0 to 2022.1.0.

New warning popped up -- newest Intel LLVM-based compiler warns about
overriding certain floating point math flags.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-09 22:56:14 -07:00
Christopher Kulla 5efe15a79e Windows build fixes for recent free function render services (#1502)
* Fix warnings from stdint on windows by pre-including the standard header

* Make sure register_JIT_Global is a public symbol since it needs to be called by client code

* Fix how llvm-as, llvm-link and python are invoked by cmake so they can be properly found on Windows platforms

Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-05-09 16:03:51 -07:00
Larry Gritz 3d00dbcd55 More conversion of internals to std::format style, bit by bit (#1493)
There's no rhyme or reason to this particular set of changes... I just
picked a few files and did the obvious conversion. Will do more in
subsequent PRs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-04 09:45:06 -07:00
Larry Gritz 10b72648a8 CI: add a test that builds with clang14 (#1498)
A few minor changes were needed to address new warnings.

clang14 warns if you use bitwise `|` or `&` in an `if`, but there are
some places where we do that purposely to avoid branches.
Disable clang14 warnings about bitwise ops for all of liboslexec.

Also some batch shading related vectorized loops fail to vectorize
with clang14 -- though they worked fine with clang12 -- and so we
needed to mark those as "complex" SIMD loops. Is this a regression
with clang14?

Revise simd loop pragma for wide_transformc due to llvm14 regression

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-03 22:43:35 -07:00
Steena Monteiro e5dd190874 rs_free_function (#1494)
In order to move towards shader execution on devices, we need to replace
host side interactions with new concepts that can exist on the device (or host).
The current virtual function based RendererServices exemplifies this dependency
on host side objects.

To break the dependency we introduce free function based renderer services (rs_free_function.h)
To simplify its introduction, we only added the renderer service free functions required by opmatrix.cpp.
Goal is to have a single opmatrix that can be compiled for host or device (eventually).
Renderers can provide llvm bitcode representation of their renderer service
free functions to the ShadingSystem.  During shader compilation/JIT the
renderer's bitcode is combined with opmatrix.cpp bitcode along with the JIT'd shader network.
The idea is the combined LLVM IR representation can then be lowered to the target
(be it on the host or device[SPIRV|PTX]).  Thus a renderer's free function implementation can be shared.

opmatrix.cpp now only calls the free functions (not virtual RendererServices).
However liboslexec on the host contains an rs_fallback.cpp which forwards
calls through the existing virtual RendererServices for seamless compatibility
when a renderer does not provide bitcode for the renderer services.

Testshade has been modified to optionally to provide rs_bitcode,
utilizing a new Cmake macro, EMBED_LLVM_BITCODE_IN_CPP, to turn rs_simplerend.cpp (the free function implementation)
into bitcode.

Free functions can be enabled via --use-rs-bitcode flag in testshade.

Free functions need access to RenderState values because they lack a this
pointer like the RendererServices virtual methods have. Added a RenderState
containing minimal set of values required by free functions.
Testshade/SimpleRenderer is responsible for setting RenderState values.

Added ShadingSystem attribute rs_bitcode to hold renderer services free function bitcode (provided by the renderer)

Renderers using global variables (like ustring's) not in strdecls.h must register their global variables' addresses
using OSL::register_JIT_Global (const char *global_var_name, void *global_var_addr).
This is necessary for the JIT process to resolve global variables that are embedded in RendererServices bitcode.
A validation step occurs that emits an error with a list of unmapped global variables.

RendererServices can reference strings with the STRING_PARAM(varname) macro.
By default, STRING_PARAM(varname) works for any string in strdecls.h.
For any string NOT in strdecls.h, it will map to a global variable with a prefix of "RS_".
For example, STRING_PARAM(raster) maps to a global ustring RS_raster.
NOTE:  C linkage with a "RS_" prefix is used to allow for unmangled
non-colliding global symbol names, so its easier to pass them to
OSL::register_JIT_Global(name, addr) for host execution
NOTE:  the STRING_PARAMS macro adapts to OSL_HOST_RS_BITCODE macro
to utilize the RS_ prefix.  RS_ prefixed versions of all OSL::Strings
intances have been created by rs_free_function.h, so the same STRING_PARAMS
macro can be used for renderer service or OSL strings.
NOTE:  We expect the handling of strings to change in the future possibly being replaced by Handles entirely

It is the renderer's responsibility to instantiate any NEW ustring global variables with the proper RS_ prefix;
It is the renderer's free function implementation to import/extern any of these NEW global variables with the proper RS_ prefix;
For testshade, a rs_strdecls.h has been added and is utilized to instance the RS_ global variables and register their addresses with OSL in simplerend.cpp.
rs_strdecls.h is also used by rs_simplerend.cpp (free function implementation) to create the externs with the RS_ prefix.

NOTE: DO NOT instantiate global variables inside the free function renderer services, because we strip global constructors as part of the pruning process.

Added LLVM_Util::validate_global_mapping to identify unresolved globals.

Added utility macro __OSL_STRINGIFY(string_value) in oslversion.h.in so the
proper naming prefix is used and we don't have multiple implementations around.

Added liboslexec build step to produce bitcode containing OSL library functions that depend on free functions (here, opmatrix.cpp)

Added a new Cmake EMBED_LLVM_BITCODE_IN_CPP function in llvm_macros.cmake that replaces the LLVM_COMPILE macro
and provides for both linking and serializing multiple OSL cpp files.

Fixed cuda.macro to use new location of serialize-bc.py in src/build-scripts.
Fixed formatting issues.

Disabled erasing llvm.global_ctors from LLVM module because of issues on MacOS Apple Clang.
Left as future work.

Added better error checking for module_from_bitcode().

Signed-off-by: Steena Monteiro <steena.monteiro@intel.com>
2022-05-03 21:22:02 -07:00
sfriedmapixar 880b44620a Fix for memory error on teardown of testrender due to late destruction of shader shared pointers. (#1499)
Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2022-05-03 21:17:13 -07:00
Larry Gritz 0a55421f34 More comprehensive warnings about things that don't optimize away (#1497)
New classes of warnings triggered when enabling option "opt_warnings":

* Creation of new strings mid-shader.
* Access to the characters of strings mid-shader.

We already warned about texture access by name that could not be
turned into a handle.

In all of these cases, we only warn *after* runtime optimization, so that shader
idioms in the source code that appear to do these forbidden things will not warn
as long as they can be reduced to safe operations in the course of the runtime
optimization step.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-05-02 11:39:36 -07:00
Larry Gritz b7a87285a1 Build: cmake improvements (ported from OIIO) (#1495)
checked_find_package:

* Optional SETVARIABLES gives a list of vars to set to TRUE if the package
  is found.
* Optional DEBUG flag turns on extra debugging information about how the
  package is found.
* Optional PREFER_CONFIG uses a dependency's exported config, if available,
  rather than our Find module.
* Global ALWAYS_PREFER_CONFIG option can be set to ON to always prefer
  config over Find modules for all dependencies.

fancy_add_executable:

* -DENABLE_INSTALL_<executable>=OFF lets you turn off the installation
  of an executable.

other:

* Change the target name for doing the clang-format over the code to
  "run-clang-format", because "clang-format" is an imported target name
  of the libclang exported cmake (which we may wish to use soon).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-29 18:43:52 -07:00
Tim Grant b0d8cb82a2 OptiX matrix fixes (#1485)
* Pass some extra headers to NVCC_COMPILE to make sure that the PTX files are regenerated whenever those headers are changed.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Don't generate PTX for rend_lib.cu when using OptiX 6.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Fix the callable program signature for the init and group functions in the OptiX wrappers.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Fix issues with the LLVM arguments for osl_printf when targeting CUDA.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Fix llvm_gen_construct_triple for OptiX. The 'to' argument was not handled correctly.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Improve support for CUDA osl_get_matrix.

Signed-off-by: Tim Grant <tgrant@nvidia.com>

* Add basic support for named transforms to testshade/testrender.

Signed-off-by: Tim Grant <tgrant@nvidia.com>
2022-04-28 23:17:11 -07:00
Larry Gritz 9cfca9397b Support for LLVM 14 (#1492)
API changes we had to take into account:
* TargetRegistry.h location
* No more DisableTailCalls field in PassManagerBuilder.

Needed to update the ref image for render-microfacet test, some sparklies changed.
Looks like the new LLVM probably JITs to ever so slightly different math code, tickling
some LSB differences that at 1 sample per pixel, results in some different sampling
directions leading to fireflies. We decided to just commit a new ref image and move on.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-27 23:55:08 -07:00
Larry Gritz a056e181c2 Fix generated OSLConfig.cmake -- wrong Imath version (#1489)
In our generated OSLConfig.cmake, we inserted a find_dependency(Imath)
that accidentally demanded the OpenEXR_VERSION (should have been
Imath_VERSION). That works fine as long as Imath version is the same
(or higher) than the OpenEXR version. But if the installed OpenEXR
version is somehow ahead of the Imath version, it will fail.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-21 13:14:43 -07:00
Larry Gritz d8000dfc2c CI: bump 'latest' openexr and pybind11 versions (#1488)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-18 18:11:26 -07:00
Larry Gritz 8feaff41fe More fmt conversion (#1490)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-18 14:59:33 -07:00
Larry Gritz 97d5337283 Some fmt conversion (#1487)
A small instalment on the long-term shift from printf-style formatting
to std::format style formatting.

Define preprocessor OSL_INTERNAL, which is defined when compiling OSL
itself, but will not be defined for downstream projects using the OSL
headers.

When building OSL, enable the symbol OIIO_ERRORHANDLER_HIDE_PRINTF,
which causes ErrorHandler methods using the old conventions to be
marked as deprecated and generate warnings.

Clean up all the calls revealed by those warnings. (And
opportunistically clean up some other things that happened to be in
the same files.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-15 18:56:35 -07:00
Brecht Van Lommel 87913529e1 Add ACES2065-1 and ACEScg as shading system color spaces (#1486)
To make functions like blackbody, wavelength and luminance work with these
color spaces.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2022-04-15 16:58:39 -07:00
Larry Gritz 4e96ab13dd Bump version for developer snapshot v1.12.4.5
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-08 15:40:50 -07:00
Larry Gritz 2e1c0a95c2 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-08 14:41:07 -07:00
Christopher Kulla 096fab8da7 Fix minor warnings about pointer casts on windows (#1484)
Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-04-08 12:34:31 -07:00
Christopher Kulla aeba1f2db4 Add Visual Studio Code folder to gitignore (#1483)
Signed-off-by: Chris Kulla <ckulla@gmail.com>
2022-04-08 11:23:07 -07:00
Larry Gritz 7e34ce27c7 Hide Matrix22 definition better -- it's not part of any public API (#1480)
Also change the one exception mentioned to a std one, matching
Imath 3.x and insulating us from any of the old Iex custom exceptions
from Imath 2.x.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-04-01 16:38:24 -07:00
Larry Gritz 8589d4dd7b CHANGES and bump version for developer snapshot v1.12.4.4
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-28 18:46:49 -07:00
Larry Gritz 20bcc714b9 Fix GPU codegen crash (#1479)
llvm_load_device_string wasn't considering temporary string variables,
only declared local variables.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-28 18:22:22 -07:00
Larry Gritz a1dc6d7c87 Print all 4 version numbers in help messages (#1477)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-28 13:24:27 -07:00
Larry Gritz e493510d81 Add Alex Wells to TSC, per recent vote (#1478)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-22 16:47:48 -07:00
Larry Gritz 9b3f15b170 Fixes for recent OIIO TextureSystem API changes (#1476)
Changed a function signature in OIIO master that threw us off here
just a tad, as there was no direct type conversion the compiler could
figure out on its own. Easy adjustment gives it the right hint.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-15 16:51:03 -07:00
Larry Gritz 8c52d48965 Convert osof() to oslfmt() using the std::format convention (#1470)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-10 09:05:12 -08:00
Larry Gritz 9b33a7af3b CI: refactor ci.yml to use strategy matrix (#1474)
This eliminates a huge amount of redundancy in our CI descriptions --
instead of the entire CI logic replicated for each test in its own
universe, we group tests into (a) all the ones based on ASWF VFX
Platform containers, (b) non-VFXP-year oddballs run on Ubuntu, (c) Mac
tests, (d) clang-format verification. Each has the build logic
expressed once, and a short list of variables that change for each
individual test of that category.

This organization is much easier to read, maintain, modify tests, or
add new test variants, and cuts the size of the ci.yml file by over 50%.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-09 21:40:25 -08:00
Alex Wells 2a186f8bc4 Enable icx compiler to vectorize OSL_OMP_COMPLEX_SIMD_LOOP (#1475)
Avoid many clang vectorization workarounds for OSL_INTEL_LLVM_COMPILER_VERSION
Added Makefile option VEC_REPORT to turn on generation of optimization reports
Reduce impact of REQUIRE_INF_NAN for icx by explicitly honoring inf, nan, and signed zeros vs. disabling fast-math

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-03-09 16:38:14 -08:00
Alex Wells 2ab1c5e322 CI: Add icx test, and other changes to support it (#1473)
Add compiler support for Intel(r) oneAPI DPC++/C++ Compiler (based on LLVM technology).

Detect if CMAKE_CXX_COMPILER_ID matches "IntelLLVM" and set CMAKE_COMPILER_IS_INTELCLANG=1
NOTE:  CMAKE_COMPILER_IS_INTEL will not be set, that is reserved for the classic Intel(r) C++ Compiler.

Define OSL_INTEL_LLVM_COMPILER to hold an encoded Intel(r) LLVM Compiler version
(e.g. 20220000), or 0 if not an Intel(r) LLVM Compiler.
Define OSL_INTEL_CLANG_VERSION to hold the encoded Clang version the
Intel(r) LLVM Compiler is based on (e.g. 140000),
or 0 if not an Intel(r) LLVM compiler.

Ensure OSL_CLANG_VERSION is when its a vanilla clang compiler, not apple or Intel(r) oneAPI DPC++/C++ Compiler.

Added OSL_ANY_CLANG which is set for any clang based compiler.

Removed OSL_NON_CLANG_COMPILER.
Updated uses of OSL_NON_CLANG_COMPILER with more specific and understandable combinations of OSL_ANY_CLANG, OSL_INTEL_CLANG_VERSION, and OSL_INTEL_COMPILER.

Make sure our math calculations are consistent,
especially division.  Different compilers may have choose to use
reciprocal division loosing precision causing slightly different
results which can lead to aliasing differences when running the testsuite
Disabled reciprocal division for all projects.

if -ffast-math is enabled to to the underlying compiler, inf's and NaN's may not be handled properly (by design)
When building liboslexec, ensure any source files that require proper INF or NaN handling have additional command line flags passed if needed (as the default behavior maybe -ffast-math):
    shadingsys.cpp
    wide/wide_shadingsys
    wide/wide_optest_float

Enable unitialized Matrix44, because all of its members get overwritten anyway, in impl_transform_normal_masked.

Added alternative test results where needed, wsing '.icx.' as shorthand for the Intel(r) oneAPI DPC++/C++ Compiler in alternative test result filenames.
Changed some tests to use the pretty(value) which clamps values close to 0 to be 0 to avoid lots of different alternative rest result files when using printf.
Added "--center" option to several regression tests to avoid aliasing in results between SIMD batched and scalar execution.

* Added icx-vp2022 to CI plan.

* To better clarify the classic vs. LLVM based Intel compilers and that they have version #'s not just 0 or 1,
renamed OSL_INTEL_COMPILER to OSL_INTEL_CLASSIC_COMPILER_VERSION
renamed OSL_INTEL_LLVM_COMPILER to OSL_INTEL_LLVM_COMPILER_VERSION

Removed unnecessary FMT_VERSION and OPENIMAGEIO_CMAKE_FLAGS from the icx-vp2022 worklow, added back USE_SIMD.
Fix spelling of losing.

Added OSL_OMP_COMPLEX_SIMD_LOOP(...) which is enabled or disabled in platform.h based on which compilers/versions can handle vectorizing complex nested control flow.  This makes it cleaner to document which loops need to vectorization conditionally controlled and centralizes where it is managed.

* Removed extra fp-model=consistent for icx-vp2022 workflow

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-03-08 09:45:45 -08:00
Larry Gritz 7366046f47 CI: Add test that uses the Intel icc/icpc compiler. (#1459)
(and a bunch of minor changes to support this)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-04 10:17:46 -08:00
Larry Gritz 1773995dbc Build: allow -Werror to be disabled even on CI branches (#1471)
Slight reworking of -Werror logic to let the default behavior be
changed by setting a cmake variable. In particular, this allows us to
make a CI build disable -Werror when we need to.

Previously, having the "OSL_CI" env variable set trumped all else and
forced -Werror. Now it just contributes to the default behavior, but
setting `-DSTOP_ON_WARNING=OFF` and cmake config time can still
disable it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-04 00:08:16 -08:00
Larry Gritz 2bdd9b567a Testsuite: allow using oiiotool for image diffs instead of idiff (#1472)
Additionally, allow custom command line arguments to run after each
image is loaded, but before the comparison.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-03-01 17:40:15 -08:00
Larry Gritz 9ee6b08f76 Make exported cmake configs relocatable by using relative paths (#1466)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-25 13:41:01 -08:00
Larry Gritz 77df61003c Start switching over from sprintf to fmt (#1469)
Turn on warnings about OIIO::Strutil::format and ustring::format

We should be using Strutil::sprintf / ustring::sprintf, or upgrading
entirely to Strutil::fmt::format / ustring::fmtformat.

Some day, the plain "format" will be deprecated, then disappear, then
reappear as compatible with std::format (as are fmt::format/fmtformat now).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-25 12:50:34 -08:00
Larry Gritz 701dcab948 Fix botched handling of OPENIMAGEIO_CMAKE_FLAGS during CI builds (#1468)
The gh-installdeps.bash file accidentally squashed any value that
the env variable already had. Oops.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-25 09:50:31 -08:00
Larry Gritz 97a4ac8338 Avoid OIIO::string_view::str() (#1467)
The str() method was not part of the final C++17 std::string_view.
To ensure future interchangeability with std::string_view, change the
few places where we call str() in the OSL code base.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-23 16:50:35 -08:00
sfriedmapixar c2b1d86c69 Add N/I to globals needed list when backfacing() shadeop is used (#1462)
* Track that the backfacing() shadeop requires N and I shader globals.

* Test ensuring that N and I are reported as needed shader globals when a backfacing() shadeop is used.

Signed-off-by: Stephen Friedman <sfriedma@pixar.com>
2022-02-23 16:03:30 -08:00
Alex Wells 0392aea57e Implement Batched pointcloud_search, pointcloud_get, and pointcloud_write. (#1464)
* Implement Batched pointcloud_search, pointcloud_get, and pointcloud_write.

Updated behavior of scalar pointcloud_search and pointcloud_get to not code gen branch with code gen runtime error for maxpoints/num_points larger than array size.  Instead now it codgens a clamp of the maxpoints/num_points to the arraysize.  This allows code to continue executing, and if accessed outside of the range, existing codgen range checks will still emit a runtime error.

Extracted class PointCloud defnition and some helper functions to pointcloud.h so it can be shared between batched and scalar implementation.
Moved PointCloud out of anonymous namespace to OSL::pvt so a single implementation (including static maps) could be shared between batched and scalar implementation.

Refactored implementation of
template<typename DataT, int WidthT> struct Masked;
template<typename DataT> struct Ref;

to flatten class hierarchy and fix bug where derivatives of unbounded arrays could not be constructed, IE:
MaskedDx<int[]> myDeriv(ptr, arraylength);

Added                                  MaskedData::assign_val_lane_from_scalar
Renamed MaskedData::assign_val_from to MaskedData::assign_val_from_wide
Renamed MaskedData::assign_all_from to MaskedData::assign_all_from_scalar

Updated BatchedAnalysis to indicate that results of pointcloud_search, pointcloud_get, and pointcloud_write are always varying regardless of the symbols passed in.
Updated debugging in BatchedAnalysis to emit unmangled symbol names.

Properly implement (was broken previously) BatchedBackendLLVM::llvm_zero_derivs(const Symbol& sym, llvm::Value* count) including using code gen loop to reduce code bloat.

* Fixed warnings about BatchedRendererServices<WidthT>::pointcloud_get and BatchedRendererServices<WidthT>::pointcloud_write not returning a value.

* Fixed unused variable "ok" in batched pointcloud_write.
Fixed undefined type when building with USE_PARTIO=0

* Update pointcloud tests to avoid non-deterministic results for unsorted results and out of range max_points/num_points.
Added support for NOOPTIMIZE file tag for batched regression tests.
Made array-length-reg NOOPTIMIZE so its code gen would actually execute vs. constant fold.
Fixed bug for storing arraylength result in varying result symbol.

* Fix missing virtual function overrides of MyBatchedRendererServices in example-batched-deformer

* Change varying point cloud tests to use pixel centers in order to avoid situations where point cloud could provice multiple data points at equal distances causing non-determinism.

* More changes to avoid non-determinism in pointcloud test results

* Add alternate reference images for point cloud results that were coming back slightly different for essentially identical distances.

* Fixed bug in llvm_gen for raytype where the wrong type was passed as a parameter for a string.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-02-19 10:17:35 -08:00
Larry Gritz 89207ef83a Fix testrender sphere tangents, per MaterialX suggestion (#1465)
Fix erroneous computation of sphere tangents

Add render-uv test to check

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-19 09:10:03 -08:00
Larry Gritz d34c3f584c Adapt to OpenEXR/Imath changing branch master -> main (#1463)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-14 14:34:57 -08:00
Larry Gritz 72d530702e CHANGES and bump version to dev snapshot v1.12.4.2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-11 12:03:26 -08:00
Larry Gritz bf185d1245 CI and build miscellaneous fixes (#1461)
(many ported/replicated from various recent OIIO PRs)

* CI: bump to latest dependency releases

* Bugs fixed in build_opencolorio.bash, it botched some of the
  directory choices when customizing where to place and build
  it. Also, switch to the more standard BUILD_SHARED_LIBS cmake
  variable to control whether to build dynamic or static libraries.

* Correctly handle the cmake variable VISIBILITY_MAP_FILE being set to
  "" on the command line as a way to disable using the visibility map
  file entirely.

* On Linux, also set link flags `--exclude-libs ALL` to hide symbols
  from any embedded static library dependencies, to prevent clashes
  with other versions of those libraries that may be compiled into a
  DCC app.

* Some other minor touch-ups in compiler.cmake.

* Refresh build_openexr.bash with the latest changes from OIIO.

* CI workflow: revise failed build artifact storage to capture cmake
  files.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-11 12:00:30 -08:00
Larry Gritz 58a25f1bea Favor our choice of Imath includes over OIIO's. (#1460)
New OIIO guards the contents of its Imath.h with the
`OIIO_IMATH_H_INCLUDED` preprocessor symbol. This lets us in OSL
pre-define it to absolutely ensure that OSL headers are including
exactly the Imath headers they want, not accidentally getting the ones
that OIIO includes.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-02-11 11:05:22 -08:00
Larry Gritz b816c21b19 Wean ourselves off of OIIO::string_view::c_str() (#1458)
OIIO's string_view::c_str() was cute, but it's a little dicey and it's
not present in the C++20 std::string_view. We didn't use it in a ton
of places, so replace with other idioms so that in the future we are
better able to interchange with or switch to std::string_view (when
our minimum supported C++ standard is high enough).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-28 14:32:50 -08:00
Larry Gritz c476b4727d oslc: detect using type name as an variable identifier (#1457)
Here was the construct it was confused by:

    struct Data {
        float height;
    };

    Data foo(Data a, float b)
    {
        return Data;   // <----- what's this madness?
    }

Curiously, this revealed a source code error in one of our other tests,
oslc-err-struct-print, which had not been detected previously!

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-27 16:56:21 -08:00
Alex Wells f7fccf6a3a Implement batched version userdata and output placement. (#1455)
Added Wide<const int, WidthT> wide_shadeindex, void* userdata_base_ptr, void* output_base_ptr to BatchedExecutor interface (and underlying implementation) that allows each data lane
of a batch to utilize a different shade index in combination with a uniform userdata and output base pointer.

Fixed bug in batched version of llvm_gen_compassign where index was being loaded as uniform value even when it was varying (really just caused assert/extra output in Release).
For scalar and batched, avoid generating code for init ops or default values when a sym_loc is found because unlike get_userdata, when supplied sym_loc can't fail.

Improved LLVM_Util::op_scatter to handle scalar destination data types, previously only wide destination were required but to handle scatter results from SOA wide data layout to AOS
output placement layout scalar destinations need to be supported.

Updated BatchedRendererServices to be less abstract replacing several pure virtual functions with default noop versions to better match behavior of RendererServices.

Changed testshade to utilize output placement by default in batched mode.
Added NOSCALAR option to testing framework to allow for batched only tests.

Added testsuite/example-batched-deformer to exercise userdata placement and simple example of utilizing batched interface.

Added alternate output for example-batched-deformer to account for some rounding differences.

Added comment to note that the batched implementation assumes that SymLocationDesc::offset is readable at point 0 (because we clamp masked off lanes to 0 vs. adding conditionals).
Renamed local variable wide_index_to_output to wide_index_for_userdata to more accurately describe how it is used.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-01-25 13:23:28 -08:00
Alex Wells 72acb7caf1 Implement batched versions of isnan, isinf, and isfinite. (#1456)
Implement batched versions of isnan, isinf, and isfinite.

Added batched regression testsuite ieee-fp-reg.

NOTE:  its really difficult to test isnan(value) == true,
as its unclear to actually generate a NAN in OSL because
most functions are "safe" and check/avoid NAN's

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-01-25 12:26:33 -08:00
Larry Gritz 40223e513b Bump version for developer preview build 2022-01-20 12:33:07 -08:00
Larry Gritz e71dfec941 CI: Bump OpenColorIO and fmt "latest" versions (#1452)
They have recently had new releases. Make our CI keep up.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-20 10:22:54 -08:00
Larry Gritz 0e4a7e6f90 Separate C++ that we build with from that we demand downstream (#1454)
We were passing along, in the exported cmake config files, a demand
for downstream clients to use a C++ standard version equal to that
which we used to build OSL itself. But that's not necessary. We may
choose to build with C++17 (for example), but all of our public APIs
are safe to use for C++14.

Split the build-time options to CMAKE_CXX_STANDARD for the standard we
build this project with, and DOWNSTREAM_CXX_STANDARD for the standard
we are declaring is the minimum to *use* the library.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-20 09:16:56 -08:00
Alex Wells 7baa2937b0 Odds and ends to enable BATCHED execution of most testsuite (#1453)
* Enable BATCHED execution of most testsuite entries that don't use closures or point cloud.

Added batched implementation of hash function.

Updated batched implementation to use the symbol.get_int(), symbol.get_float(), and symbol.get_string() methods vs. *(int*)symbol.data() approach.

Fixed bug in batched code gen where mangled symbol names were output as part of debug uninit warnings and range checking.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Fixed reparameter in batched execution.
Updated batched behavior for unlocked geom shader output parameters to function like scalar version.
Fixed batched bug when non-entry layers are executed and execution masks are compared producing a <i1x16> instead of i1 for use in conditional operation.

Added more reparameter test cases to cover arrays and arrays of aggregate types.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Enabled command line assignable user data for batched execution in testshade, which fixes testsuite/userdata-passthrough
Changed print_outputs for batched execution to not use << operator which includes parenthesis, but instead output each componenet with spaces to match the non-batched print_outputs.

renamed MaskedData<...>::assign_from(void* ptr_wide_data) to assign_val_from(const void* ptr_wide_data) to better reflect that only the value is assigned, and Dx and Dy are NOT assigned.
Added MaskedData<...>::assign_all_from(const void* ptr_data) to take a scalar DataT and broadcast it to all lanes of the MaskedData, masked off lanes are NOT overwritten, and value, Dx, Dy are assigned.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Apply clang-format to wide.h
Add some paranetheses to conditional to avoid warning.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Wrapped all printf arguments with pretty() in testsuite/geomath/test.osl to avoid small floating point differences from affecting printed results in test.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Add testsuite/geomath/ref/out-alt.txt to allow for minute floating point differences with some compiler/platform combinations.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-01-13 15:38:43 -08:00
Larry Gritz c79e4a7a4b Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-10 14:59:39 -08:00
Larry Gritz 7f40f3687c Rebuild pdf language spec docs
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-10 13:01:34 -08:00
Larry Gritz 4c7c3922ea CHANGES and docs touchups
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-10 13:00:21 -08:00
Dieter De Baets 6814224f0e windows compile fix (#1451)
Signed-off-by: Dieter De Baets <debaetsd@gmail.com>
2022-01-10 10:30:34 -08:00
Larry Gritz 0b8ddec6d9 Remove out of date MaterialX shaders (#1450)
We used to build MaterialX shaders on our end. Now it's all done in
the MaterialX project itself, and along the way, we failed to keep in
sync with them. (And even if we had "kept up", what does that even mean?
We want OSL to be independent of any particular MX release, but the MX
shaders may change from release to release. Better to be entirely on
their side of the fence.)

We turned off building these shaders by default a long
time ago, now let's finally remove the last remnants and urge everyone
to rely on the MaterialX project for this material.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-07 15:20:28 -08:00
Alex Wells 5c43516282 Add batched support for trace, setmessage, and getmessage (#1448)
Added MaskedData::assign_from(void *ptr_wide_data) to perform a masked copy of wide data at some address.
Added enum class RenderServices::TraceOpt::LLVMMemberIndex to correlate C++ data members with LLVM type generated by BatchedBackendLLVM::llvm_type_batched_trace_options()

Fixed bug in BatchedBackendLLVM::llvm_load_arg where array types where only properly broadcasting uniform to varying arguments for the 0th element of the array.

For batched implemented trace options as a LLVM type with direct code gen to alloca, init default values, and set optional values vs. callbacks.  Same code could be resused for non-batched impl.

Added BatchedMessageBuffer to context and BatchedMessageList to wide_opmessage.cpp to allow a shared buffer to be cleared by the ShadingSystem while allowing target specific compilation of SIMD import/export of message values into the list to compile in wide_opmessage.cpp.

Extended testshade's SimpleRenderer and BatchedSimpleRenderer to implement trace and getmessage to allow new tests to exercise some basic functionality.

Added new batched regression tests:
  message-reg
  trace-reg

Added new test:  message-no-closure which is a simplied version of message with no closures

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Temporarily disable simd compilation of message import and export data to test if that is cause of crash in bleeding edge CI workflow.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Temporarily disable more simd compilation of batched message test if that is cause of crash in bleeding edge CI workflow.
Temporarily run only message-reg test for bleeding edge CI workflow

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Temporarily run only message-reg.regress.batched.opt for bleeding edge CI workflow

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Fix alignment of MessageBlock allocation so that reads/writes can be assumed aligned to Block<> data members

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Re-enable disabled simd statements from trouble shooting bleeding edge CI.
Re-neable all tests for bleeding edge workflow.
Applied clang-format to wide_opmessage.cpp

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2022-01-06 16:58:29 -08:00
Larry Gritz 450a9e37cf CI: pybind11 adjustments (#1449)
* pybind11 2.9.0 release -- bump the vfx2022 and "latest" CI tests to
  use it.
* Adjust other CI test pybind11 versions to get good coverage across all
  the pybind11 releases, and to synchronize the vfx platfom tests with
  the pybind11 release that was current for its respective year.
* Sync build_scripts/build_pybind11.bash with the latest in OIIO, including
  bumping the default pybind11 version we download to 2.8.1.
* Opportunistic touch-up of warnings about llvm version to bring
  into sync with our actual current requirements.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-01-05 13:00:20 -08:00
Larry Gritz 7e2bcbb122 RuntimeOptimizer: Fix messages & unknown_message_sent initialization (#1447)
Alex Wells pointed out that they were never explicitly initialized.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-12-14 18:21:46 -08:00
Larry Gritz 535b560b0d Update films and product list
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-12-12 15:28:29 -08:00
Larry Gritz eb35c6185a Bump LLVM minimum from 7 to 9 (#1441)
Among other cruft that existed to support versions 7 and 8, this lets
us completely get rid of PrePromoteLogicalOpsOnBitMasks custom pass,
which is only needed for LLVM < 8.

Also get rid of some cmake checks for LLVM versions that require
C++14 or higher -- not necessary now that C++14 is our minimum.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-12-09 12:58:38 -08:00
Alex Wells 4faeda1234 Add batched support for dict find, dict next, dict value. (#1445)
* Add batched support for dict find, dict next, dict value.
Implementation takes advantage of uniform values and only does lookup once and broadcasts results if necessary.
When nodeid is varying, it falls back to simple loop over active data lanes performing lookups.

* Added new regression test xml-reg.
Enabled BATCHED execution of existing xml test

* Add new wide_opdictionary.cpp missed in original commit

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-12-09 12:16:28 -08:00
Larry Gritz 15e0273eec Use a project-specific var for whether we're running in CI (#1446)
Maybe somebody else is building this as a subproject or has a variable
called "CI"?

* For our CI runs, set an env variable "OSL_CI" (not just generic "CI").

* Default STOP_ON_WARNING to be off for supported releases, only on by
  default for main branch where we're actively developing. Because you
  want downstream users who are building supported releases to not get
  tripped up when their compiler upgrades and there's a new warning.

* Make sure STOP_ON_WARNING is true for our CI runs, even for release
  branches -- but now check OSL_CI, not CI, in case somebody else has
  set that.

Fixes #1428

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-12-02 23:42:58 -08:00
Larry Gritz 5b775c7fc7 CMake tweaks (#1443)
* Make PROJECT_VERSION_RELEASE_TYPE be a cache string, so individual
  build configs or sites can override it.

* Make OSL_SUPPORTED_RELEASE be an overrideable option, and make
  OSL_DEV_RELEASE be driven by it, rather than (possibly incorrectly)
  independently set.

* Change OSL_IS_SUBPROJECT to PROJECT_IS_TOP_LEVEL (and with the opposite
  sense), to match CMake 21+ behavior. And no need to set it ourselves if
  using cmake 21+.

* All of the clang-format stuff should only apply if PROJECT_IS_TOP_LEVEL.

* Add a TIME_COMMANDS option to help debug performance of the build.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-12-01 12:20:57 -08:00
Alex WellsandLarry Gritz e7ca0926c9 Pr/batched texture (#1436)
* Add batched support for 2d texture calls, gettextureinfo.

To enable, added:
  bool RenderServices::is_udim (TextureHandle *texture_handle)
  TextureSystem::TextureHandle* BatchedRendererServices::resolve_udim_uniform(...,TextureSystem::TextureHandle*, float S, float T)
  void BatchedRendererServices::resolve_udim(...,TextureSystem::TextureHandle*,Wide<const float> wS, Wide<const float> wT, Masked<TextureSystem::TextureHandle*> wresult)

which allows batched code gen to resolve_udim's for varying S & T and bin the resulting TextureHandle* and make calls to get_texture_info_uniform with a single resolved udim texture handle, then broadcast the results to data lanes with matching TextureHandle *'s.

Added extensive new regression tests:
    gettextureinfo-reg
    gettextureinfo-udim-reg
    texture-opts-reg

Enabled BATCHED execution of existing tests:
    gettextureinfo-udim
    gettextureinfo
    texture-alpha-derivs
    texture-alpha
    texture-blur
    texture-connected-options
    texture-derivs
    texture-errormsg
    texture-firstchannel
    texture-interp
    texture-missingalpha
    texture-missingcolor
    texture-simple
    texture-smallderivs
    texture-swirl
    texture-udim
    texture-width
    texture-withderivs
    texture-wrap

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Removed some commented out includes

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Add conditional compilation dependent on OIIO version to enable RendererServices::is_udim

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Fix clang-format issues

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Fix bug in testing.cmake where non-existant OPENIMAGEIO_VERSION was being checked, when it should have been OpenImageIO_VERSION.

Added quiet option to oiio-tool calls in regression tests to allow produced out.txt to match between baseline and batched runs.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Added optional silent=False argument to oiiotool in test suite, allowing us to avoid generating warnings for file already exists that was causing differences when comparing baseline/out.txt and out.txt in regression tests

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Added missing batched texture option rnd for the llvm code gen representation

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Fixed compilations issues with OIIO 2.4 by enabling "rnd" batched texture option.
Fixed some other compilation issues when OSL_DEV is defined.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Cleared up some comments around populating rnd.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Add support for batched texture3d.

Discovered mismatch between documentation, llvm_gen implementation, and oslc when passing user derivatives to texture3d.
oslc and documentation expect optional parameters "vector dpdx, vector dpdy, vector dpdz",
however llvm_gen and optexture implementation only accept "vector dpdx, vector dpdy"
and use 0 for dpdz when calling into the texture subsystem.

This commit includes changes to oslc to make the compiler match the implementation of accepting only "vector dpdx, vector dpdy".

Enable BATCHED execution of testsuite/texture3d
Add new regression test textur3d-opts-reg

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Revert oslc to make the compiler match the documentation of accepting only user inputs that include dpdz:  "vector dpdx, vector dpdy, vector dpdz".
Fixed llvm_gen and optexture to properly extract user dpdz from texture3d options or initialize a Vec3(0) and pass through to texture subsystem.
Modified batched_llvm_gen and wide_optexture to properly extract user dpdz from texture3d options or initialize a Wide<Vec3>(0) and pass through to texture subsystem.
Updated texture3d-opts-reg test to pass dpdz for calls taking user derivatives.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Added batched support for environment.

Added BatchedRendererServices::environment virtual method

Added new test environment
Added new regression test environment-opt-reg

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* clang-format of batched_rendererservices.h

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Rename testsuite/environment-opts-reg to testsuite/texture-environment-opts-reg to line up with a different PR adding testsuite/texture-environment.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Removed some environment option test for "wrap" as that is an unsupported option for environment.
Added test and handling for "time" option to batched texture3d.  Current choice is to just silently ignore "time" as currently supported 3d formats do not support time.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Removed redundant environment test as texture-environment covers it.
Enabled BATCHED execution of texture-environment

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Extended test timouts further for arithmetic-reg.regress.batched.opt and transform-reg.regress.batched.opt which were causing spurious CI timeouts.
Reduced some multipliers of user supplied derivs to environment tests to reduce differences in results.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

Co-authored-by: Larry Gritz <lg@larrygritz.com>
2021-11-30 18:35:11 -08:00
Larry Gritz a33abee2ad Docs: fix missing "errormessage" explanation for environment and texture3d (#1442)
It was documnted for texture(), but not for the others, for which it
also has worked for many years.

Thanks for Alex Wells for pointing this out.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-24 15:57:40 -08:00
Larry Gritz 9d42d4a6f7 Testing: Adjust timeout strategy (#1440)
I recently bumped the ctest per-test timeout to 300s because one of the
batched shading regression tests was occasionally taking longer than the
prior limit of 240s.

But there is a better way: Individual tests can have their timeouts
set individually via set_tests_properties(TIMEOUT), so I raised the
timeout to 300s for all tests whose names contain "-reg", also kept it
rather long (the old 240s) for the long render tests that are all named
"render-". Then for everything else, we can actually lower the default
to 60s, since no other tests should be long-running.

(For the curious, the reason these batched regression tests are so
expensive is that they test a bunch of combinations, and they first
run the test in the non-batch scalar mode, then again in batched mode,
and compare the results to ensure that the batch code never deviates
from scalar. This makes them take at least twice as long as they
ordinarily would. But also remember that these are only run for the
few CI test matrix entries where we are specifically testing batch
shading.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-24 11:52:30 -08:00
Larry Gritz 81dacc2e3b Add testsuite coverage of environment() (#1438)
Can you believe we never had a test?

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-24 09:10:39 -08:00
Larry Gritz 1e84fc03ce Fix minor CI issues (#1439)
* Increase testing timeout, some of the batch shading regression tests
  seem to take longer than the prior 240s limit.

* Turn off OpenVDB when using the osl:2021 in combination with OpenEXR
  3.x -- the version of OpenVDB in the 2021 container is too old to
  understand OpenEXR 3.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-24 08:59:12 -08:00
Larry Gritz 5ec96f37a7 CI adjustments (#1434)
* Use LLVM 13 / clang 13 for the VFX Platform 2022 test.

* Add MacOS-11 test

* Poke around how to use arbitrary LLVM versions via Conan. (Works! But
  I have not yet enabled it.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-20 10:32:53 -08:00
Larry Gritz 748b895e05 Restore unit tests for texture3d (#1437)
OIIO master recently removed support for Field3D, which is rarely used
and the project is effectively unmaintained and isn't able to build
against the newer OpenEXR releases that we want to encourage people to
use.

So the primary purpose of this patch is to switch our unit test for
texture3d from using a field3d file (and thus would not run when using
newer OIIO) to a roughly equivalent test using openvdb (which is
supported, assuming OIIO is built in the presence of OpenVDB).

But, ha, I discovered two things, either one of which means that we
had actually not been unit testing texture3d at all lately: (1) To
discover whether the installed OIIO supported openvdb (and therefore
whether to bother running the test), we were relying on a totally
nonexistant OPENIMAGEIO_BIN cmake varaible. I don't know what that was
supposed to be (did I mean OIIOTOOL_BIN? but that also is not a
thing), but anyway, it caused it to always skip the test. (2) Oh boy,
the OIIO that we were relying on for may tests, provided by the ASWF
docker containers, was an OIIO that was not built in the presence of
OpenVDB (even though our OSL testing containers DO have OpenVDB), so
again it skipped the test because it needs that OIIO-side support for
texture3d() to know how to read openvdb files. Fix this by building
OIIO from scratch with openvdb support when doing the "VFX Platform
2022" test, rather than relying on the one in the container.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-19 23:42:37 -08:00
cmstein 1ff9aec2f1 osl_get_attribute() should use device strings when compiling for OptiX. (#1435)
Signed-off-by: Clifford Stein <cstein@imageworks.com>
2021-11-17 11:13:26 -08:00
Larry Gritz 47ddafda31 Raise OIIO minimum to 2.2 going forward (#1426)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-07 20:08:38 -08:00
Larry Gritz 0fedeb4212 CI: Update some of the 'latest' released versions we build against (#1433)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-07 15:24:54 -08:00
Larry Gritz 95def2d57b Banish the last of the sscanf calls (#1432)
Because they can fail with some locales. Replace with OIIO::Strutil
parsing functions that are locale-independent.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-07 15:24:34 -08:00
Larry Gritz 41f645902f Minor docs changes for changing master branch name to main (#1431)
Renaming the master branch to main is imminent. Here are the few
places where we refer directly to branch names that will no longer
exist.

While searching for "master/", I also noticed a couple files that
had the wrong project's copyright boilerplate on it (a lot of the
cmake scripts I write and submit to both projects simultaneously).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-07 15:22:09 -08:00
Larry Gritz 2120647911 Catch up to change in OIIO TextureOptBatch in development (#1430)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-04 23:29:54 -07:00
Larry Gritz 75d06a6c94 CI: OCIO renamed their master branch to main (#1429)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-03 16:27:13 -07:00
Larry Gritz ac544e8c9c CMake: use the more compact TARGET_NAME_IF_EXISTS to know if target exists (#1425)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-11-03 00:39:22 -07:00
Larry Gritz 6b6637e271 Fix one spot where we should have used OIIO::ofstream instead of std. (#1424)
This is primarily for the sake of mingw, but also is the proper kind
of stream to pass to OIIO::Filesystem::open.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-24 15:29:55 -07:00
Larry Gritz 0f44f46973 build: Be careful about default installation directory (#1421)
Use a cmake idiom so that you need an explicit -DCMAKE_INSTALL_PREFIX=
in order to write over /usr/local or any potentially sensitive area.
In the absence of this being set explicitly, it will configure the
cmake build so that an "install" ends up in ./dist (which is what the
Makefile wrapper did all along).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-24 15:29:31 -07:00
Larry Gritz bf02d4a98b Changes to work with LLVM 13 (#1420)
And a few places to let it compile with clang 13's new warnings.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-24 15:29:08 -07:00
Alex Wells 03a31f506e Implement spline and spline inverse for batched SIMD implementation (#1422)
Added
    template <int M00, int M01, int M02, int M03,
              int M10, int M11, int M12, int M13,
              int M20, int M21, int M22, int M23,
              int M30, int M31, int M32, int M33, int DivisorT>
    struct sfm::StaticMatrix44
to model a matrix whose elements are known at compile time.  Internally it utilizes proxys instead of floats in order to optimize for special cases of 0, 1, -1 elements and not even generate math when possible.  The StaticMatrix44 is used by wide_opspline.cpp to create specialized functions for each of the spline basis types.  A dispatch function routes the compile time optimized spline or spline inverse routine.

Altered splineimpl.h to provide "int basis_type_of(StringParam basis_name)" to allow the batched implementation to map a string to spline enum value used as an index in the dispatch function to functions optimized for each type of spline basis (instead of generic 4x4 matrix implementation)

Added "T sfm::select_val(bool cond, const T left, const T right)" as alternative to the ternary operator which appeared to possibly take address of its arguments which prevented privatization of those variables when compiled inside a SIMD loop.

Added note to BatchedAnalysis implementation identifying that local variables scope is lost between .osl and .oso and when a function is inlined multiple times, its local variables could be treated as varying when they could have been uniform if somehow identified as a local variable by the Analyzer.

Enable BATCHED testing of:
  spline-boundarybug
  spline-derivbug
  spline-nonuniformknots
  spline
  splineinverse-ident
  splineinverse

Added new BATCHED_REGRESSION tests:
  spline-reg
  splineinverse-knots-ascend-reg
  splineinverse-knots-descend-reg

Added sfm::Inverter to remove nested loop behavior of batched splineinverse as OIIO::invert has a loop which was called from inside the search interval loop, created a nested loop.  Under SIMD/SIMT the nested loop could execute incoherently.  Instead we choose to use the class sfm::Inverter to manage state between is_bracketed_by(min,max), meant to be called from the search interval loop, and bracketed_invert(min,max) meant to be called after exiting the search interval loop, avoiding a nested loop that could be executed at different interval's for each SIMD/SIMT lane/thread.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-10-18 22:13:51 -07:00
Larry Gritz 1d9eec69ab Rebuild docs and minor touchups
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-08 14:38:53 -07:00
Larry Gritz e26a597e3f CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-08 14:29:59 -07:00
Larry Gritz bee949cd3b Changes to OSL ownership of color systems (#1405)
Patrick Hodoul pointed out that we were forcing OpenColorIO to
initialize and read configs as soon as the ShadingSystem was
created. In this patch, we're changing to a lazy creation approach.

We remove the `OCIOColorSystem m_ocio_system` member and the
ocio_transform() method from ShadingSystem. Put them in the
ShadingContext instead. This allows lock-free access because each
context is used by only one thread at a time.

Within the OCIOColorSystem, make the `OIIO::ColorConfig` be a
shared_ptr rather than a member, so it can be created lazily.  If the
Context's OCIOColorSystem needs a config and doesn't have its own yet,
it asks the ShadingSystem, which allocates one the first time (and
only that one time).

So, in short, SS allocates *one* shared ColorConfig, the first time
any context asks for one. The Context only asks the SS for this once
per context (i.e., once per thread). Individual shades just use the
ColorConfig of their context, not needing to lock for it (except for
that brief lock the first time any context asks for the very first
ColorConfig that's needed).

Some things were guarded by `OIIO_HAS_COLORPROCESSOR`, which is silly
because we no longer support OIIO versions so old that it's not
defined.  But then OSL `undef`ed it for Cuda. I replaced these guards
by a more straightforward direct test of whether it was Cuda code.

I added a sample OCIO config to testsuite so we can use it for tests.
In particular, the new testsuite/ocio -- test using OCIO for color
transforms.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-05 13:45:11 -07:00
Larry Gritz 0d1d2de350 Fix oslc missing a write error on function parameter (#1417)
Fixes 1416

In OSL, function parameters must be marked as `output` or they are not
supposed to be writable. In issuing errors when a write is performed on
something not writable, we missed an interesting case:

```
void g(output float b) {
    b = 1;  // ok, since b is marked as output
}

void f(float a) {
    g(a);  // <--- should be disallowed, g is writing to f's non-output param
}

float x;
f(x);
```

This patch catches cases like these. The new error looks like this:

`test.osl:22: error: cannot write to non-output parameter "a", as passed to function g() as arg 1 (output parameter "b")`

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-10-05 13:42:46 -07:00
Alex Wells 54727f9dee More batched gen ops (#1413)
* Add batched SIMD implementation for all color operations.

Added batched llvm code gen for: llvm_gen_blackbody, llvm_gen_luminance, llvm_gen_transformc (including code gen of loop to identify unique "from" and "to" space combinations to call library function with).

Made ColorSystem const correct.
Pulled much of ColorSystem's implementation into src/liboslexec/opcolor_impl.h so it could be inlined in both opcolor.cpp and wide_opcolor.cpp.
To enable SIMD fast path for ColorSystem::blackbody_rgb added new methods to expose underlying lookup table optimization.
    bool can_lookup_blackbody(float T /*Kelvin*/) const;

    Color3 lookup_blackbody_rgb (float T /*Kelvin*/) const;

    Color3 compute_blackbody_rgb (float T /*Kelvin*/) const;
When can_lookup_blackbody() returns true
then lookup_blackbody_rgb can be safely called,
otherwise the expensive compute_blackbody_rgb is required.

Updated implementation of ColorSystem to succesfully vectorize on multiple compilers, optimized lookup table data types and indexed dereferences to generate prefered 32bit indexed gathers vs 64bit gathers which require multiple instructions and registers.

To improve code generation and less chances of aliasing issues, changed nested M[i][j] operator access to Matrix in ImathMatrix.h to directly access underlying 2d array M.x[i][j] also changed Vector operator V[i] to directly access V.x, V.y, V.z in OSL/IMathx/IMath*.h

Moved helper testIfAnyLaneIsNonZero from wide_opmatrix.cpp to be testIfAnyLaneIsNonZero in OSL/wide.h

Added sfm::min_val to provide an implementation of min which returns values not references to the original through a ternary (which can cause issues with vectorization).  Added Clang specific sfm::min_val and sfm::max_val implementations to assist in vectorization.

Enabled BATCHED execution of existing testsuites: blackbody, color, transformc, wavelength_color
Added new testsuite BATCHED regression tests:  blackbody-reg, color-reg, luminance-reg, transformc-reg, wavelength_color-reg
Added sfm::min_val to provide an implementation of min which returns values not references to the original through a ternary (which can cause issues with vectorization).  Added Clang specific sfm::min_val and sfm::max_val implementations to assist in vectorization.

* Adopt OIIO calls to fast_cbrt and fast_expm1 for blackbody computation.
Use single precision for bb_spectrum object/operator and manually implement std::pow(wlm,-5.0f) to better enable vectorization.
Reduced masked code generation for rgb_to_hsl.
Removed duplicated code by implementing ColorSystem::blackbody_rgb(T) in terms of ColorSystem::can_lookup_blackbody(T), ColorSystem::lookup_blackbody_rgb(T), and ColorSystem::compute_blackbody_rgb(T).  Removed some casting to uint16_t that was unnecessary.

Removed some test shaders that were not intended to be promoted.

* Implement batched llvm code generation for ops: andor, bitwise_binary_op, clamp, get_simple_SG_field, isconstant, select, unary_op, mix

Fixed bug in BatchedAnalysis where the complement operator was being treated as always having a boolean result.  In reality the result of complement or other bitwise operation would only be boolean if its input parameters were forced to be boolean (left TODO note for future improvement).

Fixed bug in printf where integer who is forced_llvm_bool() is formatted as a float was not converted to an integer first.

Enabled BATCHED for execution for tests:  and-or-not-synonyms, isconstant, logic, select.
Expanded testsuite/shaderglobals to exercise/access all shader global data members.

Add regression tests: andor-reg, bitwise-and-reg bitwise-or-reg bitwise-shl-reg
bitwise-shr-reg bitwise-xor-reg, complement-reg, mix-reg, select-reg

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-10-05 11:57:37 -07:00
Brendan P 1d7362b331 Added Redshift renderer to list of renderers/tools that support OSL. (#1419)
Signed-off-by: brendisurfs <brendan.prednis@protonmail.com>
2021-10-02 09:58:20 -07:00
cmstein 7b2cdacdea fixing return type (#1418)
Signed-off-by: Clifford Stein <cstein@imageworks.com>
2021-10-01 19:36:13 -07:00
Derek Haase ea550aa5c8 Changing DNEG board member from Derek to Clint (#1415)
Signed-off-by: Derek Haase <derekhaase@gmail.com>
2021-09-30 13:38:14 -07:00
Larry Gritz 4f169d8b38 Raise OpenEXR/Imath minimum to 2.3 (#1406)
Remember that our current 'master' is really aiming for a release in
late 2021 at the earliest, and thus will be a version primarily
intended to be used widely in 2022. Release branches never drop
supported dependencies, so the 1.11 branch will continue to support
OpenEXR all the way back to 2.0.

VFX Platform guidance is to support the current year, plus up to 3 years
prior, so that means that for 2022-ish software, we should support back
to 2019 dependency ecosystem.

For OpenEXR, 2019 state of the art was 2.3 -- that's still dreadfully
old, and is no longer getting even critical or security bug fixes. But
it still means that we can comfortably upgrade our advertised minimum
OpenEXR from 2.0+ to 2.3+ and eliminate some build and dependency
logic that was dedicated to dealing with 2.0..2.2.

We're also raising the OpenEXR/Imath "recommended minimum" (build-time
warning, but not rejection) to 2.4. Even that is shaky, but the fact
that it's still in wide use and was officially (though IMHO unwisely)
the VFX Platform 2021 recommendation, means we can't yell at people
too much about it.

It is possible that by the time we make a supported OSL 1.12 release,
we will bump even further to OpenEXR 2.4 as the minimum. We'll make
that decision later. It would depend on our being confident that even
though 2.3 is technically within the 3 year window we try to support,
we cannot discern that anybody is actually using it (who would also
need the most recent OSL in the same app).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-09-28 10:08:33 -07:00
Luya Tshimbalanga 8682211d0b Fix compatibility with LLVM 12 and up (#1412)
Upstream LLVM stopped using the compatibility
spellings of OF_{None,Text,Append} from version 12 and up.

https://reviews.llvm.org/D101650

Signed-off-by: Luya Tshimbalanga <luya@fedoraproject.org>
2021-09-28 10:08:01 -07:00
Alex Wells 15c81df232 Add batched SIMD implementation for all color operations. (#1408)
Added batched llvm code gen for: llvm_gen_blackbody, llvm_gen_luminance, llvm_gen_transformc (including code gen of loop to identify unique "from" and "to" space combinations to call library function with).

Made ColorSystem const correct.
Pulled much of ColorSystem's implementation into src/liboslexec/opcolor_impl.h so it could be inlined in both opcolor.cpp and wide_opcolor.cpp.
To enable SIMD fast path for ColorSystem::blackbody_rgb added new methods to expose underlying lookup table optimization.
    bool can_lookup_blackbody(float T /*Kelvin*/) const;

    Color3 lookup_blackbody_rgb (float T /*Kelvin*/) const;

    Color3 compute_blackbody_rgb (float T /*Kelvin*/) const;
When can_lookup_blackbody() returns true
then lookup_blackbody_rgb can be safely called,
otherwise the expensive compute_blackbody_rgb is required.

Updated implementation of ColorSystem to succesfully vectorize on multiple compilers, optimized lookup table data types and indexed dereferences to generate prefered 32bit indexed gathers vs 64bit gathers which require multiple instructions and registers.

To improve code generation and less chances of aliasing issues, changed nested M[i][j] operator access to Matrix in ImathMatrix.h to directly access underlying 2d array M.x[i][j] also changed Vector operator V[i] to directly access V.x, V.y, V.z in OSL/IMathx/IMath*.h

Moved helper testIfAnyLaneIsNonZero from wide_opmatrix.cpp to be testIfAnyLaneIsNonZero in OSL/wide.h

Added sfm::min_val to provide an implementation of min which returns values not references to the original through a ternary (which can cause issues with vectorization).  Added Clang specific sfm::min_val and sfm::max_val implementations to assist in vectorization.

Enabled BATCHED execution of existing testsuites: blackbody, color, transformc, wavelength_color
Added new testsuite BATCHED regression tests:  blackbody-reg, color-reg, luminance-reg, transformc-reg, wavelength_color-reg
Added sfm::min_val to provide an implementation of min which returns values not references to the original through a ternary (which can cause issues with vectorization).  Added Clang specific sfm::min_val and sfm::max_val implementations to assist in vectorization.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>

* Adopt OIIO calls to fast_cbrt and fast_expm1 for blackbody computation.
Use single precision for bb_spectrum object/operator and manually implement std::pow(wlm,-5.0f) to better enable vectorization.
Reduced masked code generation for rgb_to_hsl.
Removed duplicated code by implementing ColorSystem::blackbody_rgb(T) in terms of ColorSystem::can_lookup_blackbody(T), ColorSystem::lookup_blackbody_rgb(T), and ColorSystem::compute_blackbody_rgb(T).  Removed some casting to uint16_t that was unnecessary.

Removed some test shaders that were not intended to be promoted.

* Added additional test result for black body because the change from double to single precision caused a few results to differ slightly (max delta 0.0000534058)

* Incorporated changes from PR to "fix color conversion from RGB to xyY"

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-09-27 15:49:11 -07:00
cmstein 8f9206ab46 Removing race condition when compiling for OptiX 7 (#1411)
This change now requires renderers to manually link in the compiled rend_lib.cu
PTX code when using OptiX 7.

Signed-off-by: Clifford Stein <cstein@imageworks.com>
2021-09-27 10:53:46 -07:00
ix-bruiz 3f87e75821 Fix color conversion from RGB to xyY (#1410)
Signed-off-by: Benoit Ruiz <bruiz@isotropix.com>
2021-09-23 15:32:41 -07:00
ix-bruiz f471ab5e0c Fix missing hostdevice modifier on some matrix operators (#1409)
Signed-off-by: Benoit Ruiz <bruiz@isotropix.com>
2021-09-22 10:05:40 -07:00
Nicolas Guiard 22105d2982 Changed the prototype of osl_get_attribute callback in liboslexec (#1404)
Changed the prototype of osl_get_attribute callback in liboslexec in
order it takes a copy of the attribute TypeDesc casted into a long long
instead of taking a pointer to it. This allows to make it work properly
on GPU else we have an invalid pointer.

Signed-off-by: nicolas <nicolas@isotropix.com>
2021-09-13 23:56:55 -07:00
Larry Gritz 879545c359 CI minor version updates (#1403)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-09-12 21:13:36 -07:00
cmstein 1b05f9a6a0 Fix problem with unresolved symbols on GPU (#1401)
Fix problem with unresolved symbols when multiple shaders call certain (#1401)functions on the GPU (ie. osl_printf()).

This fixes a problem I was seeingon the GPU: if I had two shaders that contained a printf(), then the second shader group would report osl_printf as being an unresolved function (the first shader group was fine). If I looked at the PTX for the second shader group, osl_printf was tagged as a "weak" function. Removing the "weak" attribute resolves the problem.

I'm not sure why osl_printf and rend_get_userdata should be different from the other functions in rend_lib.cu.

This is easily reproduced in testsuite/testoptix by adding a printf() to checkerboard.osl and microfacet_test.osl.

Signed-off-by: Clifford Stein <cstein@imageworks.com>
2021-09-02 18:08:37 -07:00
Alex Wells cb3bdb4b4e Removed clang and gcc attributes that disabled optimizations for nonAffineInverse. (#1400)
Added clang pragma and gcc attribute to disable Fused Multiply Add for nonAffineInverse to allow offline compilers to produce results closer to those of LLVM IR compilation (which has FMA disabled by default) which produced the reference images of the testsuite.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-09-01 13:07:04 -07:00
Larry Gritz 692c9b4498 Position-specific gettextureinfo() for UDIM textures (#1398)
Newly added functionality in TextureSystem (only in OIIO >= 2.3.7)
allows us to add a new flavor of gettextureinfo that takes texture
coordinates, and in the case of UDIM textures, will retrieve the info
for the particular UDIM texture that will be used for the given
position:

    int gettextureinfo (string texturename, string paramname,
                        float s, float t, output TYPE destination)

NOTE: Use with caution, this will be more expensive than ordinary
calls to gettextureinfo that will tend to constant-fold effectively,
since the s,t coordinates are runtime-determined and won't be known
for runtime optimization.

If built against older versions of TextureSystem that lack support for
the new is_udim() and udim_resolve() methods, this new gettextureinfo
will simply use the old gettextureinfo() without coordinates, and thus
will not be able to retrieve position-specific texture info.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-30 09:12:11 -07:00
Larry Gritz e901657f81 Bump some CI dependency versions (#1399)
Most important: make sure we have a proper VFXPlatfom-2022 like test,
with Python 3.9 and OpenEXR/Imath 3.1.

Fix a few of the "name" entries for tests to match the set of versions
actually present on those images.

Remove apt-get install of libboost-regex-dev, since we use only
std::regex now that we're no longer using gcc4.8.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-30 09:11:50 -07:00
Larry Gritz 881c704d11 Build: collapse build and dist hierarchy (#1396)
Similar to a recent change in OIIO... For historical reasons, our
wrapper makefiles assume that we build in `build/ARCH[.variant]`, so
maybe build/linux64, build/linux64.debug, etc.

Get rid of this extra bit of hierarchy, it no longer serves us and
it's contrary to modern cmake practice.

Also used this as an excuse to remove some SPI build script
customization that we no longer use.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-30 09:11:09 -07:00
Larry Gritz df18d97283 Give Symbol virtual destructor to fix UB because of derived classes. (#1397)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-24 09:28:31 -07:00
Larry Gritz 30d2a4a089 Userdata input placement (#1391)
This is analogous to the "output placement" that we added recently, but
for input of userdata.

Reminder: "userdata" means shader parameters marked as lockgeom=0 that
are expected to be supplied on a per-shade basis, such as interpolated
vertex data on geometric primitives. The primitive data binds by name to
matching shader parameters.

This patch concerns how the shader gets this per-point data.

Old school: in the middle of the shader, when userdata is needed, the
shader calls osl_bind_interpolated_param(), which makes a callback to
RendererServices::get_userdata(), which... does something magical and
renderer-specific to retrieve the data by name.  This is expensive and
also challenging to implement on the GPU (which is why it remains
unimplemented).

This patch changes the methodology to the following, which is somewhat
analogous to how we did output placement:

0. It is assumed that there is an arena of memory where the userdata
   is going to be, and the pointer to its start is passed down to the
   shader via execute() (just like how the shaderglobals and output
   arena pointers are passed), along with an index of the current
   shade point.

1. The renderer pre-declares SymLocationDesc records for the userdata,
   which specifies the offsets and strides within the arena where the
   data can be found.

2. Prior to launching the shader execute(), the renderer is expected
   fill in those values in the userdata arena for the points to be
   shaded.

3. When JITing the part of the shader that initializes those userdata
   parameter values, we simply JIT a simple data copy directly from
   the computed position within the arena (offsetting the right amount
   for this data, at this shade index) -- just a couple of
   instructions per shade, no function calls, no RendererServices
   callbacks, no name lookups!

4. There is no 4. That's it.

See the changes to osldeformer.cpp for an example of how this looks from
the renderer side. It's really straightforward.

Currently, if there is no SymLocationDesc for a lockgeom=0 parameter
that needs initialization, it will fall back to the old callback. We
may fully deprecate the old way, but not for a while, so this is back
compatible for now.

This seems to work, passes all tests, doesn't break anything, and works
for the osldeformer example!

There is follow-up work to do: I think we can pretty easily do the
same thing for ShaderGlobals ("make your own SG struct"), named marix
retrieval, and other attributes. Will do those in subsequent PRs if
this meets everybody's approval.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-19 14:52:27 -07:00
Larry Gritz 06c9d0d1c7 Test: don't clobber LD_LIBRARY_PATH for optix tests (#1395)
Well intentioned attempt to ensure that Cuda runtime library was in
the library path when tests were run, but it clobbered the existing
LD_LIBRARY_PATH.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-18 16:26:21 -07:00
Alex Wells d4f54bc76a PR/BatchedNoise (#1394)
Add batched code gen to generate a loop to calls to OSL library noise functions with binning of varying noisetypes and options.  For example if half of a SIMD batch uses gabor option "bandwidth" of 10 and the other half default "bandwidth" of 1, then gabornoise will be called twice (once with bandwith option set to 10 and a mask with the 1st half of SIMD lanes enabled, then a 2nd time with bandwith option set to 1 and a mask with the 2nd half of SIMD lanes enabled.

Added batched OSL noise library functions which compile with outer loop explicit vectorization.  NOTE:  Perlin and some other noises have SIMD intrinsics that work on multiple data elements (block vectorization).  When the the active number of lanes in a batch is below a tunable threshold, the legacy block vectorization version is called.  This avoids the worst case scenarios of 1 active SIMD lane executing, and allows the 3-4 wide x,y,z data element version to run instead.

Add previosly omitted /Qopenmp-simd and -fopenmp compiler flags along with -DOSL_OPENMP_SIMD to cause OpenMP outer loop explicit SIMD vectorization of loops in batched OSL libraries.

Fix Mask::invoke_foreach to be OSL_NOINLINE, it was mistakenly set to OSL_FORCEINLINE

Update oslnoise.h to access target specific library sfm namespace

Improve compile time for 4d perlin noise with Dual arguments by using a 2 iteration loops to avoid repeating a large amount of code.

Changed ShadingSystemImpl::count_noise(void) to count_noise (int number=1) to allow batched version to update the call count with the number of active lanes in the current mask.

Fixed sfm::scalar_gabor3 and sfm::scalar_pgabor3 to not use the loop array index when storing partial results, when vectorizing an aliasing issue on the stack caused incorrect results.

Enabled BATCHED execution of all noise tests.
Added new tests: noise-generic, pnoise-generic
Added new BATCHED_REGRESSION tests:  noise-gabor-reg, noise-reg, pnoise-reg

Avoid issue with constant folding in hashnoise with different compilers causing slightly different results from sin & cos to cause massively different results due to aliasing in hashnoise.

* Add openmp-simd and target compiler flags when CMAKE_COMPILER_IS_GNUCC for batched target specific liboslexec libraries
Move filter_gabor_kernel_2d from gabornoise.h to .cpp to avoid unused function warning.

* Revert to reference 4d perlin noise for Clang vectorization.

* Utilize reference filter_gabor_kernel_2d which uses its own gabor_mul_m22_v2(const Matrix22& m, const Vec2& v) instead of relying on Imath version which differs in naming between OSL/matrix22.h and <Imath/ImathMatrix.h>
Move filter_gabor_kernel_2d back from gabornoise.cpp to .h to share it between gabornoise.cpp and sfm_gabornoise.h.
Disable Clang vectorization of strlen because resulting binary causes crashes in testsuite (TODO: investigate)

* To avoid "may be used uninitialized in this function [-Werror=maybe-uninitialized]" messages add extra (unnecessary) initialization, as its a unlikely fallback case shouldn't affect performance much.

* Disabled GCC optimizations for nonAffineInverse to allow results to match LLVM-IR version for Matrix44 inversion.
Implemented better optimization for transform normal when matrix is uniform.

* Mark nonAffineInverse definition as OSL_HOSTDEVICE to match its forward declaration.

* Added environment variable TESTSHADE_LLVM_JIT_FMA to force FMA generation for JIT'd code, needed to produce reference i mages for tests.

Fixed warning message that was accessing a null pointer when testshade requests FMA without specifiying a target.

Added out_LLVM_JIT_FMA.tif image for hashnoise tests whose results vastly differ for small changes in input values, so we need a 2nd test image to compare against when FMA is enabled for LLVM JIT.

* Rearranged local stack variables inside of sfm::simplexnoise4 to instantiate Vec4 locals closer where they are used.  This was necessary to get correct results with gcc (even with vectorization disabled), suspect issue with register overflow or stack stomping.

* Fix issue with impl_transform_normal_masked failing to vectorize when only the result is varying.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-08-18 15:31:32 -07:00
Larry Gritz 92a6055ab9 Add include to prepare for upcoming OIIO change (#1393)
OIIO 2.3 will rearrange some header files slightly. If you need to use
ImageCache, you must include imagecache.h (duh!). We were accidentally
relying on some leaked definitions in other header files, which will
soon be removed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-04 10:37:00 -07:00
Larry Gritz e3f40d764e CI: Bump some of the "latest" releases (#1392)
latest OpenEXR/Imath -> 3.1.0
latest pybind11 -> 2.7.0
latest fmt -> 8.0.0

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-03 08:05:51 -07:00
Larry Gritz 79cc3a3268 Convert some uses of temp vectors to span (#1390)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-08-03 08:05:29 -07:00
Larry Gritz 0406e48cef More string format convention modernization (#1389)
* OSLQuery::errorf (public)
* ShadingSysImpl::errorf, etc. (internals)
* Context::errorf (internals)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-07-22 22:58:17 -07:00
Larry Gritz 4bfdefdba5 Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-07-21 23:45:05 -07:00
Larry Gritz cd0fa5d7d7 CHANGES etc
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-07-20 20:45:24 -07:00
Larry Gritz 2f3c21ff7c Move from some long-deprecated OIIO things to modern equivalents (#1388)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-07-20 20:44:18 -07:00
Alex Wells 27cc863108 PR/BatchedMath -- algebraic, trig, transcendental (#1385)
Implement batched versions algebraic, trigonometric, and transcendental OSL library functions.
Add extensive regression tests to exercise binary and ternary operations with combinations of uniform, varying, and constant arguments.
Added some reusable xmacros for shaders in the testsuite/common/shader's directory to create unary, binary, and ternary test shaders.

Increase timeout of CI tests from 180 seconds to 240 seconds to allow comprehensive regression tests to complete.
Alternative is to break regression tests into separate test directories so the individually finish faster.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-07-08 11:38:44 -07:00
Larry Gritz d6ec4b828f Sanitize filenames when using "archive_groupname" (#1383)
This feature (used, very possibly, only by me, for debugging) lets me
force OSL to write an archive that contains the oso files and a
serialized version of the shader network.

If no explicit name is given (by the "archive_filename" attribute), it
picks a name based on the shader group name. But that may not be a
safe string for a valid filename. We already eliminated anything
before the last slash, but it turns out that a colon (':') and pipe ('|')
can also really mess things up. So this small change protects against that.

For the actual commands sent to system(), escape special characters
in the strings and enclose any arguments that come from the user in
double quotes. That prevents shenanigans like asking for an archive
filename called "; rm -r *". By enclosing in double quotes, we'll
end up with a badly named filename produced by tar, rather than
possibly an arbitrary command being executed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-07-01 23:08:15 -07:00
Larry Gritz 98e3aca1c9 Remove last calls to ambiguous OIIO format functions (#1382)
Background: OIIO now has errorf that are explicitly printf-like, and
errorfmt that are explicitly std::format-like, and also an old style
error() that is ambiguous.  The ambiguous calls are (at this moment)
aliases to the printf ones, but will be deprecated at some point (and
may, later when it seems safe, get reborn as the std::format compliant
behavior).

This roots out and removes the last few calls to the old ambiguous
ones from the OSL codebase.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-07-01 23:06:34 -07:00
Larry Gritz b0ed183b90 CI gcc and llvm testing changes (#1381)
* Update the "bleeding edge" CI test to gcc-11, and also LLVM 12,
  which we hadn't tested before.
* A "latest releases" CI test uses gcc10 and LLVM 11.
* Turns out that nothing else on the OSL side needed to be fixed to
  accommodate gcc 11 (though you need a very up-to-date OIIO if you
  want to compile it with gcc11 unless you turn warnings off).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-06-21 10:29:06 -07:00
Larry Gritz cfc679ad8b CI: speed up OIIO build for CI by not building its tests (#1380)
Was using the wrong notation before.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-06-21 10:28:30 -07:00
Larry Gritz b9ca59ea61 CI: have a clang11 test, also test batched shading with clang (#1379)
Along the way, discovered a couple clang-specific warnings when using
C++17.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-06-21 10:28:16 -07:00
Alex Wells 135b087017 PR/BatchedMatrix (#1378)
* Implement batched matrix ops, including transform, determinant, transpose, and construction and getmatrix with spaces, multiplication, division, negation.
Moved helpers det2x2, det3x3, and det4x4 from opmatrix.cpp to Imathx.h so they could be shared with the wide_opmatrix.cpp.
Enabled BATCHED testing for matrix and transform testsuites
Added new BATCHED_REGRESSION testsuites array-reg, matrix-arithmetic-reg, matrix-compref-reg, matrix-reg, transform-reg to more fully exercise combinations of uniform and varying data types and indexing variables.

* Removed #if 0 code block of determinant match that was moved to Imathx.h

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-06-15 18:31:56 -07:00
Larry Gritz 7f8a1a1702 Now that gcc minimum is gcc6, remove use of boost::regex (#1377)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-06-02 10:57:05 -07:00
Larry Gritz d755edf4f4 Bump minimum C++ to 14 and update compiler mins to match (#1369)
As discussed at the TSC meeting and on the mail list, I won't merge this
change until June 1. It will only be in master (future OSL 1.12), not
backported to any release branch.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-06-01 15:39:53 -07:00
Alex Wells 0c0e6d4b42 Batched control flow and string ops (#1373)
* Implement batched loop control flow (including, break, continue) along with early outs (return, exit).  Also add batched support for printf and other string operations.  Implement batched support for shadingsystem ops like bind_interpolated_param, get_userdata, rangecheck, uninitcheck_values, and nancheck.  Implement batched support for negate, min/max, arraycopy, compassign, mxcompref, mxcompassign, .Added BATCHED_REGRESSION tests to the suite to exercise control flow and string ops and compare scaler and batched results.  Enabled various tests to also execute in BATCHED mode.  Enable unoptimized BATCHED mode testing, as constfolding was avoiding any work in optimized mode for some tests.
Fixed bug in testshaded batched mode that inverted population of x and y shader global values, but only noticed in order of side effects like printf in shaders.
Added buffered file support to ShadingSystem to allow batched fprint to write out to files in the correct order.
Fixed bug in BatchedAnalysis which was not handling unlocked geom correctly by requiring unlocked input parameters be varying inorder to accept Wide results from BatchedRendererServices::get_userdata.

LLVM_Util had previously added support managing masks, and its strategy should
be reviewed before trying to understand this commit's changes:

    // Overview of masking strategy
    //
    // For if/then based on a conditional, the result of the conditional is
    // conditionals written to a symbol that is a wide boolean.  To handle
    // nesting we will keep a stack of conditional masks.  When a new
    // conditional mask is pushed, it is combined with the previous mask on
    // the top of the stack.  It is the top of the mask stack that is used
    // as the mask for any instructions requiring masking.  When a
    // conditional scope is exited, we just pop the top of the conditional
    // mask stack.
    //
    // Loops are handled by pushing their conditional result onto the
    // conditional mask stack, and popping it back off at the end of the
    // loop.
    //
    // Handling of early outs (exit, return, break, continue) is done by
    // storing a mask representing the lanes which are going to be
    // deactivated (or continue executing) to an allocated location in the
    // stack. We actually have to store these early out masks, so that we
    // can apply it to the conditional mask stack.  As that stack unwinds,
    // any early out masks are applied to the top of the conditional mask
    // stack.  As there are different types of early outs that apply to
    // different control flow scopes and multiple types can be present at
    // the same time for different data lanes, we must store these early
    // out masks at separate locations on the stack.
    //
    // To handle 'exit', we allocate a 'shader mask' that is initially
    // populated with a startMaskValue representing the active lanes in a
    // shader global batch.  For example perhaps only 7 of 16 data lanes
    // are populated, the startMaskValue would store that value and push it
    // onto the conditional mask stack.  We require a location on the stack
    // for this 'shader mask' in order for an 'exit' statement to modify it
    // and cause a subset of the lanes to be deactivated.  If an exit was
    // processed, the 'shader mask' is where it will be stored and pulled
    // from when applying to the unwinding conditional mask stack.
    //
    // To handle 'return', we allocate a 'function mask' that is initially
    // populated with a startMaskValue representing the active lanes when
    // an inlined function was called.  This startMaskValue should just be
    // value at the top of the conditional mask stack.  As function calls
    // can be nested, we maintain a stack of function masks.  We require a
    // location on the stack for each 'function mask' in order for a
    // 'return' statement to modify it and cause a subset of the lanes to
    // be deactivated.  If an return was processed, the 'return mask' is
    // where it will be stored and pulled from when applying to the
    // unwinding conditional mask stack. When a function scope is exited,
    // the function mask is popped so any return's processed would apply to
    // the outer function mask vs. the one just exited.
    //
    // To handle 'break', we use the condition symbol's location on the
    // stack to directly disable data lanes for the loop execution.  As we
    // already had a location to store the conditional symbol's mask, no
    // need to allocate or store a separate one.  However code will need to
    // reload the condition's value when a break 'could have been' called
    // vs. relying on a conditional result already in a register.
    //
    // To handle 'continue', we allocate a 'continue mask' that is
    // initially populated with a 0 representing the deactived lanes by
    // 'continue' operations. We require a location on the stack for each
    // 'continue mask' in order for a 'continue' statement to modify it and
    // cause a subset of the lanes to be deactivated.  If an continue was
    // processed, the 'continue mask' is where it will be stored and pulled
    // from when applying to the unwinding conditional mask stack. When a
    // loop's scope is exited, the continue mask is popped so it would't be
    // applied to an outer loop.
    //
    // The logic of when and how to actually apply these masks is handled
    // by the caller, tracking/storing the different stacks and masks is
    // handled here.  And queries exist to see how many early outs
    // operations have been processed, these counts can be used by the
    // caller to determine which to generate code to apply each of them.

In our case BatchedBackendLLVM is the caller and during code gen will be calling:
    push_shader_instance(llvm::Value* startMaskValue) and pop_shader_instance()
    push_function_mask(llvm::Value* startMaskValue) and pop_function_mask()
    push_masked_loop(llvm::Value* location_of_control_mask, llvm::Value* location_of_continue_mask) and pop_masked_loop()
And to handle if/then/else be calling
    push_mask(llvm::Value *mask, bool negate, bool absolute) and pop_mask()
By checking masked_exit_count(), masked_return_count(), masked_break_count(), and masked_continue_count()
before and after code gen of a function call, then block, else block, loop body, etc.
we can detect if a exit, return, break or continue existed in the generated scope
and then can call apply_exit_to_mask_stack(), apply_return_to_mask_stack(),
apply_break_to_mask_stack(), or apply_continue_to_mask_stack() when needed.

Add utility function "foreach_unique" to provide scalar execution of a Functor
for each unique value in the a Wide data block along with a mask identify which
data lanes match the unique value.

Add utility function "unproxy(const T &elem)" to extract value type from a proxied
element.  This is alternative to static_cast<ValueType>(elem), and better self documents.

Fixed compatibility bug where llvm 9+ asserted that bool was not a valid datatype for llvm::ConstantDataVector::getSplat.
Added LLVM_Util::test_mask_lane(llvm::Value *mask, llvm::Value * lane_index) to test a mask with a variable lane index.

* Updated OIIO::vformat calls to OIIO::sprintf.
Conditionally compile buffered_file_output_mutex to avoid unused variable warning when not building with USE_BATCHED.
Ran couple files through clang-format.

* Initialize local variable mask_slot to avoid maybe-uninitialized errors

* Fixed paths to additional oiiodiff that runs when a test fails to find a match to use the /baseline subdir when performing a BATCHED_REGRESSION test.
Improved control-flow-test to use 0.5 default value instead of 0 to tell difference between actual assignment and 0's on the heap.

* Changed some control-flow-reg tests to use non-zero default values to tell difference between uninitialized heap and setting of default values.
Changed order of parameters so that any initops that contain an "exit" are the final parameter so the exit doesn't skip assigning default values.  Otherwise those parameters would be uninitialized data and cause intermitent CI failures.

* Deleted extraneious cmakefile settings for clang

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-06-01 15:38:58 -07:00
Larry Gritz bc5b969a59 CMake fixes (#1376)
* "SOVERSION" option was set twice, oops!
* Stray "OIIO" in a name that should have been this project's name.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-26 09:23:01 -07:00
Larry Gritz ae2edaceb8 CI: Bump OpenEXR versions to the latest patches in each branch (#1374)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-25 22:55:34 -07:00
Niklas Harrysson 35c9ae7e22 Add declarations of MaterialX closures (#1371)
This PR adds closure declarations for the MaterialX PBS nodes. A discussion of their design has been ongoing in a thread at the MaterialX GitHub repo. The full history of this discussion can be found here: https://github.com/materialx/MaterialX/pull/614

Signed-off-by: Niklas Harrysson <niklas.harrysson@gmail.com>
2021-05-25 22:55:01 -07:00
Larry Gritz 908000e595 Fix SPI compilation (everybody else can ignore).
Mostly just getting rid of support for compilers and boost versions we
no longer use. But also some openexr version finding fixes.
2021-05-22 09:35:03 -07:00
Larry Gritz 11ba289f5f Build: llvm-config --system-libs needs --static for LLVM_STATIC (#1375)
This fixes CI in the Mac test. Something about the Homebrew upgrade to llvm 12.0.0_1 made this fix necessary to build.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-22 09:15:57 -07:00
Larry Gritz 9f91311c78 CI: Change our clang-format standard to clang11 (#1372)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-21 16:06:02 -07:00
Larry Gritz 1435e3a202 Output variable placement (#1328)
Up until now, client apps declare which output variables are "renderer
outputs" before shader groups are compiled, and also after a shader is
executed, it is up to the app to extract the individual output values
and do with them what it needs to do. Those outputs live on the shader
heap (the temp storage used to run the shader), and information about
where it lives on the heap can be retrieved via find_symbol() and
symbol_address().

New paradigm:

Various inputs and outputs of shaders live in different memory arenas,
and for those inputs/outputs, the app declares (prior to shader group
compilation) which arena it lives in, its offset within the arena, and
the stride between entries (for different shades, such as different
rays in flight, different points on a mesh, pixels in an image, etc.).
The shader JITs into code that automatically pull inputs from their
sources and copy outputs to their destinations with no need for client
app code to call find_symbol or symbol_address or do any extra data
copies.

This symbol location data is communicated to the shading system through
new calls to add_symlocs() passing a new struct called a SymLocationDesc,
which has the aformentioned arena, offset, stride, etc.

Right now, the only supported arena is Outputs, and the actual call
signature to execute(), and to the shader JIT code itself, includes
extra parameters for the base pointer to the output arena (this could
conceivably change from shade to shade) and the integer shade index of
this shade.

I've tried to set this up in a general way, so that additional arenas
will be added later -- places where ShaderGlobals can be customized,
UserData, etc. Also there are placeholders for being able to talk about
absolute addreses and offsets into the heap, though I don't use them
at the moment. Some of the flexibility may be later removed as we learn
more about how we want to use this.

To show it in action, I have modified the "osldeformer" example to use
this new method to place the outputs directly where we want them.
It's just storing results into an array. The output arena base pointer
is the start of the array, the offset of the single output is 0, and
the stride is the size of each array element (one 3-float point).

As a much more complex example, testshade also uses the new technique
(unless you use --no-output-placement, but I'm not sure how long I'll
keep that). This is a good example of storing to images. Testshade thinks
of itself as shading pixels in an image, so there is an ImageBuf for every
renderer output (think of it like an AOV). The output arena base pointer
is the address of the (0,0) pixel of the ImageBuf for the first AOV; the
"offset" of each output variable is the address difference between that
AOV's first ImageBuf pixel and the arena base pointer, the stride is the
pixel data size for each output, and the shadeindex is the pixel index of
that shade.

It all works. Crazy!

OK, not quite all. Here's what hasn't been done yet:

  * testrender does not yet use the new API (only testshade)
  * GPU (have only tried CPU so far)
  * Batch shading -- I don't want to mess with this while Alex is
    still integrating all his work. We'll go back and catch the batch
    shading up after he's all done.

These will come in subsequent PRs.

All the old calls should still work, so this ought not to be a source
compatibility break for renderers using OSL. Not at this point, anyway.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-13 13:25:11 -07:00
Larry Gritz f2d0668c93 CI: Fix which openexr version is used for vfxp 2021 test
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-13 11:30:41 -07:00
Larry Gritz 7f2c3a6c0e CI script typo kept mac from recognizing ARCH properly (#1370)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-11 20:45:40 -07:00
Larry Gritz 0a97b2a96e Some minor cmake touch-ups (#1368)
* Left out some imath targets in liboslnoise

* Conform a couple libraries to conventions of the ${local_lib} notation
  we use in the othe rlibraries.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-11 20:43:03 -07:00
Larry Gritz f94bb6df40 CHANGES & docs fixes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-09 16:28:50 -07:00
Larry Gritz 1e77b38d23 CI: Make sure we have some test coverage for batched shading mode (#1367)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-07 22:51:50 -07:00
Larry Gritz 6882703746 CI Mac fix: this was no longer necessary, and seemed to be problematic (#1366)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-05 18:11:52 -07:00
Larry Gritz 444261a11e Bump the default C++ mode to 14 (#1362)
This leaves the minimum C++ at 11, but bumps the default (if not set by
the user via CMAKE_CXX_STANDARD) from 11 to 14.

This is meant to start identifying any problems people have switching
to 14. We anticipate a hard switch to 14 minimum before the next OSL
major release. This change is in master only (i.e. future OSL), we would
never change minimum or default C++ standard in the supported release
branches (currently OSL 1.11.x).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-05-04 14:02:08 -07:00
Alex Wells 4292cc9974 USE_BATCHED cmake option listing target library to build. New BATCHED_REGRESSION testing mode. (#1357)
* Introduce cmake option USE_BATCHED to enabling building batched SIMD shader execution for a comma separated list of batch sizes, ISA's, and noFMA: (0, b8_AVX, b8_AVX2, b8_AVX2_noFMA, b8_AVX512, b8_AVX512_noFMA, b16_AVX512, b16_AVX512_noFMA)
When USE_BATCHED is set, -DOSL_USE_BATCHED=1 will be passed allowing for source files to conditionally compile in batched execution support.
When USE_BATCHED is set, cmake variable BUILD_BATCHED=True and projects can conditionally add batched sources to be built.
Updated OSL source with #ifdef OSL_USE_BATCHED/#endif were needed.
Improved/streamlined liboslexec/CMakeLists.txt to iterate over targets in USE_BATCHED vs. hardcoding all variants.
Updated _OSL_SUPPORTS_* defines to match USE_BATCHED values simplying creating compiler definitions in Cmake.

Added new BATCHED_REGRESSION testing mode, when a file named BATCHED_REGRESSION exists in a testsuite folder, the run.py will be executed and its output files copied to "./baseline".  The same run.py is then run again but with environment variable TESTSHADE_BATCHED=1, which cause testshade to execute in batched mode.  Then the results/image comparison happens between the batched output files and those in "./baseline".  The "./ref" dir is never used in a regression test.
Presence of BATCHED_REGRESSION prevents non-regression tests from being created for a folder.

Converted arithmetic-cov to be a BATCHED_REGRESSION test.
Removed testsuite/arithmetic-cov/ref image files.

Renamed ShadingSystem::supports_batch_execution_at(int width) to ShadingSystem::configure_batch_execution_at(int width) to better identify its behavior:  based on currently set attributes for llvm_jit_target and llvm_jit_fma, test if current machine is capable of supporting batched execution at the specified width.  If no specific llvm_jit_target was requested, sets llvm_jit_target and llvm_jit_fma to the supported configuration for the requested width.  Returns true if supported, false otherwise

Fix bug in batched Matrix*Matrix code generation where the order of arguments were being reversed (swap was intended to transform float*Matrix to a Matrix*float function call, but accidentally happened for Matrix*Matrix)

* Moved define of OSL_USE_BATCHED to oslconfig.h.in
Fixed order of includes in batched*.cpp so oslconfig.h is higher

* Renamed testsuite/arithmetic-cov to testsuite/arithmetic-reg to better represent it is a regression test.
Changed #ifdef OSL_USE_BATCHED to #if OSL_USE_BATCHED and rely on it being set to 0 or 1 by <OSL/oslconfig.h>

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-04-29 21:04:21 -07:00
Brecht Van Lommel ab7107cf23 Fix crash generating closure functions calls with LLVM 11 (#1361)
Generating code for prepare_closure and gen_closure was crashing.
The code now matches the implementation of the removed LLVM function.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2021-04-22 09:15:10 -07:00
Larry Gritz eccd335d78 Revert "SPI: Remove old cruft related to spcomp2, rez, and gcc-4.8"
This reverts commit 63026c7279.

I removed it prematurely and not carefully enough.
2021-04-20 09:12:12 -07:00
John Haddon 8dafa41262 OSLCompiler : Check for write errors (#1360)
Fixes #1352

Signed-off-by: John Haddon <jhaddon@cinesite.com>
2021-04-20 09:08:47 -07:00
Larry Gritz 58ca5c2f8d Build: be robust to certain OpenEXR 2.x config files (#1356)
Ever since adding OpenEXR 3.0 support, we had some cases where
installations that built the 2.x IlmBase and OpenEXR portions
separately and installing to separate areas, had trouble being found
properly.

Remove the need to include OpenEXR/OpenEXRConfig.h

Also make some minor changes to ci.yml to make sure we are documenting
the right openexr versions used for each test.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-04-19 13:53:29 -07:00
Larry Gritz e9d0dc3ec4 Update several stray references to the old repo URL (#1353)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-04-12 19:35:52 -07:00
Larry Gritz 7d6310d17c CMake 3.20 safety (#1354)
It seems that our liberal use of cmake argument `--config` should only
be used in conjunction with the `--build` flag, not for the initial
configuration step. Apparently this was just silently ignored for a
long time, but for CMake 3.20, it is an error and breaks a lot of our
CI cases and our build_blah.bash scripts.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-04-02 15:46:23 -07:00
Alex Wells 8727d61ec1 More work on batched shading -- ISA specific modules (#1345)
* Added building of ISA specific shared libraries lib_b16_AVX512_oslexec, lib_b8_AVX2_oslexec, lib_b8_AVX512_oslexec, lib_b8_AVX_oslexec to house precompiled OSL library functions that execute over batches of 8 or 16 in SIMD for the ISA.  Compiler flags for OpenMP simd code gen and ISA targets has been added for Intel(r) C++ Compiler (ICC) and CLang (newer versions of GCC 6+ might be possible, but untested).

Implement batched llvm code gen for:  generic function calls, useparam, compare ops,  addition, subtraction, multiplication, division, modulus, assignment, component reference, construct triple, construct color, derivative extraction.  Stubbed out all other code gen functions with TBD asserts.

Populate OpDescriptiors with valid wide version of llvm-generating routine

Added wide_opalgebraic.cpp which uses X-macros (instead of #define like llvm_ops.cpp) to define wide(batched) versions of OSL library functions:  sqrt, inversesqrt, floor, ceil, trunc, round, sign, abs, fabs, fmod, and step.
The X-macro wrappers follow a pattern of manufacturing a target specific library function name with enough parameter types embeded in its name to uniquely identify it (vs. other versions).  Then it declares local Wide<T> or Masked<T> wrappers that convert any void */char * parameters to references to Block<T,WidthT> data blocks of wide SOA data.  Then an explicit OpenMP simd loop iterates over the data lanes and extract a local scalar values from the Wide|Masked wrappers, then the scalar implementation of the library function is then inlined using the local scalar values.  Finally the result is writen back out to the data lane inside the Wide|Masked wrapper.  This paradigm allows scalar implementations to be resused inside simd loops and avoid having to use intrinsics or assembly.  It also allows the same implementation to be recompiled for different target ISA's and varius Widths (8|16).  The build system will create copy of each  wide_*.cpp to a target and batch size specific named b(8|16)_(AVX512|AVX2|AVX)_wide*.cpp and build it with different -D__OSL_TARGET_ISA and -D__OSL_WIDTH values which inturn will manufacture uniquie function names.  Sometimes scalar algorithms/functions can be refactored to provide better performance when executing inside a SIMD loop.  sfmath.h (SIMD friendly math) houses these alternative math functions, although many improvements have already been moved into OIIO as they benefit (or do no harm) to scalar code gen.

Made ShadingContext remember the ShaderGroup it just optimized.  This allows symbol queries without actually jitting or executing a shader.

Improved TestShade to not actually execute the shader during setup_output_images, but to instead explicitly JIT scalar or batched version of the ShaderGroup (primarily to make sure JIT happens during the "setup" stage vs. lazily later).
Fix TestShade to explicitly set the number of OIIO worker threads to avoid overhead (and debugging confusion) of OIIO thread pools being created even when "-t 1" was requested.

Modified ShadingSystem to only perform group_post_jit_cleanup (delete operations of shader group) only if both scalar and wide JIT's have occured or if RendererServices doesn't support batching.  Without this changed the operations were being deleted before a batched JIT could occur.

Extended testsuite framework to look for file named "BATCHED" which causes another run of the test with TESTSHADE_BATCHED=1
Added testsuite new tests with BATCHED enabled for passing tgh shaderglobal values, and increased coverage of arithmetic tests with reference images for float, color, point, vector, normal data types along with Dx Dy results.

Added utility macros  __OSL_CONCAT,  __OSL_CONCAT3, ...,  __OSL_CONCAT10 to be able to easily manufacture function names.
Added macro __OSL_WIDE_PVT to give each target specific library its own namespace avoiding collisions should multiple libraries be loaded.
Added sfm::negate(const T &x) with optimized implementation.

Disabled some unreferenced functions warnings for ICC and removed some unused functions from batched_analysis.cpp
Updated BatchedBackendLLVM to match behavior of BackendLLVM by configuring its LLVM_Util based on ShadingSystem attributes.

Disable clang format for X macro based building of initializer arrays to prevent clang format from reordering the #include files.
Fix control flow in factory function TargetLibraryHelper::build to not trigger assert unnecessarily.

Limit list of OSL library functions in builtindecl_wide_xmacro to just those we have implemented so far because all functions listed must exist in the target specific library for it to successfully be loaded and resolved.

Added LLVM_Util::op_zero_if(llvm::Value *cond, llvm::Value *v) which allows its implementation to work around an LLVM issue where expensive instructions to produce the value (div, sqrt, etc) are duplicated (once with a mask, once without).

Fix bug in ShadingSystem::supports_batch_execution_at where jit_fma was being accidentally negated causing rest of logic to fail.
Implement ShadingSystem::BatchedExecutor<WidthT>::jit_group

* In Cmake, changed ISA specific target libraries from SHARED to MODULE so that on OSX they will be named .so instead of .dylib.
Moved new arithmetic tests into their own subdirectory arithmetic-cov so that the existing arithmetic test can run in non-batched mode as it uses printf which is still TBD for the batched version.
Fixed bug where shader ops weren't being cleaned up unless batched jit had occured.
Fixed compilation issue with newer LLVM versions and LLVMUtil::zero_if

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-04-01 23:35:15 -07:00
Larry Gritz 63026c7279 SPI: Remove old cruft related to spcomp2, rez, and gcc-4.8
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-04-01 23:04:55 -07:00
Larry Gritz c32c1ed799 Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-29 21:46:35 -07:00
Larry Gritz 96249d0258 CHANGES 2021-03-29 20:32:18 -07:00
Larry Gritz 0ceb805deb SPI fixes 2021-03-29 13:38:54 -07:00
Euan Haahr f76ea6220a Various fixes for LLVM 12 compatibility (1351)
Removed use of options.PrintMachineCode since this has been removed as
of llvm 12. Converted uses of DebugLoc::get to DILocation::get since
it has been deprecated and removed as of llvm 12.

PrintMachine code will only be used if llvm is lower than version 12.
TODO: Needs to be re-added in the new way for LLVM12. (LG just doesn't
have time to figure this out right now.)

Pass adjustment as various things have been deprecated or changed
names. (LG)

Signed-off-by: Euan Haahr <euanhaahrmail2@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-29 12:28:46 -07:00
Larry Gritz b49f4d4819 CMake 3.20 compatibility (#1349)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-27 22:26:02 -07:00
Larry Gritz 1c10440bdf CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-22 15:09:49 -07:00
Larry Gritz 975e350cd3 Formatting adjustment
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-16 21:45:14 -07:00
Larry Gritz 2599a88b1d Fix oslquery link conflict (#1348)
In PR 1346, we overlooked the fact that OSLQuery::init() is defined
*differently* in liboslquery and the separate copy that used to be
in liboslexec.

In this patch, we remove the oslquery-side version (and in fact
coalesce it into the constructor, the only place it was used). So now
instead of being replicated differently in the two libraries, it only
exists in oslexec. That constructor, since it takes a ShaderGroup* as
an argument, only makes sense to call if you have a full ShadingSystem
nearby.

Add ShadingSystem::oslquery(), deprecate OSLQuery(ShaderGroup*).
This eliminates the weirdness of having this constructor undefined in
liboslquery, moves the functionality to the ShadingSystem.
Because of ABI compatibility issues, we have to merely deprecate (but
not remove) the OSLQuery functionality for now.

Avoid assertions for shaders with params that are arrays of indeterminite length

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-16 13:13:27 -07:00
Larry Gritz 7c60b5949a Fix guard so errorfmt is not used with too early an OIIO version (#1347)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-12 15:13:32 -08:00
Larry Gritz 9d070999b6 Fully split oslquery and oslnoise libraries from oslexec (#1346)
liboslquery and liboslnoise exist as separate libraries for apps that
only need to query shader parameters or use OSL's noise functions,
respectively, but dont want to pull in the rest of OSL and all its
heavy dependencies (including LLVM). But liboslexec also needs that
functionality and so separately put the individual modules inside.

This was causing some problems for a tricky use case, and I can't
think of a good reason for it to be done this way now. So in this
patch I remove the redundant modules and just make liboslquery and
liboslnoise into *link dependencies* of liboslexec. None of this
should affect downstream projects, I don't think; linking against
liboslexec ought to just automatically pull in those other libs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-12 13:55:03 -08:00
cmstein 27d3bbbaf9 A number of changes with respect to OptiX 7: (#1309)
* strings are no longer copied to the GPU and are instead passed around
  as ustring hashes.  This means we no longer need to copy string pointers
  CUDA/PTX code.  This should result in faster compilations because
  strings are defined at "compile time" instead of "runtime".
* OSL's shaders' printf() output is now handled on the host/CPU
* testshade and testrender now use a separate optixLaunch() to set up
  global variables
* removal of runtime compilation of CUDA (libnvrtc dependency eliminated!)
  which was used to handle the setting of global variables in OptiX 7's
  CUDA programs.

Signed-off-by: Clifford Stein <cstein@imageworks.com>
2021-03-11 16:59:05 -08:00
Larry Gritz 8c6606ce3b Update old Strutil::format to new fmt conventions (#1342)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-03-11 12:13:24 -08:00
Larry Gritz 6669fa5942 Minor change for smooth build against upcoming Imath 3.0 (#1341)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-28 21:10:00 -08:00
Mads Drøschler feafbf1472 Updated vector2.h with a mod fuction: mod(vector2,vector2); (#1312)
This is useful when working with vec2 concepts through out shaders like UV data for example.
2021-02-28 11:41:24 -08:00
Larry Gritz fe08e6c04c Update CI idioms (#1338)
* Separate the CI stages into separate steps. (As was prototyped in OIIO)

* Combine the dependency-building scripts for CentOS and Ubuntu into a
  single script.

* Get rid of cruft related to the CI systems we no longer use (Appveyor,
  Travis, CircleCI).

* Get rid of some needless CI verbosity

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-28 11:39:31 -08:00
Clark Chen cbd1915658 Fix incorrect hyperlink for boost (#1339)
Signed-off-by: Clark Chen <9372896+clarkchentw@users.noreply.github.com>
2021-02-24 23:09:52 -08:00
Larry Gritz 5c95eceac8 Fix formatting
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-18 08:55:55 -08:00
Larry Gritz e5f26c0977 Typo prevented visibility hiding from happening properly (#1337)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-18 08:42:32 -08:00
Larry Gritz 5cd6b3ec3c Minor fixes/enhancements to TypeSpec & Symbol (OSL internal classes) (#1327)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-17 23:33:26 -08:00
Larry Gritz 64ccf25d4a CI: Use ccache + GitHub 'cache' action to greatly speed up CI runs (#1335)
This speeds up CI builds by 50% or more, for PRs that are minor
changes by reusing the compiled results from previous runs.  Most of
the remaining time cannot be squeezed down -- it's the instantiation
of docker containers and running the testsuite itself. But the build
(including of dependencies we build from scratch) is dramatically
faster.

At the same time, remove some commented-out test matrix cases. When/if
we re-enable those tests, we can add those back.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-10 14:23:02 -08:00
Larry Gritz 536c2d3ef6 Expunge Travis (#1334)
Kill the old travis CI

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-10 14:22:48 -08:00
sandipshukla 73d8f53a95 Fix unnecessary error messages to stderr for broken point clouds (#1333)
Signed-off-by: sandipshukla <>
2021-02-09 15:52:05 -08:00
Alex Wells f9c6e6714d Add implementation for BatchedBackendLLVM (#1330)
* Add implementation for BatchedBackendLLVM.  BatchedBackendLLVM implements the same set of functionality as BackendLLVM does, except it's implementation and many of it's methods handle wide data type (for symbols identified as varying (is_uniform()==false).  Many methods exist for (re)use by batched_llvm_gen and batched_llvm_instance.cpp.  A common theme is additional "bool is_uniform" parameter to identify if the operation we are generated code for is uniform or not.  We cannot rely on the Symbol itself, as an operation will be varying if just 1 of its inputs is varying.  This means that when uniform symbols are loaded as arguments, they will need to be widened/broadcast to partcipate in the varying operation.  Additionally "bool index_is_uniform" is used to generate gather/scatters vs. a wide load when symbols are varying.  Please remember the underlying "wide" data types are Structure of Arrays (SOA) and all address calculations have been modified inside BatchedBackendLLVM to work with SOA's.
Introduce helper class FuncSpec to encapsulate building function names that include a batch width and target ISA along with uniform and varying parameters.
Introduce TargetLibraryHelper interface and factory method to construct a Concrete TargetLibraryHelper
that provides a prefex string that all function calls will be prefixed with
and correctly initialize a function map for the shading system with
the functions from the target ISA library. Intent is batch size and target ISA specific shared libaries will be built and the correct on be loaded based on host machine.
Introduce TempScope.  Any calls to getOrAllocateTemp during the lifetime of a TempScope
will be associated with the latest TempScope on the stack and
when that TempScope's lifetime ends, any temp allocations will
be marked unused and will be available for reuse by the next
call to getOrAllocateTemp.
Introduce liboslexec/wide/define_opname_macros.h to define macros to consistently build OSL library function names including batch width, target isa, 0 to 5 arguments, and optionally masking.
Added builtindecl_wide_xmacro.h which is the equivalent of builtindecl.h for identifying the function names and signatures of OSL library functions that exist in batch size and target ISA specific shared libraries.

* Added missing initialization of OpDescriptor::llvmgenwide
Added friend declaration for ConcreteTargetLibraryHelper to use private base class TargetLibraryHelper

* Replaced some older copyright notices with latest one.
Moved llvm::Value* arrind assignment in batched_backendllvm.cpp from innerloop.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2021-02-09 15:29:48 -08:00
Larry Gritz 627c406d8a Imath 3 support: ImathLimits.h no longer exists (#1332)
Also change some refs to std::abs rather than deprecated Imath functions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-08 23:32:21 -08:00
Larry Gritz f7c8a0bb7b CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-02-01 22:17:21 -08:00
Larry Gritz 04d331e439 Transitioning repository to ASWF (#1329)
* Rename CLA files so they no longer say "draft."

* Change CONTRIBUTING.mv to correctly describe the new CLA process,
  remove language related to the old SPI CLAs. Also some touchups to
  README.md.

* Update the project_intake.md to check of various things that we've
  completed.

* Change all references to the old imageworks GitHub URLs to the new
  ASWF ones. (This touches comments at the start of basically every file.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-01-25 09:44:09 -08:00
Reza Aarabi 1e7d8f0ba8 Building OSL on Windows OS (#1326)
* readme and documentation for windows build is added

* some fixes

* remove pythonpath

* add .vscode

* windows installation document is added to new directory

* add windows build script to new doc folder

* remove .vscode folder by adding it to .gitignore

* remove .vscode manually

* update document format

* change the name of the documentation to Readme.md

* add relative image path

* image now is ok

* remove copyright problems

* remove my website name

* add appropriate copyright notices to all the files

* a little fix

* Pixar copyright is added to the python file

* Modified Apache 2.0 License is added to THIRD_PARTY.md

* remove my website from the doc

* revert changes on THIRD-PARTY.md

* Modified Apache 2.0 License is reproduced
2021-01-24 14:16:27 -08:00
Alex Wells 79c1a20ed3 BatchedAnalysis (#1322)
Introduce BatchedAnalysis which processes operations similar to code gen in order to build up relationships between operations and symbols controlling conditional control flow. Using these relationships and information on which shader globals are varing and which symbols renderer outputs, varying can be pushed down to just the symbols that will require it. Also analysis to determine which symbols can be forced in llvm to be boolean vs integers.

The idea is simple, but understanding & managing the relationships is complex, however it is entirely encapsulated in BatchedAnalysis.cpp. The main goal is to build up a multimap "m_symbols_dependent_upon" which maps a key symbol to all other symbols that due to operations, conditions, loops, function calls, early out control flow (break, continue, exit) would be forced to be varying if that key symbol where varying. We can use this map to recursively push varying of symbols down from shader globals, renderer outputs, and operations whose results are implicitly varying.
Several custom data/acceleration structures have been created to efficiently model these relations ships with their key feature being that their iterators are never invalidated as additional items are pushed and popped such that one can always iterate from a historical position back to the root:
DependencyTreeTracker, FunctionTreeTracker. Additonally LoopStack tracks loop nesting and aids in detecting cyclical reads.

Analysis is also performed to identify which symbols are read at a different conditional scope than they were written to and might require masking. Symbols written to and read from within the same (or deeper nesting) conditional scope do not require masking. A conditional scope is defined as the stack of of conditions evaluated to reach an operation and is managed by the DependencyTreeTracker.

When adding new ops, or when changing implementation or behavior of
existing ops, the following functions should be evaluated to see if
they need to be updated to handle to handle the new op or change:

    bool are_op_results_always_implicitly_varying(ustring opname);
    bool are_op_results_always_implicitly_uniform(ustring opname);
    bool does_op_implementation_require_masking(ustring opname);
    SymbolPtrVec * protected_shader_globals_op_implicitly_depends_on(ShaderInstance &inst, Opcode & opcode);

If there is a new or change in control flow op's are made,
a more detailed evaluation will be needed as their behavior
is hard coded vs. lookup based implementation of the
functions above.

RuntimeOptimizer uses BatchedAnalysis before it coalesces temporaries so that varying and uniform symbols do not get merged.
2021-01-19 15:43:15 -08:00
Larry Gritz 7fe87d1daa Remove unused variable that was warning (#1325) 2021-01-19 15:39:28 -08:00
Mitch Prater ac3eb59173 New doc files. 2021-01-13 03:43:21 -08:00
Alex Wells 9d8aaabb6d PR/OptBatchedAnalysis (#1318)
* Add ShadingSystem attribute "opt_batched_analysis"(defaults to false) which triggers additional analysis during runtime optimization to set Symbol::is_uniform, Symbol::forced_llvm_bool(), and Opcode::requires_masking.  Only coalesce_temps for symbols whose is_uniform() and forced_llvm_bool() values match.  Update testshade to set opt_batched_analysis when batched execution is requested.

* Initialize opt_batched_analysis to true when RendererServices provides a BatchedRendererServices for WidthOf<16> or WidthOf<8>.
Changed testshade from explicitly enabling opt_batched_analysis to explicitly disabling it when not in batched execution mode.
Removed test for opt_batched_analysis from coalesce symbols pass and just rely on a Symbol's is_uniform() and forced_llvm_bool() to be set correctly.
2021-01-05 15:22:17 -08:00
Larry Gritz b0d3eef7a9 Fix CI after OIIO branch markers disappeared (#1320)
OIIO removed "RB-2.1" branch marker because it's not expecting any
further development in the obsolete 2.1 branch. We still test against
it, though, so replace its designation in our CI with the specific
branch tag of the last OIIO 2.1 release.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2021-01-02 12:41:37 -08:00
debaetsd 14bd942f1b fixed cmake setup when tests are disabled (#1319) 2020-12-29 13:01:21 -08:00
Larry Gritz 1a122a6606 Switch from deprecated to current version of OIIO parallel_image call (#1317)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-12-27 17:00:23 -08:00
Alex Wells dce27cd024 Add storage to Symbol for analysis result bool forced_llvm_bool(). (#1316)
Add storage to Symbol for analysis result bool forced_llvm_bool().
Results of a compare_op and other ops with logically boolean
results under certain conditions could be forced to be represented
in llvm as a boolean <i1> vs. an integer <i32>.  This simplifies
code generation, and under batched execution is a requirement
to make efficient use of hardware masking registers by allowing a
vector of bools <16 x i1> vs. integers <16 x i32>.  However the
underlying OIIO::TypeDesc as well as OSL does not support bools,
therefore they need to be promoted to integers when interacting with
other integer op's.
The value of forced_llvm_bool() is currently only respected during
batched execution.  Forced bools should not be coalesced with regular
ints, only other forced bools.
2020-12-18 10:06:03 -08:00
Larry Gritz d311f3ef82 CI Mac: the uninstall of openssl no longer needed, now causes problems (#1315)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-12-17 15:13:03 -08:00
Larry Gritz abd5ffbf9d Amend GOVERNANCE to list new member and changing affiliations (#1314)
* Nicolas Guiard is a new TSC member representing Isotropix

* Chris Kulla has had a new affiliation for a while now

* Clean up a bit of language left over from when this document was
  just a proposal.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-12-12 12:21:18 -08:00
Larry Gritz 315d91ab92 Embed sizzle reel video in main README (#1307)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-12-10 17:54:57 -08:00
Larry Gritz 04df5730f4 New ASWF preferred CLAs, based on Apache 2.0 CLAs (#1240)
* Replace CLA drafts with ASWF CLA 2.1

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-12-10 17:54:34 -08:00
John Mertic 2bb303f705 Added mission statement in the charter, pulled from README (#1308)
Approved by the TSC by vote on 2020-12-10

Signed-off-by: John Mertic <jmertic@linuxfoundation.org>
2020-12-10 17:53:15 -08:00
Alex Wells 5b32bd1a48 Add ShadingSystem attribute "searchpath:library" (similar to searchpa… (#1310)
Add ShadingSystem attribute "searchpath:library" (similar to searchpath:shader) that is used to identify directories where target ISA optimized OSL shared libraries may exist.

Remove testshade command line parameters of "path" and "librarypath" as they were never used and can still be specified with "options".
2020-12-08 22:49:10 -08:00
Alex Wells 3104c85457 Symbol and Opcode changes to support batched analysis (#1313)
During batched analysis we will be figuring out which symbols need to be varying and which can be uniform during batched execution, we will also be figuring out the minimum number of operations which require masking as well as storing/caching some other operation specific flags used later in batched code generation.  We choose to store these analysis results inside Symbol and Opcode directly so that they are efficiently accessible and stable under optimization passes than might invidate OpcodeVec.
2020-12-08 22:31:33 -08:00
Alex Wells fc3d17acba Added missing implementations for LLVM_Util::assume_ptr_is_aligned(llvm::Value* ptr, unsigned alignment) and LLVM_Util::module_string() (#1306) 2020-12-02 15:54:20 -08:00
Larry Gritz c9f4dc98af CMake refactoring and subproject friendliness (#1304)
Modeled after recent similar changes in OIIO.

* Detect if OSL is being built as a subproject, and if so, set
  `OSL_IS_SUBPROJECT` (a.k.a. `${PROJECT_NAME}_IS_SUBPROJECT`).

* Move all the testing logic out of the main CMakeLists.txt (and a few
  testing-related macros from oiio_macros.cmake) and into a new
  src/cmake/testing.cmake.

* Move all of the packaging logic out of the main CMakeLists.txt and
  into a new src/cmake/packaging.cmake.

* Make all the testing and packaging inactive if this is being built
  as a subproject. Also disable the clang-format target for subprojects.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-12-01 17:52:40 -08:00
Larry Gritz d236f480e6 CHANGES 2020-12-01 14:51:19 -08:00
Larry Gritz 962cc73639 Extend checked_find_package with VERSION_MIN and VERSION_MAX (#1303)
Upon reading cmake docs mre carefully, it's clear that when you pass a
version to find_package (which does much of the heavy lifting inside
checked_find_package), it DOESN'T MEAN you want that version or
later. It means you want to find a version that is "compatible" with
the named version. The meaning of "compatible" is up to the package.
Some packages define it as being >= the requested version. Others
define it as being the same major release, or same major AND minor
release, or exact.

But generally speaking, we only care about the minimum version (e.g.,
"I want FooBar 8.0 or later"). And it's not guaranteed that is what
the package's compatibility will do. In fact, FooBar may be using
compatibility mode "SameMajorVersion", which will make our find of
FooBar succeed for 8.0, 8.1, 8.2, but if a user encounters FooBar 9.0,
our build will reject it, even though it's probably fine.

So I augmented our checked_find_package wrapper to take optional
VERSION_MIN to give the real minimum version, when that's the semantic
we really want (in which case we would omit the ordinary version
number used for the compatibility check and let VERSION_MIN do all the
work). There's also an optional (and usually omitted) VERSION_MAX that
you can use if you are sure that we must be less than a certain
version (the max is exclusive, you must be <, not <=, whereas the min
is inclusive >=).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-27 12:17:48 -08:00
Larry Gritz 6f024bd13a Bump version in development master 2020-11-26 23:24:16 -08:00
Larry Gritz 2f26e9ddf3 Fix bug introduced in 1267: botched constant folding. (#1305)
Some minor refactoring of the recently introduced get_vec3 introduced
a bug into the constant folding of + and - for mixed floats and
triples: the constant produced was of the type of the first operand,
instead of the result. This fixes.

Added handy helper to make vector constant (and disambiguate it from
the one that makes a color constant).
2020-11-26 23:11:34 -08:00
Alex Wells d2f74c6edd Add plumbing through ShadyingSystem into Context to support Batched Execution (#1301)
* Add Symbol::wide_dataoffset() to track offset in heap to wide version of symbol's data
Add flag to Context to track if last execution was batched
Add template<int WidthT> ShadingContext::Batched interface to group together batched versions of execute_init, execute_layer, and execute methods.
Instantiate ShadingCOntext::Batched<8> and ShadingContext::Batched<16>.
Refactor std::vector<std::pair<ErrorHandler::ErrCode, std::string> m_buffered_errors to use proper ErrorItem class with optional Mask to identify which data lanes the Error message applies to.
Added struct ErrorBatch and std::vector<ErrorBatch> m_buffered_error_batches to track which entries in m_buffered_errors came from batched execution as those ranges need to processed multiple times, once per active data lane.
Refactored ShadingContext::process_errors into a templated helper to correlate batched and not batched errors effectively serializing the message output up to the ShadingSy
stem.
Modify ShadingContext::symbol_data to use the symbol's wide_dataoffset() when last execution was batched.
Add RunLLVMGroupFuncWide to model a a function pointer to a batched verson of a JIT'd shader function that accepts batched shader globals and an integer representing the mask (active data lanes) to execute on.
Added ShadingSystemImpl::Batched<int WidthT> interface to group together batched methods jit_group, and jit_all_groups
Instantiate ShadingSystemImpl::Batched<8> and ShadingSystemImpl::Batched<16>
Added ShaderGroup::batch_jitted to track if a group had been jitted for batching (separately from scalar jit)
Added ShaderGroup::llvm_groupdata_wide_size to track amount of heap space needed for a wide version of the group data structure.
To hold onto wide versions of llvm functions side by side with scalar, added llvm_compiled_wide_version, llvm_compiled_wide_init, llvm_compiled_wide_layer.
Add plumbing through ShadyingSystem into Context to support Batched Execution.

* Removed ErrorBatch as it was deemed unnecessary (unreachable usage scenario), which simplifies processing buffered errors.
Changed bool m_execution_is_batched to int batch_size_executed, so we know exactly how many data lanes to process errors for.
Fixed some clang-format issues in osl_pvt.h
2020-11-22 23:35:15 -08:00
Larry Gritz c361228791 Don't merge layers that produce renderer outputs. (#1296)
After talking this over with Luke Emrose it seems unwise to allow
merging of layers that produce renderer outputs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-19 21:45:39 -08:00
Larry Gritz 0af46f8b2e Simplify popcount and countr_zero implementations (#1294)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-19 12:21:51 -08:00
Larry Gritz 7e5d44f313 Minor fixes to CI homebrew -- fix Mac failure, sync with OIIO
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-18 22:25:28 -08:00
Larry Gritz 6a50ea0c91 LoadMemoryCompiledShader: ensure return false on parse failure (#1302)
Most failures in this function returned false, but if it got as far as
parsing but failed that stage, it ended up returning true (success),
which is clearly wrong.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-18 16:43:58 -08:00
Larry Gritz 68fbb9b5fe Build against OpenEXR 3.0 + Imath 3.0 (#1299)
As OpenEXR works toward their 3.0 release, which includes splitting
Imath (the vector, matrix, math, and 'half' stuff) out into a separate
repo, their top of tree master finally breaks our "bleeding edge"
build.

This is a little tricky, because now our support of this dependency is
attempting to span 3 eras: 3.0 with the full split of openexr from
imath, recent openexr+ilmbase 2.x that supplies reliable exported
cmake configs, and older 2.x that predates cmake configs. Eventually
we'll phase out older versions and clean up.

Fixes in this patch generally include:

* Add a new CI test of VFX2021 + openexr/imath master. (This will go away
  when 3.0 is released and that's what we use for the main 2021 case.)

* For new enough versions of OpenEXR, use the exported config file and
  targets, rather than the old style OPENEXR_LIBRARIES style variables.
  We have kind of a mixed idiom use because we're still supporting older
  versions that predate use of the config files.

* Deal with the fact that the Imath headers now live inside
  `<Imath/ImathBlah.h>` rather than `<OpenEXR/ImathBlah.h>`. But of
  course, you need to start including things just to find out the
  version. It's tricky.  The logic is to look at
  `<OpenEXR/OpenEXRConfig.h>` to determine the version we're dealing
  with, then include Imath stuff from one or the other depending on
  what we found. I rearranged quite a few includes to ensure that all
  this logic only happens in a couple spots and the rest gets included
  transitively. As it turns out, quite a few of our `#include`s of
  Imath headers were redundant.

* OSL's exported config needs to look for OpenEXR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-18 16:41:20 -08:00
Larry Gritz f791a3deef Add #pragma error and warning to OSL preprocessor (#1300)
Two new preprocessor directives that oslc will respond to:

    #pragma error "my message"

    #pragma warning "my message"

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-18 14:55:06 -08:00
Larry Gritz ff3220753a Emergency fix for Mac versus recent OIIO master changes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-16 12:08:38 -08:00
Alex Wells ea3f571ee0 Batched testshade (#1298)
* Added 64bit specific popcount call for GCC/Clang in Mask<int WidthT>::count()

* Implement BatchedSimpleRenderer for TestShade

* Introduce template<int WidthT> struct BatchedShaderGlobals
to store upto WidthT instances of ShaderGlobal data.  The data for a batch is broken into underlying uniform and varying data structures.  Uniform contains a fixed set of shader global values that are shared between all instances.  Varying has Block<DataT, WidthT> members so each instance can hold a different value.  The Block data structure is specialized to hold the underlying data type in a SIMD friendly Structure of Arrays (SOA) data layout but provides an array subscript interface to a proxy that can import/export the DataT in its orignal data layout.

Introduce template<int WidthT> class ShadingSystem::BatchedExecutor as an interface to execute batches of shader globals through a shader network.  BatchedExecutor provides similar execute methods that accept a BatchedShaderGlobals and batchSize instead of individual ShaderGlobal(s). This is just the interface, batched backend implemention to follow in subsequent pull requests.

Introduce template<typename DataT, int WidthT> Wide to hold a reference to Block<DataT, WidthT> and provide access to the underlying SOA data layout.  Wide can handle array types and const correctness.  The Wide adapter is lightweight and can be copied by value, used as function parameter.

Once batched execution finishes, the resulting symbol address can be passed to a Wide<DataT, Width> to access the resulting data in a type safe manner.

Updated testshade with command line option "--batched" causing batched execution of 16 or 8 instances through the shader network and to extract the results.  A later pull request will add batched interface to renderer services.

* Add new file src/include/OSL/batched_shaderglobals.h

* Disambiguate fabs call to fabs(double) so it doesn't try OSL::fabs which has no overload for double

* clang-format of batched_shaderglobals.h

* Add BatchedRenderServices, Mask<int WidthT> to represent active lanes during SIMD execution, BatchedTextureOptions, Masked<typename DataT, int WidthT>

* Removed unnecessary .c_str(), changed call to ::fabs to std::fabs

* Removed BatchedRendererServicesBases in favor of simple virtual functions is_overriden_*().
Improved some comments for BatchedRendererServices.h
Workaround some QT macro issues.

* Add BatchedRendererServices implimentation which mainly asserts that its methods are never directly called.
Fixed up issues with OSL_USING_DATA_WIDTH(WIDTH) macro.

* Removed Dz Structure Of Arrays wrappers as OSL doesn't currently support Dz.

* clang-format of mask.h and wide.h

* Added GCC and MSVC specific intrinsics for Mask<int WidthT>::count() and ::first_on()
Moved documentation for Wide, Masked, and other classes in wide.h from top overview to be near class definition.
Fixed some typos.
2020-11-16 10:50:06 -08:00
Larry Gritz 376be8e2f4 Fix compability break with OIIO < 2.2 (from change 1295) (#1297)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-12 11:48:08 -08:00
Larry Gritz 4b1f7b7b23 Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-11 16:22:43 -08:00
Larry Gritz 8f911b47cf CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-10 13:49:41 -08:00
Damien Courtois b8ee545347 Windows build fixes related to Cuda compilation (#1293)
* [cmake] fixed a compilation error when generating bitcode for Cuda files.

Basically the problem is that Boost::thread does some compile time checks that rely (when compiling with MSVC) on the runtime lib being set (/MD switch for instance) And the command that generates the bitcode doesn't specify this, and is not compatible with the switch (clang++ doesn't support MSVC switches, clang-cl is the one that does, but clang-cl doesn't support -O3 and other switches ...)
The easiest solution is to just disable the compile checks from Boost::threads by defined the macro used to guard the checks header.

* [cmake] silenced a ton of warnings about dllimport attributes being ignored on Windows, when generating bitcodes

* [cmake] fixed MSVC's command line warning about overwriting a /W argument.

* better fix for the dllimport attribute not being supported when compiling for Cuda

- the OSL export macros now check for __CUDACC__
- added comments in the CMake to remember to restore the warnings when the 3rd parties' export macros are also fixed.

* clang-format fix in export.h
2020-11-10 09:49:31 -08:00
Larry Gritz 82292a52b9 Bug fix: optimizer interaction with output param that also is userdata (#1295)
* Bug fix: optimizer interaction output param that also is userdata

There's a "pass-through parameter" idiom, where an output param gets
its initial value from an input, it gets modified by the shader, but
it's also an output.

If the modification is optimized away -- say, if it was originally
`theparam *= scale` and scale is 1 -- then it may be that you end up
with no ops in the shader that read from the parameter. If the
parameter was hooked up to userdata, then get_userdata will never be
called to retrieve the value (because it's usually lazy, only doing
the callback the first time it's needed), and so the output value of
parameter will be its parameter default value in the shader, NOT the
value of the interpolatd variable, which was never retrieved and
copied into it, and also that a shader consisting of *only* that
particular flavor of useparam is not marked as "does nothing" (thus
skipping any code generation at all).

This patch adjusts the logic somewhat so that if that output parameter
is connected downstream or is a renderer output, then we definitely
initialize it with a useparam op, even if it is otherwise apparently
not read from within the shader.

Added a new test for this specific case.

Also necessitated update to reference output of debug_uninit test,
only because the extra useparam op caused some of the instruction
numbering to change.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

* testshade: allow arbitrary command line-specificed userdata

To ease testing, add `--userdata` command line option to testshade,
which constructs a ParamValueList that will be used to look up
"userdata" from the shader.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-09 16:04:55 -08:00
Anders Langlands 06ce3d0635 simple self-contained cuda example (#1280) 2020-11-06 09:25:48 -08:00
Larry Gritz 8b1098f3a1 Clean up Mask implementation of first_on (#1291)
The version of Mask::first_on turned out not to have all the necessary
clauses fleshed out, breaking on Windows. So I refactored to get it
right.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-06 08:54:31 -08:00
Larry Gritz c7d77d8508 CI/Mac: fix broken tests involving oslquery (#1289)
The specific combination of Mac + Python 3.8/3.9 + the lastest
pybind11 release causes a crash in the testsuite/python-oslquery
test. It works on other platforms and with older versions of pybind11.

I've tried to understand exactly what's going wrong, and have come up
empty and can't justify spending more time on it. It's suspiciously
similar to several recently "fixed" pybind11+python interaction bugs,
I suspect there are a couple edge cases they missed and that it will
be fixed eventually in a future pybind11 release (or possibly a future
python patch, there does seem to be a problem that pybind11 uncovered
in the cpython code).

In the mean time, a slight rewrite of the loop avoids the problem for
the purposes of our CI tests.

Also a few adjustments to switch back to python 3.9 after some recent
Homebrew fixes that had made us revert back to 3.8 for a while.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-05 10:27:10 -08:00
Larry Gritz 308f289822 CI: build_opencolorio.bash: don't build gpu tests (#1288)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-05 10:26:47 -08:00
Alex Wells c3cd439335 Pr/batched rs (#1276)
* Added 64bit specific popcount call for GCC/Clang in Mask<int WidthT>::count()

* Introduce template<int WidthT> struct BatchedShaderGlobals
to store upto WidthT instances of ShaderGlobal data.  The data for a batch is broken into underlying uniform and varying data structures.  Uniform contains a fixed set of shader global values that are shared between all instances.  Varying has Block<DataT, WidthT> members so each instance can hold a different value.  The Block data structure is specialized to hold the underlying data type in a SIMD friendly Structure of Arrays (SOA) data layout but provides an array subscript interface to a proxy that can import/export the DataT in its orignal data layout.

Introduce template<int WidthT> class ShadingSystem::BatchedExecutor as an interface to execute batches of shader globals through a shader network.  BatchedExecutor provides similar execute methods that accept a BatchedShaderGlobals and batchSize instead of individual ShaderGlobal(s). This is just the interface, batched backend implemention to follow in subsequent pull requests.

Introduce template<typename DataT, int WidthT> Wide to hold a reference to Block<DataT, WidthT> and provide access to the underlying SOA data layout.  Wide can handle array types and const correctness.  The Wide adapter is lightweight and can be copied by value, used as function parameter.

Once batched execution finishes, the resulting symbol address can be passed to a Wide<DataT, Width> to access the resulting data in a type safe manner.

Updated testshade with command line option "--batched" causing batched execution of 16 or 8 instances through the shader network and to extract the results.  A later pull request will add batched interface to renderer services.

* Add new file src/include/OSL/batched_shaderglobals.h

* Disambiguate fabs call to fabs(double) so it doesn't try OSL::fabs which has no overload for double

* clang-format of batched_shaderglobals.h

* Add BatchedRenderServices, Mask<int WidthT> to represent active lanes during SIMD execution, BatchedTextureOptions, Masked<typename DataT, int WidthT>

* Removed unnecessary .c_str(), changed call to ::fabs to std::fabs

* Removed BatchedRendererServicesBases in favor of simple virtual functions is_overriden_*().
Improved some comments for BatchedRendererServices.h
Workaround some QT macro issues.

* Add BatchedRendererServices implimentation which mainly asserts that its methods are never directly called.
Fixed up issues with OSL_USING_DATA_WIDTH(WIDTH) macro.

* Removed Dz Structure Of Arrays wrappers as OSL doesn't currently support Dz.

* clang-format of mask.h and wide.h

* Added GCC and MSVC specific intrinsics for Mask<int WidthT>::count() and ::first_on()
Moved documentation for Wide, Masked, and other classes in wide.h from top overview to be near class definition.
Fixed some typos.
2020-11-04 16:29:44 -08:00
Larry Gritz 79c3ba4159 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-02 22:35:58 -08:00
Larry Gritz c3e2101f19 Build: Require exact version if PYTHON_VERSION is specified (#1286)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-02 11:03:05 -08:00
Larry Gritz 8fa602d270 Let Mac CI use llvm 11 (#1287)
Also make the error artifact include CMake log files.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-02 11:02:52 -08:00
Larry Gritz 8ff28a0e06 Fix OSL::assume_aligned for broken MSVS clause (#1285)
Bad cut and paste made this all wrong. Fix.

Also rename the template's AlignmentT -> Alignment to help reduce
confusion because we usually use the T end to indicate a template
parameter that's a type.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-31 15:03:55 -07:00
Larry Gritz 4c3f28e10e Add GPU CI test to build with USE_OPTIX=1 (#1283)
It can't run the tests, because there is no GPU on the GHA
instance. But at least we can tell if a PR will breake the build
itself. Later we will find a way to execute these via ASWF's AWS
instances that are for this purpose.

Includes the following changes:

* Download optix headers when needed. The ASWF docker container we're
  running on already has Cuda.

* Use CUDA_TARGET_ARCH CMake variable instead of hard coding in
  llvm_util.cpp.

* Bump cuda target default to sm_60.

* Make CI failure artifacts include CMakeCache.txt for inspection.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-29 13:20:37 -07:00
Larry Gritz d988291851 Adjust for recent OIIO master change -- ImageInput no longer has m_mutex (#1281)
While we're in there, get rid of some cruft that only applied to
OIIO 1.x.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-26 19:48:34 -07:00
Larry Gritz f0b28094a8 Modifications to build against LLVM 11 (#1274)
Change bleeding edge CI test to use LLVM 11.

A variety of changes were necessary to the code in LLVM_Util:

* `#if` guards for differing calls related to VectorType::get(),
  CreateShuffleVector.

* constant-generating functions now return llvm::Constant* instead of
  llvm::Value*.

* New wide_constant(width,value) functions for when you want a width other
  than the default vector_width.

* Renamed llvmVectorGet -> llvm_vector_type to be more symmetric with
  other methds we have.

* Simplified places that could have made calls to constant(),
  constant_bool(), wide_constant(), llvm_vector_type(), and
  call_function(), but instead did more complex llvm calls by hand.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-26 17:41:59 -07:00
Larry Gritz 2571c5d878 CI: Lock down on clang-format 10 for CI format check (#1278)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-23 08:42:10 -07:00
Larry Gritz 5bc4160a6c Work around GHCI Mac problem with homebrew openssl (#1277)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-23 08:41:53 -07:00
Larry Gritz e0fb636086 Remove rendererservices.h and batched_shaderglobals.h from oslexec.h (#1275)
With just a few minor adjustments, we're able to eliminate these two
headers (and everything else they pull in) from every client of
oslexec.h.  For the purposes of oslexec.h's declarations, all uses are
either pointers or references, so we only need the names
forward-declared, but we don't need the implementations revealed to
everybody including oslexec.h.

In particular, this hides the RendererServices and BatchedShaderGlobals
from a lot of translation units, should cut down on compile time and
reduce exposure of certain semi-internals to only the modules that
need them.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-21 09:05:02 -07:00
Alex Wells ab3712811c Add interface to ShadingSystem for Batched Execution (#1272)
* Introduce template<int WidthT> struct BatchedShaderGlobals
to store up to WidthT instances of ShaderGlobal data.  The data for a batch is broken into underlying uniform and varying data structures.  Uniform contains a fixed set of shader global values that are shared between all instances.  Varying has Block<DataT, WidthT> members so each instance can hold a different value.  The Block data structure is specialized to hold the underlying data type in a SIMD friendly Structure of Arrays (SOA) data layout but provides an array subscript interface to a proxy that can import/export the DataT in its orignal data layout.

Introduce template<int WidthT> class ShadingSystem::BatchedExecutor as an interface to execute batches of shader globals through a shader network.  BatchedExecutor provides similar execute methods that accept a BatchedShaderGlobals and batchSize instead of individual ShaderGlobal(s). This is just the interface, batched backend implemention to follow in subsequent pull requests.

Introduce template<typename DataT, int WidthT> Wide to hold a reference to Block<DataT, WidthT> and provide access to the underlying SOA data layout.  Wide can handle array types and const correctness.  The Wide adapter is lightweight and can be copied by value, used as function parameter.

Once batched execution finishes, the resulting symbol address can be passed to a Wide<DataT, Width> to access the resulting data in a type safe manner.

Updated testshade with command line option "--batched" causing batched execution of 16 or 8 instances through the shader network and to extract the results.  A later pull request will add batched interface to renderer services.

* Add new file src/include/OSL/batched_shaderglobals.h

* Disambiguate fabs call to fabs(double) so it doesn't try OSL::fabs which has no overload for double

* clang-format of batched_shaderglobals.h

* Removed unnecessary .c_str(), changed call to ::fabs to std::fabs
2020-10-19 18:14:13 -07:00
Larry Gritz 441c783b76 Update ref output after recent OIIO change (#1273)
A change in OIIO master eliminated some spurious newlines in certain
error messages.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-17 11:06:29 -07:00
Declan RussellandDeclan Russell 00e56afe8a Add __CUDADEVRT_INTERNAL__ define to bitcode generation, needed to avoid duplicate cudaMalloc symbols with CUDA9+ (#1271)
Co-authored-by: Declan Russell <Declan.Russell@autodesk.com>
2020-10-15 23:17:37 -07:00
Larry Gritz 27152ad3eb Minor fixes/enhancements to TypeSpec & Symbol (OSL internal classes) (#1267)
* Simplify implementation of TypeSpec::is_triple, more efficient.

* Add TypeSpec::is_triple_based(), analogous to all the other
  is_X/is_X_based.

* Bug fix: Symbol::get_string()'s assertion was checking whether it was
  a string, but should have checked if it was string_based.

* Add Symbol::get_vec3(), analogous to get_int/float/string.

* Add Symbol::coerce_float and coerce_vec3, like get but with some type
  coercions.

* Add Symbol::dataptr() as synonym for data(). This is for "forward
  compatibility", a future PR will make more widespread use of this.

* Lots and lots of places were error-prone and verbose casts are replaced
  with the new methods, and some logic simplified.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-15 13:00:34 -07:00
Larry Gritz a9b1f07c0e Remove ustring::format references, they will change meaning someday (#1270)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-15 10:13:44 -07:00
Larry Gritz 5e848fb761 Turn on clang-format for cpp files in testsuite (#1269) 2020-10-15 10:13:25 -07:00
Larry Gritz 0411a71ec7 Fix typo in example-deformer/CMakeLists.txt (#1268)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-14 14:01:51 -07:00
Larry Gritz 3e7ee0241f Bug fix: is_nonzero was only considering the first element (#1266)
No symptoms ever reported, but surely this is a typo bug.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-12 15:39:03 -07:00
Larry Gritz 3aae741b09 Fix CI break (#2741) (#1265)
Repeat of https://github.com/OpenImageIO/oiio/pull/2741

One of our CI matrix entries recently started failing due to changes
in somethign on GHCI's Ubuntu image. Fix by switching this matrix
to use the appropriate ASWF docker image.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-12 13:27:04 -07:00
Larry Gritz 304f172376 Fix status message I meant to remove earlier
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-12 10:49:47 -07:00
Larry Gritz 58c9d166c0 pugixml build fixes (#1262)
* Bring back the idea of a Findpugixml.cmake file because it turns out
  that (for pugixml <= 1.10) the exported config files are not reliable.

* Fix CI scripts to build PugiXML (with a few different versions). We
  previously were relying on the embedded version for all CI tests, which
  masked problems associated with using an external PugiXML.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-10 13:04:51 -07:00
debaetsdandDieter De Baets 6a303aa2bc Windows compile fixes (#1263)
* Added OSLEXECPUBLIC attributes to inner classes of LLVM_Util to fix
linker errors on MSVC

* do not include cxxabi.h on non GNUC platforms

* fixed windows linker issues

- Link with Version.lib (system lib) to prevent missing symbols in
  ClangDriver.lib
- Do not define OSL_EXPORTS for oslcomp/oslquery as they should import
  (not export)

Co-authored-by: Dieter De Baets <dieter.baets@unity3d.com>
2020-10-09 13:40:02 -07:00
marsupialandrzulak a3d8ebfbb6 Make OSL & OSO parsers re-entrant. (#969)
* OSO re-entrant parser.

* OSL re-entrant parser.

* Formatting

* Use homebrew flex & bison for OSX

* Remove old oslparse()/osoparse() extern declarations.

* Set minimum versions of Flex and Bison

Add logic to flexbison.cmake to prefer the Homebrew version if it's
found (and if no BISON_ROOT is set) because the system install in
/usr/bin is too old to properly build with the new reentrant parser
directives.

Co-authored-by: rzulak <rzulak@imageworks.com>
2020-10-05 21:04:27 -07:00
Larry Gritz 17a17191df Use 'final' liberally (#1260)
This is good for optimization, allowing "de-virtualization" of function
calls in cases when the compiler can be sure that there can be no further
subclassing.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-05 16:01:46 -07:00
marsupialandrzulak 925a36e46e Build against Cuda-11.0.1 and Optix 7.1 (#1232)
Co-authored-by: rzulak <rzulak@imageworks.com>
2020-10-05 11:40:28 -07:00
Larry Gritz 3f5dae3f07 Raise OIIO dependency minimum to 2.1 going forward (#1256)
This patch drops support for OIIO 2.0, making 2.1 the minimum as we
move forward on the way to OSL 1.12 (or 2.0?). The current public
supported release of OIIO is 2.2, so this means that we are still
supporting both the current and the previous year's OIIO major
releases, as is our usual policy (that is, for an OSL that won't
be an official release until some time in 2021).

This patch does not change the supported OIIO releases of prior OSL
releases. In particular, the current release family, OSL 1.11, will
continue to support OIIO 2.0. We never change minimum dependencies
during the course of a release series.

One way this becomes a big simplification is that OIIO 2.1 started
exporting cmake configurations directly, and thus we no longer need
our copy of FindOpenImageIO.cmake, and can jettison some old
conventions that it used for older OIIO releases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-04 12:54:42 -07:00
Larry Gritz d56d03e0c5 Add Cuda+OptiX dependency reporting to testshade (#1259)
Move things around -- add new SS::getattribute queries for the
dependencies, SIMD build flags and runtime capabilities, and
Cuda/OptiX versions.  Then use these queries as the implementation for
reporting them in the statistics output.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-02 19:01:03 -07:00
Larry Gritz 0f46d8d0e2 Print more build/runtime info in stats and help message (#1258)
testshade --help or --runstats now print additional info about the
dependency versions, hardware capabilities enabled at build time, and
hardware capabilities detected at runtime. This should help debugging
of user experiences as an easy way to find out what OSL thinks it's
working with in terms of its environment.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-29 15:50:38 -07:00
Larry Gritz 8a47b386e7 Belatedly bump version after development preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-29 14:27:05 -07:00
Larry Gritz d09912a42b Fix typo in version string (#1257)
Extra char prevented the "release type" from being amended onto the
version string.

Also, change the OSL_INTRO_STRING to use the preferred convention
of "Open Shading Language" rather than "OpenShadingLanguage".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-29 14:15:59 -07:00
Larry Gritz 47381363b7 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-25 11:17:14 -07:00
Alex M. Wells acf6b29059 Optimization: Skip copying of output params to used layers. (1253)
Work by Alex Wells.

When generating the code to copy one layer's outputs to a downstream
layer's inputs, we can skip the copy entirely if we already know that
the downstream layer will not be run.

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2020-09-24 11:01:59 -07:00
Alex M. Wells ace9c64ab9 Fix false positive in uninit test involving do-while loops (1252)
Work of Alex Wells.

Like we do already for "for" loops, when generating extra ops to test for
uninitialized values, "do-while" loops also need to skip testing of their
condition variable (which we know has not been written yet, under most
circumstances).

Signed-off-by: Alex M. Wells <alex.m.wells@intel.com>
2020-09-24 11:00:03 -07:00
marsupialandrzulak 4288d5747e Fix osoparse & osolex from two independent liboslexec.so (#1255)
* Mangle parse and lex C-functions.

* Reset osoreader to nullptr after parse.

Co-authored-by: rzulak <rzulak@imageworks.com>
2020-09-24 10:59:03 -07:00
timgrantandTim Grant ff599d134d Explicitly set the OptiX pipeline stack size. (#1254)
Co-authored-by: Tim Grant <tgrant@nvidia.com>
2020-09-23 15:11:07 -07:00
Alex M. Wells 3b57df4e33 Custom opt levels and passes (1250)
Work of Alex Wells, Intel.

Added custom optimization passes to improve AVX/AVX2 code generation
which are automatically added when targeting the host:

  * PrePromoteLogicalOpsOnBitMasks
  * PreventBitMasksFromBeingLiveinsToBasicBlocks

Added support for experimental llvm_optimize: 10,11,12,13.  Optlevels
10, 11, 12, 13 explicitly create optimization passes.  They are
stripped down versions of clang's -O0, -O1, -O2, -O3.  They try to
provide similar results with improved optimization time by removing
some expensive passes that were repeated many times and omitting other
passes that are not applicable or not profitable.  Useful for
debugging, optlevel 10 adds next to no additional passes.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-21 21:52:09 -07:00
Larry Gritz 71eb599211 python cleanup (#1249)
Switch from old cmake macros that were marked obsolete in cmake 3.12 to
the new FindPython.cmake module.

Instead of defaulting to python 2.7, default to whatever is found.
But user can still set PYTHON_VERSION variable to request a specific
one in case there are multiple.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-20 22:38:15 -07:00
Larry Gritz 6226bee166 Fix derivatives of texture calls when only Dalpha is needed (#1251)
Luke Emrose noticed that for texture calls that retrieved alpha, if
derivatives were later taken *only* of the alpha but not the main
color result of the texture call, those derivs would always end up 0,
the texture call not noticing that it needed to call the version of
texture that returns derivatives.

This patch provides a fix. It was a simple matter of it testing only
whether main result derivs were needed, when determining which variety
of texture must be called.

Curiously, this was already done correctly for texture3d!

Added testsuite/texture-alpha-derivs to test this specific situation.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-19 20:17:17 -07:00
Alex M. Wells 9a85e6fe4d LLVM_Util: add support for masked operations (1248)
Work by Alex Wells.

This will be used extensively by the SIMD batched shading.

* Added support for masked operations by managing a stack of masks
  that were created by conditionals or control flow. Detailed
  explanation of the Masking Strategy in llvm_util.h.

* Added support for logically masked functions (handling of masked
  return from inside OSL functions)

* Added support for masked loops (handling of masked break and or
  masked continue).

* Added support for masked exit (handling of masked exit from entire
  shader).

* Added support for management of when masking is required with a
  ScopedMasking object to allow nesting during code gen.

* op_store (and other store variations) respect the current masking
  requirement and current top of the mask stack (not just the top
  entry, but a combined view of the entire mask stack).

* Added support for results of conditional operations to remain
  boolean.  Most masking operations are expecting vector of bool
  values, not a vector of integers., e.g. when vector width is 16, for
  scalar or <16 x i1> for wide. When a conditional result is used by
  another operation a numerical value it is automatically converted to
  an integer.

* Added `llvm::Type *type_native_mask() const;` because different
  ISA's may have different representations of a mask from llvm's
  vector of bits that comparison operations emit.  And we need varying
  boolean symbols to have the correct data type (size) on the stack
  and in data structures.

* Added gather and scatter operations.

* Added helpers to convert from bool<->int, native_mask<->llvm_mask

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-09 20:25:39 -07:00
Larry Gritz a977bd7fe8 Build system and CI touchups (#1247)
Periodic comparison of analogous build scripts in OIIO & OSL and
synchronize to ensure that my current most favored idioms are in both.

Split checked_find_package into separate file for easier
synchronization between projects.

Bumped OpenEXR versions to latest patches.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 16:00:47 -07:00
Larry Gritz f99ab09096 License file renames for uniformity and correct autodetection (#1246)
Rename LICENSE -> LICENSE.md for uniformity with other projects
and our own documentation.

Rename LICENSE-THIRD-PARTY.md -> THIRD-PARTY.md because it was
confusing GitHub's autodetection of the license (this makes many
tools, including third part such as the ASWF's landscape fail to
correctly categorize this project as BSD-3-Clause).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-27 13:05:04 -07:00
Larry Gritz 9929b39294 Fix CI build break on Mac with LLVM 10.0.1 (#1245)
There's a bug in the current Homebrew llvm 10.0.1 where
it fails to link because of missing libxml2.tbd. It's fixed
upstream in LLVM, but not yet fixed in Homebrew. Hopefully
a subsequent 10.0.x or 11.x will fix it, but for now, just
fall back to llvm@9.

Also issue a warning in the build scripts if this condition
is detected, so if a user encounters it on their system, they
have a hint about how to address it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-26 09:07:03 -07:00
Larry Gritz 9fdaf2cb1f Fix typos in comments (#1243)
Ran a spell checker on our comments. So many fixes.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 11:41:01 -07:00
Larry Gritz e254b50ff7 Use .git-blame-ignore-revs (#1244)
This new file contains the hashes of commits whose only function was
to reformat large amounts of code.

Ordinarily, this would make for confusing 'git blame' output, by
making old code written by author A appear to have a new modification
date and authorship by B, when in fact we know that B just did some
reformatting. This can make it especially hard to discern code history
after after commits that establish the use of "clang-format".

A new git feature (requiring git >= 2.23) allows pointing to a file
containing hashes of commits to be ignored by git blame:

    git blame --ignore-revs-file .git-blame-ignore-revs

To avoid having to remember this all the time, consider adding this to
your git config:

    git config blame.ignoreRevsFile .git-blame-ignore-revs

Note that git supports this feature but does not dictate the name of
the file. I'm just following the convention I'm seeing pop up in other
projects of calling it ".git-blame-ignore-revs".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 09:56:48 -07:00
Larry Gritz 708a99307c CMake: Remember to set ${PROJECT_NAME}_SUPPORTED_RELEASE
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 22:21:50 -07:00
Larry Gritz 8bc15b2dd4 Rebuild docs for release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 22:19:12 -07:00
Larry Gritz 85694d0b32 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 22:18:51 -07:00
Larry Gritz b205b1905a Fix capitalization in new testshade options
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 22:18:47 -07:00
Larry Gritz 8be28e2c5b Docs: Fix longstanding error in description of spline() (#1239)
The implementation was always correct, but the description here was
super unclear and wrong.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-14 16:27:57 -07:00
Larry Gritz 5aefa56d6c Fix fmt vs Cuda incompatibility (#1242)
We used to disable fmt and fall back to tinyformat, when using Cuda.
The new OIIO 2.2 removes tinyformat and the OIIO_USE_FMT preprocessor
symbol. So make sure that we also tell fmt to avoid using the int128
type, not supported by Cuda. That seems to be enough to let it use
the rest of fmt without trouble.
2020-08-14 16:22:00 -07:00
marsupialandrzulak b1c9fdf678 Move spi-bits to llvm-11.0.0 release. (#1241)
Co-authored-by: rzulak <rzulak@imageworks.com>
2020-08-12 20:25:47 -07:00
Alex M. Wells 3330f0a436 split the opt and jit functionality of optimize_group (1226)
Work by Alex Wells.

Separate OSL optimization from JIT by adding optional parameter
`bool do_jit = true` to all optimize_group* methods. This will allow
optimization without JIT'ing for the host, or optimizing once but
JIT'ing for multiple back ends. It will be necessary if one will be
JIT'ing only for batched execution, we would not want to pay the cost
of JIT'ing a scalar version as well (but still could if we wanted both
scalar and batched versions simultaneously).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-11 21:34:29 -07:00
Larry Gritz 5f69390515 More flexible find of llvm-config with suffixed with '-64' (#1238)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-11 11:09:26 -07:00
etheory d1ff4e5748 Remove null check from symbol_address for performance (#1237) 2020-08-02 21:15:49 -07:00
Alex M. Wells 164e834473 testshade: make a way to force varying derivatives for testing (1227)
Work by Alex Wells

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 17:51:21 -07:00
Larry Gritz 440d8a9083 Fix changes typos
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 17:48:25 -07:00
Larry Gritz 8baad933c3 Branch, master is now dev area for 1.12
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 14:36:20 -07:00
3043 changed files with 275785 additions and 53424 deletions
+16
View File
@@ -0,0 +1,16 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Ignore skills that might be installed locally by a developer, to prevent
# cluttering the output of `git status` and prevent people from accidentally
# checking in locally installed skills.
skills/*
# But don't ignore the ones that belong to this project and are checked in. As
# we add skills that we intend to commit and make available to all project
# developers, they must be individually added here if they don't start with
# "osl-".
!skills/osl-*/
!skills/prepare-patch-release/
!skills/release-notes-update/
+313
View File
@@ -0,0 +1,313 @@
#!/usr/bin/env bash
# .agents/setup-agent — Set up AI coding tool integration for this repository.
#
# Creates the tool-specific symlinks and config files needed to use the shared
# resources in AGENTS.md and .agents/ with your preferred AI coding assistant.
# Run "setup-agent <tool>" once after cloning; re-running is always safe.
#
# The canonical project instructions live in AGENTS.md (root) and skills live
# in .agents/skills/<name>/SKILL.md. Everything tool-specific is either a
# symlink into those locations, or a thin wrapper that references them.
# Tool-specific directories (.claude/, .cursor/, etc.) are git-ignored so that
# each developer runs this script for the tool they actually use.
#
# ─────────────────────────────────────────────────────────────────────────────
# TOOL STRATEGIES (update this section when tool conventions change)
# ─────────────────────────────────────────────────────────────────────────────
#
# CLAUDE CODE
# Reads: .claude/CLAUDE.md (project) or CLAUDE.md (root) — NOT AGENTS.md natively.
# If Anthropic eventually adds native AGENTS.md support, the
# .claude/CLAUDE.md wrapper can be retired.
# Skills: .claude/skills/ (each subdirectory is a skill)
# Setup: Write .claude/CLAUDE.md containing "@AGENTS.md" (Claude's include
# syntax), symlink .claude/skills -> ../.agents/skills.
# Docs: https://docs.anthropic.com/en/docs/claude-code/memory
# https://docs.anthropic.com/en/docs/claude-code/skills
#
# OPENAI CODEX
# Reads: AGENTS.md natively — no wrapper needed.
# Skills: .agents/skills/ natively, and also .codex/skills/ as a fallback.
# Setup: Symlink .codex/skills -> ../.agents/skills so either path works.
# Docs: https://developers.openai.com/codex/guides/agents-md
# https://developers.openai.com/codex/skills
#
# CURSOR
# Reads: .cursor/rules/*.mdc files — does NOT read AGENTS.md natively.
# If Cursor adds native AGENTS.md support, the rules symlink can be
# retired.
# Skills: Cursor uses a different slash-command mechanism; .agents/skills/
# are not directly usable today, but the convention may change.
# Setup: Symlink .cursor/rules/project.mdc -> ../../AGENTS.md so Cursor
# picks up our instructions as a project rule.
# Docs: https://docs.cursor.com/context/rules-for-ai
# https://docs.cursor.com/cmdk/overview
#
# OPENCODE
# Reads: AGENTS.md natively — no wrapper needed.
# Skills: Documented to read .agents/skills/ natively, but in practice also
# requires .opencode/commands/<name>.md symlinks (as of 2025-05).
# Remove the per-command symlinks once opencode reliably finds
# .agents/skills/ on its own.
# Setup: Symlink .opencode/skills -> ../.agents/skills (future-proof),
# plus individual .opencode/commands/<name>.md -> skill SKILL.md
# files (current workaround).
# Docs: https://opencode.ai/docs/configuration
# https://opencode.ai/docs/skills
#
# GITHUB COPILOT
# Reads: AGENTS.md natively (VS Code Copilot ≥ 1.99 / GitHub Copilot Chat).
# Also reads .github/copilot-instructions.md as a fallback for older
# clients or non-VS Code surfaces.
# Skills: .agents/skills/ natively supported.
# Setup: Symlink .github/copilot-instructions.md -> ../AGENTS.md so older
# clients also receive our instructions. Remove once all Copilot
# surfaces reliably pick up AGENTS.md directly.
# Docs: https://code.visualstudio.com/docs/copilot/customization/custom-instructions
# https://docs.github.com/en/copilot/concepts/about-prompting-copilot
# https://docs.github.com/en/copilot/concepts/agents/about-agent-skills
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SKILLS_DIR=".agents/skills"
SUPPORTED_TOOLS="claude codex cursor opencode copilot"
usage() {
cat <<EOF
Usage: .agents/setup-agent <tool|all|clear|list> [tool...]
Commands:
<tool> [...] Set up one or more tools
all Set up all supported tools
clear Remove all tool-specific setup created by this script
clear <tool> Remove setup for one specific tool
list List supported tools
Supported tools: $SUPPORTED_TOOLS
Examples:
.agents/setup-agent claude
.agents/setup-agent claude cursor
.agents/setup-agent all
.agents/setup-agent clear
.agents/setup-agent clear opencode
EOF
}
rel() { echo "${1#"$REPO_ROOT"/}"; }
# Create a symlink only if the path doesn't already exist.
# Silent if the link already points to the correct target.
safe_symlink() {
local link="$1" target="$2"
if [ -L "$link" ] && [ "$(readlink "$link")" = "$target" ]; then
return 0
elif [ -e "$link" ] || [ -L "$link" ]; then
echo " SKIP (already exists): $(rel "$link")"
return 0
fi
mkdir -p "$(dirname "$link")"
ln -s "$target" "$link"
echo " LINK: $(rel "$link") -> $target"
}
# Write a file only if the path doesn't already exist.
safe_write() {
local file="$1"
shift
local content="$*"
if [ -e "$file" ]; then
echo " SKIP (already exists): $(rel "$file")"
return 0
fi
mkdir -p "$(dirname "$file")"
printf '%s\n' "$content" > "$file"
echo " FILE: $(rel "$file")"
}
# Remove a symlink only if it still points to the expected target.
safe_remove_symlink() {
local link="$1" expected_target="$2"
[ ! -L "$link" ] && return 0
if [ "$(readlink "$link")" = "$expected_target" ]; then
rm "$link"
echo " REMOVED: $(rel "$link")"
else
echo " SKIP (modified, not removing): $(rel "$link")"
fi
}
# Remove a file only if its content still matches what we wrote.
safe_remove_file() {
local file="$1"
shift
local expected="$*"
[ ! -f "$file" ] || [ -L "$file" ] && return 0
if [ "$(cat "$file")" = "$expected" ]; then
rm "$file"
echo " REMOVED: $(rel "$file")"
else
echo " SKIP (modified, not removing): $(rel "$file")"
fi
}
try_rmdir() { rmdir "$1" 2>/dev/null && echo " RMDIR: $(rel "$1")" || true; }
#------------------------------------------------------------------------------
# Common (tool-agnostic project setup)
#------------------------------------------------------------------------------
setup_common() {
echo "Setting up common project infrastructure..."
# specs/ at the project root is a symlink into docs/dev/specs/ so that
# speckit bash scripts find the directory where they expect it, while the
# actual specs are committed under docs/dev/specs/ and are not cluttered
# at the project root for developers who don't use agents.
safe_symlink "$REPO_ROOT/specs" "docs/dev/specs"
}
clear_common() {
echo "Removing common project infrastructure..."
safe_remove_symlink "$REPO_ROOT/specs" "docs/dev/specs"
}
#------------------------------------------------------------------------------
# Claude Code (.claude/)
#------------------------------------------------------------------------------
setup_claude() {
echo "Setting up Claude Code..."
safe_write "$REPO_ROOT/.claude/CLAUDE.md" "@AGENTS.md"
safe_symlink "$REPO_ROOT/.claude/skills" "../.agents/skills"
safe_write "$REPO_ROOT/.claude/.gitignore" "settings.local.json"
}
clear_claude() {
echo "Removing Claude Code setup..."
safe_remove_file "$REPO_ROOT/.claude/CLAUDE.md" "@AGENTS.md"
safe_remove_symlink "$REPO_ROOT/.claude/skills" "../.agents/skills"
safe_remove_file "$REPO_ROOT/.claude/.gitignore" "settings.local.json"
try_rmdir "$REPO_ROOT/.claude"
}
#------------------------------------------------------------------------------
# OpenAI Codex (.codex/)
#------------------------------------------------------------------------------
setup_codex() {
echo "Setting up OpenAI Codex..."
safe_symlink "$REPO_ROOT/.codex/skills" "../.agents/skills"
safe_write "$REPO_ROOT/.codex/.gitignore" "*.log"
}
clear_codex() {
echo "Removing OpenAI Codex setup..."
safe_remove_symlink "$REPO_ROOT/.codex/skills" "../.agents/skills"
safe_remove_file "$REPO_ROOT/.codex/.gitignore" "*.log"
try_rmdir "$REPO_ROOT/.codex"
}
#------------------------------------------------------------------------------
# Cursor (.cursor/)
#------------------------------------------------------------------------------
setup_cursor() {
echo "Setting up Cursor..."
safe_symlink "$REPO_ROOT/.cursor/rules/project.mdc" "../../AGENTS.md"
safe_write "$REPO_ROOT/.cursor/.gitignore" "$(printf 'composer/\nchat/')"
}
clear_cursor() {
echo "Removing Cursor setup..."
safe_remove_symlink "$REPO_ROOT/.cursor/rules/project.mdc" "../../AGENTS.md"
safe_remove_file "$REPO_ROOT/.cursor/.gitignore" "$(printf 'composer/\nchat/')"
try_rmdir "$REPO_ROOT/.cursor/rules"
try_rmdir "$REPO_ROOT/.cursor"
}
#------------------------------------------------------------------------------
# Opencode (.opencode/)
#------------------------------------------------------------------------------
OPENCODE_GITIGNORE="$(printf 'node_modules\npackage.json\npackage-lock.json\nbun.lock')"
setup_opencode() {
echo "Setting up Opencode..."
safe_symlink "$REPO_ROOT/.opencode/skills" "../.agents/skills"
safe_write "$REPO_ROOT/.opencode/.gitignore" "$OPENCODE_GITIGNORE"
# Individual command links (needed in practice despite docs implying otherwise)
for skill_dir in "$REPO_ROOT/$SKILLS_DIR"/*/; do
[ -d "$skill_dir" ] || continue
local skill_name
skill_name="$(basename "$skill_dir")"
safe_symlink "$REPO_ROOT/.opencode/commands/${skill_name}.md" \
"../../$SKILLS_DIR/${skill_name}/SKILL.md"
done
}
clear_opencode() {
echo "Removing Opencode setup..."
safe_remove_symlink "$REPO_ROOT/.opencode/skills" "../.agents/skills"
safe_remove_file "$REPO_ROOT/.opencode/.gitignore" "$OPENCODE_GITIGNORE"
for skill_dir in "$REPO_ROOT/$SKILLS_DIR"/*/; do
[ -d "$skill_dir" ] || continue
local skill_name
skill_name="$(basename "$skill_dir")"
safe_remove_symlink "$REPO_ROOT/.opencode/commands/${skill_name}.md" \
"../../$SKILLS_DIR/${skill_name}/SKILL.md"
done
try_rmdir "$REPO_ROOT/.opencode/commands"
try_rmdir "$REPO_ROOT/.opencode"
}
#------------------------------------------------------------------------------
# GitHub Copilot (.github/copilot-instructions.md)
# Copilot natively reads AGENTS.md, but also checks copilot-instructions.md.
#------------------------------------------------------------------------------
setup_copilot() {
echo "Setting up GitHub Copilot..."
safe_symlink "$REPO_ROOT/.github/copilot-instructions.md" "../AGENTS.md"
}
clear_copilot() {
echo "Removing GitHub Copilot setup..."
safe_remove_symlink "$REPO_ROOT/.github/copilot-instructions.md" "../AGENTS.md"
}
#------------------------------------------------------------------------------
# Dispatch
#------------------------------------------------------------------------------
run_tool() {
local action="$1" tool="$2"
case "$tool" in
claude) "${action}_claude" ;;
codex) "${action}_codex" ;;
cursor) "${action}_cursor" ;;
opencode) "${action}_opencode" ;;
copilot) "${action}_copilot" ;;
*)
echo "Unknown tool: $tool (supported: $SUPPORTED_TOOLS)" >&2
exit 1
;;
esac
}
[ $# -eq 0 ] && { usage; exit 0; }
case "$1" in
all)
setup_common
for t in $SUPPORTED_TOOLS; do run_tool setup "$t"; done
;;
clear)
shift
if [ $# -eq 0 ]; then
for t in $SUPPORTED_TOOLS; do run_tool clear "$t"; done
clear_common
else
for t in "$@"; do run_tool clear "$t"; done
fi
;;
list)
echo "Supported tools: $SUPPORTED_TOOLS"
;;
-h|--help|help)
usage
;;
*)
setup_common
for t in "$@"; do run_tool setup "$t"; done
;;
esac
@@ -0,0 +1,103 @@
---
name: prepare-patch-release
description: Do all the tasks needed for a patch release of the project.argument-hint: [new-version]
---
Do all the tasks needed for a patch release of the project. These patch
releases generally happen on the first day of every month.
Arguments: `$ARGUMENTS`
- First argument (optional): the version of the upcoming release we are
preparing. If omitted, find the most recent tag on this branch, and the
new version will update the third portion of the version. It might be
either a version number (like `3.1.4.0`) or a tag (like `v3.1.4.0`).
Hint: The numeric "version" is a four-part numeric deignation with the pattern
`MAJOR.MINOR.PATCH.TWEAK`. The "version tag" is usually the numeric version
with a "v" prepended, for example, `v3.1.4.0`.
## Steps and Checklist
- [ ] Determine the version of the new release.
- [ ] Update the main @CMakeLists.txt.
- [ ] Use the "release-notes-update" skill to update @CHANGES.md.
- [ ] Review the release notes to ensure that the changes do not deprecate any
API calls or break API or ABI backward-compatibility, or remove support
for any dependency or toolchain versions. If you think these rules are
being violated, ask for confirmation.
- [ ] Review @README.md for changes.
- [ ] Review @INSTALL.md for changes.
- [ ] Review @CREDITS.md for changes.
- [ ] Review @SECURITY.md for changes.
## Steps to determine the versions of the last and new releases.
1. **Determine the previous tag** if not provided by looking at the
most recent git tag in the current branch, and deducing the 4-part
version number from that.
2. The assumed new version for a patch release has the same major and minor
numbers, the patch number is incremented by one since the last tag, and the
tweak number is "0".
3. If no optional version was present in the arguments, use the assumed new
version.
4. If a version was supplied in the arguments, double check that it differs
from the last tag as explained above. If it does not, ask for verification
that the version requested is correct before proceeding.
## Steps to update CMakeLists.txt
1. In the main @CMakeLists.txt, alter the version to that of the new release,
if it isn't already the same.
2. For a patch release, ensure that `${PROJECT_NAME}_SUPPORTED_RELEASE` should
be set to ON. In main (not yet a supported release) it shold be OFF. If you
find these to not be as expected, ask for confirmation of whether to fix.
3. For a patch release, `PROJECT_VERSEION_RELEASE_TYPE` should be set to empty
(""). In main, it will typically be "dev", "beta", or other designations.
If you find these to not be as expected, ask for confirmation of whether to
fix.
## Reviewing README.md
If this release added support for any new image file formats, be sure that
README.md mentions them in its list of image formats supported.
## Reviewing INSTALL.md
If any of the new commits (as described in the release notes for this version)
appear to add dependencies, or add support for new versions of dependencies,
be sure that INSTALL.md is updated to include that dependency (if not already
listed among the required and optional dependencies), and reflects the latest
version that we claim to support.
Double check @externalpackages.cmake and ensure that any minimum required
versions of dependencies that cmake will enforce match the oldest versions
of those dependencies as documentd in INSTALL.md.
## Reviewing CREDITS.md
The @CREDITS.md file lists all known contributors to the project, sorted alpha
by first name. In cases where an author's actual name is unknown, we use the
GitHub userid.
Ensure that any authors referenced in the new release notes for the version we
are releasing are inserted in the credit list, if they are not already
present. You don't need to check older versions, we presume those have already
been included.
## Reviewing SECURITY.md
The @SECURITY.md file lists which versions are currently supported at what
levels, and lists all previously-fixed SVE's or security advisories. Be sure
to check this file in older branches (the last two releases, say), and if you
are preparing a patch release, also check in main and more recent (higher
numbered) releases for more recently modified SECURITY.md, and be sure that
this branch gets amended with any information that seems to have been updated
more recently in those other branches. Check whichever is newer of the local
and remote copy of that branch, since the local one may have had release notes
or its version in CMakeLists.txt updated, but not yet pushed to GitHub.
## Reference
- Full release procedures: `docs/dev/RELEASING.md`
- Steps for updating release notes: `release-notes-update/SKILL.md`
@@ -0,0 +1,217 @@
---
name: release-notes-update
description: Generate or update release notes for a patch, minor, or major release, or just to update main. Run git-cliff, organize and edit the output per project conventions, and insert into CHANGES.md.
argument-hint: [patch|minor|major|main] [prev-tag]
---
Generate release notes for an OSL release.
Arguments: `$ARGUMENTS`
- First argument (optional): release type — `patch` (default), `minor`, `major`, or `main`.
- Second argument (optional): previous release tag (e.g. `v3.1.2.0`). If omitted, find the most recent tag automatically. If the release type is `main`, instead of a tag, look for the last commit at which the CHANGES.md file was updated.
## Steps
1. **Determine the previous tag** if not provided:
```
git describe --tags --abbrev=0
```
or look at recent tags: `git tag --sort=-version:refname | head -10`.
However, if the "release type" is `main`, instead of a tag, just find
the commit at which CHANGES.md was last updated.
2. **Run git-cliff** to get raw commit data:
```
git cliff -c src/doc/cliff.toml <prev-tag>..HEAD > /tmp/cliff-out.md
```
Read `/tmp/cliff-out.md` to see the raw output.
3. **Read CHANGES.md** to see the current top of the file and understand where to insert.
4. **Format the release notes** according to the release type:
### For patch releases:
Follow the skeleton in `docs/dev/Changes-skeleton-patch.md`:
```
Release X.Y.Z.W (Month DD, YYYY) -- compared to X.Y.Z.W-1
---------------------------------------------------------
- *category*: Description. [#NNNN](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/NNNN) (by author)
```
Rules:
- **Remove** the section headings git-cliff generates; patch notes are a flat
list.
- **Add conventional commit prefixes** to any "uncategorized" entries (those
lacking a `feat:`, `fix:`, etc. prefix).
- **Reorder** entries logically: feature enhancements first, then bug fixes,
then build/CI fixes, then internal changes, then test improvements, then
docs/admin.
- **Omit** entries that are purely internal and too minor to matter to users.
Ask for confirmation about entries you propose to omit.
- Prefer to use author's actual name if known. If the name cannot be found,
the GitHub userid can be used instead.
- Omit the author if it is the project leader, Larry Gritz, unless he is not
the dominant author (at least 75% of commits) in this release.
- Keep entries to one line each. Be terse but informative.
- Use the format `*subsystem*:` for the category prefix (e.g., back end target
such as `*optix*:` or `*batch*:`, utility like `*testrender*:` or
`*osltoy*:`, class or API category like `*ShadingSystem*:`, or topic
category such as `*build*:`, `*ci*:`, `*docs*:`).
- We aim to make patch releases on the first day of each month. If we are
within a few days of a month end, list the date as the beginning of the
upcoming month. Ask for confirmation that this is the planned release date.
### For minor or major releases:
Follow the skeleton in `docs/dev/Changes-skeleton-major.md`. Sections:
```
Release X.Y.0.0 (Month, YYYY) -- compared to X.Y-1
--------------------------------------------------
### New minimum dependencies, toolchain, and compatibility changes:
### ✏️ OSL Language, standard library, and oslc compiler (for shader writers):
### ⛰️ API changes and new ShadingSystem features (for renderer writers):
### ☀️ testshade/testrender/osltoy improvements
### 🐛/🔧 Internals: fixes, improvements, and developer concerns
### 🏗 Build/test/CI and platform ports
* CMake build system and scripts:
* Dependency and platform support:
* Testing and Continuous integration (CI) systems:
### 📚 Notable documentation changes:
### 🏢 Project Administration
### 🤝 Contributors
```
Note that the section outline may already be present, in which case you
only need to fit items into the existing category outline.
Rules:
- Group commits into sections; within each section, cluster related items together.
- When needed, expand terse one-liners into enough prose that users understand what changed and why it matters.
- For `feat:` commits, make sure the feature is explained sufficiently — don't just copy the commit subject.
- For `api:` or `api!:` commits, clearly call out what changed in the public API.
- Include PR links and author attribution for every entry.
- The notes should "tell the story" of the release, not just be a dump of commit subjects.
- We aim to make major/minor releases approximately in October 1 of each year. If the anticipted release date is already in the file, don't change it. If it is not present, ask for confirmation of the planned release date.
### For updating release notes in main:
Rules:
- Generally, follow the rules for "major/minor releases", except as noted in other items below.
- Don't apply a new skeleton of category listings unless they are not present for the upcoming release.
5. **Insert the formatted notes** into `CHANGES.md` in the appropriate place (as detailed below). Leave the existing content intact.
- When updating `main` or preparing a `major` or `minor` release, insert the updates in the top section for the upcoming major/minor release. Insert a new set of category sections only if it's not already present.
- When doing a `patch` release, insert the changes immediately above the last patch release of that branch, so that CHANGES.md lists releases in descending numerical (version) order.
- When porting a set of release notes from a release branch into main, or from an older (obsolete) release branch to the current release branch, insert it into the right place to maintain overall descending order.
6. **Double check that the notes are adequately descriptive.** (See more
detailed description of this step below.)
7. **Forward-port release notes from release branches if needed**
8. **Show a summary** of what was inserted and ask the user to review before finalizing.
## Forward-porting release notes
Release notes may have been generated independently in main, and release
branches. When updating one branch, we ensure that any changes from older
branches have been incorporated.
- When preparing `patch` release notes, check the CHANGES.md file in the
"dev-X.(Y-1)" branch for the previous minor release family to identify any
X.(Y-1).Z patch release notes that are not reflected in the current release
notes that we are updating.
- When updating `main` or doing a `major` or `minor` release, check the
CHANGES.md file in both the "dev-X.(Y-1)" and "dev-X.(Y-2)" branches.
Check whichever is newer of the local and remote copy of that branch, since
the local one may have had release notes or its version in CMakeLists.txt
updated, but not yet pushed to GitHub.
- If any patch releases are present in the older dev branches checked, insert
the release notes for those patch releases into the right positions in the
current release notes that we are updating.
- If a change is forward-ported in this manner and the same PR is an update in
the current set of changes we are updating as our main task, document that
in the current set of notes using the following convention: in the line of
the notes, the explanation of the version where it appears should reflect
the first version of all branches where it appeared, for example, `(3.2.0.0,
3.1.3.0, 3.0.8.0)` to indicate that the patch was added to each of those
versions. The versions should be listed in descending order.
## Useful abbreviations for category labels
| Abbrev | Meaning |
|--------|---------|
| build | CMake/build system |
| deps | Changes to accommodate dependency or toolchain changes |
| ci | CI/GitHub Actions |
| docs | documentation |
| int | internal/refactor |
| test | testsuite or unit tests |
| HEADER.h | Developer utilities in a public header file |
## Combining PRs into single entries
To be more concise and easier to read, within a release's notes, related
PRs/commits can be combined into a single bullet-point line, which would look
like
```
- *category*: Combined Description. [#NNNN1](URL) (by author1) [#NNNN2](URL2) (by author2) [#NNNN2](URL2) (by author2)
```
if fully combined, or if explained one by one,
```
- *category*: Description 1 [#NNNN1](URL) (by author1), amendment 2, [#NNNN2](URL2) (by author2), amendment 3, [#NNNN3](URL3) (by author3)
```
Choose the fully combined or explained one by one based on which is more clear
to the reader.
If the authors are all the same, only have the author designation at the end.
Here are the cases where it's ok to combine commits in this way:
- If it is clear that multiple PRs are part of the same feature or fix,
consisting of an initial commit, and subsequent smaller changes or
continuations of the same topic.
- An initial commit, and a subsequent commit that is obviously a fix to a bug
in the initial commit.
- "CI" changes that all only add new cases to the test matrix.
- "CI" changes that all only fix spontaneous breakages in the GitHub runners.
- "Build" changes that are all just minor updates to versions of dependencies
that we support or test against.
Some more examples of combined commit messages:
```
- feat: Add GPS metadata functionality for TIFF [PR1](PR URL 1) [PR2](PR URL 2) [PR3](PR URL 3) (by author).
- ci: New CI variants for MSVS 2026 [PR1](PR URL 1) (by author1), VFX Platform 2027 [PR2](PR URL 2) (by author2).
- ci: Various fixes for unexpected changes to GitHub Actions runners [PR1](PR URL 1), [PR2](PR URL 2) (by author)
- build: Added support for gcc 15 [PR1](PR URL 1) (by author1), OpenEXR 3.5.1 [PR2](PR URL 2) (by author2), libtiff 4.8 [PR3](PR URL 3) (by author3).
```
Always ask for confirmation before combining commits in this manner. Confirm
separately for each proposed combination of a group of multiple original
commits into a single commit. Give the user the opportunity to revise the
combined description or request other changes for the grouping.
## Double check that the notes are adequately descriptive
For newly added items for this release, read the short descriptions provided
by git-cliff, double check them against the full commit messages to be sure
the one-line summary is adequate. If the summary is misleading, too brief and
leaving out the fact that an important thing was changed, or not adequately
capturing the scope of changes, feel free to propose an alternate wording that
will make it more clear to readers what changed as a result of the PR. Ask for
confirmation on these and explain why you felt the one-line description wasn't
enough.
## Reference
Full release procedures: `docs/dev/RELEASING.md`
Patch skeleton: `docs/dev/Changes-skeleton-patch.md`
Major skeleton: `docs/dev/Changes-skeleton-major.md`
Example good patch notes: https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/releases/tag/v1.15.2.0
Example good major/minor notes: https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/releases/tag/v1.15.0.0
+3 -3
View File
@@ -1,10 +1,9 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
Language: Cpp
BasedOnStyle: WebKit
SpaceBeforeParens: ControlStatements
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
@@ -84,6 +83,7 @@ IncludeCategories:
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentExternBlock: NoIndent
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
@@ -128,7 +128,7 @@ SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++14
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
+48
View File
@@ -0,0 +1,48 @@
# Start using clang-format on OSL code base (#1215)
630b4c042d696c94ec9b2a1b6f5adc250bd61e05
# More clang-format (#1218)
bdb473cbdb119f3d9060d48f75f965cbd45f6d7a
# More clang-format: liboslquery, oslinfo, oslc, osl.imageio, osltoy (#1220)
bf366d7a90c46599b82071dac6dbef7c5e3ca157
# Turn on clang-format for cpp files in testsuite (#1269)
00c895fc642eb89685797c292048bdff15d675e7
5e848fb761261521a3ee7cd8a4f6814f32fe4a47
# CI: Change our clang-format standard to clang11 (#1372)
91d22ebe2f65d4ed0599e421172a15d99fe0e1b4
# More clang-format (this time, testrender and liboslnoise) (#1511)
08706b7cbac781b6a9389780428016be985d9d89
# clang-format #1509
b4026fd1695c08532557b3ba1c2142323087ccf9
1f73b075c99861afa42fac44567b37f797bc72f2
7f2e83794e6fa63d5180653cffb77be2cc38b32b
28399fefc890442b5ac020e7a90cee0d5bf9f03c
e56851056d33233b0bb8324faac251907099961a
1c57fc61d8ab7c3f309be4335e4c71c26399edd4
46d451ce74d00e904874df476ebeca19bb119ea9
c1045f2c2845a98e661c7181932a031eb3c76063
# More clang-format (#1512)
8c6ffdd911b9eb7db4adf41ab88891360452d7c5
# style: more clang-format (#1515)
102430c83554fe7e328cd8c3317db00507bcfaba
# Revert some formatting (#1518)
21eac9d9215d071b0a7b9ce2c32f189ed0c62c4a
# Another round of clang-format (#1540)
38015b6be28643254aea530154b7860136cf5e15
89d5db2b5c5fda79184d8245d903e580fc6a4e9c
# clang-format: the very last piece of the puzzle (#1555)
4ee62cd2ef05543f818f4d95a19efc1d684a7381
5be7c6bd4e7bd2e560cb6be8c06f11985384a87a
# Raise CI formatting standard to clang-format 17
a9ce35135e6c022d538a4a184fee1b5ce908aed8
-40
View File
@@ -1,40 +0,0 @@
<!--
Please ask questions ("how do I...?" "why doesn't this work?") on the [osl-dev mail list](https://lists.aswf.io/g/osl-dev), not by filing issues.
Make concrete suggestions for fixing the code ("here is a patch") by filing
a pull request, not an issue.
-->
### Problem
<!-- Describe the problem or suggestion here.] -->
**Expected behavior:** <!-- What you expected to happen -->
**Actual behavior:** <!-- What actually happened -->
<!-- If your problem is a broken build, please create a -->
<!-- [gist](https://gist.github.com) that contains the _full_ verbose -->
<!-- build log, which you can create like this: -->
<!-- ```make clean ; make VERBOSE=1 > build.log``` -->
<!-- If you are reporting a problem about a release branch, have you -->
<!-- already tried the current head of `master` to see if the problem -->
<!-- has been fixed? -->
### Steps to Reproduce
1. [First Step]
2. [Second Step]
3. [and so on...]
### Versions
* OSL branch/version:
* OS:
* C++ compiler:
* LLVM version:
* OIIO version:
+45
View File
@@ -0,0 +1,45 @@
---
name: Bug report
about: I think I have identified a legit bug and can describe it.
title: "[BUG]"
labels: ''
assignees: ''
---
Note: The prompts below are just to help you formulate a good and actionable
request. Feel free to deviate from this format or to delete this text and
write free-form if you prefer.
**Describe the bug**
A clear and concise description of what the bug is. What happened, and
what did you expect to happen instead.
**OSL version and dependencies**
* OSL branch/version:
* OS:
* C++ compiler:
* LLVM version:
* OIIO version:
**To Reproduce**
Steps to reproduce the behavior:
1. Do this...
2. Then this...
3. Then THIS happens (reproduce the exact error message if you can)
4. Whereas I expected this other specific thing to happen instead.
**Evidence**
- Error messages (paste them here exactly)
- Example shader code (if applicable)
**IF YOU ALREADY HAVE A CODE FIX:** There is no need to file a separate issue,
please just go straight to making a [pull request](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pulls).
+24
View File
@@ -0,0 +1,24 @@
---
name: Build problems
about: I'm having trouble building OSL. Help!
title: "[BUILD]"
labels: ''
assignees: ''
---
**PLEASE DO NOT REPORT BUILD TROUBLES AS GITHUB "ISSUES" UNLESS YOU ARE RALLY SURE IT'S A BUG**
The best way to get help with your build problems is to ask a question on the
[osl-dev developer mail list](https://lists.aswf.io/g/osl-dev). For quick
questions, you could also try the [ASWF Slack](https://slack.aswf.io)
`#openshadinglanguage` channel.
When you email about this, please attach one or both of the following:
1. The full verbose build log, which you can create like this:
```make clean ; make VERBOSE=1 > build.log```
2. The `CMakeCache.txt` file from your build directory.
If you are pretty sure that you have identified a **BUG** or other actual
problem with the OSL build scripts and you can describe how to reproduce it,
please file a [bug report issue](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues/new?template=bug_report.md).
+25
View File
@@ -0,0 +1,25 @@
---
name: Feature request
about: I have a concrete idea about how to improve OSL.
title: "[FEATURE REQUEST]"
labels: ''
assignees: ''
---
Note: The prompts below are just to help you formulate a good and actionable
request. Feel free to deviate from this format or to delete this text and
write free-form if you prefer.
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context about the feature request here.
+28
View File
@@ -0,0 +1,28 @@
---
name: Question
about: How do I... I need help with...
title: "[HELP]"
labels: ''
assignees: ''
---
**PLEASE DO NOT ASK USAGE QUESTIONS USING GITHUB "ISSUES"**
If you are pretty sure that you have identified a **BUG** in OSL, please file
a [bug report issue](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues/new?template=bug_report.md).
But if you are just asking a question:
* How do I...?
* I need help with...
* Am I doing something wrong?
* I can't build OSL
For anything of this nature, the best way to get help using OSL is to ask a
question on the [osl-dev developer mail list](https://lists.aswf.io/g/osl-dev).
For quick questions, you could also try the [ASWF Slack](https://slack.aswf.io) `#openshadinglanguage` channel.
Please check the [documentation](https://docs.openshadinglanguage.org) first;
you may find the answer more quickly than you can get your question answered
on the mail list.
+33 -9
View File
@@ -1,22 +1,46 @@
## Description
------ :scissors: -------------------------------------------------------------------
YOU MAY DELETE ALL OF THIS IF YOU ALREADY HAVE A DESCRIPTIVE COMMIT MESSAGE!
This is just a template and set of reminders about what constitutes a good PR.
But please look over the checklist at the bottom.
If THIS TEXT is still in your PR description, we'll know you didn't read the
instructions!
### Description
<!-- Please provide a description of what this PR is meant to fix, and -->
<!-- how it works (if it's not going to be very clear from the code). -->
## Tests
### Tests
<!-- Did you / should you add a testsuite case (new test, or add to an -->
<!-- existing test) to verify that this works? -->
## Checklist:
### Checklist:
<!-- Put an 'x' in the boxes as you complete the checklist items -->
- [ ] I have read the [contribution guidelines](../CONTRIBUTING.md).
- [ ] I have previously submitted a [Contributor License Agreement](http://opensource.imageworks.com/cla/).
- [ ] 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).
- [ ] My code follows the prevailing code style of this project.
- [ ] **I have read the guidelines** on [contributions](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/CONTRIBUTING.md) and [code review procedures](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/docs/dev/CodeReview.md).
- [ ] **I have read the [Policy on AI Coding Assistants](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/docs/dev/AI_Policy.md)**
and if I used AI coding assistants, I have an `Assisted-by: TOOL / MODEL`
line in the pull request description above.
- [ ] **I have updated the documentation** if my PR adds features or changes
behavior.
- [ ] **I am sure that this PR's changes are tested in the testsuite**.
- [ ] **I have run and passed the testsuite in CI** *before* submitting the
PR, by pushing the changes to my fork and seeing that the automated CI
passed there. (Exceptions: If most tests pass and you can't figure out why
the remaining ones fail, it's ok to submit the PR and ask for help. Or if
any failures seem entirely unrelated to your change; sometimes things break
on the GitHub runners.)
- [ ] **My code follows the prevailing code style of this project** and I
fixed any problems reported by the clang-format CI test.
+149
View File
@@ -0,0 +1,149 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
name: Analysis
on:
schedule:
# Run nightly while we're still working our way through the warnings
- cron: "0 8 * * *"
# Run unconditionally once weekly
# - cron: "0 0 * * 0"
push:
branches:
- main
- dev-1.14
- dev-1.15
- '*analysis*'
- '*sonar*'
paths:
- '**'
- '!**.md'
- '!**.rst'
- '!**/ci.yml'
- '!**/docs.yml'
- '!**/scorecard.yml'
- '!**/wheel.yml'
- '!**.properties'
- '!docs/**'
# Run analysis on PRs only if the branch name indicates that the purpose of
# the PR is related to the Sonar analysis. We don't run on every PR because
# the analysis run is very expensive and just isn't usually necessary.
pull_request:
branches:
- '*analysis*'
- '*sonar*'
# Allow manual kicking off of the workflow from github.com
workflow_dispatch:
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
aswf:
name: "SonarCloud Analysis"
if: github.event.repository.fork == false
strategy:
fail-fast: false
matrix:
include:
- desc: sonar gcc9/C++14 llvm13 py3.9 exr3.1 oiio2.3 avx2
nametag: static-analysis-sonar
os: ubuntu-latest
vfxyear: 2022
vfxsuffix: -clang13
cxx_std: 14
openimageio_ver: master
python_ver: 3.9
pybind11_ver: v2.9.0
simd: avx2,f16c
batched: b8_AVX2,b16_AVX512
coverage: 1
# skip_tests: 1
sonar: 1
setenvs: export SONAR_SCANNER_VERSION=4.7.0.2747
SONAR_SERVER_URL="https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR=bw_output
OSL_CMAKE_BUILD_WRAPPER="build-wrapper-linux-x86-64 --out-dir bw_output"
CMAKE_BUILD_TYPE=Debug
CMAKE_UNITY_BUILD=OFF
CODECOV=1
TESTRENDER_AA=1
OSL_TESTSUITE_SKIP_DIFF=1
CTEST_TEST_TIMEOUT=1200
OSL_CMAKE_FLAGS="-DOSL_TEST_BIG_TIMEOUT=1200 -DUSE_QT=0"
CTEST_EXCLUSIONS="broken|noise-reg.regress|noise-gabor-reg.regress"
runs-on: ${{ matrix.os }}
container:
image: aswf/ci-osl:${{matrix.vfxyear}}${{matrix.vfxsuffix}}
env:
CXX: ${{matrix.cxx_compiler}}
CC: ${{matrix.cc_compiler}}
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
FMT_VERSION: ${{matrix.fmt_ver}}
OPENEXR_VERSION: ${{matrix.openexr_ver}}
OPENIMAGEIO_VERSION: ${{matrix.openimageio_ver}}
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
PYTHON_VERSION: ${{matrix.python_ver}}
USE_BATCHED: ${{matrix.batched}}
USE_SIMD: ${{matrix.simd}}
# DEBUG_CI: 1
steps:
# We would like to use harden-runner, but it flags too many false
# positives, every time we download a dependency. We should use it only
# on CI runs where we are producing artifacts that users might rely on.
# - name: Harden Runner
# uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3
# with:
# egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
fetch-depth: '0'
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: /tmp/ccache
key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
restore-keys: ${{github.job}}-
- name: Build setup
run: |
${{matrix.setenvs}}
src/build-scripts/ci-startup.bash
- name: Remove existing OIIO
if: matrix.openimageio_ver != ''
run: |
sudo rm -rf /usr/local/include/OpenImageIO
sudo rm -rf /usr/local/lib*/cmake/OpenImageIO
sudo rm -rf /usr/local/lib*/libOpenImageIO*
sudo rm -rf /usr/local/lib*/python3.9/site-packages/OpenImageIO*
- name: Dependencies
run: |
${{matrix.depcmds}}
src/build-scripts/gh-installdeps.bash
- name: Build
run: src/build-scripts/ci-build.bash
- name: Testsuite
if: matrix.skip_tests != '1'
run: src/build-scripts/ci-test.bash
- name: Code coverage
if: matrix.coverage == '1'
run: src/build-scripts/ci-coverage.bash
- name: Sonar-scanner
if: matrix.sonar == 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner -X --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="build/bw_output" --define sonar.cfamily.gcov.reportsPath="_coverage"
+332
View File
@@ -0,0 +1,332 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
##########################################################################
# Common steps for all CI workflows
##########################################################################
name: CI Steps
on:
workflow_call:
# This inputs receive values via the "with:" section in ci_workflow.yml
inputs:
disable:
type: boolean
default: false
build:
type: string
runner:
type: string
container:
type: string
container_volumes:
type: string
default: '[]'
cc_compiler:
type: string
cxx_compiler:
type: string
cxx_std:
type: string
batched:
type: string
build_type:
type: string
depcmds:
type: string
extra_artifacts:
type: string
fmt_ver:
type: string
fmt_commit:
type: string
gcc_action_ver:
type: string
llvm_action_ver:
type: string
opencolorio_ver:
type: string
openexr_ver:
type: string
openimageio_ver:
type: string
pybind11_ver:
type: string
python_action_ver:
type: string
python_ver:
type: string
setenvs:
type: string
simd:
type: string
skip_build:
type: string
skip_tests:
type: string
abi_check:
type: string
benchmark:
type: string
build_docs:
type: string
clang_format:
type: string
generator:
type: string
ctest_args:
type: string
ctest_test_timeout:
type: string
coverage:
type: string
sonar:
type: string
old_node:
type: string
default: 0
nametag:
type: string
required_deps:
type: string
optional_deps:
type: string
build_local_deps:
type: string
secrets:
PASSED_GITHUB_TOKEN:
required: false
PASSED_SONAR_TOKEN:
required: false
permissions: read-all
jobs:
steps:
name: "${{inputs.cxx_compiler}} c++${{inputs.cxx_std}} py${{inputs.python_ver}}"
if: ${{ !inputs.disable }}
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
volumes: ${{ fromJson( inputs.container_volumes ) }}
options: -v /:/host/root ${{ (contains(inputs.runner, 'gpu') && '-e NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility --gpus all') || '-e A=x' }}
# Extra options:
# - Ensure the GPU runners have OptiX is visible in the container.
# - Mount the native filesystem under /host/root
env:
CXX: ${{inputs.cxx_compiler}}
CC: ${{inputs.cc_compiler}}
CMAKE_BUILD_TYPE: ${{inputs.build_type}}
CMAKE_CXX_STANDARD: ${{inputs.cxx_std}}
CMAKE_GENERATOR: ${{inputs.generator}}
CTEST_ARGS: ${{inputs.ctest_args}}
CTEST_TEST_TIMEOUT: ${{inputs.ctest_test_timeout}}
USE_SIMD: ${{inputs.simd}}
FMT_VERSION: ${{inputs.fmt_ver}}
fmt_BUILD_VERSION: ${{inputs.fmt_ver}}
fmt_GIT_COMMIT: ${{inputs.fmt_commit}}
OPENCOLORIO_VERSION: ${{inputs.opencolorio_ver}}
OPENEXR_VERSION: ${{inputs.openexr_ver}}
OPENIMAGEIO_VERSION: ${{inputs.openimageio_ver}}
PYBIND11_VERSION: ${{inputs.pybind11_ver}}
PYTHON_VERSION: ${{inputs.python_ver}}
USE_BATCHED: ${{inputs.batched}}
ABI_CHECK: ${{inputs.abi_check}}
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
# For CI, sometimes we want to require all dependencies to be present,
# except for a select few listed explicitly. This ensures that we don't
# accidentally have a situation in which we think we are building
# against and testing an optional dependency, but in fact are not.
OSL_REQUIRED_DEPS: ${{inputs.required_deps}}
OSL_OPTIONAL_DEPS: ${{inputs.optional_deps}}
OSL_BUILD_LOCAL_DEPS: ${{inputs.build_local_deps}}
SETENVS: ${{inputs.setenvs}}
DEPCMDS: ${{inputs.depcmds}}
steps:
# Install nodejs 20 with glibc 2.17, to work around the face that the
# GHA runners are insisting on a node version that is too new for the
# glibc in the ASWF containers prior to 2023.
- name: install nodejs20glibc2.17
if: inputs.old_node == '1'
run: |
curl --silent https://unofficial-builds.nodejs.org/download/release/v20.18.1/node-v20.18.1-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 -f -
- name: Checkout repo
if: inputs.old_node != '1'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout repo-OLD
if: inputs.old_node == '1'
# Must use an old checkout action for old containers
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Install LLVM and Clang
if: inputs.llvm_action_ver != ''
uses: KyleMayes/install-llvm-action@ebc0426251bc40c7cd31162802432c68818ab8f0 # v2.0.9
with:
version: ${{ inputs.llvm_action_ver }}
- name: Build setup
shell: bash
run: |
eval "$SETENVS"
src/build-scripts/ci-startup.bash
- name: Prepare ccache timestamp
id: ccache_cache_keys
shell: bash
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
- name: ccache-restore
if: inputs.old_node != '1'
id: ccache-restore
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
restore-keys: ${{inputs.nametag}}
- name: ccache-restore-OLD
if: inputs.old_node == '1'
id: ccache-restore-old
# Must use an old cache restore action for old containers
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.CCACHE_DIR }}
# path: ./ccache
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
restore-keys: ${{inputs.nametag}}
- name: Install gcc
if: inputs.gcc_action_ver != ''
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install -y g++-${{inputs.gcc_action_ver}}
- name: Install python
if: inputs.python_action_ver != ''
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python_action_ver }}
- name: Dependencies
shell: bash
run: |
eval "$DEPCMDS"
if [[ "$RUNNER_OS" == "Linux" ]]; then
src/build-scripts/gh-installdeps.bash
elif [[ "$RUNNER_OS" == "macOS" ]]; then
src/build-scripts/install_homebrew_deps.bash
if [[ "$OPENIMAGEIO_VERSION" != "" ]] ; then \
OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0 -DCMAKE_UNITY_BUILD=ON" ; \
source src/build-scripts/build_openimageio.bash ; \
else \
brew install --display-times -q openimageio ; \
PYTHONPATH=$PYTHONPATH:/usr/local/lib/python${PYTHON_VERSION}/site-packages ; \
fi
src/build-scripts/save-env.bash
elif [[ "$RUNNER_OS" == "Windows" ]]; then
src/build-scripts/gh-win-installdeps.bash
fi
- name: Install sonar-scanner and build-wrapper
if: inputs.sonar == '1'
uses: sonarsource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
- name: Build
if: inputs.skip_build != '1'
shell: bash
run: src/build-scripts/ci-build.bash
- name: Check out ABI standard
if: inputs.abi_check != ''
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{inputs.abi_check}}
path: abi_standard
- name: Build ABI standard
if: inputs.abi_check != ''
shell: bash
run: |
mkdir -p abi_standard/build
pushd abi_standard
src/build-scripts/ci-build.bash
popd
- name: ccache-save
if: inputs.old_node != '1'
id: ccache-save
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
- name: ccache-save-OLD
if: inputs.old_node == '1'
id: ccache-save-old
# Must use an old cache action for old containers
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.CCACHE_DIR }}
key: ${{inputs.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
- name: Testsuite
if: inputs.skip_tests != '1'
shell: bash
run: src/build-scripts/ci-test.bash
- name: Benchmarks
if: inputs.benchmark == '1'
shell: bash
run: src/build-scripts/ci-benchmark.bash
- name: clang-format
if: inputs.clang_format == '1'
shell: bash
run: src/build-scripts/run-clang-format.bash
- name: Code coverage
if: inputs.coverage == '1'
run: src/build-scripts/ci-coverage.bash
- name: Sonar-scanner
if: inputs.sonar == 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
which sonar-scanner
ls -l /__w/OpenShadingLanguage/OpenShadingLanguage/bw_output
echo "BUILD_OUTPUT_DIR is ${BUILD_WRAPPER_OUT_DIR}"
find . -name "*.gcov" -print
# sonar-scanner --define sonar.cfamily.build-wrapper-output="${BUILD_WRAPPER_OUT_DIR}"
time sonar-scanner --define sonar.host.url="${SONAR_SERVER_URL}" --define sonar.cfamily.build-wrapper-output="$BUILD_WRAPPER_OUT_DIR" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
- name: Check ABI
if: inputs.abi_check != ''
shell: bash
run: |
src/build-scripts/ci-abicheck.bash ./build abi_standard/build \
liboslexec liboslcomp liboslquery liboslnoise
- name: Build Docs
if: inputs.build_docs == '1'
shell: bash
run: |
cd src/doc
time make doxygen
time make sphinx
- name: Upload testsuite debugging artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ inputs.old_node != '1' && (failure() || inputs.build_docs == '1' || inputs.benchmark == '1' || inputs.abi_check != '') }}
with:
name: osl-${{github.job}}-${{inputs.nametag}}
path: |
build/cmake-save
build/compat_reports
build/sphinx
build/benchmarks
build/*.cmake
build/CMake*
build/testsuite/*/*.*
${{ inputs.extra_artifacts }}
- name: Upload testsuite debugging artifacts-OLD
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
if: ${{ inputs.old_node == '1' && (failure() || inputs.build_docs == '1' || inputs.benchmark == '1' || inputs.abi_check != '') }}
with:
name: osl-${{github.job}}-${{inputs.nametag}}
path: |
build/cmake-save
build/compat_reports
build/sphinx
build/benchmarks
build/*.cmake
build/CMake*
build/testsuite/*/*.*
${{ inputs.extra_artifacts }}
+584 -325
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# GitHub Actions workflow file for CI
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
@@ -10,344 +10,603 @@ name: CI
on:
push:
# Skip jobs when only documentation files are changed
paths-ignore:
- '**.md'
- '**.rst'
- '**.tex'
paths:
- '**'
- '!**.md'
- '!**.rst'
- '!**.tex'
- '!**/analysis.yml'
- '!**/docs.yml'
- '!**.properties'
- '!docs/**'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
- '**.tex'
paths:
- '**'
- '!**.md'
- '!**.rst'
- '!**.tex'
- '!docs/**'
schedule:
# Full nightly build
- cron: "0 4 * * *"
# Full nightly build, for the main project repo (not for forks)
- cron: "0 6 * * *"
workflow_dispatch:
# This allows manual triggering of the workflow from the web
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
vfxplatform-2019:
name: "Linux VFXP-2019: gcc6 C++11 llvm7 py2.7 boost-1.66 exr-2.3 OIIO-2.0 sse2"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 11
PYTHON_VERSION: 2.7
USE_PYTHON: 0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
vfxplatform-2020:
name: "Linux VFXP-2020 gcc6/C++14 llvm7 py3.7 boost-1.70 exr-2.4 OIIO-2.1 sse4"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2020
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_SIMD: sse4.2
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
aswf-old:
if: ${{ (github.event.repository.fork == false || github.event_name != 'schedule') && ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') && ! contains(github.ref, 'optix-only') }}
name: "(old) ${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
nametag: ${{ matrix.nametag || 'unnamed!' }}
disable: ${{ matrix.disable || false }}
runner: ${{ matrix.runner || 'ubuntu-latest' }}
container: ${{ matrix.container }}
container_volumes: '["/node20217:/node20217:rw,rshared", "/node20217:/__e/node20:ro,rshared]"]'
cc_compiler: ${{ matrix.cc_compiler || 'gcc' }}
cxx_compiler: ${{ matrix.cxx_compiler || 'g++' }}
cxx_std: ${{ matrix.cxx_std || '17' }}
build_type: ${{ matrix.build_type || 'Release' }}
depcmds: ${{ matrix.depcmds }}
extra_artifacts: ${{ matrix.extra_artifacts }}
fmt_ver: ${{ matrix.fmt_ver }}
fmt_commit: ${{ matrix.fmt_commit }}
opencolorio_ver: ${{ matrix.opencolorio_ver }}
openexr_ver: ${{ matrix.openexr_ver }}
openimageio_ver: ${{ matrix.openimageio_ver }}
pybind11_ver: ${{ matrix.pybind11_ver }}
python_ver: ${{ matrix.python_ver }}
setenvs: ${{ matrix.setenvs }}
simd: ${{ matrix.simd }}
batched: ${{ matrix.batched }}
skip_build: ${{ matrix.skip_build }}
skip_tests: ${{ matrix.skip_tests }}
abi_check: ${{ matrix.abi_check }}
build_docs: ${{ matrix.build_docs }}
generator: ${{ matrix.generator }}
ctest_args: ${{ matrix.ctest_args }}
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
old_node: ${{ matrix.old_node || 0 }}
llvm_action_ver: ${{ matrix.llvm_action_ver }}
clang_format: ${{ matrix.clang_format }}
strategy:
fail-fast: false
matrix:
include:
- desc: VP2022 gcc9/C++17 llvm14 py3.9 exr3.1 oiio3.0 sse2 batch-b4sse2
nametag: linux-vfx2022
runner: ubuntu-latest
container: aswf/ci-osl:2022-clang14
vfxyear: 2022
old_node: 1
cxx_std: 17
opencolorio_ver: v2.2.0
openimageio_ver: dev-3.0
python_ver: 3.9
pybind11_ver: v2.9.0
simd: sse2
- desc: VP2022 clang14/C++17 llvm14 oiio-3.0 py3.9 avx2 batch-avx512
nametag: linux-vfx2022-clang-llvm14-batch
runner: ubuntu-latest
container: aswf/ci-osl:2022-clang14
vfxyear: 2022
old_node: 1
cxx_std: 17
opencolorio_ver: v2.2.1
openimageio_ver: v3.0.11.0
python_ver: 3.9
pybind11_ver: v2.9.0
simd: avx2,f16c
batched: b4_SSE2,b8_AVX2,b8_AVX512,b16_AVX512
setenvs: USE_OPENVDB=0
- desc: VP2022 oldest everything gcc9/C++17 llvm14 py3.9 oiio3.0 no-simd
nametag: linux-oldest
runner: ubuntu-latest
container: aswf/ci-osl:2022-clang14
vfxyear: 2022
old_node: 1
cxx_std: 17
openexr_ver: v3.1.0
openimageio_ver: v3.0.0.3
python_ver: 3.9
pybind11_ver: v2.7.0
# simd: 0
setenvs: export PUGIXML_VERSION=v1.8
CMAKE_VERSION=3.19.0
ENABLE_OPENVDB=0
vfxplatform-2021:
name: "Linux VFXP-2021 gcc9/C++17 llvm10 py3.7 boost-1.70 exr-2.5 OIIO-2.2 avx2"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2021
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
OPENEXR_VERSION: 2.5.0
OPENIMAGEIO_BRANCH: RB-2.2
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux-debug-gcc7-llvm8:
name: "Linux Debug gcc7, C++14, llvm8, OIIO release, sse4, exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-7
USE_CPP: 14
CMAKE_CXX_STANDARD: 14
LLVM_VERSION: 8.0.0
OPENEXR_VERSION: 2.4.0
OPENIMAGEIO_BRANCH: release
USE_SIMD: sse4.2
MY_CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Debug
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
linux:
if: ${{ (github.event.repository.fork == false || github.event_name != 'schedule') && ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') && ! contains(github.ref, 'optix-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
nametag: ${{ matrix.nametag || 'unnamed!' }}
disable: ${{ matrix.disable || false }}
runner: ${{ matrix.runner || 'ubuntu-latest' }}
container: ${{ matrix.container }}
cc_compiler: ${{ matrix.cc_compiler || 'gcc' }}
cxx_compiler: ${{ matrix.cxx_compiler || 'g++' }}
cxx_std: ${{ matrix.cxx_std || '17' }}
build_type: ${{ matrix.build_type || 'Release' }}
depcmds: ${{ matrix.depcmds }}
extra_artifacts: ${{ matrix.extra_artifacts }}
fmt_ver: ${{ matrix.fmt_ver }}
fmt_commit: ${{ matrix.fmt_commit }}
opencolorio_ver: ${{ matrix.opencolorio_ver }}
openexr_ver: ${{ matrix.openexr_ver }}
openimageio_ver: ${{ matrix.openimageio_ver }}
pybind11_ver: ${{ matrix.pybind11_ver }}
python_ver: ${{ matrix.python_ver }}
setenvs: ${{ matrix.setenvs }}
simd: ${{ matrix.simd }}
batched: ${{ matrix.batched }}
skip_build: ${{ matrix.skip_build }}
skip_tests: ${{ matrix.skip_tests }}
abi_check: ${{ matrix.abi_check }}
build_docs: ${{ matrix.build_docs }}
generator: ${{ matrix.generator }}
ctest_args: ${{ matrix.ctest_args }}
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
llvm_action_ver: ${{ matrix.llvm_action_ver }}
clang_format: ${{ matrix.clang_format }}
strategy:
fail-fast: false
matrix:
include:
- desc: VP2023 gcc11/C++17 llvm15 py3.10 oiio-3.0 avx2
nametag: linux-vfx2023
runner: ubuntu-latest
container: aswf/ci-osl:2023-clang15.2
cxx_std: 17
openimageio_ver: v3.0.11.0
python_ver: "3.10"
pybind11_ver: v2.9.0
simd: avx2,f16c
batched: b8_AVX2
- desc: VP2024 gcc11/C++17 llvm17 py3.11 oiio-3.0 avx2
nametag: linux-vfx2024
runner: ubuntu-latest
container: aswf/ci-osl:2024-clang17
cxx_std: 17
openimageio_ver: v3.0.11.0
python_ver: "3.11"
pybind11_ver: v2.11.1
simd: avx2,f16c
batched: b8_AVX2
setenvs: export REMOVE_INSTALLED_OPENIMAGEIO=1
- desc: VP2025 gcc11/C++17 llvm18 py3.11 oiio-3.0 avx2
nametag: linux-vfx2025
runner: ubuntu-latest
container: aswf/ci-osl:2025-clang18
cxx_std: 17
python_ver: "3.11"
simd: avx2,f16c
batched: b8_AVX2
setenvs: export CTEST_EXCLUSIONS="broken|python-oslquery"
# ^^ exclude python-oslquery test until the ASWF container properly
# includes OIIO's python bindings, then we can remove that.
- desc: VP2026 gcc14/C++20 llvm20 py3.13 oiio-3.1 avx2
nametag: linux-vfx2026
runner: ubuntu-latest
container: aswf/ci-osl:2026-clang20
cxx_std: 20
python_ver: "3.13"
simd: avx2,f16c
batched: b8_AVX2
setenvs: export CTEST_EXCLUSIONS="broken|python-oslquery"
# ^^ exclude python-oslquery test until the ASWF container properly
# includes OIIO's python bindings, then we can remove that.
# Address and leak sanitizers (debug build)
- desc: sanitizers
nametag: sanitizer
runner: ubuntu-latest
container: aswf/ci-osl:2024-clang17
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 17
openimageio_ver: main
python_ver: "3.11"
pybind11_ver: v2.11.1
simd: avx2,f16c
batched: b8_AVX2
setenvs: export OSL_CMAKE_FLAGS="-DSANITIZE=address -DOSL_TEST_BIG_TIMEOUT=1200"
CMAKE_BUILD_TYPE=Debug
CTEST_TEST_TIMEOUT=1200
CTEST_EXCLUSIONS="broken|noise-reg.regress|noise-gabor-reg.regress|example-.*deformer|spline-reg.regress.batched|osl-imageio"
OSL_OPTIONS=llvm_debugging_symbols=1
TESTRENDER_AA=1
OSL_TESTSUITE_SKIP_DIFF=1
REMOVE_INSTALLED_OPENIMAGEIO=1
# Sanitizer notes:
# - There are a handful of tests we disable entirely with
# CTEST_EXCLUSIONS because they are irrelevant or just cannot be
# made to be clean (and that's ok).
# - Tests with sanitizers run slow, so we increase timeouts, and
# also set AA to 1 for render tests to speed them up.
# OSL_TESTSUITE_SKIP_DIFF prevents making the AA=1 image result
# fail, but that's ok because every other CI test is checking
# the results; here we have no reason to believe results will
# differ from other tests, we just need to run with sanitizers
# turned on.
# - In testing.cmake, we rig texture tests to disable the leak
# sanitizer, because we can't eliminate some completely benign
# leaks from the texture system, and because they are called
# from JITed code, we don't get a clean stack trace of things
# that happen in OIIO and therefore we just can't enumerate the
# allowed exceptions. So we trust that OIIO itself tests the
# texture system adequately and is able to ignore the benign
# "leaks."
linux-2020ish-clang9-llvm9:
name: "Linux clang9, C++14, llvm9, oiio release, avx, exr2.4, avx"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
USE_CPP: 14
CMAKE_CXX_STANDARD: 14
LLVM_VERSION: 9.0.0
USE_SIMD: avx
OPENEXR_VERSION: 2.4.0
OPENIMAGEIO_BRANCH: release
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
# Test ABI stability. `abi_check` is the version or commit that we
# believe is the current standard against which we don't want to
# break the ABI. Basically, we will build that version as well as
# the current one, and compare the resulting libraries.
- desc: abi check
nametag: linux-abi
runner: ubuntu-latest
container: aswf/ci-osl:2025-clang18
cc_compiler: gcc
cxx_compiler: g++
cxx_std: 17
openimageio_ver: release
python_ver: "3.11"
simd: "avx2,f16c"
batched: b8_AVX2
fmt_ver: 10.1.1
pybind11_ver: v2.10.0
skip_tests: 1
abi_check: 6ab45815c49e6f4793769c29ba64b8ef0880adaf
setenvs: export OSL_CMAKE_FLAGS="-DOSL_BUILD_TESTS=0 -DBUILD_TESTING=OFF -DUSE_QT=0"
OPENIMAGEIO_CMAKE_FLAGS="-DUSE_PYTHON=0"
CMAKE_BUILD_TYPE=RelWithDebInfo
OpenImageIO_DEPENDENCY_BUILD_ALLOW_UNVERIFIED_TAGS=ON
linux-2021ish-gcc8-llvm10:
name: "Linux gcc8, C++17, llvm10, oiio master, avx2, exr2.5, avx2"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-8
CMAKE_CXX_STANDARD: 17
LLVM_VERSION: 10.0.0
USE_SIMD: avx2,f16c
OPENEXR_VERSION: 2.5.0
OPENIMAGEIO_BRANCH: master
OPENIMAGEIO_CMAKE_FLAGS: -DBUILD_FMT_VERSION=7.0.1
PYBIND11_VERSION: 2.5.0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
- desc: icx/C++17 llvm14 py3.10 oiio-3.0 avx2
nametag: linux-icx
runner: ubuntu-latest
# If we ever need the big runner:
# runner: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-22.04-8c-32g-300h') || 'ubuntu-latest' }}
# disable: ${{ github.repository_owner != 'AcademySoftwareFoundation' }}
container: aswf/ci-osl:2023-clang15.2
cc_compiler: icx
cxx_compiler: icpx
cxx_std: 17
fmt_ver: 7.1.3
opencolorio_ver: v2.3.2
openimageio_ver: v3.0.15.0
python_ver: "3.10"
pybind11_ver: v2.10.0
simd: avx2,f16c
batched: b8_AVX2_noFMA
setenvs: export OSL_CMAKE_FLAGS="-DSTOP_ON_WARNING=OFF"
USE_OPENVDB=0
OPENCOLORIO_CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++"
linux-bleeding-edge:
# Test against development master for relevant dependencies, latest
# supported releases of everything else.
name: "Linux bleeding edge: gcc10, C++17, llvm10, oiio/ocio/exr/pybind-master, avx2"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-10
USE_CPP: 17
CMAKE_CXX_STANDARD: 17
LLVM_VERSION: 10.0.0
USE_SIMD: avx2,f16c
OPENEXR_BRANCH: master
OPENIMAGEIO_BRANCH: master
OPENIMAGEIO_CMAKE_FLAGS: -DBUILD_FMT_VERSION=master
OCIO_BRANCH: master
PYBIND11_BRANCH: master
OSL_BUILD_MATERIALX: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
- desc: Debug gcc9/C++17 llvm14 py3.10 oiio3.0 exr3.1 sse4
nametag: linux-debug-gcc9-llvm14
runner: ubuntu-22.04
cxx_compiler: g++-9
cxx_std: 17
openexr_ver: v3.1.11
openimageio_ver: v3.0.0.3
pybind11_ver: v2.7.0
python_ver: "3.10"
simd: sse4.2
setenvs: export CMAKE_BUILD_TYPE=Debug
LLVM_VERSION=14.0.0 LLVM_DISTRO_NAME=ubuntu-18.04
PUGIXML_VERSION=v1.9
CTEST_TEST_TIMEOUT=1800
OSL_CMAKE_FLAGS="-DOSL_TEST_BIG_TIMEOUT=1200"
- desc: latest releases gcc13/C++17 llvm20 oiio-rel exr3.4 py3.12 avx2 batch-b16avx512
nametag: linux-latest-releases
runner: ubuntu-24.04
cc_compiler: gcc-14
cxx_compiler: g++-14
cxx_std: 17
fmt_ver: 12.1.0
opencolorio_ver: v2.5.0
openexr_ver: v3.4.2
openimageio_ver: release
pybind11_ver: v3.0.1
python_ver: "3.12"
llvm_action_ver: "18.1.7"
simd: avx2,f16c
batched: b8_AVX2,b8_AVX512,b16_AVX512
setenvs: export LIBTIFF_VERSION=v4.7.1
PTEX_VERSION=v2.4.3
PUGIXML_VERSION=v1.15
FREETYPE_VERSION=VER-2-14-3
- desc: latest releases clang18/C++17 llvm18 oiio-rel exr3.4 py3.12 avx2 batch-b16avx512
nametag: linux-latest-releases
runner: ubuntu-24.04
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 17
fmt_ver: 12.1.0
opencolorio_ver: v2.5.0
openexr_ver: v3.4.2
openimageio_ver: release
pybind11_ver: v3.0.1
python_ver: "3.12"
llvm_action_ver: "18.1.7"
simd: avx2,f16c
batched: b8_AVX2,b8_AVX512,b16_AVX512
setenvs: export LIBTIFF_VERSION=v4.7.1
PTEX_VERSION=v2.4.3
PUGIXML_VERSION=v1.15
FREETYPE_VERSION=VER-2-14-3
- desc: bleeding edge gcc14/C++17 llvm17 oiio/ocio/exr/pybind-main py3.12 avx2 batch-b16avx512
nametag: linux-bleeding-edge
runner: ubuntu-24.04
cc_compiler: gcc-14
cxx_compiler: g++-14
cxx_std: 20
fmt_ver: main
opencolorio_ver: main
openexr_ver: main
openimageio_ver: main
# pybind11_ver: v3.0.1
pybind11_ver: master
python_ver: "3.12"
llvm_action_ver: "18.1.7"
simd: avx2,f16c
batched: b8_AVX2,b8_AVX512,b16_AVX512
setenvs: export PUGIXML_VERSION=master
PTEX_VERSION=v2.4.3
PUGIXML_VERSION=v1.15
FREETYPE_VERSION=VER-2-14-3
OpenImageIO_DEPENDENCY_BUILD_ALLOW_UNVERIFIED_TAGS=ON
- desc: clang14/C++17 llvm14 py3.10 avx2 batch-b16avx512
nametag: linux-clang14
runner: ubuntu-22.04
cxx_compiler: clang++
cc_compiler: clang
cxx_std: 17
fmt_ver: 12.1.0
opencolorio_ver: v2.5.0
openexr_ver: v3.4.2
openimageio_ver: release
pybind11_ver: v3.0.1
python_ver: "3.10"
simd: avx2,f16c
batched: b8_AVX2,b8_AVX512,b16_AVX512
setenvs: export LLVM_VERSION=14.0.0
LLVM_DISTRO_NAME=ubuntu-18.04
PUGIXML_VERSION=v1.15
# Test formatting. This test entry doesn't do a full build, it
# just runs clang-format on everything, and passes if nothing is
# misformatted. Upon failure, the build artifact will be the full
# source code with the formatting fixed (diffs will also appear in
# the console output).
- desc: "clang-format"
nametag: clang-format
runner: ubuntu-24.04
cxx_std: 17
extra_artifacts: "src/*.*"
python_ver: "3.10"
pybind11_ver: "0"
skip_build: 1
skip_tests: 1
clang_format: 1
setenvs: export OPENIMAGEIO_CMAKE_FLAGS=-DUSE_PYTHON=0
USE_PYTHON=0 QT_VERSION=0 PUGIXML_VERSION=0
SKIP_APT_GET_UPDATE=0
SKIP_SYSTEM_DEPS_INSTALL=1
EXTRA_DEP_PACKAGES="clang-format-17"
CLANG_FORMAT_EXE=clang-format-17
linux-oldest:
# Oldest versions of the dependencies that we can muster, and various
# things disabled.
name: "Linux oldest everything: gcc6 C++11 llvm7 py2.7 boost-1.66 oiio-2.0 no-simd exr2.3"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 11
PYTHON_VERSION: 2.7
USE_SIMD: 0
USE_PYTHON: 0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
macos-py38:
name: "Mac py38"
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
USE_CPP: 14
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.8
LLVM_BC_GENERATOR: /usr/bin/clang++
MY_CMAKE_FLAGS: -DLLVM_BC_GENERATOR=/usr/bin/clang++
# ^^ Force bitcode compiles to use the system clang compiler by
# preemptively telling it the LLVM_BC_GENERATOR, to avoid some
# library mismatches we tend to see on GH CI's Mac images.
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/install_homebrew_deps.bash
OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0"
source src/build-scripts/build_openimageio.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: build/*/testsuite/*/*.*
macos:
if: ${{ (github.event.repository.fork == false || github.event_name != 'schedule') && ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'linux-only') && ! contains(github.ref, 'optix-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
nametag: ${{ matrix.nametag || 'unnamed!' }}
runner: ${{ matrix.runner }}
container: ${{ matrix.container }}
cc_compiler: ${{ matrix.cc_compiler || 'clang' }}
cxx_compiler: ${{ matrix.cxx_compiler || 'clang++' }}
cxx_std: ${{ matrix.cxx_std || '17' }}
batched: ${{ matrix.batched }}
build_type: ${{ matrix.build_type || 'Release' }}
depcmds: ${{ matrix.depcmds }}
extra_artifacts: ${{ matrix.extra_artifacts }}
fmt_ver: ${{ matrix.fmt_ver }}
fmt_commit: ${{ matrix.fmt_commit }}
opencolorio_ver: ${{ matrix.opencolorio_ver }}
openexr_ver: ${{ matrix.openexr_ver }}
openimageio_ver: ${{ matrix.openimageio_ver }}
pybind11_ver: ${{ matrix.pybind11_ver }}
python_ver: ${{ matrix.python_ver }}
setenvs: ${{ matrix.setenvs }}
simd: ${{ matrix.simd }}
skip_build: ${{ matrix.skip_build }}
skip_tests: ${{ matrix.skip_tests }}
abi_check: ${{ matrix.abi_check }}
build_docs: ${{ matrix.build_docs }}
generator: ${{ matrix.generator }}
ctest_args: ${{ matrix.ctest_args }}
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
strategy:
fail-fast: false
matrix:
include:
- desc: MacOS-15-Intel aclang17/C++17/py3.13 llvm18 oiio-release
runner: macos-15-intel
nametag: macos15
cc_compiler: /usr/bin/clang
cxx_compiler: /usr/bin/clang++
cxx_std: 17
openimageio_ver: dev-3.0
python_ver: "3.13"
ctest_test_timeout: 120
setenvs: export HOMEBREW_PREFIX=/usr/local
LLVMBREWVER="@18"
INSTALL_OPENVDB=0 INSTALL_QT=0
- desc: MacOS-14-ARM llvm19 oiio-release
runner: macos-14
nametag: macos14-arm
cc_compiler: /usr/bin/clang
cxx_compiler: /usr/bin/clang++
cxx_std: 17
openimageio_ver: main
python_ver: "3.13"
setenvs: export LLVMBREWVER="@19"
- desc: MacOS-15-ARM aclang16/C++17/py3.13 llvm21 oiio-main
runner: macos-15
nametag: macos15-arm
cc_compiler: /usr/bin/clang
cxx_compiler: /usr/bin/clang++
cxx_std: 17
python_ver: "3.13"
openimageio_ver: main
- desc: MacOS-26-ARM aclang16/C++17/py3.14 llvm21 oiio-main
runner: macos-26
nametag: macos26-arm
cc_compiler: /usr/bin/clang
cxx_compiler: /usr/bin/clang++
cxx_std: 17
python_ver: "3.14"
openimageio_ver: main
# windows:
# name: "Windows"
# runs-on: windows-2019
# steps:
# - uses: actions/checkout@v2
# - name: Setup Nuget.exe
# uses: warrenbuckley/Setup-Nuget@v1
# - name: all
# shell: bash
# env:
# PYTHON_VERSION: 3.6
# CMAKE_GENERATOR: "Visual Studio 16 2019"
# OPENEXR_VERSION: 2.4.0
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-win-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash
# - uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: ${{ github.job }}
# path: build/*/testsuite/*/*.*
# sanitizer:
# name: "Sanitizers"
# runs-on: ubuntu-18.04
# if: github.event_name == 'pull_request' || contains(github.ref, 'san') || contains(github.ref, 'RB') || contains(github.ref, 'release') || contains(github.ref, 'master') || contains(github.ref, 'gh')
# steps:
# - uses: actions/checkout@v2
# #- uses: docker://aswfstaging/ci-base:2019
# - name: all
# env:
# CXX: g++-7
# CMAKE_CXX_STANDARD: 14
# SANITIZE: address
# USE_PYTHON: 0
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash
# - uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: ${{ github.job }}
# path: build/*/testsuite/*/*.*
windows:
if: ${{ (github.event.repository.fork == false || github.event_name != 'schedule') && ! contains(github.ref, 'linux-only') && ! contains(github.ref, 'macos-only') && ! contains(github.ref, 'optix-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
nametag: ${{ matrix.nametag || 'unnamed!' }}
runner: ${{ matrix.runner }}
container: ${{ matrix.container }}
cc_compiler: ${{ matrix.cc_compiler }}
cxx_compiler: ${{ matrix.cxx_compiler }}
cxx_std: ${{ matrix.cxx_std || '17' }}
batched: ${{ matrix.batched }}
build_type: ${{ matrix.build_type || 'Release' }}
depcmds: ${{ matrix.depcmds }}
extra_artifacts: ${{ matrix.extra_artifacts }}
fmt_ver: ${{ matrix.fmt_ver }}
fmt_commit: ${{ matrix.fmt_commit }}
llvm_action_ver: ${{ matrix.llvm_action_ver }}
opencolorio_ver: ${{ matrix.opencolorio_ver }}
openexr_ver: ${{ matrix.openexr_ver }}
openimageio_ver: ${{ matrix.openimageio_ver }}
pybind11_ver: ${{ matrix.pybind11_ver }}
python_ver: ${{ matrix.python_ver }}
setenvs: ${{ matrix.setenvs }}
simd: ${{ matrix.simd }}
skip_build: ${{ matrix.skip_build }}
skip_tests: ${{ matrix.skip_tests }}
abi_check: ${{ matrix.abi_check }}
build_docs: ${{ matrix.build_docs }}
generator: ${{ matrix.generator }}
ctest_args: ${{ matrix.ctest_args }}
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
strategy:
fail-fast: false
matrix:
include:
#
# Windows 2022 / MSVS 17 case is below. It's not working yet,
# work in progress.
#
- desc: Windows-2022 VS2022 llvm20 oiio3.1
runner: windows-2022
nametag: windows-2022
generator: "Visual Studio 17 2022"
python_ver: "3.12"
opencolorio_ver: v2.3.2
openexr_ver: v3.3.2
openimageio_ver: release
skip_tests: 1
setenvs: export OSL_CMAKE_FLAGS="-DUSE_LLVM_BTCODE=ON"
PUGIXML_VERSION=v1.14
OpenImageIO_BUILD_MISSING_DEPS="Freetype;TIFF;libdeflate;libjpeg-turbo"
LLVM_GOOGLE_DRIVE_ID="1uy7PNVlTQ-H56unXGOS6siRWtNcdS1J7"
- desc: Windows-2025 VS2026
runner: windows-2025-vs2026
nametag: windows-2025-vs2026
generator: "Visual Studio 18 2026"
python_ver: "3.12"
opencolorio_ver: v2.5.1
openexr_ver: v3.4.5
openimageio_ver: release
skip_tests: 1
setenvs: export OSL_CMAKE_FLAGS="-DUSE_LLVM_BTCODE=ON"
PUGIXML_VERSION=v1.14
OpenImageIO_BUILD_MISSING_DEPS="Freetype;TIFF;libdeflate;libjpeg-turbo"
LLVM_GOOGLE_DRIVE_ID="1uy7PNVlTQ-H56unXGOS6siRWtNcdS1J7"
# linux-static:
# name: "Linux static libs: gcc7, C++14, exr2.3"
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v2
# #- uses: docker://aswfstaging/ci-base:2019
# - name: all
# env:
# CXX: g++-7
# CMAKE_CXX_STANDARD: 14
# BUILD_SHARED_LIBS: OFF
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash
# - uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: ${{ github.job }}
# path: build/*/testsuite/*/*.*
clang-format:
# Test formatting. This test entry doesn't do a full build, it just runs
# clang-format on everything, and passes if nothing is misformatted.
# Upon failure, the build artifact will be the full source code with the
# formatting fixed (diffs will also appear in the console output).
name: "clang-format verification"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2021
steps:
- uses: actions/checkout@v2
- name: all
env:
BUILDTARGET: clang-format
CMAKE_CXX_STANDARD: 17
PYTHON_VERSION: 3.7
SKIP_TESTS: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: src/*/*.{cpp,h}
optix-gpu:
if: ${{ (github.event.repository.fork == false || github.event_name != 'schedule') && ! contains(github.ref, 'windows-only') && ! contains(github.ref, 'macos-only') }}
name: "${{matrix.desc}}"
uses: ./.github/workflows/build-steps.yml
with:
nametag: ${{ matrix.nametag || 'unnamed!' }}
runner: ${{ matrix.runner || 'ubuntu-latest' }}
container: ${{ matrix.container }}
cc_compiler: ${{ matrix.cc_compiler || 'gcc' }}
cxx_compiler: ${{ matrix.cxx_compiler || 'g++' }}
cxx_std: ${{ matrix.cxx_std || '17' }}
build_type: ${{ matrix.build_type || 'Release' }}
depcmds: ${{ matrix.depcmds }}
extra_artifacts: ${{ matrix.extra_artifacts }}
fmt_ver: ${{ matrix.fmt_ver }}
fmt_commit: ${{ matrix.fmt_commit }}
opencolorio_ver: ${{ matrix.opencolorio_ver }}
openexr_ver: ${{ matrix.openexr_ver }}
openimageio_ver: ${{ matrix.openimageio_ver }}
pybind11_ver: ${{ matrix.pybind11_ver }}
python_ver: ${{ matrix.python_ver }}
setenvs: ${{ matrix.setenvs }}
simd: ${{ matrix.simd }}
batched: ${{ matrix.batched }}
skip_build: ${{ matrix.skip_build }}
skip_tests: ${{ matrix.skip_tests }}
abi_check: ${{ matrix.abi_check }}
build_docs: ${{ matrix.build_docs }}
generator: ${{ matrix.generator }}
ctest_args: ${{ matrix.ctest_args }}
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
llvm_action_ver: ${{ matrix.llvm_action_ver }}
clang_format: ${{ matrix.clang_format }}
strategy:
fail-fast: false
matrix:
include:
- desc: OptiX ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'GPU') || 'build only' }} VP2025 gcc11/C++17 llvm18 py3.11 oiio-rel avx2
# ^^ This will run on GPU when on the ASWF account, but is a
# "build only" test on user accounts. Similar conditionals below
# select the right runner type and whether tests are run.
nametag: linux-optix-vfx2025
runner: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-gpu-t4-4c-16g-176h') || 'ubuntu-latest' }}
container: aswf/ci-osl:2025-clang18
cxx_std: 17
python_ver: "3.11"
pybind11_ver: v2.11.1
simd: avx2,f16c
skip_tests: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && '0') || '1' }}
setenvs: export OSL_CMAKE_FLAGS="-DOSL_USE_OPTIX=1"
OPTIX_VERSION=8.0.0
CTEST_EXCLUSIONS="broken|render-microfacet|example-cuda|python-oslquery"
+26
View File
@@ -0,0 +1,26 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenshadingLanguage
name: Publish Release Notice to ASWF Slack
on:
release:
types:
- published
# published should cover both 'released' and 'prereleased'
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Notify Slack
id: slack
with:
project_name: "Open Shading Language"
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel: "#release-announcements"
project_logo: "https://artwork.aswf.io/projects/open-shading-language/icon/color/open-shading-language-icon-color.png"
uses: jmertic/slack-release-notifier@main
+67
View File
@@ -0,0 +1,67 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the Open Shading Language Project.
#
# Releases are signed via https://github.com/sigstore/sigstore-python.
# See https://docs.sigstore.dev for information about sigstore.
#
# This action creates a .tar.gz of the complete OSL source tree at
# the given release tag, signs it via sigstore, and uploads the
# .tar.gz and the associated .tar.gz.sigstore credential bundle.
#
# To verify a downloaded release at a given tag:
#
# % pip install sigstore
# % sigstore verify github --cert-identity https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/.github/workflows/release-sign.yml@refs/tags/<tag> OSL-<tag>.tar.gz
#
name: Sign Release
on:
release:
types: [published]
permissions:
contents: read
jobs:
release:
name: Sign & upload release artifacts
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name }}
permissions:
contents: write
id-token: write
repository-projects: write
steps:
- name: Set Prefix
# The tag name begins with a 'v', e.g. "v1.14.3", but the prefix
# should omit the 'v', so the tarball "OSL-1.14.3.tar.gz"
# extracts files into "OSL-v1.14.3/...". This matches
# the GitHub release page autogenerated artifact conventions.
run: |
echo OSL_PREFIX=OSL-${TAG//v}/ >> $GITHUB_ENV
echo OSL_TARBALL=OSL-${TAG//v}.tar.gz >> $GITHUB_ENV
shell: bash
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Create archive
run: git archive --format=tar.gz -o ${OSL_TARBALL} --prefix ${OSL_PREFIX} ${TAG}
- name: Sign archive with Sigstore
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0
with:
inputs: ${{ env.OSL_TARBALL }}
upload-signing-artifacts: false
release-signing-artifacts: false
- name: Upload release archive
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${TAG} ${OSL_TARBALL} ${OSL_TARBALL}.sigstore.json
+74
View File
@@ -0,0 +1,74 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
name: Scorecards supply-chain security
on:
# Only the default branch is supported.
branch_protection_rule:
schedule:
- cron: '44 20 * * 6'
push:
branches: [ "main", "scorecard" ]
paths-ignore:
- '**.md'
- '**.rst'
- '**.tex'
# Declare default permissions as read only.
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
analysis:
name: Scorecards analysis
if: github.event.repository.fork == false
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge. (Upcoming feature)
id-token: write
steps:
- name: "Checkout code"
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@3e15ea8318eee9b333819ec77a36aca8d39df13e # v1.1.1
with:
results_file: results.sarif
results_format: sarif
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26
with:
sarif_file: results.sarif
+12 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
dist
build
@@ -8,3 +8,14 @@ build
\#*\#
*.pyc
*.log
.vscode
.envrc
.DS_Store
# AI coding tool directories — generated locally by .agents/setup-agent
.claude/
.codex/
.cursor/
.opencode/
.github/copilot-instructions.md
/specs
+47
View File
@@ -0,0 +1,47 @@
# This file establishes email equivalences so we can resolve what look like
# multiple authors, but actually are the same author who has used multiple
# emails over the course of their involvement with the project.
#
# The format is any of the following:
# <CANONICAL-EMAIL> <alternate-email>
# CANONICAL-NAME <CANONICAL-EMAIL> <alternate-email>
# CANONICAL-NAME <CANONICAL-EMAIL> alternate-name <alternate-email>
#
# You can check for duplicates with this command:
# git shortlog -sne --all
# That command (and others) will use this file to collapse the duplicates.
#
# If you see any duplicates we don't account for here, or if you look at your
# own entry here and want a different name or email to be your canonical one
# (we may not have guessed correctly and matched your preferences), please
# file a PR with the edits to this file.
Adam Martinez <amartinez.cg@gmail.com> amartinez-cg <amartinez.cg@gmail.com>
Alejandro Conty <aconty@imageworks.com> aconty <aconty@gmail.com>
Alejandro Conty <aconty@imageworks.com> Alejandro Conty <aconty@gmail.com>
Alex M. Wells <alex.m.wells@intel.com> <alex.m.wells@intel.com>
Alex M. Wells <alex.m.wells@intel.com> <AlexMWells@users.noreply.github.com>
Alex M. Wells <alex.m.wells@intel.com> <awells-np@argon.sea.pixar.com>
Alexis Oblet <alob@mikrosimage.eu> Alexis Oblet <aoblet@users.noreply.github.com>
Brecht Van Lommel <brecht@blender.org> <brecht@solidangle.com>
Brecht Van Lommel <brecht@blender.org> Brecht Van Lommel <brechtvanlommel@gmail.com>
Chris Kulla <ckulla@gmail.com> <ckulla@imageworks.com>
Chris Kulla <ckulla@gmail.com> <fpsunflower@users.noreply.github.com>
Chris Kulla <ckulla@gmail.com> Christopher Kulla <ckulla@gmail.com>
Chris Kulla <ckulla@gmail.com> fpsunflower <ckulla@gmail.com>
Clifford Stein <cstein@imageworks.com> Cliff Stein <clifford.stein@gmail.com>
Clifford Stein <cstein@imageworks.com> cmstein <cstein@imageworks.com>
Declan Russell <declan.russell@autodesk.com> Declan Russell <i7709212@bournemouth.ac.uk>
Derek Haase <derekhaase@gmail.com> Derek Haase <dhaase@imageworks.com>
Esteban Tovagliari <ramenhdr@gmail.com> est77 <ramenhdr@gmail.com>
Henri Fousse <henri.fousse@free.fr> darkhorse64 <henri.fousse@free.fr>
Larry Gritz <lg@imageworks.com> <larrygritz@gmail.com>
Larry Gritz <lg@imageworks.com> <lg@larrygritz.com>
Roman Zulak <marsupial@users.noreply.github.com> <rzulak@imageworks.com>
Roman Zulak <marsupial@users.noreply.github.com> Frederich Munch <marsupial@users.noreply.github.com>
Roman Zulak <marsupial@users.noreply.github.com> marsupial <marsupial@users.noreply.github.com>
Ronan Keryell <Ronan.Keryell@amd.com> Ronan Keryell <Ronan.Keryell@silkan.com>
Steena Monteiro <steena.monteiro@intel.com> steena.monteiro <smonteir@ortce-sklaw.jf.intel.com>
Sven-Hendrik Haase <sh@lutzhaase.com> Sven-Hendrik Haase <svenstaro@gmail.com>
Tim Grant <tgrant@nvidia.com> Tim Grant <87798327+tgrant-nv@users.noreply.github.com>
Tim Grant <tgrant@nvidia.com> timgrant <timgrant@users.noreply.github.com>
+29
View File
@@ -0,0 +1,29 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# Build documentation with Sphinx
sphinx:
configuration: src/doc/conf.py
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
- htmlzip
# Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: src/doc/requirements.txt
-183
View File
@@ -1,183 +0,0 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# .travis.yml for OSL
language: cpp
osx_image: xcode10
dist: xenial
# Add-ons: specify apt packages for Linux
# We actaully specify packages per-matrix-entry, so these don't do anything
# except to tag them (&add-sources, &common-packages, &common-boost-packages)
# so they can be referened later ('*') to save repetition.
addons:
apt:
sources: &add-sources
- ubuntu-toolchain-r-test
packages: &common-packages
- libgif-dev
- libfreetype6-dev
- python-numpy
- ninja-build
- libfreetype6-dev
- libpugixml-dev
packages: &common-boost-packages
- libboost1.58-dev
- libboost-filesystem1.58
- libboost-regex1.58
- libboost-system1.58
- libboost-thread1.58
packages: &old-boost-packages
- libboost1.55-dev
- libboost-filesystem1.55
- libboost-regex1.55
- libboost-system1.55
- libboost-thread1.55
cache:
ccache: true
apt: true
directories:
- $HOME/.ccache
before_install:
- source src/build-scripts/ci-startup.bash
- export WHICHGCC=${WHICHGCC:="4.8"}
- if [ "$CXX" == "g++" ]; then export CXX="g++-${WHICHGCC}" ; fi
install:
- if [ $TRAVIS_OS_NAME == osx ] ; then source src/build-scripts/install_homebrew_deps.bash ; fi
- if [ "$BUILD_CMAKE" == "1" ] ; then source src/build-scripts/build_cmake.bash ; fi
- source src/build-scripts/build_llvm.bash ;
- if [ $TRAVIS_OS_NAME == linux ] ; then source src/build-scripts/build_pybind11.bash ; fi
- if [ $TRAVIS_OS_NAME == linux ] ; then CXX="ccache $CXX" source src/build-scripts/build_openexr.bash ; fi
# Note: can remove the ILMBASE_HOME/OPENEXR_HOME when OIIO 2.x is floor
- export OPENIMAGEIO_MAKEFLAGS="$OPENIMAGEIO_MAKEFLAGS -j2 DEBUG= USE_PYTHON=0 OIIO_BUILD_TESTS=0"
- export ENABLE_iinfo=0 ENABLE_iv=0 ENABLE_igrep=0 ENABLE_iconvert=0 ENABLE_testtex=0
- export ENABLE_cineon=0 ENABLE_DDS=0 ENABLE_DPX=0 ENABLE_FITS=0
- export ENABLE_iff=0 ENABLE_jpeg2000=0 ENABLE_PNM=0 ENABLE_PSD=0
- export ENABLE_RLA=0 ENABLE_SGI=0 ENABLE_SOCKET=0 ENABLE_SOFTIMAGE=0
- export ENABLE_TARGA=0 ENABLE_WEBP=0 ENABLE_TARGA=0
- export OPENIMAGEIO_SITE=travis
- export OPENIMAGEIO_INSTALLDIR=$HOME/ext/OpenImageIO/dist/$ARCH
- export OSL_SITE=travis
- source src/build-scripts/build_openimageio.bash
- if [ $TRAVIS_OS_NAME == linux ] ; then
export BUILD_FLAGS="$BUILD_FLAGS LLVM_STATIC=1" ;
export TEST_FLAGS="-E broken\|render-cornell\|render-oren-nayar\|render-veachmis\|render-ward" ;
fi
# ^^^ Linux only, can't make these test work. Exclude for now and return later. ;
# before_script:
script:
- export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$OSL_ROOT/lib:$LD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$OSL_ROOT/lib:$DYLD_LIBRARY_PATH
- source src/build-scripts/ci-build-and-test.bash
branches:
only:
- master
- /RB-/
- /lg-/
matrix:
fast_finish: true
include:
- name: "VFX Platform 2018 (gcc6, c++14), llvm 7, OIIO master, OpenEXR 2.3, avx/f16c"
os: linux
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-6
env: WHICHGCC=6 USE_CPP=14 LLVM_VERSION=7.0.1 OPENIMAGEIO_BRANCH=master OPENEXR_VERSION=2.3.0 USE_SIMD=avx,f16c BUILD_CMAKE=1
- name: "MacOS (latest Apple clang, llvm 7, OIIO master, latest homebrew libs"
os: osx
compiler: clang
env: PYTHON_VERSION=3.7 USE_CPP=14
- name: "VFX Platform 2017 (gcc48, c++11), llvm 7, OIIO release, OpenEXR 2.3, sse4.2"
os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *old-boost-packages
env: WHICHGCC=4.8 USE_CPP=11 LLVM_VERSION=7.0.1 USE_SIMD=sse4.2 OPENIMAGEIO_BRANCH=release OPENEXR_VERSION=2.3.0 BUILD_CMAKE=1
- name: "Older things: OIIO 2.0, llvm 7, boost 1.58, OpenEXR 2.2"
os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *old-boost-packages
env: WHICHGCC=4.8 USE_CPP=11 LLVM_VERSION=7.0.1 USE_SIMD=sse4.2 OPENIMAGEIO_BRANCH=RB-2.0 OPENEXR_VERSION=2.2.0 BUILD_CMAKE=1
if: branch =~ /(master|RB|travis)/ OR type = pull_request
- name: "gcc7, llvm7, C++14"
os: linux
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-7
env: WHICHGCC=7 USE_CPP=14 LLVM_VERSION=7.0.0 BUILD_CMAKE=1
if: branch =~ /(master|RB|travis)/ OR type = pull_request
- name: "Future: gcc8, C++14, LLVM 7, OIIO master, AVX/f16c"
os: linux
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-8
env: WHICHGCC=8 USE_CPP=14 LLVM_VERSION=7.0.0 USE_SIMD=avx,f16c BUILD_CMAKE=1
- name: "DEBUG build, LLVM 7, OIIO master"
os: linux
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *common-boost-packages
- g++-6
env: DEBUG=1 WHICHGCC=6 LLVM_VERSION=7.0.0 OPENIMAGEIO_BRANCH=master BUILD_CMAKE=1
- name: "Oldest everything: gcc4.8, LLVM 7, OIIO 2.0, OpenEXR 2.2, no simd"
os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *old-boost-packages
env: USE_SIMD=0 LLVM_VERSION=7.0.1 OPENIMAGEIO_BRANCH=RB-2.0 OPENEXR_VERSION=2.2.0 BUILD_CMAKE=1
if: branch =~ /(master|RB|travis)/ OR type = pull_request
notifications:
email:
# recipients:
# -
on_success: change
on_failure: always
+199
View File
@@ -0,0 +1,199 @@
# OSL Agent Guide
This file provides guidance to coding assistants when working with code in
this repository.
## Project Overview
Open Shading Language (OSL) is a production shading language for VFX/animation
renderers, maintained by the Academy Software Foundation. It compiles `.osl`
shader source to `.oso` bytecode, then JIT-compiles via LLVM to native code at
render time. C++17 codebase.
## Repo map
**Core libraries**
- `src/liboslcomp/` — Shader compiler. Flex/Bison lexer+parser → AST → `.oso`
bytecode. Entry point: `oslcomp.h`
- `src/liboslexec/` — Shader execution engine. Loads `.oso`, optimizes shader
groups, JIT-compiles to native via LLVM. Key files: `backendllvm.cpp`,
`llvm_gen.cpp`, `llvm_ops.cpp`, `instance.cpp`. Contains `wide/`
subdirectory for SIMD batched execution (SSE2/AVX/AVX-512)
- `src/liboslquery/` — Query compiled shader metadata and parameters
- `src/liboslnoise/` — Noise function implementations
- `src/libbsdl/` — BSDF/closure library
**Command line tools**
- `src/oslc/` — Compiler CLI (`oslc`)
- `src/oslinfo/` — Shader info query tool (`oslinfo`)
- `src/testshade/` — Test harness that executes shaders on rectangular arrays
of points, saves output as images.
- `src/testrender/` — Minimal path-tracing renderer demonstrating OSL
integration.
- `src/osltoy/` — Qt-based GUI shader editor (optional)
**Public APIs/headers**
Headers in `src/include/OSL/`: `oslexec.h`, `oslcomp.h`, `oslquery.h`, `rendererservices.h` (abstract interface renderers must implement).
Namespaces:
- `OSL` (outer), `OSL::pvt` (private implementation of internal-only utilities)
- Versioned inner namespace: `v{MAJOR}_{MINOR}`
## Build and verification
Common build commands via the Makefile convenience wrapper:
```bash
make # configure, build, install (Release)
make debug # debug build
make clean # wipe build dir (needed when switching branches/modes)
make clang-format # format all source files
make test # full testsuite
make test TEST=<pattern> # subset matching regex
```
Or directly with cmake:
```bash
cmake -B build -S .
cmake --build build --target install
ctest --test-dir build -R <pattern> --output-on-failure
```
By default, builds into `./build` and installs into `./dist`.
## Testsuite notes
- Test output lands in `build/testsuite/<testname>/`; references in
`testsuite/<testname>/ref/`
- Read `testsuite/TESTSUITE-README.md` before updating references or
diagnosing failures
- For platform-specific diffs, add a variant ref (e.g. `out-win.txt`) rather
than overwriting
- Be conservative loosening image diff thresholds — use the minimum needed
- Check uploaded CI artifacts before changing references when local
reproduction is unclear
## Code formatting and file conventions
- `clang-format` enforced (`.clang-format`); CI rejects non-conforming code —
run `make clang-format` before committing
- Lines ~80 cols; ASCII only in code and comments; `#pragma once` for headers
- New files: standard copyright + SPDX notice
- `CamelCase` classes, `snake_case` locals, `ALL_CAPS` macros, `m_foo` private
members
- 3 blank lines between free functions/classes; 1 between class methods; max 1
blank line inside a function body
- `//` for regular comments; `///` Doxygen for public API
- If a file has a strong local style, imitate that.
## C++ guidelines
- Error handling: prefer `bool` returns, explicit status propagation, and
`errorfmt()`-style reporting — not exceptions — consistent with the
surrounding subsystem
- Preserve API, ABI, and behavior compatibility unless the task explicitly
requires a break
- For hot paths: no hidden allocation in inner loops or parallel regions;
precompute outside hot paths
## OIIO utility types (prefer over raw C++ equivalents)
The [OpenImageIO](http://github.com/AcademySoftwareFoundation/OpenImageIO) (OIIO) project is a key dependency of OSL and the two projects are co-developed. Many utilities shared by both projects live in OpenImageIO.
Prefer C++17 `std` and Imath types except as noted below. Avoid introducing
new third-party dependencies without a strong reason. Rely liberally on these
classes and headers from OIIO:
- `OIIO::TypeDesc` - light-weight description of simple types (aliased
as `OSL::TypeDesc`)
- `OIIO::ustring` and `OIIO::ustringhash` - light-weight unique string heavily
used in OSL. (Aliased as `OSL::ustring` and `OSL::ustringhash`).
- `OIIO::string_view` — non-owning string/`char*` (like `std::string_view`).
Aliased as `OSL::string_view`.
- `OIIO::span` / `OIIO::cspan` — non-owning contiguous data (like
`std::span`); use instead of pointer+length pairs. Aliased as `OSL::span`
and `OSL::cspan`.
- `OpenImageIO/strutil.h` : string processing utilities
- `OIIO::Strutil::print()` , also aliased as `OSL::print` — string
formatting/output; **never** use `printf` or `<<` streams
- `OpenImageIO/fmath.h` — fast/safe math, avoids NaN/Inf
- `OIIO::Filesystem::*` in `OpenImageIO/filesystem.h` — file/directory
utilities
- `OpenImageIO/simd.h` — SIMD helpers
- `OpenImageIO/parallel.h` — parallel loops, etc.
- `OpenImageIO/unittest.h` — unit test macros
## Safe programming in C++
- Try to avoid passing raw pointers as function arguments.
- Use `std::unique_ptr` and `std::shared_ptr` rather than raw pointers when
ownership must be expressed.
- Prefer `OSL::string_view` when passing non-mutable strings or C-style
`char*` strings.
- Prefer `OSL::span` rather than passing raw pointers + a separate length, or
passing a raw pointer with an implied (but not explicitly passed) length.
`OSL::cspan` is a synonmym when the underlying data is const/non-mutable.
`OSL::span<std::byte>` or `OSL::cspan<std::byte>` can be used to represent
contiguous untyped data. These are our equivalent of C++ `std::span`.
- Use these guidelines always for new code, but do not churn existing code
just to "modernize" it.
## Architecture
### Compilation Pipeline
OSL source → (Flex/Bison) → AST → (liboslcomp) → `.oso` bytecode → (liboslexec) → LLVM IR → JIT native code
## Code Style
- clang-format config in `.clang-format` (WebKit-based, 80-char line limit, 4-space indent)
- Run `make clang-format` before submitting changes
## Key Dependencies
- **LLVM 14+** (JIT compilation), **OpenImageIO 2.5+** (textures, image I/O, utilities), **Imath 3.1+** (math types), **Flex/Bison** (parser generation), **pybind11** (Python bindings, optional)
## Commits and PRs
- Keep PRs narrow and easy to review.
- Prefix format: `type(subsystem): message` — subsystem is optional but helpful.
- Valid types: `fix:`, `feat:`, `perf:`, `api:`, `int:`, `build:`, `test:`,
`ci:`, `docs:`, `refactor:`, `style:`, `admin:`, `revert:`.
- Add a subsystem tag when it helps, e.g. `fix(exr):` or `perf(IBA):`.
- Write commit messages and PR descriptions that explain why the change is
needed, what behavior changes, and any non-obvious implementation choices.
## Spec-driven design
Feature specifications live in `docs/dev/specs/` (not at the project root).
When using speckit commands (`/speckit-specify`, `/speckit-plan`, etc.), always
use `docs/dev/specs/` as the base directory for all spec paths, overriding any
default of `specs/`. When creating a new spec, set `SPECIFY_FEATURE_DIRECTORY`
to `docs/dev/specs/<NNN-feature-name>` and write that path to
`.specify/feature.json`.
The speckit bash scripts expect a `specs/` directory at the project root. A
symlink satisfies this without committing speckit infrastructure to the repo.
This symlink is set up by the setup-agents script, and is not committed to
the repo. All saved specs live in `docs/dev/specs`.
## AI policy
Refer to `docs/dev/AI_Policy.md`.
See `docs/dev/AI_Policy.md`. Key rule: if AI assistance contributed materially
to a patch, the commit must include `Assisted-by: <TOOL> / <MODEL>`. The human
author is responsible for understanding, testing, and defending all changes.
## References
- `CONTRIBUTING.md` : general contribution guidelines and recap of coding
conventions.
-58
View File
@@ -1,58 +0,0 @@
Corporate Contributor License Agreement ("Agreement")
Thank you for your interest in the Open Shading Language Project a Series of
LF Projects, LLC (hereinafter "Project"). In order to clarify the
intellectual property licenses granted with Contributions from any corporate
entity to the Project, LF Projects, LLC ("LF Projects") is required to have
a Corporate Contributor License Agreement (CCLA) on file that has been
signed by each contributing corporation.
Each contributing corporation ("You") must accept and agree that, for any
Contribution (as defined below), You and all other individuals and entities
that control You, are controlled by You, or are under common control with
You, are bound by the licenses granted and representations made as though
all such individuals and entities are a single contributor. For the purposes
of this definition, "control" means (i) the power, direct or indirect, to
cause the direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"Contribution" means any code, documentation or other original work of
authorship that is submitted to LF Projects for inclusion in the Project by
Your employee or by any individual or entity that controls You, or is under
common control with You or is controlled by You and authorized to make the
submission on Your behalf.
You accept and agree that all of Your present and future Contributions to
the Project shall be:
Submitted under a Developer's Certificate of Origin v. 1.1 (DCO); and
Licensed under the BSD-3-Clause License.
You agree that You shall be bound by the terms of the BSD-3-Clause License
for all contributions made by You and Your employees. Your designated
employees are those listed by Your CLA Manager(s) on the system of record
for the Project. You agree to identify Your initial CLA Manager below and
thereafter maintain current CLA Manager records in the Project's system of
record.
Initial CLA Manager (Name and Email): ______________________________________
Corporate Signature:
Company Name: ____________________________________________
Signature: _______________________________________________
Name: _______________________________________________
Title _______________________________________________
Date: _______________________________________________
+149
View File
@@ -0,0 +1,149 @@
Project Name: Open Shading Language
Project Entity: Open Shading Language Project a Series of LF Projects, LLC
If emailing signed PDF, send to: manager@lfprojects.org
**Software Grant and Corporate Contributor License Agreement ("Agreement") v2.1**
Thank you for your interest in the project specified above (the “Project”). In
order to clarify the intellectual property license granted with Contributions
from any person or entity, the Project must have a Contributor License Agreement
(CLA) on file that has been signed by each Contributor, indicating agreement to
the license terms below. This license is for your protection as a Contributor as
well as the protection of the Project and its users; it does not change your
rights to use your own Contributions for any other purpose.
This version of the Agreement allows an entity (the “Corporation”) to submit
Contributions to the Project, to authorize Contributions submitted by its
designated employees to the Project, and to grant copyright and patent licenses
thereto.
If you have not already done so, please complete and sign this Agreement using
the electronic signature portal made available to you by the Project or its
third-party service providers, or email a PDF of the signed agreement to the
email address specified above. Please read this document carefully before
signing and keep a copy for your records.
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to the Project. In return, the Project shall not
use Your Contributions in a way that is contrary to the public benefit or
inconsistent with its charter at the time of the Contribution. Except for the
license granted herein to the Project and recipients of software distributed by
the Project, You reserve all right, title, and interest in and to Your
Contributions.
1. Definitions.
“You” (or “Your”) shall mean the copyright owner or legal entity authorized by
the copyright owner that is making this Agreement with the Project. For legal
entities, the entity making a Contribution and all other entities that
control, are controlled by, or are under common control with that entity are
considered to be a single Contributor. For the purposes of this definition,
“control” means (i) the power, direct or indirect, to cause the direction or
management of such entity, whether by contract or otherwise, or (ii) ownership
of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.
“Contribution” shall mean the code, documentation or other original works of
authorship, including any modifications or additions to an existing work, that
is intentionally submitted by You to the Project for inclusion in, or
documentation of, any of the products owned or managed by the Project (the
“Work”). For the purposes of this definition, “submitted” means any form
of electronic, verbal, or written communication sent to the Project or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, the Project for the purpose of discussing and
improving the Work, but excluding communication that is conspicuously marked
or otherwise designated in writing by You as “Not a Contribution.”
2. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare
derivative works of, publicly display, publicly perform, sublicense,
and distribute Your Contributions and such derivative works.
3. Grant of Patent License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and
otherwise transfer the Work, where such license applies only to
those patent claims licensable by You that are necessarily infringed
by Your Contribution(s) alone or by combination of Your
Contribution(s) with the Work to which such Contribution(s) were
submitted. If any entity institutes patent litigation against You or
any other entity (including a cross-claim or counterclaim in a
lawsuit) alleging that your Contribution, or the Work to which
you have contributed, constitutes direct or contributory patent
infringement, then any patent licenses granted to that entity under
this Agreement for that Contribution or Work shall terminate as of
the date such litigation is filed.
4. You represent that You are legally entitled to grant the above license. You
represent further that the employee of the Corporation designated as the Initial
CLA Manager below (and each who is designated in a subsequent written
modification to the list of CLA Managers) (each, a “CLA Manager”) is
authorized to maintain with the Project (1) the list of employees of the
Corporation who are authorized to submit Contributions on behalf of the
Corporation, and (2) the list of CLA Managers.
5. You represent that each of Your Contributions is Your original creation (see
section 7 for submissions on behalf of others).
6. You are not expected to provide support for Your Contributions, except to the
extent You desire to provide support. You may provide support for free, for a
fee, or not at all. Unless required by applicable law or agreed to in writing,
You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied, including, without
limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may
submit it to the Project separately from any Contribution, identifying the
complete details of its source and of any license or other restriction
(including, but not limited to, related patents, trademarks, and license
agreements) of which you are personally aware, and conspicuously marking the
work as “Submitted on behalf of a third-party: [named here]”.
8. It is your responsibility to notify the Project when any change is required
to the list of designated employees authorized to submit Contributions on behalf
of the Corporation, or to the list of the CLA Managers.
\[Please complete and sign on the next page.\]
::: {style="page-break-after: always; visibility: hidden"}
```{=tex}
\pagebreak
```
:::
Please sign:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ Date:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Signatory Name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Signatory E-mail:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Signatory Title:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Corporation Name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Corporation Address:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Initial CLA Manager Name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Initial CLA Manager E-Mail:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
-33
View File
@@ -1,33 +0,0 @@
Individual Contributor License Agreement ("Agreement")
Thank you for your interest in the Open Shading Language Project a Series of
LF Projects, LLC (hereinafter "Project"). In order to clarify the
intellectual property licenses granted with Contributions from any corporate
entity to the Project, LF Projects, LLC ("LF Projects") is required to have
an Individual Contributor License Agreement (ICLA) on file that has been
signed by each contributing individual. (For legal entities, please use the
Corporate Contributor License Agreement (CCLA).)
Each contributing individual ("You") must accept and agree that, for any
Contribution (as defined below), You are bound by the licenses granted and
representations made herein.
"Contribution" means any code, documentation or other original work of
authorship that is submitted to LF Projects for inclusion in the Project by
You or by another person authorized to make the submission on Your behalf.
You accept and agree that all of Your present and future Contributions to
the Project shall be:
Submitted under a Developer's Certificate of Origin v. 1.1 (DCO); and
Licensed under the BSD-3-Clause License.
Signature: __________________________________________
Name: _______________________________________________
Date: _______________________________________________
+137
View File
@@ -0,0 +1,137 @@
Project Name: Open Shading Language
Project Entity: Open Shading Language Project a Series of LF Projects, LLC
If emailing signed PDF, send to: manager@lfprojects.org
**Individual Contributor License Agreement ("Agreement") v2.1**
Thank you for your interest in the project specified above (the “Project”). In
order to clarify the intellectual property license granted with Contributions
from any person or entity, the Project must have a Contributor License Agreement
(CLA) on file that has been signed by each Contributor, indicating agreement to
the license terms below. This license is for your protection as a Contributor as
well as the protection of the Project and its users; it does not change your
rights to use your own Contributions for any other purpose.
If you have not already done so, please complete and sign this Agreement using
the electronic signature portal made available to you by the Project or its
third-party service providers, or email a PDF of the signed agreement to the
email address specified above. Please read this document carefully before
signing and keep a copy for your records.
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to the Project. In return, the Project shall not
use Your Contributions in a way that is contrary to the public benefit or
inconsistent with its charter at the time of the Contribution. Except for the
license granted herein to the Project and recipients of software distributed by
the Project, You reserve all right, title, and interest in and to Your
Contributions.
1. Definitions.
“You” (or “Your”) shall mean the copyright owner or legal entity authorized by
the copyright owner that is making this Agreement with the Project. For legal
entities, the entity making a Contribution and all other entities that control,
are controlled by, or are under common control with that entity are considered
to be a single Contributor. For the purposes of this definition, “control”
means (i) the power, direct or indirect, to cause the direction or management
of such entity, whether by contract or otherwise, or (ii) ownership of fifty
percent (50%) or more of the outstanding shares, or (iii) beneficial ownership
of such entity.
“Contribution” shall mean the code, documentation or other original works of
authorship, including any modifications or additions to an existing work, that
is intentionally submitted by You to the Project for inclusion in, or
documentation of, any of the products owned or managed by the Project (the
“Work”). For the purposes of this definition, “submitted” means any form of
electronic, verbal, or written communication sent to the Project or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that are
managed by, or on behalf of, the Project for the purpose of discussing and
improving the Work, but excluding communication that is conspicuously marked or
otherwise designated in writing by You as “Not a Contribution.”
2. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare
derivative works of, publicly display, publicly perform, sublicense,
and distribute Your Contributions and such derivative works.
3. Grant of Patent License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and
otherwise transfer the Work, where such license applies only to
those patent claims licensable by You that are necessarily infringed
by Your Contribution(s) alone or by combination of Your
Contribution(s) with the Work to which such Contribution(s) were
submitted. If any entity institutes patent litigation against You or
any other entity (including a cross-claim or counterclaim in a
lawsuit) alleging that your Contribution, or the Work to which
you have contributed, constitutes direct or contributory patent
infringement, then any patent licenses granted to that entity under
this Agreement for that Contribution or Work shall terminate as of
the date such litigation is filed.
4. You represent that you are legally entitled to grant the above license. If
your employer(s) has rights to intellectual property that you create that
includes your Contributions, you represent that you have received permission to
make Contributions on behalf of that employer, that your employer has waived
such rights for your Contributions to the Project, or that your employer has
executed a separate Corporate CLA with the Project.
5. You represent that each of Your Contributions is Your original creation (see
section 7 for submissions on behalf of others). You represent that Your
Contribution submissions include complete details of any third-party license or
other restriction (including, but not limited to, related patents and
trademarks) of which you are personally aware and which are associated with
any part of Your Contributions.
6. You are not expected to provide support for Your Contributions, except to the
extent You desire to provide support. You may provide support for free, for a
fee, or not at all. Unless required by applicable law or agreed to in writing,
You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied, including, without
limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may
submit it to the Project separately from any Contribution, identifying the
complete details of its source and of any license or other restriction
(including, but not limited to, related patents, trademarks, and license
agreements) of which you are personally aware, and conspicuously marking the
work as “Submitted on behalf of a third-party: [named here]”.
8. You agree to notify the Project of any facts or circumstances of which you
become aware that would make these representations inaccurate in any respect.
\[Please complete and sign on the next page.\]
::: {style="page-break-after: always; visibility: hidden"}
```{=tex}
\pagebreak
```
:::
Please sign:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Date: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Full name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Mailing Address:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
------------------------------------------------------------------------
------------------------------------------------------------------------
Country:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
E-Mail:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
-252
View File
@@ -1,252 +0,0 @@
# Technical Charter (the "Charter") for Open Shading Language a Series of LF Projects, LLC
This charter (the "Charter") sets forth the responsibilities and procedures
for technical contribution to, and oversight of, the Open Shading Language
project, which has been established as Open Shading Language a Series of LF
Projects, LLC (the "Project"). LF Projects, LLC ("LF Projects") is a
Delaware series limited liability company. All Contributors to the Project
must comply with the terms of this Charter.
### 1. Mission and Scope of the Project
* **a.** The mission of the Project is to develop an open source project
with the goals indicated in the "README" file within the Project's code
repository.
* **b.** The scope of the Project includes software development under an
OSI-approved open source license supporting the mission, including
documentation, testing, integration and the creation of other artifacts
that aid the development, deployment, operation or adoption of the open
source software project.
### 2. Technical Steering Committee
* **a.** The Technical Steering Committee (the "TSC") will be responsible
for all technical oversight of the open source Project.
* **b.** The TSC voting members are initially the Project's Committers. At
the inception of the project, the Committers of the Project will be as
set forth within the "GOVERNANCE" file within the Project's code
repository. The TSC may choose an alternative approach for determining
the voting members of the TSC, and any such alternative approach will be
documented in the GOVERNANCE file. Any meetings of the Technical
Steering Committee are intended to be open to the public, and can be
conducted electronically, via teleconference, or in person.
* **c.** TSC projects generally will involve Contributors and Committers.
The TSC may adopt or modify roles so long as the roles are documented in
the GOVERNANCE file. Unless otherwise documented:
- **i.** Contributors include anyone in the technical community that
contributes code, documentation, or other technical artifacts to the
Project;
- **ii.** Committers are Contributors who have earned the ability to
modify ("commit") source code, documentation or other technical
artifacts in a project's repository; and
- **iii.** A Contributor may become a Committer by a majority approval
of the existing Committers or at the discretion of the TSC. A
Committer may be removed by a majority approval of the other existing
Committers, or at the discretion of the TSC.
* **d.** Participation in the Project through becoming a Contributor and
Committer is open to anyone so long as they abide by the terms of this
Charter.
* **e.** The TSC may (1) establish workflow procedures for the submission,
approval, and closure/archiving of projects, (2) set requirements for
the promotion of Contributors to Committer status, as applicable, and
(3) amend, adjust, refine and/or eliminate the roles of Contributors,
and Committers, and create new roles, and publicly document any TSC
roles, as it sees fit.
* **f.** The TSC may elect a TSC Chair, who will preside over meetings of
the TSC and will serve until his or her resignation or replacement by
the TSC. The TSC Chair, or any other TSC member so designated by the
TSC, will serve as the primary communication contact between the Project
and the Academy Software Foundation Fund of The Linux Foundation.
* **g.** Responsibilities: The TSC will be responsible for all aspects of
oversight relating to the Project, which may include:
- **i.** coordinating the technical direction of the Project;
- **ii.** approving project or system proposals (including, but not
limited to, incubation, deprecation, and changes to a sub-project's
scope);
- **iii.** organizing sub-projects and removing projects;
- **iv.** creating sub-committees or working groups to focus on
cross-project technical issues and requirements;
- **v.** appointing representatives to work with other open source or
open standards communities;
- **vi.** establishing community norms, workflows, issuing releases, and
security issue reporting policies;
- **vii.** approving and implementing policies and processes for
contributing (to be published in the CONTRIBUTING file) and
coordinating with the Series Manager to resolve matters or concerns
that may arise as set forth in Section 7 of this Charter;
- **viii.** discussions, seeking consensus, and where necessary, voting
on technical matters relating to the code base that affect multiple
projects; and
- **ix.** coordinating any marketing, events, or communications
regarding the Project with the LF Projects Manager or their designee.
### 3. TSC Voting
* **a.** While the Project aims to operate as a consensus based community,
if any TSC decision requires a vote to move the Project forward, the
voting members of the TSC will vote on a one vote per voting member
basis.
* **b.** At least fifty percent of all voting members of the TSC must be
present at a TSC meeting in order to establish a quorum. The TSC may
continue to meet if a quorum is not met, but will be prevented from
making any decisions at such meeting.
* **c.** Except as provided in Section 7.c. and 8.a, decisions by vote at
a meeting require a majority vote of those in attendance, provided
quorum is met. Decisions made by electronic vote without a meeting
require a majority vote of all voting members of the TSC.
* **d.** In the event a vote cannot be resolved by the TSC, any voting
member of the TSC may refer the matter to the Series Manager or its
designee for assistance in reaching a resolution.
### 4. Compliance with Policies
* **a.** This Charter is subject to the Series Agreement for the Project
and the Operating Agreement of LF Projects. Contributors will comply
with the policies of LF Projects as may be adopted and amended by LF
Projects, including, without limitation the policies listed at
https://lfprojects.org/policies/.
* **b.** The TSC may adopt a code of conduct ("CoC") for the Project,
which is subject to approval by the Series Manager. Contributors to the
Project will comply with the CoC or, in the event that a
Project-specific CoC has not been approved, the LF Projects Code of
Conduct listed at https://lfprojects.org/policies/.
* **c.** When amending or adopting any policy applicable to the Project,
LF Projects will publish such policy, as to be amended or adopted, on
its web site at least 30 days prior to such policy taking effect;
provided, however, that in the case of any amendment of the Trademark
Policy or Terms of Use of LF Projects, any such amendment is effective
upon publication on LF Project's web site.
* **d.** All participants must allow open participation from any
individual or organization meeting the requirements for contributing
under this Charter and any policies adopted for all participants by the
TSC, regardless of competitive interests. Put another way, the Project
community must not seek to exclude any participant based on any
criteria, requirement, or reason other than those that are reasonable
and applied on a non-discriminatory basis to all participants in the
Project community.
* **e.** The Project will operate in a transparent, open, collaborative,
and ethical manner at all times. The output of all Project discussions,
proposals, timelines, decisions, and status should be made open and
easily visible to all. Any potential violations of this requirement
should be reported immediately to the LF Projects Manager.
### 5. Community Assets
* **a.** LF Projects will hold title to all trade or service marks used by
the Project ("Project Trademarks"), whether based on common law or
registered rights. Project Trademarks will be transferred and assigned
to LF Projects to hold on behalf of the Project. Any use of any Project
Trademarks by participants in the Project will be in accordance with the
license from LF Projects and inure to the benefit of LF Projects.
* **b.** The Project shall, as permitted and in accordance with such
license from LF Projects, develop and own all Project GitHub and social
media accounts, and domain name registrations created by the Project
community.
* **c.** Under no circumstances will LF Projects be expected or required
to undertake any action on behalf of the Project that is inconsistent
with the tax-exempt status or purpose, as applicable, of LFP, Inc. or LF
Projects, LLC.
### 6. General Rules and Operations.
* **a.** The Project will:
- **i.** engage in the work of the project in a professional manner
consistent with maintaining a cohesive community, while also
maintaining the goodwill and esteem of LF Projects, LFP, Inc. and
other partner organizations in the open source software community; and
- **ii.** respect the rights of all trademark owners, including any
branding and trademark usage guidelines.
### 7. Intellectual Property Policy
* **a.** Participants acknowledge that the copyright in all new
contributions shall be retained by the copyright holder as independent
works of authorship and that no contributor or copyright holder will be
required to assign copyrights to the Project.
* **b.** Except as described in Section 7.c., all code contributions to
the Project are subject to the following:
- **i.** All new inbound code contributions to the Project must be made
using the BSD 3-Clause License (available here:
https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE)
(the "Project License").
- **ii.** All new inbound code contributions must:
o **a.** be made pursuant to a binding Project Contribution License
Agreement (the "CLA") available on the Project's web site; and
o **b.** be accompanied by a Developer Certificate of Origin
(http://developercertificate.org) sign-off in the source code system
that is submitted through a TSC-approved contribution process which
will bind the authorized contributor and, if not self-employed,
their employer to the applicable license;
- **iii.** All outbound code will be made available under the Project
License.
- **iv.** Documentation will be received and made available by the
Project under the Creative Commons Attribution 4.0 International
License (available at http://creativecommons.org/licenses/by/4.0/).
- **v.** The Project may seek to integrate and contribute back to other
open source projects ("Upstream Projects"). In such cases, the Project
will conform to all license requirements of the Upstream Projects,
including dependencies, leveraged by the Project. Upstream Project
code contributions not stored within the Project's main code
repository shall comply with the contribution process and license
terms for the applicable Upstream Project.
* **c.** If an alternative inbound or outbound license is required for
compliance with the license for a leveraged open source project or is
otherwise required to achieve the Project's mission, the Governing Board
of the Academy Software Foundation Fund of the Linux Foundation
("Governing Board"), or the Governing Board's representatives designated
for such purpose, may approve the use of an alternative license for
specific inbound or outbound contributions on an exception basis. Any
exceptions must be approved by a vote of the Governing Board and must be
limited in scope to what is required for such a purpose. To request an
exception, please describe the contribution, the alternative open source
license(s), and the justification for using an alternative open source
license for the Project.
* **d.** Contributed files should contain license information, such as
SPDX short form identifiers, indicating the open source license or
licenses pertaining to the file.
### 8. Amendments
* **a.** This charter may be amended by a two-thirds vote of the entire
TSC, subject to reasonable approval by LF Projects.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

+1 -1
View File
@@ -36,7 +36,7 @@ Additional attendees:
* Charter / legalities
- All the proposed documents are in this PR:
https://github.com/imageworks/OpenShadingLanguage/pull/1137
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1137
- **Action**: Everybody please look over the charter, etc., give a +1,
raise any objections or ask questions.
- **Action**: Look at the CLA, show to your legal depts if they care. It's
+20 -19
View File
@@ -4,27 +4,28 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- Existing Project Governance
- [X] Project License exists ( [LICENSE.md](../LICENSE.md) ) and is OSI-approved
- [X] Any third-party components/dependencies included are listed along with thier licenses ( [THIRD_PARTY.md](../THIRD_PARTY.md) )
- [X] Governamce defined, outlining community roles and how decsions are made ( [GOVERNANCE.md](../GOVERNANCE.md] )
- Closed by https://github.com/imageworks/OpenShadingLanguage/pull/1137
- [X] Any third-party components/dependencies included are listed along with their licenses ( [THIRD_PARTY.md](../THIRD_PARTY.md) )
- [X] Governance defined, outlining community roles and how decisions are made ( [GOVERNANCE.md](../GOVERNANCE.md) )
- Closed by https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1137
- [X] Contribution Policy defined ( [CONTRIBUTING.md](../CONTRIBUTING.md) )
- Closed by https://github.com/imageworks/OpenShadingLanguage/pull/1137
- Closed by https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1137
- [X] Code of Conduct defined ( existing or pull from [ASWF Sample Project](https://github.com/AcademySoftwareFoundation/aswf-sample-project/blob/master/CODE_OF_CONDUCT.md) )
- Closed by https://github.com/imageworks/OpenShadingLanguage/pull/1137
- [ ] Release methodology defined ( [release.md](process/release.md) )
- New Project Goverance
- Closed by https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1137
- [X] Release methodology defined ( [RELEASING.md](../docs/RELEASING.md) )
- Closed by https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1572
- New Project Governance
- [X] TSC members identified
- [X] First TSC meeting held
- [X] TSC meeting cadence set and added to project calendar
- [ ] CLA Approved ( if used ) ( [CCLA](ccla.md) and [ICLA](icla.md) )
- [X] CLA Approved ( if used ) ( [CCLA](CLA-corporate.md) and [ICLA](CLA-individual.md) )
- Project charter ( [charter.md](charter.md) )
- [X] Approved by TSC
- Closed by https://github.com/imageworks/OpenShadingLanguage/pull/1137
- [ ] Filed ( create pull request against [foundation repo](https://github.com/AcademySoftwareFoundation/foundation) )
- Closed by https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1137
- [X] Filed ( create pull request against [foundation repo](https://github.com/AcademySoftwareFoundation/foundation) )
- Current tools
- [X] Source Control ( https://github.com/imageworks/OpenShadingLanguage )
- [X] Issue/feature tracker ( https://github.com/imageworks/OpenShadingLanguage/issues )
- Collaboration tools
- [X] Source Control ( https://github.com/AcademySoftwareFoundation/OpenShadingLanguage )
- [X] Issue/feature tracker ( https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues )
- Collaboration tools
- [X] Mailing lists (old: http://groups.google.com/group/osl-dev )
- [X] Move to groups.io ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new ) to setup/transfer
- [X] Slack or IRC ( #openshadinglanguage )
@@ -36,18 +37,18 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- Project assets
- [X] Domain name
- [X] Logo(s) ( https://github.com/AcademySoftwareFoundation/artwork/blob/master/examples/incubating.md#open-shading-language-logos )
- [ ] Trademarks/mark ownership rights ( John to follow up with Larry on this )
- [X] Trademarks/mark ownership rights
- Outreach
- [X] New project annoucement done ( https://www.aswf.io/osl-joins-aswf/ )
- [X] New project announcement done ( https://www.aswf.io/osl-joins-aswf/ )
- [X] Project added to ASWF website and ASWF landscape
- Graduation
- [ ] CII Badge achieved
- [X] OpenSSF Best Practices Badge achieved
- [ ] Committer Diversity established
- [ ] Commit/Contribution growth during incubation
- [ ] Committers defined in the project ( [COMMITTERS.csv](COMMITTERS.csv) or [COMMITTERS.yml](COMMITTERS.yml) )
- [X] TAC representative appointed
- Chris Kulla, TSC chair, is our TAC rep for the project
- [X] License scan completed and no issues found
- Minor issues were found but already fixed in PR https://github.com/imageworks/OpenShadingLanguage/pull/1145
- [ ] Code repository imported to ASWF GitHub organization
- [ ] Developer Certificate of Origin past commit signoff done and DCO Probot enabled.
- Minor issues were found but already fixed in PR https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1145
- [X] Code repository imported to ASWF GitHub organization
- [X] Developer Certificate of Origin post commit signoff done and DCO Probot enabled.
+1351 -56
View File
File diff suppressed because it is too large Load Diff
+157 -343
View File
@@ -1,25 +1,78 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
cmake_minimum_required (VERSION 3.12)
project (OSL VERSION 1.11.7.0
cmake_minimum_required (VERSION 3.19)
set (OSL_VERSION "1.16.0.0")
set (OSL_VERSION_OVERRIDE "" CACHE STRING
"Version override (use with caution)!")
mark_as_advanced (OSL_VERSION_OVERRIDE)
if (OSL_VERSION_OVERRIDE)
set (OSL_VERSION ${OSL_VERSION_OVERRIDE})
endif ()
project (OSL VERSION ${OSL_VERSION}
LANGUAGES CXX C
HOMEPAGE_URL "https://github.com/imageworks/OpenShadingLanguage")
HOMEPAGE_URL "https://github.com/AcademySoftwareFoundation/OpenShadingLanguage")
set (PROJ_NAME ${PROJECT_NAME}) # short name
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
set (PROJECT_VERSION_RELEASE_TYPE "dev") # "dev", "betaX", "RCY", ""
set (PROJECT_VERSION_RELEASE_TYPE "dev" CACHE STRING
"Build type, for example: dev, beta2, RC1 (empty string for normal release)")
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_AUTHORS "Contributors to the Open Shading Language project")
option (${PROJECT_NAME}_SUPPORTED_RELEASE
"Set ON for supported release branch, OFF for master" OFF)
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
set (${PROJECT_NAME}_DEV_RELEASE OFF)
else ()
set (${PROJECT_NAME}_DEV_RELEASE ON)
endif ()
message (STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake version is ${CMAKE_VERSION}")
# Set PROJECT_IS_TOP_LEVEL to ON if if this is the top level project (not
# if this is included as a subproject of something else). Note that this is
# handled automatically for CMake >= 3.21.
if (CMAKE_VERSION VERSION_LESS 3.21)
if ("${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}")
set (PROJECT_IS_TOP_LEVEL ON)
endif ()
endif ()
# Set up module path for our own cmake modules and add some esential ones
list (APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/src/cmake/modules"
"${PROJECT_SOURCE_DIR}/src/cmake")
# Utilities
include (colors)
include (set_utils)
include (check_is_enabled)
include (fancy_add_executable)
# If the user wants to use Conan to build dependencies, they will have done
# this prior to the cmake config:
# cd <build area>
# conan install <source area>
# and that will leave a conanbuildinfo.cmake in the build area for us.
if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include (${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message (STATUS "Using Conan for dependencies")
conan_basic_setup()
endif()
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
# If the user hasn't configured cmake with an explicit
# -DCMAKE_INSTALL_PREFIX=..., then set it to safely install into ./dist, to
# help prevent the user from accidentally writing over /usr/local or whatever.
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND PROJECT_IS_TOP_LEVEL)
set (CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/dist" CACHE PATH
"Installation location" FORCE)
endif()
message (STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake ${CMAKE_VERSION}")
message (STATUS "CMake system = ${CMAKE_SYSTEM}")
@@ -29,6 +82,7 @@ message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")
message (STATUS "Project install prefix = ${CMAKE_INSTALL_PREFIX}")
message (STATUS "Configuration types = ${CMAKE_CONFIGURATION_TYPES}")
message (STATUS "Build type = ${CMAKE_BUILD_TYPE}")
message (STATUS "Supported release = ${${PROJECT_NAME}_SUPPORTED_RELEASE}")
# Make the build area layout look a bit more like the final dist layout
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -39,7 +93,6 @@ if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()
option (CMAKE_USE_FOLDERS "Use the FOLDER target property to organize targets into folders." ON)
mark_as_advanced (CMAKE_USE_FOLDERS)
if (CMAKE_USE_FOLDERS)
@@ -57,11 +110,11 @@ include (GNUInstallDirs)
option (VERBOSE "Print lots of messages while compiling" OFF)
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING
"Customized outer namespace base name (version will be added)")
option (${PROJ_NAME}_NAMESPACE_INCLUDE_PATCH "Should the inner namespace include the patch number" OFF)
set (SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
CACHE STRING "Set the SO version in the SO name of the output library")
if (VERBOSE)
set (CMAKE_MESSAGE_LOG_LEVEL "VERBOSE" CACHE STRING "CMake log level to display")
else ()
set (CMAKE_MESSAGE_LOG_LEVEL "STATUS" CACHE STRING "CMake log level to display")
endif ()
set (OSL_LIBNAME_SUFFIX "" CACHE STRING
"Optional name appended to ${PROJECT_NAME} libraries that are built")
option (OSL_BUILD_TESTS "Build the unit tests, testshade, testrender" ON)
@@ -72,95 +125,136 @@ else ()
endif ()
option (OSL_BUILD_PLUGINS "Bool OSL plugins, for example OIIO plugin" ON)
option (OSL_BUILD_SHADERS "Build shaders" ON)
option (OSL_BUILD_MATERIALX "Build MaterialX shaders" OFF)
option (USE_OPTIX "Include OptiX support" OFF)
option (OSL_USE_OPTIX "Include OptiX support" OFF)
message(STATUS "OSL_USE_OPTIX: ${OSL_USE_OPTIX}")
set (OPTIX_EXTRA_LIBS CACHE STRING "Extra lib targets needed for OptiX")
set (CUDA_EXTRA_LIBS CACHE STRING "Extra lib targets needed for CUDA")
set (CUDA_TARGET_ARCH "sm_35" CACHE STRING "CUDA GPU architecture (e.g. sm_35)")
set (CUDA_TARGET_ARCH "sm_60" CACHE STRING "CUDA GPU architecture (e.g. sm_50)")
set (OSL_SHADER_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/shaders"
CACHE STRING "Directory where shaders will be installed")
set (OSL_PTX_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/ptx"
CACHE STRING "Directory where OptiX PTX files will be installed")
set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library naming postfix for Debug builds (e.g., '_debug')")
option (OSL_USTRINGREP_IS_HASH "Always use ustringhash for strings" OFF)
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
add_definitions ("-DOSL_NO_DEFAULT_TEXTURESYSTEM=1")
add_compile_definitions (OSL_NO_DEFAULT_TEXTURESYSTEM=1)
endif ()
option (USE_FAST_MATH "Use fast math approximations (if no, then use system math library)" ON)
if (USE_FAST_MATH)
add_definitions ("-DOSL_FAST_MATH=1")
add_compile_definitions (OSL_FAST_MATH=1)
else ()
add_definitions ("-DOSL_FAST_MATH=0")
add_compile_definitions (OSL_FAST_MATH=0)
endif ()
option (OIIO_FMATH_SIMD_FRIENDLY "Make sure OIIO fmath functions are SIMD-friendly" OFF)
if (OIIO_FMATH_SIMD_FRIENDLY)
add_definitions (-DOIIO_FMATH_SIMD_FRIENDLY=1)
add_compile_definitions (OIIO_FMATH_SIMD_FRIENDLY=1)
endif ()
if (USE_OPTIX)
add_definitions ("-DOSL_USE_OPTIX=1")
# Define OSL_INTERNAL symbol only when building OSL itself, will not be
# defined for downstream projects using OSL.
add_compile_definitions (OSL_INTERNAL=1)
# To make sure we aren't relying on deprecated OIIO features, we define
# OIIO_DISABLE_DEPRECATED before including any OIIO headers.
add_compile_definitions (OIIO_DISABLE_DEPRECATED=900000)
# Namespace settings
#
# The "outer namespace" defaults to the project name, but it can be overridden
# to allow custom builds that put everything inside a unique namespace that
# can't conflict with default builds.
set (${PROJ_NAME}_OUTER_NAMESPACE ${PROJECT_NAME} CACHE STRING
"Customized outer namespace")
set (PROJ_NAMESPACE "${${PROJ_NAME}_OUTER_NAMESPACE}") # synonym
if (NOT ${PROJ_NAME}_OUTER_NAMESPACE STREQUAL ${PROJECT_NAME})
set (${PROJ_NAME}_CUSTOM_OUTER_NAMESPACE 1)
endif ()
# Set the default namespace. For symbol hiding reasons, it's important that
# the project name is a subset of the namespace name.
set (PROJ_NAMESPACE "${${PROJ_NAME}_NAMESPACE}")
string(REGEX MATCH ${PROJECT_NAME} NAMESPACE_HAS_PROJECT_NAME ${PROJ_NAMESPACE})
if (NOT NAMESPACE_HAS_PROJECT_NAME)
set (PROJ_NAMESPACE ${PROJECT_NAME}_${PROJ_NAMESPACE})
# There is also an inner namespace that is either vMAJ_MIN or vMAJ_MIN_PATCH,
# depending on the setting of ${PROJ_NAME}_INNER_NAMESPACE_INCLUDE_PATCH.
option (${PROJ_NAME}_INNER_NAMESPACE_INCLUDE_PATCH
"Should the inner namespace include the patch number" ${${PROJECT_NAME}_DEV_RELEASE})
if (${PROJ_NAME}_INNER_NAMESPACE_INCLUDE_PATCH)
set (PROJ_VERSION_NAMESPACE "v${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}_${PROJECT_VERSION_PATCH}")
else ()
set (PROJ_VERSION_NAMESPACE "v${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}")
endif ()
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE}_v${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR}")
if (OIIO_NAMESPACE_INCLUDE_PATCH)
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE_V}_${PROJECT_VERSION_PATCH}")
endif ()
message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}")
# PROJ_NAMESPACE_V combines the outer and inner namespaces into one symbol
set (PROJ_NAMESPACE_V "${PROJ_NAMESPACE}_${PROJ_VERSION_NAMESPACE}")
message(STATUS "Outer namespace PROJ_OUTER_NAMESPACE: ${PROJ_NAMESPACE}")
message(STATUS "Inner namespace PROJ_VERSION_NAMESPACE: ${PROJ_VERSION_NAMESPACE}")
message(STATUS "Joint namespace PROJ_NAMESPACE_V: ${PROJ_NAMESPACE_V}")
list (APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/src/cmake/modules"
"${PROJECT_SOURCE_DIR}/src/cmake")
# Define OSL_INTERNAL symbol only when building OSL itself, will not be
# defined for downstream projects using OSL.
add_definitions (-DOSL_INTERNAL=1)
# Helpful functions and macros for our project
include (colors)
include (check_is_enabled)
# To make sure we aren't relying on deprecated OIIO features, we define
# OIIO_DISABLE_DEPRECATED before including any OIIO headers.
add_definitions (-DOIIO_DISABLE_DEPRECATED=900000)
# All the C++ and compiler related options and adjustments live here
# All the C++ and compiler related options and adjustments
include (compiler)
# Dependency finding utilities and all dependency-related options
include (dependency_utils)
# Utilities and options related to finding python and making python bindings
include (pythonutils)
# Dependency finding utilities and all dependency-related options
include (externalpackages)
include (flexbison)
include (cuda_macros)
include (llvm_macros)
# Utilities related to finding python and making python bindings
include (pythonutils)
# Include all our testing apparatus and utils, but not if it's a subproject
if (${PROJECT_NAME}_BUILD_TESTS AND PROJECT_IS_TOP_LEVEL)
include (testing)
endif ()
# We want CTest for testing, so this must be added before all the calls to
# add_subdirectory, or their add_test commands will not register.
include (CTest)
include_directories (
BEFORE
"${OSL_LOCAL_DEPS_DIR}/include"
"${CMAKE_SOURCE_DIR}/src/include"
"${CMAKE_BINARY_DIR}/src/include"
"${CMAKE_BINARY_DIR}/include"
)
# Make sure our math calculations are consistent,
# especially division. Different compilers may have choose to use
# reciprocal division losing precision causing slightly different
# results which can lead to aliasing differences when running the testsuite
# Disable reciprocal division
if (CMAKE_COMPILER_IS_INTEL)
if (MSVC)
add_compile_options("/Qprec-div")
else ()
add_compile_options("-prec-div")
endif ()
elseif (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG OR CMAKE_COMPILER_IS_INTELCLANG)
add_compile_options("-fno-reciprocal-math")
endif ()
# Tell CMake to process the sub-directories
add_subdirectory (src/include)
add_subdirectory (src/liboslcomp)
add_subdirectory (src/liboslquery)
add_subdirectory (src/liboslexec)
add_subdirectory (src/liboslnoise)
add_subdirectory (src/libbsdl)
add_subdirectory (src/oslc)
add_subdirectory (src/oslinfo)
if (OSL_BUILD_TESTS)
if (OSL_BUILD_TESTS AND BUILD_TESTING)
add_subdirectory (src/testshade)
add_subdirectory (src/testrender)
endif ()
@@ -169,15 +263,12 @@ if (OSL_BUILD_PLUGINS)
add_subdirectory (src/osl.imageio)
endif ()
if (USE_QT AND Qt5_FOUND)
if (USE_QT AND (Qt5_FOUND OR Qt6_FOUND) AND NOT DISABLE_OSLTOY)
add_subdirectory (src/osltoy)
endif ()
if (OSL_BUILD_SHADERS)
add_subdirectory (src/shaders)
if (OSL_BUILD_MATERIALX)
add_subdirectory (src/shaders/MaterialX)
endif ()
endif ()
option (INSTALL_DOCS "Install documentation" ON)
@@ -185,11 +276,6 @@ if (INSTALL_DOCS)
add_subdirectory (src/doc)
endif ()
# Last minute site-specific instructions, if they exist
if (OSL_SITE AND EXISTS "${PROJECT_SOURCE_DIR}/site/${OSL_SITE}/cmake/sitecustom.cmake")
include ("${PROJECT_SOURCE_DIR}/site/${OSL_SITE}/cmake/sitecustom.cmake")
endif ()
# install pkgconfig files
if ( NOT MSVC )
configure_file(src/build-scripts/oslexec.pc.in "${CMAKE_BINARY_DIR}/oslexec.pc" @ONLY)
@@ -238,299 +324,27 @@ configure_package_config_file ("${PROJECT_SOURCE_DIR}/src/cmake/Config.cmake.in"
install (FILES "${OSL_PROJECT_CONFIG}" "${OSL_VERSION_CONFIG}"
DESTINATION "${OSL_CONFIG_INSTALL_DIR}")
install (FILES src/cmake/llvm_macros.cmake DESTINATION cmake)
set (PERMISSION_FLAGS OWNER_EXECUTE OWNER_READ OWNER_WRITE
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ)
install (FILES src/build-scripts/serialize-bc.py
DESTINATION build-scripts
PERMISSIONS ${PERMISSION_FLAGS})
# install targets files
install (EXPORT OSL_EXPORTED_TARGETS
DESTINATION ${OSL_CONFIG_INSTALL_DIR}
FILE ${OSL_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::)
#########################################################################
# Testing
# Make a build/platform/testsuite directory, and copy the master runtest.py
# there. The rest is up to the tests themselves.
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testsuite")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/common"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
add_custom_command (OUTPUT "${CMAKE_BINARY_DIR}/testsuite/runtest.py"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/testsuite/runtest.py"
"${CMAKE_BINARY_DIR}/testsuite/runtest.py"
MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/testsuite/runtest.py")
add_custom_target ( CopyFiles ALL DEPENDS "${CMAKE_BINARY_DIR}/testsuite/runtest.py" )
# add_one_testsuite() - set up one testsuite entry
#
# Usage:
# add_one_testsuite ( testname
# testsrcdir - Current test directory in ${CMAKE_SOURCE_DIR}
# testdir - Current test sandbox in ${CMAKE_BINARY_DIR}
# [ENV env1=val1 env2=val2 ... ] - env vars to set
# [COMMAND cmd...] - optional override of launch command
# )
#
macro (add_one_testsuite testname testsrcdir)
cmake_parse_arguments (_tst "" "" "ENV;COMMAND" ${ARGN})
set (testsuite "${CMAKE_SOURCE_DIR}/testsuite")
set (testdir "${CMAKE_BINARY_DIR}/testsuite/${testname}")
if (NOT _tst_COMMAND)
set (_tst_COMMAND python "${testsuite}/runtest.py" ${testdir})
if (MSVC_IDE)
list (APPEND _tst_COMMAND --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
endif ()
endif ()
list (APPEND _tst_ENV
OpenImageIO_ROOT=${OpenImageIO_ROOT}
OSL_SOURCE_DIR=${CMAKE_SOURCE_DIR}
OSL_BUILD_DIR=${CMAKE_BINARY_DIR}
OSL_TESTSUITE_ROOT=${testsuite}
OSL_TESTSUITE_SRC=${testsrcdir}
OSL_TESTSUITE_CUR=${testdir}
)
file (MAKE_DIRECTORY "${testdir}")
add_test ( NAME ${testname} COMMAND ${_tst_COMMAND} )
# message ("Test -- env ${_tst_ENV} cmd ${_tst_COMMAND}")
set_tests_properties (${testname} PROPERTIES ENVIRONMENT "${_tst_ENV}" )
# Certain tests are already internally multi-threaded, so to keep them
# from piling up together, allocate a few cores each.
if (${testname} MATCHES "^render-")
set_tests_properties (${testname} PROPERTIES LABELS render
PROCESSORS 4 COST 10)
endif ()
# Some labeling for fun
if (${testname} MATCHES "^texture-")
set_tests_properties (${testname} PROPERTIES LABELS texture
PROCESSORS 2 COST 4)
endif ()
if (${testname} MATCHES "noise")
set_tests_properties (${testname} PROPERTIES LABELS noise
PROCESSORS 2 COST 4)
endif ()
if (${testname} MATCHES "optix")
set_tests_properties (${testname} PROPERTIES LABELS optix)
endif ()
endmacro ()
macro ( TESTSUITE )
cmake_parse_arguments (_ats "" "LABEL;FOUNDVAR;TESTNAME" "" ${ARGN})
# If there was a FOUNDVAR param specified and that variable name is
# not defined, mark the test as broken.
if (_ats_FOUNDVAR AND NOT ${_ats_FOUNDVAR})
set (_ats_LABEL "broken")
endif ()
set (test_all_optix $ENV{TESTSUITE_OPTIX})
# Add the tests if all is well.
set (ALL_TEST_LIST "")
set (_testsuite "${CMAKE_SOURCE_DIR}/testsuite")
foreach (_testname ${_ats_UNPARSED_ARGUMENTS})
set (_testsrcdir "${_testsuite}/${_testname}")
if (_ats_TESTNAME)
set (_testname "${_ats_TESTNAME}")
endif ()
if (_ats_LABEL MATCHES "broken")
set (_testname "${_testname}-broken")
endif ()
set (ALL_TEST_LIST "${ALL_TEST_LIST} ${_testname}")
# Run the test unoptimized, unless it matches a few patterns that
# we don't test unoptimized (or has an OPTIMIZEONLY marker file).
if (NOT _testname MATCHES "^getattribute-shader" AND
NOT _testname MATCHES "optix" AND
NOT EXISTS "${_testsrcdir}/OPTIMIZEONLY")
add_one_testsuite ("${_testname}" "${_testsrcdir}"
ENV TESTSHADE_OPT=0 )
endif ()
# Run the same test again with aggressive -O2 runtime
# optimization, triggered by setting TESTSHADE_OPT env variable.
# Skip OptiX-only tests and those with a NOOPTIMIZE marker file.
if (NOT _testname MATCHES "optix"
AND NOT EXISTS "${_testsrcdir}/NOOPTIMIZE")
add_one_testsuite ("${_testname}.opt" "${_testsrcdir}"
ENV TESTSHADE_OPT=2 )
endif ()
# When building for OptiX support, also run it in OptiX mode
# if there is an OPTIX marker file in the directory.
# If an environment variable $TESTSUITE_OPTIX is nonzero, then
# run all tests with OptiX, even if there's no OPTIX marker.
if (USE_OPTIX
AND (EXISTS "${_testsrcdir}/OPTIX" OR test_all_optix OR _testname MATCHES "optix")
AND NOT EXISTS "${_testsrcdir}/NOOPTIX"
AND NOT EXISTS "${_testsrcdir}/NOOPTIX-FIXME")
# Unoptimized
if (NOT EXISTS "${_testsrcdir}/OPTIMIZEONLY")
add_one_testsuite ("${_testname}.optix" "${_testsrcdir}"
ENV TESTSHADE_OPT=0 TESTSHADE_OPTIX=1 )
endif ()
# and optimized
add_one_testsuite ("${_testname}.optix.opt" "${_testsrcdir}"
ENV TESTSHADE_OPT=2 TESTSHADE_OPTIX=1 )
endif ()
endforeach ()
if (VERBOSE)
message (STATUS "Added tests: ${ALL_TEST_LIST}")
endif ()
endmacro ()
if (OSL_BUILD_TESTS)
# List all the individual testsuite tests here, except those that need
# special installed tests.
TESTSUITE ( aastep allowconnect-err and-or-not-synonyms arithmetic
array array-derivs array-range array-aassign
blackbody blendmath breakcont
bug-array-heapoffsets bug-locallifetime bug-outputinit
bug-param-duplicate bug-peep bug-return
cellnoise closure closure-array color comparison
compile-buffer
component-range
connect-components
const-array-params const-array-fill
debugnan debug-uninit
derivs derivs-muldiv-clobber
draw_string
error-dupes error-serialized
example-deformer
exit exponential
fprintf
function-earlyreturn function-simple function-outputelem
function-overloads function-redef
geomath getattribute-camera getattribute-shader
getsymbol-nonheap gettextureinfo
group-outputs groupstring
hash hashnoise hex hyperb
ieee_fp if incdec initlist initops intbits isconnected isconstant
layers layers-Ciassign layers-entry layers-lazy layers-lazyerror
layers-nonlazycopy layers-repeatedoutputs
linearstep
logic loop matrix message
mergeinstances-duplicate-entrylayers
mergeinstances-nouserdata mergeinstances-vararray
metadata-braces miscmath missing-shader
named-components
noise noise-cell
noise-gabor noise-gabor2d-filter noise-gabor3d-filter
noise-perlin noise-simplex
pnoise pnoise-cell pnoise-gabor pnoise-perlin
operator-overloading
opt-warnings
oslc-comma oslc-D oslc-M
oslc-err-arrayindex oslc-err-assignmenttypes
oslc-err-closuremul oslc-err-field
oslc-err-format oslc-err-funcoverload
oslc-err-intoverflow oslc-err-write-nonoutput
oslc-err-noreturn oslc-err-notfunc
oslc-err-initlist-args oslc-err-initlist-return
oslc-err-named-components
oslc-err-outputparamvararray oslc-err-paramdefault
oslc-err-struct-array-init oslc-err-struct-ctr
oslc-err-struct-dup oslc-err-struct-print
oslc-err-unknown-ctr
oslc-warn-commainit
oslc-variadic-macro
oslc-version
oslinfo-arrayparams oslinfo-colorctrfloat
oslinfo-metadata oslinfo-noparams
osl-imageio
paramval-floatpromotion
pragma-nowarn
printf-whole-array
raytype raytype-specialized reparam
render-background render-bumptest
render-cornell render-furnace-diffuse
render-microfacet render-oren-nayar render-veachmis render-ward
select shortcircuit spline splineinverse splineinverse-ident
spline-boundarybug spline-derivbug
string
struct struct-array struct-array-mixture
struct-err struct-init-copy
struct-isomorphic-overload struct-layers
struct-operator-overload struct-return struct-with-array
struct-nested struct-nested-assign struct-nested-deep
ternary
testshade-expr
texture-alpha texture-blur texture-connected-options
texture-derivs texture-errormsg
texture-firstchannel texture-interp
texture-missingalpha texture-missingcolor texture-simple
texture-smallderivs texture-swirl texture-udim
texture-width texture-withderivs texture-wrap
trailing-commas
transitive-assign
transform transformc trig typecast
unknown-instruction
userdata
vararray-connect vararray-default
vararray-deserialize vararray-param
vecctr vector
wavelength_color Werror xml )
# Add tests that require the Python bindings if we built them.
# We also exclude these tests if this is a sanitizer build on Linux,
# because the Python interpreter itself won't be linked with the right asan
# libraries to run correctly.
if (USE_PYTHON AND NOT SANITIZE_ON_LINUX)
TESTSUITE ( python-oslquery )
if (PROJECT_IS_TOP_LEVEL AND BUILD_TESTING AND ${PROJECT_NAME}_BUILD_TESTS)
osl_add_all_tests()
endif ()
# Only run field3d-related tests if the local OIIO was built with f3d support.
EXECUTE_PROCESS ( COMMAND ${OPENIMAGEIO_BIN} --help
OUTPUT_VARIABLE oiiotool_help )
if (oiiotool_help MATCHES "field3d")
TESTSUITE ( texture-field3d )
endif()
# Only run pointcloud tests if Partio is found
if (PARTIO_FOUND)
TESTSUITE ( pointcloud pointcloud-fold )
if (PROJECT_IS_TOP_LEVEL)
include (packaging)
endif ()
# Only run the OptiX tests if OptiX and CUDA are found
if (OPTIX_FOUND AND CUDA_FOUND)
TESTSUITE ( testoptix testoptix-noise )
endif ()
# FIXME: still working on MaterialX testsuite
# add_subdirectory(testsuite/MaterialX)
endif (OSL_BUILD_TESTS)
#########################################################################
# Packaging
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# "Vendor" is only used in copyright notices, so we use the same thing that
# the rest of the copyright notices say.
set (CPACK_PACKAGE_VENDOR ${PROJECT_AUTHORS})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenShadingLanguage is...")
set (CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/src/doc/Description.txt")
set (CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${platform})
file (COPY "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION "${CMAKE_BINARY_DIR}")
file (RENAME "${CMAKE_BINARY_DIR}/LICENSE" "${CMAKE_BINARY_DIR}/License.txt")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/License.txt")
file (COPY "${PROJECT_SOURCE_DIR}/README.md" DESTINATION "${CMAKE_BINARY_DIR}")
file (RENAME "${CMAKE_BINARY_DIR}/README.md" "${CMAKE_BINARY_DIR}/Readme.txt")
set (CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/Readme.txt")
set (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/src/doc/Welcome.txt")
#set (CPACK_PACKAGE_EXECUTABLES I'm not sure what this is for)
#set (CPACK_STRIP_FILES Do we need this?)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (CPACK_GENERATOR "TGZ;STGZ;RPM;DEB")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (APPLE)
set (CPACK_GENERATOR "TGZ;STGZ;PackageMaker")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-source)
#set (CPACK_SOURCE_STRIP_FILES ...FIXME...)
set (CPACK_SOURCE_IGNORE_FILES ".*~")
include (CPack)
print_package_notfound_report ()
+261 -161
View File
@@ -10,81 +10,147 @@ why it's an open source project. Please review this document to get a
briefing on our process.
Mail List
---------
General Tips for Open Source Development
----------------------------------------
* GitHub's [Open Source Guides](https://opensource.guide/)
- Especially the guide on [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
Mail List and Slack
-------------------
Contributors should be reading the osl-dev mail list:
* [osl-dev](https://lists.aswf.io/g/osl-dev)
You can sign up for the mail list on your own using the link above.
You can sign up for the mail list on your own using the link above.
* The [ASWF Slack](https://slack.aswf.io/) has an `openshadinglanguage`
channel. Sign up for the Slack on your own, then under "channels", select
"browse channels" and you should see the openshadinglanguage channel (among
those of the other projects and working groups).
Bug Reports and Issue Tracking
------------------------------
We use GitHub's issue tracking system for bugs and enhancements:
https://github.com/imageworks/OpenShadingLanguage/issues
We use GitHub's issue tracking system for reporting bugs and requesting
enhancements:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues
**If you are merely asking a question ("how do I...")**, please do not file an
issue, but instead ask the question on the [OSL developer mail
list](https://lists.aswf.io/g/osl-dev).
list](https://lists.aswf.io/g/osl-dev) or on the Slack channel.
If you are submitting a bug report, please be sure to note which version of
OSL you are using, on what platform (OS/version, which compiler you used,
and any special build flags or other unusual environmental issues). Please
give an account of
give a specific, as-detailed-as-possible account of
* what you tried
* what happened
* what you expected to happen instead
* what you tried (command line, source code example)
* what you expected to happen
* what actually happened (crash? error message? ran but didn't give the
correct result?)
with enough detail that others can reproduce the problem.
with enough detail that others can easily reproduce the problem just by
following your instructions. Please quote the exact error message you
received. If you are having trouble building, please post the full cmake
output of a fresh VERBOSE=1 build.
Suspected security vulnerabilities should be reported by the same process.
If confidentiality precludes a public question or issue for any reason, you
may contact us privately at [security@openshadinglanguage.org](mailto:security@openshadinglanguage.org).
Policy on AI Tools
------------------
Please read our [Policy on AI Coding Assistants](docs/dev/AI_Policy.md)
before contributing or participating in the project in any way mediated by
"AI" assistants.
High-level summary:
- Human must always be in the loop, and is the responsible party for
the contents of a PR (including fully understanding and being able
to explain, defend, and modify it in response to review comments).
- Interact with the project and community yourself, not by agent.
- Disclose what tools you used and how. At a minimum, we require an
"Assisted-by: TOOL/MODEL" line in the commit comments and PR description.
- Don't waste maintainer's time with low quality PRs.
Please do read the whole [Policy on AI Coding Assistants](docs/dev/AI_Policy.md)
for all the details.
The repository includes configuration for several AI coding assistants
(Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Opencode). Much of this
uses symbolic links to keep a single source of truth in `AGENTS.md`. **Windows
users** must enable symlink support before cloning or the agent integrations
will silently malfunction:
1. Enable [Windows Developer Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development)
2. `git config --global core.symlinks true`
3. Then clone (or re-clone) the repository.
The repository supports several AI coding assistants (Claude Code, Cursor,
GitHub Copilot, OpenAI Codex, Opencode). After cloning, run the setup script
for whichever tool(s) you use:
```
.agents/setup-agent claude # or: cursor, codex, opencode, copilot, all
```
See [docs/dev/Agentic_Coding.md](docs/dev/Agentic_Coding.md) for details.
Contributor License Agreement (CLA) and Intellectual Property
-------------------------------------------------------------
To protect the project -- and the contributors! -- we do require a
Contributor License Agreement (CLA) for anybody submitting changes.
To protect the project -- and the contributors! -- we do require a Contributor
License Agreement (CLA) for anybody submitting changes. This is for your own
safety, as it prevents any possible future disputes between code authors and
their employers or anyone else who might think they might own the IP output of
the author.
**While the repo is still under github.com/imageworks**
* If you are an individual writing the code on your own time and you're SURE
you are the sole owner of any intellectual property you contribute, use the
[Individual CLA](http://opensource.imageworks.com/cla/pdf/Imageworks_Contributor_License_Agreement_Individual.pdf).
* If you are writing the code as part of your job, or if there is any
possibility that your employers might think they own any intellectual
property you create, then you should use the [Corporate
CLA](http://opensource.imageworks.com/cla/pdf/Imageworks_Contributor_License_Agreement_Corporate.pdf).
Download the appropriate CLA from the links above, print, sign, and rescan
it (or just add a digital signature directly), and email it to:
opensource@imageworks.com
Our CLA's are based on those used by Apache and many other open source
projects.
**After the repo is moved to github.com/AcademySoftwareFoundation**
OSL uses EasyCLA for managing CLAs, which automatically checks to ensure
CLAs are signed by a contributor before a commit can be merged.
* If you are an individual writing the code on your own time and
you're SURE you are the sole owner of any intellectual property you
contribute, you can [sign the CLA as an individual contributor](https://github.com/communitybridge/easycla/blob/master/contributors/sign-a-cla-as-an-individual-contributor-to-github.md).
* If you are writing the code as part of your job, or if there is any
* [Corporate CLA](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/ASWF/CLA-corporate.md) :
If you are writing the code as part of your job, or if there is any
possibility that your employers might think they own any intellectual
property you create, then you should use the [Corporate Contributor
Licence Agreement](https://github.com/communitybridge/easycla/blob/master/contributors/contribute-to-a-github-company-project.md).
property you create. This needs to be executed by someone who has
signatory power for the company.
The OSL CLAs may be previewed here:
[Corporate](https://github.com/imageworks/OpenShadingLanguage/ASWF/OSL-CLA-corporate.md),
[Individual]((https://github.com/imageworks/OpenShadingLanguage/ASWF/OSL-CLA-individual.md)).
* [Individual CLA](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/ASWF/CLA-individual.md) :
If you are an individual writing the code on your own time, using your own
equipment, and you're SURE you are the sole owner of any intellectual
property you contribute.
** Contribution sign off
Please note that it is extremely common (nearly ubiquitous in the US and
Canada, and maybe other places) for full-time employees of technology and
entertainment companies to have IP clauses in their employment agreement (in
that pile of paperwork you sign on your first day of work and then promptly
forget about) that give the company rights to any code you write, even on your
own time. The Open Shading Language project expects you to know and follow the
rules of your employer and to have them sign a corporate CLA if necessary.
The easiest way to sign CLAs is digitally [using
EasyCLA](https://corporate.v1.easycla.lfx.linuxfoundation.org). There are
detailed step-by-step instructions about using the EasyCLA system for
[corporate CLAs](https://docs.linuxfoundation.org/lfx/easycla/v2-current/contributors/corporate-contributor)
and [individual CLAs](https://docs.linuxfoundation.org/lfx/easycla/v2-current/contributors/individual-contributor#github).
Companies who prefer not to use the online tools may sign, scan, and email
the executed copy to manager@lfprojects.org.
The corporate CLA allows a company to name a "CLA Manager" (who does not need
signatory power) who has the ability to use the online system to add or delete
individual employees of the company who are authorized to submit pull
requests, without needing to get an executive to amend and sign the agreement
each time.
Please note that these CLAs are based on the Apache 2.0 CLAs, and differ
minimally, only as much as was required to correctly describe the EasyCLA
process and our use of a CLA manager.
**Contribution sign off**
ASWF requires the use of the [Developer’s Certificate of Origin 1.1
(DCO)](https://developercertificate.org/), which is the same mechanism that
@@ -98,14 +164,90 @@ as a part of the commit message.
Here is an example Signed-off-by line, which indicates that the submitter
accepts the DCO:
`Signed-off-by: John Doe <john.doe@example.com>`
Signed-off-by: John Doe <john.doe@example.com>
You can include this automatically when you commit a change to your local
git repository using <code>git commit -s</code>. You might also want to
git repository using `git commit -s`. You might also want to
leverage this [command line tool](https://github.com/coderanger/dco) for
automatically adding the signoff message on commits.
Commit messages
---------------
### Summary heuristic
Look at the commit history of the project to get a sense of the style and
level of detail that is expected in commit messages.
### General guidelines and expectations
The first line of the commit message should be a short (less than 80
characters) summary of the change, prefixed with the general nature of the
change (see below).
The rest of the commit message should be a more detailed explanation of the
changes. Some commits are self-explanatory and don't need more than the
summary line. Others may need a more detailed explanation. Hallmarks of
a good commit message include:
* An explanation of why the change is necessary and what you hope to
accomplish with it.
* A description of any major user- or developer-facing changes that people
should be aware of: changes in APIs or behaviors, new features, etc.
* An explanation of any tricky implementation details or design decisions that
might not be immediately obvious to someone reading the code.
* Guideposts for somebody reviewing the code to understand the rationale and
have any supporting background information to fully understanding the code
changes.
Remember that at some point in the future, a developer unfamiliar with your
change (maybe you, long after you've forgotten the details) might need to
understand or fix your patch. Keep that person in mind as your audience and
strive to write a commit message that explains the context in a way that saves
them time and effort. Be the hero in the story of their future debugging
effort!
### Using "conventional commits" prefixes
We strive to follow the recommendations known as [conventional
commits](https://www.conventionalcommits.org/), which means that we would like
merged commit messages to have their first line start with one of the
following prefixes:
- `feat:` new features
- `fix:` bug fixes
- `perf:` performance improvements
- `api:` changes to the public APIs
- `int:` changes to code internals that don't affect the public API
- `build:` changes to the build system
- `test:` changes to the test suite or unit tests
- `ci:` changes to the CI system
- `docs:` changes to the documentation
- `refactor:` code refactoring
- `style:` formatting or other stylistic non-functional changes to the code
- `admin:` project administration or policy changes
- `revert:` reverting a previous commit
Obviously, some (if not most) PRs may qualify for more than one of these
categories (for example, a new feature may also introduce a new API call, add
tests, and include new documentation). If that is the case, use your best
judgment to pick the category that best captures the essence or most important
aspect of the change. When ambiguous, consider the list above to be a priority
ranking (e.g., a change that fixes a bug and adds a new test should be listed
under `fix:`, because that appears first in the list).
It is also encouraged, when it makes sense to do so, to put a subcategory in
parenthesis after the prefix, like `fix(optix):` or `feat(oslc):`. If there
is no clear single format or class that is the man focus of the patch, then
you can omit the subcategory.
API or ABI-breaking changes should additionally be marked with an exclamation
point at the end of the prefix, like `feat!:` or `api!:` to make it easily
identifiable as a breaking change from the first line of the commit message.
Pull Requests and Code Review
-----------------------------
@@ -115,11 +257,13 @@ The best way to submit changes is via GitHub Pull Request. GitHub has a
All code must be formally reviewed before being merged into the official
repository. The protocol is like this:
1. Get a GitHub account, fork imageworks/OpenShadingLanguage to create your
1. Get a GitHub account, fork AcademySoftwareFoundation/OpenShadingLanguage to create your
own repository on GitHub, and then clone it to get a repository on your
local machine.
2. Edit, compile, and test your changes.
2. Edit, compile, and test your changes. Run clang-format (see the
instructions on coding style below). Our current formatting standard,
as checked by our CI, uses clang-format 17.0.
3. Push your changes to your fork (each unrelated pull request to a separate
"topic branch", please).
@@ -131,30 +275,29 @@ component that deserves extended discussion or debate among the wider OSL
community, then it may be prudent to email osl-dev pointing everybody to
the pull request URL and discussing any issues you think are important.
6. The reviewer will look over the code and critique on the "comments" area,
6. All pull requests automatically launch CI jobs on GitHub Actions to
ensure that the build completes and that the tests suite runs correctly, for
a variety of platform, compiler, library, and flag combinations. The status
of the CI tests for your PR will be displayed on the GitHub PR page. We will
not accept PRs that don't build cleanly or pass the existing testsuite.
7. The reviewer will look over the code and critique on the "comments" area,
or discuss in email. Reviewers may ask for changes, explain problems they
found, congratulate the author on a clever solution, etc. But until somebody
says "LGTM" (looks good to me), the code should not be committed. Sometimes
this takes a few rounds of give and take. Please don't take it hard if your
first try is not accepted. It happens to all of us.
7. After approval, one of the senior developers (with commit approval to the
official main repository) will merge your fixes into the master branch.
8. After approval, one of the senior developers (with commit approval to the
official main repository) will merge your fixes into the main branch.
Please see the [Code Review](docs/dev/CodeReview.md) document for more
explanaton of the code review process.
Coding Style
------------
There are two overarching rules:
1. When making changes, conform to the style and conventions of the surrounding code.
2. Strive for clarity, even if that means occasionally breaking the
guidelines. Use your head and ask for advice if your common sense seems to
disagree with the conventions.
Below we try to enumerate the guidelines embodied in the code.
#### File conventions
C++ implementation should be named `*.cpp`. Headers should be named `.h`.
@@ -162,124 +305,84 @@ All headers should contain
#pragma once
All source files should begin with these three lines:
All source files should begin with the copyright and license, which can be
found in the [LICENSE](LICENSE) file (or cut and pasted from any other other source
file). Two notes on this:
// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
* For NEW source files, please change the copyright year to the present. DO
NOT edit existing files only to update the copyright year, it just creates
pointless deltas and offers no increased protection.
as a comment in the syntax of whatever source code is used in that file (for
example, for python or shell files, use `#` rather than `//`).
* Occasionally a file contains substantial code from another project
and will also list its copyright. Do NOT copy that notice to any new files,
it really only applies to the particular file in which it appears.
Occasionally a file may contain substantial code from another project and will
also list its original copyright and license information. Do NOT alter that
notice or copy it to any new files, it really only applies to the particular
file in which it appears.
#### Formatting
NEVER alter somebody else's code to reformat just because you found
something that violates the rules. Let the group/author/leader know, and
resist the temptation to change it yourself.
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) v17
to uniformly format our source code prior to PR submission. Make sure that
clang-format is installed on your local machine, and just run
Each line of text in your code should be at most 80 characters long.
Exceptions are allowed for those rare cases where letting a line be longer
(and wrapping on an 80-character window) is actually a better and clearer
alternative than trying to split it into two lines. Sometimes this happens,
but it's extremely rare.
make clang-format
Indent 4 spaces at a time, and use actual spaces, not tabs. For files that
must use tabs for some reason, tabs should always be on 8's. Most editors
have a setting that forces indentations to be spaces. With emacs, you can do
this:
and it will automatically reformat your code according to the configuration
file found in the `.clang-format` file at the root directory of the OSL
source code checkout.
(setq c-default-style "bsd")
(setq-default indent-tabs-mode nil)
One of the CI test matrix entries runs clang-format and fails if any
diffs were generated (that is, if any of your code did not 100% conform to
the `.clang-format` formatting configuration). If it fails, clicking on that
test log will show you the diffs generated, so that you can easily correct
it on your end and update the PR with the formatting fixes.
Opening brace on the same line as the condition or loop.
If you don't have clang-format set up on your machine, and your patch is not
very long, you may find that it's more convenient to just submit it and hope
for the best, and if it doesn't pass the CI test, look at the diffs in the log
for the "clang-format" CI run and make the corrections by hand and then submit
an update to the patch (i.e. relying on CI to run clang-format for you).
One statement per line, except in rare cases where violating this rule makes
the code more clear.
Because the basic formatting is automated by clang-format, we won't
enumerate the rules here.
Three (3) consecutive empty lines between function or class method
implementations, one blank line between method declarations within a class
definition. Put a single blank line within a function if it helps to
visually separate different sequential tasks. Don't put multiple blank lines
in a row within a function, or blank lines right after an opening brace or
right before a closing brace. The goal is to use just enough white space to
help developers visually parse the code (for example, spotting at a glance
where new functions begin), but not so much as to spread it out or be
confusing.
For the occasional non-clang-format regions of code, NEVER alter somebody
else's code to reformat just because you found something that violates the
rules. Let the group/author/leader know, and resist the temptation to change
it yourself.
For if, for, while, etc., put a space before the paren, but NOT inside the parens. For example:
Each line of text in your code, including comments, should be at most 80
characters long. Exceptions are allowed for those rare cases where letting a
line be longer (and wrapping on an 80-character window) is actually a better
and clearer alternative than trying to split it into two lines. Sometimes this
happens, but it's extremely rare.
if (foo) // Yes
if(foo) // No
if ( foo ) // No
We prefer three (3) consecutive empty lines between freestanding functions or
class definitions, one blank line between method declarations within a class
definition. Put a single blank line within a function if it helps to visually
separate different sequential tasks, but don't put multiple blank lines in a
row within a function, or blank lines right after an opening brace or right
before a closing brace. The goal is to use just enough white space to help
developers visually parse the code (for example, spotting at a glance where
new functions begin), but not so much as to spread it out or be confusing.
Function calls should have a space between the function name and the opening
parenthesis, NO space inside the parenthesis, except for a single blank
space between each argument. For example:
x = foo (a, b); // Yes, this is always ok
x = foo ( a, b ); // No
x = foo (a,b); // No
x = foo(a, b); // No
x = foo(a); // Occasionally, this just looks better, when the function name is short,
// and there's just one very short argument. What can I say, I do it too.
Function declarations: function names should begin at column 0 for a full
function definition. (It's ok to violate this rule for very short inline
functions within class definitions.)
Here is a short code fragment that shows some of these rules in action:
static int
function (int a, int b)
{
int x = a + b;
if (a == 0 || b == 0) {
x += 1;
x *= 4;
} else {
x -= 3;
}
for (int i = 0; i < 3; ++i) {
x += a * i;
x *= foo (i); // function call
}
return x;
}
Don't ever reformat, re-indent, change whitespace, or make any other such
changes to working code. If you're adding just a few lines or fixing a bug
in existing code, stick to the style of the surrounding code. In very rare
circumstances, and with consensus of the group, reformatting is sometimes
helpful to improve code readability, but it should be done as a separate
formatting-only checkin.
#### Identifiers
In general, classes and templates should start with upper case and capitalize new words:
class CustomerList;
In general, local variables should start with lower case.
In general, classes and templates should start with upper case and
capitalize new words: `class CustomerList;` In general, local variables
should start with lower case. Macros should be `ALL_CAPS`, if used at all.
If your class is extremely similar to, or modeled after, something in the
standard library, Boost, or something else we interoperate with, it's ok to
standard library, or something else we interoperate with, it's ok to
use their naming conventions. For example, very general utility classes and
templates (the kind of thing you would normally find in std or boost) should
templates (the kind of thing you would normally find in std) should
be lower case with underscores separating words, as they would be if they
were standards.
template <class T> shared_ptr;
class scoped_mutex;
Macros should be ALL_CAPS, if used at all.
Names of data should generally be nouns. Functions/methods are trickier: a
the name of a function that returns a value but has no side effects should
be a noun, but a procedure that performs an action should be a verb.
@@ -306,11 +409,11 @@ Namespaces: yes, use them!
#### Third-party libraries
Prefer C++11 `std` rather than Boost or other third party libraries, where
Prefer C++17 `std` rather than other third party libraries, where
both can do the same task.
If you see a third party libary already used as a dependency (such as OIIO,
Boost, Ilmbase, or LLVM), feel free to any of its public features in OSL
If you see a third party library already used as a dependency (such as OIIO,
Imath, or LLVM), feel free to any of its public features in OSL
internals (provided those features are present in the minimum version of
that library that we support).
@@ -334,9 +437,6 @@ protected members of classes), please use Doxygen-style comments. They looks
like this:
/// Explanation of a class. Note THREE slashes!
/// Also, you need at least two lines like this. If you don't have enough
/// for two lines, make one line blank like this:
///
class myclass {
....
float foo; ///< Doxygen comments on same line look like this
+26 -16
View File
@@ -20,21 +20,24 @@ guidance.
The OSL project grows and thrives from assistance from Contributors.
Contributors include anyone in the community who contributes code,
documentation, or other technical artifacts that have been incorporated into
the projects repository.
the project repository.
Anyone can be a Contributor. You need no formal approval from the project,
beyond the legal forms.
### How to Become a Contributor
* Review the coding standards to ensure your contribution is in line
with the project's coding and styling guidelines.
* Review the coding standards and [contributing guidelines](CONTRIBUTING.md)
to ensure your contribution is in line with the project's coding and styling
guidelines.
* Sign the Individual CLA, or if you are employed by an organization that
might have any claim to IP you create, have your organization sign the
Corporate CLA.
* Submit your code as a PR with the appropriate DCO sign-off.
* Submit your code as a PR with the appropriate DCO sign-off on each commit.
The easiest way to do this is to ensure that you commit your code with `git
commit -s`.
## Committers
@@ -75,9 +78,10 @@ request that the TSC restore them to active Committer status.
## Technical Steering Committee
The Technical Steering Committee (TSC) has final authority over this
project. As defined in the project charter, TSC responsibilities include,
but are not limited to:
The Technical Steering Committee (TSC) has final authority over this project.
As defined in the project [technical charter](https://github.com/AcademySoftwareFoundation/foundation/blob/main/project_charters/open-shading-language_charter.md),
in addition to committer activities, TSC responsibilities also include, but
are not limited to:
* Coordinating technical direction of the Project.
@@ -125,20 +129,21 @@ represents the project at all ASWF TAC meetings.
### TSC Members
(Proposed list, subject to revision, some are placeholders while their
organizations decide who should be the permanent representative)
Current voting members of the TSC are:
* **Chair and TAC repreentative**: Chris Kulla - Sony Pictures Imageworks
* **Chief Architect**: Larry Gritz, Sony Pictures Imageworks
* **Chair and TAC representative**: Chris Kulla - Epic Games
* **Chief Architect**: Larry Gritz - Sony Pictures Imageworks
* Luke Emrose - Animal Logic
* Eric Enderton - NVIDIA
* Stephen Friedman - Pixar
* Derek Haase - DNEG
* Adrien Herubel - Autodesk
* Lee Kerley - Sony Pictures Imageworks
* Nicolas Guiard - Isotropix
* Thiago Ize - Autodesk
* Lee Kerley - Apple
* Mitch Prater - Laika
* Alexey Smolenchuk - DNEG
* Brecht Van Lommel - Blender
* Alex Wells - Intel
### TSC Nomination and Succession
@@ -178,6 +183,9 @@ her absence. Meetings may also be streamed online where appropriate;
connection details will be posted to the osl-dev mail list in advance of the
scheduled meeting.
The biweekly TSC meetings can be found on the [ASWF Calendar](https://calendar.openshadinglanguage.org),
just click on the OSL TSC meeting entries to get the Zoom link.
Items are added to the TSC agenda which are considered contentious or are
modifications of governance, contribution policy, TSC membership, or release
process, in addition to topics involving the high-level technical direction
@@ -201,9 +209,11 @@ The TSC may invite additional persons to participate in a non-voting
capacity.
The meeting chair is responsible for ensuring that minutes are taken and
archived in the project repository.
archived.
Due to the challenges of scheduling a global meeting with participants in
several time zones, the TSC will seek to resolve as many agenda items as
possible outside of meetings on the public mailing list.
possible outside of meetings on the public mailing list or through GitHub
issues, discussions, and pull requests.
Meeting notes (usually very brief) can be found at: https://docs.google.com/document/d/1yf0bG6eoE2EvKZBNZX3nskdTvu99ADTDTNOknCDJd1I
+90 -55
View File
@@ -4,27 +4,32 @@
Building OSL
============
OSL currently compiles and runs cleanly on Linux, Mac OS X, and Windows.
OSL currently compiles and runs cleanly on Linux (x86_64), Mac OS X (x86_64
and aarch64), and Windows (x86_64). It may build and run on other platforms as
well, but we don't officially support or test other than these platforms.
Shader execution is supported on the native architectures of those x86_64 and
aarch64 platforms, a special batched 4-, 8- or 16-wide SIMD execution mode
requiring x86_64 with SSE2, AVX/AVX2 or AVX-512 instructions, as well as on
NVIDIA GPUs using Cuda+OptiX.
Dependencies
------------
OSL requires the following dependencies or tools.
NEW or CHANGED dependencies since the last major release are **bold**.
NEW or CHANGED minimum dependencies since the last major release are **bold**.
* Build system: [CMake](https://cmake.org/) 3.12 or newer (tested through 3.18)
* Build system: [CMake](https://cmake.org/) 3.19 or newer (tested
through 4.2)
* A suitable C++11 compiler to build OSL itself, which may be any of:
- GCC 4.8.5 or newer (tested through gcc 10)
- Clang 3.4 or newer (tested through clang 10)
- Microsoft Visual Studio 2015 or newer
- Intel C++ compiler icc version 13 (?) or newer
* A suitable C++17 compiler to build OSL itself, which may be any of:
- GCC 9.3 or newer (tested through gcc 14)
- Clang 5 or newer (tested through clang 22)
- Microsoft Visual Studio 2017 or newer
- **Intel LLVM-based icx compiler version 2022 or newer** (note: the classic `icc` compiler is no longer supported).
OSL should compile also properly with C++14 or C++17, but they are not
required (unless you are using LLVM >= 10, in which case at least C++14
is needed).
* **[OpenImageIO](http://openimageio.org) 2.0 or newer** (tested through 2.2)
* [OpenImageIO](http://openimageio.org) 3.0 or newer (tested through 3.1
and main)
OSL uses OIIO both for its texture mapping functionality as well as
numerous utility classes. If you are integrating OSL into an existing
@@ -38,33 +43,36 @@ NEW or CHANGED dependencies since the last major release are **bold**.
After building OpenImageIO, if you don't have it installed in a
"standard" place (like /usr/include), you should set the environment
variable $OPENIMAGEIOHOME to point to the compiled distribution, as
well as for $OPENIMAGEIOHOME/lib to be in your LD_LIBRARY_PATH (or
DYLD_LIBRARY_PATH on OS X) and then OSL's build scripts will be able
to find it.
variable `$OpenImageIO_ROOT` to point to the compiled distribution, and
then OSL's build scripts will be able to find it. You should also have
$OpenImageIO_ROOT/lib to be in your LD_LIBRARY_PATH (or
DYLD_LIBRARY_PATH on OS X).
* **[LLVM](http://www.llvm.org) 7, 8, 9, or 10**, including
clang libraries.
* [LLVM](http://www.llvm.org) **14.0 or newer**, 15, 16, 17, 18, 19, 20, 21,
22, including clang libraries.
Note that LLVM 10 is not compatible with C++11, and requires C++14 or
later. If you *must* build OSL with C++11, you need to use an LLVM that
is LLVM 9 or earlier.
* (optional) For GPU rendering on NVIDIA GPUs:
* [OptiX](https://developer.nvidia.com/rtx/ray-tracing/optix) 7.0 or higher.
* [Cuda](https://developer.nvidia.com/cuda-downloads) 9.0 or higher. It is
recommended that you use 11.0 or higher.
* [Boost](www.boost.org) 1.55 or newer (tested through boost 1.73)
* [Ilmbase](http://openexr.com/downloads.html) 2.0 or newer (tested through 2.5)
* [Flex](https://github.com/westes/flex) and
[GNU Bison](https://www.gnu.org/software/bison/)
* [PugiXML](http://pugixml.org/)
* [Imath](https://github.com/AcademySoftwareFoundation/Imath) 3.1 or newer.
* [Flex](https://github.com/westes/flex) 2.5.35 or newer and
[GNU Bison](https://www.gnu.org/software/bison/) 2.7 or newer.
Note that on some MacOS/xcode releases, the system-installed Bison is too
old, and it's better to install a newer Bison (via Homebrew is one way to
do this easily).
* [PugiXML](http://pugixml.org/) >= 1.8 (we have tested through 1.15).
* (optional) [Partio](https://www.disneyanimation.com/technology/partio.html)
If it is not found at build time, the OSL `pointcloud` functions will not
be operative.
* (optional) Python: If you are building the Python bindings or running the
testsuite:
* Python >= 2.7 (tested against 2.7, 3.6, 3.7, 3.8)
* pybind11 >= 2.4.2 (Tested through 2.5)
* NumPy
* (optional) Qt >= 5.6 (tested through 5.15). If not found at build time,
the `osltoy` application will be disabled.
testsuite:
* **Python >= 3.9** (tested through 3.14)
* pybind11 >= 2.7 (tested through 3.0)
* NumPy (tested through 2.4)
* (optional) Qt5 >= 5.6 or Qt6 (tested Qt5 through 5.15 and Qt6 through 6.10).
If not found at build time, the `osltoy` application will be disabled.
@@ -73,49 +81,76 @@ Build process
Here are the steps to check out, build, and test the OSL distribution:
0. Install and build dependencies.
1. Install and build dependencies.
1. Check out a copy of the source code from the Git repository:
2. Check out a copy of the source code from the Git repository:
git clone https://github.com/imageworks/OpenShadingLanguage.git osl
git clone https://github.com/AcademySoftwareFoundation/OpenShadingLanguage.git osl
2. Change to the distribution directory and 'make'
3. Change to the distribution directory and 'make'
cd osl
make
Note: OSL uses 'CMake' for its cross-platform build system. But for
simplicity, we have made a "make wrapper" around it, so that by just
typing 'make' everything will build. Type 'make help' for other
typing 'make' everything will build. Type 'make help' for other
options, and note that 'make nuke' will blow everything away for the
freshest possible compile.
NOTE: If the build breaks due to compiler warnings which have been
elevated to errors, you can try "make clean" followed by
"make STOP_ON_WARNING=0", that create a build that will only stop for
You can also ignore the top level Makefile wrapper, and instead use
CMake directly:
cmake -B build -S .
cmake --build build --target install
NOTE: If the build breaks due to compiler warnings which have been elevated
to errors, you can try "make clean" followed by "make STOP_ON_WARNING=0",
or if using cmake directly, add `-DSTOP_ON_WARNING=0` to the cmake
configuration command. That will create a build that will only stop for
full errors, not warnings.
3. After compilation, you'll end up with a full OSL distribution in
dist/ARCH, where ARCH is the architecture you are building on, one of
"linux", "linux64", "macosx", "windows", or "windows64".
4. After compilation, you'll end up with a full OSL distribution in
dist/
Note: The default is to make an optimized "release" build. If
instead type 'make debug' at the top level, you will end up with
a debug build (no optimization, full symbols) in "dist/ARCH.debug".
4. Add the "dist/ARCH/bin" to your $PATH, and "dist/ARCH/lib" to your
$LD_LIBRAY_PATH (or $DYLD_LIBRARY_PATH on OS X), or copy the contents
5. Add the "dist/bin" to your `$PATH`, and "dist/lib" to your
`$LD_LIBRARY_PATH` (or `$DYLD_LIBRARY_PATH` on MacOS), or copy the contents
of those files to appropriate directories. Public include files
(those needed when building applications that incorporate OSL)
can be found in "dist/ARCH/include", and documentation can be found
in "dist/ARCH/share/doc".
can be found in "dist/include", and documentation can be found
in "dist/share/doc".
5. After building (and setting your library path), you can run the
6. After building (and setting your library path), you can run the
test suite with:
make test
Conda Environment
-----------------
To simplify installation of Python and other dependencies, you can use
the provided Conda environment setup script located at `src/build-scripts/`
by running:
source src/build-scripts/configure_conda_env.bash
**This script will:**
* Check for Miniconda installation.
* Create a Conda environment named `osl-env` if it doesn't exist.
* Install all required dependencies into the environment.
* Activate the environment for the current shell session.
After running this script, the `osl-env` environment will be created, and
all you need to do when opening a new shell session is simply activate the
Conda environment.
**When to use it:**
Run this script after cloning the repository and before building OSL. It
sets up a consistent development environment without manually installing
all dependencies. If you already have all required dependencies installed,
running it is optional.
Troubleshooting
----------------
- [Build issues on macOS Catalina (fatal error: 'wchar.h' file not found)](https://github.com/imageworks/OpenShadingLanguage/issues/1055#issuecomment-581920327)
- [Build issues on macOS Catalina (fatal error: 'wchar.h' file not found)](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues/1055#issuecomment-581920327)
-113
View File
@@ -1,113 +0,0 @@
See [LICENSE.md](LICENSE.md) for the main open source license of original
code written for the Open Shading Language project.
The remainder of this file reproduces the open source licensing details
of other projects that have been imported, incorporated into, or derived
into parts of OSL.
In no particular order:
-------------------------------------------------------------------------
BSD 3-Clause License
SPDX-License-Identifier: BSD-3-Clause
* OpenImgageIO Copyright (c) Larry Gritz, et al.
https://github.com/OpenImageIO/oiio
Many bits of code flow back and forth between OIIO and OSL, especially
parts of the CMake build system.
* OpenEXR, Copyright (c) Contributors to the OpenEXR Project.
https://github.com/AcademySoftwareFoundation/OpenEXR
OSL replicates and modifies several files from the "Imath" portion of
OpenEXR. These are all found in src/include/OSL/Imathx.
* Qt, Copyright (c) The Qt Company Ltd.
http://doc.qt.io/
Some widget code in src/osltoy is copied and/or derived from example code
for Qt.
* Highlight.js
https://github.com/highlightjs/highlight.js/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
SPDX-License-Identifier: BSD-2-Clause
* Markdeep
https://casual-effects.com/markdeep
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
Public domain
* The simplex noise implementation is Copyright (c) Stefan Gustavson.
It bears the following notice:
This library is public domain software, released by the author
into the public domain in February 2011. You may do anything
you like with it. You may even remove all attributions,
but of course I'd appreciate it if you kept my name somewhere.
-------------------------------------------------------------------------
If we have left anything out, it is unintentional. Please let us know.
View File
+36 -52
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
#########################################################################
#
@@ -19,50 +19,26 @@
working_dir := ${shell pwd}
# Figure out which architecture we're on
include ${working_dir}/src/make/detectplatform.mk
# Presence of make variables DEBUG and PROFILE cause us to make special
# builds, which we put in their own areas.
ifdef DEBUG
variant +=.debug
endif
ifdef PROFILE
variant +=.profile
endif
MY_MAKE_FLAGS ?=
MY_NINJA_FLAGS ?=
MY_CMAKE_FLAGS += -g3
MY_CMAKE_FLAGS ?=
BUILDSENTINEL ?= Makefile
NINJA ?= ninja
CMAKE ?= cmake
CMAKE_BUILD_TYPE ?= Release
# Site-specific build instructions
OSL_SITE ?= ${shell uname -n}
ifneq (${shell echo ${OSL_SITE} | grep imageworks.com},)
include ${working_dir}/site/spi/Makefile-bits
endif
# Set up variables holding the names of platform-dependent directories --
# set these after evaluating site-specific instructions
top_build_dir ?= build
build_dir ?= ${top_build_dir}/${platform}${variant}
top_dist_dir ?= dist
dist_dir ?= ${top_dist_dir}/${platform}${variant}
build_dir ?= build
dist_dir ?= dist
INSTALL_PREFIX ?= ${working_dir}/${dist_dir}
VERBOSE ?= ${SHOWCOMMANDS}
ifneq (${VERBOSE},)
MY_MAKE_FLAGS += VERBOSE=${VERBOSE}
MY_CMAKE_FLAGS += -DVERBOSE:BOOL=${VERBOSE}
MY_CMAKE_FLAGS += -DVERBOSE:BOOL=${VERBOSE} --log-level=VERBOSE
ifneq (${VERBOSE},0)
MY_NINJA_FLAGS += -v
TEST_FLAGS += -V
endif
$(info OSL_SITE = ${OSL_SITE})
$(info dist_dir = ${dist_dir})
$(info INSTALL_PREFIX = ${INSTALL_PREFIX})
endif
@@ -116,10 +92,6 @@ ifneq (${OSL_LIBNAME_SUFFIX},)
MY_CMAKE_FLAGS += -DOSL_LIBNAME_SUFFIX:STRING=${OSL_LIBNAME_SUFFIX}
endif
ifneq (${OIIO_LIBNAME_SUFFIX},)
MY_CMAKE_FLAGS += -DOIIO_LIBNAME_SUFFIX:STRING=${OIIO_LIBNAME_SUFFIX}
endif
ifneq (${OSL_BUILD_TESTS},)
MY_CMAKE_FLAGS += -DOSL_BUILD_TESTS:BOOL=${OSL_BUILD_TESTS}
endif
@@ -128,10 +100,6 @@ ifneq (${OSL_BUILD_SHADERS},)
MY_CMAKE_FLAGS += -DOSL_BUILD_SHADERS:BOOL=${OSL_BUILD_SHADERS}
endif
ifneq (${OSL_BUILD_MATERIALX},)
MY_CMAKE_FLAGS += -DOSL_BUILD_MATERIALX:BOOL=${OSL_BUILD_MATERIALX}
endif
ifdef DEBUG
CMAKE_BUILD_TYPE=Debug
endif
@@ -171,6 +139,10 @@ ifneq (${USE_SIMD},)
MY_CMAKE_FLAGS += -DUSE_SIMD:STRING="${USE_SIMD}"
endif
ifneq (${VEC_REPORT},)
MY_CMAKE_FLAGS += -DVEC_REPORT:BOOL="${VEC_REPORT}"
endif
ifneq (${TEST},)
TEST_FLAGS += -R ${TEST}
endif
@@ -220,7 +192,18 @@ ifneq (${BUILD_MISSING_DEPS},)
endif
ifneq (${USE_OPTIX},)
MY_CMAKE_FLAGS += -DUSE_OPTIX:BOOL=${USE_OPTIX}
MY_CMAKE_FLAGS += -DOSL_USE_OPTIX:BOOL=${USE_OPTIX}
endif
ifneq (${OSL_USE_OPTIX},)
MY_CMAKE_FLAGS += -DOSL_USE_OPTIX:BOOL=${OSL_USE_OPTIX}
endif
ifneq (${USE_PYTHON},)
MY_CMAKE_FLAGS += -DUSE_PYTHON:BOOL=${USE_PYTHON}
endif
ifneq (${PYTHON_VERSION},)
MY_CMAKE_FLAGS += -DPYTHON_VERSION:STRING=${PYTHON_VERSION}
endif
@@ -235,7 +218,7 @@ endif
#########################################################################
# Top-level documented targets
all: dist
all: install
# 'make debug' is implemented via recursive make setting DEBUG
debug:
@@ -255,7 +238,7 @@ config:
cd ${build_dir} ; \
${CMAKE} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
${MY_CMAKE_FLAGS} ../.. ; \
${MY_CMAKE_FLAGS} ${working_dir} ; \
fi)
@@ -293,7 +276,7 @@ clang-format: config
)
# 'make dist' is just a synonym for 'make install'
# DEPRECATED: 'make dist' is just a synonym for 'make install'
dist : install
TEST_FLAGS += --force-new-ctest-process --output-on-failure
@@ -307,7 +290,7 @@ test: build
LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH} \
DYLD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${DYLD_LIBRARY_PATH} \
OIIO_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${OIIO_LIBRARY_PATH} \
PYTHONPATH=${working_dir}/${build_dir}/src/python:${PYTHONPATH} \
PYTHONPATH=${working_dir}/${build_dir}/lib/python/site-packages:${PYTHONPATH} \
ctest -E broken ${TEST_FLAGS} \
)
@ ( if [[ "${CODECOV}" == "1" ]] ; then \
@@ -325,10 +308,10 @@ clean:
realclean: clean
${CMAKE} -E remove_directory ${dist_dir}
# 'make nuke' blows away the build and dist areas for all platforms
# DEPRECATED: use 'make realclean'
nuke:
${CMAKE} -E remove_directory ${top_build_dir}
${CMAKE} -E remove_directory ${top_dist_dir}
${CMAKE} -E remove_directory ${build_dir}
${CMAKE} -E remove_directory ${dist_dir}
#########################################################################
@@ -345,7 +328,6 @@ help:
@echo " make profile Build and install for profiling"
@echo " make clean Remove the temporary files in ${build_dir}"
@echo " make realclean Remove both ${build_dir} AND ${dist_dir}"
@echo " make nuke Remove ALL of build and dist (not just ${platform})"
@echo " make test Run tests"
@echo " make testall Run all tests, even broken ones"
@echo " make clang-format Run clang-format on all the source files"
@@ -354,9 +336,8 @@ help:
@echo " C++ compiler and build process:"
@echo " VERBOSE=1 Show all compilation commands"
@echo " STOP_ON_WARNING=0 Do not stop building if compiler warns"
@echo " OSL_SITE=xx Use custom site build mods"
@echo " MYCC=xx MYCXX=yy Use custom compilers"
@echo " CMAKE_CXX_STANDARD=14 Compile in C++14 mode (default is C++11)"
@echo " CMAKE_CXX_STANDARD=17 C++ standard to build with (default is 17)"
@echo " USE_LIBCPLUSPLUS=1 For clang, use libc++"
@echo " GLIBCXX_USE_CXX11_ABI=1 For gcc, use the new string ABI"
@echo " EXTRA_CPP_ARGS= Additional args to the C++ command"
@@ -376,10 +357,9 @@ help:
@echo " if found. And you can hint where to find it with Foo_ROOT=path"
@echo " Note that it is case sensitive!"
@echo " Finding and Using Dependencies:"
@echo " BOOST_ROOT=path Custom Boost installation"
@echo " USE_QT=0 Skip anything that needs Qt"
@echo " LLVM-related options:"
@echo " LLVM_VERSION=7.0 Specify which LLVM version to use"
@echo " LLVM_VERSION=19.0 Specify which LLVM version to use"
@echo " LLVM_DIRECTORY=xx Specify where LLVM lives"
@echo " LLVM_NAMESPACE=xx Specify custom LLVM namespace"
@echo " LLVM_STATIC=1 Use static LLVM libraries"
@@ -390,11 +370,15 @@ help:
@echo " USE_FAST_MATH=1 Use faster, but less accurate math (set to 0 for libm defaults)"
@echo " OSL_BUILD_TESTS=0 Don't build unit tests, testshade, testrender"
@echo " OSL_BUILD_SHADERS=0 Don't build any shaders"
@echo " OSL_BUILD_MATERIALX=1 Build MaterialX shaders"
@echo " USE_SIMD=arch Build with SIMD support (comma-separated choices:"
@echo " 0, sse2, sse3, ssse3, sse4.1, sse4.2, f16c,"
@echo " avx, avx2, avx512f)"
@echo " USE_OPTIX=1 Build the OptiX test renderer"
@echo " OSL_USE_OPTIX=1 Build the OptiX test renderer"
@echo " USE_BATCHED=targets Build batched SIMD execution of shaders for (comma-separated choices:"
@echo " 0, b4_SSE2, b8_AVX, b8_AVX2, b8_AVX2_noFMA,"
@echo " b8_AVX512, b8_AVX512_noFMA,"
@echo " b16_AVX512, b16_AVX512_noFMA)"
@echo " VEC_REPORT=0 Generate compiler vectorization reports"
@echo " make test, extra options:"
@echo " TEST=regex Run only tests matching the regex"
@echo ""
+217 -82
View File
@@ -1,17 +1,15 @@
<div align="center">
<img src="https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/Figures/osl-short.png" width=256 height=128>
<img src="ASWF/logos/openshadinglanguage-stacked-Shaded.png">
<!-- <H1>Open Shading Language</H1> -->
</div>
[![Open Shading Language Reel 2020](http://img.youtube.com/vi/nmwMz1YnGPA/0.jpg)](https://www.youtube.com/watch?v=nmwMz1YnGPA "Open Shading Language Reel 2020")
Open Shading Language
=====================
Build status:
[![Build Status](https://github.com/imageworks/OpenShadingLanguage/workflows/CI/badge.svg)](https://github.com/imageworks/OpenShadingLanguage/actions)
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://github.com/imageworks/OpenShadingLanguage/LICENSE)
[![Build Status](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/workflows/CI/badge.svg)](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/actions)
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/LICENSE.md)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3061/badge)](https://bestpractices.coreinfrastructure.org/projects/3061)
[![Documentation Status](https://readthedocs.org/projects/open-shading-language/badge/?version=main)](https://open-shading-language.readthedocs.io/en/main/?badge=main)
Introduction
@@ -38,7 +36,7 @@ renderers used for high-end VFX and animation work. For a full list of films
and products, see the [filmography](#where-osl-has-been-used).
The OSL code is distributed under the
["New/3-clause BSD" license](https://github.com/imageworks/OpenShadingLanguage/LICENSE),
["New/3-clause BSD" license](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/LICENSE.md),
and the documentation under the [Creative Commons Attribution 4.0 International
License](https://creativecommons.org/licenses/by/4.0/). In short, you are
free to use OSL in your own applications, whether they are free or
@@ -221,13 +219,15 @@ inferred from public sources, or that we've been told is ok to list here. If
an OSL-using project is missing and it's not a secret, just email the OSL
project leader or submit a PR with edits to this file.*
Renderers and other tools with OSL support (in approximate order of
adding OSL support):
* Sony Pictures Imageworks: in-house "Arnold" renderer
### Renderers and other production tools with OSL support
(In approximate order of adding OSL support)
* [Sony Pictures Imageworks: in-house "Arnold" renderer](https://dl.acm.org/doi/10.1145/3180495)
* [Blender/Cycles](https://docs.blender.org/manual/en/dev/render/shader_nodes/osl.html)
* [Chaos Group: V-Ray](https://www.chaosgroup.com/)
* [Pixar: PhotoRealistic RenderMan RIS](https://renderman.pixar.com)
* [Isotropix: Clarisse](http://www.isotropix.com/clarisse)
* Isotropix: [Clarisse iFX](https://www.isotropix.com/products/clarisse/ifx) / [Clarisse BUiLDER](https://www.isotropix.com/products/clarisse/builder) / [Angie](https://www.isotropix.com/products/angie)
* [Autodesk Beast](http://www.autodesk.com/products/beast/overview)
* [Appleseed](http://appleseedhq.net)
* [Animal Logic: Glimpse renderer](https://www.fxguide.com/featured/a-glimpse-at-animal-logic/)
@@ -236,8 +236,15 @@ adding OSL support):
* Ubisoft motion picture group's proprietary renderer
* [Autodesk/SolidAngle: Arnold](https://www.solidangle.com/arnold/)
* [Autodesk: 3DS Max 2019](https://help.autodesk.com/view/3DSMAX/2019/ENU/?guid=__developer_3ds_max_sdk_features_rendering_osl_html)
* [Maxon: Redshift](https://www.maxon.net/en/redshift)
### Significant work using OSL, grouped by year of release date:
(Here we are considering "significant work" to mean a feature film released
theatrically or on a major streaming platform, TV/streaming series heavily
featuring visual effects or animation, or short films that have won or been
nominated for major awards.)
Films using OSL (grouped by year of release date):
* **(2012)**
Men in Black 3, The Amazing Spider-Man, Hotel Transylvania
* **(2013)**
@@ -272,6 +279,7 @@ Films using OSL (grouped by year of release date):
Ghostbusters,
Star Trek Beyond,
Suicide Squad,
Kubo and the Two Strings,
Kingsglaive: Final Fantasy XV,
Storks,
Miss Peregrine's Home for Peculiar Children,
@@ -306,7 +314,7 @@ Films using OSL (grouped by year of release date):
* **(2018)**
Peter Rabbit,
Black Panther,
Annnihilation,
Annihilation,
Red Sparrow,
Pacific Rim Uprising,
Avengers Infinity War,
@@ -332,7 +340,7 @@ Films using OSL (grouped by year of release date):
The Kid Who Would Be King,
Alita: Battle Angel,
Lego Movie 2,
Lucky 13,
Lucky 13 (Love, Death, and Robots),
Captain Marvel,
Triple Frontier,
Avengers: Endgame,
@@ -347,104 +355,232 @@ Films using OSL (grouped by year of release date):
Angry Birds 2,
The Art of Racing in the Rain,
Secret Life of Pets,
The Mandalorian,
The Mandalorian (S1),
The Dark Crystal: Age of Resistance,
The King,
Jumanji: The Next Level,
Richard Jewell,
Game of Thrones,
Lost in Space,
* **(2020 / upcoming)**
Game of Thrones (S8),
Lost in Space (S1),
Togo,
Missing Link
* **(2020)**
Underwater,
Birds of Prey,
Onward,
Bloodshot,
Greyhound,
The Old Guard,
Mulan,
Tenet,
The New Mutants,
Artemis Fowl,
The Eight Hundred,
Over the Moon,
Wonder Woman 1984,
Soul,
The Mandalorian (S2),
The Boys (S2),
Umbrella Academy (S2)
* **(2021)**
Chaos Walking,
Peter Rabbit 2: The Runaway,
The Falcon and the Winder Soldier,
Secret Magic Control Agency,
Zack Snyder's Justice League,
The Mitchells vs the Machines,
Jupiter's Legacy,
Luca,
F9,
Vivo,
Jungle Cruise,
Cinderella,
Dune,
No Time To Die,
Ron's Gone Wrong,
Venom: Let There Be Carnage,
Last Night in Soho,
Ghostbusters: Afterlife,
Spider-Man 3: No Way Home,
Matrix Resurrections,
Sing 2
* **(2022)**
Hotel Transylvania 4: Transformania,
Death on the Nile,
Uncharted,
Turning Red,
The Adam Project,
Doctor Strange in the Multiverse of Madness,
Love, Death, and Robots: In Vaulted Halls Entombed,
Jurassic World: Dominion,
Lightyear,
Thor: Love and Thunder,
The Sea Beast,
DC League of Super Pets,
Minions: Rise of Gru,
Bullet Train,
Slumberland,
Glass Onion,
Puss in Boots: The Last Wish,
Archive 81 (series),
Moon Night (series),
Obi-Wan Kenobi (series),
The Boys (S3),
Andor (S1),
Troll,
She-Hulk (series)
* **(2023)**
Ant-Man and the Wasp: Quantumania,
The Mandalorian S3,
The Magician's Elephant,
Super Mario Bros Film,
Guardians of the Galaxy 3,
Spider-Man: Across the Spider-Verse,
Elemental,
Indiana Jones and the Dial of Destiny,
Nimona,
The Marvels,
Leo,
The Boys (S4),
The Moon,
Migration,
* **(2024)**
Ghostbusters: Frozen Empire,
The Garfield Movie,
Inside Out 2,
Red One,
Dream Productions (series),
The Lord of the Rings: The Rings of Power (S2),
* **(2025)**
Win or Lose (series),
A Minecraft Movie,
K-Pop Demon Hunters,
Fountain of Youth,
Elio,
Fantastic Four: First Steps,
Heads of State,
Bad Guys 2,
In Your Dreams,
The Last of Us (S2),
Murderbot (S1),
* **(2026 / upcoming)**
GOAT,
Hoppers,
Project Hail Mary,
...
Building and Installation
-------------------------
👷 Building and Installation
----------------------------
Please read the [INSTALL.md](INSTALL.md) file for detailed instructions on
how to build and install OSL.
Documentation
-------------
💁 Documentation
----------------
The OSL language specification can be found at
[src/doc/osl-languagespec.pdf](src/doc/osl-languagespec.pdf) (in a source
distribution) or in the share/doc/OSL/osl-languagespec.pdf file of an
installed binary distribution.
The OSL language specification can be found at [OSL Documentation on ReadTheDocs](https://docs.openshadinglanguage.org)
There is also a [PDF version](https://readthedocs.org/projects/open-shading-language/downloads/pdf/stable/).
For those interested in learning to program OSL shaders there is the
[Siggraph 2024 Course](https://dl.acm.org/doi/proceedings/10.1145/3664475),
[Shader Writing in Open Shading Language](https://dl.acm.org/doi/10.1145/3664475.3664534)
and its companion
[Supplementary Materials](https://github.com/LaikaStudios/OSLShaderWriting),
which use RenderMan<sup>&reg;</sup> in the examples but which are primarily about writing OSL shaders.
There is also the [Shader Writing in Open Shading Language book](https://www.routledge.com/Shader-Writing-in-Open-Shading-Language-with-RenderManr-Examples/Prater/p/book/9781032421100).
This covers all the material from the Siggraph course but in far greater detail. It also includes much more information about how OSL operates and covers a much broader range of shader examples.
Contact & reporting problems
----------------------------
Simple "how do I...", "I'm having trouble", or "is this a bug" questions are
best asked on the [osl-dev developer mail
list](https://lists.aswf.io/g/osl-dev).
That's where the most people will see it and potentially be able to answer
your question quickly (moreso than a GH "issue").
Bugs, build problems, and discovered vulnerabilities that you are relatively
certain is a legit problem in the code, and for which you can give clear
instructions for how to reproduce, should be [reported as
issues](https://github.com/imageworks/OpenShadingLanguage/issues).
If confidentiality precludes a public question or issue, you may contact the
project administrator privately at [lg@imageworks.com](lg@imageworks.com),
including for security-related issues.
Contributing
------------
OSL welcomes code contributions, and nearly 50 people
have done so over the years. We take code contributions via the usual GitHub
pull request (PR) mechanism. Please see [CONTRIBUTING](CONTRIBUTING.md) for
detailed instructions.
Contacts, Links, and References
🚑 Contact & reporting problems
-------------------------------
[OSL GitHub page](https://github.com/imageworks/OpenShadingLanguage)
Simple "how do I...", "I'm having trouble", or "is this a bug" questions are
best asked on the [osl-dev developer mail list](https://lists.aswf.io/g/osl-dev).
That's where the most people will see it and potentially be able to answer
your question quickly (more so than a GH "issue"). For quick questions, you
could also try the [ASWF Slack](https://slack.aswf.io) `#openshadinglanguage`
channel.
[Read or subscribe to the OSL development mail list](https://lists.aswf.io/g/osl-dev)
A bug or build problem that you are relatively certain is a legit problem in
the code, and **for which you can give clear instructions for how to
reproduce**, should be [reported as
issues](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues).
Email the lead architect: lg AT imageworks DOT com
To report a security vulnerability that is serious enough that it should not
be discussed publicly until a patch is ready, please file a GitHub [security
advisory](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/security/advisories/new).
[Most recent PDF of the OSL language specification](https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf
)
If any other issue requires confidentiality that precludes a public question
or issue, you may contact the project administrator privately at
[lg@larrygritz.com](lg@larrygritz.com).
[OSL home page at SPI](http://opensource.imageworks.com/?p=osl)
[Sony Pictures Imageworks main open source page](http://opensource.imageworks.com)
🔧 Contributing and developer documentation
-------------------------------------------
OSL welcomes code contributions, and nearly 50 people have done so over the
years. We take code contributions via the usual GitHub pull request (PR)
mechanism.
* [CONTRIBUTING](CONTRIBUTING.md) has detailed instructions about the
development process.
* [AI Policy](docs/dev/AI_Policy.md) decribes our policies on AI coding
assistance tools.
* [RELEASING](docs/dev/RELEASING.md) explains our policies and procedures for
making releases. We have a major, possibly-compatibility-breaking, release
annually in September/October, and minor bug fix and safe feature addition
release at the beginning of every month.
* Other developer documentation is in the [docs/dev](docs/dev) directory.
* You may also have luck learning a bit about the organization and
architecture of the project by reading the [DeepWiki Analysis of
OpenShadingLanguage](https://deepwiki.com/AcademySoftwareFoundation/OpenShadingLanguage).
But take it with a grain of salt -- like any LLM-generated summary, there
may be inaccuracies lurking.
☎️ Communications channels and additional resources
---------------------------------------------------
* [OSL home page](http://openshadinglanguage.org)
* [OSL GitHub page](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage)
* [OSL Documentation on ReadTheDocs](https://docs.openshadinglanguage.org)
* [Developer mail list](https://lists.aswf.io/g/osl-dev)
* [ASWF Slack](https://slack.aswf.io) (look for the `#openshadinglanguage` channel)
* Biweekly Technical Steering Committee (TSC) Zoom meetings are on the [ASWF
Calendar](https://calendar.openshadinglanguage.org) (click on the OSL
meeting entries, every second Monday, to get the Zoom link, anyone may join)
If you want to contribute code back to the project, you'll need to
sign [a Contributor License Agreement](http://opensource.imageworks.com/cla/).
Credits
-------
The current project leadership is documented in the GOVERNANCE.md file.
The current project leadership is documented in the
[Governance](GOVERNANCE.md) file.
Many people have contributed features, bug fixes, and other changes to OSL
over the years: Steve Agland, Shane Ambler, Martijn Berger, Farchad
Bidgolirad, Nicholas Bishop, Solomon Boulos, Stefan Bruens, Stefan Büttner,
Matthaus G. Chajdas, Alejandro Conty, Thomas Dinges, Luke Emrose, Louis
Feng, Mark Final, Henri Fousse, Syoyo Fujita, Tim Grant, Larry Gritz, Derek
Haase, Sven-Hendrik Haase, John Haddon, Daniel Heckenberg, Thiago Ize, Matt
Johnson, Ronan Keryell, Chris Kulla, Elvic Liang, Max Liani, Adam Martinez,
John Mertic, Bastien Montagne, Steena Monteiro, Alexis Oblet, Erich Ocean,
Mikko Ohtamaa, Jino Park, Alexei Pawlow, Jay Reynolds, Declan Russell,
Patrick Scheibe, Alex Schworer, Jonathan Scruggs, Sergey Sharybin, Cliff
Stein, Stephan Steinbach, Esteban Tovagliari, Brecht Van Lommel, Alexander
von Knorring, Alex Wells, Roman Zulak. (Listed alphabetically; if we've left
anybody out, it is inadvertent, please let us know.)
Bidgolirad, Alexandru Biscoveanu, Nicholas Bishop, Curtis Black, Rasmus
Bonnedal, Solomon Boulos, Stefan Bruens, Stefan Büttner, Matthaus G. Chajdas,
Clark Chen, Mehdi Chinoune, Alejandro Conty, Damien Courtois, Dieter De Baets,
Thomas Dinges, Daniel Dresser, Mads Drøschler, Peter Ellerington, Luke Emrose,
Louis Feng, Mark Final, Henri Fousse, Stephen Friedman, Syoyo Fujita, Alex
Fuller, Tim Grant, Larry Gritz, Nicolas Guiard, Euan Haahr, Derek Haase,
Sven-Hendrik Haase, John Haddon, Niklas Harrysson, Daniel Heckenberg, Chris
Hellmuth, Christian Heusel, Adrien Herubel, Dan Horák, Thiago Ize, Matt
Johnson, Ronan Keryell, Chris Kulla, Elvic Liang, Max Liani, Sv. Lockal, Silvia Lopez,
Adam Martinez, John Mertic, Bastien Montagne, Steena Monteiro, Patrick Mours,
Alexis Oblet, Erich Ocean, Mikko Ohtamaa, Jean-Francois Panisset, Jino Park,
Alexei Pawlow, Mitch Prater, Jay Reynolds, Declan Russell, Benoit Ruiz,
Patrick Scheibe, Alex Schworer, Jonathan Scruggs, Sergey Sharybin, Mark
Sisson, Sandip Shukla, Alexey Smolenchuk, Cliff Stein, Stephan Steinbach, Taraash, Luya
Tshimbalanga, Esteban Tovagliari, Brecht Van Lommel, Thibault Vergne,
Alexander von Knorring, Aidan Welch, Alex Wells, Roman Zulak. (Listed
alphabetically; if we've left anybody out, it is inadvertent, please let us
know.)
We cannot possibly express sufficient gratitude to the managers at Sony
Pictures Imageworks who allowed this project to proceed, supported it
@@ -469,9 +605,8 @@ developers and users at other VFX and animation studios.
The OSL implementation depends upon several other open source packages,
all with compatible licenses:
* [OpenImageIO (c) Larry Gritz, et al](http://www.openimageio.org)
* [Boost - various authors](http://www.boost.org)
* [IlmBase (c) Industrial Light & Magic](http://www.openexr.com)
* [OpenImageIO](http://www.openimageio.org)
* [IlmBase](http://www.openexr.com)
* [LLVM Compiler Infrastructure](http://llvm.org)
OSL's documentation incorporates parts of [Markdeep](https://casual-effects.com/markdeep/)
+74
View File
@@ -0,0 +1,74 @@
# Security Policy
## Supported Versions
This gives guidance about which branches are supported with patches to
security vulnerabilities.
| Version / branch | Supported |
| --------- | ---------------------------------------------------- |
| main | :white_check_mark: :construction: ALL fixes immediately, but this is a branch under development with a frequently unstable ABI and occasionally unstable API. |
| 1.15.x | :white_check_mark: All fixes that can be backported without breaking ABI compatibility. New tagged releases monthly. |
| 1.14.x | :warning: Only the most critical fixes, only if they can be easily backported. |
| <= 1.13.x | :x: No longer receiving patches of any kind. |
## Reporting a Vulnerability
If you think you've found a potential vulnerability in OSL, please
report it to the maintainers. Include detailed steps to reproduce the issue,
and any other information that could aid an investigation.
The best way to report a vulnerability is to file a GitHub [security
advisory](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/security/advisories/new).
If that is not possible, it is also fine to email your report to
security@openshadinglanguage.org. Only the project administrators have access
to these reports.
Our policy is to respond to vulnerability reports within 14 days, and to
address critical security vulnerabilities rapidly and post patches as quickly
as possible.
## What do we consider a vulnerability?
We only consider a situation to be a security vulnerability if an untrusted
party can plausibly trigger the flaw through normal product inputs (for
example, a maliciously crafted oso file that might compromise a renderer when
loaded). We do not support requesting a CVE for API-only or caller-controlled
failures with no realistic adversarial path.
The OSL project adopts the same security stance as many other language
compilers: we believe that shaders that will be JITed and executed are by
definition *trusted inputs*, and should not be accepted from untrusted
sources. A shader that causes damage when it faithfully executes is not a
vulnerability per se. In rare circumstances, we might consider it a
vulnerability if a maliciously crafted shader can cause the renderer or OSL
library to do something damaging that is different from what the shader text
implies.
Flaws whose root cause lies in a dependency should be reported and fixed
upstream; the upstream project owns the CVE when one is warranted.
## Other security features
### Signed tags
Starting with OSL 1.14.3.0, we cryptographically sign release tags.
To verify a tag, you can use the `git tag -v` command, which will check
the signature against the public key that is included in the repository.
For example,
```bash
git tag -v v1.14.3.0
```
## Outstanding Security Issues
None known
## History of CVE Fixes
None to date
+315
View File
@@ -0,0 +1,315 @@
See [LICENSE.md](LICENSE.md) for the main open source license of original
code written for the Open Shading Language project.
The remainder of this file reproduces the open source licensing details
of other projects that have been imported, incorporated into, or derived
into parts of OSL.
In no particular order:
-------------------------------------------------------------------------
BSD 3-Clause License
SPDX-License-Identifier: BSD-3-Clause
* OpenEXR, Copyright (c) Contributors to the OpenEXR Project.
https://github.com/AcademySoftwareFoundation/OpenEXR
OSL replicates and modifies several files from the "Imath" portion of
OpenEXR. These are all found in src/include/OSL/Imathx.
* Qt, Copyright (c) The Qt Company Ltd.
http://doc.qt.io/
Some widget code in src/osltoy is copied and/or derived from example code
for Qt.
* Highlight.js
https://github.com/highlightjs/highlight.js/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
SPDX-License-Identifier: BSD-2-Clause
* Markdeep
https://casual-effects.com/markdeep
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------
Public domain
* The simplex noise implementation is Copyright (c) Stefan Gustavson.
It bears the following notice:
This library is public domain software, released by the author
into the public domain in February 2011. You may do anything
you like with it. You may even remove all attributions,
but of course I'd appreciate it if you kept my name somewhere.
-------------------------------------------------------------------------
Apache 2.0 License.
SPDX-License-Identifier: Apache-2.0
* OpenImageIO Copyright (c) Contributors to the OpenImageIO Project.
https://github.com/AcademySoftwareFoundation/OpenImageIO
Many bits of code flow back and forth between OIIO and OSL, especially
parts of the CMake build system.
* ninjatracing.py utility for build profiling is Apache-2.0 licensed
and comes from https://github.com/nico/ninjatracing.
Copyright 2018 Nico Weber.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
Modified Apache 2.0 License
Universal Scene Description
Copyright Pixar.
Portions of the build_osl.py were derived from scripts distributed with USD.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor
and its affiliates, except as required to comply with Section 4(c) of
the License and to reproduce the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
-------------------------------------------------------------------------
If we have left anything out, it is unintentional. Please let us know.
-200
View File
@@ -1,200 +0,0 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
clone_depth: 10
version: '{branch}-{build}'
# Disable Appveyor's test discovery which is not used
test: off
branches:
only:
- master
- release
- appveyor
- /RB-/
- /lg-/
skip_tags: true
build:
parallel: true
verbosity: detailed
platform:
- x64
# - x86
configuration:
#- Debug
- Release
environment:
matrix:
- TOOLSET: msvc14
os:
- Visual Studio 2015
cache:
- C:\projects\OSLdeps -> appveyor.yml
# The -> means that the cache dir is discarded if appveyor.yml has changed
before_build:
- ps: |
$OSL_INSTALL_BEGIN=Get-Date
Write-Output "Configuration: $env:CONFIGURATION"
Write-Output "Platform: $env:PLATFORM"
ls C:\Program Files\LLVM
Get-ChildItem Env:
[Array]$OSL_BUILD_FLAGS = "--", "/nologo", "/verbosity:minimal";
$DWN_DIR = "C:\projects\OSLdownloads"
$DEP_DIR = "C:\projects\OSLdeps"
$BOOST_ROOT = "C:\Libraries\boost_1_69_0"
$PYTHON_DIR = "C:\Python27"
$LLVM_DIR = "C:\Program Files\LLVM\bin"
#$LLVM_DIR = "$DEP_DIR"
$env:Path += ";$DEP_DIR\lib;$DEP_DIR\bin"
$OSL_INT_DIR = "build\windows$env:PLATFORM"
# RDP into the build-bot to try some stuff out
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# Choose the VisualStudio generator
$GENERATOR = switch ($env:TOOLSET)
{
"msvc14" {"Visual Studio 14 2015"}
"msvc12" {"Visual Studio 12 2013"}
"msvc11" {"Visual Studio 11 2012"}
"msvc10" {"Visual Studio 10 2010"}
}
# Final setup based on 64 or 32 bit
if ($env:PLATFORM -eq "x64") {
$GENERATOR = "$GENERATOR Win64"
$PYTHON_DIR = "$PYTHON_DIR-x64"
$BOOST_LIBRARYDIR = "$BOOST_ROOT\lib64-msvc-14.0"
} else {
$BOOST_LIBRARYDIR = "$BOOST_ROOT\lib32-msvc-14.0"
}
# Always create the download directory
md $DWN_DIR -Force | Out-Null;
# If the dependency directory exists/cached, use it
if(!(Test-Path -Path $DEP_DIR )){
md $DEP_DIR -Force | Out-Null; cd $DEP_DIR
md $DEP_DIR\include -Force | Out-Null; cd $DEP_DIR
md $DEP_DIR\lib -Force | Out-Null; cd $DEP_DIR
cd $DWN_DIR
nuget install libtiff-$env:TOOLSET-$env:PLATFORM-master -Version 4.0.6.85 -Source https://ci.appveyor.com/nuget/libtiff-i3h8tqqy7o7b
mv .\libtiff*\*.h $DEP_DIR\include\
mv .\libtiff*\*.lib $DEP_DIR\lib\
mv .\libtiff*\*.dll $DEP_DIR\lib\
nuget install libpng-$env:TOOLSET-$env:PLATFORM-master -Version 1.6.18.44 -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48
mv .\libpng*\*.h $DEP_DIR\include\
mv .\libpng*\*.lib $DEP_DIR\lib\
mv .\libpng*\*.dll $DEP_DIR\lib\
nuget install libjpeg-$env:TOOLSET-$env:PLATFORM-master -Version 1.4.80.21 -Source https://ci.appveyor.com/nuget/libjpegturbo-o6k4js4y7pjw
mv .\libjpeg*\*.h $DEP_DIR\include\
mv .\libjpeg*\*.lib $DEP_DIR\lib\
mv .\libjpeg*\*.dll $DEP_DIR\lib\
nuget install freetype
mv .\freetype.2.8.0.1\build\native\include\* $DEP_DIR\include\
mv .\freetype.2.8.0.1\build\native\lib\$env:PLATFORM\v140\dynamic\$env:CONFIGURATION\*.lib $DEP_DIR\lib\
mv .\freetype.redist.2.8.0.1\build\native\bin\$env:PLATFORM\v140\dynamic\$env:CONFIGURATION\*.dll $DEP_DIR\lib\
# ZLib
cd $DWN_DIR
Start-FileDownload https://github.com/madler/zlib/archive/v1.2.8.tar.gz
tar -xzf v1.2.8.tar.gz; cd zlib-1.2.8; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR"
cmake --build . --config $env:CONFIGURATION --target INSTALL $OSL_BUILD_FLAGS
# IlmBase
cd $DWN_DIR
Start-FileDownload http://download.savannah.nongnu.org/releases/openexr/ilmbase-2.2.1.tar.gz
tar -xzf ilmbase-2.2.1.tar.gz ; cd ilmbase* ; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DCMAKE_CXX_FLAGS=" /W1 /EHsc /DWIN32=1 "
cmake --build . --config $env:CONFIGURATION --target INSTALL $OSL_BUILD_FLAGS
# LLVM
# This shouldn't be necessary, we use the pre-installed LLVM
# cd $DWN_DIR
# git clone --depth 10 --branch release_40 https://github.com/llvm-mirror/llvm.git
# cd llvm; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
# cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DLLVM_TARGETS_TO_BUILD="X86"
# cmake --build . --config $env:CONFIGURATION --target INSTALL $OSL_BUILD_FLAGS
# OpenEXR
cd $DWN_DIR
Start-FileDownload http://download.savannah.nongnu.org/releases/openexr/openexr-2.2.1.tar.gz
tar -xzf openexr-2.2.1.tar.gz ; cd openexr* ; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DILMBASE_PACKAGE_PREFIX="$DEP_DIR" -DCMAKE_CXX_FLAGS=" /W1 /EHsc /DWIN32=1 "
cmake --build . --config $env:CONFIGURATION --target INSTALL $OSL_BUILD_FLAGS
}
# Always do this
cinst winflexbison
build_script:
- ps: |
# OpenImageIO
$env:OpenImageIO_ROOT = "C:\projects\oiio"
$env:FREETYPE_DIR = "$DEP_DIR"
$FREETYPE_LIBRARY = "$DEP_DIR\lib\freetype28.lib"
cd $DWN_DIR
git clone --depth 10 https://github.com/OpenImageIO/oiio.git oiiosrc
cd .\oiiosrc; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_INSTALL_PREFIX="$env:OpenImageIO_ROOT" -DCMAKE_PREFIX_PATH="$DEP_DIR;$BOOST_ROOT" -DBOOST_LIBRARYDIR="$BOOST_LIBRARYDIR" -DFREETYPE_LIBRARY="$FREETYPE_LIBRARY" -DUSE_PYTHON=OFF -DOIIO_BUILD_TESTS=OFF -DUSE_NUKE=OFF
cmake --build . --config $env:CONFIGURATION --target INSTALL $OSL_BUILD_FLAGS
# Build OSL
cd $env:APPVEYOR_BUILD_FOLDER
md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$env:OpenImageIO_ROOT;$DEP_DIR;$BOOST_ROOT;$LLVM_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DLLVM_DIRECTORY="$LLVM_DIR" -DLLVM_STATIC=ON -DOpenImageIO_ROOT="$env:OpenImageIO_ROOT" -DBOOST_LIBRARYDIR="$BOOST_LIBRARYDIR" -DFLEX_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison\tools\win_flex.exe" -DBISON_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe" -DUSE_QT=OFF -DBUILD_SHARED_LIBS=ON -DLINKSTATIC=OFF
# OSL's CMake should probably be handling Windows config better...
$OSL_BUILD_DIR = "$env:APPVEYOR_BUILD_FOLDER\$OSL_INT_DIR"
$env:OSL_ROOT = "$env:APPVEYOR_BUILD_FOLDER\src"
$env:OIIO_LIBRARY_PATH = "$OSL_BUILD_DIR\src\osl.imageio\$env:CONFIGURATION"
$env:Path += ";$OSL_BUILD_DIR\src\oslc\$env:CONFIGURATION"
$env:Path += ";$OSL_BUILD_DIR\src\oslinfo\$env:CONFIGURATION"
$env:Path += ";$OSL_BUILD_DIR\src\liboslcomp\$env:CONFIGURATION"
$env:Path += ";$OSL_BUILD_DIR\src\liboslexec\$env:CONFIGURATION"
$env:Path += ";$OSL_BUILD_DIR\src\liboslnoise\$env:CONFIGURATION"
$env:Path += ";$OSL_BUILD_DIR\src\liboslquery\$env:CONFIGURATION"
$env:Path += ";$env:OpenImageIO_ROOT\lib;$env:OpenImageIO_ROOT\bin"
$env:Path += ";$BOOST_LIBRARYDIR"
cmake --build . --config $env:CONFIGURATION $OSL_BUILD_FLAGS
$OSL_BUILD_END=Get-Date
if(($OSL_BUILD_END-$OSL_INSTALL_BEGIN).TotalMinutes -gt 50) {
# Change to appveyor.yml means the cache needs to be rebuilt leaving
# us with not enough time to run the tests.
echo "OSL tests skipped in favor of uploading dependency cache"
# Echo to build log and Appveyors message page
Add-AppveyorMessage -Message "OSL tests skipped in favor of uploading dependency cache" -Category Warning
} else {
# Test OSL
ctest -C $env:CONFIGURATION --output-on-failure
}
#init:
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#on_failure:
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+27
View File
@@ -0,0 +1,27 @@
# Documentation
The OSL Documentation Project is a work in progress.
The plan is to adopt the OCIO Documentation Project's methodology for maintaining and building documentation of various kinds as it becomes the blueprint for the ASWF.
There is much work to be done here.
Of particular interest are these topics. Please consider adding any information you might have about any of these to the repo:
* Any material at all for people learning to write OSL shaders (beyond the formal language spec, which is not intended to be a tutorial or cookbook for writing shaders).
* Example .osl code and/or .h files that are:
1. Generally useful, but do not warrant inclusion into the OSL source itself.
2. Tutorial in nature.
* Robust installation or build instructions for Windows and macOS.
* Guide for how to integrate OSL into an application such as a renderer.
If you have some relevant content and you'd like to discuss its inclusion, please use the OSL Documentation discussion:
[OSL Documentation](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/discussions/1324)
or alternatively, you may post to:
https://lists.aswf.io/g/osl-dev/topics<br>
osl-dev@lists.aswf.io
You may also simply submit a PR.
@@ -0,0 +1,112 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the Open Shading Language Project. -->
Inlining Options for OptiX and CUDA
===================================
When compiling shaders for OptiX and CUDA (and in general), there is a tradeoff
between compile speed and shade-time performance. The LLVM optimizer generally
does a good job of balancing these concerns, but there might be cases where a
renderer can give additional hints to the optimizer to tip the balance one way
or the other.
Aggressive inlining can increase the run-time performance, but can negatively
impact the compile speed. Inlining can be very helpful with small functions
where the function call overhead tends to dwarf the useful instructions, so it
is important to inline such functions when possible.
Choosing to __not__ inline certain functions (e.g., very large noise functions)
allows them to be excluded from the module prior to running the LLVM optimizer
and JIT engine, which can greatly improve the compile time. This is particularly
beneficial when a function is not likely to be inlined anyway; removing such
large functions from the module prior to optimization can speed up compilation
considerably without affecting the generated PTX.
ShadingSystem Attributes
------------------------
There are a number of `ShadingSystem` attributes to help control the inlining
behavior. The default settings should work well in most circumstances, but they
can be adjusted to favor compile speed over shade-time performance, or vice
versa.
* `optix_no_inline_thresh`: Don't inline functions greater-than or equal-to the
threshold. This allows them to be excluded from the module prior to
optimization, which reduces the size of module and can greatly speed up the
optimization and JIT stages.
* `optix_force_inline_thresh`: Force inline functions less-than or equal-to the
threshold. This tends to be most helpful with relatively low values, < 30.
* `optix_no_inline`: Don't inline any functions. Offers the best compile times
at the expense of shade-time performance. This option is not recommended, but is
included for benchmarking and tuning purposes.
* `optix_no_inline_layer_funcs`: Don't inline the shader layer functions. This
can moderately improve compile times at the expense of shade-time performance.
* `optix_merge_layer_funcs`: Allow layer functions that are only called once to
be merged into their caller, even if `optix_no_inline_layer_funcs` is set. This
can help restore some of the shade-time performance lost by enabling
`optix_no_inline_layer_funcs`.
* `optix_no_inline_rend_lib`: Don't inline any functions defined in the
renderer-supplied `rend_lib` module. As an alternative, the renderer can simply
not supply the LLVM bitcode for the `rend_lib` module to the `ShadingSystem`.
Inline/Noinline Function Registration
-------------------------------------
In addition to the `ShadingSystem` attributes, individual functions can be
registered with the `ShadingSystem` as `inline` or `noinline`. Functions can
be unregistered to restore the default inlining behavior. This registration
takes precedence over the `ShadingSystem` inlining attributes, which allows
very fine-grained control when needed.
```C++
// Register
shadingsys->register_inline_function(ustring("osl_abs_ff"));
shadingsys->register_noinline_function(ustring("osl_gabornoise_dfdfdf"));
// Unregister
shadingsys->unregister_inline_function(ustring("osl_abs_ff"));
shadingsys->unregister_noinline_function(ustring("osl_gabornoise_dfdfdf"));
```
It might be best to prefer the `ShadingSystem` attributes to control the inlining
behavior, and to strategically register functions when it is known to be
beneficial through benchmarking and profiling.
Tuning and Analysis
-------------------
We have added a Python script (`src/build-scripts/analyze-ptx.py`) to help
identify functions that might be good candidates for inlining/noinling. This
script will generate a summary of the functions in the input PTX file, with a
list of all functions and their sizes in CSV format. It will also generate a
graphical reprensentation of the callgraph in DOT and PDF format.
An example tuning workflow might include the following steps:
1. Run `analyze-ptx.py` on the "shadeops" and "rend_lib" PTX files to generate
a list of the functions contained in those modules.
```bash
$ analyze_ptx.py shadeop_cuda.ptx
$ analyze_ptx.py rend_lib_myrender.ptx
```
2. Run `analyze-ptx.py` on the generated PTX for a representative shader:
```bash
$ analyze_ptx.py myshader.ptx
```
3. View the summary file (`myshader-summary.txt`) and the callgraph
(`myshader-callgraph.gv`) to deterimine which library functions were _not_
inlined. They will appear as boxes with a dashed outline in the callgraph.
In particular, be on the lookout for trivial functions (e.g., `osl_floor_ff`)
which have not been inlined. If such functions appear, that might be a sign
that the inline thresholds need to be adjusted, or that it might be
beneficial to register specific functions.
+3
View File
@@ -0,0 +1,3 @@
# Application Integration
Contains content related to integrating OSL into a renderer, or any application for that matter, using the C API.
+21
View File
@@ -0,0 +1,21 @@
# Build and Install Instructions
---
#### Copyright Contributors to the Open Shading Language project.
#### SPDX-License-Identifier: CC-BY-4.0
---
Contains information about building and installing OSL.
## Windows
Method #1:
https://github.com/debaetsd/OSL_build
Method #2:
Go through `docs/build_install/windows/Readme.md` and using batch files to install OSL cleanly!
## macOS
+311
View File
@@ -0,0 +1,311 @@
## **Building, Using and Debugging OSL in Windows**
---
#### Copyright Contributors to the Open Shading Language project.
#### SPDX-License-Identifier: CC-BY-4.0
---
### **Contents**
1. Introduction
- Experimental
- My Setup
- Inspiration
2. Preparing Environment
- Cleaning Up the PATH
- Set-Up needed Environment Variables
- Set Flags based on your needs
3. Building (Release, Debug)
- Running the code based on your config
- Be Patient
- Errors
4. Running
5. Development in Windows
---
### **1. Introduction**
This document is prepared for those who have problem in building OSL in Windows OS, this is completely custom setup. And it is developing to make it compatible with all situations.
(`Disclaimer:` This Process is completely Experimental and it worked on my system, maybe you get error with changing some configs, during this process).
At a first glance it seems to be complicated, but it is very easy to do, bare with me.
So it would be great to share our experiences to reach to best way of building in Windows (and of course other Operating Systems) to save our time and energy to focus on OSL development and OSL Shader writing.
### **1.1 Experimental**
After a lot of efforts on manual building OSL on Windows, Finally I found a clean way to do that, I explained every steps I did, I hope it works for you too. This method is stricktly related to Environment Variables you create and Flags you set to the command and need patient and hard disk.
I've built OSL with minimal needed packages, for extra packages, they should be set as flag (**script is under development**)
### **1.2 My Setup**
This is my setup I have on my PC for building OSL, so you need to install some software before start.
My System and Setup Configuration:
**OS:** Windows 10 Home
**Compiler:** Microsoft Visual Studio 2019
**Git:** 2.28.0
**Python:** 3.7 tip: disable python App Installer in Manage `App Execution Aliases (Windows 10)`
**Cmake:** 3.18.4
**Qt:** 5.15.0
**NASM:** 2.15.05 for JPEG
**OpenShadingLanguage:** cloned from latest master branch
**LLVM:** 11.0.0 C++ is set on C++14
**CLANG:** 11.0.0 C++ is set on C++14
**WinFlexBison:** 2.5.22
**Zlib:** 1.2.11
**JPEG:** 2.0.5
**TIFF:** 4.1.0
**PNG:** 1.6.35
**PyBind11:** 2.6.0
**LibRaw:** 0.20.2
**OpenImageIO:** 2.1.20
**OpenColorIO:** 1.1.0
**OpenEXR/**IlmBase: 2.5.3
**GLUT:** 3.2.1 freeglut on windows (this is needed for partio) (unfortunately Partio didn't build, it has a problem) (I’ve created a PR for it in Disney github repo)
**Disney Partio:** latest from master (zip file) (Skip this for now) (I didn't build OSL with Partio)
**PugiXML:** 1.10
---
### **1.3 Inspiration**
After lots of manual building dependencies one by one and fix errors and things I got inspired by `PIXAR USD INSTALLATION METHOD` and borrowed its structure to build OSL.
so I studied its python build script and found we can use same logic for installing OSL, fortunately after changing and adding OSL needed packages and some custom setup it worked fine
It still needs some other works to make it complete for all dependencies (optional).
We will keep Pixar name on it as inspiration code (or we can keep their copyright)
You can Run the installer from: `yourpath/OpenShadingLanguage/docs/build_install/windows/build_osl.bat`
---
### **21. Preparing Environment**
There are bunch od prerequisites for building OSL that I explained in following sections.
### **2.1 Cleaning Up the PATH**
Be sure you don't have any custom item added to PATH in your global Environment Variables of Windows
You can do it:
`Start Menu > Edit the system environmment variables > Environment Variables > User Variables/System Variables`
so you should not have any path that refer to previous osl installation folders
Recommendation: remove added path for cmake, git, python, Qt, llvm
it should be clean now.
### **2.2 Set-Up needed Environment Variables**
For running batch scripts without any problem I recommend to create some base environment variables.
**Needed Environment Variables: (Key/Value based on my installation folder)**
| Env Var | Path Example |
| --------------- | ---------------------------------------------------------------------------------- |
| BASE_LOCATION | D:\madoodia\sdks |
| PYTHON_LOCATION | D:\madoodia\sdks |
| QT_LOCATION | C:\Qt\5.15.0\msvc2019_64 |
| NASM_LOCATION | C:\NASM |
| GIT_LOCATION | "C:\Program Files\Git" |
| CMAKE_LOCATION | "C:\Program Files\CMake" |
| VCVARS_LOCATION | "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build" |
|
Open `docs/build_install/windows/osl_env_vars_setup.bat` in your editor and edit paths' values based on your installation folders.
### **2.3 Set Flags based on your needs**
The main build launcher is here `docs/build_install/windows/build_osl.bat`
For now we can not assign pre-installed llvm so we have to build all together at once and put all of them in one directory.
I am working on it to see how we can use external llvm installation without error.
**Table of flags we can assign to the command**
| Flag | State | Can Use |
| ------------- | --------------- | ------- |
| --osl | Implemented | Yes |
| --python | Implemented | Yes |
| --zlib | Implemented | Yes |
| --llvm | Implemented | Yes |
| --clang | Implemented | Yes |
| --pugixml | Implemented | Yes |
| --openexr | Implemented | Yes |
| --tiff | Implemented | Yes |
| --jpeg | Implemented | Yes |
| --png | Implemented | Yes |
| --flex | Implemented | Yes |
| --bison | Implemented | Yes |
| --opencolorio | Implemented | Yes |
| --openimageio | Implemented | Yes |
| --libraw | Implemented | Yes |
| --pybind11 | Implemented | Yes |
| --Ptex | Implemented | No |
| --openvdb | Implemented | No |
| --partio | Implemented | No |
| --ffmpeg | Not-Implemented | No |
| --field3d | Not-Implemented | No |
| --opencv | Not-Implemented | No |
| --gif | Not-Implemented | No |
| --heif | Not-Implemented | No |
| --squish | Not-Implemented | No |
| --dcmtk | Not-Implemented | No |
| --webp | Not-Implemented | No |
---
### **3. Building (Release, Debug)**
We Prepared some batch files to do it for you automatically.
Based on Environment Variables you set in previous sections you can just call them and wait for it to be built and installed.
**My Method:**
- Open Powershell
- Go to: yourPath/OpenShadingLanguage/docs/build_install/windows
- Run build_osl.bat release
### **3.1 Running the code based on your config**
Based on the config (`Release` or `Debug`) that you send for installer it will create directory in `BASE_LOCATION` for you
`BASE_LOCATION/osl_release` for Release mode
`BASE_LOCATION/osl_debug` for Debug mode
**IMPORTANT:** `Good to know you can not have Release and Debug files in one directory at the same time, it makes conflict and give you weired errors. So keep them separate.`
### **3.2 Be Patient**
You should be patient because the whole process (based on your PC config) takes time between 30 minutes to 1 hour
And it takes:
**Release:** `~8Gb` of your hard disk (after installation) (Download size is `~350Mb`)
**Debug:** `~90Gb` of your hard disk (after installation) (Download size is `~400Mb`)
so please set a location to `BASE_LOCATION` that have enough space.
### **3.4 Errors**
If you got any error in any step of building process, you can remove the related package's build directory from `BASE_LOCATION/build` and run the installer again.
If you got any error please report to the forum of OSL.
---
### **4. Running**
We Prepared some batch files to do it for you automatically. Based on Environment Variables you set in previous sections you can just call it.
**Recommendation:** use `Powershell`
**TIP:** If you add your osl installation folders (both release and debug) in global Windows Environment Variable, you will get error.
So you can add release path or debug path in your global environment variables. Or create and use batch scripts.
For adding path you should add these two paths to your global env variables:
• PATH : `<osl install dir>\bin`;
• PATH : `<osl install dir>\lib`;
For example, you can open osltoy in releae mode with running `osltoy_release_launcher.bat`
if you have question, feel free to ask.
---
### **5. Development in Windows**
After editing your code, when you want to see your changes you should build osl again. But this time, it is so faster than before, (if you keep build folders) So just need to rebuild it in release mode.
**Release mode**:
- open powershell
- cd OpenShadingLanguage repo
- cd build_script
- run build_osl.bat release
- run osl_release_sln.bat
- example: set osltoy as default project
- run it in release x64 mode
**Debug mode**:
- open powershell
- cd OpenShadingLanguage repo
- cd build_script
- run build_osl.bat debug
- run osl_debug_sln.bat
- example: set osltoy as default project
- run it in debug x64 mode
If you open Visual Studio solution (sln) from release or debug, you can build it from inside it after your code editing
I recommend using: (in **powershell**)
- **osl_release_sln.bat** or **osl_debug_sln.bat**
now you can use Visual Studio for debugging.
---
**TIP about OSLToy:**
If you load a shader in `osltoy` and when hit Recompile, it is crashed and closed, probabely your output color attribute name is not `Cout`
It is mandatory to have at least one `Cout` output Variable in any shader, Otherwise osltoy will crash.
That's it
TIP: this process is getting better, I will update the document soon
**Conclusion:**
For easy installation you just need to setup your Environment Variables in `yourPath/OpenShadingLanguage/docs/build_install/windows/osl_env_vars_setup.bat` based on your paths
It is a custom setup, for example all dependencies are built before osl, because I had lots of issues on using external installation (like llvm)
and I tried this method on llvm 7, 8 and 9, all with error, so my current build setup is on llvm 11 and C++14, it can be changed in code. (I am trying to make it easy to use for changing configs with arguments)
Please take a look at docs and let me know my mistakes.
This method worked fine for me for release, debug and debugging in visual studio.
I am trying to build OSL on `Linux` with same method. If it worked fine I will Update the build system.
---
![osl_building_on_windows](./osl_building_on_windows.jpg)
+48
View File
@@ -0,0 +1,48 @@
@REM /* --------------------- */
@REM Copyright Contributors to the Open Shading Language project.
@REM SPDX-License-Identifier: BSD-3-Clause
@REM /* --------------------- */
@REM Main batch file for installing OSL
@echo off
call osl_env_vars_setup.bat
cls
set OSL_INPUT_CONFIG=%1
if "%OSL_INPUT_CONFIG%" equ "debug" (
set OSL_LOCATION_DIR=osl_debug
set OSL_BUILD_CONFIG=--debug
goto RUN
)
if "%OSL_INPUT_CONFIG%" equ "release" (
set OSL_LOCATION_DIR=osl_release
set OSL_BUILD_CONFIG=
goto RUN
)
if "%OSL_INPUT_CONFIG%" equ "" (
echo --= Enter debug or release as argument
exit
)
@REM if argument is not debug or release
if "%OSL_INPUT_CONFIG%" neq "" (
echo --= Enter debug or release as argument
exit
)
:RUN
set PATH=%CMAKE_LOCATION%/bin;GIT_LOCATION/cmd;%PYTHON_LOCATION%;%PYTHON_LOCATION%/Scripts;%QT_LOCATION%/bin;%QT_LOCATION%/lib;%NASM_LOCATION%;%PATH%
set PYTHONPATH=%PYTHON_LOCATION%/Lib/site-packages;
set Qt5_ROOT=%QT_LOCATION%/lib/cmake
call %VCVARS_LOCATION%/vcvarsall.bat x64
cls
python build_osl.py --generator "Visual Studio 16 2019" --osl --python %OSL_BUILD_CONFIG% --zlib --llvm --clang --pugixml --openexr --tiff --jpeg --png --flex --bison --opencolorio --openimageio --libraw --pybind11 %BASE_LOCATION%/%OSL_LOCATION_DIR%
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

@@ -0,0 +1,19 @@
@REM /* --------------------- */
@REM Copyright Contributors to the Open Shading Language project.
@REM SPDX-License-Identifier: BSD-3-Clause
@REM /* --------------------- */
@REM Running Visual Studio 2019 in debug mode for editing and debugging OSL
@echo off
call osl_env_vars_setup.bat
cls
set PATH=%PYTHON_LOCATION%;%PYTHON_LOCATION%/Scripts;%QT_LOCATION%/bin;%QT_LOCATION%/lib;%BASE_LOCATION%/osl_debug/bin;%BASE_LOCATION%/osl_debug/lib;%PATH%
set PYTHONPATH=%PYTHON_LOCATION%/Lib/site-packages;
%BASE_LOCATION%\osl_debug\build\OpenShadingLanguage\OSL.sln
@@ -0,0 +1,33 @@
@REM /* --------------------- */
@REM Copyright Contributors to the Open Shading Language project.
@REM SPDX-License-Identifier: BSD-3-Clause
@REM /* --------------------- */
@REM Running Visual Studio 2019 in release mode for running OSL or editing code
@echo off
@REM TIP:
@REM for modifying env vars based on your paths
@REM if your path has space in it, put whole path between
@REM double quotation
set BASE_LOCATION=D:/madoodia/sdks
set PYTHON_LOCATION=C:/Python37
set QT_LOCATION=C:/Qt/5.15.0/msvc2019_64
set NASM_LOCATION=C:/NASM
set GIT_LOCATION="C:/Program Files/Git"
set CMAKE_LOCATION="C:/Program Files/CMake"
set VCVARS_LOCATION="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build"
echo --= -------------------------------------------- =--
echo --= Environmment Variables created successfully! =--
echo BASE_LOCATION : %BASE_LOCATION%
echo PYTHON_LOCATION : %PYTHON_LOCATION%
echo QT_LOCATION : %QT_LOCATION%
echo NASM_LOCATION : %NASM_LOCATION%
echo GIT_LOCATION : %GIT_LOCATION%
echo CMAKE_LOCATION : %CMAKE_LOCATION%
echo VCVARS_LOCATION : %VCVARS_LOCATION%
echo --= -------------------------------------------- =--
@@ -0,0 +1,18 @@
@REM /* --------------------- */
@REM Copyright Contributors to the Open Shading Language project.
@REM SPDX-License-Identifier: BSD-3-Clause
@REM /* --------------------- */
@REM Main batch file for installing OSL
@echo off
call osl_env_vars_setup.bat
cls
set PATH=%PYTHON_LOCATION%;%PYTHON_LOCATION%/Scripts;%QT_LOCATION%/bin;%QT_LOCATION%/lib;%BASE_LOCATION%/osl_release/bin;%BASE_LOCATION%/osl_release/lib;%PATH%
set PYTHONPATH=%PYTHON_LOCATION%/Lib/site-packages;
%BASE_LOCATION%\osl_release\build\OpenShadingLanguage\OSL.sln
@@ -0,0 +1,18 @@
@REM /* --------------------- */
@REM Copyright Contributors to the Open Shading Language project.
@REM SPDX-License-Identifier: BSD-3-Clause
@REM /* --------------------- */
@REM Running OSLToy in debug mode
@echo off
call osl_env_vars_setup.bat
cls
set PATH=%PYTHON_LOCATION%;%PYTHON_LOCATION%/Scripts;%QT_LOCATION%/bin;%QT_LOCATION%/lib;%BASE_LOCATION%/osl_debug/bin;%BASE_LOCATION%/osl_debug/lib;%PATH%
set PYTHONPATH=%PYTHON_LOCATION%/Lib/site-packages;
osltoy
@@ -0,0 +1,18 @@
@REM /* --------------------- */
@REM Copyright Contributors to the Open Shading Language project.
@REM SPDX-License-Identifier: BSD-3-Clause
@REM /* --------------------- */
@REM Running OSLToy in release mode
@echo off
call osl_env_vars_setup.bat
cls
set PATH=%PYTHON_LOCATION%;%PYTHON_LOCATION%/Scripts;%QT_LOCATION%/bin;%QT_LOCATION%/lib;%BASE_LOCATION%/osl_release/bin;%BASE_LOCATION%/osl_release/lib;%PATH%
set PYTHONPATH=%PYTHON_LOCATION%/Lib/site-packages;
osltoy
+13
View File
@@ -0,0 +1,13 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Ignore temporary specs that may be ephemeral or local to an individual
# developer, to prevent cluttering the output of `git status` and prevent
# people from accidentally checking in specs that are only meant for them.
specs/*
# But don't ignore the ones that belong to this project and are checked in. As
# we add specs that we intend to commit and make available to all project
# developers, they must be individually added here.
!specs/002-backend-cpp
+170
View File
@@ -0,0 +1,170 @@
Policy on AI Coding Assistants
==============================
- Initial policy merged 23-Mar-2026
Use of "AI coding assistants" is permitted on this project, with the following
guidelines and principles.
Summary of our core values:
- Human must always be in the loop, and is the responsible party for
the contents of a PR (including fully understanding and being able
to explain, defend, and modify it in response to review comments).
- Interact with the project and community yourself, not by agent.
- Disclose what tools you used and how. At a minimum, we require an
"Assisted-by: TOOL/MODEL" line in the commit comments and PR description.
- Don't waste maintainer's time with low quality PRs.
The long version:
### Human authorship and interaction with the project
**The human making a PR is considered the author** and is fully responsible
for the code they submit.
**No PRs should be submitted, reviewed/merged, or deployed without a human
fully in the loop.** You may use agents locally to help you write code (and
docs, tests, etc.), but you may not use agents to autonomously interact with
the project community. Submit your own PRs, write your own discussion
comments, respond to community members in your own words, approve or reject
code in review using your own brain.
Code autonomously submitted without an identifiable human author and
responsible party will be immediately closed, and the account associated with
the submission may be banned from future project participation.
**DO NOT "vibe code."** This term refers to a pure prompt-to-behavior cycle
where the human accepts un-inspected code based on the program behavior alone.
We don't want this. Code that must be maintained by the project should be
truly understood. Project code is ideally the result of discussion / pair
programming between the author and assistant, but even if the machine is doing
most of the work, all code should be approved and fully understood by the
author prior to PR submission.
### Professionalism and quality
**The usual high quality level of PRs should be maintained regardless of tools
used.** This includes not only code, but also the design, testing, PR
preparation, and the author's ability to explain and defend the code and
respond to questions and requests for changes. We never want to hear "but the
AI..." as an excuse for anything.
**PRs should always be [reviewed](CodeReview.md) and approved by someone other
than their author if at all possible.** This is especially true of code with
machine-generated components, because of the additional risk that the
submitter/operator may not fully understand what they did not write
themselves. This is part of the reason for AI tool disclosure -- to ensure
that another pair of eyes is on it. AI code review may be requested for
additional input, but the AI cannot give "approval", nor merge code itself.
Even when using a coding assistant to write the code, you are strongly
encouraged to write your own PR description, in your own words, if for no
other reason than to force yourself to understand the code well enough to
describe it to others.
### Disclosure
**Disclosure is required.** Patches that were written with the aid of AI
coding assistants must have, at a minimum, the following line in the commit
comment and PR description body:
Assisted-by: TOOL / MODEL
Ideally, to the extent practical, the PR description should also have a brief
description of how the tool was used, including the gist of key prompts or
summarizing the direction of the dialog. A full log is not necessary; a short
summary will do.
There are several reasons for this disclosure/documentation, even though it
will sometimes be inconvenient:
- Reproducibility: We want even automated work to be reproducible by others in
principle, just like a scientific paper.
- Education: We want to actively teach each other what tools, prompts, or
methods are successful at making high quality results for the project.
- Metrics: We would like the ability to look back and compare assisted vs
non-assisted code for things like defect rate (how often were new bugs
introduced or commits needed to be reverted), whether people are more likely
to write comprehensive tests when using assistants, etc.
- Compliance: Many key users and developers are in companies where they need
to disclose how AI tools were used in their work, and in other software that
they use. Let's make it easy for them.
- Insurance: Should future legal decisions radically change the IP status of
AI-generated code, or if particular models are implicated in copyright
violations, we want a way to find out which contributions might need to be
revisited in order to bring the project back into compliance.
### Intellectual Property
Regardless of how the code came to be -- from your head alone, from a friend,
from Stack Overflow, from a blog post, from reading other code bases, or from
a coding assistant -- we expect the terms of the
[DCO](https://developercertificate.org/) and CLA to apply, and for the author
to take reasonable care that code is not copied from a source with an
incompatible license.
You may find that your confidence about complying with the DCO+CLA depends on:
- If you provided a detailed specification and how much you edited or guided
the results yourself.
- Whether you are modifying or extending existing code versus writing large
amounts of entirely new code.
- The degree to which the generated code seems to fit into our structure and
idiomatic style, and therefore seems unlikely to be copied from elsewhere.
- Whether your tool has guardrails to prevent answers that are too similar to
existing code, for example as claimed by [Claude](https://privacy.claude.com/en/articles/10023638-why-am-i-receiving-an-output-blocked-by-content-filtering-policy-error) and [Copilot](https://docs.github.com/en/copilot/how-tos/manage-your-account/).
### Extractive submissions
**Maintainer time and attention are precious commodities**, and use of coding
assistants is not an excuse to submit poor PRs or to externalize costs onto
maintainers/reviewers (such as responsibility for understanding, testing, or
fixing PRs that the human author does not have a full understanding of).
Maintainers are free to take counter-measures against submitters of sub-par
PRs, or other violations of this policy, up to and including banning habitual
abusers from future participation in the project.
**We discourage use of AI tools to fix GitHub issues labeled as "good first
issue" or for "Dev Days" work.** Cultivating and educating new contributors is
important, and as such, we do not want people to swoop in and use automated
tools to trivially solve tasks that were curated specifically for somebody to
actually learn from. We expect each developer to implement at most one "good
first issue" per Dev Days occasion, and we encourage you to solve the problem
with your own brain to maximize the learning experience.
### Exceptions
This AI tool use policy is not meant to encompass cases such as:
- "Smart auto-complete", spell-checking, grammar checking, or other uses that
aren't really contributing substantively to authorship.
- Use of LLMs to explain code or learn about the codebase, answer basic
programming questions, help with background research, or audit the code
for bugs that are subsequently confirmed and fixed by people.
- Language translation for non-fluent English speakers or other accessibility
accommodations.
- Trivial or de-minimis fixes such as fixing a typo, obviously wrong variable
use, etc.
- Reviewing your own code for mistakes prior to submitting a PR (as long as it
isn't making the fixes for you).
### Creative contributions -- out of scope
This project repository contains code for tools, and their documentation. We
don't really directly host any artistically creative work here, so we have not
addressed additional policy issues that might come up in such a context.
If you are representing a different project that is using this document for
guidance or inspiration for your own policies, please be aware that you may
have needs that are not covered by these policies but deserve well-crafted
guidance.
### References and inspiration
Our policy has been informed and inspired by the following efforts in other communities:
- [LLVM AI Tool Policy](https://llvm.org/docs/AIToolPolicy.html)
- [Fedora Project policy on AI-assisted contributions](https://communityblog.fedoraproject.org/council-policy-proposal-policy-on-ai-assisted-contributions/)
- [Linux Foundation policy on Generative AI](https://www.linuxfoundation.org/legal/generative-ai)
- [Rust policy on rejecting burdensome PRs](https://github.com/rust-lang/compiler-team/issues/893)
- The METR paper [Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity](https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/)
- [GitHub Blog: Rethinking open source mentorship in the AI era](https://github.blog/open-source/maintainers/rethinking-open-source-mentorship-in-the-ai-era/)
+57
View File
@@ -0,0 +1,57 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the OpenImageIO Project. -->
# Agentic coding / coding assistants
Please start by reading [our policy on using "AI" coding
assistsants](AI_Policy.md).
## Multi-tool setup
We aim to allow people to use whatever agentic or coding assistant tools they
want. The repository ships with a setup script that configures tool-specific
files locally for whichever assistant(s) you use.
### Generic: `AGENTS.md` and `.agents/`
As much as possible, we use identical instructions and files across all coding
assistants.
`AGENTS.md` is the main file providing overall repo-specific instructions and
context to agents. Many coding agents already read this file directly; for
those that don't, the setup script creates the necessary links or wrappers.
`.agents/skills/` is where shared skill files live. Many tools find skills
here automatically; for those that need them elsewhere, the setup script
creates the appropriate links.
### Running the setup script
After cloning, run `.agents/setup-agent <tool>` for the tool(s) you use:
```
.agents/setup-agent claude # Claude Code
.agents/setup-agent cursor # Cursor
.agents/setup-agent codex # OpenAI Codex
.agents/setup-agent opencode # Opencode
.agents/setup-agent copilot # GitHub Copilot
.agents/setup-agent all # all of the above
```
The script is idempotent — running it multiple times is safe. To undo:
```
.agents/setup-agent clear # remove all tool setup
.agents/setup-agent clear claude # remove setup for one tool
```
Tool-specific directories (`.claude/`, `.cursor/`, `.codex/`, `.opencode/`,
`.github/copilot-instructions.md`) are created locally only and are listed in
`.gitignore`. Each developer runs the script for the tool they use; nothing
tool-specific is committed to the repository.
The script header contains per-tool documentation (what each tool reads
natively, what requires setup, and links to relevant docs) — consult it when
adding support for a new tool or updating the strategy for an existing one.
+51
View File
@@ -0,0 +1,51 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the Open Shading Language Project. -->
# Build profiling
These are instructions for profiling the build process of OSL --
useful for figuring out where the build process is spending its time, and
where it might be optimized.
## Profiling module compilation with clang -ftime-trace
These instructions are based on the following references:
- general instructions: https://www.superfunc.zone/posts/001-speeding-up-c-builds/
- ninjatracing.py script: https://github.com/nico/ninjatracing
- Background info: https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/
The steps are as follows, and they require the use of clang, ninja, and
the chrome browser:
1. Build with clang using the `-ftime-trace`, flag which is set when you use
the OSL build option -DOSL_BUILD_PROFILE=1. You MUST use clang, as this
is a clang-specific feature, and you must use the ninja builder (use CMake
arguments `-G ninja`). This must be a *fresh* build, not an incremental
build (or the results will only reflect the incrementally build parts).
This will result in a file, build/.ninja_log, containing timings from
the build process.
2. Prepare the output using the `ninjatracing.py` script as follows:
```
python3 src/build-scripts/ninjatracing.py -a build/.ninja_log > top_level.json
```
3. Running the Chrome browser, visit the URL `chrome://tracing`, and LOAD that
json file created in the previous step. This will display a timeline of the
build process, showing which thread, in what order, and how long each
module took to compile.
4. For even more detail on what's happening within the compilation of each
module, you can use the `-e` flag to expand the output:
```
python3 src/build-scripts/ninjatracing.py -a -e -g 50000 build/.ninja_log > expanded.json
```
Loading this in Chrome's tracing view, as above, will show a full flame
chart of the build process, showing the time spent in the different
functional parts of the compiler and which functions of OSL it is
compiling or which templates are being instantiated.
+32
View File
@@ -0,0 +1,32 @@
Release 1.14.0 (Fall 2024) -- compared to 1.13
-------------------------------------------------
### New minimum dependencies and compatibility changes:
* *Blah*: Raise minimum to 1.2...
### OSL Language, standard library, and oslc compiler (for shader writers):
* *New feature*: item
### ⛰️ API changes and new ShadingSystem features (for renderer writers):
### 🚀 SIMD batched shading mode
### 🚀 OptiX GPU rendering
### 🐛/🔧 Internals: fixes, improvements, and developer concerns
### 🏗 Build/test/CI and platform ports
* CMake build system and scripts:
- item
* Testing and Continuous integration (CI) systems:
- *test*: item
- *ci*: item
* Platform support:
- *win*: item
### 📚 Documentation
- *docs*: item
### 🏢 Project Administration
- *admin*: item
+4
View File
@@ -0,0 +1,4 @@
Release 1.2.3.4 (Month DD, YYYY) -- compared to 1.2.3.3
-------------------------------------------------------
- *category*: Description [#1234](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1234) (by someuser)
+196
View File
@@ -0,0 +1,196 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the Open Shading Language Project. -->
Code Review Procedures
======================
### Why do we code review?
Code review is a process where someone other than the author of a patch
examines the proposed changes and approves or critiques them. The main
benefits are to:
- Encourage submitters to ensure that their changes are well thought out,
tested, and documented so that their intent and wisdom will be clear to
others.
- Directly find shortcomings in or suggest improvements to the proposed
changes, and ensure that the changes are consistent with the project's best
practices.
- Minimize the amount of the code base that has only been seen or is only
understood by one person.
- Improve security and robustness of the code base by assuring that at least
two people (submitter and reviewer) agree that every patch is reasonable and
safe.
### Reviewer guidelines -- what you should be looking for
Code review is not difficult, and it doesn't require you to be a senior
developer or a domain expert. Even if you don't particularly understand that
region of the code and are not a domain expert in the feature being changed,
you can still provide a helpful second pair of eyes to look for obvious red
flags and give an adequate review:
- This may seem too obvious to say explicitly, but a big part of review is
just looking at the PR and seeing that it doesn't appear to deface,
purposely/obviously break, or introduce malware into the project.
- Does the explanation of the PR make logical sense and appear to match (as
near as you can tell) the changes in the code? Does it seem sensible, even
if you don't understand all the details?
- Does the test pass all of our existing CI tests? (If it does, at least we
are reasonably sure it doesn't break commonly used features.)
- Is there any evidence that the changes have been tested? Ideally, something
already in, or added to the testsuite by this PR, exercises the new or
altered code. (Though sometimes a patch addresses an edge case that's very
hard to reproduce in the testsuite, and you have to rely on the submitter's
word and the sensibility of their explanation.)
- Not required, but nice if we can get it: You're an expert in the part of
the code being changed, and you agree that this is the best way to achieve
an improvement.
- Any objections should be explained in detail and invite counter-arguments
from the author or other onlookers. A reviewer should never close a PR
unless it fails to conform to even the basic requirements of any submitted
PR, or if enough time has passed that it's clear that the PR has been
abandoned by its author. It's ok to ultimately say "no" to a PR that can't
be salvaged, but that should be the result of a dialogue.
Obviously, you also want any review comments you give to be constructive and
helpful. If you don't understand something, ask for clarification. If you
think something is wrong, suggest a fix if you know how to fix it. If you
think something is missing, suggest what you think should be added. Follow the
expected kind and constructive tone of the project's community.
### Submitter guidelines -- how to encourage good reviews and timely merges
A few tips for submitters to help ensure that your PRs get reviewed and merged
in a timely manner and are respectful of the reviewers' time and effort:
- Aim for small PRs that do a specific thing in a clear way. It is better to
implement a large change with a series of PRs that each take a small,
obvious step forward, than to have one huge PR that makes changes so
extensive that nobody quite knows how to evaluate it.
- Make sure your PR commit summary message clearly explains the why and how of
your changes. You want someone to read that and judge whether it's a
sensible approach, know what to look for in the code, and have their
examination of the code make them say "yes, I see, of course, great, just as
I expected!"
- Make sure your PR includes a test (if not covered by existing tests).
- Make sure your PR fully passes our CI tests.
- Make sure your PR modifies the documentation as necessary if it adds new
features, changes any public APIs, or alters behavior of existing features.
- If your PR alters public C++ APIs for which there are also Python bindings,
make sure that the changes are also reflected in the Python bindings and any
other language bindings we support.
- If you are adding new language features or behaviors, make sure they are
implemented and tested in all of the back-ends: single point shading,
batch shading, GPU/OptiX.
### Code review procedures -- in the ideal case
In the best of circumstances, the code review process should be as follows for
**EVERY** pull request:
- At least one reviewer critiques and eventually (possibly after changes are
made) approves the pull request. Reviewers, by definition, are not the same
person as the author.
- Reviewers should indicate their approval by clicking the "Approve" button in
GitHub, or by adding a comment that says "LGTM" (looks good to me).
- If possible, reviewers should have some familiarity with the code being
changed (though for a large code base, this is not always possible).
- At least a few work days should elapse between posting the PR and merging
it, even if an approving review is received immediately. This is to allow
additional reviewers or dissenting voices to get a chance to weigh in.
- If the reviewer has suggestions for improvement, it's the original author
who should make the changes and push them to the PR, or at the very least,
the author should okay any changes made by the reviewer before a merge
occurs (if at all practical).
Not all patches need the highest level of scrutiny. Reviews can be cursory and
quick, and merges performed without additional delay, in some common low-risk
circumstances:
- The patch fixes broken CI, taking the project from a verifiably broken state
to passing all of our CI builds and tests.
- The changes are only to documentation, comments, or other non-code files,
and so cannot break the build or introduce new bugs.
- The code changes are trivial and are obviously correct. (This is a judgment
call, but if the author or reviewer or both are among the project's senior
developers, they don't need to performatively pretend that they aren't sure
it's a good patch.)
- The changes are to *localized* and *low risk* code, that even if wrong,
would only have the potential to break individual non-critical features or
rarely-used code paths.
Conversely, some patches are so important or risky that if possible, they
should be reviewed by multiple people, preferably from different stakeholder
institutions than the author, and ensure that the approval is made with a
detailed understanding of the issues. In these cases, it may also be worth
bringing up the issue up at a TSC meeting to ensure the attention of many
stakeholders. These include:
- *New directions*: Addition of major new features, new strategic initiatives,
or changes to APIs that introduce new idioms or usage patterns should give
ample time for all stakeholders to provide feedback. In such cases, it may
be worth having the PR open for comments for weeks, not just days.
- *Risky changes*: Changes to core classes or code that could subtly break
many things if not done right, or introduce performance regressions to
critical cases.
- *Compatibility breaks*: changes that propose to break backward API
compatibility with existing code or data files, or that change the required
toolchain or dependencies needed to build the project.
- *Security*: Changes that could introduce security vulnerabilities, or that
fix tricky security issues where the best fix is not obvious.
### Code review compromises -- because things are rarely ideal
We would love to have many senior reviewers constantly watching for PRs, doing
thorough reviews immediately, and following the above guidelines without
exception. Wouldn't that be great! But in reality, we have to compromise,
hurry, or cut corners, or nothing would ever get done. Some of these
compromises are understandable and acceptable if they aren't happening too
often.
- Lack of reviews: If no reviews are forthcoming after a couple days, a "are
there any objections?" comment may be added to the PR, and if no objections
are raised within another few days, the PR may be merged by the author if
they are a senior developer on the project. This is a fact of life, but
should be minimized (with a rigor proportional to where the patch falls on
the "low risk / high risk" scale described above). If this is done, you
should leave an additional comment explaining why it was merged without
review and inviting people to submit post-merge comments if they
subsequently spot something that can be improved.
- Time-critical patches: urgent security fixes, broken CI or builds, critical
bugs affecting major stakeholders who are waiting for a repaired release,
fixes that are blocking other work or preventing other PRs from advancing.
In such cases, it is understandable for senior developers to try to speed up
the process of getting the changes integrated (though the very nature of
their criticality also indicates that it's worth getting a review if at all
possible).
- Failing tests: Sometimes a PR must be merged despite failing CI tests.
Usually this is for one of two reasons: (1) spurious CI failures are known
to be occurring at that time and are unrelated to the PR; (2) the PR is part
of a series of patches that are only expected to fully pass CI when the last
piece is completed.
These changes are understandable, but we still are striving to reduce their
frequency. It is the responsibility of the senior developers, TSC members, and
major stakeholders to be monitoring the incoming PRs and helping with reviews
as much as possible, to ensure that review exceptions are rare.
### Code review pathologies -- things to avoid
These are anti-patterns that generally are indications of an unhealthy open
source project:
* An author merging their own PR without any review comments that indicate
meaningful scrutiny or approval from another party, and without giving
adequate warning that a merge will occur if no reviews are received.
* PRs languishing for weeks or months without any review or merge.
* PRs that don't adequately test their changes (basically crossing your
fingers and hoping it works).
* PRs that are merged despite failing CI that might be related or, if
unrelated, that might be masking problems with the PR being evaluated.
Again, sometimes these things happen out of necessity to keep the project
moving forward under constrained development resources. But we strive as much
as possible to ensure that they are rare exceptions.
+449
View File
@@ -0,0 +1,449 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the Open Shading Language Project. -->
# Release Procedures for Open Shading Language
## Version nomenclature and release cadence
### The meaning of the version parts
Our release numbers are of the form `MAJOR.MINOR.PATCH.TWEAK`, and we follow
an almost-semantic-versioning scheme.
MAJOR releases are those that break backward-compatibility of the public APIs,
requiring existing application code to change their source code where it calls
OSL API functions in order to compile and work correctly.
MINOR releases guarantee API backward-compatibility with prior releases that
have the same major number, but can introduce ABI or link incompatibilities.
Applications using OSL need to be recompiled to move to a new minor release,
but should not need to change their source code (except, of course, to take
advantage of new features). Minor releases are allowed to drop support for
sufficiently old compilers and dependencies.
PATCH releases guarantee both API and ABI/link backward-compatibility with
prior releases that have the same minor number. Features and new public API
calls may be added (thus deviating from strict semantic versioning), but only
if they preserve ABI/link compatibility. This means that standalone functions
or static methods may be added, but existing functions will not change their
parameters, and no new virtual methods or struct data layouts change for patch
releases (for classes in public header files). Application code can be
re-linked to a new patch release without needing to be recompiled. We also
guarantee that any compilers or dependencies supported for the first release
of a minor series will continue to be supported for all patches to that minor
series.
TWEAK releases are restricted to critical bug fixes or build breaks that do
not alter public APIs in any way.
### Cadence of releases
Major (arbitrarily incompatible) releases happen rarely, usually with multiple
years between them.
Minor (API backward-compatible) releases are scheduled annually, targeted at
late summer (SIGGRAPH time) to be in beta, and early autumn for a full
release.
Patch (API and ABI backward-compatible) releases are scheduled monthly,
usually aiming for the first day of each month.
Tweak (fully forward and backward compatible) releases are not regularly
scheduled, and only happen sporadically, when a critical fix is needed in
between scheduled patch releases.
### Things are different in "main"
The "main" branch is where ongoing development occurs without any
compatibility guarantees. We don't always know if the next year's release from
main will turn out to be major (API breaking) or minor (only ABI breaking).
Some studios or products need the most up-to-date enhancements, and thus tend
to build OSL from the "main" branch rather than using tagged releases. For
these users, we try to set version numbers and occasionally tag in main, to
send a signal about which points in main seem safe to rely on various
compatibility levels. However, the rules are slightly different than we use
for releases.
In the "main" branch:
- TWEAK tags within "main" only guarantee ABI back-compatibility, but may
have additions or non-bug-fix behavior changes (akin to patch releases
within a release branch).
- PATCH tags within "main" are allowed to break ABI or API (changes that
would require minor or major releases, if they were not in "main").
- Beware of unmarked breaks in compatibility of commits in main that are
in between developer preview tags.
---
## Branch and tag names
**Branches** are places where commits containing new development may be added
(and thus the branch markers will move over time). Branch names obey the
following conventions:
- `main` is the area for arbitrary changes intended for the next year's
major or minor release.
- `dev-1.2` are the areas for staging additions that will become the next
tweak or patch release for the minor version series.
- `release` is a special branch marker that is always set to the latest tag of
the currently supported, stable release family. People can count on
"release" always being the latest stable release, whatever that may be at
the time.
**Tags** indicate releases or developer previews, and once a commit is
tagged, it is permanent and will never be moved. Tag names obey the following
conventions:
- `v1.2.3.4` is a specific public stable release, corresponding to official
major, minor, public, or tweak releases.
- `v1.2.3.4-alpha`, `v1.2.3.4-beta`, or `v1.2.3.4-RC1` are pre-releases for an
upcoming public stable release, at the alpha, beta, or release candidate
stages, respectively.
- `v1.2.3.4-dev` is a "developer preview" within "main." It is not an official
supported release, and while the numbering may indicate compatibility versus
other recent developer previews, they should not be assumed to be compatible
with any prior official stable releases.
*Very* occasionally, other branch or tag names (with custom suffixes or
different naming schemes) may be used for special purposes by particular
developers or users, but should not be considered reliable or permanent, and
in general should be ignored by anyone who didn't make the tag or branch.
---
## Release Procedures
### Soft freeze for monthly tweak releases:
We freely backport *safe*, non-ABI-breaking changes by cherry-picking them
from main to the supported branch continually throughout most of the month.
In the seven days before the new month, we do a "soft freeze" where only
important bug fixes are backported. Hold on to any other patches you wish to
backport until after the monthly patch release (i.e., save them for the next
month's release so you never have a release that contains changes that are
only a few days old, and therefore not as well tested). You may, of course,
continue to backport fixes to documentation or other non-code parts of the
project during this soft freeze.
### Branching for annual major/minor releases
By mid-June (about 1-2 months before the beta of a new annual big release),
you should branch and mark it as an alpha.
At the tip of "main", create a new branch named `dev-MAJOR.MINOR` that will
be the staging area for the next release.
Customarily, at that point we add a commit to main (but not to the new
dev-MAJ.MIN branch) that bumps main's version to the next minor level, to
avoid any confusion between builds from main versus what will be the next
release branch. This starts the divergence between main and the release
branch, and henceforth, any big or compatibility-breaking changes will only be
committed to main and not backported to the release branch. (Though we are
loose about this rule during the alpha period and allow continued breaking
changes in the alpha, but by the time we call it beta, we allow no more
breaking changes.) Also at this stage, the main branch's CHANGES.md should
have a heading added at the top for the *next* version.
### Prior to a release
1. Update CI dependencies: Ensure that the "latest" CI test specifies the
current releases of the dependencies and compilers (check their home
pages), and that the [INSTALL.md](../INSTALL.md) file correctly documents
the version ranges that we expect to work and that we actively test.
2. Release notes: [CHANGES.md](../CHANGES.md) should be updated to reflect
all the new features and fixes. Looking at the notes from older releases
should provide a good example of what we're aiming for.
- Patch and tweak releases can be brief one-line descriptions (often the
first line of the commit messages involved), presented in a single
section in either chronological or any other order that seems right.
- Minor or major releases have a much more extensive, prose-based
description of all changes since the last minor release, broken into
sections (dependency changes, major new features, enhancements and fixes,
internals and developer goodies, testing/CI/ports, etc.) and ordered for
readability and relevance.
3. Ensure docs are up to date:
- [README.md](README.md): Actually read it! Make sure it all seems
accurate and up to date.
- [INSTALL.md](INSTALL.md): Be sure that it accurately reflects the
current minimum and latest-tested versions of each dependency.
- [CREDITS.md](CREDITS.md): Check against the recent repo history to be
sure new contributors are listed.
- [SECURITY.md](SECURITY.md): Make sure it accurately reflects the
status of which branches get updates.
- Skim the [user documentation](https://docs.openshadinglanguage.org) to
ensure it's building correctly and doesn't have any obvious errors,
especially the parts that describe new features.
4. Make sure the the top-level CMakeLists.txt file is updated:
- The version on the `project()` call should be correct.
- The `PROJECT_VERSION_RELEASE_TYPE` variable should be set to "alpha" or
"beta" if appropriate, "RC" for release candidate, or empty string `""`
for most supported releases, and "dev" only for the main branch or
developer previews.
- The `${PROJECT_NAME}_SUPPORTED_RELEASE` variable should be `ON` for any
release branch, `OFF` for main.
5. Make sure everything passes the usual CI workflow. Also check the daily or
weekly "analysis" workflows to make sure there aren't any important
warnings that should be fixed.
### Staging alpha / beta / release candidate (annual minor/major releases only)
For monthly patch releases, we don't have any formal alpha/beta/RC stages.
For the annual minor or major releases we have a staged release:
- `alpha` is everything after we have branched, in which we think all the big
new features have been added, and while we will make continued changes and
fixes, we are aiming for increased stability and to minimize additional
breaking changes prior to the release.
- `beta` should be about one month prior to the final release date. We create
a tag `v1.2.3.4-beta` and announce the beta (see below "Making the
release"). Once we tag a beta, we try very hard not to allow any further
changes that change the API or are not ABI-compatible (i.e., safe fixes
only).
- `RC` or release candidates around one week prior to the final release date.
This is a trial run, hopefully identical to the final release (except for
removing the RC label and making a new tag). The only changes allowed after
RC are fixes to the most critical bugs or build breaks that would be bad for
users to encounter. If critical problems are found with RC1, they should be
fixed and immediately re-tagged as RC2, etc. All other fixes should be
postponed until the next month's patch release.
### Making the release
A final release is made on the scheduled date, provided the latest RC has
survived for at least a few days of testing without finding any critical
problems. Don't make the release final until you are sure there are no
truly critical bugs or build breaks that users will encounter.
The following are the steps for making the release:
1. Double check the top-level CMakeLists.txt to ensure the right version
number and type of version designation (i.e.,
`PROJECT_VERSION_RELEASE_TYPE` should be set appropriately).
2. Edit CHANGES.md to reflect the correct date of the release and ensure it
includes any last-minute changes that were made during beta or release
candidate stages. Please see the section "Generating release notes" below.
3. Push it to **your** GitHub fork, make sure it passes CI.
4. Tag the release with a signed tag:
$ git tag -s v1.2.3.4 # add a signed tag
$ git tag -v v1.2.3.4 # verify the tag
Be sure that the tag also reflects if it's an alpha (v1.2.3.4-alpha),
beta (v1.2.3.4-beta), release candidate (v1.2.3.4-RC1), or developer
preview (v1.2.3.4-dev). If it's a final release, just use the plain
version number (v1.2.3.4).
Note that the tag signing requires you to have a GPG key set up and
associated with your GitHub account. Please see [GitHub's signed tagging instructions](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-tags) for more information.
If you get errors messages "gpg: signing failed: Inappropriate ioctl for device", then the solution is to first:
$ export GPG_TTY=$(tty)
5. If this will now be the recommended stable release, move the `release`
branch marker to the same position.
6. Push it to GitHub: `git push aswf release --tags`
(This example assumes "aswf" is the name of the remote for the GitHub
`AcademySoftwareFoundation/OpenShadingLanguage` repo.)
7. Draft a release on GitHub: On
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/releases
select "Draft a new release." Choose the new tag you just pushed. Make the
release title "Open Shading Language v1.2.3.4" (and beta, etc., designation
if applicable). In the description, paste the release notes for this
release (from CHANGES.md). If this is a beta or release candidate, check
"this is a pre-release" box at the bottom.
8. Announce the release on the [osl-dev mail list](https://lists.aswf.io/g/osl-dev)
with the subject "Release: OSL v1.2.3.4" and using one of these templates
for the body of the email.
For a monthly patch release:
> We have tagged v1.2.3.4 as the latest production release and moved the
> "release" branch marker to that point. This is guaranteed to be API,
> ABI, and link back-compatible with prior 1.2 releases. Release notes
> are below.
>
> (Paste the full set of 1.2 changes here, just copy the appropriate
> part of CHANGES.md)
For an annual major/minor release:
> OSL version 1.2 has been released! Officially tagged as "v1.2.3.4", we
> have also moved the "release" branch tag to this position. Henceforth,
> 1.2 is the supported production release family. The API is now frozen --
> we promise that subsequent 1.2.x releases (which should happen monthly)
> will not break back-compatibility of API, ABI, or linkage, compared to
> this release. Please note that this release is *not* ABI or link
> compatible with 1.1 or older releases.
>
> Release notes for 1.2 outlining all the changes since last year's
> release are below.
>
> Please note that a few of the build and runtime dependencies have
> changed their minimum supported versions. (List here any important
> changes to dependencies, compilers, or C++ standard that users should be
> aware of.)
>
> (List here anything else that people should know about this release
> family that may be surprising if they haven't followed the last year of
> development closely, or that they must know even if they are too lazy to
> read the release notes. If this is a major release that is not
> backward-compatible with prior versions, warn about that here.)
>
> Enjoy, and please report any problems. We will continue to make patch
> releases to the 1.2 family roughly monthly, which will contain bug fixes
> and non-breaking enhancements.
>
> The older 1.1 series of releases is now considered obsolete. We will
> continue for now to make 1.1 patch releases, but over time, these will
> become less frequent and be reserved for only the most critical bug
> fixes.
>
> The "main" branch is now progressing toward an eventual 1.3 release next
> summer. As usual, you are welcome to use main for real work, but we do
> not make any compatibility guarantees and don't guarantee continuing API
> compatibility in main.
>
> (Paste the full set of 1.2 changes here, just copy the appropriate
> part of CHANGES.md)
For a beta leading up to the annual major/minor release:
> OSL version 1.2 is now in beta, tagged as "v1.2.3.4-beta". We
> will try very hard not to make any further API or ABI changes between
> now and the final release (unless it is absolutely necessary to fix
> an important problem identified during beta testing). The final 1.2
> release is scheduled for [DATE GOES HERE], so please try building and
> testing the beta so we are sure to find any problems.
>
> Release notes for 1.2 outlining all the changes since last year's
> release are below.
>
> (Paste the full set of 1.2 changes here, just copy the appropriate
> part of CHANGES.md)
### After the release
Odds and ends to do after the tag is pushed and the announcements are sent:
- Re-read RELEASING.md and ensure that the instructions match what you
have done. Update as necessary.
- Go to [OSL's docs hosted on readthedocs.org](https://docs.openshadinglanguage.org),
and ensure that the new release is built, visible, and is the default
release shown (specified in the Admin section). I tend to keep the latest
patch of each minor release available for reference indefinitely, but hide
the docs for earlier patch releases within that minor release series.
- Edit the top-level CMakeList.txt to update the version to the *next*
anticipated release on the branch, in order to ensure that anybody building
from subsequent patches won't get a release number that advertises itself
incorrectly as a prior tagged release. Also edit CHANGES.md to add a new
(blank) heading for the next patch or release.
## Generating release notes
We strongly encourage the use of "conventional commit" prefixes in commit
messages. See [CONTRIBUTING.md](CONTRIBUTING.md#commit-messages) for details.
Many PRs are submitted (even by the author of this section you are now
reading!) without the conventional commit prefix. The person who approves and
merges the commit should take responsibility during the merge process to edit
the commit message to add the appropriate prefix (and for that matter, to edit
any part of the commit message for clarity). But at the end of the day, if we
end up with some commits lacking a conventional commit prefix, it's no big
deal -- we can fix it all up by hand when we make the release notes. But
having CC prefixes in as many commit messages possible helps make the release
notes process be simpler and more automated.
We have been using the [git-cliff](https://github.com/orhun/git-cliff) tool
as the starting point for release notes. The command we use is:
git cliff -c src/doc/cliff.toml -d v1.2.3.4..HEAD > cliff.out.md
where v1.2.3.4 in this example is the tag of the last release. You could also
use commit hashes to denote the range of changes you want to document.
**For monthly patch releases**
We have found that the git-cliff output is most of what we need for the patch
releases, and can be copied into the CHANGES.md file with only some minor
editing needed. The template for the patch release notes can be found in
[Changes-skeleton-patch.md](docs/dev/Changes-skeleton-patch.md).
* Get rid of the headings that git-cliff generates. We don't use the headings
for the patch releases.
* Add prefixes to any commits that don't have them (they will be marked as
"uncategorized" by git-cliff), and feel free to change any of the existing
prefixes that you think are wrong or could be improved for clarity.
* Rearrange the order of the entries to be logical and readable. I prefer the
order: feature enhancements, bug fixes, build system fixes that might impact
users, internal changes, test improvements, documentation and administrative
changes.
* For patch releases, feel free to omit any entries that you think are not
user-facing and are too minor to be worth mentioning in the release notes.
Strive to keep the release notes just long enough for users to know if the
patch contains any fixes relevant to them, but short enough to be read at a
glance and without extraneous detail.
Here is an example of well-constructed monthly patch release notes:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/releases/tag/v1.13.12.0
**For annual major/minor releases**
For major releases, the git-cliff output is just a starting point and need
significant editing to get the detail and quality level we expect for our
major releases. A simple bullet list of commits is not sufficient -- we aim
for a prose-based description of important changes that "tell the story" of
the year's work and will be thoroughly understood by our stakeholders who need
to understand what has changed.
* Copy all the headings from [Changes-skeleton-major.md](docs/dev/Changes-skeleton-major.md)
or the previous year's release notes to get the skeleton of the major and
minor headers that you fit everything into. Note that it mostly corresponds
to sections of the git-cliff output, but with a more carefully constructed
hierarchy of categories.
* Add prefixes to any commits that don't have them (they will be marked as
"uncategorized" by git-cliff), and feel free to change any of the existing
prefixes that you think are wrong or could be improved for clarity.
* Rearrange the git-cliff output into the hierarchy of our preferred major
release notes organization. Within each section and subsection, group
similar changes together. The chronological order of the commits isn't as
important as clearly explaining what changed over the course of the year.
* The git-cliff output is a good starting point for populating the notes with
every PR, plus automatically adding a reference and link to the PR and the
name of the author of the patch.
* Look with a skeptical eye at the one-line bullet points from git-cliff (i.e,
from the first line of each PR's commit message). Often, they are too terse
or tend to [bury the lede](https://www.dictionary.com/e/slang/bury-the-lede/).
Expand into as much explanation is necessary for users who need to know
about the change or feature to know whether it is relevant and have some
idea what to do or that they should look at the relevant PRs for more
detail.
Here is an example of well-constructed annual major release notes:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/releases/tag/v1.14.3.0
+3
View File
@@ -0,0 +1,3 @@
# Shader Writing in OSL
Contains OSL shader writing content.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
# Web Site
Contains OSL web site content.
-537
View File
@@ -1,537 +0,0 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# SPI-specific settings
ifneq (${VERBOSE},)
$(info Including spi/Makefile-bits)
endif
# For SpComp2 builds, do:
#
# make OSL_SPCOMP2=1 spcomp2_install
# or
# make OSL_SPCOMP2=1 SPCOMP2_LOCAL_PATH=/test/path spcomp2_install_local
#
# For Arnold builds, do:
#
# make OSL_ARNOLD=1
#
# For a Rez-bound build, do:
#
# make OSL_SPIREZ=1
#
# (Options: OSL_REZ_NAME=blah REZ_PACKAGE_ROOT=path)
#
# Otherwise a default 'make' will make a fully generic OSL build.
OSL_SPCOMP2 ?= 0
OSL_ARNOLD ?= 0
OSL_SPIREZ ?= 0
OSL_REZ_NAME ?= OSL
OSL_VERS = $(shell grep "OSL VERSION" CMakeLists.txt | egrep -o "[0-9.]+")
ONEVERS = $(shell site/spi/format_version.py ${OSL_VERS})
OSL_SPCOMP2_VERSION ?= ${ONEVERS}
ifeq (${OSL_SPCOMP2},1)
$(info Building for SpComp2)
OSL_ARNOLD := 0
NAMESPACE ?= 'OSL_SpComp2'
SOVERSION ?= ${OSL_SPCOMP2_VERSION}
PYLIB_LIB_PREFIX ?= 1
PYLIB_INCLUDE_SONAME ?= 1
OPENIMAGEIO_SPCOMP2_VERSION ?= 20103
OPENEXR_VERSION ?= 2.2.0
else ifeq (${OSL_ARNOLD},1)
$(info Building for Arnold)
NAMESPACE ?= 'OSL_Arnold'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
OPENEXR_VERSION ?= 2.4.0
else ifeq (${OSL_SPIREZ},1)
$(info Building for Rez distribution)
NAMESPACE ?= 'OSL'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
MY_CMAKE_FLAGS += -DOSL_SPIREZ=1 -DOSL_REZ_PACKAGE_NAME=${OSL_REZ_NAME}
MY_CMAKE_FLAGS += -DCMAKE_DEBUG_POSTFIX=_d
OPENIMAGEIO_VERSION ?= 2.2.0.0
OPENEXR_VERSION ?= 2.4.0
$(info Building against OpenImageIO ${OPENIMAGEIO_VERSION})
else
$(info Building generic OSL)
NAMESPACE ?= 'OSL'
PYLIB_LIB_PREFIX ?= 0
PYLIB_INCLUDE_SONAME ?= 0
endif
#$(info MAKECMDGOALS = $(MAKECMDGOALS))
## Detect which SPI platform and set $platform, $COMPILER, $SPCOMP2_COMPILER,
## and PYTHON_VERSION. Lots of other decisions are based on these.
ifeq (${SP_OS}, rhel7)
# Rhel7 (current)
platform := rhel7
SPI_COMPILER_PLATFORM ?= gcc-6.3
ifeq (${SPI_COMPILER_PLATFORM},gcc-4.8)
SPCOMP2_COMPILER ?= gcc48m64
CMAKE_CXX_STANDARD ?= 11
else
SPCOMP2_COMPILER ?= gcc63
CMAKE_CXX_STANDARD ?= 14
endif
SP_PLATFORM ?= linux
SP_PROC ?= x86_64
SP_REZ_OS ?= CentOS-7
else ifeq (${platform}, macosx)
# Generic OSX machines (including LG's laptop)
COMPILER ?= clang
SPCOMP2_COMPILER ?= clang
SP_OS ?= macosx
SP_PLATFORM ?= macosx
SP_PROC ?= x86_64
SP_REZ_OS ?= MacOS
else
$(error Unknown SP_OS=${SP_OS} platform=${platform})
endif # endif ${SP_OS}
PYTHON_VERSION ?= 2.7
MY_CMAKE_FLAGS += -DSP_OS=${SP_OS} -DSP_PLATFORM=${SP_PLATFORM}
MY_CMAKE_FLAGS += -DSP_PROC=${SP_PROC} -DSP_REZ_OS=${SP_REZ_OS}
MY_CMAKE_FLAGS += -DSPI_COMPILER_PLATFORM=${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS:STRING="-DOSL_SPI=1" -DOSL_SITE:STRING=spi
MY_CMAKE_FLAGS += -DSPI_TESTS=1
MY_CMAKE_FLAGS += -DOSL_NAMESPACE_INCLUDE_PATCH=1
REZ_PACKAGE_ROOT ?= /shots/spi/home/software/packages
SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
## Rhel7 (current)
ifeq (${SP_OS}, rhel7)
USE_SIMD ?= sse4.1,aes
CMAKE ?= cmake
USE_NINJA ?= 1
NINJA ?= ninja
ifeq ($(USE_NINJA),1)
MY_CMAKE_FLAGS += -DCMAKE_MAKE_PROGRAM=${NINJA}
endif
export CCACHE_CPP2 ?= 1
# Override lib64 and use SPI convention of lib
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_LIBDIR="${INSTALL_PREFIX}/lib"
ifeq (${OSL_SPCOMP2},1)
MY_CMAKE_FLAGS += -DPYTHON_SITE_DIR="${INSTALL_PREFIX}/python"
else ifeq (${OSL_SPIREZ},1)
MY_CMAKE_FLAGS += -DPYTHON_SITE_DIR="${INSTALL_PREFIX}/python"
else ifeq (${OSL_ARNOLD},1)
OIIO_LIBNAME_SUFFIX ?= _Arnold
OSL_LIBNAME_SUFFIX ?= _Arnold
endif
#
# Compilers:
#
# A variety of tags can be used to try specific versions of gcc or
# clang from the site-specific places we have installed them.
LLVM_DIRECTORY ?= /shots/spi/home/lib/arnold/rhel7/llvm_8.0.0
ifeq (${COMPILER},clang6)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_6.0.1
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang7)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_7.0.1
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang8)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_8.0.0
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang9)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/9.0.1-1/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang10)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/10.0.0-1/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang11)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/11.0.0-rc1/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER}, gcc6)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++
else ifeq (${COMPILER},gcc)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
else ifeq (${COMPILER},)
# default compiler is clang, taken from the LLVM directory
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
endif
ifeq (${SPI_COMPILER_PLATFORM},gcc-4.8)
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" \
-DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr" \
-DTOOLCHAIN_FLAGS="--gcc-toolchain=/usr"
endif
MY_CMAKE_FLAGS +=
-DLLVM_STATIC=1 \
-DLLVM_VERSION=${LLVM_VERSION} \
-DLLVM_DIRECTORY=${LLVM_DIRECTORY}
#
# Boost
#
BOOSTVERS ?= 1.70
BOOSTSPSUFFIX ?=
BOOSTVERSSP=${BOOSTVERS}${BOOSTSPSUFFIX}
MY_CMAKE_FLAGS += -DBOOST_VERS_SP=${BOOSTVERSSP}
# $(info BOOSTVERSSP ${BOOSTVERSSP})
ifeq (${BOOSTVERS},1.55)
SPBOOST_INC_DIR ?= /usr/include/boost_${BOOSTVERSSP}
SPBOOST_LIB_DIR ?= /usr/lib64/boost_${BOOSTVERSSP}
ifeq (${BOOSTSPSUFFIX}, sp)
SPBOOST_LIBNAMESTART ?= lib${BOOSTSPSUFFIX}boost_${shell echo ${BOOSTVERS} | sed "s/\\./_/"}_0
else
SPBOOST_LIBNAMESTART ?= lib${BOOSTSPSUFFIX}boost
endif
SPBOOST_LIBNAMEEND ?= -gcc48-mt-${shell echo ${BOOSTVERS} | sed "s/\\./_/"}
MY_CMAKE_FLAGS += \
-DBOOST_CUSTOM=1 \
-DBoost_VERSION=${BOOSTVERS} \
-DBoost_INCLUDE_DIRS=${SPBOOST_INC_DIR} \
-DBoost_LIBRARY_DIRS=${SPBOOST_LIB_DIR} \
-DBoost_LIBRARIES:STRING="${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_filesystem${SPBOOST_LIBNAMEEND}.so;${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_regex${SPBOOST_LIBNAMEEND}.so;${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_system${SPBOOST_LIBNAMEEND}.so;${SPBOOST_LIB_DIR}/${SPBOOST_LIBNAMESTART}_thread${SPBOOST_LIBNAMEEND}.so"
else
# Our Boost >= 1.61 setup is MUCH simpler and more standard
SPBOOST_INC_DIR := /usr/include/boostroot/boost${BOOSTVERSSP}.0
SPBOOST_LIB_DIR := /usr/lib64/boostroot/boost${BOOSTVERSSP}.0
MY_CMAKE_FLAGS += \
-DBOOST_INCLUDEDIR=${SPBOOST_INC_DIR} \
-DBOOST_LIBRARYDIR=${SPBOOST_LIB_DIR}
endif
#
# Python
#
PYTHON_INCLUDE_DIR ?= /usr/include/python${PYTHON_VERSION}
PYTHON_LIBRARY_DIR ?= /usr/lib64
PYTHON_LIBRARY ?= ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
ifeq (${PYTHON_VERSION},3.6)
# Special sauce for Python 3.6
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
MY_CMAKE_FLAGS += \
-DPYTHONINTERP_FOUND=1 \
-DPYTHON_VERSION_STRING=3.6.3 \
-DPYTHON_VERSION_MAJOR=3 \
-DPYTHON_VERSION_MINOR=6 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
else ifeq (${PYTHON_VERSION},3.7)
# Special sauce for Python 3.7
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
MY_CMAKE_FLAGS += \
-DPYTHONINTERP_FOUND=1 \
-DPYTHON_VERSION_STRING=3.7.3 \
-DPYTHON_VERSION_MAJOR=3 \
-DPYTHON_VERSION_MINOR=7 \
-DPYTHON_VERSION_PATCH=3 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
else ifeq (${PYTHON_VERSION},2.7)
# Special sauce for Python 2.7
PYTHON_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}
PYTHON_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
MY_CMAKE_FLAGS += \
-DPYTHONINTERP_FOUND=1 \
-DPYTHON_VERSION_STRING=2.7.5 \
-DPYTHON_VERSION_MAJOR=2 \
-DPYTHON_VERSION_MINOR=7 \
-DPYTHON_VERSION_PATCH=5 \
-DPython_ADDITIONAL_VERSIONS="${PYTHON_VERSION}"
endif
MY_CMAKE_FLAGS += \
-DPYTHON_INCLUDE_DIR:STRING=${PYTHON_INCLUDE_DIR} \
-DPYTHON_LIBRARY:STRING=${PYTHON_LIBRARY} \
-Dpybind11_ROOT:STRING=${REZ_PACKAGE_ROOT}/pybind11/2.4.3/python-${PYTHON_VERSION}
# Set our preferred OpenEXR path, but allow env variable to override
# with custom/test version.
ifneq (${OPENEXR_VERSION},)
# If OPENEXR_VERSION is set, grab from the rez area
OpenEXR_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenEXR/${OPENEXR_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}
MY_CMAKE_FLAGS += -DOpenEXR_ROOT=${OpenEXR_ROOT}
else ifeq (${OpenEXR_ROOT},)
# If not getting from rez, get from the system install
MY_CMAKE_FLAGS += \
-DOPENEXR_INCLUDE_DIR=/usr/include/OpenEXR2 \
-DOPENEXR_LIBRARY_DIR=/usr/lib64/OpenEXR2
endif
Partio_VERSION ?= 1.10.6
partio_ROOT ?= ${REZ_PACKAGE_ROOT}/partio/${Partio_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERSSP}
MY_CMAKE_FLAGS += -Dpartio_ROOT="${partio_ROOT}"
pugixml_VERSION ?= 1.10.0
pugixml_ROOT ?= ${REZ_PACKAGE_ROOT}/pugixml/${pugixml_VERSION}/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -Dpugixml_ROOT="${pugixml_ROOT}"
# set up OSL distribution environment
SPARCH=${SP_OS}-$(SPCOMP2_COMPILER)$(CPPSTDSUFFIX)-boost$(subst .,,$(BOOSTVERSSP))
ifeq (${OSL_SPIREZ},1)
OpenImageIO_ROOT := ${REZ_PACKAGE_ROOT}/OpenImageIO/${OPENIMAGEIO_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERSSP}
$(info OpenImageIO_ROOT ${OpenImageIO_ROOT})
else ifeq (${OSL_SPCOMP2},1)
OpenImageIO_ROOT := $(SPCOMP2_ROOT)/OpenImageIO/$(SPARCH)/v$(OPENIMAGEIO_SPCOMP2_VERSION)
else ifeq (${OSL_ARNOLD},1)
OpenImageIO_ROOT ?= ${working_dir}/../OpenImageIO_local/dist/${platform}${variant}/
else ifneq (${OpenImageIO_ROOT},)
# User supplied something
endif
ifneq ($(OpenImageIO_ROOT),)
MY_CMAKE_FLAGS += -DOpenImageIO_ROOT=${OpenImageIO_ROOT}
endif
# Cuda/OptiX
USE_OPTIX ?= 1
CUDA_VERSION ?= 10.1u2
OPTIX_VERSION ?= 6.0.0
# CUDA_TOOLKIT_ROOT_DIR = $(shell rez-env -b cuda-${CUDA_VERSION} ${SPI_COMPILER_PLATFORM} -c "echo '$CUDA_TOOLKIT_ROOT'")
CUDA_TOOLKIT_ROOT_DIR ?= /shots/spi/home/lib/arnold/rhel7/cuda_${CUDA_VERSION}
CUDA_EXTRA_LIBS ?= ${CUDA_TOOLKIT_ROOT_DIR}/lib64/libnvrtc.so
OptiX_ROOT ?= /shots/spi/home/lib/arnold/rhel7/optix_${OPTIX_VERSION}
OPTIXHOME = ${OptiX_ROOT}
MY_CMAKE_FLAGS += -DUSE_OPTIX=${USE_OPTIX} \
-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR} \
-DCUDA_EXTRA_LIBS=${CUDA_EXTRA_LIBS} \
-DOPTIXHOME=${OPTIXHOME} -DOPTIX_EXTRA_LIBS=lzma
# end rhel7
## Generic OSX machines (including LG's laptop)
else ifeq (${platform}, macosx)
CMAKE_CXX_STANDARD ?= 14
USE_SIMD ?= sse4.2
MY_CMAKE_FLAGS += -DCMAKE_BUILD_WITH_INSTALL_RPATH=1
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_NAME_DIR="${working_dir}/dist/${platform}${variant}/lib"
BOOSTVERSSP=${BOOSTVERS}${BOOSTSPSUFFIX}
LLVM_DIRECTORY ?= /usr/local/opt/llvm
# A variety of tags can be used to try specific versions of gcc or
# clang from the site-specific places we have installed them.
ifeq (${COMPILER}, gcc48)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc5)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc6)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc8)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc9)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang6)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@6/6.0.1_2/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@6/6.0.1_2/bin/clang++
else ifeq (${COMPILER},clang7)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@7/7.0.1_1/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@7/7.0.1_1/bin/clang++
else ifeq (${COMPILER},clang8)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@8/8.0.1_1/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/8.0.1/bin/clang++
else ifeq (${COMPILER},clang9)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@9/9.0.1/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@9/9.0.1/bin/clang++
else ifeq (${COMPILER},clang10)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/10.0.0/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/10.0.0/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER},gcc)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
else ifeq (${COMPILER},)
# default compiler is clang, taken from the LLVM directory
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},llvm)
# "llvm" means "use the clang from our llvm"
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
endif
# end generic OSX
else
$(error Unknown SP_OS=${SP_OS} platform=${platform})
endif # endif ${SP_OS}
ifeq (${OSL_SPIREZ},1)
# Rpath touch-ups
# NOTE: This MUST match the order and naming of the Rez variants
# set in rez/package.py.in
REZ_INSTALL_PATH := ${REZ_PACKAGE_ROOT}/${OSL_REZ_NAME}/${OSL_VERS}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERSSP}/cuda-${CUDA_VERSION}/optix-${OPTIX_VERSION}
MY_CMAKE_FLAGS += -DOSL_REZ_INSTALL_PATH=${REZ_INSTALL_PATH}
MY_CMAKE_FLAGS += -DCMAKE_INSTALL_RPATH="${REZ_INSTALL_PATH}/lib;@executable_path/../lib;${OpenImageIO_ROOT}/lib"
INSTALL_PREFIX := ${working_dir}/dist/${platform}
endif
ifneq (${VERBOSE},)
$(info MY_CMAKE_FLAGS: $(MY_CMAKE_FLAGS))
endif
############################################################################
# SpComp2 magic incantations follow. Here be dragons.
############################################################################
CPPSTDSUFFIX=
SPCOMP2_INSTALL_ROOT ?= $(SPCOMP2_ROOT)
BOOSTVERSSP?=${BOOSTVERS}${BOOSTSPSUFFIX}
SPARCH=${SP_OS}-$(SPCOMP2_COMPILER)$(CPPSTDSUFFIX)-boost$(subst .,,$(BOOSTVERSSP))
OIIO_SPCOMP2_PATH := ${SPCOMP2_INSTALL_ROOT}/OpenImageIO/${SPARCH}/v${OPENIMAGEIO_SPCOMP2_VERSION}
# $(info New rhel7 OIIO_SPCOMP2_PATH is ${OIIO_SPCOMP2_PATH})
PYVERNOSPACE=${shell echo ${PYTHON_VERSION} | sed "s/\\.//"}
SPPYARCH=$(SPARCH)-py$(PYVERNOSPACE)
all: dist
local: dist
.PHONY: spcomp2_install spcomp2_install_local clean all
spi: MY_CMAKE_FLAGS += -DCMAKE_DEBUG_POSTFIX=_d
spi: debug dist
spcomp2_install_local: SPCOMP2_INSTALL_ROOT = $(SPCOMP2_LOCAL_PATH)
spcomp2_install_local: spcomp2_install
comma:= ,
empty:=
space:= $(empty) $(empty)
#OSL_SPCOMP2_PATH := ${SPCOMP2_INSTALL_ROOT}/OSL/${SP_OS}-${SPCOMP2_COMPILER}$(CPPSTDSUFFIX)-boost${SPCOMP2_BOOSTVERS_SUFFIX}/v${OSL_SPCOMP2_VERSION}
#$(info New rhel7 OSL_SPCOMP2_PATH is ${OSL_SPCOMP2_PATH})
#INSTALL_SPCOMP2_CURRENT = $(SPCOMP2_INSTALL_ROOT)/OSL/$(SPARCH)/v$(OSL_SPCOMP2_VERSION)
#INSTALL_BIN_LOCATION = $(INSTALL_SPCOMP2_CURRENT)/bin
SPCOMP2_RPATH_OPT ?= ${OpenImageIO_ROOT}/lib:${partio_ROOT}/lib
SPCOMP2_RPATH_DEBUG ?= ${OpenImageIO_ROOT}/lib:${partio_ROOT}/lib/debug
#PYSPCOMP2_RPATH_OPT ?= ${SPCOMP2_RPATH_OPT}:${OSL_SPCOMP2_PATH}/lib:${PYTHON_LIBRARY_DIR}
#PYSPCOMP2_RPATH_DEBUG ?= ${SPCOMP2_RPATH_DEBUG}:${OSL_SPCOMP2_PATH}/lib/debug:${PYTHON_LIBRARY_DIR}
spcomp2: MY_CMAKE_FLAGS += \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
-DCMAKE_INSTALL_RPATH=$(SPCOMP2_INSTALL_ROOT)/OSL/$(SPARCH)/v$(OSL_SPCOMP2_VERSION)/lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
-DPYLIB_INCLUDE_SONAME:BOOL=ON \
-DPYLIB_LIB_PREFIX:BOOL=ON \
-DPYMODULE_SUFFIX="V${OSL_SPCOMP2_VERSION}"
spcomp2: dist
spcomp2_debug: MY_CMAKE_FLAGS += \
-DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
-DCMAKE_INSTALL_RPATH=$(SPCOMP2_INSTALL_ROOT)/OSL/$(SPARCH)/v$(OSL_SPCOMP2_VERSION)/lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
-DPYLIB_INCLUDE_SONAME:BOOL=ON \
-DPYLIB_LIB_PREFIX:BOOL=ON \
-DPYMODULE_SUFFIX="V${OSL_SPCOMP2_VERSION}"
spcomp2_debug: debug
spcomp2_install_fixup_rhel7: spcomp2 spcomp2_debug
echo $(SPCOMP2_INSTALL_ROOT)
patchelf --set-rpath ${SPCOMP2_RPATH_OPT} ${dist_dir}/lib/liboslexec${OSL_LIBNAME_SUFFIX}.so
patchelf --set-rpath ${SPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/lib/liboslexec.so
patchelf --set-rpath ${SPCOMP2_RPATH_OPT} ${dist_dir}/lib/liboslcomp${OSL_LIBNAME_SUFFIX}.so
patchelf --set-rpath ${SPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/lib/liboslcomp.so
patchelf --set-rpath ${SPCOMP2_RPATH_OPT} ${dist_dir}/lib/liboslquery${OSL_LIBNAME_SUFFIX}.so
patchelf --set-rpath ${SPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/lib/liboslquery.so
# patchelf --set-rpath ${PYSPCOMP2_RPATH_OPT} ${dist_dir}/python/libPyOSL.so
# patchelf --set-rpath ${PYSPCOMP2_RPATH_DEBUG} ${dist_dir}.debug/python/libPyOSL.so
# This goal can't start with 'install' because something elsewhere picks
# it up and starts doing bad things
spcomp2_install: spcomp2_install_fixup_${SP_OS}
perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
--project=oslexec \
--version=$(OSL_SPCOMP2_VERSION) \
--root=$(SPCOMP2_INSTALL_ROOT) \
--arch=$(SPARCH) \
--headers=$(subst $(space),$(comma),$(wildcard ${dist_dir}/include/OSL/*)) \
--cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread" \
--namespace=${NAMESPACE} \
--srcdir=${dist_dir}/lib \
--builddir_o=${dist_dir}/lib \
--builddir_d=${dist_dir}.debug/lib
perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
--project=oslquery \
--version=$(OSL_SPCOMP2_VERSION) \
--root=$(SPCOMP2_INSTALL_ROOT) \
--arch=$(SPARCH) \
--headers=$(subst $(space),$(comma),$(wildcard ${dist_dir}/include/OSL/*)) \
--cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread" \
--namespace=${NAMESPACE} \
--srcdir=${dist_dir}/lib \
--builddir_o=${dist_dir}/lib \
--builddir_d=${dist_dir}.debug/lib
#perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
# --project=oslcomp \
# --version=$(OSL_SPCOMP2_VERSION) \
# --root=$(SPCOMP2_INSTALL_ROOT) \
# --arch=$(SPARCH) \
# --headers=$(subst $(space),$(comma),$(wildcard ${dist_dir}/include/OSL/*)) \
# --cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread" \
# --namespace=${NAMESPACE} \
# --srcdir=${dist_dir}/lib \
# --builddir_o=${dist_dir}/lib \
# --builddir_d=${dist_dir}.debug/lib
#perl -I/usr/local/spi/lib/make /usr/local/spi/bin/spcomp_install.pl -m installhost \
# --project=PyOSL \
# --version=$(OSL_SPCOMP2_VERSION) \
# --root=$(SPCOMP2_INSTALL_ROOT) \
# --arch=$(SPPYARCH) \
# --cflags= --static_lflags="$(LINK_BOOST) $(LINK_OPENEXR) -lpthread"\
# --namespace=${NAMESPACE} \
# --srcdir=${dist_dir}/python \
# --builddir_o=${dist_dir}/python \
# --builddir_d=${dist_dir}.debug/python
-72
View File
@@ -1,72 +0,0 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the Open Shading Language Project. -->
Build a variant for Rez/general use
-----------------------------------
Skip this section if you are instead building for SpComp2.
Note: For testing or to make your own local rez package, you can customize
either the rez package name, or the rez install location name, with make
flags `OSL_REZ_NAME=blah REZ_PACKAGE_ROOT=/path/to/my/rez/pkgs` appended
to the `make` commands of any of the variants listed below. For example,
make OSL_SPIREZ=1 OSL_REZ_NAME=oiio_test REZ_PACKAGE_ROOT=/path/to/my/rez/pkgs
Variants:
# C++11/gcc4.8 compat, Python 2.7, Boost 1.55, OptiX 6, Cuda 10.1
# OIIO 2.2.0.0, OpenEXR 2.2
make nuke
make spi OSL_SPIREZ=1 BOOSTVERS=1.55 USE_OPTIX=1 CUDA_VERSION=10.1 OPTIX_VERSION=6.0.0 OPENIMAGEIO_VERSION=2.2.0.0 OPENEXR_VERSION=2.2.0 PYTHON_VERSION=2.7
# C++11/gcc6.3 compat, Python 2.7, Boost 1.70, OptiX 6, Cuda 10.1
# OIIO 2.2.0.0, OpenEXR 2.4
make nuke
make spi OSL_SPIREZ=1 SPI_COMPILER_PLATFORM=gcc-6.3 BOOSTVERS=1.70 USE_OPTIX=1 CUDA_VERSION=10.1 OPTIX_VERSION=6.0.0 OPENIMAGEIO_VERSION=2.2.0.0 OPENEXR_VERSION=2.4.0 PYTHON_VERSION=2.7
You can do any of these on your local machine.
Rez/general release (do for each variant)
-----------------------------------------
This must be done from compile42 (for correct write permissions on certain
shared directories), even if you did the build itself locally.
For any of the variants that you built above:
( cd dist/rhel7 ; rez release --skip-repo-errors )
That command will release the dist to the studio.
Appwrapper binary releases
--------------------------
We don't currently do this.
<!---
This step is for the ONE general/rez variant that we believe is the
canonical source of command line oslc and oslinfo. After building and
releasing as above,
cp dist/rhel7/OSL_*.xml /shots/spi/home/lib/app_cfg/OSL
That will make appcfg aware of the release.
To also make this release the new facility default:
db-any spi/home/OSL.bin highest /shots/spi/home/lib/app_cfg/OSL/OSL_A.B.C.D.xml
where A.B.C.D is the version.
--->
SpComp2 build and release
-------------------------
Phasing out support for this.
-6
View File
@@ -1,6 +0,0 @@
<cfg>
<version>@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@</version>
<appdir architecture="@SP_OS@">@OSL_REZ_INSTALL_PATH@</appdir>
<launchprogram></launchprogram>
<setup></setup>
</cfg>
-20
View File
@@ -1,20 +0,0 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
option (${PROJ_NAME}_SPIREZ "Enable extra bits for building for SPI Rez install" OFF)
set (${PROJ_NAME}_REZ_PACKAGE_NAME CACHE STRING "${PROJECT_NAME}")
if (${PROJ_NAME}_SPIREZ)
message (STATUS "Creating package.py from package.py.in")
configure_file ("${PROJECT_SOURCE_DIR}/site/spi/rez/package.py.in" "${CMAKE_BINARY_DIR}/package.py")
set (appcfg_filename "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}.xml")
configure_file ("${PROJECT_SOURCE_DIR}/site/spi/appcfg.xml.in" "${appcfg_filename}")
install (FILES ${CMAKE_BINARY_DIR}/package.py
"${PROJECT_SOURCE_DIR}/site/spi/rez/CMakeLists.txt"
${appcfg_filename}
DESTINATION ${CMAKE_INSTALL_PREFIX}
COMPONENT developer)
endif ()
-21
View File
@@ -1,21 +0,0 @@
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# This helper script takes a major.minor.patch semantic version string
# ("2.1.1") and reformats it into the dot-less zero-padded version like
# "20101". This is necessary to turn external release designations into
# integer SpComp2 version numbers.
from __future__ import print_function
import sys
if len(sys.argv) != 2 :
print('Need 1 argument: version number with dots')
exit(1)
vers = sys.argv[1]
parts = vers.split('.')
print ('{:d}{:02d}{:02d}'.format(int(parts[0]), int(parts[1]), int(parts[2])))
-31
View File
@@ -1,31 +0,0 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
cmake_minimum_required(VERSION 2.8)
project(OSL)
include(RezBuild)
rez_install_dirs(
include lib share
# python
DESTINATION .
)
# Bin specified separately so it can be marked as EXECUTABLE, otherwise it
# installs with only read permissions.
rez_install_dirs(
bin
DESTINATION .
EXECUTABLE
)
rez_install_cmake(
DESTINATION .
INCLUDE_DIRS include
LIBRARY_DIRS lib
LIBRARIES oslexec oslcomp oslquery
oslexec_d oslcomp_d oslquery_d
)
-59
View File
@@ -1,59 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
#
# Documentation on packages and available attributes can be found at:
# https://github.com/nerdvegas/rez/wiki/Package-Definition-Guide
name = '@OSL_REZ_PACKAGE_NAME@'
version = '@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@'
description = \
"""
Rez package of Open Shading Language (OSL)
"""
authors = ['Larry Gritz <lg@imageworks.com>']
# Add dependencies to other Rez packages here
requires = [
'platform-@SP_PLATFORM@', 'arch-@SP_PROC@', 'os-@SP_REZ_OS@',
'OpenImageIO-@OPENIMAGEIO_VERSION_MAJOR@.@OPENIMAGEIO_VERSION_MINOR@.@OPENIMAGEIO_VERSION_PATCH@'
]
#build_command = 'python {root}/build.py'
# Rez has a limitation where it is not possible to add variants to a package that
# does not have any: https://github.com/nerdvegas/rez/wiki/Variants#single-variants.
# Unless you are 100% certain that your package will NEVER require any variants,
# you should define your package with at least one variant.
variants = [
[
'@SPI_COMPILER_PLATFORM@',
'python-@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@',
'boost-@BOOST_VERS_SP@',
'cuda-@CUDA_VERSION@',
'optix-@OPTIX_VERSION@'
],
]
def commands():
# Add import statements here, not at the top of the file!
# Uncomment if you have executables under bin/
env.PATH.append("{root}/bin")
env.LD_LIBRARY_PATH.append("{root}/lib")
# Uncomment if you have Python code under python/
env.PYTHONPATH.append("{root}/python")
# For SpImport.Packages, append the python directory
#env.SPIMPORT_PACKAGES.append("{root}/python")
if building:
env.CMAKE_MODULE_PATH.append('{root}')
# Add env vars or custom code you want executed only at build time
+25
View File
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the Open Shading Language Project.
sonar.host.url=https://sonarcloud.io
# Required metadata
sonar.organization=academysoftwarefoundation
sonar.projectName=OpenShadingLanguage
sonar.projectVersion=1.12
sonar.projectKey=AcademySoftwareFoundation_OpenShadingLanguage
# Project links
sonar.links.homepage=https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
sonar.links.ci=https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/actions
sonar.links.scm=https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
sonar.links.issue=https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues
# Source properties
sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.exclusions=src/include/OSL/Imath/*.h,src/build-scripts/*
# C/C++ analyzer properties
sonar.cfamily.build-wrapper-output=build/bw_output
sonar.cfamily.gcov.reportsPath=_coverage
-273
View File
@@ -1,273 +0,0 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT (openexr)
SET(OPENEXR_VERSION_MAJOR "2")
SET(OPENEXR_VERSION_MINOR "2")
SET(OPENEXR_VERSION_PATCH "0")
SET(OPENEXR_VERSION ${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH})
SET(OPENEXR_VERSION_API ${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR})
# enable the tests
ENABLE_TESTING()
# distro building
SET(CPACK_PACKAGE_VERSION_MAJOR "${OPENEXR_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${OPENEXR_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${OPENEXR_VERSION_PATCH}")
SET(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${OPENEXR_VERSION}"
)
set(CPACK_SOURCE_IGNORE_FILES
"/.git*;/.cvs*;${CPACK_SOURCE_IGNORE_FILES}")
INCLUDE ( CPack )
# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
OPTION (USE_ZLIB_WINAPI "Use ZLib Win API" OFF)
OPTION (NAMESPACE_VERSIONING "Use Namespace Versioning" ON)
OPTION (BUILD_UTILS "Build the binary/utility programs" ON)
OPTION (BUILD_TESTS "Build the tests" ON)
# Setup osx rpathing
SET (CMAKE_MACOSX_RPATH 1)
SET (BUILD_WITH_INSTALL_RPATH 1)
ADD_DEFINITIONS ( -DHAVE_CONFIG_H -DILM_IMF_TEST_IMAGEDIR="${CMAKE_SOURCE_DIR}/IlmImfTest/" )
INCLUDE_DIRECTORIES (
${CMAKE_CURRENT_BINARY_DIR}/config
IlmImf
IlmImfUtil
exrmaketiled
exrenvmap
exrmakepreview
exrmultiview
IlmImfFuzzTest
)
FIND_PACKAGE(ZLIB REQUIRED)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
IF (NOT WIN32)
SET ( PTHREAD_LIB pthread )
ENDIF()
INCLUDE_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/include/OpenEXR )
LINK_DIRECTORIES ( ${ILMBASE_PACKAGE_PREFIX}/lib )
MESSAGE ( "ILMBASE_PACKAGE_PREFIX = " ${ILMBASE_PACKAGE_PREFIX})
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
SET (LIB_TYPE SHARED)
IF (WIN32)
ADD_DEFINITIONS(-DOPENEXR_DLL)
ENDIF ()
ENDIF ()
IF (USE_ZLIB_WINAPI)
ADD_DEFINITIONS(-DZLIB_WINAPI)
ENDIF ()
# Test for GCC-style inline asm support with AVX instructions
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES (
"
int main()
{
#if defined(__GNUC__) && defined(__SSE2__)
int n = 0;
int eax = 0;
int edx = 0;
__asm__(
\"xgetbv ;\"
\"vzeroupper \"
: \"=a\"(eax), \"=d\"(edx) : \"c\"(n) : );
#else
#error No GCC style inline asm supported for AVX instructions
#endif
}
" HAVE_GCC_INLINE_ASM_AVX)
# Check if sysconf(_SC_NPROCESSORS_ONLN) can be used for CPU count
CHECK_CXX_SOURCE_COMPILES (
"
#include <unistd.h>
int main()
{
sysconf(_SC_NPROCESSORS_ONLN);
}
" HAVE_SYSCONF_NPROCESSORS_ONLN)
##########################
# OpenEXRConfig.h generation
##########################
IF (WIN32)
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" )
ELSEIF (APPLE)
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_DARWIN 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#include <string.h>\n" )
ELSE ()
# Linux
FILE ( WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_LINUX_PROCFS 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_LARGE_STACK 1\n" )
ENDIF()
IF (NAMESPACE_VERSIONING)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 1\n")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_NAMESPACE Imf\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE Imf_${OPENEXR_VERSION_API}\n\n" )
ELSE ()
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 0\n")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_NAMESPACE Imf\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_INTERNAL_NAMESPACE Imf\n\n" )
ENDIF ()
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_VERSION_STRING \"${OPENEXR_VERSION}\"\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_PACKAGE_STRING \"OpenEXR ${OPENEXR_VERSION}\"\n" )
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "
#define OPENEXR_VERSION_MAJOR ${OPENEXR_VERSION_MAJOR}
#define OPENEXR_VERSION_MINOR ${OPENEXR_VERSION_MINOR}
#define OPENEXR_VERSION_PATCH ${OPENEXR_VERSION_PATCH}
")
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "
// Version as a single hex number, e.g. 0x01000300 == 1.0.3
#define OPENEXR_VERSION_HEX ((OPENEXR_VERSION_MAJOR << 24) | \\
(OPENEXR_VERSION_MINOR << 16) | \\
(OPENEXR_VERSION_PATCH << 8))\n
")
IF (HAVE_GCC_INLINE_ASM_AVX)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX 1\n" )
ENDIF()
IF (HAVE_SYSCONF_NPROCESSORS_ONLN)
FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h "#define OPENEXR_IMF_HAVE_SYSCONF_NPROCESSORS_ONLN 1\n" )
ENDIF()
SET (OPENEXR_LIBSUFFIX "")
SET (ILMBASE_LIBSUFFIX "")
IF (NAMESPACE_VERSIONING)
SET ( OPENEXR_LIBSUFFIX "-${OPENEXR_VERSION_API}" )
# assume same NAMESPACE_VERSION setting for IlmBase for now
SET ( ILMBASE_LIBSUFFIX "-${OPENEXR_VERSION_API}" )
ENDIF ()
##########################
# IlmImf library
##########################
ADD_SUBDIRECTORY ( IlmImf )
SET_TARGET_PROPERTIES ( IlmImf
PROPERTIES
VERSION 22.0.0
SOVERSION 22
OUTPUT_NAME "IlmImf${OPENEXR_LIBSUFFIX}"
)
##########################
# IlmImfUtil library
##########################
ADD_SUBDIRECTORY ( IlmImfUtil )
SET_TARGET_PROPERTIES ( IlmImfUtil
PROPERTIES
VERSION 22.0.0
SOVERSION 22
OUTPUT_NAME "IlmImfUtil${OPENEXR_LIBSUFFIX}"
)
##########################
# Example Code
##########################
ADD_SUBDIRECTORY ( IlmImfExamples )
##########################
# Tests
##########################
if (BUILD_TESTS)
ADD_SUBDIRECTORY ( IlmImfTest )
ADD_SUBDIRECTORY ( IlmImfUtilTest )
ADD_SUBDIRECTORY ( IlmImfFuzzTest )
endif ()
##########################
# Binaries / Utilities
##########################
if (BUILD_UTILS)
ADD_SUBDIRECTORY ( exrheader )
ADD_SUBDIRECTORY ( exrmaketiled )
ADD_SUBDIRECTORY ( exrstdattr )
ADD_SUBDIRECTORY ( exrmakepreview )
ADD_SUBDIRECTORY ( exrenvmap )
ADD_SUBDIRECTORY ( exrmultiview )
ADD_SUBDIRECTORY ( exrmultipart )
endif ()
##########################
# Installation
##########################
INSTALL ( FILES
${CMAKE_CURRENT_BINARY_DIR}/config/OpenEXRConfig.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/OpenEXR
)
# Documentation
INSTALL ( FILES
doc/TechnicalIntroduction.pdf
doc/ReadingAndWritingImageFiles.pdf
doc/OpenEXRFileLayout.pdf
doc/MultiViewOpenEXR.pdf
doc/InterpretingDeepPixels.pdf
doc/TheoryDeepPixels.pdf
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/doc/OpenEXR-${OPENEXR_VERSION}
)
# Examples
INSTALL ( FILES
IlmImfExamples/main.cpp
IlmImfExamples/drawImage.cpp
IlmImfExamples/rgbaInterfaceExamples.cpp
IlmImfExamples/rgbaInterfaceTiledExamples.cpp
IlmImfExamples/generalInterfaceExamples.cpp
IlmImfExamples/lowLevelIoExamples.cpp
IlmImfExamples/previewImageExamples.cpp
IlmImfExamples/generalInterfaceTiledExamples.cpp
IlmImfExamples/generalInterfaceTiledExamples.h
IlmImfExamples/drawImage.h
IlmImfExamples/rgbaInterfaceExamples.h
IlmImfExamples/generalInterfaceExamples.h
IlmImfExamples/rgbaInterfaceTiledExamples.h
IlmImfExamples/lowLevelIoExamples.h
IlmImfExamples/previewImageExamples.h
IlmImfExamples/namespaceAlias.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/doc/OpenEXR-${OPENEXR_VERSION}/examples
)
# LG additions
if (DEFINED ENV{APPVEYOR})
add_definitions ("/W0")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /W0")
endif ()
@@ -1,273 +0,0 @@
# yue.nicholas@gmail.com
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h")
ADD_EXECUTABLE ( b44ExpLogTable
b44ExpLogTable.cpp
)
TARGET_LINK_LIBRARIES ( b44ExpLogTable
Half
Iex${ILMBASE_LIBSUFFIX}
IlmThread${ILMBASE_LIBSUFFIX}
${PTHREAD_LIB}
)
ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/b44ExpLogTable > ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h
DEPENDS b44ExpLogTable
)
else ()
message (STATUS "Skipping build of b44ExpLogTable.h")
endif ()
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h")
ADD_EXECUTABLE ( dwaLookups
dwaLookups.cpp
)
TARGET_LINK_LIBRARIES ( dwaLookups
Half
Iex${ILMBASE_LIBSUFFIX}
IlmThread${ILMBASE_LIBSUFFIX}
${PTHREAD_LIB}
)
ADD_CUSTOM_COMMAND (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dwaLookups > ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
DEPENDS dwaLookups
)
else ()
message (STATUS "Skipping build of dwaLookups.h")
endif ()
SET ( ILMIMF_SRCS
ImfAttribute.cpp
ImfBoxAttribute.cpp
ImfCRgbaFile.cpp
ImfChannelList.cpp
ImfChannelListAttribute.cpp
ImfFloatAttribute.cpp
ImfFrameBuffer.cpp
ImfHeader.cpp
ImfIO.cpp
ImfInputFile.cpp
ImfIntAttribute.cpp
ImfLineOrderAttribute.cpp
ImfMatrixAttribute.cpp
ImfOpaqueAttribute.cpp
ImfOutputFile.cpp
ImfRgbaFile.cpp
ImfStringAttribute.cpp
ImfVecAttribute.cpp
ImfHuf.cpp
ImfThreading.cpp
ImfWav.cpp
ImfLut.cpp
ImfCompressor.cpp
ImfRleCompressor.cpp
ImfZipCompressor.cpp
ImfPizCompressor.cpp
ImfB44Compressor.cpp
ImfDwaCompressor.cpp
ImfMisc.cpp
ImfCompressionAttribute.cpp
ImfDoubleAttribute.cpp
ImfConvert.cpp
ImfPreviewImage.cpp
ImfPreviewImageAttribute.cpp
ImfVersion.cpp
ImfChromaticities.cpp
ImfChromaticitiesAttribute.cpp
ImfKeyCode.cpp
ImfKeyCodeAttribute.cpp
ImfTimeCode.cpp
ImfTimeCodeAttribute.cpp
ImfRational.cpp
ImfRationalAttribute.cpp
ImfFramesPerSecond.cpp
ImfStandardAttributes.cpp
ImfStdIO.cpp
ImfEnvmap.cpp
ImfEnvmapAttribute.cpp
ImfScanLineInputFile.cpp
ImfTiledInputFile.cpp
ImfTiledMisc.cpp
ImfTiledOutputFile.cpp
ImfTiledRgbaFile.cpp
ImfTileDescriptionAttribute.cpp
ImfTileOffsets.cpp
ImfRgbaYca.cpp
ImfPxr24Compressor.cpp
ImfTestFile.cpp
ImfStringVectorAttribute.cpp
ImfMultiView.cpp
ImfAcesFile.cpp
ImfMultiPartOutputFile.cpp
ImfGenericOutputFile.cpp
ImfOutputPartData.cpp
ImfMultiPartInputFile.cpp
ImfGenericInputFile.cpp
ImfPartType.cpp
ImfInputPartData.cpp
ImfOutputPart.cpp
ImfTiledOutputPart.cpp
ImfInputPart.cpp
ImfTiledInputPart.cpp
ImfDeepScanLineInputPart.cpp
ImfDeepScanLineOutputPart.cpp
ImfDeepScanLineInputFile.cpp
ImfDeepScanLineOutputFile.cpp
ImfDeepTiledInputPart.cpp
ImfDeepTiledOutputPart.cpp
ImfDeepTiledInputFile.cpp
ImfDeepTiledOutputFile.cpp
ImfDeepFrameBuffer.cpp
ImfDeepCompositing.cpp
ImfCompositeDeepScanLine.cpp
ImfDeepImageStateAttribute.cpp
ImfFastHuf.cpp
ImfFloatVectorAttribute.cpp
ImfRle.cpp
ImfSystemSpecific.cpp
ImfZip.cpp
)
IF (BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DILMIMF_EXPORTS)
ENDIF()
ADD_LIBRARY ( IlmImf ${LIB_TYPE}
${ILMIMF_SRCS}
)
TARGET_LINK_LIBRARIES ( IlmImf
Half
Iex${ILMBASE_LIBSUFFIX}
Imath${ILMBASE_LIBSUFFIX}
IlmThread${ILMBASE_LIBSUFFIX}
${PTHREAD_LIB} ${ZLIB_LIBRARIES}
)
ADD_DEPENDENCIES ( IlmImf b44ExpLogTable )
SET_SOURCE_FILES_PROPERTIES (
ImfB44Compressor.cpp
PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h
)
ADD_DEPENDENCIES ( IlmImf dwaLookups )
SET_SOURCE_FILES_PROPERTIES (
ImfDwaCompressor.cpp
PROPERTIES
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dwaLookups.h
)
# Libraries
INSTALL ( TARGETS
IlmImf
DESTINATION
${CMAKE_INSTALL_PREFIX}/lib
)
# Headers
INSTALL ( FILES
ImfForward.h
ImfExport.h
ImfAttribute.h
ImfBoxAttribute.h
ImfCRgbaFile.h
ImfChannelList.h
ImfChannelListAttribute.h
ImfCompressionAttribute.h
ImfDoubleAttribute.h
ImfFloatAttribute.h
ImfFrameBuffer.h
ImfHeader.h
ImfIO.h
ImfInputFile.h
ImfIntAttribute.h
ImfLineOrderAttribute.h
ImfMatrixAttribute.h
ImfOpaqueAttribute.h
ImfOutputFile.h
ImfRgbaFile.h
ImfStringAttribute.h
ImfVecAttribute.h
ImfHuf.h
ImfWav.h
ImfLut.h
ImfArray.h
ImfCompression.h
ImfLineOrder.h
ImfName.h
ImfPixelType.h
ImfVersion.h
ImfXdr.h
ImfConvert.h
ImfPreviewImage.h
ImfPreviewImageAttribute.h
ImfChromaticities.h
ImfChromaticitiesAttribute.h
ImfKeyCode.h
ImfKeyCodeAttribute.h
ImfTimeCode.h
ImfTimeCodeAttribute.h
ImfRational.h
ImfRationalAttribute.h
ImfFramesPerSecond.h
ImfStandardAttributes.h
ImfEnvmap.h
ImfEnvmapAttribute.h
ImfInt64.h
ImfRgba.h
ImfTileDescription.h
ImfTileDescriptionAttribute.h
ImfTiledInputFile.h
ImfTiledOutputFile.h
ImfTiledRgbaFile.h
ImfRgbaYca.h
ImfTestFile.h
ImfThreading.h
ImfB44Compressor.h
ImfStringVectorAttribute.h
ImfMultiView.h
ImfAcesFile.h
ImfMultiPartOutputFile.h
ImfGenericOutputFile.h
ImfMultiPartInputFile.h
ImfGenericInputFile.h
ImfPartType.h
ImfPartHelper.h
ImfOutputPart.h
ImfTiledOutputPart.h
ImfInputPart.h
ImfTiledInputPart.h
ImfDeepScanLineOutputFile.h
ImfDeepScanLineOutputPart.h
ImfDeepScanLineInputFile.h
ImfDeepScanLineInputPart.h
ImfDeepTiledInputFile.h
ImfDeepTiledInputPart.h
ImfDeepTiledOutputFile.h
ImfDeepTiledOutputPart.h
ImfDeepFrameBuffer.h
ImfDeepCompositing.h
ImfCompositeDeepScanLine.h
ImfNamespace.h
ImfMisc.h
ImfDeepImageState.h
ImfDeepImageStateAttribute.h
ImfFloatVectorAttribute.h
DESTINATION
${CMAKE_INSTALL_PREFIX}/include/OpenEXR
)
+413
View File
@@ -0,0 +1,413 @@
#!/usr/bin/env python3
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
import getopt
import graphviz
import itertools
import os
import re
import sys
from collections import OrderedDict
from dataclasses import dataclass, field
from typing import Dict
#-------------------------------------------------------------------------------
# PTX parsing helpers
#-------------------------------------------------------------------------------
# pre-compile some regex patterns to speed up parsing
call_ptn = re.compile(r"^\s*(call\.uni).*$")
dec_ptn = re.compile(r"^\s*(\.pragma|\.extern|\.visible|\.func|\.local|\.global|\.reg|\.param|LBB[0-9_]+\:)(.*)$")
fn_ptn = re.compile(r"^(\.visible \.func|\.visible \.entry|\.weak \.func|\.func).*[\s]+([a-zA-Z0-9_]+)[\(\)]*$")
inst_ptn = re.compile(r"^\s*([@!%p0-9 ]*)([a-zA-Z0-9\.]+)\s*([a-zA-Z0-9\$\.,% _\[\]{}+-]+);.*$")
mem_ptn = re.compile(r"^\s*(st|ld).*;$")
ret_ptn = re.compile(r"^\s*(ret);.*$")
def get_func_name(line):
match = fn_ptn.match(line)
if match:
return match.group(2)
else:
return ""
def is_func_or_decl(line):
match = fn_ptn.match(line)
if match:
return True
else:
return False
def is_call_start(line):
if line.find("call.uni") != -1:
return True
else:
return False
def is_instruction(line):
match = call_ptn.match(line)
if match:
return True
if len(line) < 4:
return False
if not line.endswith(';'):
return False
match = dec_ptn.match(line)
if not match:
return True
else:
return False
def is_mem_inst(line):
match = mem_ptn.match(line)
if match:
return True
else:
return False
def parse_inst(line):
if not is_instruction(line):
return "", "", ""
match = call_ptn.match(line)
if match:
return "", "call.uni", ""
match = ret_ptn.match(line)
if match:
return "", "ret", ""
match = inst_ptn.match(line)
if match:
return match.group(1), match.group(2), match.group(3)
else:
return "", "", ""
#-------------------------------------------------------------------------------
@dataclass
class FuncStats:
func_name: str = ""
inst_count: int = 0
call_count: int = 0
mem_count: int = 0
call_dict: Dict[str, int] = field(default_factory=dict) # func name, count
inst_dict: Dict[str, int] = field(default_factory=dict) # inst, count
@dataclass
class FileStats:
total_funcs: int = 0
total_insts: int = 0
total_mem_insts: int = 0
total_calls: int = 0
extern_funcs: Dict[str, int] = field(default_factory=dict) # func name, count
func_calls: Dict[str, int] = field(default_factory=dict) # func name, count
summary_dict: Dict[str, str] = field(default_factory=dict) # func name, summary
inst_dict: Dict[str, int] = field(default_factory=dict) # inst, count
largest_function: str = ""
largest_size: int = 0
csv_string: str = ""
#-------------------------------------------------------------------------------
def parse_ptx(ptx_filename):
# read the raw PTX into a string
raw_ptx = ""
with open(ptx_filename, 'r') as ptx_file:
raw_ptx = ptx_file.read()
# variables to keep track of the parsing state
begin_func_or_decl = False
begin_call = False
in_func = False
brace_count = 0
func_stats = FuncStats()
func_dict = {}
for line in raw_ptx.splitlines():
# strip off comments
if line.find("//") != -1:
line = line[:line.find("//")]
# trim whitespace and trailing commas
line = line.strip(" \t\n\r,")
# keep track of when we hit a function declaration or definition
if is_func_or_decl(line):
begin_func_or_decl = True
func_stats.func_name = get_func_name(line)
# keep track of braces so we can have some picture of nesting
brace_count = brace_count + line.count('{')
brace_count = brace_count - line.count('}')
# if we hit a call.uni, we need to look for the name of the callee
# on the next pass
if is_call_start(line):
begin_call = True
func_stats.call_count = func_stats.call_count + 1
elif begin_call:
begin_call = False
func_stats.call_dict[line] = func_stats.call_dict.get(line, 0) + 1
pred, opcode, args = parse_inst(line)
if in_func and opcode != "":
func_stats.inst_count = func_stats.inst_count + 1
func_stats.mem_count = func_stats.mem_count + is_mem_inst(line)
inst = opcode
func_stats.inst_dict[inst] = func_stats.inst_dict.get((inst), 0) + 1
if begin_func_or_decl and brace_count == 1:
in_func = True
begin_func_or_decl = False
# exiting the function -- save off the stats
if in_func and brace_count == 0:
func_dict[func_stats.func_name] = func_stats
# prepare for the next iteration
func_stats = FuncStats()
begin_func_or_decl = False
begin_call = False
in_func = False
brace_count = 0
return func_dict
#-------------------------------------------------------------------------------
def gather_file_stats(func_dict):
file_stats = FileStats()
file_stats.total_funcs = len(func_dict)
file_stats.csv_string = "Function Name, Total Instructions, Memory Instructions, Function Calls\n"
# print the function statistics
for key, entry in sorted(func_dict.items()):
func_name = entry.func_name
file_stats.total_insts += entry.inst_count
file_stats.total_mem_insts += entry.mem_count
file_stats.total_calls += entry.call_count
# keep track of the largest function
if entry.inst_count > file_stats.largest_size:
file_stats.largest_function = func_name
file_stats.largest_size = entry.inst_count
# clamp the counts to prevent divide-by-zero
inst_count = max(1, entry.inst_count)
mem_count = max(1, entry.mem_count)
call_count = max(1, entry.call_count)
summary_string = ""
summary_string += " Function: {}\n".format(func_name)
summary_string += " Total Instructions: {}\n".format(inst_count)
summary_string += " Memory Instructions: {} ({:.2f}%)\n".format(mem_count, 100 * float(mem_count)/inst_count)
summary_string += " Total Calls: {}\n".format(entry.call_count)
summary_string += "\n"
summary_string += "Top 10 Function Calls (name, count, %):\n"
for name, count in itertools.islice(sorted(entry.call_dict.items(), key=lambda item: -item[1]), 0, 11):
summary_string += " {}, {}, {:.2f}%\n".format(name, count, 100 * float(count)/max(1,file_stats.total_calls))
# print the instruction mix
summary_string += "\n"
summary_string += "Instruction Mix (name, count, %):\n"
for inst, count in sorted(entry.inst_dict.items()):
summary_string += " {}, {}, {:.2f}%\n".format(inst, count, 100 * float(count)/inst_count)
file_stats.inst_dict[inst] = file_stats.inst_dict.get((inst), 0) + count
# print the call mix
summary_string += "\n"
summary_string += "Function Calls (name, count, %):\n"
for name, count in sorted(entry.call_dict.items()):
file_stats.func_calls[name] = file_stats.func_calls.get((name), 0) + count
summary_string += " {}, {}, {:.2f}%\n".format(name, count, 100 * float(count)/call_count)
if not name in func_dict:
file_stats.extern_funcs[name] = 1
file_stats.summary_dict[func_name] = summary_string
file_stats.csv_string += "{},{},{},{}\n".format(func_name, entry.inst_count, entry.mem_count, entry.call_count)
return file_stats
#-------------------------------------------------------------------------------
def generate_summary(func_dict, file_stats, out_name):
summary_string = "Overall Stats\n"
summary_string += " Total Functions: {}\n".format(file_stats.total_funcs)
summary_string += " Total Instructions: {}\n".format(file_stats.total_insts)
summary_string += " Memory Instructions: {} ({:.2f}%)\n".format(file_stats.total_mem_insts, 100 * float(file_stats.total_mem_insts)/max(1, file_stats.total_insts))
summary_string += " Total Calls: {}\n".format(file_stats.total_calls)
summary_string += " Biggest Function: {} ({} instructions)\n".format(file_stats.largest_function, file_stats.largest_size)
summary_string += "\n"
summary_string += "Top 10 Function Calls (name, count, %):\n"
for name, count in itertools.islice(sorted(file_stats.func_calls.items(), key=lambda item: -item[1]), 0, 11):
summary_string += " {}, {}, {:.2f}%\n".format(name, count, 100 * float(count)/max(1,file_stats.total_calls))
summary_string += "\n"
summary_string += "Function Call Counts (name, count, %):\n"
for name, count in sorted(file_stats.func_calls.items()):
summary_string += " {}, {}, {:.2f}%\n".format(name, count, 100 * float(count)/max(1,file_stats.total_calls))
summary_string += "\n"
summary_string += "Instruction Mix (name, count, %):\n"
for name, count in sorted(file_stats.inst_dict.items()):
summary_string += " {}, {}, {:.2f}%\n".format(name, count, 100 * float(count)/max(1,file_stats.total_insts))
summary_string += "\n"
summary_string += "Uncalled Functions:\n"
for name, count in sorted(func_dict.items()):
if not name in file_stats.func_calls:
summary_string += " {}\n".format(name)
summary_string += "\n"
summary_string += "Extern Functions:\n"
for name, val in sorted(file_stats.extern_funcs.items()):
summary_string += " {}\n".format(name)
with open("{}-summary.txt".format(out_name), "w") as summary_file:
summary_file.write(summary_string)
for func_name, summary in sorted(file_stats.summary_dict.items()):
summary_file.write("\n#---------------------------------------\n")
summary_file.write(summary)
with open("{}.csv".format(out_name), "w") as csv_file:
csv_file.write(file_stats.csv_string)
return summary_string
#-------------------------------------------------------------------------------
def wrap_name(name):
wrapped_name = ""
cur_line = ""
last_char = ''
wrap_len = 20
split_pos = 0
line_pos = 0
for cur_char in name:
cur_line = cur_line + cur_char
line_pos = line_pos + 1
if not cur_char.isalpha():
# prefer to split at non-alphabetic characters
split_pos = line_pos
elif last_char.isupper() and not cur_char.isupper():
# otherwise, prefer to split at the first capitalized letter
# of some group
split_pos = line_pos - 2
if line_pos == wrap_len:
wrapped_name = wrapped_name + cur_line[:split_pos] + '\n'
cur_line = cur_line[split_pos:]
line_pos = len(cur_line)
last_char = cur_char
wrapped_name = wrapped_name + cur_line + '\n'
return wrapped_name.strip(" \t\n\r,")
#-------------------------------------------------------------------------------
def generate_callgraph(func_dict, file_stats, out_name):
callgraph = graphviz.Digraph("{} Call Graph".format(out_name),
filename="{}-callgraph.gv".format(out_name),
engine="dot")
callgraph.attr("graph", rankdir="TB")
callgraph.attr("graph", splines="true")
callgraph.attr("graph", concentrate="false")
callgraph.attr("graph", clusterrank="none")
callgraph.attr("node", fontname="Courier New")
callgraph.attr("node", shape="square")
callgraph.attr("node", nojustify="true")
callgraph.attr("node", width="2.5")
callgraph.attr("node", height="2.5")
callgraph.attr("edge", penwidth="3")
callgraph.attr("edge", constrain="false")
# create a summary node
with callgraph.subgraph(name="Summary") as c:
c.attr("graph", rankdir="TB")
c.attr("graph", splines="true")
c.attr("graph", concentrate="false")
c.attr("graph", clusterrank="none")
c.attr("node", fontname="Courier New")
c.attr("node", shape="square")
c.attr("node", nojustify="false")
c.attr("node", width="2.5")
c.attr("node", height="2.5")
c.attr("edge", penwidth="3")
c.attr("edge", constrain="false")
c.node(name="SUMMARY",
label="Summary\linsts: {}\lfuncs: {}\lcalls: {}\l".format
(file_stats.total_insts, file_stats.total_funcs, file_stats.total_calls))
# create the nodes
for func_name, entry in sorted(func_dict.items()):
num_calls_to = 0
if func_name in file_stats.func_calls:
num_calls_to = file_stats.func_calls[func_name]
label = "{}\n\ninsts: {}\lcalls from: {}\lcalls to: {}\l".format(
wrap_name(func_name),
entry.inst_count,
entry.call_count,
num_calls_to)
callgraph.node(name=wrap_name(func_name), label=label)
# create nodes for the extern functions
callgraph.attr("node", style="dashed")
for key, entry in sorted(file_stats.extern_funcs.items()):
func_name = key
callgraph.node(wrap_name(func_name))
# cycle through a handful of edge colors to add a little eye candy
color_idx = 0
edge_colors = [ "#FF000080", # red
"#00800F80", # green
"#FFAF0080", # orange
"#0000FF80", # blue
"#40404080" ] # gray
# create the edges
for key, entry in sorted(func_dict.items()):
func_name = entry.func_name
callgraph.attr("edge", color=edge_colors[color_idx])
for calleeName, count in sorted(entry.call_dict.items()):
callgraph.attr("edge", tooltip="{} -> {}".format(func_name, calleeName))
callgraph.edge(wrap_name(func_name), wrap_name(calleeName))
color_idx = (color_idx + 1) % len(edge_colors)
callgraph.render()
return
#-------------------------------------------------------------------------------
def main():
if len(sys.argv) != 2:
sys.exit("Wrong number of arguments\nUsage: $ parse-ptx.py <path-to-PTX-file>")
in_name = sys.argv[1]
if not os.path.isfile(in_name):
sys.exit("Unable to open PTX file")
out_name = os.path.splitext(os.path.basename(in_name))[0]
func_dict = parse_ptx(in_name)
file_stats = gather_file_stats(func_dict)
generate_summary(func_dict, file_stats, out_name)
generate_callgraph(func_dict, file_stats, out_name)
return
if __name__ == "__main__":
main()
#-------------------------------------------------------------------------------
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Utility script to download and build abi checking tools
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Exit the whole script if any command fails.
set -ex
# Where to install the final results
: ${LOCAL_DEPS_DIR:=${PWD}/ext}
: ${ABITOOLS_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
git clone https://github.com/lvc/vtable-dumper
pushd vtable-dumper ; make install prefix=${ABITOOLS_INSTALL_DIR} ; popd
git clone https://github.com/lvc/abi-dumper
pushd abi-dumper ; make install prefix=${ABITOOLS_INSTALL_DIR} ; popd
git clone https://github.com/lvc/abi-compliance-checker
pushd abi-compliance-checker ; make install prefix=${ABITOOLS_INSTALL_DIR} ; popd
popd
# ls -R ${LOCAL_DEPS_DIR}
export PATH=${PATH}:${ABITOOLS_INSTALL_DIR}/bin
+20 -5
View File
@@ -1,10 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
# Utility script to download and build cmake
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Exit the whole script if any command fails.
set -ex
@@ -12,14 +12,29 @@ set -ex
echo "Building cmake"
uname
CMAKE_VERSION=${CMAKE_VERSION:=3.12.4}
CMAKE_VERSION=${CMAKE_VERSION:=3.31.3}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
CMAKE_INSTALL_DIR=${CMAKE_INSTALL_DIR:=${LOCAL_DEPS_DIR}/cmake}
if [[ `uname` == "Linux" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} && true
if [[ `uname` == "Linux" && `uname -m` == "x86_64" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} || true
curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh" -o "cmake.sh"
sh cmake.sh --skip-license --prefix=${CMAKE_INSTALL_DIR}
export PATH=${CMAKE_INSTALL_DIR}/bin:$PATH
fi
if [[ `uname` == "Linux" && `uname -m` == "aarch64" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} || true
curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-aarch64.sh" -o "cmake.sh"
sh cmake.sh --skip-license --prefix=${CMAKE_INSTALL_DIR}
export PATH=${CMAKE_INSTALL_DIR}/bin:$PATH
# In case we ever need to build from scratch:
# curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz" -o cmake.tar.gz
# tar xzf cmake.tar.gz
# pushd cmake-${CMAKE_VERSION}
# CXX="ccache $CXX" ./bootstrap --parallel=${PARALLEL:=4} --enable-ccache
# CXX="ccache $CXX" timeout 2100 time make ${PAR_MAKEFAGS} || true
# export PATH=${CMAKE_INSTALL_DIR}/bin:$PWD/bin:$PATH
# popd
fi
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Utility script to download and build libpng
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of libpng to download if we don't have it yet
LIBPNG_REPO=${LIBPNG_REPO:=https://github.com/glennrp/libpng.git}
LIBPNG_VERSION=${LIBPNG_VERSION:=v1.6.35}
# Where to put libpng repo source (default to the ext area)
LIBPNG_SRC_DIR=${LIBPNG_SRC_DIR:=${PWD}/ext/libpng}
# Temp build area (default to a build/ subdir under source)
LIBPNG_BUILD_DIR=${LIBPNG_BUILD_DIR:=${LIBPNG_SRC_DIR}/build}
# Install area for libpng (default to ext/dist)
LIBPNG_INSTALL_DIR=${LIBPNG_INSTALL_DIR:=${PWD}/ext/dist}
#LIBPNG_CONFIG_OPTS=${LIBPNG_CONFIG_OPTS:=}
pwd
echo "libpng install dir will be: ${LIBPNG_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone libpng project from GitHub and build
if [[ ! -e ${LIBPNG_SRC_DIR} ]] ; then
echo "git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}"
git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}
fi
cd ${LIBPNG_SRC_DIR}
echo "git checkout ${LIBPNG_VERSION} --force"
git checkout ${LIBPNG_VERSION} --force
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -S . -B ${LIBPNG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBPNG_INSTALL_DIR} \
-DPNG_EXECUTABLES=OFF \
-DPNG_TESTS=OFF \
${LIBPNG_CONFIG_OPTS}
time cmake --build ${LIBPNG_BUILD_DIR} --config Release --target install
fi
# ls -R ${LIBPNG_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export PNG_ROOT=$LIBPNG_INSTALL_DIR
+26 -26
View File
@@ -1,10 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
# Utility script to download and build LLVM & clang
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Exit the whole script if any command fails.
set -ex
@@ -12,36 +12,36 @@ set -ex
echo "Building LLVM"
uname
: ${LLVM_VERSION:=18.1.8}
: ${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
mkdir -p $LLVM_INSTALL_DIR || true
if [[ `uname` == "Linux" ]] ; then
LLVM_VERSION=${LLVM_VERSION:=8.0.0}
LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
if [[ "$GITHUB_WORKFLOW" != "" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-18.04}
elif [[ "$TRAVIS_DIST" == "trusty" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-14.04}
elif [[ "$TRAVIS_DIST" == "xenial" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-16.04}
elif [[ "$TRAVIS_DIST" == "bionic" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-18.04}
else
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=error}
fi
: ${LLVM_DISTRO_NAME:=ubuntu-18.04}
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-${LLVM_DISTRO_NAME}.tar.xz
echo LLVMTAR = $LLVMTAR
if [ "$LLVM_VERSION" == "10.0.0" ] ; then
# new
curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
else
curl --location http://releases.llvm.org/${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
fi
curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
mkdir -p $LLVM_INSTALL_DIR && true
mv clang+llvm*/* $LLVM_INSTALL_DIR
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
ls -a $LLVM_DIRECTORY
elif [[ `uname -s` == "Windows" || "${RUNNER_OS}" == "Windows" ]] ; then
echo "Installing Windows LLVM"
: ${LLVM_DISTRO_NAME:=ubuntu-18.04}
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-pc-windows-msvc.tar.xz
echo LLVMTAR = $LLVMTAR
curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
mv clang+llvm*/* $LLVM_INSTALL_DIR
else
echo Bad uname `uname`
fi
echo "Installed LLVM ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
ls -a $LLVM_INSTALL_DIR || true
ls -a $LLVM_INSTALL_DIR/* || true
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
export LLVM_ROOT=${LLVM_INSTALL_DIR}
+68
View File
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Utility script to download and build OpenColorIO
# Exit the whole script if any command fails.
set -ex
# Which OCIO to retrieve, how to build it
OPENCOLORIO_REPO=${OPENCOLORIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git}
OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.3.2}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build}
OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENCOLORIO_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE:=Release}
# Just need libs:
OPENCOLORIO_CMAKE_FLAGS+=" -DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
-DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
-DOCIO_BUILD_JAVA=OFF \
-DBUILD_SHARED_LIBS=${OPENCOLORIO_BUILD_SHARED_LIBS:=ON}"
# Fix yaml-cpp which breaks against cmake 4.0 because of too-old cmake min.
# Remove when yaml-cpp is fixed to declare its own minimum high enough.
export CMAKE_POLICY_VERSION_MINIMUM=3.5
BASEDIR=`pwd`
pwd
echo "OpenColorIO install dir will be: ${OPENCOLORIO_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone OpenColorIO project from GitHub and build
if [[ ! -e ${OPENCOLORIO_SOURCE_DIR} ]] ; then
echo "git clone ${OPENCOLORIO_REPO} ${OPENCOLORIO_SOURCE_DIR}"
git clone ${OPENCOLORIO_REPO} ${OPENCOLORIO_SOURCE_DIR}
fi
cd ${OPENCOLORIO_SOURCE_DIR}
echo "git checkout ${OPENCOLORIO_VERSION} --force"
git checkout ${OPENCOLORIO_VERSION} --force
echo "Building OpenColorIO from commit" `git rev-parse --short HEAD`
cmake -S ${OPENCOLORIO_SOURCE_DIR} -B ${OPENCOLORIO_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \
${OPENCOLORIO_CMAKE_FLAGS}
time cmake --build ${OPENCOLORIO_BUILD_DIR} --target install --config ${OPENCOLORIO_BUILD_TYPE}
popd
# ls -R ${OPENCOLORIO_INSTALL_DIR}
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export OpenColorIO_ROOT=$OPENCOLORIO_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OPENCOLORIO_INSTALL_DIR}/lib
+36 -76
View File
@@ -1,101 +1,60 @@
#!/bin/bash
#!/usr/bin/env bash
# Utility script to download and build OpenEXR & Imath
# Utility script to download and build OpenEXR & IlmBase
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Exit the whole script if any command fails.
set -ex
# Which OpenEXR to retrieve, how to build it
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/openexr/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=2.4.0}
OPENEXR_BRANCH=${OPENEXR_BRANCH:=v${OPENEXR_VERSION}}
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/AcademySoftwareFoundation/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=v3.2.4}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENEXR_SOURCE_DIR=${OPENEXR_SOURCE_DIR:=${LOCAL_DEPS_DIR}/openexr}
OPENEXR_BUILD_DIR=${OPENEXR_BUILD_DIR:=${LOCAL_DEPS_DIR}/openexr-build}
OPENEXR_INSTALL_DIR=${OPENEXR_INSTALL_DIR:=${LOCAL_DEPS_DIR}/openexr-install}
OPENEXR_INSTALL_DIR=${OPENEXR_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENEXR_BUILD_TYPE=${OPENEXR_BUILD_TYPE:=Release}
CMAKE_GENERATOR=${CMAKE_GENERATOR:="Unix Makefiles"}
OPENEXR_CMAKE_FLAGS=${OPENEXR_CMAKE_FLAGS:=""}
OPENEXR_CXX_FLAGS=${OPENEXR_CXX_FLAGS:=""}
BASEDIR=$PWD
pwd
echo "Building OpenEXR ${OPENEXR_BRANCH}"
echo "EXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "EXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "Building OpenEXR ${OPENEXR_VERSION}"
echo "OpenEXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "OpenEXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "OpenEXR build type is ${OPENEXR_BUILD_TYPE}"
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
echo "OpenEXR Build type is ${OPENEXR_BUILD_TYPE}"
if [[ "$CMAKE_GENERATOR" == "" ]] ; then
OPENEXR_GENERATOR_CMD="-G \"$CMAKE_GENERATOR\""
fi
# Clone OpenEXR project (including IlmBase) from GitHub and build
# Clone OpenEXR project (including Imath) from GitHub and build
if [[ ! -e ${OPENEXR_SOURCE_DIR} ]] ; then
echo "git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}"
git clone ${OPENEXR_REPO} ${OPENEXR_SOURCE_DIR}
fi
mkdir -p ${OPENEXR_INSTALL_DIR} && true
mkdir -p ${OPENEXR_BUILD_DIR} && true
pushd ${OPENEXR_SOURCE_DIR}
git checkout ${OPENEXR_BRANCH} --force
git checkout ${OPENEXR_VERSION} --force
echo "Building OpenEXR from commit" `git rev-parse --short HEAD`
if [[ ${OPENEXR_BRANCH} == "v2.2.0" ]] || [[ ${OPENEXR_BRANCH} == "v2.2.1" ]] ; then
mkdir -p ${OPENEXR_BUILD_DIR}/IlmBase && true
mkdir -p ${OPENEXR_BUILD_DIR}/OpenEXR && true
cd ${OPENEXR_BUILD_DIR}/IlmBase
cmake --config ${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}/IlmBase
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
cd ${OPENEXR_BUILD_DIR}/OpenEXR
cmake --config ${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}\;${OPENEXR_INSTALL_DIR}" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DBUILD_UTILS=0 -DBUILD_TESTS=0 \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}/OpenEXR
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
elif [[ ${OPENEXR_BRANCH} == "v2.3.0" ]] ; then
# Simplified setup for 2.3+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DOPENEXR_BUILD_TESTS=0 \
-DOPENEXR_BUILD_PYTHON_LIBS=0 \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
else
# Simplified setup for 2.4+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DOPENEXR_BUILD_UTILS=0 \
-DBUILD_TESTING=0 \
-DPYILMBASE_ENABLE=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
fi
cmake -S ${OPENEXR_SOURCE_DIR} -B ${OPENEXR_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DBUILD_SHARED_LIBS=${OpenEXR_LOCAL_BUILD_SHARED_LIBS:=ON} \
-DOPENEXR_BUILD_TOOLS=0 \
-DBUILD_TESTING=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DINSTALL_OPENEXR_EXAMPLES=0 \
-DOPENEXR_INSTALL_EXAMPLES=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS}
time cmake --build ${OPENEXR_BUILD_DIR} --target install --config ${OPENEXR_BUILD_TYPE}
popd
@@ -103,11 +62,12 @@ popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export ILMBASE_ROOT=$OPENEXR_INSTALL_DIR
export OPENEXR_ROOT=$OPENEXR_INSTALL_DIR
export ILMBASE_LIBRARY_DIR=$OPENEXR_INSTALL_DIR/lib
export OPENEXR_LIBRARY_DIR=$OPENEXR_INSTALL_DIR/lib
export LD_LIBRARY_PATH=$OPENEXR_ROOT/lib:$LD_LIBRARY_PATH
export OpenEXR_ROOT=$OPENEXR_INSTALL_DIR
# Environment variables are case insensitive on Windows, don't set
# it a second time with different case. This seems to trigger a bug
# where the next cmake command fails to find the compiler.
if [[ $(uname -s) != "Windows" && "${RUNNER_OS}" != "Windows" ]]; then
export OPENEXR_ROOT=$OPENEXR_INSTALL_DIR
fi
export LD_LIBRARY_PATH=$OpenEXR_ROOT/lib:$LD_LIBRARY_PATH
export ILMBASE_ROOT_DIR=$OPENEXR_INSTALL_DIR
export OPENEXR_ROOT_DIR=$OPENEXR_INSTALL_DIR
+38 -32
View File
@@ -1,58 +1,64 @@
#!/bin/bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Install OpenImageIO
# Exit the whole script if any command fails.
set -ex
OPENIMAGEIO_REPO=${OPENIMAGEIO_REPO:=OpenImageIO/oiio}
OPENIMAGEIO_BRANCH=${OPENIMAGEIO_BRANCH:=master}
OPENIMAGEIO_REPO=${OPENIMAGEIO_REPO:=AcademySoftwareFoundation/OpenImageIO}
OPENIMAGEIO_VERSION=${OPENIMAGEIO_VERSION:=release}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENIMAGEIO_SRCDIR=${OPENIMAGEIO_SRCDIR:=${LOCAL_DEPS_DIR}/OpenImageIO}
OPENIMAGEIO_BUILD_DIR=${OPENIMAGEIO_BUILD_DIR:=${OPENIMAGEIO_SRCDIR}/build/$PLATFORM}
OPENIMAGEIO_INSTALLDIR=${OPENIMAGEIO_INSTALLDIR:=$OPENIMAGEIO_SRCDIR/dist/$PLATFORM}
OPENIMAGEIO_CMAKE_FLAGS=${OPENIMAGEIO_CMAKE_FLAGS:=""}
OPENIMAGEIO_SOURCE_DIR=${OPENIMAGEIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenImageIO}
OPENIMAGEIO_BUILD_DIR=${OPENIMAGEIO_BUILD_DIR:=${OPENIMAGEIO_SOURCE_DIR}/build}
OPENIMAGEIO_INSTALL_DIR=${OPENIMAGEIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENIMAGEIO_BUILD_TYPE=${OPENIMAGEIO_BUILD_TYPE:=Release}
OPENIMAGEIO_CMAKE_FLAGS=${OPENIMAGEIO_CMAKE_FLAGS:=""}
OPENIMAGEIO_CXXFLAGS=${OPENIMAGEIO_CXXFLAGS:=""}
BASEDIR=$PWD
CMAKE_GENERATOR=${CMAKE_GENERATOR:="Unix Makefiles"}
if [ ! -e $OPENIMAGEIO_SRCDIR ] ; then
git clone https://github.com/${OPENIMAGEIO_REPO} $OPENIMAGEIO_SRCDIR
pwd
echo "OpenImageIO build dir will be: ${OPENIMAGEIO_BUILD_DIR}"
echo "OpenImageIO install dir will be: ${OPENIMAGEIO_INSTALL_DIR}"
echo "OpenImageIO Build type is ${OPENIMAGEIO_BUILD_TYPE}"
echo "CXX: '${CXX}'"
echo "CC: '${CC}'"
echo "CMAKE_CXX_COMPILER: '${CMAKE_CXX_COMPILER}'"
if [ ! -e $OPENIMAGEIO_SOURCE_DIR ] ; then
git clone https://github.com/${OPENIMAGEIO_REPO} $OPENIMAGEIO_SOURCE_DIR
fi
mkdir -p ${OPENIMAGEIO_INSTALLDIR} && true
mkdir -p ${OPENIMAGEIO_INSTALL_DIR} && true
mkdir -p ${OPENIMAGEIO_BUILD_DIR} && true
pushd $OPENIMAGEIO_SRCDIR
pushd $OPENIMAGEIO_SOURCE_DIR
git fetch --all -p
git checkout $OPENIMAGEIO_BRANCH --force
git checkout $OPENIMAGEIO_VERSION --force
echo "Building OpenImageIO from ${OPENIMAGEIO_REPO} / ${OPENIMAGEIO_VERSION} @ commit" `git rev-parse --short HEAD`
if [[ "$USE_SIMD" != "" ]] ; then
OPENIMAGEIO_CMAKE_FLAGS="$OPENIMAGEIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
if [[ "$DEBUG" == "1" ]] ; then
OPENIMAGEIO_CMAKE_FLAGS="$OPENIMAGEIO_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug"
OPENIMAGEIO_CMAKE_FLAGS+=" -DUSE_SIMD=$USE_SIMD"
fi
# if [[ "$ARCH" == "windows64" ]] ; then
pushd ${OPENIMAGEIO_BUILD_DIR}
cmake ../.. -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="$OPENIMAGEIO_BUILD_TYPE" \
-DCMAKE_INSTALL_PREFIX="$OPENIMAGEIO_INSTALLDIR" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DCMAKE_INSTALL_LIBDIR="$OPENIMAGEIO_INSTALLDIR/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
$OPENIMAGEIO_CMAKE_FLAGS -DVERBOSE=1
cmake -S ${OPENIMAGEIO_SOURCE_DIR} -B ${OPENIMAGEIO_BUILD_DIR} \
-DCMAKE_BUILD_TYPE="${OPENIMAGEIO_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DCMAKE_INSTALL_PREFIX="${OPENIMAGEIO_INSTALL_DIR}" \
-DPYTHON_VERSION="${PYTHON_VERSION}" \
-DCMAKE_INSTALL_LIBDIR="${OPENIMAGEIO_INSTALL_DIR}/lib" \
-DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD}" \
${OPENIMAGEIO_CMAKE_FLAGS} -DVERBOSE=1
echo "Parallel build $CMAKE_BUILD_PARALLEL_LEVEL"
time cmake --build . --target install --config ${OPENIMAGEIO_BUILD_TYPE}
popd
time cmake --build ${OPENIMAGEIO_BUILD_DIR} --target install --config ${OPENIMAGEIO_BUILD_TYPE}
popd
export OpenImageIO_ROOT=$OPENIMAGEIO_INSTALLDIR
export PATH=$OpenImageIO_ROOT/bin:$PATH
export OpenImageIO_ROOT=$OPENIMAGEIO_INSTALL_DIR
export DYLD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
@@ -60,4 +66,4 @@ export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages:$P
echo "DYLD_LIBRARY_PATH = $DYLD_LIBRARY_PATH"
echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH"
echo "OpenImageIO_ROOT $OpenImageIO_ROOT"
ls -R $OpenImageIO_ROOT
# ls -R $OpenImageIO_ROOT
+33 -30
View File
@@ -4,49 +4,52 @@
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of pugixml to download if we don't have it yet
PUGIXML_REPO=${PUGIXML_REPO:=https://github.com/zeux/pugixml.git}
PUGIXML_VERSION=${PUGIXML_VERSION:=1.10}
PUGIXML_BRANCH=${PUGIXML_BRANCH:=v${PUGIXML_VERSION}}
PUGIXML_VERSION=${PUGIXML_VERSION:=v1.11.4}
# Where to put pugixml repo source (default to the ext area)
PUGIXML_SRC_DIR=${PUGIXML_SRC_DIR:=${PWD}/ext/pugixml}
# Temp build area (default to a build/ subdir under source)
PUGIXML_BUILD_DIR=${PUGIXML_BUILD_DIR:=${PUGIXML_SRC_DIR}/build}
# Install area for pugixml (default to ext/dist)
PUGIXML_INSTALL_DIR=${PUGIXML_INSTALL_DIR:=${PWD}/ext/dist}
#PUGIXML_BUILD_OPTS=${PUGIXML_BUILD_OPTS:=}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
PUGIXML_SOURCE_DIR=${PUGIXML_SOURCE_DIR:=${LOCAL_DEPS_DIR}/pugixml}
PUGIXML_BUILD_DIR=${PUGIXML_BUILD_DIR:=${PUGIXML_SOURCE_DIR}/build}
PUGIXML_INSTALL_DIR=${PUGIXML_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
PUGIXML_BUILD_TYPE=${PUGIXML_BUILD_TYPE:=Release}
pwd
echo "pugixml install dir will be: ${PUGIXML_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
echo "Building Pugixml ${PUGIXML_VERSION}"
echo "Pugixml source dir will be: ${PUGIXML_SOURCE_DIR}"
echo "Pugixml build dir will be: ${PUGIXML_BUILD_DIR}"
echo "Pugixml install dir will be: ${PUGIXML_INSTALL_DIR}"
echo "Pugixml build type is ${PUGIXML_BUILD_TYPE}"
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
# Clone pugixml project from GitHub and build
if [[ ! -e ${PUGIXML_SRC_DIR} ]] ; then
echo "git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}"
git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}
if [[ ! -e ${PUGIXML_SOURCE_DIR} ]] ; then
echo "git clone ${PUGIXML_REPO} ${PUGIXML_SOURCE_DIR}"
git clone ${PUGIXML_REPO} ${PUGIXML_SOURCE_DIR}
fi
cd ${PUGIXML_SRC_DIR}
echo "git checkout ${PUGIXML_BRANCH} --force"
git checkout ${PUGIXML_BRANCH} --force
mkdir -p ${PUGIXML_INSTALL_DIR} && true
mkdir -p ${PUGIXML_BUILD_DIR}
cd ${PUGIXML_BUILD_DIR}
time cmake --config Release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PUGIXML_INSTALL_DIR} \
-DBUILD_TESTS=OFF \
${PUGIXML_BUILD_OPTS} ..
time cmake --build . --config Release --target install
pushd ${PUGIXML_SOURCE_DIR}
echo "git checkout ${PUGIXML_VERSION} --force"
git checkout ${PUGIXML_VERSION} --force
echo "Building pugixml from commit" `git rev-parse --short HEAD`
ls -R ${PUGIXML_INSTALL_DIR}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -S ${PUGIXML_SOURCE_DIR} -B ${PUGIXML_BUILD_DIR} \
-DCMAKE_BUILD_TYPE=${PUGIXML_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${PUGIXML_INSTALL_DIR} \
-DBUILD_SHARED_LIBS=${PUGIXML_LOCAL_BUILD_SHARED_LIBS:=ON} \
-DBUILD_TESTS=OFF \
${PUGIXML_CMAKE_FLAGS}
time cmake --build ${PUGIXML_BUILD_DIR} --target install --config ${PUGIXML_BUILD_TYPE}
fi
# ls -R ${PUGIXML_INSTALL_DIR}
popd
#echo "listing .."
@@ -55,4 +58,4 @@ popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export pugixml_ROOT=$PUGIXML_INSTALL_DIR
export LD_LIBRARY_PATH=$pugixml_ROOT/lib:$pugixml_ROOT/lib64:$LD_LIBRARY_PATH
+20 -15
View File
@@ -1,18 +1,17 @@
#!/usr/bin/env bash
# Utility script to download and build pybind11
#
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Utility script to download and build pybind11
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of pybind11 to download if we don't have it yet
PYBIND11_REPO=${PYBIND11_REPO:=https://github.com/pybind/pybind11.git}
PYBIND11_VERSION=${PYBIND11_VERSION:=2.4.3}
PYBIND11_BRANCH=${PYBIND11_BRANCH:=v${PYBIND11_VERSION}}
PYBIND11_VERSION=${PYBIND11_VERSION:=v3.0.0}
# Where to put pybind11 repo source (default to the ext area)
PYBIND11_SRC_DIR=${PYBIND11_SRC_DIR:=${PWD}/ext/pybind11}
@@ -23,6 +22,10 @@ LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
PYBIND11_INSTALL_DIR=${PYBIND11_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#PYBIND11_BUILD_OPTS=${PYBIND11_BUILD_OPTS:=}
# Fix for pybind11 breaking against cmake 4.0 because of too-old cmake min.
# Remove when pybind11 is fixed to declare its own minimum high enough.
export CMAKE_POLICY_VERSION_MINIMUM=3.5
if [[ "${PYTHON_VERSION}" != "" ]] ; then
PYBIND11_BUILD_OPTS+=" -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION}"
fi
@@ -39,18 +42,20 @@ if [[ ! -e ${PYBIND11_SRC_DIR} ]] ; then
git clone ${PYBIND11_REPO} ${PYBIND11_SRC_DIR}
fi
cd ${PYBIND11_SRC_DIR}
echo "git checkout ${PYBIND11_BRANCH} --force"
git checkout ${PYBIND11_BRANCH} --force
mkdir -p ${PYBIND11_BUILD_DIR}
cd ${PYBIND11_BUILD_DIR}
time cmake --config Release \
-DCMAKE_INSTALL_PREFIX=${PYBIND11_INSTALL_DIR} \
-DPYBIND11_TEST=OFF \
${PYBIND11_BUILD_OPTS} ..
time cmake --build . --config Release --target install
echo "git checkout ${PYBIND11_VERSION} --force"
git checkout ${PYBIND11_VERSION} --force
echo "Building pybind11 from commit" `git rev-parse --short HEAD`
ls -R ${PYBIND11_INSTALL_DIR}
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -S . -B ${PYBIND11_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PYBIND11_INSTALL_DIR} \
-DPYBIND11_TEST=OFF \
${PYBIND11_BUILD_OPTS}
time cmake --build ${PYBIND11_BUILD_DIR} --config Release --target install
fi
# ls -R ${PYBIND11_INSTALL_DIR}
popd
#echo "listing .."
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Utility script to download and build zlib
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of zlib to download if we don't have it yet
ZLIB_REPO=${ZLIB_REPO:=https://github.com/madler/zlib.git}
ZLIB_VERSION=${ZLIB_VERSION:=v1.2.11}
# Where to put zlib repo source (default to the ext area)
ZLIB_SRC_DIR=${ZLIB_SRC_DIR:=${PWD}/ext/zlib}
# Temp build area (default to a build/ subdir under source)
ZLIB_BUILD_DIR=${ZLIB_BUILD_DIR:=${ZLIB_SRC_DIR}/build}
# Install area for zlib (default to ext/dist)
ZLIB_INSTALL_DIR=${ZLIB_INSTALL_DIR:=${PWD}/ext/dist}
#ZLIB_CONFIG_OPTS=${ZLIB_CONFIG_OPTS:=}
# Fix zlib which breaks against cmake 4.0 because of too-old cmake min.
# Remove when zlib is fixed to declare its own minimum high enough.
export CMAKE_POLICY_VERSION_MINIMUM=3.5
pwd
echo "zlib install dir will be: ${ZLIB_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone zlib project from GitHub and build
if [[ ! -e ${ZLIB_SRC_DIR} ]] ; then
echo "git clone ${ZLIB_REPO} ${ZLIB_SRC_DIR}"
git clone ${ZLIB_REPO} ${ZLIB_SRC_DIR}
fi
cd ${ZLIB_SRC_DIR}
echo "git checkout ${ZLIB_VERSION} --force"
git checkout ${ZLIB_VERSION} --force
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -S . -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${ZLIB_INSTALL_DIR} \
${ZLIB_CONFIG_OPTS}
time cmake --build ${ZLIB_BUILD_DIR} --config Release --target install
fi
# ls -R ${ZLIB_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export ZLIB_ROOT=$ZLIB_INSTALL_DIR
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -e
# Arguments to this script are:
# BUILDDIR_NEW BUILDDIR_OLD LIBRARIES...
BUILDDIR_NEW=$1
shift
BUILDDIR_OLD=$1
shift
LIBS=$*
#
# First, create ABI dumps from both builds
#
ABI_ARGS="-bin-only -skip-cxx -public-headers $PWD/dist/include/OSL "
echo "ABI_CHECK: PWD=${PWD} "
ls -l $BUILDDIR_NEW
ls -l $BUILDDIR_OLD
for dir in $BUILDDIR_NEW $BUILDDIR_OLD ; do
for lib in $LIBS ; do
abi-dumper $ABI_ARGS ${dir}/lib/${lib}.so -o ${dir}/abi-${lib}.dump
done
done
echo "Saved ABI dumps"
#
# Run the ABI compliance checker, saving the outputs to files
#
for lib in $LIBS ; do
abi-compliance-checker -l $lib -old $BUILDDIR_OLD/abi-$lib.dump -new $BUILDDIR_NEW/abi-$lib.dump | tee ${lib}-abi-results.txt || true
echo -e "\x1b[33;1m"
echo -e "$lib"
fgrep "Binary compatibility:" ${lib}-abi-results.txt
echo -e "\x1b[33;0m"
done
#
# If the "Binary compatibility" summary results say anything other than 100%,
# we fail!
#
for lib in $LIBS ; do
if [[ `fgrep "Binary compatibility:" ${lib}-abi-results.txt | grep -v 100\%` != "" ]] ; then
cp -r compat_reports ${BUILDDIR_NEW}/compat_reports
exit 1
fi
done
-61
View File
@@ -1,61 +0,0 @@
#!/usr/bin/env bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex
# This script is run when CI system first starts up.
# It expects that ci-setenv.bash was run first, so $PLATFORM and $ARCH
# have been set.
if [[ -e src/build-scripts/ci-setenv.bash ]] ; then
source src/build-scripts/ci-setenv.bash
fi
mkdir -p build/$PLATFORM dist/$PLATFORM && true
if [[ "$USE_SIMD" != "" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
if [[ "$DEBUG" == "1" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug"
fi
pushd build/$PLATFORM
cmake ../.. -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OSL_ROOT" \
-DUSE_PYTHON="${USE_PYTHON}" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DCMAKE_INSTALL_LIBDIR="$OSL_ROOT/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
$MY_CMAKE_FLAGS -DVERBOSE=1
time cmake --build . --target ${BUILDTARGET:=install} --config ${CMAKE_BUILD_TYPE}
popd
#make $MAKEFLAGS VERBOSE=1 $BUILD_FLAGS config
#make $MAKEFLAGS $PAR_MAKEFLAGS $BUILD_FLAGS $BUILDTARGET
if [[ "$SKIP_TESTS" == "" ]] ; then
$OSL_ROOT/bin/testshade --help
export OIIO_LIBRARY_PATH=$OSL_ROOT/lib:$OIIO_LIBRARY_PATH
TESTSUITE_CLEANUP_ON_SUCCESS=1
make $BUILD_FLAGS test
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
echo "git diff was not empty. Failing clang-format or clang-tidy check."
exit 1
fi
fi
#if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
#fi
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex
OSL_CMAKE_FLAGS="$MY_CMAKE_FLAGS $OSL_CMAKE_FLAGS"
export OSL_SRC_DIR=${OSL_SRC_DIR:=$PWD}
export OSL_BUILD_DIR=${OSL_BUILD_DIR:=${OSL_SRC_DIR}/build}
export OSL_INSTALL_DIR=${OSL_INSTALL_DIR:=${OSL_SRC_DIR}/dist}
export OSL_CMAKE_BUILD_TYPE=${OSL_CMAKE_BUILD_TYPE:=${CMAKE_BUILD_TYPE:=Release}}
if [[ "$USE_SIMD" != "" ]] ; then
OSL_CMAKE_FLAGS="$OSL_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
if [[ -n "$CODECOV" ]] ; then
OSL_CMAKE_FLAGS="$OSL_CMAKE_FLAGS -DCODECOV=${CODECOV}"
fi
cmake -S ${OSL_SRC_DIR} -B ${OSL_BUILD_DIR} -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="${OSL_CMAKE_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OSL_ROOT" \
-DUSE_PYTHON="${USE_PYTHON:=1}" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DUSE_BATCHED="${USE_BATCHED:=0}" \
-DCMAKE_INSTALL_LIBDIR="$OSL_ROOT/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
$OSL_CMAKE_FLAGS -DVERBOSE=1
# Save a copy of the generated files for debugging broken CI builds.
mkdir ${OSL_BUILD_DIR}/cmake-save || true
cp -r ${OSL_BUILD_DIR}/CMake* ${OSL_BUILD_DIR}/*.cmake ${OSL_BUILD_DIR}/cmake-save
: ${BUILDTARGET:=install}
if [[ "$BUILDTARGET" != "none" ]] ; then
echo "Parallel build ${CMAKE_BUILD_PARALLEL_LEVEL} of target ${BUILDTARGET}"
time ${OSL_CMAKE_BUILD_WRAPPER} cmake --build ${OSL_BUILD_DIR} --target ${BUILDTARGET} --config ${OSL_CMAKE_BUILD_TYPE}
ccache --show-stats || true
fi
if [[ "${DEBUG_CI:=0}" != "0" ]] ; then
echo "PATH=$PATH"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "PYTHONPATH=$PYTHONPATH"
echo "ldd testshade"
ldd $OSL_ROOT/bin/testshade
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
echo "Running " `which clang-format` " version " `clang-format --version`
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
echo "git diff was not empty. Failing clang-format or clang-tidy check."
exit 1
fi
fi
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Run code coverage analysis
# This assumes that the build occurred with CODECOV=1 andtests have already
# fully run.
set -ex
echo "Performing code coverage analysis"
mkdir _coverage
pushd _coverage
ls -R ../build/src/
# Remove files or directories we want to exclude from code coverage analysis,
# generally because we don't expect to execute any of their code during our
# CI. (Because it's only used interactively, or is fallback code only used
# when certain dependencies are not found.) Including these when we know we
# won't be calling them during coverage gathering will just make our coverage
# percentage look artifically low.
rm -f ../build/src/osltoy/CMakeFiles/osltoy.dir/*.cpp.{gcno,gcda}
# The sed command below converts from:
# ../build/src/liboslexec/CMakeFiles/oslexec.dir/foo.gcno
# to:
# ../src/liboslexec/foo.cpp
for g in $(find ../build -name "*.gcno" -type f); do
echo "Processing $g"
echo "dirname $g = $(dirname $g) to " `$(echo "$g" | sed -e 's/\/build\//\//' -e 's/\.gcno/\.cpp/' -e 's/\.cpp\.cpp/\.cpp/' -e 's/\/CMakeFiles.*\.dir\//\//')`
gcov -l -p -o $(dirname "$g") $(echo "$g" | sed -e 's/\/build\//\//' -e 's/\.gcno/\.cpp/' -e 's/\/CMakeFiles.*\.dir\//\//')
done
# Remove pointless .gcov files so we don't analyze them
rm -f "*opt*include*"
rm -f "*usr*local*"
popd
+83 -55
View File
@@ -2,77 +2,105 @@
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# This script is run when CI system first starts up.
# Since it sets many env variables needed by the caller, it should be run
# with 'source', not in a separate shell.
# Figure out the platform
if [[ $TRAVIS_OS_NAME == osx || $RUNNER_OS == macOS ]] ; then
export ARCH=macosx
fi
if [[ $TRAVIS_OS_NAME == linux || $RUNNER_OS == Linux || $CIRCLECI == true ]] ; then
export ARCH=linux64
fi
if [[ $RUNNER_OS == Windows ]] ; then
export ARCH=windows64
fi
export PLATFORM=$ARCH
if [[ "$DEBUG" == 1 ]] ; then
export PLATFORM=${PLATFORM}.debug
fi
echo "Architecture is $ARCH"
echo "Build platform name is $PLATFORM"
# Environment variables we always need
export USE_CCACHE=1
export CCACHE_CPP2=1
export OSL_ROOT=$PWD/dist/$PLATFORM
export DYLD_LIBRARY_PATH=$OSL_ROOT/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$OSL_ROOT/lib:$LD_LIBRARY_PATH
export OIIO_LIBRARY_PATH=$OSL_ROOT/lib:${OIIO_LIBRARY_PATH}
export LSAN_OPTIONS=suppressions=$PWD/src/build-scripts/nosanitize.txt
export ASAN_OPTIONS=print_suppressions=0
export PATH=/usr/local/bin/_ccache:/usr/lib/ccache:$PATH
export USE_CCACHE=${USE_CCACHE:=1}
export CCACHE_CPP2=
export CCACHE_DIR=$HOME/.ccache
export CCACHE_COMPRESSION=yes
if [[ "$(which ccache)" != "" ]] ; then
# Try to coax dependency building into also using ccache
# Wait, no, this breaks old OIIO!
# export CMAKE_CXX_COMPILER_LAUNCHER="ccache"
# export CMAKE_C_COMPILER_LAUNCHER="ccache"
ccache -z
fi
mkdir -p $CCACHE_DIR
export USE_PYTHON=${USE_PYTHON:=1}
export PYTHON_VERSION=${PYTHON_VERSION:="2.7"}
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export PYTHONPATH=/usr/local/lib64/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export PYTHONPATH=$OSL_ROOT/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export BUILD_MISSING_DEPS=${BUILD_MISSING_DEPS:=1}
export COMPILER=${COMPILER:=gcc}
export CXX=${CXX:=g++}
export CI=true
export USE_NINJA=1
export DISTDIR=$PWD/dist
export OSL_ROOT=$PWD/dist
export DYLD_LIBRARY_PATH=$DISTDIR/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$DISTDIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$DISTDIR/lib64:$LD_LIBRARY_PATH
export OIIO_LIBRARY_PATH=$DISTDIR/lib
export OPENIMAGEIO_PLUGIN_PATH=$DISTDIR/lib:${OPENIMAGEIO_PLUGIN_PATH}
export LSAN_OPTIONS=suppressions=$PWD/src/build-scripts/nosanitize.txt
export ASAN_OPTIONS=print_suppressions=0:detect_odr_violation=1
# export UBSAN_OPTIONS=suppressions=$PWD/src/build-scripts/ubsan-suppressions.txt
export PYTHON_VERSION=${PYTHON_VERSION:="3.7"}
export PYTHONPATH=$DISTDIR/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
cmake --version
export OSL_CI=true
export OpenImageIO_CI=true
export USE_NINJA=${USE_NINJA:=1}
export CMAKE_GENERATOR=${CMAKE_GENERATOR:=Ninja}
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release}
if [[ $TRAVIS == true ]] ; then
export PARALLEL=2
elif [[ $CIRCLECI == true ]] ; then
export PARALLEL=4
elif [[ $GITHUB_ACTIONS == true ]] ; then
export PARALLEL=4
fi
export PARALLEL=${PARALLEL:=4}
export PAR_MAKEFLAGS=-j${PARALLEL}
export CMAKE_BUILD_PARALLEL_LEVEL=${PARALLEL}
export CTEST_PARALLEL_LEVEL=${PARALLEL}
export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=17}
export LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=$HOME/ext}
export CMAKE_PREFIX_PATH=${LOCAL_DEPS_DIR}:${CMAKE_PREFIX_PATH}
export PATH=${LOCAL_DEPS_DIR}/dist/bin:$PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib64:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH
uname -a
uname -n
export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1}
# For CI, default to building missing dependencies automatically
export OpenImageIO_BUILD_MISSING_DEPS=${OpenImageIO_BUILD_MISSING_DEPS:=all}
export OSL_BUILD_MISSING_DEPS=${OSL_BUILD_MISSING_DEPS:=all}
# Sonar
export BUILD_WRAPPER_OUT_DIR="${PWD}/bw_output"
export BW_OUTPUT_DIR="${PWD}/bw_output"
# Parallel builds
if [[ `uname -s` == "Linux" ]] ; then
echo "procs: " `nproc`
head -40 /proc/cpuinfo
export PARALLEL=${PARALLEL:=$((2 + `nproc`))}
elif [[ "${RUNNER_OS}" == "macOS" ]] ; then
echo "procs: " `sysctl -n hw.ncpu`
sysctl machdep.cpu.features
export PARALLEL=${PARALLEL:=$((2 + `sysctl -n hw.ncpu`))}
elif [[ "${RUNNER_OS}" == "Windows" ]] ; then
# Presumably Windows
export PARALLEL=${PARALLEL:=$((2 + ${NUMBER_OF_PROCESSORS}))}
else
export PARALLEL=${PARALLEL:=6}
fi
export PAR_MAKEFLAGS=-j${PARALLEL}
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=${PARALLEL}}
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:=${PARALLEL}}
export OIIO_USE_CUDA=1
export CUDAToolkit_ROOT=/usr/local/cuda
mkdir -p build dist
echo "HOME = $HOME"
echo "PWD = $PWD"
echo "LOCAL_DEPS_DIR = $LOCAL_DEPS_DIR"
echo "uname -a: " `uname -a`
echo "uname -m: " `uname -m`
echo "uname -s: " `uname -s`
echo "uname -n: " `uname -n`
pwd
ls
env | sort
if [[ $ARCH == linux64 ]] ; then
if [[ `uname -s` == "Linux" ]] ; then
echo "nprocs: " `nproc`
head -40 /proc/cpuinfo
elif [[ $ARCH == macosx ]] ; then
elif [[ "${RUNNER_OS}" == "macOS" ]] ; then
echo "nprocs: " `sysctl -n hw.ncpu`
sysctl machdep.cpu.features
fi
# Save the env for use by other stages
src/build-scripts/save-env.bash
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex
: ${CTEST_EXCLUSIONS:="broken"}
: ${CTEST_TEST_TIMEOUT:=60}
$OSL_ROOT/bin/testshade --help
echo "Parallel test ${CTEST_PARALLEL_LEVEL}"
echo "Default timeout ${CTEST_TEST_TIMEOUT}"
echo "Test exclusions '${CTEST_EXCLUSIONS}'"
echo "CTEST_ARGS '${CTEST_ARGS}'"
pushd build
ctest -C ${CMAKE_BUILD_TYPE} --force-new-ctest-process --output-on-failure \
--timeout ${CTEST_TEST_TIMEOUT} -E "${CTEST_EXCLUSIONS}" ${CTEST_ARGS} \
|| \
ctest -C ${CMAKE_BUILD_TYPE} --force-new-ctest-process \
--rerun-failed --repeat until-pass:5 -R render --output-on-failure \
--timeout ${CTEST_TEST_TIMEOUT} -E "${CTEST_EXCLUSIONS}" ${CTEST_ARGS}
# The weird construct above allows the render-* tests to run multiple times
popd
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
@@ -0,0 +1,55 @@
#!/bin/bash
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# --- Colors ---
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# --- Check if the script is sourced ---
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo -e "${YELLOW}Please run this script as:"
echo -e " ${NC}source $(basename "${BASH_SOURCE[0]}")"
echo -e "Otherwise, '${YELLOW}conda activate${NC}' won't persist in your current shell."
return 0 2>/dev/null || exit 0
fi
# --- Check if Miniconda exists ---
if [ ! -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
echo -e "${RED}Miniconda not found at ~/miniconda3.${NC}"
echo -e "Please install Miniconda before running this script"
echo -e "${YELLOW}Important:${NC} During installation, decline any PATH modifications."
echo -e "This script activates the environment per session using 'source'."
return 0 2>/dev/null || exit 0
else
# Load Conda
source ~/miniconda3/etc/profile.d/conda.sh
# Create OSL environment if it doesn't exist
if ! conda info --envs | grep -q "osl-env"; then
echo "Creating osl-env Conda environment..."
conda create -y -n osl-env
# Activate the environment
conda activate osl-env
# Install dependencies
echo "Installing dependencies in osl-env..."
conda install -y -c conda-forge \
cmake \
llvmdev=20.1.8 clangdev clangxx_linux-64 libcxx \
python=3.12 numpy pybind11 \
openimageio=2.5 imath flex bison pugixml zlib
else
echo -e "${GREEN}osl-env environment already exists.${NC}"
# Activate the environment
conda activate osl-env
fi
fi
+4 -6
View File
@@ -1,9 +1,7 @@
#!/usr/bin/env python3
from __future__ import print_function, absolute_import
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# ----------------------------------------------------------------------
@@ -73,7 +71,7 @@ from __future__ import print_function, absolute_import
###
### Only one main doc region will be output by the `docdeep` program,
### specified with the `-d` command line argument. Any other doc-regions
### will not be included in the documention output of that run.
### will not be included in the documentation output of that run.
###
### However, one doc-region may *include* the text of another doc-region
### as follows:
@@ -114,7 +112,7 @@ from __future__ import print_function, absolute_import
### For pre-code comments, the contiguous comment region associated with
### a declaration immediately precedes the declaration. Such a comment
### set has its first line start with `///>`. For post-code comments,
### the documentaiton comments follows the code declaration, and this is
### the documentation comments follows the code declaration, and this is
### designated by having its first line start with `///<`. I like to
### just remember that the `<` or `>` points in the direction of the code
### declaration that the comment applies to.

Some files were not shown because too many files have changed in this diff Show More