Compare commits
85
Commits
main
...
Release-1.9.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63d1e4e2e1 | ||
|
|
51092ded43 | ||
|
|
2ace988c8d | ||
|
|
8b8069ca90 | ||
|
|
d85c0f152e | ||
|
|
b775e752eb | ||
|
|
01bce8a720 | ||
|
|
32f0f6d75a | ||
|
|
4918894101 | ||
|
|
41a5dd85e0 | ||
|
|
d514eebfd5 | ||
|
|
6a1e822584 | ||
|
|
e341a9afaa | ||
|
|
ab76acd2f1 | ||
|
|
8561ce003d | ||
|
|
4d9bdbaaa6 | ||
|
|
d4aca83ed3 | ||
|
|
c1321674ca | ||
|
|
b66510ae91 | ||
|
|
79da1d62ec | ||
|
|
735e590f2c | ||
|
|
4e720f40a4 | ||
|
|
63a104ae68 | ||
|
|
c7a87ee34e | ||
|
|
d963157dcd | ||
|
|
7cf81fffd7 | ||
|
|
bded0f2ac3 | ||
|
|
8a808524d7 | ||
|
|
4a4a5b3cec | ||
|
|
dc988aa2d5 | ||
|
|
0ebd0c0623 | ||
|
|
829df136cc | ||
|
|
da9456eb44 | ||
|
|
0463a766ff | ||
|
|
ea9ea71932 | ||
|
|
029f592319 | ||
|
|
bd573b7417 | ||
|
|
8c2d2e053c | ||
|
|
35f19f7c03 | ||
|
|
231e707529 | ||
|
|
e6ada16003 | ||
|
|
a39a6e75d4 | ||
|
|
9697ed82ad | ||
|
|
df03f84a60 | ||
|
|
65ec2c70e8 | ||
|
|
b16a1228d1 | ||
|
|
a58ef622d2 | ||
|
|
f5f5393d12 | ||
|
|
92a219d7a9 | ||
|
|
3931f2e210 | ||
|
|
0f6c2fa588 | ||
|
|
be665fed1a | ||
|
|
dd01e1627f | ||
|
|
9c37c2014e | ||
|
|
9df4e9c6cc | ||
|
|
f3484a2948 | ||
|
|
0601c3bc28 | ||
|
|
da2864bd28 | ||
|
|
f82cdc4966 | ||
|
|
008d3d5dbd | ||
|
|
33de97ae5a | ||
|
|
52c98f6013 | ||
|
|
00d5cee81d | ||
|
|
25139ed449 | ||
|
|
81846bf206 | ||
|
|
92b2792374 | ||
|
|
7e076044e6 | ||
|
|
b55a4a99ac | ||
|
|
5e73ceba51 | ||
|
|
a895948a1a | ||
|
|
cf7726e5d8 | ||
|
|
2a40110a8a | ||
|
|
ab131823bd | ||
|
|
085407889c | ||
|
|
895548e8ae | ||
|
|
c6c2750e13 | ||
|
|
8ae78d351b | ||
|
|
c8440a868a | ||
|
|
38fcf31f64 | ||
|
|
6e35abd0fd | ||
|
|
e52c08e85a | ||
|
|
db5e728a50 | ||
|
|
4eca768c69 | ||
|
|
78ecf4a9fe | ||
|
|
b6b2cc7f8f |
+166
-35
@@ -7,21 +7,24 @@ dist: trusty
|
||||
|
||||
|
||||
# Add-ons: specify apt packages for Linux
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- boost-latest
|
||||
- ubuntu-toolchain-r-test
|
||||
- george-edison55-precise-backports
|
||||
packages:
|
||||
- cmake
|
||||
- cmake-data
|
||||
- g++-4.8
|
||||
- g++-5
|
||||
- g++-6
|
||||
- g++-7
|
||||
- libboost1.55-all-dev
|
||||
- libtiff4-dev
|
||||
# Currently, we do this per-matrix-entry so it can be finely customized
|
||||
# so that each entry only get the packages it needs.
|
||||
#addons:
|
||||
# apt:
|
||||
# sources:
|
||||
# - boost-latest
|
||||
# - ubuntu-toolchain-r-test
|
||||
# - george-edison55-precise-backports
|
||||
# packages:
|
||||
# - g++-4.8
|
||||
# - g++-6
|
||||
# - g++-7
|
||||
# - libboost-filesystem1.55
|
||||
# - libboost-python1.55
|
||||
# - libboost-regex1.55
|
||||
# - libboost-system1.55
|
||||
# - libboost-thread1.55
|
||||
# - libboost-wave1.55
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
@@ -57,12 +60,16 @@ install:
|
||||
CXX="ccache $CXX" CCACHE_CPP2=1 src/build-scripts/build_openexr.bash ;
|
||||
export ILMBASE_HOME=$PWD/openexr-install ;
|
||||
export OPENEXR_HOME=$PWD/openexr-install ;
|
||||
if [ "$LLVM_VERSION" == "" ]; then export LLVM_VERSION="3.9.0" ; fi ;
|
||||
wget http://releases.llvm.org/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz ;
|
||||
tar xf clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz ;
|
||||
rm -f clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz ;
|
||||
if [ "$LLVM_VERSION" == "" ]; then export LLVM_VERSION="error3.9.0" ; fi ;
|
||||
if [ "$LLVM_VERSION" == "5.0.0" ]; then export LLVMTAR=clang+llvm-${LLVM_VERSION}-linux-x86_64-ubuntu14.04.tar.xz ; else export LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz ; fi;
|
||||
echo LLVMTAR = $LLVMTAR ;
|
||||
wget http://releases.llvm.org/${LLVM_VERSION}/${LLVMTAR} ;
|
||||
tar xf $LLVMTAR ;
|
||||
rm -f $LLVMTAR ;
|
||||
echo "Installed ${LLVM_VERSION}" ;
|
||||
mv clang+llvm* llvm-install ;
|
||||
export LLVM_DIRECTORY=$PWD/llvm-install ;
|
||||
ls -a $LLVM_DIRECTORY ;
|
||||
fi
|
||||
- export OIIOMAKEFLAGS="$OIIOMAKEFLAGS -j2 DEBUG= USE_PYTHON=0 OIIO_BUILD_TESTS=0"
|
||||
- export OPENIMAGEIO_SITE=travis
|
||||
@@ -105,40 +112,164 @@ branches:
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
# Build with C++11, default compiler, optimized build, against OIIO master
|
||||
# Build with C++11, default compiler, optimized build, against the
|
||||
# latest OIIO master.
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-regex1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: LLVM_VERSION=3.9.0
|
||||
- os: osx
|
||||
compiler: clang
|
||||
# Test against the older release branch of OIIO (all the other tests
|
||||
# are against OIIO master).
|
||||
# are against OIIO master). Test against a higher SSE level.
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: OIIOBRANCH=release
|
||||
# Test gcc 5, also against higher SSE level
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-regex1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: USE_SIMD=sse4.2 OIIOBRANCH=RB-1.8 LLVM_VERSION=3.9.0
|
||||
# Test gcc6, and highest SIMD level supported by Travis, and LLVM 4
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: WHICHGCC=5 USE_SIMD=sse4.2
|
||||
# Test gcc6, and highest SIMD level supported by Travis.
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- g++-6
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: WHICHGCC=6 USE_SIMD=avx,f16c OIIOBRANCH=RB-1.9 LLVM_VERSION=4.0.0
|
||||
# Linux only: test gcc 7, also test C++14 and LLVM 5.0
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: WHICHGCC=6 USE_SIMD=avx,f16c
|
||||
# Linux only: test gcc 7, also test C++14
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- g++-7
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: WHICHGCC=7 USE_CPP=14 OIIOBRANCH=release LLVM_VERSION=5.0.1
|
||||
# Linux only: test gcc 7, also test C++14 and LLVM 6.0
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: WHICHGCC=7 USE_CPP=14
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- g++-7
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: WHICHGCC=7 USE_CPP=14 OIIOBRANCH=master LLVM_VERSION=6.0.1
|
||||
# Linux only: test gcc 7, also test C++14 and newer LLVM (7.0)
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- g++-7
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: WHICHGCC=7 USE_CPP=14 OIIOBRANCH=release LLVM_VERSION=7.0.0
|
||||
# Linux only: test gcc 8, also test C++14 and newer LLVM (7.0)
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- g++-8
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: WHICHGCC=8 USE_CPP=14 OIIOBRANCH=master LLVM_VERSION=7.0.0
|
||||
# Build with C++11, DEBUG build, against OIIO master
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: DEBUG=1
|
||||
# Test against older LLVM
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-regex1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: DEBUG=1 LLVM_VERSION=3.9.0
|
||||
# One more, just for the heck of it, turn all SIMD off, and also test
|
||||
# against the oldest LLVM we still support and the oldest OIIO.
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: LLVM_VERSION=3.5.2
|
||||
# One more, just for the heck of it, turn all SIMD off.
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: USE_SIMD=0
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- boost-latest
|
||||
packages:
|
||||
- libboost1.55-dev
|
||||
- libboost-filesystem1.55
|
||||
- libboost-python1.55
|
||||
- libboost-regex1.55
|
||||
- libboost-system1.55
|
||||
- libboost-thread1.55
|
||||
- libboost-wave1.55
|
||||
env: USE_SIMD=0 LLVM_VERSION=3.5.2 OIIOBRANCH=RB-1.7
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
||||
+103
-9
@@ -1,11 +1,80 @@
|
||||
Release 1.9 -- ?? 2017 (compared to 1.8)
|
||||
Release 1.9.13 -- 1 Dec? 2018 (compared to 1.9.12)
|
||||
------------------------------------------------
|
||||
* Fix crash with texture3d lookups with derivatives. #932
|
||||
* Fix oslc crash when a struct parameter is initialized with a function call
|
||||
that returns a structure. #934
|
||||
|
||||
Release 1.9.12 -- 1 Nov 2018 (compared to 1.9.11)
|
||||
------------------------------------------------
|
||||
* Fix oslc read/write error for regex_search/regex_match #922
|
||||
* Make oso reading more robust to certain broken inputs. #923
|
||||
* Internals: make safe for some changes coming to ustring API in OIIO
|
||||
master. #929
|
||||
* Several docs fixes.
|
||||
|
||||
Release 1.9.11 -- 1 Oct 2018 (compared to 1.9.10)
|
||||
------------------------------------------------
|
||||
* Full support for using LLVM 6.0 and 7.0. #913, #919
|
||||
* Support for building with gcc 8. #921
|
||||
* Fix testrender bug with undefined order of operations (only was a problem
|
||||
with gcc5 and clang7). #916
|
||||
|
||||
Release 1.9.10 -- 1 Sep 2018 (compared to 1.9.9)
|
||||
------------------------------------------------
|
||||
* Fix Windows compile of the flex/bison compiler components. #891
|
||||
* Fix for compatibility with OIIO 1.9.
|
||||
* Fix incorrect array length on unbounded arrays specified by relaxed
|
||||
parameter type checking. #900
|
||||
* Speed up oslc parsing of long constant initializer lists. #901
|
||||
* 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,
|
||||
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
|
||||
weighting. Extend add/sub/muldiv to include matrices. #903, #904, #905
|
||||
|
||||
Release 1.9.9 -- 1 May 2018 (compared to 1.9.8)
|
||||
-----------------------------------------------
|
||||
* New SS attribute "error_repeats", if set to non-zero, turns off the
|
||||
suppression of multiple identical errors and warnings. Setting it (even to
|
||||
its existing value) also clears the "already seen" lists. #880
|
||||
(1.8.14/1.9.9)
|
||||
* Update to fix with some changes in OpenImageIO 1.9. #882
|
||||
|
||||
Release 1.9.8 -- 1 Apr 2018 (compared to 1.9.7)
|
||||
-----------------------------------------------
|
||||
* Build the version into the shared library .so names. #876 (1.8.13/1.9.8)
|
||||
|
||||
Release 1.9.7 -- 1 Feb 2018 (compared to 1.9.6)
|
||||
-----------------------------------------------
|
||||
* oslc fix to properly handle command line arguments if the shader file is
|
||||
not the last argument on the command line. #841
|
||||
* oslc: when using boost.wave for preprocessing, fix whitespace insertion
|
||||
#840 and windows path separators #849.
|
||||
* oslc: Fix bug/undefined behavior when trying to format/printf a struct.
|
||||
#849
|
||||
* liboslnoise: Fix symbol export/hiding. #849
|
||||
* Misc build issue cleanup on Windows. #849
|
||||
* For release branches, we no longer have builds consider every compiler
|
||||
warning to be an error (except in master or for CI builds).
|
||||
|
||||
Release 1.9.6 -- 1 Jan 2018 (compared to 1.9.5)
|
||||
-----------------------------------------------
|
||||
* Fix oslc crash with invalid field selection syntax. #835
|
||||
* Certain texture calls were inadvertently not passing in thread data,
|
||||
forcing the texture system to look it up again redundantly. #829
|
||||
|
||||
|
||||
Release 1.9 -- 4 December 2017 (compared to 1.8)
|
||||
--------------------------------------------------
|
||||
|
||||
Dependency and standards changes:
|
||||
* **C++11 required**: OSL 1.9 requires a minimum standard of C++11. It
|
||||
should also build against C++14 and C++17.
|
||||
* **LLVM 3.5 / 3.9 / 4.0 / 5.0**: Support has been added for LLVM 3.9, 4.0, and
|
||||
5.0. Support has been removed for for LLVM 3.4.
|
||||
* **LLVM 3.5 / 3.9 / 4.0 / 5.0**: Support has been added for LLVM 3.9, 4.0,
|
||||
and 5.0. Support has been removed for for LLVM 3.4.
|
||||
* **OpenImageIO 1.7+**: This release of OSL should build properly against
|
||||
OIIO 1.7 or newer. You may find that 1.6 is still ok, but we are not doing
|
||||
any work to ensure that.
|
||||
@@ -18,10 +87,10 @@ Language features:
|
||||
OSL_VERSION_PATCH, and OSL_VERSION (e.g. 10900 for 1.9.0) reveal the
|
||||
OSL release at shader compile time. #747 (1.9.0)
|
||||
* Structure constructors: If you have a struct `S` comprising fields with
|
||||
types T1, T2, ..., you may now have an expression `S(T1 v2,T2 v2,...)` that
|
||||
constructs and returns an `S` with those field values, much in the same
|
||||
way that you can say `color(a,b,c)` to construct a color out of components
|
||||
a, b, c. #751 (1.9.0)
|
||||
types T1, T2, ..., you may now have an expression `S(T1 v2, T2 v2,...)`
|
||||
that constructs and returns an `S` with those field values, much in the
|
||||
same way that you can say `color(a,b,c)` to construct a color out of
|
||||
components a, b, c. #751 (1.9.0)
|
||||
* User-defined operator overloading: If you make a new (struct) type, it
|
||||
is possible to define overloaded operators, like this:
|
||||
|
||||
@@ -99,8 +168,8 @@ API changes, new options, new ShadingSystem features (for renderer writers):
|
||||
parameters expecting a float-aggregate or array thereof, and an `int`
|
||||
may be passed to a parameter expecting a `float`, and an `int[1]` may
|
||||
be passed to an `int` parameter. #794,#797 (1.9.1)
|
||||
* Shader group attribute additions/changes:
|
||||
* RendererServices:
|
||||
* Fixed `ClosureComponent` to work with SSE alignment requirements. #810
|
||||
(1.9.3)
|
||||
|
||||
Performance improvements:
|
||||
* Shader JIT time is improved by about 10% as a result of pre-declaring
|
||||
@@ -163,6 +232,15 @@ Bug fixes and other improvements (internals):
|
||||
the `'.'` (dot) character as decimal separator in floating point number,
|
||||
even when running on a computer system configured to use a foreign locale
|
||||
where the comma is traditionally used as the decimal separator. #795 (1.9.1)
|
||||
* Fix param analysis bug for texture or pointcloud functions with optional
|
||||
token/value parameters where the token name wasn't a string literal -- it
|
||||
could fail to recognize that certain parameters would be written to by the
|
||||
call. #812 (1.9.3)
|
||||
* ShadingSystem statistics are now printed if any shaders were
|
||||
declared/loaded, even if no shaders were executed. #815 (1.9.3)
|
||||
* Minor OSLQuery implementation improvements: add move/copy constructors
|
||||
for OSLQuery::Parameter, make the ShadingSystem side of OSLQuery correctly
|
||||
report default parameter values. #821 (1.9.4)
|
||||
|
||||
Build & test system improvements:
|
||||
* C++11 is the new language baseline. #704, #707
|
||||
@@ -220,6 +298,11 @@ Build & test system improvements:
|
||||
#788 (1.9.1)
|
||||
* Improved proper rebuilding of the LLVM bitcode for llvm_ops.cpp when only
|
||||
certain headers change. #802 (1.9.1)
|
||||
* Fix gcc7 warnings about signed vs unsigned compares. #807 (1.9.2)
|
||||
* Simplify the build logic for finding PugiXML and prefer a system install
|
||||
when found, rather than looking to OIIO to supply it. #809 (1.9.2)
|
||||
* MSVS 2015 x64 compilation fixes. #820 (1.9.4)
|
||||
* Fix debug compile against OIIO 1.7. #822 (1.9.4)
|
||||
|
||||
Developer goodies:
|
||||
* The `dual.h` implementation has been completely overhauled. The primary
|
||||
@@ -237,6 +320,17 @@ Documentation:
|
||||
* Full testshade docs in `doc/testshade.md.html` (1.9.0)
|
||||
|
||||
|
||||
Release 1.8.14 -- 1 May 2018 (compared to 1.8.13)
|
||||
--------------------------------------------------
|
||||
* New SS attribute "error_repeats", if set to non-zero, turns off the
|
||||
suppression of multiple identical errors and warnings. Setting it (even to
|
||||
its existing value) also clears the "already seen" lists. #880
|
||||
* Update to fix with some changes in OpenImageIO 1.9. #882
|
||||
|
||||
Release 1.8.13 -- 1 Apr 2018 (compared to 1.8.12)
|
||||
--------------------------------------------------
|
||||
* Build the version into the shared library .so names. #876
|
||||
|
||||
Release 1.8.12 -- 1 Nov 2017 (compared to 1.8.11)
|
||||
--------------------------------------------------
|
||||
* Improve type checking error messages with structs. #761
|
||||
|
||||
+7
-6
@@ -1,13 +1,13 @@
|
||||
cmake_minimum_required (VERSION 3.2.2)
|
||||
cmake_policy (SET CMP0048 NEW) # Allow VERSION specifier in project()
|
||||
project (OSL
|
||||
VERSION 1.9.1
|
||||
VERSION 1.9.13
|
||||
LANGUAGES CXX C)
|
||||
set (PROJ_NAME ${PROJECT_NAME}) # short name
|
||||
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower 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_COPYRIGHTYEARS "2008-2017")
|
||||
set (PROJECT_COPYRIGHTYEARS "2008-2018")
|
||||
set (PROJECT_AUTHORS "Sony Pictures Imageworks, et al")
|
||||
set (PROJECT_URL "")
|
||||
|
||||
@@ -81,6 +81,8 @@ endif()
|
||||
|
||||
option (VERBOSE "Print lots of messages while compiling" OFF)
|
||||
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING "Customized outer namespace base name (version will be added)")
|
||||
set (SOVERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}
|
||||
CACHE STRING "Set the SO version in the SO name of the output library")
|
||||
option (OSL_BUILD_TESTS "Build the unit tests, testshade, testrender" ON)
|
||||
if (WIN32)
|
||||
option (USE_LLVM_BITCODE "Generate embedded LLVM bitcode" OFF)
|
||||
@@ -89,7 +91,6 @@ else ()
|
||||
endif ()
|
||||
option (USE_PARTIO "Use Partio if found" ON)
|
||||
set (PARTIO_HOME "" CACHE STRING "Search path for Partio components")
|
||||
option (USE_EXTERNAL_PUGIXML "Use an externally built shared library version of the pugixml library" OFF)
|
||||
set (PUGIXML_HOME "" CACHE STRING "Hint about where to find external PugiXML library")
|
||||
option (USE_FAST_MATH "Use fast math approximations (if no, then use system math library)" ON)
|
||||
option (OSL_BUILD_PLUGINS "Bool OSL plugins, for example OIIO plugin" ON)
|
||||
@@ -261,12 +262,12 @@ TESTSUITE ( and-or-not-synonyms aastep arithmetic array array-derivs array-range
|
||||
pnoise pnoise-cell pnoise-gabor pnoise-perlin pnoise-uperlin
|
||||
operator-overloading
|
||||
oslc-comma oslc-D
|
||||
oslc-err-arrayindex oslc-err-closuremul
|
||||
oslc-err-arrayindex oslc-err-closuremul oslc-err-field
|
||||
oslc-err-format oslc-err-intoverflow
|
||||
oslc-err-noreturn oslc-err-notfunc
|
||||
oslc-err-outputparamvararray oslc-err-paramdefault
|
||||
oslc-err-struct-array-init oslc-err-struct-ctr
|
||||
oslc-err-struct-dup
|
||||
oslc-err-struct-dup oslc-err-struct-print
|
||||
oslc-warn-commainit
|
||||
oslc-variadic-macro
|
||||
oslc-version
|
||||
|
||||
+9
-4
@@ -12,8 +12,8 @@ NEW or CHANGED dependencies since the last major release are **bold**.
|
||||
* Build system: **[CMake](https://cmake.org/) 3.2.2 or newer**
|
||||
|
||||
* A suitable **C++11** compiler to build OSL itself, which may be any of:
|
||||
- GCC 4.8.5 or newer
|
||||
- Clang 3.4 or newer
|
||||
- GCC 4.8.5 or newer (through gcc 8)
|
||||
- Clang 3.4 or newer (through clang 7)
|
||||
- Microsoft Visual Studio 2015 or newer
|
||||
- Intel C++ compiler icc version 13 (?) or newer
|
||||
|
||||
@@ -39,7 +39,7 @@ NEW or CHANGED dependencies since the last major release are **bold**.
|
||||
DYLD_LIBRARY_PATH on OS X) and then OSL's build scripts will be able
|
||||
to find it.
|
||||
|
||||
* **[LLVM](http://www.llvm.org) 3.5, 3.9, 4.0, or 5.0**
|
||||
* **[LLVM](http://www.llvm.org) 3.5, 3.9, 4.0, 5.0, 6.0, or 7.0**
|
||||
|
||||
Optionally, if Clang libraries are installed alongside LLVM, OSL will
|
||||
in most circumstances use Clang's internals for C-style preprocessing of
|
||||
@@ -79,6 +79,11 @@ Here are the steps to check out, build, and test the OSL distribution:
|
||||
options, and note that 'make nuke' will blow everything away for the
|
||||
freshest possible compile.
|
||||
|
||||
NOTE: If the build breaks due to compiler warnings which have been
|
||||
elevated to errors, you can try "make clean" followed by
|
||||
"make STOP_ON_WARNING=0", that create a build that will only stop for
|
||||
full errors, not warnings.
|
||||
|
||||
3. After compilation, you'll end up with a full OSL distribution in
|
||||
dist/ARCH, where ARCH is the architecture you are building on, one of
|
||||
"linux", "linux64", "macosx", "windows", or "windows64".
|
||||
@@ -92,7 +97,7 @@ Here are the steps to check out, build, and test the OSL distribution:
|
||||
of those files to appropriate directories. Public include files
|
||||
(those needed when building applications that incorporate OSL)
|
||||
can be found in "dist/ARCH/include", and documentation can be found
|
||||
in "dist/ARCH/doc".
|
||||
in "dist/ARCH/share/doc".
|
||||
|
||||
5. After building (and setting your library path), you can run the
|
||||
test suite with:
|
||||
|
||||
@@ -137,6 +137,10 @@ ifneq (${BUILDSTATIC},)
|
||||
MY_CMAKE_FLAGS += -DBUILDSTATIC:BOOL=${BUILDSTATIC}
|
||||
endif
|
||||
|
||||
ifneq (${SOVERSION},)
|
||||
MY_CMAKE_FLAGS += -DSOVERSION:STRING=${SOVERSION}
|
||||
endif
|
||||
|
||||
ifneq (${LINKSTATIC},)
|
||||
MY_CMAKE_FLAGS += -DLINKSTATIC:BOOL=${LINKSTATIC}
|
||||
endif
|
||||
@@ -145,10 +149,6 @@ ifneq (${OSL_BUILD_TESTS},)
|
||||
MY_CMAKE_FLAGS += -DOSL_BUILD_TESTS:BOOL=${OSL_BUILD_TESTS}
|
||||
endif
|
||||
|
||||
ifneq (${USE_EXTERNAL_PUGIXML},)
|
||||
MY_CMAKE_FLAGS += -DUSE_EXTERNAL_PUGIXML:BOOL=${USE_EXTERNAL_PUGIXML} -DPUGIXML_HOME=${PUGIXML_HOME}
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
MY_CMAKE_FLAGS += -DCMAKE_BUILD_TYPE:STRING=Debug
|
||||
endif
|
||||
@@ -370,7 +370,6 @@ help:
|
||||
@echo " OPENEXR_HOME=path Custom OpenEXR installation"
|
||||
@echo " ILMBASE_HOME=path Custom Ilmbase installation"
|
||||
@echo " PARTIO_HOME= Use Partio from the given location"
|
||||
@echo " USE_EXTERNAL_PUGIXML=1 Use the system PugiXML, not the one in OIIO"
|
||||
@echo " LLVM-related options:"
|
||||
@echo " LLVM_VERSION=4.0 Specify which LLVM version to use"
|
||||
@echo " LLVM_DIRECTORY=xx Specify where LLVM lives"
|
||||
|
||||
@@ -242,6 +242,7 @@ adding OSL support):
|
||||
* [DNA Research: 3Delight](http://www.3delight.com/)
|
||||
* Ubisoft motion picture group's proprietary renderer
|
||||
* [Autodesk/SolidAngle: Arnold](https://www.solidangle.com/arnold/)
|
||||
* [Autodesk: 3DS Max 2019](https://help.autodesk.com/view/3DSMAX/2019/ENU/?guid=__developer_3ds_max_sdk_features_rendering_osl_html)
|
||||
|
||||
Films using OSL (grouped by year of release date):
|
||||
* **(2012)**
|
||||
@@ -275,8 +276,10 @@ Films using OSL (grouped by year of release date):
|
||||
Suicide Squad,
|
||||
Kingsglaive: Final Fantasy XV,
|
||||
Storks,
|
||||
Miss Peregrine's Home for Peculiar Children, Assassin's Creed
|
||||
* **(2017) / upcoming**
|
||||
Miss Peregrine's Home for Peculiar Children,
|
||||
Assassin's Creed,
|
||||
Fantastic Beasts and Where to Find Them
|
||||
* **(2017)**
|
||||
Lego Batman,
|
||||
The Great Wall,
|
||||
A Cure for Wellness,
|
||||
@@ -296,9 +299,24 @@ Films using OSL (grouped by year of release date):
|
||||
The Emoji Movie,
|
||||
Detroit,
|
||||
Kingsman: The Golden Circle,
|
||||
Lega Ninjago Movie,
|
||||
Lego Ninjago Movie,
|
||||
Blade Runner 2049,
|
||||
Geostorm,
|
||||
Coco,
|
||||
Justice League,
|
||||
Thor: Ragnarok
|
||||
* **(2018) / upcoming**
|
||||
Peter Rabbit,
|
||||
Black Panther,
|
||||
Annnihilation,
|
||||
Red Sparrow,
|
||||
Pacific Rim Uprising,
|
||||
Avengers Infinity War,
|
||||
Deadpool 2,
|
||||
Incredibles 2,
|
||||
Hotel Transylvania 3: Summer Vacation,
|
||||
Ant Man and the Wasp,
|
||||
Skyscraper,
|
||||
...
|
||||
|
||||
|
||||
@@ -339,11 +357,12 @@ Van Lommel.
|
||||
|
||||
Additionally, many others have contributed features, bug fixes, and other
|
||||
changes: Steve Agland, Shane Ambler, Martijn Berger, Farchad Bidgolirad,
|
||||
Nicholas Bishop, Stefan Büttner, Matthaus G. Chajdas, Thomas Dinges, Henri
|
||||
Fousse, Syoyo Fujita, Derek Haase, Sven-Hendrik Haase, John Haddon, Daniel
|
||||
Heckenberg, Ronan Keryell, Elvic Liang, Max Liani, Bastien Montagne, Erich
|
||||
Ocean, Mikko Ohtamaa, Alex Schworer, Sergey Sharybin, Stephan Steinbach,
|
||||
Esteban Tovagliari, Alexander von Knorring, Roman Zulak. (Listed
|
||||
Nicholas Bishop, Stefan Büttner, Matthaus G. Chajdas, Thomas Dinges, Mark
|
||||
Final, Henri Fousse, Syoyo Fujita, Tim Grant, Derek Haase, Sven-Hendrik
|
||||
Haase, John Haddon, Daniel Heckenberg, Matt Johnson, Ronan Keryell, Elvic
|
||||
Liang, Max Liani, Bastien Montagne, Alexis Oblet, Erich Ocean, Mikko
|
||||
Ohtamaa, Alex Schworer, Jonathan Scruggs, Sergey Sharybin, Stephan
|
||||
Steinbach, Esteban Tovagliari, Alexander von Knorring, Roman Zulak. (Listed
|
||||
alphabetically; if we've left anybody out, please let us know.)
|
||||
|
||||
We cannot possibly express sufficient gratitude to the managers at Sony
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
clone_depth: 10
|
||||
version: '{branch}-{build}'
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- release
|
||||
- appveyor
|
||||
- /RB-/
|
||||
- /lg-/
|
||||
|
||||
skip_tags: true
|
||||
|
||||
build:
|
||||
parallel: true
|
||||
verbosity: detailed
|
||||
|
||||
platform:
|
||||
- x64
|
||||
# - x86
|
||||
|
||||
configuration:
|
||||
#- Debug
|
||||
- Release
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- TOOLSET: msvc14
|
||||
|
||||
os:
|
||||
- Visual Studio 2015
|
||||
|
||||
cache:
|
||||
- C:\projects\OSLdeps
|
||||
|
||||
before_build:
|
||||
- ps: |
|
||||
Write-Output "Configuration: $env:CONFIGURATION"
|
||||
Write-Output "Platform: $env:PLATFORM"
|
||||
Get-ChildItem Env:
|
||||
|
||||
$DWN_DIR = "C:\projects\OSLdownloads"
|
||||
$DEP_DIR = "C:\projects\OSLdeps"
|
||||
$BOOST_ROOT = "C:\Libraries\boost_1_63_0"
|
||||
$PYTHON_DIR = "C:\Python27"
|
||||
$LLVM_DIR = "C:\Libraries\llvm-4.0.0"
|
||||
$LLVM_DIR = "$DEP_DIR"
|
||||
$env:Path += ";$DEP_DIR\lib;$DEP_DIR\bin"
|
||||
$env:APPVEYOR_SAVE_CACHE_ON_ERROR = true
|
||||
$OSL_INT_DIR = "build\windows$env:PLATFORM"
|
||||
|
||||
# Choose the VisualStudio generator
|
||||
$GENERATOR = switch ($env:TOOLSET)
|
||||
{
|
||||
"msvc14" {"Visual Studio 14 2015"}
|
||||
"msvc12" {"Visual Studio 12 2013"}
|
||||
"msvc11" {"Visual Studio 11 2012"}
|
||||
"msvc10" {"Visual Studio 10 2010"}
|
||||
}
|
||||
|
||||
# Final setup based on 64 or 32 bit
|
||||
if ($env:PLATFORM -eq "x64") {
|
||||
$GENERATOR = "$GENERATOR Win64"
|
||||
$PYTHON_DIR = "$PYTHON_DIR-x64"
|
||||
$BOOST_LIBRARYDIR = "$BOOST_ROOT\lib64-msvc-14.0"
|
||||
} else {
|
||||
$BOOST_LIBRARYDIR = "$BOOST_ROOT\lib32-msvc-14.0"
|
||||
}
|
||||
|
||||
# If the dependency directory exists/cached, use it
|
||||
if(!(Test-Path -Path $DEP_DIR )){
|
||||
md $DWN_DIR -Force | Out-Null;
|
||||
md $DEP_DIR -Force | Out-Null; cd $DEP_DIR
|
||||
md $DEP_DIR\include -Force | Out-Null; cd $DEP_DIR
|
||||
md $DEP_DIR\lib -Force | Out-Null; cd $DEP_DIR
|
||||
|
||||
cd $DWN_DIR
|
||||
nuget install libtiff-$env:TOOLSET-$env:PLATFORM-master -Version 4.0.6.85 -Source https://ci.appveyor.com/nuget/libtiff-i3h8tqqy7o7b
|
||||
mv .\libtiff*\*.h $DEP_DIR\include\
|
||||
mv .\libtiff*\*.lib $DEP_DIR\lib\
|
||||
mv .\libtiff*\*.dll $DEP_DIR\lib\
|
||||
|
||||
nuget install libpng-$env:TOOLSET-$env:PLATFORM-master -Version 1.6.18.44 -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48
|
||||
mv .\libpng*\*.h $DEP_DIR\include\
|
||||
mv .\libpng*\*.lib $DEP_DIR\lib\
|
||||
mv .\libpng*\*.dll $DEP_DIR\lib\
|
||||
|
||||
nuget install libjpeg-$env:TOOLSET-$env:PLATFORM-master -Version 1.4.80.21 -Source https://ci.appveyor.com/nuget/libjpegturbo-o6k4js4y7pjw
|
||||
mv .\libjpeg*\*.h $DEP_DIR\include\
|
||||
mv .\libjpeg*\*.lib $DEP_DIR\lib\
|
||||
mv .\libjpeg*\*.dll $DEP_DIR\lib\
|
||||
|
||||
nuget install freetype
|
||||
mv .\freetype.2.8.0.1\build\native\include\* $DEP_DIR\include\
|
||||
mv .\freetype.2.8.0.1\build\native\lib\$env:PLATFORM\v140\dynamic\Release\*.lib $DEP_DIR\lib\
|
||||
mv .\freetype.redist.2.8.0.1\build\native\bin\$env:PLATFORM\v140\dynamic\Release\*.lib $DEP_DIR\lib\
|
||||
|
||||
# ZLib
|
||||
cd $DWN_DIR
|
||||
Start-FileDownload https://github.com/madler/zlib/archive/v1.2.8.tar.gz
|
||||
tar -xzf v1.2.8.tar.gz; cd zlib-1.2.8; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
|
||||
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR"
|
||||
cmake --build . --config $env:CONFIGURATION --target INSTALL
|
||||
|
||||
# IlmBase
|
||||
cd $DWN_DIR
|
||||
Start-FileDownload http://download.savannah.nongnu.org/releases/openexr/ilmbase-2.2.1.tar.gz
|
||||
tar -xzf ilmbase-2.2.1.tar.gz ; cd ilmbase* ; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
|
||||
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR"
|
||||
cmake --build . --config $env:CONFIGURATION --target INSTALL
|
||||
|
||||
# OpenEXR
|
||||
cd $DWN_DIR
|
||||
Start-FileDownload http://download.savannah.nongnu.org/releases/openexr/openexr-2.2.1.tar.gz
|
||||
tar -xzf openexr-2.2.1.tar.gz ; cd openexr* ; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
|
||||
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DILMBASE_PACKAGE_PREFIX="$DEP_DIR"
|
||||
cmake --build . --config $env:CONFIGURATION --target INSTALL
|
||||
|
||||
# OpenImageIO
|
||||
cd $DWN_DIR
|
||||
Start-FileDownload https://github.com/OpenImageIO/oiio/archive/Release-1.8.14.zip
|
||||
unzip Release-1.8.14.zip; cd .\oiio-Release*\; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
|
||||
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR;$BOOST_ROOT" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DFREETYPE_DIR="$DEP_DIR" -DBOOST_LIBRARYDIR="$BOOST_LIBRARYDIR" -DUSE_PYTHON=OFF -DOIIO_BUILD_TESTS=OFF -DUSE_NUKE=OFF
|
||||
cmake --build . --config $env:CONFIGURATION --target INSTALL
|
||||
|
||||
# LLVM
|
||||
cd $DWN_DIR
|
||||
git clone --depth 10 --branch release_40 https://github.com/llvm-mirror/llvm.git
|
||||
cd llvm; md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
|
||||
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DLLVM_TARGETS_TO_BUILD="X86"
|
||||
cmake --build . --config $env:CONFIGURATION --target INSTALL
|
||||
|
||||
cd $env:APPVEYOR_BUILD_FOLDER
|
||||
}
|
||||
|
||||
# Always do this
|
||||
cinst winflexbison
|
||||
|
||||
|
||||
build_script:
|
||||
- ps: |
|
||||
# Build OSL
|
||||
md "$OSL_INT_DIR" -Force | Out-Null; cd "$OSL_INT_DIR"
|
||||
cmake ..\.. -G "$GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$env:CONFIGURATION" -DCMAKE_PREFIX_PATH="$DEP_DIR;$BOOST_ROOT;$LLVM_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR" -DLLVM_DIRECTORY="$LLVM_DIR" -DLLVM_STATIC=ON -DOPENIMAGEIOHOME="$DEP_DIR" -DBOOST_LIBRARYDIR="$BOOST_LIBRARYDIR" -DFLEX_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison\tools\win_flex.exe" -DBISON_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison\tools\win_bison.exe" -DUSE_QT=OFF -DBUILDSTATIC=OFF -DLINKSTATIC=OFF
|
||||
|
||||
# OSL's CMake should probably be handling Windows config better...
|
||||
$OSL_BUILD_DIR = "$env:APPVEYOR_BUILD_FOLDER\$OSL_INT_DIR"
|
||||
$env:Path += ";$BOOST_LIBRARYDIR"
|
||||
$env:OSLHOME = "$env:APPVEYOR_BUILD_FOLDER\src"
|
||||
$env:OPENIMAGEIOHOME = "$DEP_DIR"
|
||||
$env:OIIO_LIBRARY_PATH = "$OSL_BUILD_DIR\src\osl.imageio\$env:CONFIGURATION"
|
||||
$env:Path += ";$OSL_BUILD_DIR\src\oslc\$env:CONFIGURATION"
|
||||
$env:Path += ";$OSL_BUILD_DIR\src\oslinfo\$env:CONFIGURATION"
|
||||
$env:Path += ";$OSL_BUILD_DIR\src\liboslcomp\$env:CONFIGURATION"
|
||||
$env:Path += ";$OSL_BUILD_DIR\src\liboslexec\$env:CONFIGURATION"
|
||||
$env:Path += ";$OSL_BUILD_DIR\src\liboslnoise\$env:CONFIGURATION"
|
||||
$env:Path += ";$OSL_BUILD_DIR\src\liboslquery\$env:CONFIGURATION"
|
||||
|
||||
cmake --build . --config $env:CONFIGURATION
|
||||
|
||||
# Test OSL
|
||||
ctest -C $env:CONFIGURATION --output-on-failure -E "texture-udim"
|
||||
|
||||
|
||||
#init:
|
||||
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
#on_failure:
|
||||
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
+21
-3
@@ -18,7 +18,7 @@ ifeq ($(SP_OS), rhel7)
|
||||
|
||||
## If not overridden, here is our preferred LLVM installation
|
||||
## (may be changed as new versions are rolled out to the facility)
|
||||
LLVM_DIRECTORY ?= /shots/spi/home/lib/arnold/rhel7/llvm_5.0.0
|
||||
LLVM_DIRECTORY ?= /shots/spi/home/lib/arnold/rhel7/llvm_7.0.0
|
||||
|
||||
# A variety of tags can be used to try specific versions of gcc or
|
||||
# clang from the site-specific places we have installed them.
|
||||
@@ -28,14 +28,26 @@ ifeq ($(SP_OS), rhel7)
|
||||
-DCMAKE_CXX_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_4.0_final/bin/clang++
|
||||
else ifeq (${COMPILER}, clang5)
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DCMAKE_C_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_5.0.0/bin/clang \
|
||||
-DCMAKE_CXX_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_5.0.0/bin/clang++
|
||||
-DCMAKE_C_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_5.0.1/bin/clang \
|
||||
-DCMAKE_CXX_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_5.0.1/bin/clang++
|
||||
else ifeq (${COMPILER}, clang6)
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DCMAKE_C_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_6.0.1/bin/clang \
|
||||
-DCMAKE_CXX_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_6.0.1/bin/clang++
|
||||
else ifeq (${COMPILER}, clang7)
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DCMAKE_C_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_7.0.0/bin/clang \
|
||||
-DCMAKE_CXX_COMPILER=/shots/spi/home/lib/arnold/rhel7/llvm_7.0.0/bin/clang++
|
||||
else ifeq (${COMPILER},clang)
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||
else ifeq (${COMPILER}, gcc490)
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DCMAKE_C_COMPILER=/net/soft_scratch/apps/arnold/tools/gcc-4.9-20130512-test/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/net/soft_scratch/apps/arnold/tools/gcc-4.9-20130512-test/bin/g++
|
||||
else ifeq (${COMPILER}, gcc6)
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++
|
||||
else ifeq (${COMPILER},gcc)
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
|
||||
else ifeq (${COMPILER},)
|
||||
@@ -43,8 +55,12 @@ ifeq ($(SP_OS), rhel7)
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang \
|
||||
-DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" \
|
||||
-DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr" \
|
||||
-DTOOLCHAIN_FLAGS="--gcc-toolchain=/usr"
|
||||
endif
|
||||
|
||||
|
||||
MY_CMAKE_FLAGS += \
|
||||
-DOPENEXR_CUSTOM_INCLUDE_DIR=/usr/include/OpenEXR2 \
|
||||
-DOPENEXR_CUSTOM_LIB_DIR=/usr/lib64/OpenEXR2 \
|
||||
@@ -93,6 +109,8 @@ else ifeq (${platform}, macosx)
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang-3.5 -DCMAKE_CXX_COMPILER=clang++-3.5
|
||||
else ifeq (${COMPILER},clang40)
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@4/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@4/bin/clang++
|
||||
else ifeq (${COMPILER},clang7)
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/7.0.0/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/7.0.0/bin/clang++
|
||||
else ifeq (${COMPILER},clang)
|
||||
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||
else ifeq (${COMPILER},gcc)
|
||||
|
||||
@@ -7,7 +7,7 @@ message (STATUS "CMAKE_CXX_COMPILER_ID is ${CMAKE_CXX_COMPILER_ID}")
|
||||
set (USE_CPP 11 CACHE STRING "C++ standard to prefer (11, 14, etc.)")
|
||||
option (USE_LIBCPLUSPLUS "Compile with clang libc++")
|
||||
set (USE_SIMD "" CACHE STRING "Use SIMD directives (0, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2, avx512f, f16c)")
|
||||
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 (HIDE_SYMBOLS "Hide symbols not in the public API" ON)
|
||||
option (USE_CCACHE "Use ccache if found" ON)
|
||||
option (USE_fPIC "Build with -fPIC")
|
||||
@@ -64,8 +64,11 @@ endif ()
|
||||
# turn on more detailed warnings and consider warnings as errors
|
||||
if (NOT MSVC)
|
||||
add_definitions ("-Wall")
|
||||
if (STOP_ON_WARNING)
|
||||
if (STOP_ON_WARNING OR DEFINED ENV{CI})
|
||||
add_definitions ("-Werror")
|
||||
# N.B. Force CI builds (Travis defines $CI) to use -Werror, even if
|
||||
# STOP_ON_WARNING has been switched off by default, which we may do
|
||||
# in release branches.
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -340,8 +343,4 @@ endif ()
|
||||
|
||||
if (DEFINED ENV{TRAVIS} OR DEFINED ENV{APPVEYOR} OR DEFINED ENV{CI})
|
||||
add_definitions ("-D${PROJECT_NAME}_CI=1" "-DBUILD_CI=1")
|
||||
if (WIN32)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -186,15 +186,9 @@ endif (USE_PARTIO)
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Pugixml setup. Normally we just use the version bundled with oiio, but
|
||||
# some linux distros are quite particular about having separate packages so we
|
||||
# allow this to be overridden to use the distro-provided package if desired.
|
||||
if (USE_EXTERNAL_PUGIXML)
|
||||
find_package (PugiXML REQUIRED)
|
||||
# insert include path to pugixml first, to ensure that the external
|
||||
# pugixml is found, and not the one in OIIO's include directory.
|
||||
include_directories (BEFORE "${PUGIXML_INCLUDE_DIR}")
|
||||
add_definitions ("-DUSE_EXTERNAL_PUGIXML")
|
||||
endif()
|
||||
# Pugixml setup. Prefer a system install, but note that FindPugiXML.cmake
|
||||
# will look in the OIIO distribution if it's not found on the system.
|
||||
find_package (PugiXML REQUIRED)
|
||||
include_directories (BEFORE "${PUGIXML_INCLUDE_DIR}")
|
||||
# end Pugixml setup
|
||||
###########################################################################
|
||||
|
||||
@@ -76,8 +76,13 @@ IF ( FLEX_EXECUTABLE AND BISON_EXECUTABLE )
|
||||
MAIN_DEPENDENCY ${bisonsrc}
|
||||
DEPENDS ${${compiler_headers}}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
if ( WINDOWS )
|
||||
SET ( WINCOMPAT --wincompat )
|
||||
else ()
|
||||
SET ( WINCOMPAT )
|
||||
endif ()
|
||||
ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx}
|
||||
COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
|
||||
COMMAND ${FLEX_EXECUTABLE} ${WINCOMPAT} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
|
||||
MAIN_DEPENDENCY ${flexsrc}
|
||||
DEPENDS ${${compiler_headers}}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
|
||||
@@ -52,6 +52,7 @@ if (NOT ${LLVM_VERSION} VERSION_LESS 3.8)
|
||||
execute_process (COMMAND ${LLVM_CONFIG} --system-libs
|
||||
OUTPUT_VARIABLE LLVM_SYSTEM_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string (REPLACE " " ";" LLVM_SYSTEM_LIBRARIES "${LLVM_SYSTEM_LIBRARIES}")
|
||||
else ()
|
||||
# Older LLVM did not have llvm-config --system-libs, but we know that
|
||||
# on Linux, we'll need curses.
|
||||
|
||||
@@ -17,6 +17,15 @@ find_library (PUGIXML_LIBRARY
|
||||
/usr/local/lib
|
||||
/usr/local/lib/pugixml-1.8)
|
||||
|
||||
# Second chance -- if not found, look in the OIIO distro
|
||||
if (NOT PUGIXML_INCLUDE_DIR AND OPENIMAGEIO_INCLUDE_DIR)
|
||||
find_path (PUGIXML_INCLUDE_DIR
|
||||
NAMES pugixml.hpp
|
||||
PATHS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO)
|
||||
set (PUGIXML_LIBRARY ${OPENIMAGEIO_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
|
||||
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS (PugiXML DEFAULT_MSG PUGIXML_LIBRARY
|
||||
|
||||
+20
-20
@@ -55,14 +55,14 @@ Language Specification
|
||||
%\\ \large (CONFIDENTIAL --- draft in progress)
|
||||
} \bigskip }
|
||||
\author{
|
||||
\copyright\ Copyright 2009-2017 Sony Pictures Imageworks Inc., et al. All rights reserved.
|
||||
\copyright\ Copyright 2009-2018 Sony Pictures Imageworks Inc., et al. All rights reserved.
|
||||
\bigskip \\
|
||||
\vspace{1in} \\
|
||||
Editor: Larry Gritz \\
|
||||
\emph{lg@imageworks.com}
|
||||
}
|
||||
\date{{\large Date: 30 Jun 2017 \\
|
||||
% (with corrections, 12 May 2017)
|
||||
(with corrections, 11 Oct 2018)
|
||||
}
|
||||
\bigskip
|
||||
\bigskip
|
||||
@@ -614,7 +614,7 @@ information about the renderer as a whole (rendering options, etc.).
|
||||
|
||||
Surface shaders (and volume shaders) do not by themselves compute the
|
||||
final color of light emanating from the surface (or along a volume).
|
||||
Rather, the compute a \emph{closure}, which is a symbolic representation
|
||||
Rather, they compute a \emph{closure}, which is a symbolic representation
|
||||
describing the appearance of the surface, that may be more fully
|
||||
evaluated later. This is in effect a parameterized formula, in which
|
||||
some inputs have definite numeric values, but others may depend on
|
||||
@@ -979,7 +979,7 @@ different behaviors or appearances when used on different objects.
|
||||
|
||||
Shader parameters are specified in the shader declaration, in
|
||||
parentheses after the shader's name. This is much like the parameters
|
||||
to a \languagename function (or a function in C or similar languages),
|
||||
to an OSL function (or a function in C or similar languages),
|
||||
except that shader parameters must have an \emph{initializer}, giving a
|
||||
default value for the parameter. Shader parameter default initializers
|
||||
may be expressions (i.e., may be computed rather than restricted to
|
||||
@@ -1865,7 +1865,7 @@ reference to a named space:
|
||||
\end{code}
|
||||
|
||||
\noindent The first form creates the matrix that transforms points from
|
||||
\commonspace to \shaderspace. Transforming points by this matrix
|
||||
\shaderspace to \commonspace. Transforming points by this matrix
|
||||
is identical to calling {\cf transform("shader",...)}.
|
||||
The second form prepends the current-to-world transformation matrix
|
||||
onto the $4 \times 4$ matrix with components $m_{0,0} ... m_{3,3}$.
|
||||
@@ -2105,7 +2105,7 @@ At present, the only type of \closure supported by \langname is the
|
||||
form a linear combination of \colorclosure's. Additional closure types
|
||||
and operations are reserved for future use.
|
||||
|
||||
Allowable operations on \colorclosure's include:
|
||||
Allowable operations on \colorclosure include:
|
||||
|
||||
\medskip
|
||||
\noindent \begin{tabular}{|p{2.25in}|p{1.25in}|p{1.75in}|}
|
||||
@@ -3067,16 +3067,6 @@ The {\cf mix} function returns a linear blending :
|
||||
$ x*(1-\alpha) + y*(\alpha) $
|
||||
\apiend
|
||||
|
||||
\apiitem{int {\ce isnan} (float x) \\
|
||||
int {\ce isinf} (float x) \\
|
||||
int {\ce isfinite} (float x)}
|
||||
\indexapi{isnan()} \indexapi{isinf()} \indexapi{isfinite()}
|
||||
The {\cf isnan()} function returns 1 if $x$ is a not-a-number (NaN)
|
||||
value, 0 otherwise. The {\cf isinf()} function returns 1 if $x$ is an
|
||||
infinite (Inf or --Inf) value, 0 otherwise. The {\cf isfinite()}
|
||||
function returns 1 if $x$ is an ordinary number (neither infinite nor
|
||||
NaN), 0 otherwise. \apiend
|
||||
|
||||
\apiitem{\emph{type} {\ce select} (\emph{type} x, \emph{type} y, \emph{type} cond) \\
|
||||
\emph{type} {\ce select} (\emph{type} x, \emph{type} y, float cond) \\
|
||||
\emph{type} {\ce select} (\emph{type} x, \emph{type} y, int cond)}
|
||||
@@ -3242,10 +3232,12 @@ and {\cf eta} is the ratio of refractive index of the medium
|
||||
containing {\cf I} to that on the opposite side of the surface.
|
||||
\apiend
|
||||
|
||||
\apiitem{point {\ce rotate} (point Q, float angle, point P0, point P1)}
|
||||
\apiitem{point {\ce rotate} (point Q, float angle, point P0, point P1) \\
|
||||
point {\ce rotate} (point Q, float angle, vector axis)}
|
||||
\indexapi{rotate()}
|
||||
Returns the point computed by rotating point {\cf Q} by {\cf angle}
|
||||
radians about the axis that passes from point {\cf P0} to {\cf P1}.
|
||||
Returns the point computed by rotating point {\cf Q} by {\cf angle}
|
||||
radians about the axis that passes from point {\cf P0} to {\cf P1},
|
||||
or about the {\cf axis} vector centered on the origin.
|
||||
\apiend
|
||||
|
||||
\apiitem{\emph{ptype} {\ce transform} (string tospace, \emph{ptype} p) \\
|
||||
@@ -3688,7 +3680,7 @@ animation (provided its input is \emph{precisely} identical).
|
||||
int {\ce hash} (float u, float v) \\
|
||||
int {\ce hash} (point p) \\
|
||||
int {\ce hash} (point p, float t) \\
|
||||
int {\ce hash) (int i)}}
|
||||
int {\ce hash} (int i)}
|
||||
\indexapi{hash()}
|
||||
\NEW % 1.9
|
||||
Returns a deterministic, repeatable integer \emph{hash} of the 1-, 2-, 3-,
|
||||
@@ -4204,6 +4196,14 @@ The first channel to look up from the texture map (default: 0).
|
||||
\apiend
|
||||
\vspace{-16pt}
|
||||
|
||||
\apiitem{"subimage", <int> \\
|
||||
"subimage", <string>}
|
||||
\vspace{12pt}
|
||||
Specify the subimage (by numerical index, or name) of the subimage
|
||||
within a multi-image texture file (default: subimage 0).
|
||||
\apiend
|
||||
\vspace{-16pt}
|
||||
|
||||
\apiitem{"fill", <float>}
|
||||
\vspace{12pt}
|
||||
The value to return for any channels that are requested,
|
||||
|
||||
Binary file not shown.
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
/// Default ctr leaves everything uninitialized
|
||||
///
|
||||
constexpr Dual () { }
|
||||
OIIO_CONSTEXPR14 Dual () { }
|
||||
|
||||
/// Construct a Dual from just a real value (derivs set to 0)
|
||||
///
|
||||
|
||||
@@ -103,3 +103,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#else
|
||||
# define OSLQUERYPUBLIC OSL_DLL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(oslnoise_EXPORTS) || defined(oslexec_EXPORTS)
|
||||
# define OSLNOISEPUBLIC OSL_DLL_EXPORT
|
||||
#else
|
||||
# define OSLNOISEPUBLIC OSL_DLL_IMPORT
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace llvm {
|
||||
class ExecutionEngine;
|
||||
class Function;
|
||||
class FunctionType;
|
||||
class JITMemoryManager;
|
||||
class SectionMemoryManager;
|
||||
class Linker;
|
||||
class LLVMContext;
|
||||
class Module;
|
||||
@@ -500,7 +500,7 @@ private:
|
||||
llvm::LLVMContext *m_llvm_context;
|
||||
llvm::Module *m_llvm_module;
|
||||
IRBuilder *m_builder;
|
||||
MemoryManager *m_llvm_jitmm;
|
||||
llvm::SectionMemoryManager *m_llvm_jitmm;
|
||||
llvm::Function *m_current_function;
|
||||
llvm::legacy::PassManager *m_llvm_module_passes;
|
||||
llvm::legacy::FunctionPassManager *m_llvm_func_passes;
|
||||
|
||||
@@ -114,29 +114,26 @@ struct OSLEXECPUBLIC ClosureColor {
|
||||
|
||||
/// ClosureComponent is a subclass of ClosureColor that holds the ID and
|
||||
/// parameter data for a single primitive closure component (such as
|
||||
/// diffuse, translucent, etc.). The declaration leaves 4 bytes for
|
||||
/// parameter data (mem), but it's expected that the structure be
|
||||
/// allocated with enough space to house all the parameter data for
|
||||
/// whatever type of custom primitive component it actually is.
|
||||
struct OSLEXECPUBLIC ClosureComponent : public ClosureColor
|
||||
/// diffuse, translucent, etc.).
|
||||
///
|
||||
/// ClosureComponent itself takes up 16 bytes, and its allocation will be
|
||||
/// scaled to add parameters after the end of the struct. Alignment is
|
||||
/// set to 16 bytes so that 64 bit pointers and 128 bit SSE types in user
|
||||
/// structs have the required alignment.
|
||||
struct OSLEXECPUBLIC OSL_ALIGNAS(16) ClosureComponent : public ClosureColor
|
||||
{
|
||||
Vec3 w; ///< Weight of this component
|
||||
alignas(void*) char mem[8]; ///< Memory for the primitive, 8 is the minimum, allocation will be
|
||||
/// scaled to requirements of the registered closure struct.
|
||||
/// Alignment is forced to a void* to match likely alignement requirements
|
||||
/// of the user's structs.
|
||||
|
||||
/// Handy method for getting the parameter memory as a void*.
|
||||
///
|
||||
void *data () { return &mem; }
|
||||
const void *data () const { return &mem; }
|
||||
void *data () { return (char*)(this + 1); }
|
||||
const void *data () const { return (const char*)(this + 1); }
|
||||
|
||||
/// Handy methods for extracting the underlying parameters as a struct
|
||||
template <typename T>
|
||||
const T* as() const { return reinterpret_cast<const T*>(mem); }
|
||||
const T* as() const { return reinterpret_cast<const T*>(data()); }
|
||||
|
||||
template <typename T>
|
||||
T* as() { return reinterpret_cast<const T*>(mem); }
|
||||
T* as() { return reinterpret_cast<const T*>(data()); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -131,4 +131,12 @@ using OIIO::string_view;
|
||||
# define OSL_DEPRECATED(msg)
|
||||
#endif
|
||||
|
||||
/// Work around bug in GCC with mixed __attribute__ and alignas parsing
|
||||
/// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69585
|
||||
#ifdef __GNUC__
|
||||
# define OSL_ALIGNAS(size) __attribute__((aligned(size)))
|
||||
#else
|
||||
# define OSL_ALIGNAS(size) alignas(size)
|
||||
#endif
|
||||
|
||||
OSL_NAMESPACE_EXIT
|
||||
|
||||
@@ -111,6 +111,9 @@ public:
|
||||
/// fails to find the layer or parameter? (1)
|
||||
/// int strict_messages Issue error if a message is set after
|
||||
/// being queried (1).
|
||||
/// int error_repeats If zero, suppress repeats of errors and
|
||||
/// warnings that are exact duplicates of
|
||||
/// earlier ones. (1)
|
||||
/// int lazylayers Evaluate shader layers only when their
|
||||
/// outputs are first needed (1)
|
||||
/// int lazyglobals Run layers lazily even if they write to
|
||||
|
||||
@@ -123,12 +123,19 @@ typedef void (*NoiseGenericFunc)(int outdim, float *out, bool derivs,
|
||||
typedef void (*NoiseImplFunc)(float *out, const float *in,
|
||||
const float *period, NoiseParams *params);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
float simplexnoise1 (float x, int seed=0, float *dnoise_dx=NULL);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
float simplexnoise2 (float x, float y, int seed=0,
|
||||
float *dnoise_dx=NULL, float *dnoise_dy=NULL);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
float simplexnoise3 (float x, float y, float z, int seed=0,
|
||||
float *dnoise_dx=NULL, float *dnoise_dy=NULL,
|
||||
float *dnoise_dz=NULL);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
float simplexnoise4 (float x, float y, float z, float w, int seed=0,
|
||||
float *dnoise_dx=NULL, float *dnoise_dy=NULL,
|
||||
float *dnoise_dz=NULL, float *dnoise_dw=NULL);
|
||||
@@ -2794,25 +2801,47 @@ struct USimplexNoise {
|
||||
|
||||
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<float> gabor (const Dual2<Vec3> &P, const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<float> gabor (const Dual2<float> &x, const Dual2<float> &y,
|
||||
const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<float> gabor (const Dual2<float> &x, const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<Vec3> gabor3 (const Dual2<Vec3> &P, const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<Vec3> gabor3 (const Dual2<float> &x, const Dual2<float> &y,
|
||||
const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<Vec3> gabor3 (const Dual2<float> &x, const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<float> pgabor (const Dual2<Vec3> &P, const Vec3 &Pperiod,
|
||||
const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<float> pgabor (const Dual2<float> &x, const Dual2<float> &y,
|
||||
float xperiod, float yperiod, const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<float> pgabor (const Dual2<float> &x, float xperiod,
|
||||
const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<Vec3> pgabor3 (const Dual2<Vec3> &P, const Vec3 &Pperiod,
|
||||
const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<Vec3> pgabor3 (const Dual2<float> &x, const Dual2<float> &y,
|
||||
float xperiod, float yperiod, const NoiseParams *opt);
|
||||
|
||||
OSLNOISEPUBLIC
|
||||
Dual2<Vec3> pgabor3 (const Dual2<float> &x, float xperiod,
|
||||
const NoiseParams *opt);
|
||||
|
||||
|
||||
+12
-10
@@ -61,12 +61,12 @@ public:
|
||||
struct Parameter {
|
||||
ustring name; ///< name
|
||||
TypeDesc type; ///< data type
|
||||
bool isoutput; ///< is it an output param?
|
||||
bool validdefault; ///< false if there's no default val
|
||||
bool varlenarray; ///< is it a varying-length array?
|
||||
bool isstruct; ///< is it a structure?
|
||||
bool isclosure; ///< is it a closure?
|
||||
void *data; ///< pointer to data
|
||||
bool isoutput = false; ///< is it an output param?
|
||||
bool validdefault = false; ///< false if there's no default val
|
||||
bool varlenarray = false; ///< is it a varying-length array?
|
||||
bool isstruct = false; ///< is it a structure?
|
||||
bool isclosure = false; ///< is it a closure?
|
||||
void *data = nullptr; ///< pointer to data
|
||||
std::vector<int> idefault; ///< default int values
|
||||
std::vector<float> fdefault; ///< default float values
|
||||
std::vector<ustring> sdefault; ///< default string values
|
||||
@@ -75,10 +75,12 @@ public:
|
||||
std::vector<ustring> fields; ///< Names of this struct's fields
|
||||
ustring structname; ///< Name of the struct
|
||||
std::vector<Parameter> metadata; ///< Meta-data about the param
|
||||
Parameter ()
|
||||
: isoutput(false), validdefault(false), varlenarray(false),
|
||||
isstruct(false), isclosure(false), data(NULL)
|
||||
{ }
|
||||
|
||||
Parameter () {}
|
||||
Parameter (const Parameter& src);
|
||||
Parameter (Parameter&& src);
|
||||
const Parameter& operator= (const Parameter &);
|
||||
const Parameter& operator= (Parameter &&);
|
||||
};
|
||||
|
||||
OSLQuery ();
|
||||
|
||||
@@ -496,7 +496,8 @@ public:
|
||||
// since by design we have made this structure hold no unique
|
||||
// pointers and have no elements that aren't safe to memcpy, even
|
||||
// though the compiler probably can't figure that out.
|
||||
if (this != &a) memcpy (this, &a, sizeof(Symbol));
|
||||
// Cast to char* to defeat gcc8 rejecting this.
|
||||
if (this != &a) memcpy ((char *)this, (const char *)&a, sizeof(Symbol));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -699,21 +700,21 @@ public:
|
||||
bool is_temp () const { return symtype() == SymTypeTemp; }
|
||||
|
||||
// Retrieve the const float value (will ASSERT if not a const float!)
|
||||
float get_float (int index = 0) {
|
||||
float get_float (int index = 0) const {
|
||||
ASSERT (data() && typespec().is_float_based());
|
||||
return ((const float *)data())[index];
|
||||
}
|
||||
|
||||
// Retrieve the const int value (will ASSERT if not a const int!)
|
||||
int get_int (int index = 0) {
|
||||
int get_int (int index = 0) const {
|
||||
ASSERT (data() && typespec().is_int_based());
|
||||
return ((const int *)data())[index];
|
||||
}
|
||||
|
||||
// Retrieve the const string value (will ASSERT if not a const string!)
|
||||
ustring get_string () {
|
||||
ustring get_string (int index = 0) const {
|
||||
ASSERT (data() && typespec().is_string());
|
||||
return ((const ustring *)data())[0];
|
||||
return ((const ustring *)data())[index];
|
||||
}
|
||||
|
||||
/// Stream output
|
||||
|
||||
@@ -18,6 +18,15 @@ if (BUILDSTATIC)
|
||||
ADD_DEFINITIONS ( -DBUILD_STATIC=1 )
|
||||
else ()
|
||||
ADD_LIBRARY ( oslcomp SHARED ${liboslcomp_srcs} )
|
||||
|
||||
if (VERBOSE)
|
||||
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
|
||||
endif ()
|
||||
set_target_properties( oslcomp
|
||||
PROPERTIES
|
||||
VERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION} )
|
||||
|
||||
endif ()
|
||||
|
||||
TARGET_LINK_LIBRARIES ( oslcomp ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES}
|
||||
|
||||
+29
-3
@@ -26,10 +26,14 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <functional>
|
||||
#ifndef NDEBUG
|
||||
#include <atomic>
|
||||
#endif
|
||||
|
||||
#include "osl_pvt.h"
|
||||
#include "oslcomp_pvt.h"
|
||||
@@ -65,14 +69,34 @@ private:
|
||||
ScopeExit print_node_counts ([](){
|
||||
for (int i = 0; i < ASTNode::_last_node; ++i)
|
||||
if (node_counts[i] > 0)
|
||||
#if OIIO_VERSION >= (10000 * 1 + 100 * 8)
|
||||
Strutil::printf ("ASTNode type %2d: %5d (peak %5d)\n",
|
||||
i, node_counts[i], node_counts_peak[i]);
|
||||
#else
|
||||
printf("ASTNode type %2d: %5d (peak %5d)\n",
|
||||
i, node_counts[i].load(), node_counts_peak[i].load());
|
||||
#endif
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ASTNode::ref
|
||||
reverse (ASTNode::ref list)
|
||||
{
|
||||
ASTNode::ref new_list;
|
||||
while (list) {
|
||||
ASTNode::ref next = list->next();
|
||||
list->m_next = new_list;
|
||||
new_list = list;
|
||||
list = next;
|
||||
}
|
||||
return new_list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ASTNode::ASTNode (NodeType nodetype, OSLCompilerImpl *compiler)
|
||||
: m_nodetype(nodetype), m_compiler(compiler),
|
||||
m_sourcefile(compiler->filename()),
|
||||
@@ -620,6 +644,8 @@ ASTstructselect::find_fieldsym (int &structid, int &fieldid)
|
||||
{
|
||||
if (! lvalue()->typespec().is_structure() &&
|
||||
! lvalue()->typespec().is_structure_array()) {
|
||||
error ("type '%s' does not have a member '%s'",
|
||||
type_c_str(lvalue()->typespec()), m_field);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1015,14 +1041,14 @@ ASTtype_constructor::childname (size_t i) const
|
||||
ASTfunction_call::ASTfunction_call (OSLCompilerImpl *comp, ustring name,
|
||||
ASTNode *args, FunctionSymbol *funcsym)
|
||||
: ASTNode (function_call_node, comp, 0, args), m_name(name),
|
||||
m_sym(funcsym ? funcsym : comp->symtab().find (name)), // Look it up.
|
||||
m_poly(funcsym), // Default - resolved symbol or null
|
||||
m_argread(~1), // Default - all args are read except the first
|
||||
m_argwrite(1), // Default - first arg only is written by the op
|
||||
m_argtakesderivs(0) // Default - doesn't take derivs
|
||||
{
|
||||
// If we weren't passed a function symbol directly, look it up.
|
||||
m_sym = funcsym ? funcsym : comp->symtab().find (name);
|
||||
if (! m_sym) {
|
||||
error ("function '%s' was not declared in this scope", name.c_str());
|
||||
error ("function '%s' was not declared in this scope", name);
|
||||
// FIXME -- would be fun to troll through the symtab and try to
|
||||
// find the things that almost matched and offer suggestions.
|
||||
return;
|
||||
|
||||
@@ -172,6 +172,9 @@ public:
|
||||
return B;
|
||||
}
|
||||
|
||||
/// Reverse the order of the list.
|
||||
friend ASTNode::ref reverse (ASTNode::ref list);
|
||||
|
||||
/// What source file was this parse node created from?
|
||||
///
|
||||
ustring sourcefile () const { return m_sourcefile; }
|
||||
|
||||
@@ -998,15 +998,15 @@ ASTNode::codegen_struct_initializers (ref init, Symbol *sym,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (paraminit) {
|
||||
if (paraminit && nodetype() == variable_declaration_node) {
|
||||
// For parameter initialization, don't really generate ops if it
|
||||
// can be statically initialized.
|
||||
std::string out;
|
||||
ASSERT (nodetype() == variable_declaration_node);
|
||||
ASTvariable_declaration *v = (ASTvariable_declaration *)this;
|
||||
if (v->param_default_literals (fieldsym, init.get(), out))
|
||||
continue;
|
||||
|
||||
}
|
||||
if (paraminit) {
|
||||
// Delineate and remember the init ops for this field individually
|
||||
m_compiler->codegen_method (fieldname);
|
||||
fieldsym->initbegin (m_compiler->next_op_label ());
|
||||
@@ -1873,10 +1873,13 @@ ASTfunction_call::codegen_arg (SymbolPtrVec &argdest, SymbolPtrVec &index1,
|
||||
form->typespec().c_str());
|
||||
}
|
||||
}
|
||||
argdest.push_back (thisarg);
|
||||
index1.push_back (ind1);
|
||||
index2.push_back (ind2);
|
||||
index3.push_back (ind3);
|
||||
if (thisarg) {
|
||||
argdest.push_back (thisarg);
|
||||
index1.push_back (ind1);
|
||||
index2.push_back (ind2);
|
||||
index3.push_back (ind3);
|
||||
} else
|
||||
arg->error("Invalid argument to function");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -204,8 +204,10 @@ OSLCompilerImpl::preprocess_buffer (const std::string &buffer,
|
||||
context_type ctx (instring.begin(), instring.end(), filename.c_str());
|
||||
|
||||
// Turn on support of variadic macros, e.g. #define FOO(...) __VA_ARGS__
|
||||
// Turn off whitespace insertion.
|
||||
boost::wave::language_support lang = boost::wave::language_support (
|
||||
ctx.get_language() | boost::wave::support_option_variadics);
|
||||
(ctx.get_language() | boost::wave::support_option_variadics)
|
||||
& ~boost::wave::language_support::support_option_insert_whitespace);
|
||||
ctx.set_language (lang);
|
||||
|
||||
ctx.add_macro_definition (OIIO::Strutil::format("OSL_VERSION_MAJOR=%d",
|
||||
@@ -329,6 +331,12 @@ OSLCompilerImpl::preprocess_buffer (const std::string &buffer,
|
||||
|
||||
inst.getPreprocessorOutputOpts().ShowCPP = 1;
|
||||
inst.getPreprocessorOutputOpts().ShowMacros = 0;
|
||||
#if OSL_LLVM_VERSION >= 40
|
||||
inst.getPreprocessorOutputOpts().ShowComments = 0;
|
||||
inst.getPreprocessorOutputOpts().ShowLineMarkers = 1;
|
||||
inst.getPreprocessorOutputOpts().ShowMacroComments = 0;
|
||||
inst.getPreprocessorOutputOpts().ShowIncludeDirectives = 0;
|
||||
#endif
|
||||
|
||||
clang::HeaderSearchOptions &headerOpts = inst.getHeaderSearchOpts();
|
||||
headerOpts.UseBuiltinIncludes = 0;
|
||||
@@ -942,7 +950,7 @@ OSLCompilerImpl::write_oso_file (const std::string &outfilename,
|
||||
lastline = -1;
|
||||
}
|
||||
|
||||
if (/*m_debug &&*/ op.sourcefile()) {
|
||||
if (/*m_debug &&*/ !op.sourcefile().empty()) {
|
||||
ustring file = op.sourcefile();
|
||||
int line = op.sourceline();
|
||||
if (file != lastfile || line != lastline)
|
||||
@@ -975,7 +983,7 @@ OSLCompilerImpl::write_oso_file (const std::string &outfilename,
|
||||
// %filename and %line document the source code file and line that
|
||||
// contained code that generated this op. To avoid clutter, we
|
||||
// only output these hints when they DIFFER from the previous op.
|
||||
if (op.sourcefile()) {
|
||||
if (!op.sourcefile().empty()) {
|
||||
if (op.sourcefile() != lastfile) {
|
||||
lastfile = op.sourcefile();
|
||||
oso ("%c%%filename{\"%s\"}", firsthint ? '\t' : ' ', lastfile);
|
||||
|
||||
@@ -107,6 +107,7 @@ static std::stack<TypeSpec> typespec_stack; // just for function_declaration
|
||||
%type <n> variable_declaration def_expressions def_expression
|
||||
%type <n> initializer_opt initializer initializer_list_opt initializer_list
|
||||
%type <n> compound_initializer init_expression_list init_expression
|
||||
%type <n> init_expression_list_rev
|
||||
%type <i> outputspec arrayspec simple_typename
|
||||
%type <i> typespec typespec_or_shadertype
|
||||
%type <n> statement_list statement scoped_statements local_declaration
|
||||
@@ -491,9 +492,45 @@ compound_initializer
|
||||
|
||||
init_expression_list
|
||||
: init_expression
|
||||
| init_expression_list ',' init_expression
|
||||
| init_expression_list_rev ',' init_expression
|
||||
{
|
||||
#ifdef OIIO_REFCNT_HAS_RELEASE
|
||||
// Left recursion is much more efficient for Bison, but
|
||||
// concatenating the sole last expression ($3) on the
|
||||
// far end of the running list ($1) leads to an
|
||||
// inadvertently quadratic algorithm, which is very
|
||||
// painful for long initializer lists of thousands of
|
||||
// items (like for a big table). So we use a trick:
|
||||
// accumulate the list in referse order (lets us prepend
|
||||
// as O(1) instead of append with O(n)) and then reverse
|
||||
// it right before we return the list. BUT... note that
|
||||
// we only do this for sufficiently new OIIO that lets
|
||||
// us safely convert the ref-counted pointer to a raw
|
||||
// pointer.
|
||||
ASTNode::ref revlist = concat ($3, $1);
|
||||
revlist = reverse (revlist);
|
||||
$$ = revlist.release ();
|
||||
#else
|
||||
// OIIO too old to support reverse(), so just do it
|
||||
// the old way, normal order.
|
||||
$$ = concat ($1, $3);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
||||
init_expression_list_rev
|
||||
: init_expression
|
||||
| init_expression_list_rev ',' init_expression
|
||||
{
|
||||
#ifdef OIIO_REFCNT_HAS_RELEASE
|
||||
$$ = concat ($3, $1);
|
||||
// NOTE: intentionally concat in reverse order!
|
||||
// Because this is init_expression_list_rev!
|
||||
#else
|
||||
// OIIO too old to support reverse(), so just do it
|
||||
// the old way, normal order.
|
||||
$$ = concat ($1, $3);
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@@ -119,6 +119,12 @@ using namespace OSL::pvt;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// flex itself will generate fatal warnings about signed vs unsigned.
|
||||
// Bypass that nonsense.
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 7
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
|
||||
void preprocess (const char *yytext);
|
||||
|
||||
// Macro that sets the yylloc line variables to the current parse line.
|
||||
@@ -313,6 +319,19 @@ preprocess (const char *yytext)
|
||||
while (f[len] && f[len] != '\"')
|
||||
++len;
|
||||
std::string filename (f, len);
|
||||
#if defined(_WIN32) && defined(USE_BOOST_WAVE) && (USE_BOOST_WAVE != 0)
|
||||
// Assuming boost is the culprit and escaping Windows path
|
||||
// separators incorrectly which clang's preprocessor won't do.
|
||||
// Should this just be for Windows CI builds?
|
||||
auto replace_all = [](std::string& str, const std::string& from, const std::string& to) {
|
||||
size_t start = 0;
|
||||
while((start = str.find(from, start)) != std::string::npos) {
|
||||
str.replace(start, from.size(), to);
|
||||
start += to.size();
|
||||
}
|
||||
};
|
||||
replace_all( filename, "\\\\", "\\");
|
||||
#endif
|
||||
// Make it relative to the working directory, so error output
|
||||
// isn't hugely cluttered (and also to make Boost::wave's
|
||||
// error output match the standard cpp.
|
||||
|
||||
@@ -946,9 +946,17 @@ ASTfunction_call::mark_optional_output (int firstopt, const char **tags)
|
||||
ASTNode *s = argvec[a].get();
|
||||
bool isoutput = false;
|
||||
// compare against output tags
|
||||
if (s->typespec().is_string() && s->nodetype() == ASTNode::literal_node) {
|
||||
for (const char **tag = tags; *tag && !isoutput; ++tag)
|
||||
isoutput = isoutput || mark_all || (! strcmp (((ASTliteral *)s)->strval(), *tag));
|
||||
if (s->typespec().is_string()) {
|
||||
if (s->nodetype() == ASTNode::literal_node) {
|
||||
// If the token is a string literal, see if it's one of the
|
||||
// ones designated as an output slot.
|
||||
for (const char **tag = tags; *tag && !isoutput; ++tag)
|
||||
isoutput = isoutput || mark_all || (! strcmp (((ASTliteral *)s)->strval(), *tag));
|
||||
} else {
|
||||
// If the token is not a literal, we don't know what it'll
|
||||
// be at runtime, so mark it conservatively as possible output.
|
||||
isoutput = true;
|
||||
}
|
||||
}
|
||||
if (isoutput) {
|
||||
// writes to the next arg!
|
||||
@@ -995,6 +1003,11 @@ ASTfunction_call::typecheck_printf_args (const char *format, ASTNode *arg)
|
||||
m_name.c_str());
|
||||
return false;
|
||||
}
|
||||
if (arg->typespec().is_structure_based()) {
|
||||
error ("struct '%s' is not a valid argument",
|
||||
arg->typespec().structspec()->name());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string ourformat (oldfmt, format); // straddle the format
|
||||
// Doctor it to fix mismatches between format and data
|
||||
@@ -1061,6 +1074,7 @@ ASTfunction_call::typecheck_builtin_specialcase ()
|
||||
}
|
||||
|
||||
if (func()->readwrite_special_case()) {
|
||||
int nargs = (int)listlength(args());
|
||||
if (m_name == "sincos") {
|
||||
argwriteonly (1);
|
||||
argwriteonly (2);
|
||||
@@ -1068,11 +1082,16 @@ ASTfunction_call::typecheck_builtin_specialcase ()
|
||||
m_name == "gettextureinfo" || m_name == "getmatrix" ||
|
||||
m_name == "dict_value") {
|
||||
// these all write to their last argument
|
||||
argwriteonly ((int)listlength(args()));
|
||||
argwriteonly (nargs);
|
||||
} else if (m_name == "pointcloud_get") {
|
||||
argwriteonly (5);
|
||||
} else if (m_name == "pointcloud_search") {
|
||||
mark_optional_output(5, pointcloud_out_args);
|
||||
} else if ((m_name == "regex_search" || m_name == "regex_match")
|
||||
&& nargs == 3) {
|
||||
// the kind of regex_search and regex_match that contains a
|
||||
// results argument should mark it writeable.
|
||||
argwriteonly (2);
|
||||
} else if (m_name == "split") {
|
||||
argwriteonly (2);
|
||||
} else if (func()->texture_args()) {
|
||||
@@ -1345,8 +1364,8 @@ static const char * builtin_func_args [] = {
|
||||
"printf", "xs*", "!printf", NULL,
|
||||
"psnoise", PNOISE_ARGS, NULL,
|
||||
"random", "f", "c", "p", "v", "n", NULL,
|
||||
"regex_match", "iss", "isi[]s", NULL,
|
||||
"regex_search", "iss", "isi[]s", NULL,
|
||||
"regex_match", "iss", "isi[]s", "!rw", NULL,
|
||||
"regex_search", "iss", "isi[]s", "!rw", NULL,
|
||||
"setmessage", "xs?", "xs?[]", NULL,
|
||||
"sincos", "xfff", "xccc", "xppp", "xvvv", "xnnn", "!rw", NULL,
|
||||
"snoise", NOISE_ARGS, NULL,
|
||||
|
||||
@@ -138,6 +138,14 @@ if (BUILDSTATIC)
|
||||
ADD_LIBRARY ( oslexec STATIC ${liboslexec_srcs} )
|
||||
else ()
|
||||
ADD_LIBRARY ( oslexec SHARED ${liboslexec_srcs} )
|
||||
|
||||
if (VERBOSE)
|
||||
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
|
||||
endif ()
|
||||
set_target_properties( oslexec
|
||||
PROPERTIES
|
||||
VERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION} )
|
||||
endif ()
|
||||
|
||||
TARGET_LINK_LIBRARIES ( oslexec
|
||||
|
||||
@@ -112,10 +112,10 @@ BackendLLVM::llvm_debug() const
|
||||
{
|
||||
if (shadingsys().llvm_debug() == 0)
|
||||
return 0;
|
||||
if (shadingsys().debug_groupname() &&
|
||||
if (!shadingsys().debug_groupname().empty() &&
|
||||
shadingsys().debug_groupname() != group().name())
|
||||
return 0;
|
||||
if (inst() && shadingsys().debug_layername() &&
|
||||
if (inst() && !shadingsys().debug_layername().empty() &&
|
||||
shadingsys().debug_layername() != inst()->layername())
|
||||
return 0;
|
||||
return shadingsys().llvm_debug();
|
||||
|
||||
@@ -386,7 +386,7 @@ DECL (osl_texture_set_subimagename, "xXs")
|
||||
DECL (osl_texture_set_missingcolor_arena, "xXX")
|
||||
DECL (osl_texture_set_missingcolor_alpha, "xXif")
|
||||
DECL (osl_texture, "iXXXXffffffiXXXXXXX")
|
||||
DECL (osl_texture3d, "iXXXXXXXXiXXXXXXXXX")
|
||||
DECL (osl_texture3d, "iXXXXXXXiXXXXXXX")
|
||||
DECL (osl_environment, "iXXXXXXXiXXXXXXX")
|
||||
DECL (osl_get_textureinfo, "iXXXXiiiX")
|
||||
|
||||
|
||||
@@ -2345,7 +2345,7 @@ DECLFOLDER(constfold_getattribute)
|
||||
ustring obj_name;
|
||||
if (object_lookup)
|
||||
obj_name = *(const ustring *)ObjectName.data();
|
||||
if (! obj_name)
|
||||
if (obj_name.empty())
|
||||
return 0;
|
||||
|
||||
found = array_lookup
|
||||
@@ -2539,9 +2539,22 @@ DECLFOLDER(constfold_texture)
|
||||
#endif
|
||||
CHECK_str (width, float, TypeDesc::FLOAT)
|
||||
else CHECK_str (blur, float, TypeDesc::FLOAT)
|
||||
else CHECK_str (wrap, ustring, TypeDesc::STRING)
|
||||
else CHECK (firstchannel, int, TypeDesc::INT)
|
||||
else CHECK (fill, float, TypeDesc::FLOAT)
|
||||
|
||||
else if ((name == Strings::wrap || name == Strings::swrap ||
|
||||
name == Strings::twrap || name == Strings::rwrap)
|
||||
&& value && valuetype == TypeDesc::STRING) {
|
||||
// Special trick is needed for wrap modes because the input
|
||||
// is a string but the field we're setting is an int enum.
|
||||
#if OIIO_VERSION < 10800
|
||||
OIIO::TextureOpt::Wrap wrapmode = OIIO::TextureOpt::decode_wrapmode (*(ustring *)value);
|
||||
#else
|
||||
OIIO::Tex::Wrap wrapmode = OIIO::Tex::decode_wrapmode (*(ustring *)value);
|
||||
#endif
|
||||
void* value = &wrapmode;
|
||||
CHECK_str (wrap, int, TypeDesc::INT);
|
||||
}
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
@@ -2666,7 +2679,7 @@ DECLFOLDER(constfold_pointcloud_search)
|
||||
for (int i = 0; i < nattrs; ++i) {
|
||||
// We had stashed names, data types, and destinations earlier.
|
||||
// Retrieve them now to build a query.
|
||||
if (! names[i])
|
||||
if (names[i].empty())
|
||||
continue;
|
||||
void *const_data = NULL;
|
||||
TypeDesc const_valtype = value_types[i];
|
||||
|
||||
@@ -325,7 +325,7 @@ ShadingContext::osl_get_attribute (ShaderGlobals *sg, void *objdata,
|
||||
bool ok;
|
||||
|
||||
for (auto& f : m_failed_attribs) {
|
||||
if ((obj_name || f.objdata == objdata) &&
|
||||
if ((!obj_name.empty() || f.objdata == objdata) &&
|
||||
f.attr_name == attr_name && f.obj_name == obj_name &&
|
||||
f.attr_type == attr_type && f.array_lookup == array_lookup &&
|
||||
f.index == index && f.objdata) {
|
||||
|
||||
@@ -36,12 +36,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <OpenImageIO/dassert.h>
|
||||
#include <OpenImageIO/strutil.h>
|
||||
|
||||
#ifdef USE_EXTERNAL_PUGIXML
|
||||
# include <pugixml.hpp>
|
||||
#else
|
||||
# include <OpenImageIO/pugixml.hpp>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
#ifdef USING_OIIO_PUGI
|
||||
namespace pugi = OIIO::pugi;
|
||||
#endif
|
||||
|
||||
|
||||
#include "oslexec_pvt.h"
|
||||
|
||||
OSL_NAMESPACE_ENTER
|
||||
@@ -49,12 +50,6 @@ OSL_NAMESPACE_ENTER
|
||||
namespace pvt { // OSL::pvt
|
||||
|
||||
|
||||
#ifndef USE_EXTERNAL_PUGIXML
|
||||
namespace pugi = OIIO::pugi;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Helper class to manage the dictionaries.
|
||||
//
|
||||
// Shaders are written as if they parse arbitrary things from whole
|
||||
|
||||
@@ -246,7 +246,11 @@ ShaderInstance::parameters (const ParamValueList ¶ms)
|
||||
|
||||
if (master()->shadingsys().relaxed_param_typecheck()) {
|
||||
// first handle cases where we actually need to modify the data (like setting a float parameter with an int)
|
||||
if ((paramtype == TypeDesc::FLOAT || paramtype.is_vec3()) && valuetype.basetype == TypeDesc::INT && valuetype.basevalues() == 1) {
|
||||
#if OIIO_VERSION >= 10804
|
||||
if ((paramtype == TypeDesc::FLOAT || paramtype.is_vec3()) && valuetype.basetype == TypeDesc::INT && valuetype.basevalues() == 1) {
|
||||
#else
|
||||
if ((paramtype == TypeDesc::FLOAT || paramtype.is_vec3()) && valuetype.basetype == TypeDesc::INT && valuetype.numelements()*valuetype.aggregate == 1) {
|
||||
#endif
|
||||
int val = *static_cast<const int*>(p.data());
|
||||
float conv = float(val);
|
||||
if (val != int(conv))
|
||||
@@ -264,11 +268,19 @@ ShaderInstance::parameters (const ParamValueList ¶ms)
|
||||
// * if paramtype is sized (or not an array) just check for the total number of entries
|
||||
// * if paramtype is unsized (shader writer is flexible about how many values come in) -- make sure we are a multiple of the target type
|
||||
// * allow a single float setting a vec3 (or equivalent)
|
||||
#if OIIO_VERSION >= 10804
|
||||
if (!( valuetype.basetype == paramtype.basetype &&
|
||||
!valuetype.is_unsized_array() &&
|
||||
((!paramtype.is_unsized_array() && valuetype.basevalues() == paramtype.basevalues()) ||
|
||||
( paramtype.is_unsized_array() && valuetype.basevalues() % paramtype.aggregate == 0) ||
|
||||
( paramtype.is_vec3() && valuetype == TypeDesc::FLOAT) ) )) {
|
||||
#else
|
||||
if (!( valuetype.basetype == paramtype.basetype &&
|
||||
!valuetype.is_unsized_array() &&
|
||||
((!paramtype.is_unsized_array() && valuetype.numelements()*valuetype.aggregate == paramtype.numelements()*paramtype.aggregate) ||
|
||||
( paramtype.is_unsized_array() && valuetype.numelements()*valuetype.aggregate % paramtype.aggregate == 0) ||
|
||||
( paramtype.is_vec3() && valuetype == TypeDesc::FLOAT) ) )) {
|
||||
#endif
|
||||
// We are being very relaxed in this mode, so if the user _still_ got it wrong
|
||||
// something more serious is at play and we should treat it as an error.
|
||||
shadingsys().error ("attempting to set parameter from incompatible type: %s (expected '%s', received '%s')",
|
||||
@@ -313,13 +325,14 @@ ShaderInstance::parameters (const ParamValueList ¶ms)
|
||||
// data offsets to each parameter, we didn't know the length
|
||||
// needed to allocate this param in its proper spot.
|
||||
ASSERT (valuetype.arraylen > 0);
|
||||
int nelements = valuetype.arraylen * valuetype.aggregate;
|
||||
// Store the actual length in the shader instance parameter
|
||||
// override info.
|
||||
so->arraylen (valuetype.arraylen);
|
||||
// override info. Compute the length this way to account for relaxed
|
||||
// parameter checking (for example passing an array of floats to an array of colors)
|
||||
so->arraylen (nelements / paramtype.aggregate);
|
||||
// Allocate space for the new param size at the end of its
|
||||
// usual parameter area, and set the new dataoffset to that
|
||||
// position.
|
||||
int nelements = valuetype.arraylen * valuetype.aggregate;
|
||||
if (paramtype.basetype == TypeDesc::FLOAT) {
|
||||
so->dataoffset((int) m_fparams.size());
|
||||
expand (m_fparams, nelements);
|
||||
|
||||
@@ -323,6 +323,8 @@ LLVMGEN (llvm_gen_printf)
|
||||
std::string ourformat (oldfmt, format); // straddle the format
|
||||
// Doctor it to fix mismatches between format and data
|
||||
Symbol& sym (*rop.opargsym (op, arg));
|
||||
ASSERT (! sym.typespec().is_structure_based());
|
||||
|
||||
TypeDesc simpletype (sym.typespec().simpletype());
|
||||
int num_elements = simpletype.numelements();
|
||||
int num_components = simpletype.aggregate;
|
||||
@@ -2093,7 +2095,7 @@ llvm_gen_texture_options (BackendLLVM &rop, int opnum,
|
||||
ustring name = *(ustring *)Name.data();
|
||||
++a; // advance to next argument
|
||||
|
||||
if (! name) // skip empty string param name
|
||||
if (name.empty()) // skip empty string param name
|
||||
continue;
|
||||
|
||||
Symbol &Val (*rop.opargsym(op,a));
|
||||
@@ -2202,7 +2204,7 @@ llvm_gen_texture_options (BackendLLVM &rop, int opnum,
|
||||
if (name == Strings::subimage && valtype == TypeDesc::STRING) {
|
||||
if (Val.is_constant()) {
|
||||
ustring v = *(ustring *)Val.data();
|
||||
if (! v && ! subimage_set) {
|
||||
if (v.empty() && ! subimage_set) {
|
||||
continue; // Ignore nulls unless they are overrides
|
||||
}
|
||||
}
|
||||
@@ -2390,32 +2392,18 @@ LLVMGEN (llvm_gen_texture3d)
|
||||
if (user_derivs) {
|
||||
args.push_back (rop.llvm_void_ptr (*rop.opargsym (op, 3)));
|
||||
args.push_back (rop.llvm_void_ptr (*rop.opargsym (op, 4)));
|
||||
args.push_back (rop.llvm_void_ptr (*rop.opargsym (op, 5)));
|
||||
} else {
|
||||
// Auto derivs of P
|
||||
args.push_back (rop.llvm_void_ptr (P, 1));
|
||||
args.push_back (rop.llvm_void_ptr (P, 2));
|
||||
// dPdz is correct for input P, zero for all else
|
||||
if (&P == rop.inst()->symbol(rop.inst()->Psym())) {
|
||||
args.push_back (rop.llvm_void_ptr (P, 3));
|
||||
} else {
|
||||
// zero for dPdz, for now
|
||||
llvm::Value *fzero = rop.ll.constant (0.0f);
|
||||
llvm::Value *vzero = rop.ll.op_alloca (rop.ll.type_triple());
|
||||
for (int i = 0; i < 3; ++i)
|
||||
rop.ll.op_store (fzero, rop.ll.GEP (vzero, 0, i));
|
||||
args.push_back (rop.ll.void_ptr(vzero));
|
||||
}
|
||||
}
|
||||
args.push_back (rop.ll.constant (nchans));
|
||||
args.push_back (rop.ll.void_ptr (rop.llvm_void_ptr (Result, 0)));
|
||||
args.push_back (rop.ll.void_ptr (rop.llvm_void_ptr (Result, 1)));
|
||||
args.push_back (rop.ll.void_ptr (rop.llvm_void_ptr (Result, 2)));
|
||||
args.push_back (rop.ll.void_ptr_null()); // no dresultdz for now
|
||||
args.push_back (rop.ll.void_ptr (alpha ? alpha : rop.ll.void_ptr_null()));
|
||||
args.push_back (rop.ll.void_ptr (dalphadx ? dalphadx : rop.ll.void_ptr_null()));
|
||||
args.push_back (rop.ll.void_ptr (dalphady ? dalphady : rop.ll.void_ptr_null()));
|
||||
args.push_back (rop.ll.void_ptr_null()); // No dalphadz for now
|
||||
args.push_back (rop.ll.void_ptr (errormessage ? errormessage : rop.ll.void_ptr_null()));
|
||||
rop.ll.call_function ("osl_texture3d", &args[0], (int)args.size());
|
||||
rop.generated_texture_call (texture_handle != NULL);
|
||||
@@ -2603,7 +2591,7 @@ llvm_gen_noise_options (BackendLLVM &rop, int opnum,
|
||||
Symbol &Val (*rop.opargsym(op,a));
|
||||
TypeDesc valtype = Val.typespec().simpletype ();
|
||||
|
||||
if (! name) // skip empty string param name
|
||||
if (name.empty()) // skip empty string param name
|
||||
continue;
|
||||
|
||||
if (name == Strings::anisotropic && Val.typespec().is_int()) {
|
||||
@@ -2694,7 +2682,7 @@ LLVMGEN (llvm_gen_noise)
|
||||
derivs &= Result.has_derivs(); // ignore derivs if result doesn't need
|
||||
|
||||
bool pass_name = false, pass_sg = false, pass_options = false;
|
||||
if (! name) {
|
||||
if (name.empty()) {
|
||||
// name is not a constant
|
||||
name = periodic ? Strings::genericpnoise : Strings::genericnoise;
|
||||
pass_name = true;
|
||||
|
||||
@@ -88,6 +88,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# include <llvm/Transforms/Scalar/GVN.h>
|
||||
#endif
|
||||
|
||||
#if OSL_LLVM_VERSION >= 70
|
||||
#include <llvm/Transforms/Utils.h>
|
||||
#include <llvm/Transforms/InstCombine/InstCombine.h>
|
||||
#endif
|
||||
|
||||
OSL_NAMESPACE_ENTER
|
||||
|
||||
namespace pvt {
|
||||
@@ -106,6 +111,32 @@ namespace pvt {
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
#if OSL_LLVM_VERSION >= 60
|
||||
// NOTE: This is a COPY of something internal to LLVM, but since we destroy our LLVMMemoryManager
|
||||
// via global variables we can't rely on the LLVM copy sticking around.
|
||||
// Because of this, the variable must be declared _before_ jitmm_hold so that the object stays
|
||||
// valid until after we have destroyed all our memory managers.
|
||||
struct DefaultMMapper final : public llvm::SectionMemoryManager::MemoryMapper {
|
||||
llvm::sys::MemoryBlock
|
||||
allocateMappedMemory(llvm::SectionMemoryManager::AllocationPurpose Purpose,
|
||||
size_t NumBytes, const llvm::sys::MemoryBlock *const NearBlock,
|
||||
unsigned Flags, std::error_code &EC) override {
|
||||
return llvm::sys::Memory::allocateMappedMemory(NumBytes, NearBlock, Flags, EC);
|
||||
}
|
||||
|
||||
std::error_code protectMappedMemory(const llvm::sys::MemoryBlock &Block,
|
||||
unsigned Flags) override {
|
||||
return llvm::sys::Memory::protectMappedMemory(Block, Flags);
|
||||
}
|
||||
|
||||
std::error_code releaseMappedMemory(llvm::sys::MemoryBlock &M) override {
|
||||
return llvm::sys::Memory::releaseMappedMemory(M);
|
||||
}
|
||||
};
|
||||
static DefaultMMapper llvm_default_mapper;
|
||||
#endif
|
||||
|
||||
static OIIO::spin_mutex llvm_global_mutex;
|
||||
static bool setup_done = false;
|
||||
static boost::thread_specific_ptr<LLVM_Util::PerThreadInfo> perthread_infos;
|
||||
@@ -271,14 +302,16 @@ public:
|
||||
virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
|
||||
mm->registerEHFrames (Addr, LoadAddr, Size);
|
||||
}
|
||||
virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
|
||||
#if OSL_LLVM_VERSION < 50
|
||||
virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
|
||||
mm->deregisterEHFrames(Addr, LoadAddr, Size);
|
||||
#else
|
||||
// TODO: verify this is correct
|
||||
mm->deregisterEHFrames();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
virtual void deregisterEHFrames() {
|
||||
mm->deregisterEHFrames();
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual uint64_t getSymbolAddress(const std::string &Name) {
|
||||
return mm->getSymbolAddress (Name);
|
||||
}
|
||||
@@ -329,17 +362,20 @@ LLVM_Util::LLVM_Util (int debuglevel)
|
||||
if (! m_thread->llvm_jitmm) {
|
||||
#if USE_OLD_JIT
|
||||
m_thread->llvm_jitmm = llvm::JITMemoryManager::CreateDefaultMemManager();
|
||||
#elif OSL_LLVM_VERSION >= 60
|
||||
m_thread->llvm_jitmm = new LLVMMemoryManager(&llvm_default_mapper);
|
||||
#else
|
||||
m_thread->llvm_jitmm = new LLVMMemoryManager;
|
||||
m_thread->llvm_jitmm = new LLVMMemoryManager();
|
||||
#endif
|
||||
ASSERT (m_thread->llvm_jitmm);
|
||||
jitmm_hold.push_back (std::shared_ptr<LLVMMemoryManager>(m_thread->llvm_jitmm));
|
||||
jitmm_hold.emplace_back (m_thread->llvm_jitmm);
|
||||
}
|
||||
#if USE_OLD_JIT
|
||||
m_llvm_jitmm = new MemoryManager(m_thread->llvm_jitmm);
|
||||
m_llvm_jitmm = (llvm::SectionMemoryManager*) new MemoryManager(m_thread->llvm_jitmm);
|
||||
#else
|
||||
// Hold the REAL manager and use it as an argument later
|
||||
m_llvm_jitmm = reinterpret_cast<MemoryManager*>(m_thread->llvm_jitmm);
|
||||
// m_llvm_jitmm = reinterpret_cast<MemoryManager*>(m_thread->llvm_jitmm);
|
||||
m_llvm_jitmm = m_thread->llvm_jitmm;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -584,13 +620,14 @@ LLVM_Util::make_jit_execengine (std::string *err)
|
||||
engine_builder.setErrorStr (err);
|
||||
|
||||
#if USE_OLD_JIT
|
||||
engine_builder.setJITMemoryManager (m_llvm_jitmm);
|
||||
engine_builder.setJITMemoryManager ((llvm::JITMemoryManager*)m_llvm_jitmm);
|
||||
// N.B. createJIT will take ownership of the the JITMemoryManager!
|
||||
engine_builder.setUseMCJIT (0);
|
||||
#else
|
||||
// We are actually holding a LLVMMemoryManager
|
||||
engine_builder.setMCJITMemoryManager (std::unique_ptr<llvm::RTDyldMemoryManager>
|
||||
(new MemoryManager(reinterpret_cast<LLVMMemoryManager*>(m_llvm_jitmm))));
|
||||
// (new MemoryManager(reinterpret_cast<LLVMMemoryManager*>(m_llvm_jitmm))));
|
||||
(new MemoryManager(m_llvm_jitmm)));
|
||||
#endif /* USE_OLD_JIT */
|
||||
|
||||
engine_builder.setOptLevel (llvm::CodeGenOpt::Default);
|
||||
@@ -1321,6 +1358,10 @@ LLVM_Util::op_memset (llvm::Value *ptr, int val, int len, int align)
|
||||
void
|
||||
LLVM_Util::op_memset (llvm::Value *ptr, int val, llvm::Value *len, int align)
|
||||
{
|
||||
#if OSL_LLVM_VERSION >= 70
|
||||
builder().CreateMemSet (ptr, builder().getInt8((unsigned char)val),
|
||||
len, (unsigned)align);
|
||||
#else
|
||||
// memset with i32 len
|
||||
// and with an i8 pointer (dst) for LLVM-2.8
|
||||
llvm::Type* types[] = {
|
||||
@@ -1349,6 +1390,7 @@ LLVM_Util::op_memset (llvm::Value *ptr, int val, llvm::Value *len, int align)
|
||||
};
|
||||
builder().CreateCall (func, llvm::ArrayRef<llvm::Value*>(args, 5));
|
||||
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1357,6 +1399,10 @@ LLVM_Util::op_memset (llvm::Value *ptr, int val, llvm::Value *len, int align)
|
||||
void
|
||||
LLVM_Util::op_memcpy (llvm::Value *dst, llvm::Value *src, int len, int align)
|
||||
{
|
||||
#if OSL_LLVM_VERSION >= 70
|
||||
builder().CreateMemCpy (dst, (unsigned)align, src, (unsigned)align,
|
||||
uint64_t(len));
|
||||
#else
|
||||
// i32 len
|
||||
// and with i8 pointers (dst and src) for LLVM-2.8
|
||||
llvm::Type* types[] = {
|
||||
@@ -1380,6 +1426,7 @@ LLVM_Util::op_memcpy (llvm::Value *dst, llvm::Value *src, int len, int align)
|
||||
};
|
||||
builder().CreateCall (func, llvm::ArrayRef<llvm::Value*>(args, 5));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1681,12 +1728,17 @@ LLVM_Util::write_bitcode_file (const char *filename, std::string *err)
|
||||
std::string local_error;
|
||||
llvm::raw_fd_ostream out (filename, err ? *err : local_error, llvm::sys::fs::F_None);
|
||||
#endif
|
||||
llvm::WriteBitcodeToFile (module(), out);
|
||||
|
||||
#if OSL_LLVM_VERSION >= 36
|
||||
if (err && local_error)
|
||||
*err = local_error.message ();
|
||||
if (! out.has_error()) {
|
||||
#if OSL_LLVM_VERSION >= 70
|
||||
llvm::WriteBitcodeToFile (*module(), out);
|
||||
#else
|
||||
llvm::WriteBitcodeToFile (module(), out);
|
||||
#endif
|
||||
#if OSL_LLVM_VERSION >= 36
|
||||
if (err && local_error)
|
||||
*err = local_error.message ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -331,129 +331,106 @@ OSOReaderToMaster::parameter_done ()
|
||||
|
||||
|
||||
|
||||
inline bool
|
||||
starts_with (const std::string &source, const std::string &pattern)
|
||||
{
|
||||
return ! strncmp (source.c_str(), pattern.c_str(), pattern.length());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If the string 'source' begins with 'pattern', erase the pattern from
|
||||
// the start of source and return true. Otherwise, do not alter source
|
||||
// and return false.
|
||||
inline bool
|
||||
extract_prefix (std::string &source, const std::string &pattern)
|
||||
{
|
||||
if (starts_with (source, pattern)) {
|
||||
source.erase (0, pattern.length());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Return the prefix of source that doesn't contain any characters in
|
||||
// 'stop', erase that prefix from source (up to and including the stop
|
||||
// character. Also, the returned string is trimmed of leading and trailing
|
||||
// spaces if 'do_trim' is true.
|
||||
static std::string
|
||||
readuntil (std::string &source, const std::string &stop, bool do_trim=false)
|
||||
{
|
||||
size_t e = source.find_first_of (stop);
|
||||
if (e == source.npos)
|
||||
return std::string ();
|
||||
std::string r (source, 0, e);
|
||||
source.erase (0, e == source.npos ? e : e+1);
|
||||
if (do_trim)
|
||||
r = Strutil::strip (r); // trim whitespace
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
OSOReaderToMaster::hint (string_view hintstring)
|
||||
{
|
||||
std::string h (hintstring); // FIXME -- use string_view ops here
|
||||
if (extract_prefix (h, "%filename{\"")) {
|
||||
m_sourcefile = readuntil (h, "\"");
|
||||
string_view h (hintstring);
|
||||
|
||||
if (Strutil::parse_prefix (h, "%filename{\"")) {
|
||||
m_sourcefile = Strutil::parse_until (h, "\"");
|
||||
return;
|
||||
}
|
||||
if (extract_prefix (h, "%line{")) {
|
||||
m_sourceline = atoi (h.c_str());
|
||||
if (Strutil::parse_prefix (h, "%line{")) {
|
||||
Strutil::parse_int (h, m_sourceline);
|
||||
return;
|
||||
}
|
||||
if (extract_prefix (h, "%structfields{")) {
|
||||
ASSERT (m_master->m_symbols.size() && "structfields hint but no sym");
|
||||
if (Strutil::parse_prefix (h, "%structfields{") && m_master->m_symbols.size()) {
|
||||
Symbol &sym (m_master->m_symbols.back());
|
||||
StructSpec *structspec = sym.typespec().structspec();
|
||||
if (structspec->numfields() == 0) {
|
||||
while (1) {
|
||||
std::string afield = readuntil (h, ",}", true);
|
||||
std::string afield = Strutil::parse_until (h, ",}");
|
||||
Strutil::parse_char (h, ','); // skip the separator
|
||||
if (! afield.length())
|
||||
break;
|
||||
// std::cerr << " struct field " << afield << "\n";
|
||||
structspec->add_field (TypeSpec(), ustring(afield));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (extract_prefix (h, "%mystructfield{")) {
|
||||
ASSERT (m_master->m_symbols.size() && "mystructfield hint but no sym");
|
||||
Symbol &sym (m_master->m_symbols.back());
|
||||
sym.fieldid (atoi(h.c_str()+15));
|
||||
if (Strutil::parse_prefix (h, "%mystructfield{") && m_master->m_symbols.size()) {
|
||||
int ival = -1;
|
||||
if (Strutil::parse_int (h, ival) && ival >= 0)
|
||||
m_master->m_symbols.back().fieldid (ival);
|
||||
return;
|
||||
}
|
||||
if (extract_prefix (h, "%read{")) {
|
||||
ASSERT (m_master->m_symbols.size() && "read hint but no sym");
|
||||
if (Strutil::parse_prefix (h, "%read{") && m_master->m_symbols.size()) {
|
||||
Symbol &sym (m_master->m_symbols.back());
|
||||
int first, last;
|
||||
sscanf (h.c_str(), "%d,%d", &first, &last);
|
||||
sym.set_read (first, last);
|
||||
if (Strutil::parse_int (h, first) && Strutil::parse_char(h, ',')
|
||||
&& Strutil::parse_int (h, last))
|
||||
sym.set_read (first, last);
|
||||
return;
|
||||
}
|
||||
if (extract_prefix (h, "%write{")) {
|
||||
ASSERT (m_master->m_symbols.size() && "write hint but no sym");
|
||||
if (Strutil::parse_prefix (h, "%write{") && m_master->m_symbols.size()) {
|
||||
Symbol &sym (m_master->m_symbols.back());
|
||||
int first, last;
|
||||
sscanf (h.c_str(), "%d,%d", &first, &last);
|
||||
sym.set_write (first, last);
|
||||
if (Strutil::parse_int (h, first) && Strutil::parse_char(h, ',')
|
||||
&& Strutil::parse_int (h, last))
|
||||
sym.set_write (first, last);
|
||||
return;
|
||||
}
|
||||
if (extract_prefix(h, "%argrw{")) {
|
||||
const char* str = h.c_str();
|
||||
ASSERT(*str == '\"');
|
||||
str++; // skip open quote
|
||||
size_t i = 0;
|
||||
for (; *str != '\"'; i++, str++) {
|
||||
ASSERT(*str == 'r' || *str == 'w' || *str == 'W' || *str == '-');
|
||||
m_master->m_ops.back().argwrite(i, *str == 'w' || *str =='W');
|
||||
m_master->m_ops.back().argread(i, *str == 'r' || *str =='W');
|
||||
if (Strutil::parse_prefix(h, "%argrw{") && m_master->m_ops.size()) {
|
||||
Opcode &op (m_master->m_ops.back());
|
||||
string_view str = Strutil::parse_until (h, "}");
|
||||
Strutil::parse_string (str, str, false, Strutil::DeleteQuotes);
|
||||
if (str.size() != m_nargs) {
|
||||
m_shadingsys.error ("Parsing shader %s: malformed hint '%s' on op %s line %d",
|
||||
m_master->shadername(), hintstring,
|
||||
m_master->m_ops.back().opname(), m_sourceline);
|
||||
m_errors = true;
|
||||
}
|
||||
for (size_t i = 0; str.size() && i < m_nargs; i++, str.remove_prefix(1)) {
|
||||
char c = str.front();
|
||||
op.argwrite (i, c == 'w' || c =='W');
|
||||
op.argread (i, c == 'r' || c =='W');
|
||||
}
|
||||
ASSERT(m_nargs == i);
|
||||
// Fix old bug where oslc forgot to mark getmatrix last arg as write
|
||||
ustring opname = m_master->m_ops.back().opname();
|
||||
static ustring getmatrix("getmatrix");
|
||||
if (m_master->m_ops.back().opname() == getmatrix)
|
||||
m_master->m_ops.back().argwrite(m_nargs-1, true);
|
||||
if (opname == getmatrix)
|
||||
m_master->m_ops.back().argwriteonly (m_nargs-1);
|
||||
// Fix old bug where oslc forgot to mark regex results as write.
|
||||
// This was a bug prior to 1.10.
|
||||
static ustring regex_search("regex_search");
|
||||
static ustring regex_match("regex_match");
|
||||
if (opname == regex_search || opname == regex_search)
|
||||
m_master->m_ops.back().argwriteonly (2);
|
||||
return;
|
||||
}
|
||||
if (extract_prefix(h, "%argderivs{")) {
|
||||
if (Strutil::parse_prefix(h, "%argderivs{")) {
|
||||
while (1) {
|
||||
std::string afield = readuntil (h, ",}", true);
|
||||
string_view afield = Strutil::parse_until (h, ",}");
|
||||
Strutil::parse_char (h, ','); // skip the separator
|
||||
if (! afield.length())
|
||||
break;
|
||||
int arg = atoi (afield.c_str());
|
||||
if (arg >= 0)
|
||||
int arg = -1;
|
||||
if (Strutil::parse_int (afield, arg) && arg >= 0)
|
||||
m_master->m_ops.back().argtakesderivs (arg, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (extract_prefix (h, "%meta{") && m_master->m_symbols.size()) {
|
||||
if (Strutil::parse_prefix (h, "%meta{") && m_master->m_symbols.size()) {
|
||||
Symbol &sym (m_master->m_symbols.back());
|
||||
int lockval = -1;
|
||||
int ok = sscanf (h.c_str(), " int , lockgeom , %d", &lockval);
|
||||
if (ok)
|
||||
sym.lockgeom (lockval);
|
||||
int ival = -1;
|
||||
TypeDesc type (Strutil::parse_identifier (h, "", true));
|
||||
Strutil::parse_char (h, ',');
|
||||
string_view ident = Strutil::parse_identifier (h, "", true);
|
||||
Strutil::parse_char (h, ',');
|
||||
if (type == TypeDesc::TypeInt && ident == "lockgeom"
|
||||
&& Strutil::parse_int (h, ival) && ival >= 0)
|
||||
sym.lockgeom (ival);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +474,7 @@ OSOReaderToMaster::codeend ()
|
||||
// If we were previously chalking up the code to init ops for a
|
||||
// symbol, mark the end.
|
||||
m_master->symbol(m_codesym)->initend (nextop);
|
||||
} else if (m_codesection && m_codesection == "___main___") {
|
||||
} else if (m_codesection == "___main___") {
|
||||
// If we were previously reading ops for the ___main___ entry
|
||||
// point, mark its end properly.
|
||||
m_master->m_maincodeend = nextop;
|
||||
|
||||
@@ -106,7 +106,7 @@ Parser::buildStop(LPexp *etype, LPexp *scatter, const std::list<LPexp*> &custom)
|
||||
LPexp *
|
||||
Parser::parseSymbol()
|
||||
{
|
||||
bool iscustom;
|
||||
bool iscustom = false;
|
||||
ustring sym = parseRawSymbol(iscustom);
|
||||
if (m_ingroup) {
|
||||
if (sym == udot)
|
||||
|
||||
@@ -264,7 +264,7 @@ ShaderMaster::print ()
|
||||
for (size_t j = 0; j < Opcode::max_jumps; ++j)
|
||||
if (m_ops[i].jump(j) >= 0)
|
||||
out << " " << m_ops[i].jump(j);
|
||||
if (m_ops[i].sourcefile())
|
||||
if (!m_ops[i].sourcefile().empty())
|
||||
out << "\t(" << m_ops[i].sourcefile() << ":"
|
||||
<< m_ops[i].sourceline() << ")";
|
||||
out << "\n";
|
||||
|
||||
@@ -259,7 +259,7 @@ osl_texture (void *sg_, const char *name, void *handle,
|
||||
// and ensure that they're being put in aligned memory.
|
||||
OIIO::simd::float4 result_simd, dresultds_simd, dresultdt_simd;
|
||||
bool ok = sg->renderer->texture (USTR(name),
|
||||
(TextureSystem::TextureHandle *)handle, NULL,
|
||||
(TextureSystem::TextureHandle *)handle, sg->context->texture_thread_info(),
|
||||
*opt, sg, s, t, dsdx, dtdx, dsdy, dtdy, 4,
|
||||
(float *)&result_simd,
|
||||
derivs ? (float *)&dresultds_simd : NULL,
|
||||
@@ -294,18 +294,15 @@ osl_texture (void *sg_, const char *name, void *handle,
|
||||
|
||||
OSL_SHADEOP int
|
||||
osl_texture3d (void *sg_, const char *name, void *handle,
|
||||
void *opt_, void *P_,
|
||||
void *dPdx_, void *dPdy_, void *dPdz_, int chans,
|
||||
void *result, void *dresultdx,
|
||||
void *dresultdy, void *dresultdz,
|
||||
void *alpha, void *dalphadx,
|
||||
void *dalphady, void *dalphadz,
|
||||
void *opt_, void *P_, void *dPdx_, void *dPdy_,
|
||||
int chans,
|
||||
void *result, void *dresultdx, void *dresultdy,
|
||||
void *alpha , void *dalphadx , void *dalphady ,
|
||||
ustring *errormessage)
|
||||
{
|
||||
const Vec3 &P (*(Vec3 *)P_);
|
||||
const Vec3 &dPdx (*(Vec3 *)dPdx_);
|
||||
const Vec3 &dPdy (*(Vec3 *)dPdy_);
|
||||
const Vec3 &dPdz (*(Vec3 *)dPdz_);
|
||||
ShaderGlobals *sg = (ShaderGlobals *)sg_;
|
||||
TextureOpt *opt = (TextureOpt *)opt_;
|
||||
bool derivs = (dresultdx != NULL || dalphadx != NULL);
|
||||
@@ -313,12 +310,12 @@ osl_texture3d (void *sg_, const char *name, void *handle,
|
||||
// and ensure that they're being put in aligned memory.
|
||||
OIIO::simd::float4 result_simd, dresultds_simd, dresultdt_simd, dresultdr_simd;
|
||||
bool ok = sg->renderer->texture3d (USTR(name),
|
||||
(TextureSystem::TextureHandle *)handle, NULL,
|
||||
*opt, sg, P, dPdx, dPdy, dPdz,
|
||||
(TextureSystem::TextureHandle *)handle, sg->context->texture_thread_info(),
|
||||
*opt, sg, P, dPdx, dPdy, Vec3(0),
|
||||
4, (float *)&result_simd,
|
||||
derivs ? (float *)&dresultds_simd : NULL,
|
||||
derivs ? (float *)&dresultdt_simd : NULL,
|
||||
derivs ? (float *)&dresultdr_simd : NULL,
|
||||
derivs ? (float *)&dresultds_simd : nullptr,
|
||||
derivs ? (float *)&dresultdt_simd : nullptr,
|
||||
derivs ? (float *)&dresultdr_simd : nullptr,
|
||||
errormessage);
|
||||
|
||||
for (int i = 0; i < chans; ++i)
|
||||
@@ -330,19 +327,15 @@ osl_texture3d (void *sg_, const char *name, void *handle,
|
||||
if (derivs) {
|
||||
OIIO::simd::float4 dresultdx_simd = dresultds_simd * dPdx[0] + dresultdt_simd * dPdx[1] + dresultdr_simd * dPdx[2];
|
||||
OIIO::simd::float4 dresultdy_simd = dresultds_simd * dPdy[0] + dresultdt_simd * dPdy[1] + dresultdr_simd * dPdy[2];
|
||||
OIIO::simd::float4 dresultdz_simd = dresultds_simd * dPdz[0] + dresultdt_simd * dPdz[1] + dresultdr_simd * dPdz[2];
|
||||
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];
|
||||
for (int i = 0; i < chans; ++i)
|
||||
((float *)dresultdz)[i] = dresultdz_simd[i];
|
||||
}
|
||||
if (dalphadx) {
|
||||
((float *)dalphadx)[0] = dresultdx_simd[chans];
|
||||
((float *)dalphady)[0] = dresultdy_simd[chans];
|
||||
((float *)dalphadz)[0] = dresultdz_simd[chans];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +364,7 @@ osl_environment (void *sg_, const char *name, void *handle,
|
||||
OIIO::simd::float4 local_result;
|
||||
bool ok = sg->renderer->environment (USTR(name),
|
||||
(TextureSystem::TextureHandle *)handle,
|
||||
NULL, *opt, sg, R, dRdx, dRdy, 4,
|
||||
sg->context->texture_thread_info(), *opt, sg, R, dRdx, dRdy, 4,
|
||||
(float *)&local_result, NULL, NULL,
|
||||
errormessage);
|
||||
|
||||
|
||||
@@ -770,6 +770,7 @@ private:
|
||||
bool m_debug_uninit; ///< Find use of uninitialized vars?
|
||||
bool m_lockgeom_default; ///< Default value of lockgeom
|
||||
bool m_strict_messages; ///< Strict checking of message passing usage?
|
||||
bool m_error_repeats; ///< Allow repeats of identical err/warn?
|
||||
bool m_range_checking; ///< Range check arrays & components?
|
||||
bool m_unknown_coordsys_error; ///< Error to use unknown xform name?
|
||||
bool m_connection_error; ///< Error for ConnectShaders to fail?
|
||||
@@ -1312,6 +1313,13 @@ public:
|
||||
m_current_block = 0;
|
||||
}
|
||||
|
||||
// avoid 'attempting to reference a deleted function' of std::unique_ptr<char>s
|
||||
// in reference to those member variables of ShadingContext
|
||||
SimplePool(const SimplePool &) = delete;
|
||||
SimplePool(SimplePool &&) = delete;
|
||||
SimplePool &operator=(const SimplePool &) = delete;
|
||||
SimplePool &&operator=(SimplePool &&) = delete;
|
||||
|
||||
~SimplePool() {}
|
||||
|
||||
char * alloc(size_t size, size_t alignment=1) {
|
||||
@@ -1614,7 +1622,7 @@ public:
|
||||
|
||||
ClosureComponent * closure_component_allot(int id, size_t prim_size, const Color3 &w) {
|
||||
// Allocate the component and the mul back to back
|
||||
size_t needed = sizeof(ClosureComponent) - sizeof(void*) + prim_size;
|
||||
size_t needed = sizeof(ClosureComponent) + prim_size;
|
||||
ClosureComponent *comp = (ClosureComponent *) m_closure_pool.alloc(needed, alignof(ClosureComponent));
|
||||
comp->id = id;
|
||||
comp->w = w;
|
||||
@@ -1845,14 +1853,6 @@ private:
|
||||
// Buffering of error messages and printfs
|
||||
typedef std::pair<ErrorHandler::ErrCode, std::string> ErrorItem;
|
||||
mutable std::vector<ErrorItem> m_buffered_errors;
|
||||
|
||||
// Calculate offset needed to align ClosureComponent's mem to a given alignment.
|
||||
inline size_t closure_alignment_offset_calc(size_t alignment) {
|
||||
return alignment == 1
|
||||
? 0
|
||||
: alignment - (reckless_offsetof(ClosureComponent, mem) & (alignment - 1));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -117,6 +117,12 @@ using namespace OSL::pvt;
|
||||
#define isatty _isatty
|
||||
#endif
|
||||
|
||||
// flex itself will generate fatal warnings about signed vs unsigned.
|
||||
// Bypass that nonsense.
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 7
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
/* Declare modes */
|
||||
|
||||
@@ -91,7 +91,7 @@ struct SortedPointCompare {
|
||||
PointCloud *
|
||||
PointCloud::get (ustring filename, bool write)
|
||||
{
|
||||
if (! filename)
|
||||
if (filename.empty())
|
||||
return NULL;
|
||||
spin_lock lock (pointcloudmap_mutex);
|
||||
PointCloudMap::const_iterator found = pointclouds.find(filename);
|
||||
@@ -139,7 +139,7 @@ PointCloud::PointCloud (ustring filename,
|
||||
PointCloud::~PointCloud ()
|
||||
{
|
||||
// Save the file if we wrote to it
|
||||
if (m_write && m_filename)
|
||||
if (m_write && !m_filename.empty())
|
||||
Partio::write (m_filename.c_str(), *m_partio_cloud);
|
||||
if (m_partio_cloud)
|
||||
m_partio_cloud->release ();
|
||||
@@ -238,7 +238,7 @@ RendererServices::pointcloud_search (ShaderGlobals *sg,
|
||||
float *out_distances, int derivs_offset)
|
||||
{
|
||||
#if USE_PARTIO
|
||||
if (! filename)
|
||||
if (filename.empty())
|
||||
return 0;
|
||||
PointCloud *pc = PointCloud::get(filename);
|
||||
if (pc == NULL) { // The file failed to load
|
||||
@@ -408,7 +408,7 @@ RendererServices::pointcloud_write (ShaderGlobals *sg,
|
||||
const void **data)
|
||||
{
|
||||
#if USE_PARTIO
|
||||
if (! filename)
|
||||
if (filename.empty())
|
||||
return false;
|
||||
PointCloud *pc = PointCloud::get(filename, true /* create file to write */);
|
||||
spin_lock lock (pc->m_mutex);
|
||||
|
||||
@@ -125,7 +125,7 @@ RuntimeOptimizer::RuntimeOptimizer (ShadingSystemImpl &shadingsys,
|
||||
m_stop_optimizing(false),
|
||||
m_raytypes_on(group.raytypes_on()), m_raytypes_off(group.raytypes_off())
|
||||
{
|
||||
memset (&m_shaderglobals, 0, sizeof(ShaderGlobals));
|
||||
memset ((char *)&m_shaderglobals, 0, sizeof(ShaderGlobals));
|
||||
m_shaderglobals.context = shadingcontext();
|
||||
}
|
||||
|
||||
@@ -169,15 +169,15 @@ OSOProcessorBase::set_debug ()
|
||||
|
||||
// If either group or layer was specified for debug, surely they want
|
||||
// debugging turned on.
|
||||
if (shadingsys().debug_groupname() || shadingsys().debug_layername())
|
||||
if (!shadingsys().debug_groupname().empty() || !shadingsys().debug_layername().empty())
|
||||
m_debug = std::max (m_debug, 1);
|
||||
|
||||
// Force debugging off if a specific group was selected for debug
|
||||
// and we're not it, or a specific layer was selected for debug and
|
||||
// we're not it.
|
||||
bool wronggroup = (shadingsys().debug_groupname() &&
|
||||
bool wronggroup = (!shadingsys().debug_groupname().empty() &&
|
||||
shadingsys().debug_groupname() != group().name());
|
||||
bool wronglayer = (shadingsys().debug_layername() && inst() &&
|
||||
bool wronglayer = (!shadingsys().debug_layername().empty() && inst() &&
|
||||
shadingsys().debug_layername() != inst()->layername());
|
||||
if (wronggroup || wronglayer)
|
||||
m_debug = 0;
|
||||
@@ -192,7 +192,7 @@ RuntimeOptimizer::set_debug ()
|
||||
|
||||
// If a specific group is isolated for debugging and the
|
||||
// 'optimize_dondebug' flag is on, fully optimize all other groups.
|
||||
if (shadingsys().debug_groupname() &&
|
||||
if (!shadingsys().debug_groupname().empty() &&
|
||||
shadingsys().debug_groupname() != group().name()) {
|
||||
if (shadingsys().m_optimize_nondebug) {
|
||||
// Debugging trick: if user said to only debug one group, turn
|
||||
@@ -2250,7 +2250,7 @@ void
|
||||
RuntimeOptimizer::optimize_instance ()
|
||||
{
|
||||
// If "opt_layername" attribute is set, only optimize the named layer
|
||||
if (shadingsys().m_opt_layername &&
|
||||
if (!shadingsys().m_opt_layername.empty() &&
|
||||
shadingsys().m_opt_layername != inst()->layername())
|
||||
return;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ shade_image (ShadingSystem &shadingsys, ShaderGroup &group,
|
||||
const ShaderSymbol **output_sym = OIIO_ALLOCA(const ShaderSymbol*, outputs.size());
|
||||
TypeDesc *output_type = OIIO_ALLOCA(TypeDesc, outputs.size());
|
||||
int *output_nchans = OIIO_ALLOCA(int, outputs.size());
|
||||
for (size_t i = 0; i < outputs.size(); ++i) {
|
||||
for (int i = 0; i < int(outputs.size()); ++i) {
|
||||
output_sym[i] = shadingsys.find_symbol (group, outputs[i]);
|
||||
output_type[i] = shadingsys.symbol_typedesc (output_sym[i]);
|
||||
output_nchans[i] = output_type[i].numelements() * output_type[i].aggregate;
|
||||
@@ -127,10 +127,10 @@ shade_image (ShadingSystem &shadingsys, ShaderGroup &group,
|
||||
if (defaultsg) {
|
||||
// If the caller passed a default SG template, use it to initialize
|
||||
// the sg and in particular to set all the constant fields.
|
||||
memcpy (&sg, defaultsg, sizeof(ShaderGlobals));
|
||||
memcpy ((char *)&sg, (const char*)defaultsg, sizeof(ShaderGlobals));
|
||||
} else {
|
||||
// No SG template was passed, so set up reasonable defaults.
|
||||
memset (&sg, 0, sizeof(ShaderGlobals));
|
||||
memset ((char *)&sg, 0, sizeof(ShaderGlobals));
|
||||
// Set "shader" space to be Mshad. In a real renderer, this may be
|
||||
// different for each shader group.
|
||||
sg.shader2common = OSL::TransformationPtr (&Mshad);
|
||||
@@ -185,7 +185,7 @@ shade_image (ShadingSystem &shadingsys, ShaderGroup &group,
|
||||
|
||||
// Save all the designated outputs.
|
||||
int chan = 0;
|
||||
for (size_t i = 0; i < outputs.size(); ++i) {
|
||||
for (int i = 0; i < int(outputs.size()); ++i) {
|
||||
const void *data = shadingsys.symbol_address (*ctx, output_sym[i]);
|
||||
if (!data)
|
||||
continue; // Skip if symbol isn't found
|
||||
|
||||
@@ -648,6 +648,7 @@ ShadingSystemImpl::ShadingSystemImpl (RendererServices *renderer,
|
||||
m_lazy_userdata(false), m_userdata_isconnected(false),
|
||||
m_clearmemory (false), m_debugnan (false), m_debug_uninit(false),
|
||||
m_lockgeom_default (true), m_strict_messages(true),
|
||||
m_error_repeats(false),
|
||||
m_range_checking(true),
|
||||
m_unknown_coordsys_error(true), m_connection_error(true),
|
||||
m_greedyjit(false), m_countlayerexecs(false),
|
||||
@@ -1142,6 +1143,14 @@ ShadingSystemImpl::attribute (string_view name, TypeDesc type,
|
||||
m_renderer_outputs.emplace_back(((const char **)val)[i]);
|
||||
return true;
|
||||
}
|
||||
if (name == "error_repeats") {
|
||||
// Special case: setting error_repeats also clears the "previously
|
||||
// seen" error and warning lists.
|
||||
m_errseen.clear();
|
||||
m_warnseen.clear();
|
||||
ATTR_SET ("error_repeats", int, m_error_repeats);
|
||||
}
|
||||
|
||||
return false;
|
||||
#undef ATTR_SET
|
||||
#undef ATTR_SET_STRING
|
||||
@@ -1165,6 +1174,7 @@ ShadingSystemImpl::getattribute (string_view name, TypeDesc type,
|
||||
}
|
||||
|
||||
lock_guard guard (m_mutex); // Thread safety
|
||||
|
||||
ATTR_DECODE_STRING ("searchpath:shader", m_searchpath);
|
||||
ATTR_DECODE ("statistics:level", int, m_statslevel);
|
||||
ATTR_DECODE ("lazylayers", int, m_lazylayers);
|
||||
@@ -1202,6 +1212,7 @@ ShadingSystemImpl::getattribute (string_view name, TypeDesc type,
|
||||
ATTR_DECODE ("llvm_debug_layers", int, m_llvm_debug_layers);
|
||||
ATTR_DECODE ("llvm_debug_ops", int, m_llvm_debug_ops);
|
||||
ATTR_DECODE ("strict_messages", int, m_strict_messages);
|
||||
ATTR_DECODE ("error_repeats", int, m_error_repeats);
|
||||
ATTR_DECODE ("range_checking", int, m_range_checking);
|
||||
ATTR_DECODE ("unknown_coordsys_error", int, m_unknown_coordsys_error);
|
||||
ATTR_DECODE ("connection_error", int, m_connection_error);
|
||||
@@ -1514,7 +1525,7 @@ ShadingSystemImpl::error (const std::string &msg) const
|
||||
lock_guard guard (m_errmutex);
|
||||
int n = 0;
|
||||
for (auto&& s : m_errseen) {
|
||||
if (s == msg)
|
||||
if (s == msg && !m_error_repeats)
|
||||
return;
|
||||
++n;
|
||||
}
|
||||
@@ -1532,7 +1543,7 @@ ShadingSystemImpl::warning (const std::string &msg) const
|
||||
lock_guard guard (m_errmutex);
|
||||
int n = 0;
|
||||
for (auto&& s : m_warnseen) {
|
||||
if (s == msg)
|
||||
if (s == msg && !m_error_repeats)
|
||||
return;
|
||||
++n;
|
||||
}
|
||||
@@ -1600,8 +1611,8 @@ ShadingSystemImpl::getstats (int level) const
|
||||
out << "OSL ShadingSystem statistics (" << (void*)this;
|
||||
out << ") ver " << OSL_LIBRARY_VERSION_STRING
|
||||
<< ", LLVM " << OSL_LLVM_FULL_VERSION << "\n";
|
||||
if (m_stat_shaders_requested == 0) {
|
||||
out << " No shaders requested\n";
|
||||
if (m_stat_shaders_requested == 0 && m_stat_shaders_loaded == 0) {
|
||||
out << " No shaders requested or loaded\n";
|
||||
return out.str();
|
||||
}
|
||||
|
||||
@@ -1626,6 +1637,7 @@ ShadingSystemImpl::getstats (int level) const
|
||||
BOOLOPT (debug_uninit);
|
||||
BOOLOPT (lockgeom_default);
|
||||
BOOLOPT (strict_messages);
|
||||
BOOLOPT (error_repeats);
|
||||
BOOLOPT (range_checking);
|
||||
BOOLOPT (greedyjit);
|
||||
BOOLOPT (countlayerexecs);
|
||||
@@ -2664,7 +2676,7 @@ ShadingSystemImpl::optimize_group (ShaderGroup &group)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_only_groupname && m_only_groupname != group.name()) {
|
||||
if (!m_only_groupname.empty() && m_only_groupname != group.name()) {
|
||||
// For debugging purposes, we are requested to compile only one
|
||||
// shader group, and this is not it. Mark it as does_nothing,
|
||||
// and also as optimized so nobody locks on it again, and record
|
||||
@@ -3098,6 +3110,19 @@ OSL::OSLQuery::init (const ShaderGroup *group, int layernum)
|
||||
p.fdefault.clear();
|
||||
p.sdefault.clear();
|
||||
p.spacename.clear();
|
||||
int n = int (p.type.numelements() * p.type.aggregate);
|
||||
if (p.type.basetype == TypeDesc::INT) {
|
||||
for (int i = 0; i < n; ++i)
|
||||
p.idefault.push_back (sym->get_int(i));
|
||||
}
|
||||
if (p.type.basetype == TypeDesc::FLOAT) {
|
||||
for (int i = 0; i < n; ++i)
|
||||
p.fdefault.push_back (sym->get_float(i));
|
||||
}
|
||||
if (p.type.basetype == TypeDesc::STRING) {
|
||||
for (int i = 0; i < n; ++i)
|
||||
p.sdefault.push_back (sym->get_string(i));
|
||||
}
|
||||
p.fields.clear(); // don't bother filling this out
|
||||
if (StructSpec *ss = ts.structspec()) {
|
||||
p.structname = ss->name().string();
|
||||
|
||||
@@ -7,6 +7,14 @@ if (BUILDSTATIC)
|
||||
ADD_LIBRARY ( oslnoise STATIC ${liboslnoise_srcs} )
|
||||
else ()
|
||||
ADD_LIBRARY ( oslnoise SHARED ${liboslnoise_srcs} )
|
||||
|
||||
if (VERBOSE)
|
||||
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
|
||||
endif ()
|
||||
set_target_properties( oslnoise
|
||||
PROPERTIES
|
||||
VERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION} )
|
||||
endif ()
|
||||
|
||||
TARGET_LINK_LIBRARIES ( oslnoise ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
|
||||
|
||||
@@ -409,6 +409,14 @@ getargs (int argc, const char *argv[])
|
||||
int
|
||||
main (int argc, char const *argv[])
|
||||
{
|
||||
#if !defined(NDEBUG) || defined(OIIO_CI) || defined(OIIO_CODE_COVERAGE)
|
||||
// For the sake of test time, reduce the default iterations for DEBUG,
|
||||
// CI, and code coverage builds. Explicit use of --iters or --trials
|
||||
// will override this, since it comes before the getargs() call.
|
||||
iterations /= 10;
|
||||
ntrials = 1;
|
||||
#endif
|
||||
|
||||
getargs (argc, argv);
|
||||
|
||||
test_perlin ();
|
||||
|
||||
@@ -10,6 +10,14 @@ if (BUILDSTATIC)
|
||||
ADD_LIBRARY ( oslquery STATIC ${liboslquery_srcs} )
|
||||
else ()
|
||||
ADD_LIBRARY ( oslquery SHARED ${liboslquery_srcs} )
|
||||
|
||||
if (VERBOSE)
|
||||
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
|
||||
endif ()
|
||||
set_target_properties( oslquery
|
||||
PROPERTIES
|
||||
VERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION} )
|
||||
endif ()
|
||||
|
||||
TARGET_LINK_LIBRARIES ( oslquery ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} )
|
||||
|
||||
@@ -267,6 +267,99 @@ OSOReaderQuery::codemarker (const char *name)
|
||||
|
||||
|
||||
|
||||
OSLQuery::Parameter::Parameter (const Parameter& src)
|
||||
: name(src.name), type(src.type), isoutput(src.isoutput),
|
||||
validdefault(src.validdefault), varlenarray(src.varlenarray),
|
||||
isstruct(src.isstruct), isclosure(src.isclosure),
|
||||
idefault(src.idefault), fdefault(src.fdefault),
|
||||
sdefault(src.sdefault), spacename(src.spacename),
|
||||
fields(src.fields), structname(src.structname),
|
||||
metadata(src.metadata)
|
||||
{
|
||||
if (type.basetype == TypeDesc::INT)
|
||||
data = idefault.data();
|
||||
else if (type.basetype == TypeDesc::FLOAT)
|
||||
data = fdefault.data();
|
||||
else if (type.basetype == TypeDesc::STRING)
|
||||
data = sdefault.data();
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSLQuery::Parameter::Parameter (Parameter&& src)
|
||||
: name(src.name), type(src.type), isoutput(src.isoutput),
|
||||
validdefault(src.validdefault), varlenarray(src.varlenarray),
|
||||
isstruct(src.isstruct), isclosure(src.isclosure),
|
||||
idefault(src.idefault), fdefault(src.fdefault),
|
||||
sdefault(src.sdefault), spacename(src.spacename),
|
||||
fields(src.fields), structname(src.structname),
|
||||
metadata(src.metadata)
|
||||
{
|
||||
if (type.basetype == TypeDesc::INT)
|
||||
data = idefault.data();
|
||||
else if (type.basetype == TypeDesc::FLOAT)
|
||||
data = fdefault.data();
|
||||
else if (type.basetype == TypeDesc::STRING)
|
||||
data = sdefault.data();
|
||||
}
|
||||
|
||||
|
||||
|
||||
const OSLQuery::Parameter&
|
||||
OSLQuery::Parameter::operator= (const Parameter& src)
|
||||
{
|
||||
name = src.name;
|
||||
type = src.type;
|
||||
isoutput = src.isoutput;
|
||||
validdefault = src.validdefault;
|
||||
varlenarray = src.varlenarray;
|
||||
isstruct = src.isstruct;
|
||||
isclosure = src.isclosure;
|
||||
idefault = src.idefault;
|
||||
fdefault = src.fdefault;
|
||||
sdefault = src.sdefault;
|
||||
spacename = src.spacename;
|
||||
fields = src.fields;
|
||||
structname = src.structname;
|
||||
metadata = src.metadata;
|
||||
if (type.basetype == TypeDesc::INT)
|
||||
data = idefault.data();
|
||||
else if (type.basetype == TypeDesc::FLOAT)
|
||||
data = fdefault.data();
|
||||
else if (type.basetype == TypeDesc::STRING)
|
||||
data = sdefault.data();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const OSLQuery::Parameter&
|
||||
OSLQuery::Parameter::operator= (Parameter&& src)
|
||||
{
|
||||
name = src.name;
|
||||
type = src.type;
|
||||
isoutput = src.isoutput;
|
||||
validdefault = src.validdefault;
|
||||
varlenarray = src.varlenarray;
|
||||
isstruct = src.isstruct;
|
||||
isclosure = src.isclosure;
|
||||
idefault = std::move(src.idefault);
|
||||
fdefault = std::move(src.fdefault);
|
||||
sdefault = std::move(src.sdefault);
|
||||
spacename = src.spacename;
|
||||
fields = src.fields;
|
||||
structname = src.structname;
|
||||
metadata = std::move(src.metadata);
|
||||
if (type.basetype == TypeDesc::INT)
|
||||
data = idefault.data();
|
||||
else if (type.basetype == TypeDesc::FLOAT)
|
||||
data = fdefault.data();
|
||||
else if (type.basetype == TypeDesc::STRING)
|
||||
data = sdefault.data();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSLQuery::OSLQuery ()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,15 @@ macro (add_oiio_plugin)
|
||||
add_library (${_target_name} SHARED ${_plugin_UNPARSED_ARGUMENTS})
|
||||
target_link_libraries (${_target_name} ${OPENIMAGEIO_LIBRARIES} ${_plugin_LINK_LIBRARIES})
|
||||
set_target_properties (${_target_name} PROPERTIES PREFIX "" FOLDER "Plugins")
|
||||
|
||||
if (VERBOSE)
|
||||
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
|
||||
endif ()
|
||||
set_target_properties( ${_target_name}
|
||||
PROPERTIES
|
||||
VERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION} )
|
||||
|
||||
install_targets (${_target_name})
|
||||
endmacro ()
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
virtual bool close ();
|
||||
virtual int current_subimage (void) const { return m_subimage; }
|
||||
virtual int current_miplevel (void) const { return m_miplevel; }
|
||||
#if OIIO_PLUGIN_VERSION < 21 /* OIIO < 1.9 */
|
||||
virtual bool seek_subimage (int subimage, int miplevel, ImageSpec &newspec);
|
||||
virtual bool read_native_scanline (int y, int z, void *data);
|
||||
virtual bool read_native_scanlines (int ybegin, int yend, int z,
|
||||
@@ -110,6 +111,19 @@ public:
|
||||
virtual bool read_native_tile (int x, int y, int z, void *data);
|
||||
virtual bool read_native_tiles (int xbegin, int xend, int ybegin, int yend,
|
||||
int zbegin, int zend, void *data);
|
||||
#else
|
||||
virtual bool seek_subimage (int subimage, int miplevel);
|
||||
virtual bool read_native_scanline (int subimage, int miplevel,
|
||||
int y, int z, void *data);
|
||||
virtual bool read_native_scanlines (int subimage, int miplevel,
|
||||
int ybegin, int yend, int z,
|
||||
void *data);
|
||||
virtual bool read_native_tile (int subimage, int miplevel,
|
||||
int x, int y, int z, void *data);
|
||||
virtual bool read_native_tiles (int subimage, int miplevel,
|
||||
int xbegin, int xend, int ybegin, int yend,
|
||||
int zbegin, int zend, void *data);
|
||||
#endif
|
||||
private:
|
||||
std::string m_filename; ///< Stash the filename
|
||||
ShaderGroupRef m_group;
|
||||
@@ -227,7 +241,7 @@ static ErrorRecorder errhandler;
|
||||
static void
|
||||
setup_shadingsys ()
|
||||
{
|
||||
lock_guard lock (shading_mutex);
|
||||
OIIO::lock_guard lock (shading_mutex);
|
||||
if (! shadingsys) {
|
||||
renderer = new OIIO_RendererServices (TextureSystem::create(true));
|
||||
shadingsys = new ShadingSystem (renderer, NULL, &errhandler);
|
||||
@@ -490,14 +504,14 @@ OSLInput::open (const std::string &name, ImageSpec &newspec,
|
||||
}
|
||||
// std::cout << "Processing group specification:\n---\n"
|
||||
// << groupspec << "\n---\n";
|
||||
lock_guard lock (shading_mutex);
|
||||
OIIO::lock_guard lock (shading_mutex);
|
||||
m_group = shadingsys->ShaderGroupBegin ("", "surface", groupspec);
|
||||
if (! m_group)
|
||||
return false; // Failed
|
||||
shadingsys->ShaderGroupEnd ();
|
||||
}
|
||||
if (Strutil::ends_with (shadername, ".oso")) { // Compiled shader
|
||||
lock_guard lock (shading_mutex);
|
||||
OIIO::lock_guard lock (shading_mutex);
|
||||
shadername.remove_suffix (4);
|
||||
m_group = shadingsys->ShaderGroupBegin ();
|
||||
for (size_t p = 0, np = m_topspec.extra_attribs.size(); p < np; ++p) {
|
||||
@@ -515,7 +529,7 @@ OSLInput::open (const std::string &name, ImageSpec &newspec,
|
||||
if (Strutil::ends_with (shadername, ".osl")) { // shader source
|
||||
}
|
||||
if (Strutil::ends_with (shadername, ".oslbody")) { // shader source
|
||||
lock_guard lock (shading_mutex);
|
||||
OIIO::lock_guard lock (shading_mutex);
|
||||
shadername.remove_suffix (8);
|
||||
static int exprcount = 0;
|
||||
std::string exprname = OIIO::Strutil::format("expr_%d", exprcount++);
|
||||
@@ -554,7 +568,16 @@ OSLInput::open (const std::string &name, ImageSpec &newspec,
|
||||
TypeDesc(TypeDesc::STRING,m_outputs.size()),
|
||||
&m_outputs[0]);
|
||||
|
||||
#if OIIO_PLUGIN_VERSION < 21
|
||||
return ok && seek_subimage (0, 0, newspec);
|
||||
#else
|
||||
ok &= seek_subimage (0, 0);
|
||||
if (ok)
|
||||
newspec = spec();
|
||||
else
|
||||
close ();
|
||||
return ok;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -569,10 +592,16 @@ OSLInput::close ()
|
||||
|
||||
|
||||
bool
|
||||
OSLInput::seek_subimage (int subimage, int miplevel, ImageSpec &newspec)
|
||||
OSLInput::seek_subimage (int subimage, int miplevel
|
||||
#if OIIO_PLUGIN_VERSION < 21
|
||||
, ImageSpec &newspec
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (subimage == current_subimage() && miplevel == current_miplevel()) {
|
||||
#if OIIO_PLUGIN_VERSION < 21
|
||||
newspec = spec();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -593,15 +622,27 @@ OSLInput::seek_subimage (int subimage, int miplevel, ImageSpec &newspec)
|
||||
m_spec.full_height = m_spec.height;
|
||||
m_spec.full_depth = m_spec.depth;
|
||||
}
|
||||
#if OIIO_PLUGIN_VERSION < 21
|
||||
newspec = spec();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
OSLInput::read_native_scanlines (int ybegin, int yend, int z, void *data)
|
||||
OSLInput::read_native_scanlines (
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
int subimage, int miplevel,
|
||||
#endif
|
||||
int ybegin, int yend, int z, void *data)
|
||||
{
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
lock_guard lock (m_mutex);
|
||||
if (! seek_subimage (subimage, miplevel))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Create an ImageBuf wrapper of the user's data
|
||||
ImageSpec spec = m_spec; // Make a spec that describes just this scanline
|
||||
spec.y = ybegin;
|
||||
@@ -622,17 +663,35 @@ OSLInput::read_native_scanlines (int ybegin, int yend, int z, void *data)
|
||||
|
||||
|
||||
bool
|
||||
OSLInput::read_native_scanline (int y, int z, void *data)
|
||||
OSLInput::read_native_scanline (
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
int subimage, int miplevel,
|
||||
#endif
|
||||
int y, int z, void *data)
|
||||
{
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
return read_native_scanlines (subimage, miplevel, y, y+1, z, data);
|
||||
#else
|
||||
return read_native_scanlines (y, y+1, z, data);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
OSLInput::read_native_tiles (int xbegin, int xend, int ybegin, int yend,
|
||||
OSLInput::read_native_tiles (
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
int subimage, int miplevel,
|
||||
#endif
|
||||
int xbegin, int xend, int ybegin, int yend,
|
||||
int zbegin, int zend, void *data)
|
||||
{
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
lock_guard lock (m_mutex);
|
||||
if (! seek_subimage (subimage, miplevel))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Create an ImageBuf wrapper of the user's data
|
||||
ImageSpec spec = m_spec; // Make a spec that describes just this scanline
|
||||
spec.x = xbegin;
|
||||
@@ -655,10 +714,24 @@ OSLInput::read_native_tiles (int xbegin, int xend, int ybegin, int yend,
|
||||
|
||||
|
||||
bool
|
||||
OSLInput::read_native_tile (int x, int y, int z, void *data)
|
||||
OSLInput::read_native_tile (
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
int subimage, int miplevel,
|
||||
#endif
|
||||
int x, int y, int z, void *data)
|
||||
{
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
lock_guard lock (m_mutex);
|
||||
if (! seek_subimage (subimage, miplevel))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return
|
||||
read_native_tiles (x, std::min (x+m_spec.tile_width, m_spec.x+m_spec.width),
|
||||
read_native_tiles (
|
||||
#if OIIO_PLUGIN_VERSION >= 21
|
||||
subimage, miplevel,
|
||||
#endif
|
||||
x, std::min (x+m_spec.tile_width, m_spec.x+m_spec.width),
|
||||
y, std::min (y+m_spec.tile_height, m_spec.y+m_spec.height),
|
||||
z, std::min (z+m_spec.tile_depth, m_spec.z+m_spec.depth),
|
||||
data);
|
||||
|
||||
+26
-12
@@ -118,13 +118,17 @@ main (int argc, const char *argv[])
|
||||
|
||||
OIIO::Filesystem::convert_native_arguments (argc, (const char **)argv);
|
||||
|
||||
std::vector<std::string> args;
|
||||
bool quiet = false;
|
||||
|
||||
if (argc <= 1) {
|
||||
usage ();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
std::vector<std::string> args;
|
||||
bool quiet = false;
|
||||
std::string shader_path;
|
||||
|
||||
// Parse arguments from command line
|
||||
for (int a = 1; a < argc; ++a) {
|
||||
if (! strcmp (argv[a], "--help") | ! strcmp (argv[a], "-h")) {
|
||||
usage ();
|
||||
@@ -141,6 +145,7 @@ main (int argc, const char *argv[])
|
||||
quiet |= (strcmp (argv[a], "-q") == 0);
|
||||
}
|
||||
else if (! strcmp (argv[a], "-o") && a < argc-1) {
|
||||
// Output filepath
|
||||
args.emplace_back(argv[a]);
|
||||
++a;
|
||||
args.emplace_back(argv[a]);
|
||||
@@ -150,18 +155,27 @@ main (int argc, const char *argv[])
|
||||
args.emplace_back(argv[a]);
|
||||
}
|
||||
else {
|
||||
OSLCompiler compiler (&default_oslc_error_handler);
|
||||
bool ok = compiler.compile (argv[a], args);
|
||||
if (ok) {
|
||||
if (!quiet)
|
||||
std::cout << "Compiled " << argv[a] << " -> "
|
||||
<< compiler.output_filename() << "\n";
|
||||
} else {
|
||||
std::cout << "FAILED " << argv[a] << "\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
// Shader to compile
|
||||
shader_path = argv[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (shader_path.empty ()) {
|
||||
std::cout << "ERROR: Missing shader path" << "\n\n";
|
||||
usage ();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
OSLCompiler compiler (&default_oslc_error_handler);
|
||||
bool ok = compiler.compile (shader_path, args);
|
||||
if (ok) {
|
||||
if (!quiet)
|
||||
std::cout << "Compiled " << shader_path << " -> " << compiler.output_filename() << "\n";
|
||||
}
|
||||
else {
|
||||
std::cout << "FAILED " << shader_path << "\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -98,26 +98,40 @@ endmacro()
|
||||
|
||||
# MX shaders that come in flavors for all color/vector types, and float.
|
||||
make_mx_flavors (
|
||||
mx_absval.mx mx_add.mx mx_blur.mx mx_clamp.mx mx_compare.mx
|
||||
mx_constant.mx mx_contrast.mx mx_divide.mx mx_dot.mx
|
||||
mx_exponent.mx mx_floor.mx mx_fractal3d.mx mx_geomattrvalue.mx
|
||||
mx_image.mx mx_invert.mx mx_max.mx mx_min.mx mx_mix.mx
|
||||
mx_modulo.mx mx_multiply.mx mx_noise2d.mx mx_noise3d.mx
|
||||
mx_absval.mx mx_acos.mx mx_asin.mx mx_atan2.mx
|
||||
mx_blur.mx mx_ceil.mx mx_clamp.mx mx_compare.mx
|
||||
mx_constant.mx mx_contrast.mx mx_cos.mx mx_dot.mx
|
||||
mx_exp.mx mx_power.mx mx_floor.mx mx_fractal3d.mx mx_geomattrvalue.mx
|
||||
mx_image.mx mx_invert.mx mx_ln.mx mx_max.mx mx_min.mx mx_mix.mx
|
||||
mx_modulo.mx mx_noise2d.mx mx_noise3d.mx
|
||||
mx_ramp4.mx mx_ramplr.mx mx_ramptb.mx mx_remap.mx
|
||||
mx_smoothstep.mx mx_splitlr.mx mx_splittb.mx mx_subtract.mx
|
||||
mx_sign.mx mx_sin.mx mx_smoothstep.mx mx_splitlr.mx
|
||||
mx_splittb.mx mx_sqrt.mx
|
||||
mx_switch.mx mx_swizzle_color.mx mx_swizzle_color2.mx
|
||||
mx_swizzle_color4.mx mx_swizzle_vector.mx mx_swizzle_vector2.mx
|
||||
mx_swizzle_vector4.mx mx_triplanarprojection.mx
|
||||
mx_swizzle_vector4.mx mx_tan.mx mx_tiledimage.mx
|
||||
mx_triplanarprojection.mx
|
||||
TYPES float color color2 color4 vector vector2 vector4)
|
||||
|
||||
# MX shaders that come in flavors for all float-based types
|
||||
make_mx_flavors (
|
||||
mx_add.mx mx_divide.mx mx_multiply.mx mx_subtract.mx
|
||||
TYPES float color color2 color4 vector vector2 vector4 matrix33 matrix44)
|
||||
|
||||
# MX shaders that come in flavors for all color, vector, matrix types
|
||||
make_mx_flavors (
|
||||
mx_add_float.mx mx_divide_float.mx
|
||||
mx_multiply_float.mx mx_subtract_float.mx
|
||||
TYPES color color2 color4 vector vector2 vector4 matrix33 matrix44)
|
||||
|
||||
# MX shaders that come in flavors for all color/vector types.
|
||||
make_mx_flavors (
|
||||
mx_add_float.mx mx_clamp_float.mx mx_contrast_float.mx
|
||||
mx_divide_float.mx mx_exponent_float.mx mx_fractal3d_fa.mx
|
||||
mx_atan2_float.mx mx_clamp_float.mx mx_contrast_float.mx
|
||||
mx_extract.mx mx_power_float.mx mx_fractal3d_fa.mx
|
||||
mx_invert_float.mx mx_max_float.mx mx_min_float.mx
|
||||
mx_modulo_float.mx mx_multiply_float.mx mx_noise2d_fa.mx
|
||||
mx_noise3d_fa.mx mx_pack.mx mx_remap_float.mx
|
||||
mx_smoothstep_float.mx mx_subtract_float.mx mx_swizzle_float.mx
|
||||
mx_modulo_float.mx mx_noise2d_fa.mx
|
||||
mx_noise3d_fa.mx mx_remap_float.mx mx_separate.mx
|
||||
mx_smoothstep_float.mx mx_swizzle_float.mx
|
||||
TYPES color color2 color4 vector vector2 vector4)
|
||||
|
||||
# MX shaders that come in flavors for all color types, and float
|
||||
@@ -134,13 +148,16 @@ make_mx_flavors (mx_cellnoise2d.mx TYPES float)
|
||||
make_mx_flavors (mx_cellnoise3d.mx TYPES float)
|
||||
make_mx_flavors (mx_constant.mx TYPES matrix44 matrix33 string filename bool int)
|
||||
make_mx_flavors (mx_crossproduct.mx TYPES vector)
|
||||
make_mx_flavors (mx_determinant.mx TYPES matrix44 matrix33)
|
||||
make_mx_flavors (mx_disjointover.mx TYPES color2 color4)
|
||||
make_mx_flavors (mx_dot.mx TYPES matrix44 matrix33 string filename bool int surfaceshader)
|
||||
make_mx_flavors (mx_dotproduct.mx TYPES vector vector2 vector4)
|
||||
make_mx_flavors (mx_frame.mx TYPES float)
|
||||
make_mx_flavors (mx_geomattrvalue.mx TYPES int bool string)
|
||||
make_mx_flavors (mx_heighttonormal.mx TYPES vector)
|
||||
make_mx_flavors (mx_hueshift.mx TYPES color color4)
|
||||
make_mx_flavors (mx_hsvadjust.mx TYPES color color4)
|
||||
make_mx_flavors (mx_hsvtorgb.mx TYPES color color4)
|
||||
make_mx_flavors (mx_hueshift.mx TYPES color color4) # DEPRECATED in MX 1.36
|
||||
make_mx_flavors (mx_in.mx TYPES color2 color4)
|
||||
make_mx_flavors (mx_luminance.mx TYPES color color4)
|
||||
make_mx_flavors (mx_magnitude.mx TYPES vector vector2 vector4)
|
||||
@@ -152,19 +169,26 @@ make_mx_flavors (mx_normal.mx TYPES vector)
|
||||
make_mx_flavors (mx_normalize.mx TYPES vector vector2 vector4)
|
||||
make_mx_flavors (mx_out.mx TYPES color2 color4)
|
||||
make_mx_flavors (mx_over.mx TYPES color2 color4)
|
||||
make_mx_flavors (mx_pack_cc.mx TYPES color4)
|
||||
make_mx_flavors (mx_pack_cf.mx TYPES color4)
|
||||
make_mx_flavors (mx_pack_vf.mx TYPES vector4)
|
||||
make_mx_flavors (mx_pack_vv.mx TYPES vector4)
|
||||
make_mx_flavors (mx_combine_cc.mx TYPES color4)
|
||||
make_mx_flavors (mx_combine_cf.mx TYPES color4)
|
||||
make_mx_flavors (mx_combine_vf.mx TYPES vector4)
|
||||
make_mx_flavors (mx_combine_vv.mx TYPES vector4)
|
||||
make_mx_flavors (mx_position.mx TYPES vector)
|
||||
make_mx_flavors (mx_premult.mx TYPES color color2 color4)
|
||||
make_mx_flavors (mx_rotate2d.mx TYPES vector2)
|
||||
make_mx_flavors (mx_rgbtohsv.mx TYPES color color4)
|
||||
make_mx_flavors (mx_rotate.mx TYPES vector vector2)
|
||||
make_mx_flavors (mx_rotate2d.mx TYPES vector2) # DEPRECATED in MX 1.36
|
||||
make_mx_flavors (mx_saturate.mx TYPES color color4)
|
||||
make_mx_flavors (mx_scale.mx TYPES vector vector2)
|
||||
make_mx_flavors (mx_tangent.mx TYPES vector)
|
||||
make_mx_flavors (mx_texcoord.mx TYPES vector vector2)
|
||||
make_mx_flavors (mx_time.mx TYPES float)
|
||||
make_mx_flavors (mx_transformpoint.mx TYPES vector vector4)
|
||||
make_mx_flavors (mx_transformvector.mx TYPES vector vector4)
|
||||
make_mx_flavors (mx_transformnormal.mx TYPES vector vector4)
|
||||
make_mx_flavors (mx_transpose.mx TYPES matrix44 matrix33)
|
||||
make_mx_flavors (mx_unpremult.mx TYPES color color2 color4)
|
||||
make_mx_flavors (mx_matrix_invert.mx TYPES matrix44 matrix33)
|
||||
|
||||
|
||||
add_custom_target (mxshaders ALL
|
||||
|
||||
@@ -190,36 +190,52 @@ replacements = {
|
||||
)
|
||||
}
|
||||
|
||||
ALL_TYPES = ['float', 'color', 'color2', 'color4', 'vector', 'vector2', 'vector4']
|
||||
COL_TYPES = ['color', 'color2', 'color4']
|
||||
VEC_TYPES = ['vector', 'vector2', 'vector4']
|
||||
MAT_TYPES = ['matrix33', 'matrix44']
|
||||
CV_TYPES = COL_TYPES + VEC_TYPES
|
||||
CVF_TYPES = CV_TYPES + ['float']
|
||||
EXTRA_TYPES = ['matrix44', 'matrix33', 'string', 'filename', 'bool', 'int', 'surfaceshader']
|
||||
|
||||
BUILD_DICT = {
|
||||
'mx_absval': ALL_TYPES,
|
||||
'mx_add': ALL_TYPES + ['surfaceshader'],
|
||||
'mx_add_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_absval': CVF_TYPES,
|
||||
'mx_acos' : CVF_TYPES,
|
||||
'mx_add': CVF_TYPES + ['matrix33', 'matrix44', 'surfaceshader'],
|
||||
'mx_add_float': CV_TYPES + MAT_TYPES,
|
||||
'mx_asin' : CVF_TYPES,
|
||||
'mx_atan2' : CVF_TYPES,
|
||||
'mx_atan2_float' : CVF_TYPES,
|
||||
'mx_ambientocclusion': ['float'],
|
||||
'mx_bitangent': ['vector'],
|
||||
'mx_blur': ALL_TYPES,
|
||||
'mx_blur': CVF_TYPES,
|
||||
'mx_burn': ['float', 'color', 'color2', 'color4'],
|
||||
'mx_ceil' : CVF_TYPES,
|
||||
'mx_cellnoise2d': ['float'],
|
||||
'mx_cellnoise3d': ['float'],
|
||||
'mx_clamp': ALL_TYPES,
|
||||
'mx_clamp_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_compare': ALL_TYPES,
|
||||
'mx_constant': ALL_TYPES + ['matrix44', 'matrix33', 'string', 'filename', 'bool', 'int'],
|
||||
'mx_clamp': CVF_TYPES,
|
||||
'mx_clamp_float': CV_TYPES,
|
||||
'mx_compare': CVF_TYPES,
|
||||
'mx_constant': CVF_TYPES + ['matrix44', 'matrix33', 'string', 'filename', 'bool', 'int'],
|
||||
'mx_cos': CVF_TYPES,
|
||||
'mx_crossproduct': ['vector'],
|
||||
'mx_determinant' : MAT_TYPES,
|
||||
'mx_dodge': ['float', 'color', 'color2', 'color4'],
|
||||
'mx_dotproduct': ['vector', 'vector2', 'vector4'],
|
||||
'mx_dot': ALL_TYPES + ['matrix44', 'matrix33', 'string', 'filename', 'bool', 'int', 'surfaceshader'],
|
||||
'mx_floor': ALL_TYPES,
|
||||
'mx_dotproduct': VEC_TYPES,
|
||||
'mx_dot': CVF_TYPES + ['matrix44', 'matrix33', 'string', 'filename', 'bool', 'int', 'surfaceshader'],
|
||||
'mx_exp' : CVF_TYPES + ['int'],
|
||||
'mx_extract' : CV_TYPES,
|
||||
'mx_floor': CVF_TYPES,
|
||||
'mx_frame': ['float'],
|
||||
'mx_geomattrvalue': ALL_TYPES + ['bool', 'string', 'int'],
|
||||
'mx_geomattrvalue': CVF_TYPES + ['bool', 'string', 'int'],
|
||||
'mx_geomcolor': ['float', 'color', 'color2', 'color4'],
|
||||
'mx_heighttonormal': ['vector'],
|
||||
'mx_hueshift': ['color', 'color4'],
|
||||
'mx_image': ALL_TYPES,
|
||||
'mx_max': ALL_TYPES,
|
||||
'mx_min': ALL_TYPES,
|
||||
'mx_hsvadjust' : ['color', 'color4'],
|
||||
'mx_hsvtorgb' : ['color', 'color4'],
|
||||
'mx_hueshift': ['color', 'color4'], # DEPRECATED in MX 1.36
|
||||
'mx_image': CVF_TYPES,
|
||||
'mx_ln' : CVF_TYPES + ['int'],
|
||||
'mx_max': CVF_TYPES,
|
||||
'mx_min': CVF_TYPES,
|
||||
'mx_overlay': ['float', 'color', 'color2', 'color4'],
|
||||
'mx_screen': ['float', 'color', 'color2', 'color4'],
|
||||
'mx_inside': ['float','color', 'color2', 'color4'],
|
||||
@@ -230,68 +246,81 @@ BUILD_DICT = {
|
||||
'mx_matte': ['color2', 'color4'],
|
||||
'mx_out': ['color2', 'color4'],
|
||||
'mx_over': ['color2', 'color4'],
|
||||
'mx_mix': ALL_TYPES + ['surfaceshader'],
|
||||
'mx_fractal3d': ALL_TYPES,
|
||||
'mx_fractal3d_fa':['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_contrast': ALL_TYPES,
|
||||
'mx_contrast_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_smoothstep': ALL_TYPES,
|
||||
'mx_smoothstep_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_divide': ALL_TYPES,
|
||||
'mx_divide_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_exponent': ALL_TYPES,
|
||||
'mx_exponent_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_invert': ALL_TYPES,
|
||||
'mx_invert_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_mix': CVF_TYPES + ['surfaceshader'],
|
||||
'mx_fractal3d': CVF_TYPES,
|
||||
'mx_fractal3d_fa':CV_TYPES,
|
||||
'mx_contrast': CVF_TYPES,
|
||||
'mx_contrast_float': CV_TYPES,
|
||||
'mx_smoothstep': CVF_TYPES,
|
||||
'mx_smoothstep_float': CV_TYPES,
|
||||
'mx_divide': CVF_TYPES + MAT_TYPES,
|
||||
'mx_divide_float': CV_TYPES + MAT_TYPES,
|
||||
'mx_power': CVF_TYPES,
|
||||
'mx_power_float': CV_TYPES,
|
||||
'mx_invert': CVF_TYPES,
|
||||
'mx_invert_float': CV_TYPES,
|
||||
'mx_luminance': ['color', 'color4'],
|
||||
'mx_magnitude': ['vector', 'vector2', 'vector4'],
|
||||
'mx_max': ALL_TYPES,
|
||||
'mx_max_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_min': ALL_TYPES,
|
||||
'mx_min_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_modulo': ALL_TYPES,
|
||||
'mx_modulo_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_multiply': ALL_TYPES,
|
||||
'mx_multiply_float':['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_noise2d': ALL_TYPES,
|
||||
'mx_noise2d_fa':['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_noise3d': ALL_TYPES,
|
||||
'mx_noise3d_fa':['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_magnitude': VEC_TYPES,
|
||||
'mx_max': CVF_TYPES,
|
||||
'mx_max_float': CV_TYPES,
|
||||
'mx_min': CVF_TYPES,
|
||||
'mx_min_float': CV_TYPES,
|
||||
'mx_modulo': CVF_TYPES,
|
||||
'mx_modulo_float': CV_TYPES,
|
||||
'mx_multiply': CVF_TYPES + MAT_TYPES,
|
||||
'mx_multiply_float': CV_TYPES + MAT_TYPES,
|
||||
'mx_noise2d': CVF_TYPES,
|
||||
'mx_noise2d_fa':CV_TYPES,
|
||||
'mx_noise3d': CVF_TYPES,
|
||||
'mx_noise3d_fa':CV_TYPES,
|
||||
'mx_normal': ['vector'],
|
||||
'mx_normalize': ['vector', 'vector2', 'vector4'],
|
||||
'mx_pack': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_pack_cf': ['color4'],
|
||||
'mx_pack_cc': ['color4'],
|
||||
'mx_pack_vf': ['vector4'],
|
||||
'mx_pack_vv': ['vector4'],
|
||||
'mx_normalize': VEC_TYPES,
|
||||
'mx_combine': CV_TYPES,
|
||||
'mx_combine_cf': ['color4'],
|
||||
'mx_combine_cc': ['color4'],
|
||||
'mx_combine_vf': ['vector4'],
|
||||
'mx_combine_vv': ['vector4'],
|
||||
'mx_position': ['vector'],
|
||||
'mx_premult': ['color', 'color2', 'color4'],
|
||||
'mx_ramp4': ALL_TYPES,
|
||||
'mx_ramplr': ALL_TYPES,
|
||||
'mx_ramptb': ALL_TYPES,
|
||||
'mx_remap': ALL_TYPES,
|
||||
'mx_remap_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_premult': COL_TYPES,
|
||||
'mx_ramp4': CVF_TYPES,
|
||||
'mx_ramplr': CVF_TYPES,
|
||||
'mx_ramptb': CVF_TYPES,
|
||||
'mx_remap': CVF_TYPES,
|
||||
'mx_remap_float': CV_TYPES,
|
||||
'mx_rgbtohsv' : ['color', 'color4'],
|
||||
'mx_rotate': ['vector', 'vector2'], # Deprecated in MX 1.36
|
||||
'mx_rotate2d': ['vector2'],
|
||||
'mx_saturate': ['color', 'color4'],
|
||||
'mx_scale': ['vector', 'vector2'],
|
||||
'mx_splitlr': ALL_TYPES,
|
||||
'mx_splittb': ALL_TYPES,
|
||||
'mx_subtract': ALL_TYPES,
|
||||
'mx_subtract_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_swizzle_float': ['color', 'color2', 'color4', 'vector', 'vector2', 'vector4'],
|
||||
'mx_swizzle_color': ALL_TYPES,
|
||||
'mx_swizzle_color2': ALL_TYPES,
|
||||
'mx_swizzle_color4': ALL_TYPES,
|
||||
'mx_swizzle_vector': ALL_TYPES,
|
||||
'mx_swizzle_vector2': ALL_TYPES,
|
||||
'mx_swizzle_vector4': ALL_TYPES,
|
||||
'mx_switch': ALL_TYPES,
|
||||
'mx_separate': CV_TYPES,
|
||||
'mx_sign': CVF_TYPES,
|
||||
'mx_sin': CVF_TYPES,
|
||||
'mx_splitlr': CVF_TYPES,
|
||||
'mx_splittb': CVF_TYPES,
|
||||
'mx_sqrt' : CVF_TYPES,
|
||||
'mx_subtract': CVF_TYPES + MAT_TYPES,
|
||||
'mx_subtract_float': CV_TYPES + MAT_TYPES,
|
||||
'mx_swizzle_float': CV_TYPES,
|
||||
'mx_swizzle_color': CVF_TYPES,
|
||||
'mx_swizzle_color2': CVF_TYPES,
|
||||
'mx_swizzle_color4': CVF_TYPES,
|
||||
'mx_swizzle_vector': CVF_TYPES,
|
||||
'mx_swizzle_vector2': CVF_TYPES,
|
||||
'mx_swizzle_vector4': CVF_TYPES,
|
||||
'mx_switch': CVF_TYPES,
|
||||
'mx_tan': CVF_TYPES,
|
||||
'mx_tangent': ['vector'],
|
||||
'mx_texcoord': ['vector', 'vector2'],
|
||||
'mx_tiledimage': CVF_TYPES,
|
||||
'mx_time': ['float'],
|
||||
'mx_triplanarprojection': ALL_TYPES,
|
||||
'mx_unpremult': ['color', 'color2', 'color4'],
|
||||
'mx_mult_surfaceshader': ['color', 'float']
|
||||
'mx_transformpoint' : ['vector', 'vector4'],
|
||||
'mx_transformvector' : ['vector', 'vector4'],
|
||||
'mx_transformnormal' : ['vector', 'vector4'],
|
||||
'mx_transpose' : MAT_TYPES,
|
||||
'mx_triplanarprojection': CVF_TYPES,
|
||||
'mx_unpremult': COL_TYPES,
|
||||
'mx_mult_surfaceshader': ['color', 'float'],
|
||||
'mx_matrix_invert' : MAT_TYPES,
|
||||
}
|
||||
|
||||
# open_mx_file: open a file on disk and return its contents
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_acos_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" acos(in)" ]]
|
||||
(
|
||||
TYPE in = TYPE_DEFAULT_IN,
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = acos(in);
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
|
||||
shader mx_add_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" add in2 to the incoming data" ]]
|
||||
(
|
||||
@@ -14,5 +15,5 @@ shader mx_add_TYPE_SUFFIX
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = in1 + in2;
|
||||
out = mx_add (in1, in2);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
@@ -14,5 +14,5 @@ shader mx_add_float_TYPE_SUFFIX
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = in1 + in2;
|
||||
out = mx_add (in1, in2);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_asin_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" asin(in)" ]]
|
||||
(
|
||||
TYPE in = TYPE_DEFAULT_IN,
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = asin(in);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_atan2_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" atan2(in1, in2)" ]]
|
||||
(
|
||||
TYPE in1 = TYPE_DEFAULT_IN,
|
||||
TYPE in2 = TYPE_DEFAULT_IN,
|
||||
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = atan2(in1, in2);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_atan2_float_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" atan2(in1, in2)" ]]
|
||||
(
|
||||
TYPE in1 = TYPE_DEFAULT_IN,
|
||||
float in2 = 0.0,
|
||||
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = atan2(in1, in2);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_ceil_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" Find the smallest integer less than or equal to the parameter." ]]
|
||||
(
|
||||
TYPE in = TYPE_DEFAULT_IN,
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = ceil(in);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_pack_TYPE_SUFFIX
|
||||
[[ string help = "Pack the channels from two, three or four streams into the same number of channels of a \
|
||||
[[ string help = "Combine the channels from two, three or four streams into the same number of channels of a \
|
||||
single stream of a specified compatible type;" ]]
|
||||
(
|
||||
float in1 = 0,
|
||||
@@ -18,5 +18,5 @@ shader mx_pack_TYPE_SUFFIX
|
||||
output TYPE out = TYPE_ZERO
|
||||
)
|
||||
{
|
||||
out = pack (in1, in2, in3, in4);
|
||||
out = combine (in1, in2, in3, in4);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_pack_cc_TYPE_SUFFIX
|
||||
[[ string help = "Pack the channels from two, three or four streams into the same number of channels of a \
|
||||
shader mx_combine_cc_TYPE_SUFFIX
|
||||
[[ string help = "Combine the channels from two, three or four streams into the same number of channels of a \
|
||||
single stream of a specified compatible type;" ]]
|
||||
(
|
||||
color2 in1 = {0,0},
|
||||
@@ -1,13 +1,13 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_pack_cf_TYPE_SUFFIX
|
||||
[[ string help = "Pack the channels from two, three or four streams into the same number of channels of a \
|
||||
shader mx_combine_cf_TYPE_SUFFIX
|
||||
[[ string help = "Combine the channels from two, three or four streams into the same number of channels of a \
|
||||
single stream of a specified compatible type;" ]]
|
||||
(
|
||||
color in1 = 0,
|
||||
@@ -1,13 +1,13 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_pack_vf_TYPE_SUFFIX
|
||||
[[ string help = "Pack the channels from two, three or four streams into the same number of channels of a \
|
||||
shader mx_combine_vf_TYPE_SUFFIX
|
||||
[[ string help = "Combine the channels from two, three or four streams into the same number of channels of a \
|
||||
single stream of a specified compatible type;" ]]
|
||||
(
|
||||
vector in1 = 0,
|
||||
@@ -1,13 +1,13 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_pack_vv_TYPE_SUFFIX
|
||||
[[ string help = "Pack the channels from two, three or four streams into the same number of channels of a \
|
||||
shader mx_combine_vv_TYPE_SUFFIX
|
||||
[[ string help = "Combine the channels from two, three or four streams into the same number of channels of a \
|
||||
single stream of a specified compatible type;" ]]
|
||||
(
|
||||
vector2 in1 = {0,0},
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_cos_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" cos(in)" ]]
|
||||
(
|
||||
TYPE in = TYPE_DEFAULT_IN,
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = cos(in);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader mx_determinant_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" the determinant of matrix in" ]]
|
||||
(
|
||||
TYPE in = TYPE_DEFAULT_IN,
|
||||
output float out = 0
|
||||
)
|
||||
{
|
||||
out = determinant(in);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
shader exp_TYPE_SUFFIX
|
||||
[[ string help = TYPE_STR" e(in)" ]]
|
||||
(
|
||||
TYPE in = TYPE_DEFAULT_IN,
|
||||
output TYPE out = TYPE_DEFAULT_OUT
|
||||
)
|
||||
{
|
||||
out = exp(in);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
|
||||
shader mx_extract_TYPE_SUFFIX
|
||||
[[ string help = "Generate a float from an aggregate (vector, color, etc.)" ]]
|
||||
(
|
||||
TYPE in = TYPE_ZERO,
|
||||
int index = 0,
|
||||
output float out = 0
|
||||
)
|
||||
{
|
||||
out = extract (in, index);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Open Shading Language : Copyright (c) 2009-2017 Sony Pictures Imageworks Inc., et al.
|
||||
// https://github.com/imageworks/OpenShadingLanguage/blob/master/LICENSE
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
//
|
||||
// MaterialX specification (c) 2017 Lucasfilm Ltd.
|
||||
// http://www.materialx.org/
|
||||
|
||||
#include "mx_funcs.h"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user