Compare commits

...
85 Commits
Author SHA1 Message Date
Larry Gritz 63d1e4e2e1 Changes, Release 1.9.13 2018-12-01 18:00:52 -08:00
Larry Gritz 51092ded43 Fix crash with struct parameter assignment from function call. (#934)
Edge case that triggered an assert.
2018-11-20 10:50:32 -08:00
Christopher Kulla 2ace988c8d Fix texture3d lookups with derivatives (#932)
One side was trying to make use of dresultdz while the llvm codegen was always providing nullptr. Since the shading system only supports Dual2 at the moment for derivative lookups, it seems more consistent to forget about trying to come up with a meaningful Z derivative for the time being.
2018-11-08 10:35:25 -08:00
Larry Gritz 8b8069ca90 Bump version after release 2018-10-29 15:56:24 -07:00
Larry Gritz d85c0f152e Rebuild PDF docs 2018-10-29 15:56:24 -07:00
Larry Gritz b775e752eb Adjust Travis builds 2018-10-29 15:14:37 -07:00
Larry Gritz 01bce8a720 CHANGES 2018-10-29 15:14:28 -07:00
Larry Gritz 32f0f6d75a Wean ourselves off of 'operator int' of ustring, and bug fixes (#929)
OIIO's ustring has an "operator int()" that is possibly ill-advised, as
claimed by Thiago Ize and John Haddon from an oiio-dev thread from back
in 2015 (I'm doing some old thread necromancy). They claimed that an
operator int (or for that matter bool) could result in subtle bugs from
type conversions you don't expect to happen.  The fact that there's no
equivalent operator int/bool for std::string or std::string_view
bolsters their argument.

I started off just trying to eliminate all OSL uses that assume this
operator would work (the proper idiom is simply `!str.empty()`). Along the
way, I found *TWO* bugs related to this -- one in osltoy and one
when constant folding "wrap" arguments to texture functions! So Thiago
and John were surely right, and I am appropriately chastened and
belatedly trying to find a way to get rid of the troublesome operator.
2018-10-29 13:56:20 -07:00
Larry Gritz 4918894101 Fix typos in docs & comments
[ci skip]
2018-10-22 15:55:43 -07:00
Larry Gritz 41a5dd85e0 Rewrite OSOReaderToMaster::hint (#923)
Zap is seeing sporadic (but frustraingly impossible to reproduce) crash
reports from inside this function, specifically in the part that parses
%argrw hints.

There was a longstanding comment:   // FIXME -- use string_view ops here

So, sure, rewrite the whole thing using string_view and Strutil::parse
functions, and remove the assertions, and put extra guards to make sure
we aren't acessing a symbol or op (via blah.back()) if there aren't any
in the vector yet, and pretty much just let it ignore or be robust to any
malformed hints.

I've never seen a repro case, so I don't know that this will fix it, but
it's programmed a lot more defensively now, so hopefully there will be
no further crashes (after I backport this to whatever version Zap is
using).  I even put in an error message for a certain way to malform
%argrw, in the hopes that it might give us a clue, but even that is just
a guess.
2018-10-13 14:41:15 -07:00
Larry Gritz d514eebfd5 Fix docs typo about matrix construction 2018-10-13 14:39:40 -07:00
Larry Gritz 6a1e822584 Fix oslc read/write error for regex_search/regex_match (#922)
For these functions, oslc failed to mark the results output param as
write only.

Fix the bug in oslc, and also put in a provision in loadshader that will
correct the old already-compiled incorrect files.

Thanks to Steena Monteiro from Intel for pointing this out!
2018-10-05 15:52:33 -07:00
Larry Gritz e341a9afaa Bump version after release 2018-10-01 15:57:48 -07:00
Larry Gritz ab76acd2f1 CHANGES 2018-10-01 15:55:53 -07:00
Larry Gritz 8561ce003d Test against llvm7 and gcc8, several gcc8-related warning fixes 2018-09-29 22:12:08 -07:00
Larry Gritz 4d9bdbaaa6 Support clang7 and llvm7 (#919)
(backported from master)
2018-09-23 21:03:40 -07:00
Larry Gritz d4aca83ed3 Fix testrender bug with undefined order of operations (#916)
A suspicious line in testrender seems to depend on undefined behavior
regarding the specific order of evaluation of quantities in a math expression.
It has been there forever, but only seems to fail on certain builds of gcc 5
and possibly clang 7.

It's just a one-line fix to remove the order-of-evaluation ambiguity.

Thanks, Tim Grant, for pointing this out!
2018-09-14 22:49:22 -07:00
Larry Gritz c1321674ca Support for LLVM 6 (#913)
Ported from master/1.10: Fix LLVM memory manager for LLVM 6.0 and higher.

Travis: add a test build against LLVM 6.0.1 on Linux

Win/Appveyor: update the version of OIIO we build against
2018-09-14 12:57:30 -07:00
Larry Gritz b66510ae91 Bump version after release 2018-09-04 21:50:16 -07:00
Larry Gritz 79da1d62ec CHANGES 2018-09-04 14:24:52 -07:00
Larry Gritz 735e590f2c MaterialX cleanup: ramp4, texture mapping, matrix math (#907)
* MaterialX: fix definition of ramp4 top vs bottom

In recent times, it's been decided that "top" always refers to v=1 and
"bottom" refers to v=0.

* MaterialX: various clean ups to texture mapping nodes

* image node: wasn't honoring addressmode or filtertype params.

* Fixes to triplanarprojection: wasn't properly normalizing by the
  combined weight of the three views, wasn't honoring filtertype param,
  wasn't forcing periodic wrap.

* Implement the new "tiledimage" node.

* MaterialX: extend add/sub/mul/div to include matrices per 1.36 spec
2018-08-08 22:55:36 -07:00
Larry Gritz 4e720f40a4 Whitespace cleanup
[ci skip]
2018-07-28 12:34:17 -07:00
Larry Gritz 63a104ae68 MaterialX 1.36 additions: rotate, transforms, rgb/hsv, extract, separate (#905)
* Add a variant of rotate() that just takes an axis, rotate about the origin.

* MaterialX: add rotate node (new with MaterialX 1.36)

* rotate2d note is kept for back-compatibility, but considered deprecated, since it was dropped from 1.36.

* MaterialX: implement new transformpoint, transformvector, transformnormal nodes

* MaterialX: add new nodes rgbtohsv, hsvtorgb

* MaterialX: add new 1.36 node 'hsvadjust', deprecate 'hueshift'

* MatrialX: Add new 1.36 nodes: extract, separate
2018-07-28 08:45:54 -07:00
Larry Gritz c7a87ee34e Add sign() and log() to vector struct types. (#904)
Ass missing `sign` node to MaterialX.
Change MaterialX `ln` implementation from log2 to correct log.
2018-07-25 18:00:12 -07:00
Derek Haase d963157dcd Add lots of new MaterialX 1.36 support
Add sin, cos, tan, atan2, ceil, sqrt, exp, determinent, ln, and
transpose operators

Rename exponent operator to power

Rename pack to combine

add extract operator

Add conversion operators:
color2->vector2
color->vector
color4->vector4
vector2->color2
vector->color
vector4->color4

Matrix inversion operator.
2018-07-21 09:41:51 -07:00
Derek Haase 7cf81fffd7 Add more functions to color2, color4, vector2, vector4
ceil, sqrt, exp, log2, sin, cos, tan, asin, acos, atan2
2018-07-21 09:41:27 -07:00
Larry Gritz bded0f2ac3 Speed up parsing of long initializer lists. (#901)
If you have something like

    float table[65536] = { 0.1, 0.35, -0.72, ... }

This might take TENS of seconds for oslc to parse, because the mechanics
of how that long list of values is parsed -- it involves a singly-linked
list of ASTNodes, and with each new one, we are appending to the far end
of the linked list. This leads to an O(n^2) parsing time, where n is the
length of the list.

The straightforward (but wrong!) way to fix it is to change the Bison
grammar for init_expression_list from "left-recursive" to "right-recursive".
That makes it natural to prepend items (O(1)) to the accumulating list,
but it's very inefficient for Bison and can overrun Bison's fixed-size
parsing stack. Bison docs discurage use of right-recursion in grammars,
since left-recursion grammar can parse arbitrarily deep recursive
structures in a fixed memory size.

OK, so how do we fix this? Trickery! Keep left recursion, but accumulate
in the reverse order (i.e., prepend, not append), and then do a single
reverse of the backwards list at the very end. That makes the whole
parsing affair O(n) instead of O(n^2).

Sounds good, but one final wrinkle is that the list we need to reverse
is is a raw pointer to the head, followed by ref-counted pointers to
each subsequent element. In order to keep from accidentally freeing
things if the ref counts reach zero, we have our fancy reverse()
function rely on a brand spanking new feature of OIIO's intrusive_ptr<>
to add a release() method (https://github.com/OpenImageIO/oiio/pull/1986).
But since that doesn't exist in older OIIO, to avoid a compatibility
break, we only do our special left recursion + backwards list + reversal
trick if the OIIO version we build against has that new feature.
Otherwise, it's #ifdef'ed out and we just do it the old slow way.

This fixes OSL issue #723, and for the pathological test case presented
in that issue, it improves compile time (on my laptop) from ~26 seconds
to 0.4 seconds.

I also checked that this funny business with the reversal doesn't slow
down the simple cases for ordinary shader. Compiling the whole
collection of 500+ MaterialX shaders took about 20.5 seconds, and with
the new parsing code is exactly the same, or at least, too close to
accurately discern in the time trials.
2018-07-19 22:15:10 -07:00
Christopher Kulla 8a808524d7 Fix incorrect array length on unbounded arrays specified via relaxed parameter type checking (#900) 2018-07-19 22:14:28 -07:00
Larry Gritz 4a4a5b3cec docs
[ci skip]
2018-07-19 22:14:01 -07:00
Larry Gritz dc988aa2d5 Update trig ref output after recent OIIO change 2018-06-15 09:35:25 -07:00
Larry Gritz 0ebd0c0623 Fix build break after recent OIIO changes 2018-06-14 15:16:47 -07:00
Alex Fuller 829df136cc Flex/bison wincompat patch (#891) 2018-06-04 14:23:41 -07:00
Larry Gritz da9456eb44 Bump version after release
[ci skip]
2018-05-01 15:39:02 -07:00
Larry Gritz 0463a766ff changes 2018-05-01 15:39:02 -07:00
Larry Gritz ea9ea71932 Updates to handle OIIO ImageInput refactor. (#882) 2018-04-29 18:15:00 -07:00
Larry Gritz 029f592319 Fix error_repeats: clearing happened for getattribute instead of attribute 2018-04-26 08:38:50 -07:00
Larry Gritz bd573b7417 Reduce extreme cost of oslnoise_test on CI and DEBUG runs 2018-04-09 16:25:12 -07:00
Larry Gritz 8c2d2e053c SS attrib "error_repeats" controls suppression of repeat errors & warnings (880)
Previously, exactly identical error and warning messages (including from
shaders themselves) printed the first time and suppressed the duplicates.
The rationale is that an error in a shader could easily turn into thousands
of error messages if duplicates weren't suppressed.
There wasn't a way to turn this behavior off.

Now it's controlled by ShadingSystem attribute "error_repeats", an int,
which has default value 0 (do not issue repeated errors). If changed
to 1, repeated errors and warnings will be allowed to pass to the error
handler, without suppression in the ShadingSystem.

Furthermore, the act of setting the attribute (to either 0 or 1) has the
side effect of clearing the list of remembered errors. This means that
even if you want error suppression, poking it in this way will reset the
counters, which might be a handy thing to do at the start of each frame
(if you are using a single ShadingSystem to render multiple frames) so
that you start the counts fresh for each render, rather than for each
ShadingSystem.
2018-04-09 15:33:23 -07:00
Larry Gritz 35f19f7c03 Bump version after release 2018-03-31 14:47:36 -07:00
Larry Gritz 231e707529 docs 2018-03-31 14:45:35 -07:00
Matt Johnson e6ada16003 specify the VERSION and SOVERSION when building library shared objects (#876)
In this change, we specify the VERSION and SOVERSION properties of library
shared objects so that the SONAME in the shared object contains the OSL version
number suffix (major.minor). This also results in the build creating versioned
symlinks back to the installed shared objects. Code that links against the
libraries can then link against a specific version of OSL such that the correct
version can be dynamically linked at runtime.

This follows a similar pattern to the one used in OpenImageIO.
2018-03-27 11:01:41 -07:00
Larry Gritz a39a6e75d4 Fix docs typos (#871)
Fixes #869
Fixes #870

[ci skip]
2018-03-05 16:33:51 -08:00
Larry Gritz 9697ed82ad Bump version after release 2018-02-01 11:46:36 -08:00
Larry Gritz df03f84a60 CHANGES/docs 2018-02-01 11:16:27 -08:00
Larry Gritz 65ec2c70e8 Change STOP_ON_WARNING default to off for release branch, except for CI builds 2018-02-01 11:15:22 -08:00
Larry Gritz b16a1228d1 Force -Wall on Travis builds (#850) 2018-02-01 11:15:22 -08:00
Larry Gritz a58ef622d2 Appveyor: tweak which branches will run, run tests with --output-on-failure 2018-01-31 12:05:26 -08:00
Frederich Munch f5f5393d12 Appveyor 2018-01-30 17:56:14 -08:00
Frederich Munch 92a219d7a9 CMake: Fix LLVM_SYSTEM_LIBRARIES on Windows. 2018-01-30 17:56:07 -08:00
Frederich Munch 3931f2e210 Fix problems running test suite on Windows. 2018-01-30 17:54:04 -08:00
Frederich Munch 0f6c2fa588 Add Windows export for liboslnoise. 2018-01-30 17:09:36 -08:00
Frederich Munch be665fed1a Work around boost::wave’s preprocessing escaping Windows path separators. 2018-01-30 17:09:15 -08:00
Frederich Munch dd01e1627f Fix bug/undefined behavior trying to format/printf a struct value. 2018-01-30 17:07:48 -08:00
marsupial 9c37c2014e Minor fixes - boost::wave whitespace issue and uninitialized variable (#840)
* Turn off Turn off whitespace insertion when using boost::wave.

* Fix  un-initialized members of ASTfunction_call.
Move all initialization into constructor so some compilers can error on regression.
2018-01-30 15:48:57 -08:00
Larry Gritz 9df4e9c6cc Improve install instructions 2018-01-30 15:48:51 -08:00
Larry Gritz f3484a2948 Fix compiler warning about possibly uninitialized variable (false positive) (#847)
Fixes #846
2018-01-25 16:29:48 -08:00
Alexis Oblet 0601c3bc28 oslc: handle args if the shader file is not the last argument 2018-01-13 17:18:54 -08:00
Larry Gritz da2864bd28 Change URL for LLVM source after it moved 2018-01-12 19:36:34 -08:00
Larry Gritz f82cdc4966 Bump version after release 2018-01-02 00:03:06 -08:00
Larry Gritz 008d3d5dbd CHANGES and 1.9.6 2018-01-01 21:33:34 -08:00
marsupial 33de97ae5a Fix oslc crash with invalid field selection. (#835) 2017-12-19 00:48:17 -08:00
Chris Kulla 52c98f6013 Pass the context's texture_thread_info to the render services texture callbacks instead of always passing NULL 2017-12-06 11:06:01 -08:00
Larry Gritz 00d5cee81d Bump version after release 2017-12-04 21:54:11 -08:00
Larry Gritz 25139ed449 RELEASE 2017-12-04 21:10:58 -08:00
Larry Gritz 81846bf206 Add missing OSLQuery::Parameter correct assignment operator (#827) 2017-12-01 14:49:42 -08:00
Mark Final 92b2792374 Fixes compiler error (AppleClang,Gcc) in using std::atomic values as printf arguments (#826)
Compiler error in AppleClang (Xcode8) is

/Users/mark/dev/Thirdparty/OSL-1.9/src/liboslcomp/ast.cpp:76:33: error: call to implicitly-deleted copy constructor of 'std::atomic<int>'
                             i, node_counts[i], node_counts_peak[i]);
                                ^~~~~~~~~~~~~~

Compiler error in Gcc (4.8) is

/home/mark/dev/Thirdparty/OSL-1.9/src/liboslcomp/ast.cpp:76:68: error: use of deleted function ‘std::atomic<int>::atomic(const std::atomic<int>&)’
                              i, node_counts[i], node_counts_peak[i]);
                                                                    ^
Believe this is a problem because printf accepts arguments by value, whereas OIIO 1.8's Strutil::printf takes by reference, and you can't copy a std::atomic.
2017-12-01 11:42:29 -08:00
Larry Gritz 7e076044e6 Bump version after RC release 2017-11-29 19:33:38 -08:00
Larry Gritz b55a4a99ac CHANGES and 1.9.3RC3 2017-11-29 19:14:13 -08:00
Larry Gritz 5e73ceba51 OSLQuery improvements (#821)
* OSLQuery::Parameter -- add copy/move constructors

* Make the ShadingSystem side of OSLQuery correctly report default vals.
2017-11-27 21:14:44 -08:00
Mark Final a895948a1a Fix to compile OSL debug against OIIO-1.7.x. Previously assumed OIIO 1.8 going by required headers and the new Strutil::printf function (#822) 2017-11-27 14:20:35 -08:00
Mark Final cf7726e5d8 VisualStudio 2015 x64 compilation fixes for 1.9.x (#820)
* VisualStudio 2015 x64 build fix

include/OSL/dual.h(64): error C2476: 'constexpr' constructor does not
initialize all members

According to http://en.cppreference.com/w/cpp/language/constexpr, this
is an expected error for C++11, but not for C++14 and beyond.

* VisualStudio 2015 x64 build fix

Using SimplePool in the member variables in ShadingContext is causing an
'attempting to reference a deleted function' error for the
std::unique_ptr<char>s.

Applying the rule of 5, to disallow copying or moving a SimplePool.
2017-11-26 21:17:17 -08:00
Larry Gritz 2a40110a8a bump version after RC release 2017-11-21 16:10:12 -08:00
Larry Gritz ab131823bd CHANGES and 1.9.3RC2 2017-11-21 16:05:59 -08:00
Brecht Van Lommel 085407889c Fix ClosureComponent to work with SSE alignment requirements. (#810) 2017-11-17 10:34:26 -08:00
Larry Gritz 895548e8ae Allow stats to print if shaders were declared, even if not requested (#815) 2017-11-16 12:06:39 -08:00
Larry Gritz c6c2750e13 oslc: Fix param write analysis bug for token/value optional arguments (#812)
Functions that take optional argument lists in token/value form, like
`texture` or `pointcloud_search` needed to mark just those value
references as "writeable" that are (for example, the one following
"alpha" for texture calls, but all of the optional value slots for
pointcloud_search).

The logic on the oslc side here was broken -- it worked when the token
was a string literal, but when it was a variable whose value wouldn't be
known until runtime, it was failing to mark it as writeable, whereas the
correct thing to do is to conservatively conclude that it *might* be
written to (we don't know yet) and mark it as such.

The cascade of errors could lead to incorrect runtime optimization, if
the only used output of the function call was one of these parameters
that failed to be marked as an output, so so the whole function call
might be subject to the "useless op elision" optimization wherein ops
whose writes are never subsequently read can be eliminated entirely.
2017-11-15 13:30:14 -08:00
Larry Gritz 8ae78d351b Bump version after RC tag/release 2017-11-15 13:30:06 -08:00
Larry Gritz c8440a868a 1.9.2RC1 2017-11-14 10:24:17 -08:00
Larry Gritz 38fcf31f64 Travis reduce package install cost
1. Instead of installing libboost1.55-all-dev, which truly is everything
boost, just install the boost headers and the library components for the
very small number of non-header things we want.

2. Move the Linux package installation to be per-matrix-entry, this
allows us to customize by only installing the specific g++ version we
need, and exclude some boost components (using gcc >= 4.9 removes the
need for boost regex, for example).

This shaves several MINUTES of time from each test matrix entry, which
had been needlessly downloading and installing unneeded packages.
2017-11-10 00:06:40 -08:00
Larry Gritz 6e35abd0fd Simplify the PugiXML logic. (#809)
By default, look for a system install. If that's not found, check
the OIIO distribution, where another header-only copy can also usually
be found. Eliminate the USE_EXTERNAL_PUGIXML, I don't think anybody
depends on that as long as the default is to check system libs first.

The only thing this doesn't do well is to have a system PugiXML but
*force* us to use the one from OIIO (whose only possible advantage is that
it's namespaced). If this is a problem in practice, we can return to make
that possible.
2017-11-10 00:06:40 -08:00
Larry Gritz e52c08e85a Restore support for OIIO 1.7 (#808) 2017-11-09 18:51:12 -08:00
Larry Gritz db5e728a50 Suppress gcc7 warning about signed vs unsigned compare. (#807)
We can't fix the code -- it's not "our" code, it it's the stuff
generated as part of the build process by flex itself. The expedient
thing is to just suppress the warning in the flex-generated module.
2017-11-09 16:13:57 -08:00
Larry Gritz 4eca768c69 Bump release for next beta 2017-11-09 16:13:57 -08:00
Larry Gritz 78ecf4a9fe Fix incorrect Linux pre-build LLVM for 4.0, 5.0 2017-11-01 22:46:12 -07:00
Larry Gritz b6b2cc7f8f Branch for OSL 1.9 beta 2017-11-01 09:57:38 -07:00
223 changed files with 4584 additions and 896 deletions
+166 -35
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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:
+4 -5
View File
@@ -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"
+27 -8
View File
@@ -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
View File
@@ -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
View File
@@ -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)
+5 -6
View File
@@ -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 ()
+4 -10
View File
@@ -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
###########################################################################
+6 -1
View File
@@ -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} )
+1
View File
@@ -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.
+9
View File
@@ -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
View File
@@ -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.
+1 -1
View File
@@ -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)
///
+6
View File
@@ -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
+2 -2
View File
@@ -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;
+11 -14
View File
@@ -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()); }
};
+8
View File
@@ -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
+3
View File
@@ -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
+29
View File
@@ -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
View File
@@ -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 ();
+6 -5
View File
@@ -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
+9
View File
@@ -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
View File
@@ -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;
+3
View File
@@ -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; }
+10 -7
View File
@@ -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");
}
+11 -3
View File
@@ -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);
+38 -1
View File
@@ -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
}
;
+19
View File
@@ -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.
+25 -6
View File
@@ -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,
+8
View File
@@ -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
+2 -2
View File
@@ -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();
+1 -1
View File
@@ -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")
+16 -3
View File
@@ -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];
+1 -1
View File
@@ -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) {
+5 -10
View File
@@ -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
+17 -4
View File
@@ -246,7 +246,11 @@ ShaderInstance::parameters (const ParamValueList &params)
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 &params)
// * 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 &params)
// 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);
+6 -18
View File
@@ -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;
+68 -16
View File
@@ -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
}
}
+62 -85
View File
@@ -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;
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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";
+11 -18
View File
@@ -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);
+9 -9
View File
@@ -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));
}
};
+6
View File
@@ -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 */
+4 -4
View File
@@ -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);
+6 -6
View File
@@ -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;
+4 -4
View File
@@ -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
+30 -5
View File
@@ -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();
+8
View File
@@ -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} )
+8
View File
@@ -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 ();
+8
View File
@@ -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} )
+93
View File
@@ -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 ()
{
+9
View File
@@ -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 ()
+83 -10
View File
@@ -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
View File
@@ -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;
}
BIN
View File
Binary file not shown.
+42 -18
View File
@@ -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
+99 -70
View File
@@ -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
+2 -2
View File
@@ -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"
+17
View File
@@ -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);
}
+4 -3
View File
@@ -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);
}
+3 -3
View File
@@ -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);
}
+2 -2
View File
@@ -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"
+17
View File
@@ -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);
}
+19
View File
@@ -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);
}
+19
View File
@@ -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);
}
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+17
View File
@@ -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);
}
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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},
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+17
View File
@@ -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);
}
+2 -2
View File
@@ -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"
+17
View File
@@ -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);
}
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+17
View File
@@ -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);
}
+19
View File
@@ -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);
}
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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