Compare commits

...
13 Commits
Author SHA1 Message Date
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
17 changed files with 261 additions and 103 deletions
+115 -36
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-origin.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
@@ -108,37 +115,109 @@ matrix:
# Build with C++11, default compiler, optimized build, against 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: OIIOBRANCH=release USE_SIMD=sse4.2 LLVM_VERSION=3.9.0
# Test gcc6, and highest SIMD level supported by Travis, and newer LLVM
- 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 LLVM_VERSION=4.0.0
# Linux only: test gcc 7, also test C++14 and even newer LLVM
- os: linux
compiler: gcc
env: WHICHGCC=6 USE_SIMD=avx,f16c
# Linux only: test gcc 7, also test C++14
- 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 LLVM_VERSION=5.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:
+22 -3
View File
@@ -1,6 +1,16 @@
Release 1.9 -- ?? 2017 (compared to 1.8)
Release 1.9 -- 30 November 2017 (compared to 1.8)
--------------------------------------------------
**Fixes for 1.9.3RC2**
* 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)
* Fixed `ClosureComponent` to work with SSE alignment requirements. #810
(1.9.3)
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.
@@ -99,8 +109,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 +173,12 @@ 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)
Build & test system improvements:
* C++11 is the new language baseline. #704, #707
@@ -220,6 +236,9 @@ 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)
Developer goodies:
* The `dual.h` implementation has been completely overhauled. The primary
+2 -3
View File
@@ -1,11 +1,11 @@
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.3
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 "RC2") # "dev", "betaX", "RCY", ""
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_COPYRIGHTYEARS "2008-2017")
set (PROJECT_AUTHORS "Sony Pictures Imageworks, et al")
@@ -89,7 +89,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)
-5
View File
@@ -145,10 +145,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 +366,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"
+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
###########################################################################
+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
+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
+6
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.
+11 -3
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!
+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
+13 -1
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')",
+1 -9
View File
@@ -1614,7 +1614,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 +1845,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 */
+2 -2
View File
@@ -1600,8 +1600,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();
}
+4 -7
View File
@@ -41,10 +41,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <OpenImageIO/timer.h>
#include <OpenImageIO/thread.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 <OSL/oslexec.h>
@@ -226,9 +226,6 @@ void parse_scene() {
}
text.push_back(0); // make sure text ends with trailing 0
#ifdef USING_OIIO_PUGI
namespace pugi = OIIO::pugi;
#endif
// build DOM tree
pugi::xml_document doc;
pugi::xml_parse_result parse_result = doc.load_file(scenefile.c_str());
+42
View File
@@ -313,7 +313,12 @@ action_param (int argc, const char *argv[])
&f[0], &f[1], &f[2], &f[3],
&f[4], &f[5], &f[6], &f[7], &f[8], &f[9], &f[10], &f[11],
&f[12], &f[13], &f[14], &f[15]) == 16) {
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, TypeDesc::TypeMatrix, 1, f);
#else
params.push_back (ParamValue());
params.back().init (paramname, TypeDesc::TypeMatrix, 1, f);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -323,7 +328,12 @@ action_param (int argc, const char *argv[])
&& sscanf (stringval.c_str(), "%g, %g, %g", &f[0], &f[1], &f[2]) == 3) {
if (type == TypeDesc::UNKNOWN)
type = TypeDesc::TypeVector;
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, type, 1, f);
#else
params.push_back (ParamValue());
params.back().init (paramname, type, 1, f);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -332,7 +342,13 @@ action_param (int argc, const char *argv[])
// string.
if ((type == TypeDesc::UNKNOWN || type == TypeDesc::TypeInt)
&& OIIO::Strutil::string_is<int>(stringval)) {
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, OIIO::Strutil::from_string<int>(stringval));
#else
params.push_back (ParamValue());
int i = OIIO::Strutil::from_string<int>(stringval);
params.back().init (paramname, TypeDesc::TypeInt, 1, &i);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -341,7 +357,13 @@ action_param (int argc, const char *argv[])
// whole string.
if ((type == TypeDesc::UNKNOWN || type == TypeDesc::TypeFloat)
&& OIIO::Strutil::string_is<float>(stringval)) {
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, OIIO::Strutil::from_string<float>(stringval));
#else
params.push_back (ParamValue());
float f = OIIO::Strutil::from_string<float>(stringval);
params.back().init (paramname, TypeDesc::TypeFloat, 1, &f);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -355,7 +377,12 @@ action_param (int argc, const char *argv[])
OIIO::Strutil::parse_float (stringval, vals[i]);
OIIO::Strutil::parse_char (stringval, ',');
}
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, type, 1, &vals[0]);
#else
params.push_back (ParamValue());
params.back().init (paramname, type, 1, &vals[0]);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -369,7 +396,12 @@ action_param (int argc, const char *argv[])
OIIO::Strutil::parse_int (stringval, vals[i]);
OIIO::Strutil::parse_char (stringval, ',');
}
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, type, 1, &vals[0]);
#else
params.push_back (ParamValue());
params.back().init (paramname, type, 1, &vals[0]);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -383,7 +415,12 @@ action_param (int argc, const char *argv[])
std::vector<ustring> strelements;
for (auto&& s : splitelements)
strelements.push_back (ustring(s));
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, type, 1, &strelements[0]);
#else
params.push_back (ParamValue());
params.back().init (paramname, type, 1, &strelements[0]);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
return;
@@ -391,7 +428,12 @@ action_param (int argc, const char *argv[])
// All remaining cases -- it's a string
const char *s = stringval.c_str();
#if OIIO_VERSION >= 10804
params.emplace_back (paramname, TypeDesc::TypeString, 1, &s);
#else
params.push_back (ParamValue());
params.back().init (paramname, TypeDesc::TypeString, 1, &s);
#endif
if (unlockgeom)
params.back().interp (ParamValue::INTERP_VERTEX);
}