diff options
author | Marcus von Appen <mva@FreeBSD.org> | 2015-02-08 20:51:53 +0000 |
---|---|---|
committer | Marcus von Appen <mva@FreeBSD.org> | 2015-02-08 20:51:53 +0000 |
commit | 3bbf7b9e2447d5261739596f2e26c19f93baec01 (patch) | |
tree | d407d8510c98702abb4ec7408212f19aeea54214 /graphics | |
parent | ec3490597599051e4bd0db7caf937d8c08a7fd4d (diff) | |
download | ports-3bbf7b9e2447d5261739596f2e26c19f93baec01.tar.gz ports-3bbf7b9e2447d5261739596f2e26c19f93baec01.zip |
Notes
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/openshadinglanguage/Makefile | 4 | ||||
-rw-r--r-- | graphics/openshadinglanguage/distinfo | 4 | ||||
-rw-r--r-- | graphics/openshadinglanguage/files/patch-alignment.patch | 181 | ||||
-rw-r--r-- | graphics/openshadinglanguage/files/patch-src__testshade__testshade.cpp | 11 |
4 files changed, 185 insertions, 15 deletions
diff --git a/graphics/openshadinglanguage/Makefile b/graphics/openshadinglanguage/Makefile index f34e719ff9c5..8e9f98c7cbdb 100644 --- a/graphics/openshadinglanguage/Makefile +++ b/graphics/openshadinglanguage/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= openshadinglanguage -PORTVERSION= 1.5.11 +PORTVERSION= 1.5.12 CATEGORIES= graphics devel MAINTAINER= FreeBSD@Shaneware.biz @@ -21,7 +21,7 @@ USE_GITHUB= yes GH_ACCOUNT= imageworks GH_PROJECT= OpenShadingLanguage GH_TAGNAME= Release-${PORTVERSION} -GH_COMMIT= 9c3ba5b +GH_COMMIT= f03977a CMAKE_ARGS= -DLLVM_CONFIG:STRING="${LOCALBASE}/bin/llvm-config34" USE_LDCONFIG= yes diff --git a/graphics/openshadinglanguage/distinfo b/graphics/openshadinglanguage/distinfo index 716908a37747..c53f6728c4af 100644 --- a/graphics/openshadinglanguage/distinfo +++ b/graphics/openshadinglanguage/distinfo @@ -1,2 +1,2 @@ -SHA256 (openshadinglanguage-1.5.11.tar.gz) = 756712f3a28ab0b0c304d0732703486b0f9daf023dd9f751bbad53f65efb8ec4 -SIZE (openshadinglanguage-1.5.11.tar.gz) = 11560150 +SHA256 (openshadinglanguage-1.5.12.tar.gz) = 2eeff220999503ae1f2bed6ad9979cb32550858bd694487e4d4b27e49d58e67a +SIZE (openshadinglanguage-1.5.12.tar.gz) = 11560513 diff --git a/graphics/openshadinglanguage/files/patch-alignment.patch b/graphics/openshadinglanguage/files/patch-alignment.patch new file mode 100644 index 000000000000..05c6fa646a8a --- /dev/null +++ b/graphics/openshadinglanguage/files/patch-alignment.patch @@ -0,0 +1,181 @@ +--- ./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; + } + + diff --git a/graphics/openshadinglanguage/files/patch-src__testshade__testshade.cpp b/graphics/openshadinglanguage/files/patch-src__testshade__testshade.cpp deleted file mode 100644 index 840649eaebe3..000000000000 --- a/graphics/openshadinglanguage/files/patch-src__testshade__testshade.cpp +++ /dev/null @@ -1,11 +0,0 @@ ---- src/testshade/testshade.cpp.orig 2014-09-23 05:01:22 UTC -+++ src/testshade/testshade.cpp -@@ -733,7 +733,7 @@ test_shade (int argc, const char *argv[] - int num_layers = 0; - shadingsys->getattribute (shadergroup.get(), "num_layers", num_layers); - if (num_layers > 0) { -- std::vector<const char *> layers (num_layers, NULL); -+ std::vector<const char *> layers (size_t(num_layers), NULL); - shadingsys->getattribute (shadergroup.get(), "layer_names", - TypeDesc(TypeDesc::STRING, num_layers), - &layers[0]); |