- Update to version 1.6.6

OpenShadingLanguage 1.6 comes with new features and lots of bug fixes:
* new OSL operators and arrays of undefined length can be passed to the
  shaders now
* many API enhancements for the render services and shader contexts

Changelog: https://github.com/imageworks/OpenShadingLanguage/blob/RB-1.6/CHANGES

PR:		200819
Submitted by:	Shane Ambler <FreeBSD@ShaneWare.Biz>
This commit is contained in:
Marcus von Appen
2015-07-08 16:52:00 +00:00
parent 8ccb80a309
commit 0cb7e96265
7 changed files with 8 additions and 274 deletions

View File

@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= openshadinglanguage
PORTVERSION= 1.5.12
PORTVERSION= 1.6.6
DISTVERSIONPREFIX= Release-
CATEGORIES= graphics devel
@@ -40,10 +40,4 @@ post-patch:
@${REINPLACE_CMD} -e 's,/bin/bash,/bin/sh,' \
${WRKSRC}/src/liboslexec/serialize-bc.bash
post-install:
.for LNAME in oslcomp oslexec oslquery testshade
${MV} ${STAGEDIR}${PREFIX}/lib/lib${LNAME}.so ${STAGEDIR}${PREFIX}/lib/lib${LNAME}.so.1
${LN} -s lib${LNAME}.so.1 ${STAGEDIR}${PREFIX}/lib/lib${LNAME}.so
.endfor
.include <bsd.port.mk>

View File

@@ -1,2 +1,2 @@
SHA256 (imageworks-OpenShadingLanguage-Release-1.5.12_GH0.tar.gz) = c871942c5cfade3cad2f1dc68ddf47f96aeae285c162394305c46db6c6930873
SIZE (imageworks-OpenShadingLanguage-Release-1.5.12_GH0.tar.gz) = 11560575
SHA256 (imageworks-OpenShadingLanguage-Release-1.6.6_GH0.tar.gz) = be73f656e65997b5c3ce9576c8ee4695b14dbd100319862596f2f77585ee2a88
SIZE (imageworks-OpenShadingLanguage-Release-1.6.6_GH0.tar.gz) = 12351422

View File

