Compare commits

...
27 Commits
Author SHA1 Message Date
Larry Gritz ebc98bf5be CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-01 09:50:06 -07:00
Larry Gritz 1d744e5b54 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:56:33 -07:00
Larry Gritz a7bfaf09d0 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:47:25 -07:00
timgrantandTim Grant 7802ac31f7 Explicitly set the OptiX pipeline stack size. (#1254)
Co-authored-by: Tim Grant <tgrant@nvidia.com>
2020-09-23 15:12:00 -07:00
Larry Gritz 9efefc74b9 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-21 09:44:01 -07:00
Larry Gritz f6c4430870 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:18:51 -07:00
Larry Gritz 3206f48898 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-01 12:08:10 -07:00
Larry Gritz 88c37b53fe Release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-01 11:22:21 -07:00
Larry Gritz 1907e0f062 CHANGES, prep for RC
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 15:13:57 -07:00
Larry Gritz bcd2162311 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:06:34 -07:00
Larry Gritz 1afa2caeae 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 10:14:05 -07:00
Larry Gritz c5b2afa46d 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:58 -07:00
Larry Gritz 991c2247c5 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 11:41:49 -07:00
Larry Gritz 0dc6f76d2f Bump version tweak for next release candidate
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-22 15:11:05 -07:00
Larry Gritz 709f6e9c66 Ready release candidate
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 22:18:29 -07:00
Larry Gritz 9cc760aeb9 Rebuild docs for release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 22:18:29 -07:00
Larry Gritz 1496406616 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 21:43:02 -07:00
Larry Gritz 46a6157613 Fix capitalization in new testshade options
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-18 21:35:05 -07:00
Larry Gritz c629e52bff Docs: Fix longstanding error in description of spline()
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:26:52 -07:00
Larry Gritz 1f8950d056 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:25:29 -07:00
Alex M. Wells c4cd20ce70 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 22:10:43 -07:00
Larry Gritz d141efa55d More flexible find of llvm-config with suffixed with '-64' (#1238)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-11 11:10:27 -07:00
etheory 9d37207658 Remove null check from symbol_address for performance (#1237) 2020-08-02 21:33:15 -07:00
Alex M. Wells 93cf9fc383 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-02 21:32:22 -07:00
Larry Gritz c0d873bc38 Fix changes typos
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 17:48:12 -07:00
Larry Gritz 2835538c70 Bump version after tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 17:48:12 -07:00
Larry Gritz d5d0e5e003 Branch for 1.11 beta
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-01 14:36:44 -07:00
80 changed files with 682 additions and 366 deletions
+8
View File
@@ -0,0 +1,8 @@
# 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
+11 -3
View File
@@ -110,7 +110,7 @@ jobs:
USE_CPP: 14
CMAKE_CXX_STANDARD: 14
LLVM_VERSION: 8.0.0
OPENEXR_VERSION: 2.4.0
OPENEXR_VERSION: 2.4.1
OPENIMAGEIO_BRANCH: release
USE_SIMD: sse4.2
MY_CMAKE_FLAGS: -DCMAKE_BUILD_TYPE=Debug
@@ -136,8 +136,9 @@ jobs:
CMAKE_CXX_STANDARD: 14
LLVM_VERSION: 9.0.0
USE_SIMD: avx
OPENEXR_VERSION: 2.4.0
OPENIMAGEIO_BRANCH: release
OPENEXR_VERSION: 2.4.1
OPENIMAGEIO_VERSION: release
PYTHON_VERSION: 2.7
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
@@ -242,6 +243,12 @@ jobs:
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.8
LLVM_BC_GENERATOR: /usr/bin/clang++
LLVMBREWVER: "@9"
# ^^ 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.
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
@@ -249,6 +256,7 @@ jobs:
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/install_homebrew_deps.bash
brew uninstall llvm
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
+4 -4
View File
@@ -4,15 +4,15 @@ 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] )
- [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 decsions are made ( [GOVERNANCE.md](../GOVERNANCE.md] )
- Closed by https://github.com/imageworks/OpenShadingLanguage/pull/1137
- [X] Contribution Policy defined ( [CONTRIBUTING.md](../CONTRIBUTING.md) )
- Closed by https://github.com/imageworks/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
- New Project Governance
- [X] TSC members identified
- [X] First TSC meeting held
- [X] TSC meeting cadence set and added to project calendar
@@ -38,7 +38,7 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- [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 )
- 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
+99 -54
View File
@@ -1,7 +1,27 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the Open Shading Language Project. -->
Release 1.11 --1 Sept 2020 (compared to 1.10)
Release 1.11.8 -- 1 Oct 2020 (compared to 1.11.7)
---------------------------------------------------
* Fix broken derivatives of the optional "alpha" return of texture calls
when the normal color channels return don't have their derivatives used
but the alpha does. #1258
* Building vs Python: instead of defaulting to searching for python 2.7
specifically and needing to set PYTHON_VERSION if you want (or have) a
different one, default to whichever version is found. If multiple versions
of Python are on the system, you can still use the PYTHON_VERSION cmake
variable to disambiguate which one you want. #1249
* For the experimental OptiX support, explicitly set the OptiX pipeline
stack size (fixes some bugs). #1254
* ShadingSystem statistics output (which is printed with `testshade --help`,
by the way) now includes information about the SIMD capabilities specified
at OSL build time, those available at runtime, and the versions of LLVM,
OIIO, and Imath used. This should help in debugging and issue reporting
by making it easy to know certain build time choices just by running
testshade. #1258
Release 1.11 -- 1 Sept 2020 (compared to 1.10)
--------------------------------------------------
ASWF adoption changes:
* GOVERNANCE.md and ASWF/Technical-Charter.md document the project
@@ -107,8 +127,6 @@ OSL Standard library:
color spaces. #1013 (1.11.0)
* `cbrt()` cube root was added to the standard library. #1164 #1166 (1.11.6)
Shaders:
API changes, new options, new ShadingSystem features (for renderer writers):
* `ShadingSystem::convert_value()` will now allow promotion of int or
float to `float[4]`. #940 (1.11.0)
@@ -148,11 +166,14 @@ API changes, new options, new ShadingSystem features (for renderer writers):
system attribute) now defaults to 1, not 0. That should be the best
performance while still having reasonable JIT times. #1114 (1.11.4)
* We no longer automatically build the MaterialX shaders (you need to set
build option OSL_BUILD_MATRIALX to ON). This will eventually be deprecated
build option OSL_BUILD_MATERIALX to ON). This will eventually be deprecated
entirely. #1136 (1.11.5)
* Helper varieties of ShadingSystem::Parameter() and ReParameter() that
handle the common cases of a single float, int, or string. #1195 #1196
(1.11.6)
* `ShaingSystem::optimize_group()` now takes an optional parameter that
allows the caller to only do the optimize step without the JIT step.
#1226 (1.11.71)
Continued work on experimental SIMD batched shading mode:
* Continued work on SIMD-friendly math and noise: #1108 (1.11.4)
@@ -173,7 +194,7 @@ Continued work on experimental OptiX rendering:
* Work on matrix ops. #1054 (1.11.1)
* Allow init ops. #1059 (1.11.1)
* Fixes to string closure params. #1061 (1.11.1)
# Add support for OptiX 7 #1111 #1203 (1.11.6)
* Add support for OptiX 7 #1111 #1203 (1.11.6)
Performance improvements:
* Constant fold array accesses even if they are out of bounds. #1035 (1.11.0)
@@ -185,8 +206,10 @@ Performance improvements:
* Range checking of matrix component access is skipped for certain cases
where it was unnecessary. #1174 (1.11.6)
* LLVM JIT+optimize time has been sped up around 10% by doing a better job
of pruning unused functions and symbols in the generated modul. #1172
of pruning unused functions and symbols in the generated module. #1172
(1.11.6)
* `ShadingSystem::symbol_address()` no longer checks for the symbol to be
NULL (though it will assert on a debug build). #1237 (1.11.7.1)
Bug fixes and other improvements (internals):
* Fix bug in implementation of `splineinverse()` when computing with
@@ -229,13 +252,13 @@ Bug fixes and other improvements (internals):
Internals/developer concerns:
* Switch much of the internals where we do string formatting using printf-like
conventions to errorf(), etc., naming convention, reserving the non-f
names for future use with C++20 std::format/python convenetions. #1076
names for future use with C++20 std::format/python conventions. #1076
(1.11.3)
* Remove pointless assertions from the TypeSpec class. #1079
* Assertion overhaul: use OSL_ASSERT/OSL_DASSERT instead of borrowing from
OIIO's dassert.h. Note that OSL_ASSERT always tests, prints error if the
test fails, but then only aborts for debug builds (no abort for release
builds). In ocntrast, OSL_DASSERT does all for debug builds, and none
builds). In contrast, OSL_DASSERT does all for debug builds, and none
(not even the test) for release builds. #1080 #1087 (1.11.3)
* Refactor the implementation of the `Dual` template to support more
efficient code generation when used in vectorized loops (this will be
@@ -278,21 +301,48 @@ Build & test system improvements:
hidden that is not part of the public API.
- The ENABLERTTI build option has been renamed `ENABLE_RTTI`.
- Config based install and usage.
* Testshade makes sure that no unreported errors accumulted in the texture
system or image cache. #939 (1.11.0)
* testshade: Check that no leftover errors are in the TextureSystem or
ImageCache at the end of the test (that would indicate that someplace in
OSL we are failing to check texture errors). #939 (1.10.3/1.11.0)
* testshade:
- Make sure that no unreported errors accumulated in the texture system
or image cache. #939 (1.11.0)
- Check that no leftover errors are in the TextureSystem or ImageCache
at the end of the test (that would indicate that someplace in OSL we
are failing to check texture errors). #939 (1.10.3/1.11.0)
- `testshade -o` : now `null` as the filename will not produce any
output. This is handy to mark a renderer output but without storing
the results as an image. #1193 (1.11.6)
- `--vary_pdxdy`, `--vary_udxdy` and `--vary_vdxdy` allow a way to
force P, u, v to have varying derivatives (for testing purposes).
#1227 (1.11.7.1)
* Supporting dependencies:
- Build script finding of LLVM is now more robust to certain library
configurations of llvm, particularly where everything is bundled in
just one libLLVM without a separate libLLVMMCJIT. #976 (1.10.4/1.11.0)
- Support for LLVM 4 has been dropped. #981 (1.11.0)
- Simplified finding of flex/bison, rely more on CMake's built-in
flex/bison find packages. #977 (1.11.0)
- Verified that OSL can be built with Clang 8 and LLVM 8.0.
- When building against recent OIIO versions whose Sysutil supports
stack dumps, crashes in the command line tools (including testshade)
will print stack traces to aid debugging. #1019 (1.11.0)
- Improve finding of OpenEXR/IlmBase. #1022 (1.11.0)
- Fix problems when building against Qt 5.13 due to deprecated calls.
#1043 (1.11.0)
- Fixes for CI when using OIIO 2.1 master that has changed its own cmake
minimum to 3.12. #1065 (1.11.1)
- Improvement for how the build system figures out which LLVM static
libraries are needed. #1070 (1.11.1)
- Improvements in finding Partio. #1125 (1.11.5)
- Fixes to support Qt 5.15 (currently, osltoy is the only component that
uses Qt). #1204 (1.11.6)
- Better able to find LLVM when the system installation of LLVM has its
llvm-config named `llvm-config-64`. #1238 (1.11.7.1)
- Fixes for OIIO 2.2 which has eliminated use of tinyformat in favor of
always relying on fmtlib. #1242 (1.11.7.1)
- Address problem with LLVM 10.0.1 on Mac when installed by Homebrew.
#1245 (1.11.7.2)
* A new build-time CMake variable `OSL_LIBNAME_SUFFIX` lets you optionally
add a custom suffix to the main libraries that are built. (Use with
caution.) #970 (1.11.0)
* Build script finding of LLVM is now more robust to certain library
configurations of llvm, particularly where everything is bundled in just
one libLLVM without a separate libLLVMMCJIT. #976 (1.10.4/1.11.0)
* Support for LLVM 4 has been dropped. #981 (1.11.0)
* Simplified finding of flex/bison, rely more on CMake's built-in flex/bison
find packages. #977 (1.11.0)
* Verified that OSL can be built with Clang 8 and LLVM 8.0.
* Add a build-time option GLIBCXX_USE_CXX11_ABI to force the "new/old string
ABI" to something other than the default for your version of gcc. #995
(1.10.5/1.11.0)
@@ -302,25 +352,15 @@ Build & test system improvements:
#956 (1.10.0)
* When OptiX mode is enabled (USE_OPTIX=1), the testsuite will some tests in
an additional time forcing OptiX mode: any test containing a file named
`OPTIX` in its test directory; or all tests if enviroment variable
`OPTIX` in its test directory; or all tests if environment variable
`TESTSUITE_OPTIX=1` (except tests that contain a file named `NOOPTIX` in
their directory. #1004 (1.10.0)
* Allow OSL to build with `USE_LLVM_BITCODE` enabled on Windows. #998 (1.10.0)
* Various Windows compilation improvements. #1017 #1020
* When building against recent OIIO versions whose Sysutil supports stack
dumps, crashes in the command line tools (including testshade) will
print stack traces to aid debugging. #1019 (1.11.0)
* Improve finding of OpenEXR/IlmBase. #1022 (1.11.0)
* Fix signed/unsigned comparison warnings. #1037 (1.11.0)
* Fix problems when building against Qt 5.13 due to deprecated calls. #1043
(1.11.0)
* Fixes for MinGW compiler on Windows. #1047 #1048 (1.11.0)
* Fixes for CI when using OIIO 2.1 master that has changed its own cmake
minimum to 3.12. #1065 (1.11.1)
* Scripts and tests utilizing Python have all been visited to make sure they
are compatible with both Python 2.x and Python 3.x. #1071 (1.11.1)
* Improvement for how the build system figures out which LLVM static
libraries are needed. #1070 (1.11.1)
* Build: on OSX, better logic about the OIIO plugin must be built as a
module or as a shared library. #1078 (1.11.3/1.10.8)
* Removed support for Boost Wave for preprocessing osl input. We now always
@@ -330,19 +370,18 @@ Build & test system improvements:
up during testing, mostly related to unused function paramters. #1106 (1.11.3)
* The testsuite can run in parallel, with a number of threads set by the
environment variable `CTEST_PARALLEL_LEVEL`. #1119 (1.11.4)
* Improvements in finding Partio. #1125 (1.11.5)
* oslconfig.h is now generated by a cmake configure_file step, from
oslconfig.h.in. #1141 (1.11.5)
* Use ASWF docker images to speed up many of the CI matrix entries, as well
as to excactly test several VFX Platform specs. #1169 (1.11.6)
as to exactly test several VFX Platform specs. #1169 (1.11.6)
* Fix typo that botched the version in the .pc pkgconfig file. #1168 (1.11.6)
* CI test against gcc9 and gcc10. #1192 (1.11.6)
* Propagate RTTI compile options to exported cmake config. #1194 (1.11.6)
* `testshade -o` : now `null` as the filename will not produce any output.
This is handy to mark a renderer output but without storing the results
as an image. #1193 (1.11.6)
* Fixes to support Qt 5.15 (currently, osltoy is the only component that
uses Qt). #1204 (1.11.6)
* New file .git-blame-ignore-revs lists the hashes of commits that only
performed bulk reformatting, so that they don't misattribute authorship
or modification date. Everybody do this in your local repo:
`git config blame.ignoreRevsFile .git-blame-ignore-revs`
#1244 (1.11.7.2)
Documentation:
* Make it clear that the documentation is licensed under the CC-BY-4.0
@@ -352,6 +391,12 @@ Documentation:
deformer. #1199 (1.11.6)
* `testrender` now contains a progressive sampler, which might be a good
example for others writing renderers. #1202 (1.11.6)
* Fix incorrect descripton in `spline()` regarding the number of spline
values required for each interpolation type. #1239 (1.11.7.1)
* Extensive fixing of typos and misspellings in docs and comments. #1243
(1.11.7.2)
* Renamed "LICENSE-THIRD-PARTY.md" to "THIRD-PARTY.md" to avoid confusing
GitHub's reporting of the project's license. (1.11.7.2)
Release 1.10.13 -- 1 Aug 2020 (compared to 1.10.12)
@@ -607,7 +652,7 @@ Shaders:
* mandelbrot.osl: computes Mandelbrot and Julia images. #827 (1.10.0)
* MaterialX support:
* Improved support for MaterialX 1.36: add sin, cos, tan, atan2, ceil,
sqrt, exp, determinent, ln, transpose, sign, rotate, transforms,
sqrt, exp, determinant, ln, transpose, sign, rotate, transforms,
rgb/hsv convert, extract, separate, tiledimage. Rename exponent ->
power, pack -> combine, hsvadjust -> hueshift. Add some color2/4
mutual conversion operators. Fixes to ramp4, clean up texture mapping
@@ -665,7 +710,7 @@ API changes, new options, new ShadingSystem features (for renderer writers):
Bug fixes and other improvements (internals):
* The context's `texture_thread_info` is now properly passed to the
RenderServices callbacks instead of passing NULL. (1.10.0)
* Symbols are enbled in the JIT, allowing Intel Vtune profiler to correctly
* Symbols are enabled in the JIT, allowing Intel Vtune profiler to correctly
report which JITed OSL code is being executed. #830 (1.10.0)
* ASTNode and OSLCompilerImpl -- add info() and message() methods to
complement the existing error and warning. #854 (1.10.0)
@@ -746,7 +791,7 @@ Release 1.9.10 -- 1 Sep 2018 (compared to 1.9.9)
* Add more functions to color2.h, color4.h, vector2.h, vector4.h: ceil,
sqrt, exp, log2, log, sign, sin, cos, tan, asin, acos, atan2. #903, #904
* Improved support for MaterialX 1.36: add sin, cos, tan, atan2, ceil, sqrt,
exp, determinent, ln, transpose, sign, rotate, transforms, rgb/hsv convert,
exp, determinant, ln, transpose, sign, rotate, transforms, rgb/hsv convert,
extract, separate, tiledimage. Rename exponent -> power, pack -> combine,
hsvadjust -> hueshift. Add some color2/4 mutual conversion operators.
Fixes to ramp4, clean up texture mapping nodes, fixes to triplanarprojection
@@ -831,7 +876,7 @@ Standard library additions/changes:
* `smoothstep()` has been extended to `T smoothstep(T edge0, T edge1, T x)`
for T of any the `triple` types (previously, `smoothstep` only came in
the `float` variety). #765 (1.9.0/1.8.10)
* `mix()` has been extenended to support
* `mix()` has been extended to support
`color closure mix (color closure A, color closure B, color x)`
#766 (1.9.0/1.8.10)
* `hashnoise()` is like cellnoise (1D, 2D, 3D, or 4D input, 1D or 4D output
@@ -1028,7 +1073,7 @@ Developer goodies:
This lets you use the `Dual` templates for automatic differentiation of
of ordinary 1D functions (e.g., `Dual<float,1>`) or 3D volumetric
computations (e.g., `Dual<float,3>`). Most of OSL internals use automatic
differentiation on 2 dimenstions (`Dual<float,2>` a.k.a. `Dual2<float>`),
differentiation on 2 dimensions (`Dual<float,2>` a.k.a. `Dual2<float>`),
but this change makes `dual.h` a lot more useful outside of OSL.
#803 (1.9.1)
@@ -1168,7 +1213,7 @@ Language features:
nested `{ {...}, {...} }`. #640 (1.8.0)
* oslc (and liboslcomp) now supports UTF-8 filenames, including on
Windows. #643 (1.8.0)
* osl now accepts hexidecimal integer constants (such as `0x01ff`).
* osl now accepts hexadecimal integer constants (such as `0x01ff`).
#653 (1.8.1)
Standard library additions/changes:
@@ -1184,7 +1229,7 @@ Standard library additions/changes:
message passed to the renderer (leaving error handling and reporting
entirely up to the shader). #686 (1.8.2)
* `select(a,b,cond)` is similar to `mix`, but without interpolation --
if cond is 0, returns a, else return b (per comonent). #696 (1.8.3)
if cond is 0, returns a, else return b (per component). #696 (1.8.3)
API changes, new options, new ShadingSystem features (for renderer writers):
* ShadingSystem API changes:
@@ -1214,7 +1259,7 @@ API changes, new options, new ShadingSystem features (for renderer writers):
* When the attribute "profile" is set, the statistics report will
include a count of the total number of noise calls. #642 (1.8.0)
* ShadingSystem and shader group attribute "exec_repeat" (int; default is
1) can artifically manipulate how many times the shader is executed.
1) can artificially manipulate how many times the shader is executed.
This can sometimes be handy for tricky benchmarks. #659 (1.8.2)
* Attribute "force_derivs" can force derivatives to be computed
everywhere. (Mostly good for debugging or benchmarking derivatives,
@@ -1227,7 +1272,7 @@ Performance improvements:
output parameters and what optimizations can be done based on that. #657
(1.8.1)
* Better runtime optimization of certain matrix constructors. #676 (1.8.2)
* Improved alias analyis for parameters with simple initialization ops.
* Improved alias analysis for parameters with simple initialization ops.
#679 (1.8.2)
* Runtime optimizer now constant-folds bitwise `&`, `|`, `^`, `~`
operators. #682 (1.8.2)
@@ -1348,7 +1393,7 @@ Release 1.7.2 -- 1 Mar 2016 (compared to 1.7.1)
Release 1.7 [1.7.1] -- 29 Jan 2016 (compared to 1.6)
--------------------------------------------------
Language, standard libary, and compiler changes (for shader writers):
Language, standard library, and compiler changes (for shader writers):
* Language features:
* Support for closure arrays in shader inputs. #544 (1.7.0)
* Disallow quote strings from spanning lines (just like you can't in
@@ -1359,7 +1404,7 @@ Language, standard libary, and compiler changes (for shader writers):
* isconstant(expr) returns 1 if the expression can be turned into
a constant at runtime (with full knowledge of the shader group's
parameter values and connections). This is helpful mostly for advanced
shader writers to verify their assuptions about which expressions can
shader writers to verify their assumptions about which expressions can
end up being fully constant-folded by the runtime optimizer. #578 (1.7.1)
* New behavior of isconnected(parmaname): return 1 if the parameter
is connected to an upstream layer, 2 if connected to a downstream layer,
@@ -1393,7 +1438,7 @@ API changes, new options, new ShadingSystem features (for renderer writers):
users). (1.7.0)
* "opt_passes" controls the number of optimization passes over each
instance (default: 10). This is mainly for developer debugging, you
should not need to change or expost this. #576 (1.7.1)
should not need to change or expose this. #576 (1.7.1)
* "connection_error" controls whether a bad connection is considered
a true error (or is just ignored). #583 (1.7.1)
* Shader group attribute additions/changes:
@@ -1491,7 +1536,7 @@ Documentation:
Release 1.6 -- 26 May 2015 (compared to 1.5)
-----------------------------------------------
Language, standard libary, and compiler changes (for shader writers):
Language, standard library, and compiler changes (for shader writers):
* It is now supported to have shader parameters that are arrays of
unspecified length (like 'float foo[] = {...}'). Their length will be
fixed when they are assigned an instance value of fixed length, or when
@@ -1632,11 +1677,11 @@ Bug fixes and other improvements:
* Improved detection of shader groups that optimize away to nothing. (1.6.2)
* Fix of possible (but never reported) bug with instancing merging.
#431 (1.6.2)
* Fix incorrect oslc code generation when assigining an element of an
* Fix incorrect oslc code generation when assigning an element of an
array-of-structs to another element of array-of-structs. #432 (1.6.2)
* Bug fix in code generation of constant folding of getmatrix() calls
(never reported symptomatic). #440 (1.6.2)
* Fixes to constuction of temporary filename used for group serialization
* Fixes to construction of temporary filename used for group serialization
archive. (1.6.2)
* Internals fix: logb() incorrectly declaring derivative functions (it
has no derivs). #437 (1.5.12/1.6.2)
@@ -1652,7 +1697,7 @@ Bug fixes and other improvements:
* Bug fix: runtime optimizer should not consider a layer unused if its
outputs are renderer outputs. Also fix subtle bug in detecting whether
an output param is a renderer output. #457 (1.6.2)
* Clear derivatives properly in the implementaiton of gettextureinfo.
* Clear derivatives properly in the implementation of gettextureinfo.
#463 (1.6.2)
* Correct handling of point-like shader parameters defined with default
values that use the constructors that provide "space" names. #465 (1.6.2)
+12 -12
View File
@@ -3,14 +3,15 @@
# https://github.com/imageworks/OpenShadingLanguage
cmake_minimum_required (VERSION 3.12)
project (OSL VERSION 1.11.7.0
project (OSL VERSION 1.11.8.0
LANGUAGES CXX C
HOMEPAGE_URL "https://github.com/imageworks/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", "betaX", "RCY", ""
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (${PROJECT_NAME}_SUPPORTED_RELEASE 1) # Change to 1 after release branch
set (PROJECT_AUTHORS "Contributors to the Open Shading Language project")
message (STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION}")
@@ -131,13 +132,13 @@ include (check_is_enabled)
# All the C++ and compiler related options and adjustments live here
include (compiler)
# Utilities related to finding python and making python bindings
include (pythonutils)
include (externalpackages)
include (flexbison)
include (cuda_macros)
# Utilities related to finding python and making python bindings
include (pythonutils)
# 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)
@@ -278,7 +279,7 @@ macro (add_one_testsuite testname testsrcdir)
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})
set (_tst_COMMAND ${Python_EXECUTABLE} "${testsuite}/runtest.py" ${testdir})
if (MSVC_IDE)
list (APPEND _tst_COMMAND --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
@@ -454,7 +455,8 @@ TESTSUITE ( aastep allowconnect-err and-or-not-synonyms arithmetic
struct-nested struct-nested-assign struct-nested-deep
ternary
testshade-expr
texture-alpha texture-blur texture-connected-options
texture-alpha texture-alpha-derivs
texture-blur texture-connected-options
texture-derivs texture-errormsg
texture-firstchannel texture-interp
texture-missingalpha texture-missingcolor texture-simple
@@ -513,12 +515,10 @@ 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}/LICENSE.md" DESTINATION "${CMAKE_BINARY_DIR}")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE.md")
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_README "${CMAKE_BINARY_DIR}/README.md")
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?)
+1 -1
View File
@@ -309,7 +309,7 @@ Namespaces: yes, use them!
Prefer C++11 `std` rather than Boost or 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,
If you see a third party library already used as a dependency (such as OIIO,
Boost, Ilmbase, 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).
+1 -1
View File
@@ -128,7 +128,7 @@ represents the project at all ASWF TAC meetings.
(Proposed list, subject to revision, some are placeholders while their
organizations decide who should be the permanent representative)
* **Chair and TAC repreentative**: Chris Kulla - Sony Pictures Imageworks
* **Chair and TAC representative**: Chris Kulla - Sony Pictures Imageworks
* **Chief Architect**: Larry Gritz, Sony Pictures Imageworks
* Luke Emrose - Animal Logic
View File
+16
View File
@@ -223,6 +223,22 @@ ifneq (${USE_OPTIX},)
MY_CMAKE_FLAGS += -DUSE_OPTIX:BOOL=${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
ifneq (${PYLIB_LIB_PREFIX},)
MY_CMAKE_FLAGS += -DPYLIB_LIB_PREFIX:BOOL=${PYLIB_LIB_PREFIX}
endif
ifneq (${PYLIB_INCLUDE_SONAME},)
MY_CMAKE_FLAGS += -DPYLIB_INCLUDE_SONAME:BOOL=${PYLIB_INCLUDE_SONAME}
endif
#$(info MY_CMAKE_FLAGS = ${MY_CMAKE_FLAGS})
#$(info MY_MAKE_FLAGS = ${MY_MAKE_FLAGS})
+1 -1
View File
@@ -386,7 +386,7 @@ 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").
your question quickly (more so 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
+1 -1
View File
@@ -12,7 +12,7 @@ In no particular order:
BSD 3-Clause License
SPDX-License-Identifier: BSD-3-Clause
* OpenImgageIO Copyright (c) Larry Gritz, et al.
* OpenImageIO Copyright (c) Larry Gritz, et al.
https://github.com/OpenImageIO/oiio
Many bits of code flow back and forth between OIIO and OSL, especially
+11 -32
View File
@@ -95,7 +95,6 @@ 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}
@@ -108,6 +107,7 @@ SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
## Rhel7 (current)
ifeq (${SP_OS}, rhel7)
PYTHON_VERSION ?= 2.7
USE_SIMD ?= sse4.1,aes
CMAKE ?= cmake
USE_NINJA ?= 1
@@ -217,46 +217,25 @@ ifeq (${SP_OS}, rhel7)
#
# Python
#
PYTHON_INCLUDE_DIR ?= /usr/include/python${PYTHON_VERSION}
Python_INCLUDE_DIR ?= /usr/include/python${PYTHON_VERSION}
PYTHON_LIBRARY_DIR ?= /usr/lib64
PYTHON_LIBRARY ?= ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
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}"
Python_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
Python_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
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}"
Python_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}m
Python_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}m.so
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}"
Python_INCLUDE_DIR := /usr/include/python${PYTHON_VERSION}
Python_LIBRARY := ${PYTHON_LIBRARY_DIR}/libpython${PYTHON_VERSION}.so
endif
MY_CMAKE_FLAGS += \
-DPYTHON_INCLUDE_DIR:STRING=${PYTHON_INCLUDE_DIR} \
-DPYTHON_LIBRARY:STRING=${PYTHON_LIBRARY} \
-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}
+1 -1
View File
@@ -21,7 +21,7 @@ PYBIND11_BUILD_DIR=${PYBIND11_BUILD_DIR:=${PYBIND11_SRC_DIR}/build}
# Install area for pybind11 (default to ext/dist)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
PYBIND11_INSTALL_DIR=${PYBIND11_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#PYBIND11_BUILD_OPTS=${PYBIND11_BUILD_OPTS:=}
PYBIND11_BUILD_OPTS=${PYBIND11_BUILD_OPTS:=}
if [[ "${PYTHON_VERSION}" != "" ]] ; then
PYBIND11_BUILD_OPTS+=" -DPYBIND11_PYTHON_VERSION=${PYTHON_VERSION}"
+1 -1
View File
@@ -30,7 +30,7 @@ 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}" \
-DUSE_PYTHON="${USE_PYTHON:=1}" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DCMAKE_INSTALL_LIBDIR="$OSL_ROOT/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
from __future__ import print_function, absolute_import
# Copyright Contributors to the Open Shading Language project.
+3 -1
View File
@@ -56,4 +56,6 @@ fi
export PATH=/usr/local/opt/qt5/bin:$PATH
export PATH=/usr/local/opt/python/libexec/bin:$PATH
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export PATH=/usr/local/opt/llvm/bin:$PATH
export PATH=/usr/local/opt/llvm${LLVMBREWVER}/bin:$PATH
export LLVM_DIRECTORY=/usr/local/opt/llvm${LLVMBREWVER}
export LLVM_ROOT=/usr/local/opt/llvm${LLVMBREWVER}
+1 -1
View File
@@ -5,7 +5,7 @@
# Is the named package "enabled" via our disabling convention? If either
# USE_pkgname (or the all-uppercase USE_PKGNAME, or ENABLE_pkgname, or
# ENABLE_PKGNAME) exists as either a CMake or environment variable, is
# nonempty by contains a non-true/nonnzero value, store false in the
# nonempty by contains a non-true/nonzero value, store false in the
# variable named by <enablevar>, otherwise store true.
function (check_is_enabled pkgname enablevar)
string (TOUPPER ${pkgname} pkgname_upper)
+6 -6
View File
@@ -80,7 +80,7 @@ endif ()
###########################################################################
# Turn on more detailed warnings and optionally consider warnings as errors
#
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF)
option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF)
if (NOT MSVC)
add_compile_options ("-Wall")
@@ -116,7 +116,7 @@ if (${CXX_VISIBILITY_PRESET} STREQUAL "hidden" AND
(CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU"))
# Linux/FreeBSD/Hurd: also hide all the symbols of dependent libraries
# to prevent clashes if an app using this project is linked against
# other verions of our dependencies.
# other versions of our dependencies.
set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}")
endif ()
@@ -202,9 +202,9 @@ endif ()
# Use ccache if found
#
# This can really speed up compilation by caching object files that have
# been compiled previously with idential arguments and inputs. Putting this
# been compiled previously with identical arguments and inputs. Putting this
# logic here makes it work even if the user is unaware of ccache. If it's
# not found on the system, it will simply be silnetly not used.
# not found on the system, it will simply be silently not used.
option (USE_CCACHE "Use ccache if found" ON)
find_program (CCACHE_FOUND ccache)
if (CCACHE_FOUND AND USE_CCACHE)
@@ -249,8 +249,8 @@ endif ()
###########################################################################
# SIMD and machine architecture options.
#
# The USE_SIMD optinon may be set to a comma-separated list of machine /
# instruction set optinos, such as "avx3,f16c". The list will be parsed and
# The USE_SIMD option may be set to a comma-separated list of machine /
# instruction set options, such as "avx3,f16c". The list will be parsed and
# the proper compiler directives added to generate code for those ISA
# capabilities.
#
+17 -2
View File
@@ -53,7 +53,7 @@ set (OPTIONAL_DEPS "" CACHE STRING
# following extra features:
# * If either `USE_pkgname` or the all-uppercase `USE_PKGNAME` (or
# `ENABLE_pkgname` or `ENABLE_PKGNAME`) exists as either a CMake or
# environment variable, is nonempty by contains a non-true/nonnzero
# environment variable, is nonempty by contains a non-true/nonzero
# value, do not search for or use the package. The optional ENABLE <var>
# arguments allow you to override the name of the enabling variable. In
# other words, support for the dependency is presumed to be ON, unless
@@ -255,10 +255,25 @@ if (LLVM_VERSION VERSION_GREATER_EQUAL 10.0.0 AND
"icc >= 7, MSVS >= 2017. "
"If you must use C++11, you need to build against LLVM 9 or earlier.")
endif ()
if (APPLE AND LLVM_VERSION VERSION_EQUAL 10.0.1 AND EXISTS "/usr/local/Cellar/llvm")
message (WARNING
"${ColorYellow}If you are using LLVM 10.0.1 installed by Homebrew, "
"please note that a known bug in LLVM may produce a link error where "
"it says it can't find libxml2.tbd. If you encounter this, please "
"try downgrading to LLVM 9: \n"
" brew uninstall llvm \n"
" brew install llvm@9 \n"
" export LLVM_DIRECTORY=/usr/local/opt/llvm@9 "
"${ColorReset}\n")
endif ()
checked_find_package (partio)
# From pythonutils.cmake
find_python ()
# Qt -- used for osltoy
set (qt5_modules Core Gui Widgets)
if (OPENGL_FOUND)
@@ -289,7 +304,7 @@ if (USE_CUDA OR USE_OPTIX)
STRING (FIND ${LLVM_TARGETS} "NVPTX" nvptx_index)
if (NOT ${nvptx_index} GREATER -1)
message (FATAL_ERROR "NVTPX target is not available in the provided LLVM build")
message (FATAL_ERROR "NVPTX target is not available in the provided LLVM build")
endif()
if (${CUDA_VERSION} VERSION_GREATER 8 AND ${LLVM_VERSION} VERSION_LESS 6)
+2 -2
View File
@@ -4,9 +4,9 @@
# Macro to add an executable build target. The executable name can be
# specified with NAME, otherwise is inferred from the subdirectory name. The
# source files of the binary can be specifeied with SRC, otherwise are
# source files of the binary can be specified with SRC, otherwise are
# inferred to be all the .cpp files within the subdirectory. Optional
# compile DEFINITIONS, private INCLUDE_DIRS, and priviate LINK_LIBRARIES may
# compile DEFINITIONS, private INCLUDE_DIRS, and private LINK_LIBRARIES may
# also be specified.
#
# The executable may be disabled individually using any of the usual
+3 -1
View File
@@ -30,9 +30,11 @@ list (APPEND LLVM_CONFIG_PATH_HINTS
"/usr/local/opt/llvm/bin/")
find_program (LLVM_CONFIG
NAMES llvm-config-${LLVM_VERSION} llvm-config
llvm-config-64-${LLVM_VERSION} llvm-config-64
HINTS ${LLVM_CONFIG_PATH_HINTS} NO_DEFAULT_PATH)
find_program (LLVM_CONFIG
NAMES llvm-config-${LLVM_VERSION} llvm-config
llvm-config-64-${LLVM_VERSION} llvm-config-64
HINTS ${LLVM_CONFIG_PATH_HINTS})
if (NOT LLVM_FIND_QUIETLY)
message (STATUS "Found llvm-config '${LLVM_CONFIG}'")
@@ -113,7 +115,7 @@ endforeach ()
#
# It seems that this is not a problem when linking against the llvm and
# libclang libraries statically. So on apple and when LLVM 10+ are involved,
# just force that choice. Other than larger execubales, it seems harmless,
# just force that choice. Other than larger executables, it seems harmless,
# and in any case a better choice than this beastly bug.
#
# We can periodically revisit this with new version of LLVM, maybe they will
+2 -2
View File
@@ -41,9 +41,9 @@
# NOTE: This file is deprecated.
#
# In OIIO 2.1+, we generate OpenImageIOConfig.cmake files that are now the
# preferred way for downstream projecs to find an installed OIIO. There
# preferred way for downstream projects to find an installed OIIO. There
# should be no need to copy this FindOpenImageIO.cmake file into downstream
# projects, *unless* they need to work with a range of OIIO vesions that
# projects, *unless* they need to work with a range of OIIO versions that
# may include <2.1, which would lack the generated config files.
#
###########################################################################
+28 -29
View File
@@ -4,7 +4,7 @@
# Python-related options.
option (USE_PYTHON "Build the Python bindings" ON)
set (PYTHON_VERSION "2.7" CACHE STRING "Target version of python to find")
set (PYTHON_VERSION "" CACHE STRING "Target version of python to try to find")
option (PYLIB_INCLUDE_SONAME "If ON, soname/soversion will be set for Python module library" OFF)
option (PYLIB_LIB_PREFIX "If ON, prefix the Python module with 'lib'" OFF)
set (PYMODULE_SUFFIX "" CACHE STRING "Suffix to add to Python module init namespace")
@@ -12,10 +12,6 @@ set (PYMODULE_SUFFIX "" CACHE STRING "Suffix to add to Python module init namesp
# Find Python. This macro should only be called if python is required. If
# Python cannot be found, it will be a fatal error.
# Variables set by this macro:
# PYTHON_INCLUDES_PATH - directory where python headers are found
# PYTHON_LIBRARIES - python libraries to link
# PYTHON_SITE_DIR - our own install dir where our python moduels go
macro (find_python)
if (NOT VERBOSE)
set (PythonInterp_FIND_QUIETLY true)
@@ -24,34 +20,39 @@ macro (find_python)
# Attempt to find the desired version, but fall back to other
# additional versions.
checked_find_package (PythonInterp ${PYTHON_VERSION} REQUIRED)
if (USE_PYTHON)
set (_req REQUIRED)
else ()
unset (_req)
endif ()
checked_find_package (Python ${PYTHON_VERSION}
${_req}
COMPONENTS Interpreter Development
PRINT Python_Development_FOUND Python_VERSION
Python_EXECUTABLE Python_LIBRARIES
Python_Development_FOUND Python_Interpreter_FOUND)
# The version that was found may not be the default or user
# defined one.
set (PYTHON_VERSION_FOUND ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
set (PYTHON_VERSION_FOUND ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR})
if (NOT ${PYTHON_VERSION} VERSION_EQUAL ${PYTHON_VERSION_FOUND} )
message (WARNING "The requested version ${PYTHON_VERSION} was not found.")
message (WARNING "Using ${PYTHON_VERSION_FOUND} instead.")
endif ()
checked_find_package (PythonLibs ${PYTHON_VERSION_FOUND} REQUIRED)
if (VERBOSE)
message (STATUS " Python include dirs ${PYTHON_INCLUDE_PATH}")
message (STATUS " Python libraries ${PYTHON_LIBRARIES}")
message (STATUS " Python site packages dir ${PYTHON_SITE_DIR}")
message (STATUS " Python to include 'lib' prefix: ${PYLIB_LIB_PREFIX}")
message (STATUS " Python to include SO version: ${PYLIB_INCLUDE_SONAME}")
message (STATUS " Python version ${PYTHON_VERSION_STRING}")
message (STATUS " Python version major: ${PYTHON_VERSION_MAJOR} minor: ${PYTHON_VERSION_MINOR}")
endif ()
# Give hints to subsequent pybind11 searching to ensure that it finds
# exactly the same version that we found.
set (PythonInterp_FIND_VERSION PYTHON_VERSION_FOUND)
set (PythonInterp_FIND_VERSION_MAJOR ${Python_VERSION_MAJOR})
if (NOT DEFINED PYTHON_SITE_DIR)
set (PYTHON_SITE_DIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_FOUND}/site-packages")
endif ()
if (VERBOSE)
message (STATUS " Python site packages dir ${PYTHON_SITE_DIR}")
message (STATUS " Python to include 'lib' prefix: ${PYLIB_LIB_PREFIX}")
message (STATUS " Python to include SO version: ${PYLIB_INCLUDE_SONAME}")
endif ()
endmacro()
###########################################################################
# pybind11
@@ -69,16 +70,14 @@ macro (setup_python_module)
# Add the library itself
add_library (${target_name} MODULE ${lib_SOURCES})
# Set up include dirs for python & pybind11
target_include_directories (${target_name} SYSTEM PRIVATE ${PYTHON_INCLUDE_PATH})
# Declare the libraries it should link against
target_link_libraries (${target_name} PRIVATE
pybind11::pybind11 ${lib_LIBS} ${SANITIZE_LIBRARIES})
target_link_libraries (${target_name}
PRIVATE
pybind11::pybind11
Python::Python
${lib_LIBS} ${SANITIZE_LIBRARIES})
if (APPLE)
set_target_properties (${target_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else ()
target_link_libraries (${target_name} PRIVATE ${PYTHON_LIBRARIES})
endif ()
# Exclude the 'lib' prefix from the name
+2 -2
View File
@@ -11,7 +11,7 @@ set (public_docs osl-languagespec.pdf
install (FILES ${public_docs} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation)
install ( FILES "${PROJECT_SOURCE_DIR}/LICENSE"
install ( FILES "${PROJECT_SOURCE_DIR}/LICENSE.md"
"${PROJECT_SOURCE_DIR}/INSTALL.md"
"${PROJECT_SOURCE_DIR}/CHANGES.md"
"${PROJECT_SOURCE_DIR}/README.md"
@@ -43,7 +43,7 @@ macro (docdeep_generate)
endif ()
set (docdeep_program ${CMAKE_SOURCE_DIR}/src/build-scripts/docdeep.py)
add_custom_command (OUTPUT ${mdfile}
COMMAND python ${docdeep_program} -d ${_docdeep_NAME} -s docs.css
COMMAND ${Python_EXECUTABLE} ${docdeep_program} -d ${_docdeep_NAME} -s docs.css
${_docdeep_SOURCE} > "${CMAKE_CURRENT_BINARY_DIR}/${mdfile}"
MAIN_DEPENDENCY ${docdeep_program}
DEPENDS ${_docdeep_SOURCE}
+6 -4
View File
@@ -66,7 +66,7 @@ All rights reserved.
Editor: Larry Gritz \\
\emph{lg@imageworks.com}
}
\date{{\large Date: 1 Aug 2020 \\
\date{{\large Date: 11 Aug 2020 \\
% (with corrections, 21 Jul 2020)
}
\bigskip
@@ -3064,7 +3064,7 @@ Returns 1 if $x>0$, -1 if $x<0$, 0 if $x=0$.
\emph{type} {\ce trunc} (\emph{type} x) }
\indexapi{floor()} \indexapi{ceil()} \indexapi{round()} \indexapi{trunc()}
Various rouinding methods: {\cf floor} returns the largest integer less
Various rounding methods: {\cf floor} returns the largest integer less
than or equal to $x$; {\cf ceil} returns the smallest integer greater than
or equal to $x$; {\cf round} returns the closest integer to $x$, in
either direction; and {\cf trunc} returns the integral part of $x$
@@ -3756,8 +3756,10 @@ The type of interpolation is specified by the \emph{basis} name,
\qkw{bezier}, \qkw{bspline}, \qkw{hermite}, \qkw{linear}, or
\qkw{constant}. Some basis
types require particular numbers of knot values -- Bezier splines
require $4n+3$ values, Hermite splines require $4n+2$ values,
Catmull-Rom and linear splines may use any number of values $n\ge 4$.
require $3n+1$ values, Hermite splines require $2n+2$ values, and all of
Catmull-Rom, linear, and constant requires $3+n$, where in all cases,
$n \ge 1$ is the number of spline segments.
To maintain consistency with the other spline types, \qkw{linear} splines will
ignore the first and last data value; interpolating piecewise-linearly
between $y_1$ and $y_{n-2}$, and \qkw{constant} splines ignore the first
Binary file not shown.
+4 -2
View File
@@ -20,10 +20,12 @@
#include <OSL/Imathx/ImathColor.h>
#include <OSL/matrix22.h>
// Temporary bug fix: having trouble with cuda complaining about {fmt} lib.
// Work around by disabling it from oiio headers.
// The fmt library causes trouble for Cuda. Work around by disabling it from
// oiio headers (OIIO <= 2.1) or telling fmt not to use the troublesome
// int128 that Cuda doesn't understand (OIIO >= 2.2).
#ifdef __CUDA_ARCH__
# define OIIO_USE_FMT 0
# define FMT_USE_INT128 0
#endif
// All the things we need from OpenImageIO
+8 -8
View File
@@ -88,7 +88,7 @@ public:
/// int no_pointcloud Skip pointcloud lookups. (0)
/// int exec_repeat How many times to run each group (1).
/// int opt_warnings Warn on certain failure to runtime-optimize
/// cetain shader constructs. (0)
/// certain shader constructs. (0)
/// int gpu_opt_error Consider a hard error if certain shader
/// constructs cannot be optimized away. (0)
/// 2. Attributes that should be set by applications/renderers that
@@ -468,7 +468,7 @@ public:
/// Replace a parameter value in a previously-declared shader group.
/// This is meant to called after the ShaderGroupBegin/End, but will
/// fail if the shader has already been irrevocably optimized/compiled,
/// unless the paraticular parameter is marked as lockgeom=0 (which
/// unless the particular parameter is marked as lockgeom=0 (which
/// indicates that it's a parameter that may be overridden by the
/// geometric primitive). This call gives you a way of changing the
/// instance value, even if it's not a geometric override.
@@ -667,20 +667,20 @@ public:
/// to the optimizer, and will be determined strictly at execution time.
void set_raytypes(ShaderGroup *group, int raytypes_on, int raytypes_off);
/// Ensure that the group has been optimized and JITed. The ctx pointer
/// Ensure that the group has been optimized and optionally JITed. The ctx pointer
/// supplies a ShadingContext to use.
void optimize_group (ShaderGroup *group, ShadingContext *ctx);
void optimize_group (ShaderGroup *group, ShadingContext *ctx, bool do_jit = true);
/// Ensure that the group has been optimized and JITed. This is a
/// Ensure that the group has been optimized and optionally JITed. This is a
/// convenience function that simply calls set_raytypes followed by
/// optimize_group. The ctx supplies a ShadingContext to use.
void optimize_group (ShaderGroup *group, int raytypes_on,
int raytypes_off, ShadingContext *ctx);
int raytypes_off, ShadingContext *ctx, bool do_jit = true);
/// If option "greedyjit" was set, this call will trigger all
/// shader groups that have not yet been compiled to do so with the
/// specified number of threads (0 means use all available HW cores).
void optimize_all_groups (int nthreads=0);
void optimize_all_groups (int nthreads=0, bool do_jit = true);
/// Return a pointer to the TextureSystem being used.
TextureSystem * texturesys () const;
@@ -713,7 +713,7 @@ public:
/// float -> triple replicate x3
/// float -> float[4] replicate x4
/// float -> int truncate like a (int) type cast
/// triple -> triple copy, regarless of differing vector types
/// triple -> triple copy, regardless of differing vector types
/// 3. Additional rules not allowed in OSL source code:
/// float -> float[2] replicate x2
/// int -> float[2] convert to float and replicate x2
+2 -2
View File
@@ -62,7 +62,7 @@ template <typename S, typename T> OSL_HOSTDEVICE Vec3 vnoise (S x, T y);
// Cell noise on 1-4 dimensional domain, range [0,1].
// cellnoise is constant within each unit cube (cell) on the domain, but
// discontinuous at integer boundaries (and uncorrellated from cell to
// discontinuous at integer boundaries (and uncorrelated from cell to
// cell).
template <typename S > OSL_HOSTDEVICE float cellnoise (S x);
template <typename S, typename T> OSL_HOSTDEVICE float cellnoise (S x, T y);
@@ -71,7 +71,7 @@ template <typename S, typename T> OSL_HOSTDEVICE Vec3 vcellnoise (S x, T y);
// Hash noise on 1-4 dimensional domain, range [0,1].
// hashnoise is like cellnoise, but without the 'floor' -- in other words,
// it's an uncorrellated hash that is different for every floating point
// it's an uncorrelated hash that is different for every floating point
// value.
template <typename S > OSL_HOSTDEVICE float hashnoise (S x);
template <typename S, typename T> OSL_HOSTDEVICE float hashnoise (S x, T y);
+1 -1
View File
@@ -136,7 +136,7 @@ public:
bool open(string_view shadername, string_view searchpath = string_view());
///< For an uninitialized `OSLQuery` object, initialize it with info on
/// the named shader with optional searcphath. Return true for success,
/// the named shader with optional searchpath. Return true for success,
/// false if the shader could not be found or opened properly.
bool open_bytecode(string_view buffer);
+2 -2
View File
@@ -30,7 +30,7 @@
#define OSL_LIBRARY_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define OSL_LIBRARY_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define OSL_LIBRARY_VERSION_TWEAK @PROJECT_VERSION_TWEAK@
#define OSL_LIBRARY_VERSION_RELEASE_TYPE @OPROJECT_VERSION_RELEASE_TYPE@
#define OSL_LIBRARY_VERSION_RELEASE_TYPE @PROJECT_VERSION_RELEASE_TYPE@
#define OSL_LIBRARY_VERSION_CODE (10000 * OSL_VERSION_MAJOR + \
100 * OSL_VERSION_MINOR + \
@@ -44,7 +44,7 @@
OSL_LIBRARY_VERSION_MINOR, \
OSL_LIBRARY_VERSION_PATCH, \
OSL_LIBRARY_VERSION_RELEASE_TYPE)
#define OSL_INTRO_STRING "OpenShadingLanguage " OSL_LIBRARY_VERSION_STRING
#define OSL_INTRO_STRING "Open Shading Language " OSL_LIBRARY_VERSION_STRING
#define OSL_COPYRIGHT_STRING "Copyright Contributors to the Open Shading Language project."
+2 -2
View File
@@ -160,7 +160,7 @@
// Generic pragma definition
#if defined(_MSC_VER)
// Of couse MS does it in a quirky way
// Of course MS does it in a quirky way
#define OSL_PRAGMA(UnQuotedPragma) __pragma(UnQuotedPragma)
#else
// All other compilers seem to support C99 _Pragma
@@ -271,7 +271,7 @@
// calls should be inlined, and so on recursively. Has no affect on function calls to
// whose definition exists in different translation units or calls that are not
// legal to inline (possibly by OSL_NOINLINE). Intent is to ensure that entire
// contents of a SIMD loop body is are fully inlined avoiding compiler hueristcs.
// contents of a SIMD loop body is are fully inlined avoiding compiler heuristics.
// However if any debugging code exists inside the code block, then the amount
// of code inlined could explode. So great care should be used when placing
// code inside one of these forced inline blocks. Note that if OSL_DEBUG is true,
+1 -1
View File
@@ -129,7 +129,7 @@ public:
/// the name of one of the coordinate systems). A renderer is free
/// to not implement this, in which case the default implementation
/// is simply to make appropriate calls to get_matrix and
/// get_inverse_matrix. The existance of this method is to allow
/// get_inverse_matrix. The existence of this method is to allow
/// some renderers to provide transformations that cannot be
/// expressed by a 4x4 matrix.
///
+1 -1
View File
@@ -145,7 +145,7 @@ namespace sfm
}
// because lengthTiny does alot of work including another
// because lengthTiny does a lot of work including another
// sqrt, we really want to skip that if possible because
// with SIMD execution, we end up doing the sqrt twice
// and blending the results. Although code could be
+1 -1
View File
@@ -98,7 +98,7 @@ struct ShaderGlobals {
TransformationPtr object2common;
TransformationPtr shader2common;
/// The output closure will be placed here. The rendererer should
/// The output closure will be placed here. The renderer should
/// initialize this to NULL before shading execution, and this is where
/// it can retrieve the output closure from after shader execution has
/// completed.
+10 -10
View File
@@ -764,15 +764,15 @@ protected:
char m_symtype; ///< Kind of symbol (param, local, etc.)
unsigned m_has_derivs : 1; ///< Step to derivs (0 == has no derivs)
unsigned m_const_initializer : 1; ///< initializer is a constant expression
unsigned m_connected_down : 1; ///< Connected to a later/downtream layer
unsigned m_initialized : 1; ///< If a param, has it been initialized?
unsigned m_lockgeom : 1; ///< Is the param not overridden by geom?
unsigned m_allowconnect : 1; ///< Is the param not overridden by geom?
unsigned m_renderer_output : 1; ///< Is this sym a renderer output?
unsigned m_readonly : 1; ///< read-only symbol
char m_valuesource; ///< Where did the value come from?
bool m_free_data; ///< Free m_data upon destruction?
short m_fieldid; ///< Struct field of this var (or -1)
unsigned m_connected_down : 1; ///< Connected to a later/downstream layer
unsigned m_initialized : 1; ///< If a param, has it been initialized?
unsigned m_lockgeom : 1; ///< Is the param not overridden by geom?
unsigned m_allowconnect : 1; ///< Is the param not overridden by geom?
unsigned m_renderer_output : 1; ///< Is this sym a renderer output?
unsigned m_readonly : 1; ///< read-only symbol
char m_valuesource; ///< Where did the value come from?
bool m_free_data; ///< Free m_data upon destruction?
short m_fieldid; ///< Struct field of this var (or -1)
short m_layer; ///< Layer (within the group) this belongs to
int m_scope; ///< Scope where this symbol was declared
int m_dataoffset; ///< Offset of the data (-1 for unknown)
@@ -792,7 +792,7 @@ typedef std::vector<Symbol*> SymbolPtrVec;
/// Intermediate Represenatation opcode
/// Intermediate Representation opcode
///
class Opcode {
public:
+4 -4
View File
@@ -176,7 +176,7 @@ public:
return this;
}
/// Detatch any 'next' nodes.
/// Detach any 'next' nodes.
void detach_next() { m_next.reset(); }
/// Concatenate ASTNode sequences A and B, returning a raw pointer to
@@ -320,7 +320,7 @@ protected:
void typecheck_children(TypeSpec expected = TypeSpec());
/// Helper for check_arglist: simple case of checking a single arg type
/// agaisnt the front of the formals list (which will be advanced).
/// against the front of the formals list (which will be advanced).
bool check_simple_arg(const TypeSpec& argtype, const char*& formals,
bool coerce);
@@ -383,7 +383,7 @@ protected:
bool is_constructor = false,
Symbol* arrayindex = nullptr);
// Codegen an array assignemnt: lval[index] = src
// Codegen an array assignment: lval[index] = src
// If no index is provided the constant i is used.
// Will return either src or a temporary that was codegened.
Symbol* codegen_aassign(TypeSpec elemtype, Symbol* src, Symbol* lval,
@@ -942,7 +942,7 @@ private:
void typecheck_builtin_specialcase();
/// Make sure the printf-like format string matches the list of
/// arguments poitned to by arg. If ok, return true, otherwise
/// arguments pointed to by arg. If ok, return true, otherwise
/// return false and call an appropriate error().
bool typecheck_printf_args(const char* format, ASTNode* arg);
+3 -3
View File
@@ -154,7 +154,7 @@ OSLCompilerImpl::add_struct_fields(StructSpec* structspec, ustring basename,
arr ? NULL : init);
} else {
if (node && init && !arr) {
// Remember the pairing of this field and the iniial expr.
// Remember the pairing of this field and the initial expr.
((ASTvariable_declaration*)node)
->register_struct_init(fieldname, init);
}
@@ -911,7 +911,7 @@ ASTNode::codegen_initlist(ref init, TypeSpec type, Symbol* sym)
ASTvariable_declaration* v = (ASTvariable_declaration*)this;
std::string out;
if (v->param_default_literals(fieldsym, init.get(), out))
continue; // Skip if we had a static initalizer
continue; // Skip if we had a static initializer
}
codegen_initlist(init, fieldsym->typespec(), fieldsym);
}
@@ -1338,7 +1338,7 @@ ASTstructselect::codegen_assign(Symbol* dest, Symbol* src)
// A struct select needs to decypher whether there is an array index
// A struct select needs to decipher whether there is an array index
// necessary in the chain of events. The only kind of assignment that
// makes sense is a series of struct field selections, array indexings,
// or (last) a direct variable reference (for the top level struct).
+2 -2
View File
@@ -374,7 +374,7 @@ public:
m_nowarn_lines.insert({ filename(), lineno() + 1 });
}
// Is the line amont
// Is the line among the 'do not warn' list
bool nowarn(ustring filename, int line) const
{
return m_nowarn_lines.find({ filename, line }) != m_nowarn_lines.end();
@@ -433,7 +433,7 @@ private:
}
/// Add all symbols used in the op range [opbegin,opend) to rsyms
/// and/or wsyms. Pass NULL if you don't care abou one or the other.
/// and/or wsyms. Pass NULL if you don't care about one or the other.
/// Pass both pointers to the same vector if you want both reads and
/// writes recorded to the same place.
void syms_used_in_op_range(OpcodeVec::const_iterator opbegin,
+3 -3
View File
@@ -864,7 +864,7 @@ public:
else if (cinit->initlist())
typecheck_fields(cinit, cinit->initlist().get(), ftype);
else if (m_mode & must_init_all)
m_success = false; // empty init list not allowd
m_success = false; // empty init list not allowed
} else
typecheck_array(cinit, ftype);
@@ -2019,7 +2019,7 @@ ASTfunction_call::typecheck(TypeSpec expected)
}
}
// Fix up actual arguments compound initializiers that were paired with
// Fix up actual arguments compound initializers that were paired with
// user function formal arguments that are unsigned arrays. They were
// not yet typechecked, do so now.
if (any_args_are_compound_initializers && is_user_function()) {
@@ -2076,7 +2076,7 @@ ASTfunction_call::typecheck(TypeSpec expected)
// the functions as having special properties:
// "!rw" nonstandard behavior about which args are read vs written.
// "!printf" has a printf-like argument list
// "!tex" has a texture()-like token/value pair optinal argument list
// "!tex" has a texture()-like token/value pair optional argument list
// "!deriv" takes derivs of its arguments
// clang-format off
+1 -1
View File
@@ -149,7 +149,7 @@ macro ( CUDA_SHADEOPS_COMPILE srclist )
DEPENDS ${shadeops_bc_list} ${exec_headers} ${PROJECT_PUBLIC_HEADERS} ${shadeops_srcs}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
# Serialze the linked bitcode into a CPP file and add it to the list of liboslexec soures
# Serialize the linked bitcode into a CPP file and add it to the list of liboslexec soures
add_custom_command ( OUTPUT ${shadeops_bc_cuda_cpp}
COMMAND python "${CMAKE_CURRENT_SOURCE_DIR}/serialize-bc.py"
${linked_shadeops_bc} ${shadeops_bc_cuda_cpp} "osl_llvm_compiled_ops_cuda"
+1 -1
View File
@@ -25,7 +25,7 @@ class MyAov : public Aov
MyAov(const TestPath *test, int id)
{
// Init for the test case array. For each test case set a bool
// in m_expected marking wether this AOV should get soem color
// in m_expected marking wether this AOV should get some color
// from that test or not.
for (int i = 0; test[i].path[0]; ++i) { // iterate test cases
m_expected.push_back(false); // false by default
+1 -1
View File
@@ -156,7 +156,7 @@ class NdfAutomata {
/// Perform a lambda closure of a state set
///
/// In other words, complete the given set so it includes all the aditional
/// In other words, complete the given set so it includes all the additional
/// states that are reachable by the lambda symbol
void lambdaClosure(IntSet &states)const;
+2 -2
View File
@@ -448,7 +448,7 @@ BackendLLVM::getOrAllocateCUDAVariable (const Symbol& sym, bool addMetadata)
// Use the ustring hash to create a name for the symbol that's based on
// the string contents
//
// TODO: Collisions between variable names are unlikely, but stil
// TODO: Collisions between variable names are unlikely, but still
// possible. Using something like a counter to handle collisions
// is unattractive because it depends on the order in which
// strings are encountered at run time.
@@ -1075,7 +1075,7 @@ BackendLLVM::llvm_assign_impl (Symbol &Result, Symbol &Src,
: llvm_load_value (Src, 0, arrind, srccomp, basetype);
if (!src_val)
return false;
// write source float into all compnents when dstcomp == -1, otherwise
// write source float into all components when dstcomp == -1, otherwise
// the single element requested.
if (dstcomp == -1) {
for (int i = 0; i < num_components; ++i)
+1 -1
View File
@@ -144,7 +144,7 @@ public:
}
/// Return an llvm::Value* that is either a scalar and derivs is
/// false, or a pointer to sym's values (if sym is an aggreate or
/// false, or a pointer to sym's values (if sym is an aggregate or
/// derivs == true). Furthermore, if deriv == true and sym doesn't
/// have derivs, coerce it into a variable with zero derivs.
llvm::Value *llvm_load_arg (const Symbol& sym, bool derivs);
+2 -2
View File
@@ -1932,7 +1932,7 @@ DECLFOLDER(constfold_sincos)
DECLFOLDER(constfold_normalize)
{
// Try to turn R=normalze(x) into R=C
// Try to turn R=normalize(x) into R=C
Opcode &op (rop.inst()->ops()[opnum]);
Symbol &X (*rop.inst()->argsymbol(op.firstarg()+1));
OSL_DASSERT(X.typespec().is_triple());
@@ -3050,7 +3050,7 @@ DECLFOLDER(constfold_raytype)
rop.turn_into_assign_zero (op, "raytype => 0");
return 1;
}
return 0; // indeterminite until execution time
return 0; // indeterminate until execution time
}
+2 -2
View File
@@ -50,9 +50,9 @@ ShadingContext::execute_init (ShaderGroup &sgroup, ShaderGlobals &ssg, bool run)
// Optimize if we haven't already
if (sgroup.nlayers()) {
sgroup.start_running ();
if (! sgroup.optimized()) {
if (! sgroup.jitted()) {
auto ctx = shadingsys().get_context(thread_info());
shadingsys().optimize_group (sgroup, ctx);
shadingsys().optimize_group (sgroup, ctx, true /*do_jit*/);
if (shadingsys().m_greedyjit && shadingsys().m_groups_to_compile_count) {
// If we are greedily JITing, optimize/JIT everything now
shadingsys().optimize_all_groups ();
+6 -6
View File
@@ -1191,11 +1191,11 @@ LLVM_Util::make_jit_execengine (std::string *err,
// However cpu feature set may or may not support FMA's independently
options.AllowFPOpFusion = jit_fma() ? llvm::FPOpFusion::Fast :
llvm::FPOpFusion::Standard;
// Unfortunately enabling UnsafeFPMath allows reciprocols, which we don't want for divides
// Unfortunately enabling UnsafeFPMath allows reciprocals, which we don't want for divides
// To match results for existing unit tests we might need to disable UnsafeFPMath
// TODO: investigate if reciprocols can be disabled by other means.
// TODO: investigate if reciprocals can be disabled by other means.
// Perhaps enable UnsafeFPMath, then modify creation of DIV instructions
// to remove the arcp (allow reciprocol) flag on that instructions
// to remove the arcp (allow reciprocal) flag on that instructions
options.UnsafeFPMath = false;
// Since there are OSL langauge functions isinf and isnan,
// we cannot assume there will not be infs and NANs
@@ -1203,7 +1203,7 @@ LLVM_Util::make_jit_execengine (std::string *err,
options.NoNaNsFPMath = false;
// We will not be setting up any exception handling for FP math
options.NoTrappingFPMath = true;
// Debatable, but peraps some tests care about the sign of +0 vs. -0
// Debatable, but perhaps some tests care about the sign of +0 vs. -0
options.NoSignedZerosFPMath = false;
// We will NOT be changing rounding mode dynamically
options.HonorSignDependentRoundingFPMathOption = false;
@@ -1758,7 +1758,7 @@ LLVM_Util::prune_and_internalize_module (std::unordered_set<llvm::Function*> ext
__OSL_PRUNE_ONLY(std::cout << ">>>>>>>>>>>>>>>>>>After: internalize non-external functions" << std::endl);
// At this point everything should already be materialized, but we need
// to materialze the module itself to avoid asserts checking for the
// to materialize the module itself to avoid asserts checking for the
// module's materialization when using a DEBUG version of LLVM
LLVMErr err = m_llvm_module->materializeAll();
if (error_string(std::move(err), out_err))
@@ -3034,7 +3034,7 @@ LLVM_Util::ptx_compile_group (llvm::Module* lib_module, const std::string& name,
llvm::Reloc::Static, llvm::CodeModel::Small, llvm::CodeGenOpt::Aggressive);
OSL_ASSERT (target_machine && "PTX compile error: Unable to create target machine -- is NVPTX enabled in LLVM?");
// Setup the optimzation passes
// Setup the optimization passes
llvm::legacy::FunctionPassManager fn_pm (linked_module);
fn_pm.add (llvm::createTargetTransformInfoWrapperPass (
target_machine->getTargetIRAnalysis()));
+2 -2
View File
@@ -83,7 +83,7 @@ class Parser
/// and report it was a custom symbol in the iscustom flag
ustring parseRawSymbol(bool &iscustom);
/// Given that the begining of a concatenation of regexps is ready to parse, parse it
/// and it can be optionally be enclosed in parentheis ()
/// and it can be optionally be enclosed in parentheses ()
LPexp *parseCat();
/// Given that a fully qualified group like <.RD'custom'> is ready to parse, parse it
LPexp *parseGroup();
@@ -107,7 +107,7 @@ class Parser
// automatically converted to a group, this prevents that happening
bool m_ingroup;
// maps each basic label to its expected possition in the appearance order, for instance
// the direction label can't be in the fisrt pos of a group. This way we know where to put the
// the direction label can't be in the first pos of a group. This way we know where to put the
// expression when the user writes just S, which translates to <..S>
SymbolToInt m_label_position;
// The set of the basic labels
+1 -1
View File
@@ -164,7 +164,7 @@ lpexp::NRepeat::genAuto(NdfAutomata &automata)const
last->addTransition(lambda, fl.first);
last = fl.second;
}
// And then n - m aditional movements. But we make them optional using
// And then n - m additional movements. But we make them optional using
// lambda transitions
if (!last && i < m_max)
first = last = automata.newState();
+1 -1
View File
@@ -30,7 +30,7 @@ typedef enum {
/// Base class for a light path expression
//
/// Light path expressions are arranged as an abstract syntax tree. All the
/// nodes in that tree satisfy this interface that basicaly makes the automate
/// nodes in that tree satisfy this interface that basically makes the automate
/// generation easy and clear.
///
/// The node types for this tree are:
+1 -1
View File
@@ -167,7 +167,7 @@ osl_printf (ShaderGlobals *sg, const char* format_str, ...)
va_list args;
va_start (args, format_str);
#if 0
// Make super sure we know we are excuting LLVM-generated code!
// Make super sure we know we are executing LLVM-generated code!
std::string newfmt = std::string("llvm: ") + format_str;
format_str = newfmt.c_str();
#endif
+9 -5
View File
@@ -230,7 +230,7 @@ osl_texture (void *sg_, const char *name, void *handle,
{
ShaderGlobals *sg = (ShaderGlobals *)sg_;
TextureOpt *opt = (TextureOpt *)opt_;
bool derivs = (dresultdx != NULL);
bool derivs = (dresultdx || dalphadx);
// It's actually faster to ask for 4 channels (even if we need fewer)
// and ensure that they're being put in aligned memory.
OIIO::simd::float4 result_simd, dresultds_simd, dresultdt_simd;
@@ -249,12 +249,16 @@ osl_texture (void *sg_, const char *name, void *handle,
// Correct our st texture space gradients into xy-space gradients
if (derivs) {
OSL_DASSERT((dresultdx == nullptr) == (dresultdy == nullptr));
OSL_DASSERT((dalphadx == nullptr) == (dalphady == nullptr));
OIIO::simd::float4 dresultdx_simd = dresultds_simd * dsdx + dresultdt_simd * dtdx;
OIIO::simd::float4 dresultdy_simd = dresultds_simd * dsdy + dresultdt_simd * dtdy;
for (int i = 0; i < chans; ++i)
((float *)dresultdx)[i] = dresultdx_simd[i];
for (int i = 0; i < chans; ++i)
((float *)dresultdy)[i] = dresultdy_simd[i];
if (dresultdx) {
for (int i = 0; i < chans; ++i)
((float *)dresultdx)[i] = dresultdx_simd[i];
for (int i = 0; i < chans; ++i)
((float *)dresultdy)[i] = dresultdy_simd[i];
}
if (dalphadx) {
((float *)dalphadx)[0] = dresultdx_simd[chans];
((float *)dalphady)[0] = dresultdy_simd[chans];
+9 -5
View File
@@ -117,7 +117,7 @@ struct OpDescriptor {
ustring name; // name of op
OpLLVMGen llvmgen; // llvm-generating routine
OpFolder folder; // constant-folding routine
bool simple_assign; // wholy overwites arg0, no other writes,
bool simple_assign; // wholly overwrites arg0, no other writes,
// no side effects
int flags; // other flags
OpDescriptor () { }
@@ -583,7 +583,7 @@ public:
/// The group is set and won't be changed again; take advantage of
/// this by optimizing the code knowing all our instance parameters
/// (at least the ones that can't be overridden by the geometry).
void optimize_group (ShaderGroup &group, ShadingContext *ctx);
void optimize_group (ShaderGroup &group, ShadingContext *ctx, bool do_jit);
/// After doing all optimization and code JIT, we can clean up by
/// deleting the instances' code and arguments, and paring their
@@ -610,7 +610,7 @@ public:
int raytype_bit (ustring name);
void optimize_all_groups (int nthreads=0, int mythread=0, int totalthreads=1);
void optimize_all_groups (int nthreads=0, int mythread=0, int totalthreads=1, bool do_jit=true);
typedef std::unordered_map<ustring,OpDescriptor,ustringHash> OpDescriptorMap;
@@ -873,7 +873,7 @@ private:
/// Describe one end of a parameter connetion: the parameter number, and
/// optinally an array index and/or channel number within that parameter.
/// optionally an array index and/or channel number within that parameter.
struct ConnectedParam {
int param; ///< Parameter number (in the symbol table)
int arrayindex:27; ///< Array index (-1 for not an index)
@@ -1404,7 +1404,7 @@ public:
/// Clear the layers
///
void clear () { m_layers.clear (); m_optimized = 0; m_executions = 0; }
void clear () { m_layers.clear (); m_optimized = 0; m_jitted = 0; m_executions = 0; }
/// Append a new shader instance on to the end of this group
///
@@ -1425,6 +1425,9 @@ public:
int optimized () const { return m_optimized; }
void optimized (int opt) { m_optimized = opt; }
int jitted () const { return m_jitted; }
void jitted (int jitted) { m_jitted = jitted; }
size_t llvm_groupdata_size () const { return m_llvm_groupdata_size; }
void llvm_groupdata_size (size_t size) { m_llvm_groupdata_size = size; }
@@ -1527,6 +1530,7 @@ private:
// needed on every shade execution at the front of the struct, as much
// together on one cache line as possible.
volatile int m_optimized = 0; ///< Is it already optimized?
volatile int m_jitted = 0; ///< Is it already jitted?
bool m_does_nothing = false; ///< Is the shading group just func() { return; }
size_t m_llvm_groupdata_size = 0;///< Heap size needed for its groupdata
int m_id; ///< Unique ID for the group
+1 -1
View File
@@ -28,7 +28,7 @@ public:
typedef std::unordered_map<ustring, std::shared_ptr<Partio::ParticleAttribute>, ustringHash> AttributeMap;
// N.B./FIXME(C++11): shared_ptr is probably overkill, but
// scoped_ptr is not copyable and therefore can't be used in
// standard containers. When C++11 is uniquitous, unique_ptr is the
// standard containers. When C++11 is ubiquitous, unique_ptr is the
// one that should really be used.
const Partio::ParticlesData* read_access() const { OSL_DASSERT(!m_write); return m_partio_cloud; }
+2 -2
View File
@@ -968,7 +968,7 @@ RuntimeOptimizer::simplify_params ()
// constant value. (a) Partial-to-whole connections, for example
// connecting one component of an upstream triple output to a
// downstream float input, should propagate the constant, but we
// currently neglect this case. (b) If *multiple* conections
// currently neglect this case. (b) If *multiple* connections
// combine to fully propagate values, for example if someone was
// foolish enough to connect R, G, and B components of color
// parameters *separately*, we sure don't notice that and treat
@@ -2103,7 +2103,7 @@ RuntimeOptimizer::optimize_ops (int beginop, int endop,
OSL_ASSERT (lastblock == m_bblockids[opnum] &&
"this should not be a new basic block");
--skipops;
continue; // Move along to the next op, no opimization here
continue; // Move along to the next op, no optimization here
}
// Things to do if we've just moved to a new basic block
if (lastblock != m_bblockids[opnum]) {
+1 -1
View File
@@ -134,7 +134,7 @@ public:
int turn_into_nop (int begin, int end, string_view why=NULL);
/// Transmute regulare function call into a 'no return' function call
/// Transmute regular function call into a 'no return' function call
/// The funcationcall_nr is useful to generate debug info for the inlined
/// function call. Its existence shouldn't otherwise modify resulting
/// code generation.
+174 -81
View File
@@ -14,18 +14,21 @@
#include "backendllvm.h"
#include <OSL/oslquery.h>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/optparser.h>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/sysutil.h>
#include <OpenImageIO/thread.h>
#include <OpenImageIO/timer.h>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/optparser.h>
#include <OpenImageIO/fmath.h>
#include "opcolor.h"
using namespace OSL;
using namespace OSL::pvt;
#include <OpenEXR/ImfChannelList.h> // Just for OPENEXR_VERSION_STRING
// avoid naming conflicts with MSVC macros
#ifdef _MSC_VER
#undef RGB
@@ -387,7 +390,8 @@ const void*
ShadingSystem::symbol_address (const ShadingContext &ctx,
const ShaderSymbol *sym) const
{
return sym ? ctx.symbol_data (*(const Symbol *)sym) : NULL;
OSL_DASSERT(sym != nullptr);
return ctx.symbol_data (*(const Symbol *)sym);
}
@@ -476,9 +480,9 @@ ShadingSystem::raytype_bit (ustring name)
void
ShadingSystem::optimize_all_groups (int nthreads)
ShadingSystem::optimize_all_groups (int nthreads, bool do_jit)
{
return m_impl->optimize_all_groups (nthreads);
return m_impl->optimize_all_groups (nthreads, 0 /*mythread*/, 1 /*totalthreads*/, do_jit);
}
@@ -526,10 +530,10 @@ ShadingSystem::set_raytypes (ShaderGroup *group, int raytypes_on, int raytypes_o
void
ShadingSystem::optimize_group (ShaderGroup *group, ShadingContext *ctx)
ShadingSystem::optimize_group (ShaderGroup *group, ShadingContext *ctx, bool do_jit)
{
if (group)
m_impl->optimize_group (*group, ctx);
m_impl->optimize_group (*group, ctx, do_jit);
}
@@ -537,11 +541,12 @@ ShadingSystem::optimize_group (ShaderGroup *group, ShadingContext *ctx)
void
ShadingSystem::optimize_group (ShaderGroup *group,
int raytypes_on, int raytypes_off,
ShadingContext *ctx)
ShadingContext *ctx,
bool do_jit)
{
// convenience function for backwards compatibility
set_raytypes (group, raytypes_on, raytypes_off);
optimize_group (group, ctx);
optimize_group (group, ctx, do_jit);
}
@@ -1076,6 +1081,18 @@ ShadingSystemImpl::query_closure(const char **name, int *id,
ShadingSystemImpl::~ShadingSystemImpl ()
{
size_t ngroups = m_all_shader_groups.size();
for (size_t i = 0; i < ngroups; ++i) {
if (ShaderGroupRef g = m_all_shader_groups[i].lock()) {
if (!g->jitted() ) {
// As we are now lazier in jitting and need to keep the OSL IR
// around in case we want to create a batched JIT or vice versa
// we may have OSL IR to cleanup
group_post_jit_cleanup(*g);
}
}
}
printstats ();
// N.B. just let m_texsys go -- if we asked for one to be created,
// we asked for a shared one.
@@ -1154,11 +1171,11 @@ ShadingSystemImpl::attribute (string_view name, TypeDesc type,
ATTR_SET ("llvm_target_host", int, m_llvm_target_host);
// Due to ABI breakage in LLVM 7.0.[0-1] for llvm::Optional with GCC,
// calling any llvm API's that accept an llvm::Optional parameter will break
// calling any llvm APIs that accept an llvm::Optional parameter will break
// ABI causing issues.
// https://bugs.llvm.org/show_bug.cgi?id=39427
// Fixed in llvm 7.1.0+
// Workaround don't enable debug symbols which would use llvm::Optional API's
// Workaround don't enable debug symbols which would use llvm::Optional APIs
#if (!OSL_GNUC_VERSION) || (OSL_LLVM_VERSION >= 71)
ATTR_SET ("llvm_debugging_symbols", int, m_llvm_debugging_symbols);
#endif
@@ -1526,7 +1543,7 @@ ShadingSystemImpl::getattribute (ShaderGroup *group, string_view name,
if (name == "group_entry_name" && type.basetype == TypeDesc::STRING) {
int nlayers = group->nlayers ();
ShaderInstance *inst = (*group)[nlayers-1];
// This formuation mirrors OSOProcessorBase::layer_function_name()
// This formulation mirrors OSOProcessorBase::layer_function_name()
#ifdef OIIO_HAS_SPRINTF
*(ustring *)val = ustring::sprintf ("__direct_callable__%s_%s_%d", group->name(),
inst->layername(), inst->id());
@@ -1561,7 +1578,7 @@ ShadingSystemImpl::getattribute (ShaderGroup *group, string_view name,
if (! group->optimized()) {
auto threadinfo = create_thread_info();
auto ctx = get_context(threadinfo);
optimize_group (*group, ctx);
optimize_group (*group, ctx, false /*jit*/);
release_context(ctx);
destroy_thread_info (threadinfo);
}
@@ -1758,20 +1775,56 @@ struct group_time_compare { // So looking forward to C++11 lambdas!
// Return a comma-separated list of all the important SIMD/capabilities
// that were enabled as a compile-time option when OSL was built.
// (Keep this in sync with oiio_simd_caps in imageio.cpp).
static std::string
osl_simd_caps()
{
// clang-format off
std::vector<string_view> caps;
if (OIIO_SIMD_SSE >= 2) caps.emplace_back ("sse2");
if (OIIO_SIMD_SSE >= 3) caps.emplace_back ("sse3");
if (OIIO_SIMD_SSE >= 3) caps.emplace_back ("ssse3");
if (OIIO_SIMD_SSE >= 4) caps.emplace_back ("sse41");
if (OIIO_SIMD_SSE >= 4) caps.emplace_back ("sse42");
if (OIIO_SIMD_AVX) caps.emplace_back ("avx");
if (OIIO_SIMD_AVX >= 2) caps.emplace_back ("avx2");
if (OIIO_SIMD_AVX >= 512) caps.emplace_back ("avx512f");
if (OIIO_AVX512DQ_ENABLED) caps.emplace_back ("avx512dq");
if (OIIO_AVX512IFMA_ENABLED) caps.emplace_back ("avx512ifma");
if (OIIO_AVX512PF_ENABLED) caps.emplace_back ("avx512pf");
if (OIIO_AVX512ER_ENABLED) caps.emplace_back ("avx512er");
if (OIIO_AVX512CD_ENABLED) caps.emplace_back ("avx512cd");
if (OIIO_AVX512BW_ENABLED) caps.emplace_back ("avx512bw");
if (OIIO_AVX512VL_ENABLED) caps.emplace_back ("avx512vl");
if (OIIO_FMA_ENABLED) caps.emplace_back ("fma");
if (OIIO_F16C_ENABLED) caps.emplace_back ("f16c");
// if (OIIO_POPCOUNT_ENABLED) caps.emplace_back ("popcnt");
return OIIO::Strutil::join (caps, ",");
// clang-format on
}
std::string
ShadingSystemImpl::getstats (int level) const
{
int columns = OIIO::Sysutil::terminal_columns() - 2;
if (level <= 0)
return "";
std::ostringstream out;
out.imbue (std::locale::classic()); // force C locale
out << "OSL ShadingSystem statistics (" << (void*)this;
out << ") ver " << OSL_LIBRARY_VERSION_STRING
<< ", LLVM " << OSL_LLVM_FULL_VERSION << "\n";
if (m_stat_shaders_requested == 0 && m_stat_shaders_loaded == 0) {
out << " No shaders requested or loaded\n";
return out.str();
}
out << "Open Shading Language " << OSL_LIBRARY_VERSION_STRING << "\n";
out << " Build deps: LLVM-" << OSL_LLVM_FULL_VERSION
<< " OIIO-" << OIIO_VERSION_STRING << " Imath-" <<
#ifdef OPENEXR_VERSION_STRING
OPENEXR_VERSION_STRING
#else
"(unknown)"
#endif
<< "\n";
std::string opt;
#define BOOLOPT(name) opt += Strutil::sprintf(#name "=%d ", m_##name)
@@ -1837,7 +1890,28 @@ ShadingSystemImpl::getstats (int level) const
#undef BOOLOPT
#undef INTOPT
#undef STROPT
out << " Options: " << Strutil::wordwrap(opt, 75, 12) << "\n";
// Print the HW info
out << " Build HW support: ";
std::string buildsimd = osl_simd_caps();
if (!buildsimd.size())
buildsimd = "no SIMD";
out << buildsimd << "\n";
OIIO::Strutil::fprintf(out, " Runtime HW: %d cores %.1fGB %s\n",
OIIO::Sysutil::hardware_concurrency(),
OIIO::Sysutil::physical_memory() / float(1 << 30),
OIIO::get_string_attribute("hw:simd"));
// TODO: detect GPU info and print it here
out << "\n";
out << "ShadingSystem Options:\n";
out << " " << Strutil::wordwrap(opt, columns, 4) << "\n";
out << "\nOSL ShadingSystem statistics (" << (void*)this << ")\n";
if (m_stat_shaders_requested == 0 && m_stat_shaders_loaded == 0) {
out << " No shaders requested or loaded\n";
return out.str();
}
out << " Shaders:\n";
out << " Requested: " << m_stat_shaders_requested << "\n";
@@ -2243,7 +2317,7 @@ ShadingSystemImpl::ConnectShaders (ShaderGroup& group,
}
// Decode the parameter names, find their symbols in their
// respective layers, and also decode requrest to attach specific
// respective layers, and also decode request to attach specific
// array elements or color/vector channels.
ConnectedParam srccon = decode_connected_param(srcparam, srclayer, srcinst);
ConnectedParam dstcon = decode_connected_param(dstparam, dstlayer, dstinst);
@@ -2921,14 +2995,15 @@ ShadingSystemImpl::group_post_jit_cleanup (ShaderGroup &group)
void
ShadingSystemImpl::optimize_group (ShaderGroup &group, ShadingContext *ctx)
ShadingSystemImpl::optimize_group (ShaderGroup &group, ShadingContext *ctx, bool do_jit)
{
if (group.optimized())
return; // already optimized
if (group.optimized() && (!do_jit || group.jitted()))
return; // already optimized and optionally jitted
OIIO::Timer timer;
lock_guard lock (group.m_mutex);
if (group.optimized()) {
bool need_jit = do_jit && !group.jitted();
if (group.optimized() && !need_jit) {
// The group was somehow optimized by another thread between the
// time we checked group.optimized() and now that we have the lock.
// Nothing to do but record how long we waited for the lock.
@@ -2946,6 +3021,7 @@ ShadingSystemImpl::optimize_group (ShaderGroup &group, ShadingContext *ctx)
// how long we waited for the lock.
group.does_nothing (true);
group.m_optimized = true;
group.m_jitted = true;
spin_lock stat_lock (m_stat_mutex);
double t = timer();
m_stat_optimization_time += t;
@@ -2962,63 +3038,80 @@ ShadingSystemImpl::optimize_group (ShaderGroup &group, ShadingContext *ctx)
ctx = get_context(thread_info);
ctx_allocated = true;
}
RuntimeOptimizer rop (*this, group, ctx);
rop.run ();
rop.police_failed_optimizations();
if (!group.optimized()) {
RuntimeOptimizer rop (*this, group, ctx);
rop.run ();
rop.police_failed_optimizations();
// Copy some info recorded by the RuntimeOptimizer into the group
group.m_unknown_textures_needed = rop.m_unknown_textures_needed;
for (auto&& f : rop.m_textures_needed)
group.m_textures_needed.push_back (f);
group.m_unknown_closures_needed = rop.m_unknown_closures_needed;
for (auto&& f : rop.m_closures_needed)
group.m_closures_needed.push_back (f);
for (auto&& f : rop.m_globals_needed)
group.m_globals_needed.push_back (f);
group.m_globals_read = rop.m_globals_read;
group.m_globals_write = rop.m_globals_write;
size_t num_userdata = rop.m_userdata_needed.size();
group.m_userdata_names.reserve (num_userdata);
group.m_userdata_types.reserve (num_userdata);
group.m_userdata_offsets.resize (num_userdata, 0);
group.m_userdata_derivs.reserve (num_userdata);
group.m_userdata_layers.reserve (num_userdata);
group.m_userdata_init_vals.reserve (num_userdata);
for (auto&& n : rop.m_userdata_needed) {
group.m_userdata_names.push_back (n.name);
group.m_userdata_types.push_back (n.type);
group.m_userdata_derivs.push_back (n.derivs);
group.m_userdata_layers.push_back (n.layer_num);
group.m_userdata_init_vals.push_back (n.data);
}
group.m_unknown_attributes_needed = rop.m_unknown_attributes_needed;
for (auto&& f : rop.m_attributes_needed) {
group.m_attributes_needed.push_back (f.name);
group.m_attribute_scopes.push_back (f.scope);
// Copy some info recorded by the RuntimeOptimizer into the group
group.m_unknown_textures_needed = rop.m_unknown_textures_needed;
for (auto&& f : rop.m_textures_needed)
group.m_textures_needed.push_back (f);
group.m_unknown_closures_needed = rop.m_unknown_closures_needed;
for (auto&& f : rop.m_closures_needed)
group.m_closures_needed.push_back (f);
for (auto&& f : rop.m_globals_needed)
group.m_globals_needed.push_back (f);
group.m_globals_read = rop.m_globals_read;
group.m_globals_write = rop.m_globals_write;
size_t num_userdata = rop.m_userdata_needed.size();
group.m_userdata_names.reserve (num_userdata);
group.m_userdata_types.reserve (num_userdata);
group.m_userdata_offsets.resize (num_userdata, 0);
group.m_userdata_derivs.reserve (num_userdata);
group.m_userdata_layers.reserve (num_userdata);
group.m_userdata_init_vals.reserve (num_userdata);
for (auto&& n : rop.m_userdata_needed) {
group.m_userdata_names.push_back (n.name);
group.m_userdata_types.push_back (n.type);
group.m_userdata_derivs.push_back (n.derivs);
group.m_userdata_layers.push_back (n.layer_num);
group.m_userdata_init_vals.push_back (n.data);
}
group.m_unknown_attributes_needed = rop.m_unknown_attributes_needed;
for (auto&& f : rop.m_attributes_needed) {
group.m_attributes_needed.push_back (f.name);
group.m_attribute_scopes.push_back (f.scope);
}
group.m_optimized = true;
spin_lock stat_lock (m_stat_mutex);
if (!need_jit) {
m_stat_opt_locking_time += locking_time;
m_stat_optimization_time += timer();
}
m_stat_opt_locking_time += rop.m_stat_opt_locking_time;
m_stat_opt_locking_time += locking_time + rop.m_stat_opt_locking_time;
m_stat_specialization_time += rop.m_stat_specialization_time;
}
BackendLLVM lljitter (*this, group, ctx);
lljitter.run ();
if (need_jit) {
BackendLLVM lljitter (*this, group, ctx);
lljitter.run ();
group_post_jit_cleanup (group);
// NOTE: it is now possible to optimize and not JIT
// which would leave the cleanup to happen
// when the ShadingSystem is destroyed
group_post_jit_cleanup (group);
group.m_jitted = true;
spin_lock stat_lock (m_stat_mutex);
m_stat_opt_locking_time += locking_time;
m_stat_optimization_time += timer();
m_stat_total_llvm_time += lljitter.m_stat_total_llvm_time;
m_stat_llvm_setup_time += lljitter.m_stat_llvm_setup_time;
m_stat_llvm_irgen_time += lljitter.m_stat_llvm_irgen_time;
m_stat_llvm_opt_time += lljitter.m_stat_llvm_opt_time;
m_stat_llvm_jit_time += lljitter.m_stat_llvm_jit_time;
m_stat_max_llvm_local_mem = std::max (m_stat_max_llvm_local_mem,
lljitter.m_llvm_local_mem);
}
if (ctx_allocated) {
release_context(ctx);
destroy_thread_info(thread_info);
}
group.m_optimized = true;
spin_lock stat_lock (m_stat_mutex);
m_stat_optimization_time += timer();
m_stat_opt_locking_time += locking_time + rop.m_stat_opt_locking_time;
m_stat_specialization_time += rop.m_stat_specialization_time;
m_stat_total_llvm_time += lljitter.m_stat_total_llvm_time;
m_stat_llvm_setup_time += lljitter.m_stat_llvm_setup_time;
m_stat_llvm_irgen_time += lljitter.m_stat_llvm_irgen_time;
m_stat_llvm_opt_time += lljitter.m_stat_llvm_opt_time;
m_stat_llvm_jit_time += lljitter.m_stat_llvm_jit_time;
m_stat_max_llvm_local_mem = std::max (m_stat_max_llvm_local_mem,
lljitter.m_llvm_local_mem);
m_stat_groups_compiled += 1;
m_stat_instances_compiled += group.nlayers();
m_groups_to_compile_count -= 1;
@@ -3026,15 +3119,15 @@ ShadingSystemImpl::optimize_group (ShaderGroup &group, ShadingContext *ctx)
static void optimize_all_groups_wrapper (ShadingSystemImpl *ss, int mythread, int totalthreads)
static void optimize_all_groups_wrapper (ShadingSystemImpl *ss, int mythread, int totalthreads, bool do_jit)
{
ss->optimize_all_groups (1, mythread, totalthreads);
ss->optimize_all_groups (1, mythread, totalthreads, do_jit);
}
void
ShadingSystemImpl::optimize_all_groups (int nthreads, int mythread, int totalthreads)
ShadingSystemImpl::optimize_all_groups (int nthreads, int mythread, int totalthreads, bool do_jit)
{
// Spawn a bunch of threads to do this in parallel -- just call this
// routine again (with threads=1) for each thread.
@@ -3047,7 +3140,7 @@ ShadingSystemImpl::optimize_all_groups (int nthreads, int mythread, int totalthr
OIIO::thread_group threads;
m_threads_currently_compiling += nthreads;
for (int t = 0; t < nthreads; ++t)
threads.add_thread (new std::thread (optimize_all_groups_wrapper, this, t, nthreads));
threads.add_thread (new std::thread (optimize_all_groups_wrapper, this, t, nthreads, do_jit));
threads.join_all ();
m_threads_currently_compiling -= nthreads;
return;
@@ -3070,7 +3163,7 @@ ShadingSystemImpl::optimize_all_groups (int nthreads, int mythread, int totalthr
group = m_all_shader_groups[i].lock();
}
if (group && group->m_complete)
optimize_group (*group, ctx);
optimize_group (*group, ctx, do_jit);
}
}
release_context(ctx);
@@ -3084,7 +3177,7 @@ ShadingSystemImpl::merge_instances (ShaderGroup &group, bool post_opt)
{
// Look through the shader group for pairs of nodes/layers that
// actually do exactly the same thing, and eliminate one of the
// rundantant shaders, carefully rewiring all its outgoing
// redundant shaders, carefully rewiring all its outgoing
// connections to later layers to refer to the one we keep.
//
// It turns out that in practice, it's not uncommon to have
@@ -3380,7 +3473,7 @@ ClosureRegistry::register_closure (string_view name, int id,
entry.params.push_back(params[i]);
if (params[i].type == TypeDesc()) {
entry.struct_size = params[i].offset;
/* CLOSURE_FINISH_PARAM stashes the real struct alignement here
/* CLOSURE_FINISH_PARAM stashes the real struct alignment here
* make sure that the closure struct doesn't want more alignment than ClosureComponent
* because we will be allocating the real struct inside it. */
OSL_ASSERT_MSG(params[i].field_size <= int(alignof(ClosureComponent)),
+1 -1
View File
@@ -265,7 +265,7 @@ slice_gabor_kernel_3d (const Dual2<float> &d, float w, float a,
phi = float(M_TWO_PI) * rng();
}
// gabor_cell was unnecesarily calling down to sample even when outside the radius
// gabor_cell was unnecessarily calling down to sample even when outside the radius
// however to match existing results, we need to bump the random number generator
// an equivalent # of times. Here the sample function stripped down to just
// the rng() calls
+4 -4
View File
@@ -16,7 +16,7 @@
// (presumably because the hash can be done faster than the table
// lookup)
// * Added 'seed' parameters to more easily generate 'vector' versions
// of the noise, where each component starts with a differen seed.
// of the noise, where each component starts with a different seed.
// * Change the gradN functions to return float* into the array, rather
// have a float* parameter for each dimension.
// * Simplify the function logic to have fewer assignments, faster.
@@ -282,7 +282,7 @@ OSL_HOSTDEVICE float simplexnoise2 (float x, float y, int seed,
// for the last two arguments
if (dnoise_dx) {
OSL_DASSERT(dnoise_dy);
/* A straight, unoptimised calculation would be like:
/* A straight, unoptimized calculation would be like:
* *dnoise_dx = -8.0f * t20 * t0 * x0 * ( g0[0] * x0 + g0[1] * y0 ) + t40 * g0[0];
* *dnoise_dy = -8.0f * t20 * t0 * y0 * ( g0[0] * x0 + g0[1] * y0 ) + t40 * g0[1];
* *dnoise_dx += -8.0f * t21 * t1 * x1 * ( g1[0] * x1 + g1[1] * y1 ) + t41 * g1[0];
@@ -451,7 +451,7 @@ simplexnoise3 (float x, float y, float z, int seed,
// for the last three arguments
if (dnoise_dx) {
OSL_DASSERT(dnoise_dy && dnoise_dz);
/* A straight, unoptimised calculation would be like:
/* A straight, unoptimized calculation would be like:
* *dnoise_dx = -8.0f * t20 * t0 * x0 * dot(g0[0], g0[1], g0[2], x0, y0, z0) + t40 * g0[0];
* *dnoise_dy = -8.0f * t20 * t0 * y0 * dot(g0[0], g0[1], g0[2], x0, y0, z0) + t40 * g0[1];
* *dnoise_dz = -8.0f * t20 * t0 * z0 * dot(g0[0], g0[1], g0[2], x0, y0, z0) + t40 * g0[2];
@@ -648,7 +648,7 @@ simplexnoise4 (float x, float y, float z, float w, int seed,
// for the last four arguments
if (dnoise_dx) {
OSL_DASSERT(dnoise_dy && dnoise_dz && dnoise_dw);
/* A straight, unoptimised calculation would be like:
/* A straight, unoptimized calculation would be like:
* *dnoise_dx = -8.0f * t20 * t0 * x0 * dot(g0[0], g0[1], g0[2], g0[3], x0, y0, z0, w0) + t40 * g0[0];
* *dnoise_dy = -8.0f * t20 * t0 * y0 * dot(g0[0], g0[1], g0[2], g0[3], x0, y0, z0, w0) + t40 * g0[1];
* *dnoise_dz = -8.0f * t20 * t0 * z0 * dot(g0[0], g0[1], g0[2], g0[3], x0, y0, z0, w0) + t40 * g0[2];
+1 -2
View File
@@ -41,8 +41,7 @@ install_targets (${local_lib})
# from pythonutils.cmake
find_python ()
if (USE_PYTHON)
if (USE_PYTHON AND Python_Development_FOUND)
checked_find_package (pybind11 2.4.2 REQUIRED)
file (GLOB python_srcs py_*.cpp)
+1 -1
View File
@@ -13,7 +13,7 @@
#
# The plugin name is deduced from the name of the current directory and the
# source is automatically linked against OpenImageIO. Additional libraries
# (for example, libpng) may be specified after the optionl LINK_LIBRARIES
# (for example, libpng) may be specified after the LINK_LIBRARIES
# keyword.
#
macro (add_oiio_plugin)
+3 -3
View File
@@ -46,7 +46,7 @@ static std::string oneparam;
// Print the default values for a paarameter built out of integers.
// Print the default values for a parameter built out of integers.
static void
print_default_string_vals(const OSLQuery::Parameter* p, bool verbose)
{
@@ -69,7 +69,7 @@ print_default_string_vals(const OSLQuery::Parameter* p, bool verbose)
// Print the default values for a paarameter built out of floats (including
// Print the default values for a parameter built out of floats (including
// color, point, etc., or arrays thereof).
static void
print_default_int_vals(const OSLQuery::Parameter* p, bool verbose)
@@ -95,7 +95,7 @@ print_default_int_vals(const OSLQuery::Parameter* p, bool verbose)
// Print the default values for a paarameter built out of strings.
// Print the default values for a parameter built out of strings.
static void
print_default_float_vals(const OSLQuery::Parameter* p, bool verbose)
{
+4 -4
View File
@@ -178,7 +178,7 @@ public:
setBackground(m_info, Qt::black, Qt::white);
// Hilight the edges against solid backgrounds
// Highlight the edges against solid backgrounds
m_image->setStyleSheet("border: 2px solid black");
// When mouse moves fast, it might get over the inspector.
@@ -202,7 +202,7 @@ class OSLToyRenderView : public QLabel {
float static mapPixel(float pos, float res) { return (pos / res); }
// Shold probably live in PixelInfo, but its here now
// Should probably live in PixelInfo, but its here now
bool getPixel(QPoint pos, PixelInfo& info)
{
if (!m_framebuffer.initialized())
@@ -233,7 +233,7 @@ class OSLToyRenderView : public QLabel {
{
if (!m_magnifier) {
// Create the magnifier in the top-most parent
// so no siblings will draw ontop
// so no siblings will draw on top
QWidget* parent = parentWidget();
QWidget* lastParent = nullptr;
do {
@@ -361,7 +361,7 @@ Magnifier::mouseMoveEvent(QMouseEvent* event)
// Qt Docs help:
// -------------
// Qt turorials: http://doc.qt.io/qt-5/qtexamplesandtutorials.html
// Qt tutorials: http://doc.qt.io/qt-5/qtexamplesandtutorials.html
// Qt code example for an image viewer:
// http://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-example.html
// Qt code example for a code text editor with line numbers:
+2 -2
View File
@@ -398,7 +398,7 @@ OSLToyRenderer::get_camera_fov(ShaderGlobals* /*sg*/, bool derivs,
ustring /*object*/, TypeDesc type,
ustring /*name*/, void* val)
{
// N.B. in a real rederer, this may be time-dependent
// N.B. in a real renderer, this may be time-dependent
if (type == TypeDesc::TypeFloat) {
((float*)val)[0] = m_fov;
if (derivs)
@@ -522,7 +522,7 @@ OSLToyRenderer::get_camera_screen_window(ShaderGlobals* /*sg*/, bool derivs,
ustring /*object*/, TypeDesc type,
ustring /*name*/, void* val)
{
// N.B. in a real rederer, this may be time-dependent
// N.B. in a real renderer, this may be time-dependent
if (type == TypeFloatArray4) {
((float*)val)[0] = m_screen_window[0];
((float*)val)[1] = m_screen_window[1];
+1 -1
View File
@@ -123,7 +123,7 @@ enum RayType {
};
// Closures supported by the OSL sample renderer. This list is mosly aspirational.
// Closures supported by the OSL sample renderer. This list is mostly aspirational.
enum ClosureIDs {
EMISSION_ID = 1,
BACKGROUND_ID,
+1 -1
View File
@@ -95,7 +95,7 @@ RT_PROGRAM void intersect (void)
shading_normal = geometric_normal = N;
surface_area = a;
// Calcuate the texture coordinates and derivatives
// Calculate the texture coordinates and derivatives
calc_uv();
rtReportIntersection(0);
+2 -2
View File
@@ -97,7 +97,7 @@ float3 process_closure(const OSL::ClosureColor* closure_tree)
const OSL::ClosureColor* ptr_stack[STACK_SIZE];
OSL::Color3 weight_stack[STACK_SIZE];
// Shading accumlator
// Shading accumulator
OSL::Color3 weight = OSL::Color3(1.0f);
const void* cur = closure_tree;
@@ -277,7 +277,7 @@ float3 process_closure (const OSL::ClosureColor* closure_tree)
const OSL::ClosureColor* ptr_stack[STACK_SIZE];
OSL::Color3 weight_stack[STACK_SIZE];
// Shading accumlator
// Shading accumulator
OSL::Color3 weight = OSL::Color3 (1.0f);
const void* cur = closure_tree;
+1 -1
View File
@@ -60,7 +60,7 @@ private:
int getOffset (const std::string& str) const;
// Free the previous allocation, allocate a new block of GPU memory of twice
// the size, copy the string contents into the new allocation, and upate the
// the size, copy the string contents into the new allocation, and update the
// OptiX variables that hold the string addresses.
void reallocTable();
+31 -5
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/imageworks/OpenShadingLanguage
#include <vector>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/sysutil.h>
@@ -14,6 +15,7 @@
#ifdef OSL_USE_OPTIX
# if (OPTIX_VERSION >= 70000)
# include <optix_function_table_definition.h>
# include <optix_stack_size.h>
# include <optix_stubs.h>
# include <cuda.h>
# include <nvrtc.h>
@@ -299,7 +301,7 @@ OptixRaytracer::synch_attributes ()
return false;
}
// set the elemet size to char
// set the element size to char
buffer->setElementSize(sizeof(char));
// and number of elements to the actual size needed.
@@ -527,20 +529,18 @@ OptixRaytracer::make_optix_materials ()
size_t sizeof_msg_log;
// Make module that contains programs we'll use in this scene
OptixModuleCompileOptions module_compile_options;
OptixModuleCompileOptions module_compile_options = {};
module_compile_options.maxRegisterCount = OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT;
module_compile_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_DEFAULT;
module_compile_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
module_compile_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
module_compile_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
OptixPipelineCompileOptions pipeline_compile_options = {};
pipeline_compile_options.traversableGraphFlags = OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY;
pipeline_compile_options.usesMotionBlur = false;
pipeline_compile_options.numPayloadValues = 3;
pipeline_compile_options.numAttributeValues = 3;
pipeline_compile_options.numAttributeValues = 3;
pipeline_compile_options.exceptionFlags = OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW;
pipeline_compile_options.pipelineLaunchParamsVariableName = "render_params";
@@ -865,6 +865,32 @@ OptixRaytracer::make_optix_materials ()
//if (sizeof_msg_log > 1)
// printf ("Creating optix pipeline:\n%s\n", msg_log);
// Set the pipeline stack size
OptixStackSizes stack_sizes = {};
for( OptixProgramGroup& program_group : final_groups )
OPTIX_CHECK (optixUtilAccumulateStackSizes (program_group, &stack_sizes));
uint32_t max_trace_depth = 1;
uint32_t max_cc_depth = 1;
uint32_t max_dc_depth = 1;
uint32_t direct_callable_stack_size_from_traversal;
uint32_t direct_callable_stack_size_from_state;
uint32_t continuation_stack_size;
OPTIX_CHECK (optixUtilComputeStackSizes (&stack_sizes,
max_trace_depth,
max_cc_depth,
max_dc_depth,
&direct_callable_stack_size_from_traversal,
&direct_callable_stack_size_from_state,
&continuation_stack_size ) );
const uint32_t max_traversal_depth = 1;
OPTIX_CHECK (optixPipelineSetStackSize (m_optix_pipeline,
direct_callable_stack_size_from_traversal,
direct_callable_stack_size_from_state,
continuation_stack_size,
max_traversal_depth ));
// Build OptiX Shader Binding Table (SBT)
std::vector<GenericRecord> sbt_records(final_groups.size());
+1 -1
View File
@@ -87,7 +87,7 @@ struct Camera {
finalize();
}
// Compute all derived values based on camera parametrs.
// Compute all derived values based on camera parameters.
void finalize () {
float k = OIIO::fast_tan(fov * float(M_PI / 360));
Vec3 right = dir.cross(up).normalize();
+1 -1
View File
@@ -251,7 +251,7 @@ struct Ward : public BSDF, WardParams {
float cosTheta = 1 / sqrtf(1 + tanTheta2);
float sinTheta = cosTheta * sqrtf(tanTheta2);
Vec3 h; // already normalized becaused expressed from spherical coordinates
Vec3 h; // already normalized because expressed from spherical coordinates
h.x = sinTheta * cosPhi;
h.y = sinTheta * sinPhi;
h.z = cosTheta;
+2 -2
View File
@@ -579,7 +579,7 @@ bool
SimpleRaytracer::get_camera_fov (ShaderGlobals* /*sg*/, bool derivs, ustring /*object*/,
TypeDesc type, ustring /*name*/, void *val)
{
// N.B. in a real rederer, this may be time-dependent
// N.B. in a real renderer, this may be time-dependent
if (type == TypeDesc::TypeFloat) {
((float *)val)[0] = m_fov;
if (derivs)
@@ -695,7 +695,7 @@ bool
SimpleRaytracer::get_camera_screen_window (ShaderGlobals* /*sg*/, bool derivs, ustring /*object*/,
TypeDesc type, ustring /*name*/, void *val)
{
// N.B. in a real rederer, this may be time-dependent
// N.B. in a real renderer, this may be time-dependent
if (type == TypeFloatArray4) {
((float *)val)[0] = m_screen_window[0];
((float *)val)[1] = m_screen_window[1];
+34 -7
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/imageworks/OpenShadingLanguage
#include <vector>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/sysutil.h>
@@ -14,6 +15,7 @@
#ifdef OSL_USE_OPTIX
# if (OPTIX_VERSION >= 70000)
# include <optix_function_table_definition.h>
# include <optix_stack_size.h>
# include <optix_stubs.h>
# include <cuda.h>
# include <nvrtc.h>
@@ -280,7 +282,7 @@ OptixGridRenderer::synch_attributes ()
return false;
}
// set the elemet size to char
// set the element size to char
buffer->setElementSize(sizeof(char));
// and number of elements to the actual size needed.
@@ -440,12 +442,11 @@ OptixGridRenderer::make_optix_materials ()
size_t sizeof_msg_log;
// Make module that contains programs we'll use in this scene
OptixModuleCompileOptions module_compile_options;
OptixModuleCompileOptions module_compile_options = {};
module_compile_options.maxRegisterCount = OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT;
module_compile_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_DEFAULT;
module_compile_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
module_compile_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
module_compile_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
OptixPipelineCompileOptions pipeline_compile_options = {};
@@ -738,7 +739,7 @@ OptixGridRenderer::make_optix_materials ()
// printf ("Creating program group for string-library:\n%s\n", msg_log);
// Set up OptiX pipeline
OptixProgramGroup final_groups[] = {
std::vector<OptixProgramGroup> final_groups = {
strlib_group, // string globals
raygen_group,
miss_group,
@@ -751,13 +752,39 @@ OptixGridRenderer::make_optix_materials ()
OPTIX_CHECK (optixPipelineCreate (m_optix_ctx,
&pipeline_compile_options,
&pipeline_link_options,
&final_groups[0],
int(sizeof(final_groups)/sizeof(OptixProgramGroup)),
final_groups.data(),
int(final_groups.size()),
msg_log, &sizeof_msg_log,
&m_optix_pipeline));
//if (sizeof_msg_log > 1)
// printf ("Creating optix pipeline:\n%s\n", msg_log);
// Set the pipeline stack size
OptixStackSizes stack_sizes = {};
for( OptixProgramGroup& program_group : final_groups )
OPTIX_CHECK (optixUtilAccumulateStackSizes (program_group, &stack_sizes));
uint32_t max_trace_depth = 1;
uint32_t max_cc_depth = 1;
uint32_t max_dc_depth = 1;
uint32_t direct_callable_stack_size_from_traversal;
uint32_t direct_callable_stack_size_from_state;
uint32_t continuation_stack_size;
OPTIX_CHECK (optixUtilComputeStackSizes (&stack_sizes,
max_trace_depth,
max_cc_depth,
max_dc_depth,
&direct_callable_stack_size_from_traversal,
&direct_callable_stack_size_from_state,
&continuation_stack_size ) );
const uint32_t max_traversal_depth = 1;
OPTIX_CHECK (optixPipelineSetStackSize (m_optix_pipeline,
direct_callable_stack_size_from_traversal,
direct_callable_stack_size_from_state,
continuation_stack_size,
max_traversal_depth ));
// Build OptiX Shader Binding Table (SBT)
CUdeviceptr d_raygenRecord;
CUdeviceptr d_missRecord;
+2 -2
View File
@@ -440,7 +440,7 @@ bool
SimpleRenderer::get_camera_fov (ShaderGlobals* /*sg*/, bool derivs, ustring /*object*/,
TypeDesc type, ustring /*name*/, void *val)
{
// N.B. in a real rederer, this may be time-dependent
// N.B. in a real renderer, this may be time-dependent
if (type == TypeDesc::TypeFloat) {
((float *)val)[0] = m_fov;
if (derivs)
@@ -556,7 +556,7 @@ bool
SimpleRenderer::get_camera_screen_window (ShaderGlobals* /*sg*/, bool derivs, ustring /*object*/,
TypeDesc type, ustring /*name*/, void *val)
{
// N.B. in a real rederer, this may be time-dependent
// N.B. in a real renderer, this may be time-dependent
if (type == TypeFloatArray4) {
((float *)val)[0] = m_screen_window[0];
((float *)val)[1] = m_screen_window[1];
+61 -6
View File
@@ -53,6 +53,9 @@ static bool debug2 = false;
static bool llvm_debug = false;
static bool verbose = false;
static bool runstats = false;
static bool vary_Pdxdy = false;
static bool vary_udxdy = false;
static bool vary_vdxdy = false;
static bool saveptx = false;
static bool warmup = false;
static bool profile = false;
@@ -428,6 +431,29 @@ stash_shader_arg (int argc, const char* argv[])
void
print_info()
{
ErrorHandler errhandler;
SimpleRenderer* rend = nullptr;
#ifdef OSL_USE_OPTIX
if (use_optix)
rend = new OptixGridRenderer;
else
#endif
rend = new SimpleRenderer;
TextureSystem *texturesys = TextureSystem::create();
shadingsys = new ShadingSystem(rend, texturesys, &errhandler);
rend->init_shadingsys(shadingsys);
std::cout << "\n" << shadingsys->getstats (5) << "\n";
delete shadingsys;
delete rend;
}
static void
getargs (int argc, const char *argv[])
{
@@ -452,6 +478,9 @@ getargs (int argc, const char *argv[])
"--llvm_debug", &llvm_debug, "Turn on LLVM debugging info",
"--runstats", &runstats, "Print run statistics",
"--stats", &runstats, "", // DEPRECATED 1.7
"--vary_pdxdy", &vary_Pdxdy, "populate Dx(P) & Dy(P) with varying values (vs. uniform)",
"--vary_udxdy", &vary_udxdy, "populate Dx(u) & Dy(u) with varying values (vs. uniform)",
"--vary_vdxdy", &vary_vdxdy, "populate Dx(v) & Dy(v) with varying values (vs. uniform)",
"--profile", &profile, "Print profile information",
"--saveptx", &saveptx, "Save the generated PTX (OptiX mode only)",
"--warmup", &warmup, "Perform a warmup launch",
@@ -514,6 +543,7 @@ getargs (int argc, const char *argv[])
std::cout << "testshade -- Test Open Shading Language\n"
OSL_COPYRIGHT_STRING "\n";
ap.usage ();
print_info();
exit (EXIT_SUCCESS);
}
}
@@ -619,23 +649,48 @@ setup_shaderglobals (ShaderGlobals &sg, ShadingSystem *shadingsys,
// centers of each pixel.
sg.u = uscale * (float)(x+0.5f) / xres + uoffset;
sg.v = vscale * (float)(y+0.5f) / yres + voffset;
sg.dudx = uscale / xres;
sg.dvdy = vscale / yres;
if (vary_udxdy) {
sg.dudx = 1.0f - sg.u;
sg.dudy = sg.u;
} else {
sg.dudx = uscale / xres;
}
if (vary_vdxdy) {
sg.dvdx = 1.0f - sg.v;
sg.dvdy = sg.v;
} else {
sg.dvdy = vscale / yres;
}
} else {
// Our patch is like a Reyes grid of points, with the border
// samples being exactly on u,v == 0 or 1.
sg.u = uscale * ((xres == 1) ? 0.5f : (float) x / (xres - 1)) + uoffset;
sg.v = vscale * ((yres == 1) ? 0.5f : (float) y / (yres - 1)) + voffset;
sg.dudx = uscale / std::max (1, xres-1);
sg.dvdy = vscale / std::max (1, yres-1);
if (vary_udxdy) {
sg.dudx = 1.0f - sg.u;
sg.dudy = sg.u;
} else {
sg.dudx = uscale / std::max (1, xres-1);
}
if (vary_vdxdy) {
sg.dvdx = 1.0f - sg.v;
sg.dvdy = sg.v;
} else {
sg.dvdy = vscale / std::max (1, yres-1);
}
}
// Assume that position P is simply (u,v,1), that makes the patch lie
// on [0,1] at z=1.
sg.P = Vec3 (sg.u, sg.v, 1.0f);
// Derivatives with respect to x,y
sg.dPdx = Vec3 (sg.dudx, sg.dudy, 0.0f);
sg.dPdy = Vec3 (sg.dvdx, sg.dvdy, 0.0f);
if (vary_Pdxdy) {
sg.dPdx = Vec3 (1.0f - sg.u, 1.0f - sg.v, sg.u*0.5);
sg.dPdy = Vec3 (1.0f - sg.v, 1.0f - sg.u, sg.v*0.5);
} else {
sg.dPdx = Vec3 (uscale / std::max (1, xres-1), 0.0f, 0.0f);
sg.dPdy = Vec3 (0.0f, vscale / std::max (1, yres-1), 0.0f);
}
sg.dPdz = Vec3 (0.0f, 0.0f, 0.0f); // just use 0 for volume tangent
// Tangents of P with respect to surface u,v
sg.dPdu = Vec3 (1.0f, 0.0f, 0.0f);
Binary file not shown.
@@ -0,0 +1,3 @@
Compiled test.osl -> test.oso
Output Cout to out.tif
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/imageworks/OpenShadingLanguage
# Set up a texture that is a gradient image with a distinct alpha gradient
# of 0.5 from left to right and 0.25 right to left, and no change in value
# for R,G,B.
command += oiiotool("-pattern fill:topleft=0.125,0.25,0.5,0:topright=0.125,0.25,0.5,0.5:bottomleft=0.125,0.25,0.5,0.25:bottomright=0.125,0.25,0.5,0.75 64x64 4 -d half -o alpharamp.exr")
command += testshade("-g 64 64 --center -od uint8 -o Cout out.tif test")
outputs = [ "out.txt", "out.tif" ]
+14
View File
@@ -0,0 +1,14 @@
// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/imageworks/OpenShadingLanguage
shader
test (string filename = "alpharamp.exr",
output color Cout = 0)
{
// This tests whether needing derivs of only the alpha channel
// works properly.
float a;
color C = texture (filename, u, v, "alpha", a, "wrap", "clamp");
Cout = color (a, Dx(a)/Dx(u), Dy(a)/Dy(v));
}