@@ -1,75 +0,0 @@
--- ./CMakeLists.txt.orig 2013-11-26 05:11:29.000000000 +1030
+++ ./CMakeLists.txt 2013-11-28 23:52:39.202491493 +1030
@@ -10,10 +10,8 @@
set (OSO_FILE_VERSION_MAJOR 1)
set (OSO_FILE_VERSION_MINOR 0)
-cmake_minimum_required (VERSION 2.6)
-if (NOT CMAKE_VERSION VERSION_LESS 2.8.4)
- cmake_policy (SET CMP0017 NEW)
-endif ()
+cmake_minimum_required (VERSION 2.8.7)
+cmake_policy (SET CMP0017 NEW)
set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}")
message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")
@@ -22,6 +20,8 @@
message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()
+include (CheckCXXSymbolExists)
+
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
@@ -124,12 +124,11 @@
endif ()
endif ()
-# Try to detect if this is an OSX distro new enough that the system library
-# is libc++, in which case we should force use of Boost Wave (because that
-# avoids a nonstandard g++ extension in the other code path).
-if (EXISTS "/usr/lib/libc++.dylib" OR OSL_USE_LIBCPP)
- set (OSL_SYSTEM_HAS_LIBCPP ON)
-endif ()
+# Try to detect libc++, in which case we should force use of Boost
+# Wave (because that avoids a nonstandard g++ extension in the other
+# code path).
+check_cxx_symbol_exists(_LIBCPP_VERSION string OSL_SYSTEM_HAS_LIBCPP)
+
set (VERBOSE OFF CACHE BOOL "Print lots of messages while compiling")
set (BUILDSTATIC OFF CACHE BOOL "Build static library instead of shared")
@@ -167,7 +166,6 @@
if (CMAKE_COMPILER_IS_CLANG AND OSL_USE_LIBCPP)
message (STATUS "Using libc++")
- add_definitions ("-stdlib=libc++")
endif ()
set (CMAKE_MODULE_PATH
@@ -202,6 +200,10 @@
message (STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}")
+# Try to detect libc++, in which case we should force use of Boost
+# Wave (because that avoids a nonstandard g++ extension in the other
+# code path).
+check_cxx_symbol_exists(_LIBCPP_VERSION string OSL_SYSTEM_HAS_LIBCPP)
###########################################################################
if (MSVC)
@@ -232,6 +234,13 @@
add_subdirectory (src/include)
add_subdirectory (src/doc)
+if (USE_BOOST_WAVE)
+ add_definitions ("-DUSE_BOOST_WAVE")
+endif ()
+
+if (CMAKE_COMPILER_IS_CLANG AND OSL_SYSTEM_HAS_LIBCPP)
+ message (STATUS "Using libc++")
+endif ()
#########################################################################

View File

@@ -1,181 +0,0 @@
--- ./src/include/OSL/oslexec.h.orig
+++ ./src/include/OSL/oslexec.h
@@ -428,7 +428,8 @@ class OSLEXECPUBLIC ShadingSystem
std::string getstats (int level=1) const;
void register_closure (string_view name, int id, const ClosureParam *params,
- PrepareClosureFunc prepare, SetupClosureFunc setup);
+ PrepareClosureFunc prepare, SetupClosureFunc setup,
+ int alignment = 1);
/// Query either by name or id an existing closure. If name is non
/// NULL it will use it for the search, otherwise id would be used
/// and the name will be placed in name if successful. Also return
--- ./src/liboslexec/oslexec_pvt.h
+++ ./src/liboslexec/oslexec_pvt.h
@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <OpenImageIO/paramlist.h>
#include <OpenImageIO/refcnt.h>
+#include "OSL/genclosure.h"
#include "OSL/oslexec.h"
#include "OSL/oslclosure.h"
#include "osl_pvt.h"
@@ -693,13 +694,16 @@ class ClosureRegistry {
std::vector<ClosureParam> params;
// the needed size for the structure
int struct_size;
+ // the needed alignment of the structure
+ int alignment;
// Creation callbacks
PrepareClosureFunc prepare;
SetupClosureFunc setup;
};
void register_closure (string_view name, int id, const ClosureParam *params,
- PrepareClosureFunc prepare, SetupClosureFunc setup);
+ PrepareClosureFunc prepare, SetupClosureFunc setup,
+ int alignmen = 1);
const ClosureEntry *get_entry (ustring name) const;
const ClosureEntry *get_entry (int id) const {
@@ -855,7 +859,8 @@ class ShadingSystemImpl
ustring *alloc_string_constants (size_t n) { return m_string_pool.alloc (n); }
void register_closure (string_view name, int id, const ClosureParam *params,
- PrepareClosureFunc prepare, SetupClosureFunc setup);
+ PrepareClosureFunc prepare, SetupClosureFunc setup,
+ int alignment = 1);
bool query_closure (const char **name, int *id,
const ClosureParam **params);
const ClosureRegistry::ClosureEntry *find_closure(ustring name) const {
@@ -1120,19 +1125,24 @@ class SimplePool {
char * alloc(size_t size, size_t alignment=1) {
// Alignment must be power of two
DASSERT ((alignment & (alignment - 1)) == 0);
- // Fail if beyond allocation limits or senseless alignment
- if (size > BlockSize || (size & (alignment - 1)) != 0)
+ // Fail if beyond allocation limits (we make sure there's enough space
+ // for alignment padding here as well).
+ if (size + alignment - 1 > BlockSize)
return NULL;
- m_block_offset -= (m_block_offset & (alignment - 1)); // Fix up alignment
- if (size <= m_block_offset) {
+ // Fix up alignment
+ size_t alignment_offset = alignment_offset_calc(alignment);
+ if (size + alignment_offset <= m_block_offset) {
// Enough space in current block
- m_block_offset -= size;
+ m_block_offset -= size + alignment_offset;
} else {
// Need to allocate a new block
m_current_block++;
m_block_offset = BlockSize - size;
if (m_blocks.size() == m_current_block)
m_blocks.push_back(new char[BlockSize]);
+ alignment_offset = alignment_offset_calc(alignment);
+ DASSERT (m_block_offset >= alignment_offset);
+ m_block_offset -= alignment_offset;
}
return m_blocks[m_current_block] + m_block_offset;
}
@@ -1140,6 +1150,10 @@ class SimplePool {
void clear () { m_current_block = 0; m_block_offset = BlockSize; }
private:
+ inline size_t alignment_offset_calc(size_t alignment) {
+ return (((uintptr_t)m_blocks[m_current_block] + m_block_offset) & (alignment - 1));
+ }
+
std::vector<char *> m_blocks;
size_t m_current_block;
size_t m_block_offset;
@@ -1320,7 +1334,9 @@ class OSLEXECPUBLIC ShadingContext {
ClosureComponent * closure_component_allot(int id, size_t prim_size, int nattrs) {
size_t needed = sizeof(ClosureComponent) + (prim_size >= 4 ? prim_size - 4 : 0)
+ sizeof(ClosureComponent::Attr) * nattrs;
- ClosureComponent *comp = (ClosureComponent *) m_closure_pool.alloc(needed);
+ int alignment = m_shadingsys.find_closure(id)->alignment;
+ size_t alignment_offset = closure_alignment_offset_calc(alignment);
+ ClosureComponent *comp = (ClosureComponent *) (m_closure_pool.alloc(needed + alignment_offset, alignment) + alignment_offset);
comp->type = ClosureColor::COMPONENT;
comp->id = id;
comp->size = prim_size;
@@ -1335,7 +1351,9 @@ class OSLEXECPUBLIC ShadingContext {
// Allocate the component and the mul back to back
size_t needed = sizeof(ClosureComponent) + (prim_size >= 4 ? prim_size - 4 : 0)
+ sizeof(ClosureComponent::Attr) * nattrs;
- ClosureComponent *comp = (ClosureComponent *) m_closure_pool.alloc(needed);
+ int alignment = m_shadingsys.find_closure(id)->alignment;
+ size_t alignment_offset = closure_alignment_offset_calc(alignment);
+ ClosureComponent *comp = (ClosureComponent *) (m_closure_pool.alloc(needed + alignment_offset, alignment) + alignment_offset);
comp->type = ClosureColor::COMPONENT;
comp->id = id;
comp->size = prim_size;
@@ -1486,6 +1504,14 @@ class OSLEXECPUBLIC ShadingContext {
// 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));
+ }
+
};
--- ./src/liboslexec/shadingsys.cpp
+++ ./src/liboslexec/shadingsys.cpp
@@ -284,9 +284,10 @@ void
ShadingSystem::register_closure (string_view name, int id,
const ClosureParam *params,
PrepareClosureFunc prepare,
- SetupClosureFunc setup)
+ SetupClosureFunc setup,
+ int alignment)
{
- return m_impl->register_closure (name, id, params, prepare, setup);
+ return m_impl->register_closure (name, id, params, prepare, setup, alignment);
}
@@ -798,7 +799,8 @@ void
ShadingSystemImpl::register_closure (string_view name, int id,
const ClosureParam *params,
PrepareClosureFunc prepare,
- SetupClosureFunc setup)
+ SetupClosureFunc setup,
+ int alignment)
{
for (int i = 0; params && params[i].type != TypeDesc(); ++i) {
if (params[i].key == NULL && params[i].type.size() != (size_t)params[i].field_size) {
@@ -806,7 +808,7 @@ ShadingSystemImpl::register_closure (string_view name, int id,
return;
}
}
- m_closure_registry.register_closure(name, id, params, prepare, setup);
+ m_closure_registry.register_closure(name, id, params, prepare, setup, alignment);
}
@@ -2554,7 +2556,8 @@ void
ClosureRegistry::register_closure (string_view name, int id,
const ClosureParam *params,
PrepareClosureFunc prepare,
- SetupClosureFunc setup)
+ SetupClosureFunc setup,
+ int alignment)
{
if (m_closure_table.size() <= (size_t)id)
m_closure_table.resize(id + 1);
@@ -2578,6 +2581,7 @@ ClosureRegistry::register_closure (string_view name, int id,
}
entry.prepare = prepare;
entry.setup = setup;
+ entry.alignment = alignment;
m_closure_name_to_id[ustring(name)] = id;
}

View File

@@ -1,5 +1,5 @@
--- ./src/doc/CMakeLists.txt.orig 2013-11-26 05:11:29.000000000 +1030
+++ ./src/doc/CMakeLists.txt 2013-11-28 23:57:11.961491397 +1030
--- src/doc/CMakeLists.txt.orig 2015-03-10 21:57:05 UTC
+++ src/doc/CMakeLists.txt
@@ -1,11 +1,11 @@
set (public_docs osl-languagespec.pdf)
# Some day: CLA-INDIVIDUAL CLA-CORPORATE

View File

@@ -1,6 +1,6 @@
--- ./src/shaders/CMakeLists.txt.orig 2013-02-15 11:22:42.000000000 +1030
+++ ./src/shaders/CMakeLists.txt 2013-02-17 07:11:28.389609929 +1030
@@ -42,5 +42,5 @@
--- src/shaders/CMakeLists.txt.orig 2015-03-10 21:57:05 UTC
+++ src/shaders/CMakeLists.txt
@@ -49,5 +49,5 @@ add_custom_target (shaders ALL
SOURCES ${shader_source} ${shader_headers})
install (FILES ${shader_headers} ${shader_source} ${shader_objs}

View File

@@ -21,13 +21,9 @@ include/OSL/oslversion.h
include/OSL/rendererservices.h
include/OSL/shaderglobals.h
lib/liboslcomp.so
lib/liboslcomp.so.1
lib/liboslexec.so
lib/liboslexec.so.1
lib/liboslquery.so
lib/liboslquery.so.1
lib/libtestshade.so
lib/libtestshade.so.1
%%DATADIR%%/CHANGES
%%DATADIR%%/INSTALL
%%DATADIR%%/LICENSE