summaryrefslogtreecommitdiff
path: root/media-libs/osl
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2025-01-10 06:41:31 +0000
committerV3n3RiX <venerix@koprulu.sector>2025-01-10 06:41:31 +0000
commitf9d8ddaae80afb8fa0924cd3f769f9b37dd373e1 (patch)
treed8962e6446d606b8c95329b4b78932a65f928a5f /media-libs/osl
parentd94fef9a5708b8e64f363f4a71f0b56caef5efe4 (diff)
gentoo auto-resync : 10:01:2025 - 06:41:30
Diffstat (limited to 'media-libs/osl')
-rw-r--r--media-libs/osl/Manifest13
-rw-r--r--media-libs/osl/files/osl-1.12.14.0-libfmt11.patch431
-rw-r--r--media-libs/osl/files/osl-1.12.14.0-m_dz.patch23
-rw-r--r--media-libs/osl/files/osl-boost-config.patch22
-rw-r--r--media-libs/osl/files/osl-include-cstdint.patch20
-rw-r--r--media-libs/osl/files/osl-oslfile.patch26
-rw-r--r--media-libs/osl/osl-1.12.14.0-r3.ebuild (renamed from media-libs/osl/osl-1.12.14.0-r2.ebuild)75
-rw-r--r--media-libs/osl/osl-1.13.10.0-r1.ebuild (renamed from media-libs/osl/osl-1.13.10.0.ebuild)42
-rw-r--r--media-libs/osl/osl-1.13.12.0-r1.ebuild (renamed from media-libs/osl/osl-1.13.12.0.ebuild)41
-rw-r--r--media-libs/osl/osl-9999.ebuild41
10 files changed, 687 insertions, 47 deletions
diff --git a/media-libs/osl/Manifest b/media-libs/osl/Manifest
index 94ca76a342f9..200992168440 100644
--- a/media-libs/osl/Manifest
+++ b/media-libs/osl/Manifest
@@ -1,9 +1,14 @@
+AUX osl-1.12.14.0-libfmt11.patch 17575 BLAKE2B 5a9745185816934c124e2c3955e1ef31417a8fa5debc4a47a2918805b805cb907c4e7f4698ad375778876308f60a634f11d5cb6bd0068ae9ec83f0c9f319e28b SHA512 bee654dd41674af24f9d2345988276619ef59681b82649e29c9895eaa61391e44e012cd50fcb07819e572111c2c2a79f559fa54629aef4dfb9268f0942e62b10
+AUX osl-1.12.14.0-m_dz.patch 759 BLAKE2B 90f51613bebf8c33a49809226f1dd156aed0d59f9717566ddde9131bdb3f6257a3a1a790d596c25ed788a126c4bc5a889c38f9a94b72da2a412318aae2e042e2 SHA512 14121a2764fd1662651884f71901cbe16756376fbefc64243deb8d6dc05c5fc3f0e986cc7f257ad9e130f0df75e1734827294c92c33a6f07fd3c99b58dc0c03b
+AUX osl-boost-config.patch 848 BLAKE2B 591a874bec29b28de3efb6ee27aa2c2c719b4342a86f1ca5e176bd493341e0ec284a1e96053b7aae72d2b133738741e61f35fc71193a12c7094482fab04ab83a SHA512 aa044ae09b33035d0357e032d47d500df0b1b7c6ae34e42c802c37ad6687d3c9a02aa4604a513563559269e56a2e32e76c9e5276333a9fd21eee1c3bdd08b35e
+AUX osl-include-cstdint.patch 322 BLAKE2B ef0739524bea3eced1b74cc116719f725a546fdb48704f03eb9134482df6b805512821156a082c788b1383d3d38c928b035846de079b5cae2a5c97e0b4ae1927 SHA512 3c169930fb4f90a176f7f5c120f13a28383cfab5334282f5755b479c7f3ad22dec0c9bdd8d0fbbbe91146248efb3ec83539fa56d1f1ae9be33c6cc3a08376b16
+AUX osl-oslfile.patch 948 BLAKE2B a3862fd04ef4ae18ad8644829a7e064a13e2bd1d2269ca4dfc0358b3d5245eab1ad1035a043f5334a2e786cb07839cfe7475dab9baba6f501d040648d0f5d66d SHA512 12af586c78730725cc8caf67446e8dd006d6cffb240b0d007c9a6b2ac61d2b455daa3d2d8bd2017e9994fcd5191e6165ef6e45e465eb9491e5fc6f5155a3f5bc
DIST osl-1.12.14.0.tar.gz 20555853 BLAKE2B 4f6bc2084e4c1b25e707a37830961f20926e6ab5cb915c763cbd8126127e70f6368832077729ab5e044f573e8c38c4afb413eff8adccee5ea1ae96cb9be43b6e SHA512 51641e58fb0bba042853e3976c104decc788f1b1d3ec2e33a3f5504b11b05950dc38766ffb066b0f76edc4e0a8829d6b7dd408d9288b74d69380395b1d991bd5
DIST osl-1.13.10.0.tar.gz 21776721 BLAKE2B 6b40adcf50403292003ae8216e60328d5af6d25bf22cd241aeb4f99b1d39c628c78fe1bc8372226c984ca38b6e08427525f12dc38e5b6d3355de02cbc71f1b7b SHA512 f005b8797a7bb882bcdf4fd644551d42c150956baa8dd9deff39ff1121321f33b8e144a9a96ac940ae6bf60985c6131457131baa87c73c2b498298aaa77c3c7d
DIST osl-1.13.12.0.tar.gz 21824352 BLAKE2B 0d5c1d166afc347a515187c34d60c0a2be99e8a1b7078a388190f2232ee545654e3c1fea829dfabb7b0a105d69d3d98cc5dae4fa8f4db1a2228f9f258b34e76b SHA512 152a1b085c4ea88c86bc0ccbd694b848b9f50bd91f1a165899c2c3999042e413e54cdfb83dd90ea23daeeb2a3b65f794b8b2c19e9629bbda266971dcd6e3b5e7
-EBUILD osl-1.12.14.0-r2.ebuild 9647 BLAKE2B 2fa1118e970336fcbbdf499c4c584bd7edff4d7e2978f2368a70323bd11f64834a1a5d43fe6b4399bafe6b6b59f00e8ad1a5746204e9bff0b7bd724858d44385 SHA512 6becb0eb838e9dad30fb1644fd0578a190364a6d3f6812437f94c4cbfaf3c7e6059021d0255ac6c885ac9494e4cde0e08cc929c392687283f4b54b27c846d167
+EBUILD osl-1.12.14.0-r3.ebuild 10439 BLAKE2B 1ce29bfd7988636b8c3ca287ebf106b26f5ead7575f9134b5dde1c813df77b4034eb0efcfca830de7ec6373de720800cd32ae80c91e90d34cb923390ec2b49b8 SHA512 dbc37768b5d5c8afb9c1d44b6db737fad57deb0f663f9207c245fe8aa91fa7fa538bf9abdf10734c8cf761ef820dca92aef78b89c9806181d7705fd44e4578a6
EBUILD osl-1.12.14.0.ebuild 3906 BLAKE2B 59228846da135c84663ff3d4a12f3370de16f281bf7f03dbd14668581c2b8fd010de16129f1e1957c51da5d83a0c1d9541ad1713ff5b938c22021ff9b84eb74b SHA512 e557e55accb7b1a5b5b07c1198fe92547d067d6687100f4ef54be38e20488bdda2cb7809e218aa7f207358ab6a1dc157d1bf5581a7db42180ed2fd4927f42c22
-EBUILD osl-1.13.10.0.ebuild 7413 BLAKE2B 41e145d8e5667e4d806d5866d6c0290f19acbe708b016defd8135d95789d4f90fbe1aa3752df7f0f77f44e74a0b48854529a0a54cf11f3c1304d7963de06ed9f SHA512 4705b288b171509af1e6ac213c3b1efeeffb57f82773dcbd60ff67fb91f13d955d0d271027e2028229bb4decdd0af40d55a7eacdc604c37bd3189c7485a5ad32
-EBUILD osl-1.13.12.0.ebuild 7414 BLAKE2B 9c6bb8ac71cfa7be1515560a996ac6a67ce92a7b6b984774a32eaa8019f536a02b2488cb9c66da3d21cfd61a5403a1e899be7280c2877f06ddc99c7e082c5811 SHA512 1301357bcfd76558740d00fc8fda5de4e49449155e27d014c243a8f3ee6561f3a01efac4dca4067187852b94f54bf89e5384fbf158c042be3a338519b86e46b9
-EBUILD osl-9999.ebuild 7414 BLAKE2B 9c6bb8ac71cfa7be1515560a996ac6a67ce92a7b6b984774a32eaa8019f536a02b2488cb9c66da3d21cfd61a5403a1e899be7280c2877f06ddc99c7e082c5811 SHA512 1301357bcfd76558740d00fc8fda5de4e49449155e27d014c243a8f3ee6561f3a01efac4dca4067187852b94f54bf89e5384fbf158c042be3a338519b86e46b9
+EBUILD osl-1.13.10.0-r1.ebuild 7949 BLAKE2B b79ea75f6622de002bb68002c7cc0c1dfa3f0273698e0b1c97a37e45a31633b49153bbc0d4ade9d874de021455a87524084141d98631c462848caa44b38cc5f2 SHA512 1806739ec0a8e42ba3111980fbf144d65119f1b4d7cc479087f5937bcfc28c3827b75dec589346ec0333d16ee53bac9da342857fcfdfd2055dce11aefb50a28f
+EBUILD osl-1.13.12.0-r1.ebuild 7908 BLAKE2B 6bd879152bd18ab8dfbadbfeb9a696c214851ebb62704f97f4d23c615392ed8c332ee0fc1f9f43c28a176b152ad1b2839ba4cc47eb86bb303132b797710c7048 SHA512 10d805b863d8d2ea2e4c2cef312704e09a0fc8b0c0db98735274b5987eb21c97a0fa78755910100e77288a98deea5098603b17b544efbd624f2a00bacdb5957d
+EBUILD osl-9999.ebuild 7908 BLAKE2B 6bd879152bd18ab8dfbadbfeb9a696c214851ebb62704f97f4d23c615392ed8c332ee0fc1f9f43c28a176b152ad1b2839ba4cc47eb86bb303132b797710c7048 SHA512 10d805b863d8d2ea2e4c2cef312704e09a0fc8b0c0db98735274b5987eb21c97a0fa78755910100e77288a98deea5098603b17b544efbd624f2a00bacdb5957d
MISC metadata.xml 1095 BLAKE2B d9d1b720bceb0f61f6841ef3a2d7b222a952f4c96c6ab1ee61f8e28ddae0d470b49fce998d60afedc527c8776d3514268ba0f135fcba881252c512f26e2f3c74 SHA512 b4a36e79e830cf648e0de7fdd3f360cd41834de8ac491972609990386380960b34263fde6d3cd129d07d8032a7741b399880c3f24684ba5ea8beb6498da0189f
diff --git a/media-libs/osl/files/osl-1.12.14.0-libfmt11.patch b/media-libs/osl/files/osl-1.12.14.0-libfmt11.patch
new file mode 100644
index 000000000000..6b0d7caead64
--- /dev/null
+++ b/media-libs/osl/files/osl-1.12.14.0-libfmt11.patch
@@ -0,0 +1,431 @@
+From 62ab57dcaa96587c9c7d014571c4b83da1181090 Mon Sep 17 00:00:00 2001
+From: Larry Gritz <lg@larrygritz.com>
+Date: Mon, 13 Mar 2023 09:58:11 -0700
+Subject: [PATCH] oslc: simple constant folding of binary expressions on the
+ oslc side
+
+The runtime optimization does a great job of constant folding, and
+we'd pushed it there because, with instance parameter values and
+shader network connections known, it can find so much more opportunity
+to optimize than we could in oslc.
+
+However, there is one pesky problem, which is that shader parameters
+that are initialized to even simple expressions such as 3+1 end up
+with "init ops", which although later constant folded by the time the
+shader is JITed, make it impossible to know the value via OSLQuery.
+
+So this patch just takes the simplest cases -- certain `int OP int`
+and `float OP float` expressions involving literal constants, and
+performs the operation as it's parsing the code. So
+
+ int val = 3 + 1;
+
+actually just immediately is turned into `val = 4` instead of making
+an "add".
+
+To reiterate, the add would never have happened while executing the
+shader -- at runtime in the renderer, when it's time to optimize and
+JIT the shader, it would know it's a constant 4 value. This is
+strictly about making oslc directly output an .oso file that knows
+that parameter `val` has default value 4 instead of throwing up its
+hands and saying "it's math code that will be evaluated later."
+
+Signed-off-by: Larry Gritz <lg@larrygritz.com>
+---
+ src/cmake/testing.cmake | 1 +
+ src/liboslcomp/ast.cpp | 63 +++++++++++++++++++++++
+ src/liboslcomp/ast.h | 4 ++
+ src/liboslcomp/oslgram.y | 36 +++++++-------
+ testsuite/oslc-literalfold/ref/out.txt | 28 +++++++++++
+ testsuite/oslc-literalfold/run.py | 7 +++
+ testsuite/oslc-literalfold/test.osl | 69 ++++++++++++++++++++++++++
+ 7 files changed, 190 insertions(+), 18 deletions(-)
+ create mode 100644 testsuite/oslc-literalfold/ref/out.txt
+ create mode 100755 testsuite/oslc-literalfold/run.py
+ create mode 100644 testsuite/oslc-literalfold/test.osl
+
+diff --git a/src/cmake/testing.cmake b/src/cmake/testing.cmake
+index 0ae2c200e..3ce6f2a3d 100644
+--- a/src/cmake/testing.cmake
++++ b/src/cmake/testing.cmake
+@@ -299,6 +299,7 @@ macro (osl_add_all_tests)
+ oslc-err-struct-dup oslc-err-struct-print
+ oslc-err-type-as-variable
+ oslc-err-unknown-ctr
++ oslc-literalfold
+ oslc-pragma-warnerr
+ oslc-warn-commainit
+ oslc-variadic-macro
+diff --git a/src/liboslcomp/ast.cpp b/src/liboslcomp/ast.cpp
+index 0ae74db48..74873e1c1 100644
+--- a/src/liboslcomp/ast.cpp
++++ b/src/liboslcomp/ast.cpp
+@@ -1187,6 +1187,69 @@ ASTbinary_expression::ASTbinary_expression(OSLCompilerImpl* comp, Operator op,
+
+
+
++ASTNode*
++ASTbinary_expression::make(OSLCompilerImpl* comp, Operator op, ASTNode* left,
++ ASTNode* right)
++{
++ // If the left and right are both literal constants, fold the expression
++ if (left->nodetype() == literal_node && right->nodetype() == literal_node) {
++ ASTNode* cf = nullptr; // constant-folded result
++ if (left->typespec().is_int() && right->typespec().is_int()) {
++ int lv = dynamic_cast<ASTliteral*>(left)->intval();
++ int rv = dynamic_cast<ASTliteral*>(right)->intval();
++ switch (op) {
++ case Mul: cf = new ASTliteral(comp, lv * rv); break;
++ case Div: cf = new ASTliteral(comp, rv ? lv / rv : 0); break;
++ case Add: cf = new ASTliteral(comp, lv + rv); break;
++ case Sub: cf = new ASTliteral(comp, lv - rv); break;
++ case Mod: cf = new ASTliteral(comp, rv ? lv % rv : 0); break;
++ case Equal: cf = new ASTliteral(comp, lv == rv ? 1 : 0); break;
++ case NotEqual: cf = new ASTliteral(comp, lv != rv ? 1 : 0); break;
++ case Greater: cf = new ASTliteral(comp, lv > rv ? 1 : 0); break;
++ case Less: cf = new ASTliteral(comp, lv < rv ? 1 : 0); break;
++ case GreaterEqual:
++ cf = new ASTliteral(comp, lv >= rv ? 1 : 0);
++ break;
++ case LessEqual: cf = new ASTliteral(comp, lv <= rv ? 1 : 0); break;
++ case BitAnd: cf = new ASTliteral(comp, lv & rv); break;
++ case BitOr: cf = new ASTliteral(comp, lv | rv); break;
++ case Xor: cf = new ASTliteral(comp, lv ^ rv); break;
++ case ShiftLeft: cf = new ASTliteral(comp, lv << rv); break;
++ case ShiftRight: cf = new ASTliteral(comp, lv >> rv); break;
++ default: break;
++ }
++ } else if (left->typespec().is_float()
++ && right->typespec().is_float()) {
++ float lv = dynamic_cast<ASTliteral*>(left)->floatval();
++ float rv = dynamic_cast<ASTliteral*>(right)->floatval();
++ switch (op) {
++ case Mul: cf = new ASTliteral(comp, lv * rv); break;
++ case Div: cf = new ASTliteral(comp, rv ? lv / rv : 0.0f); break;
++ case Add: cf = new ASTliteral(comp, lv + rv); break;
++ case Sub: cf = new ASTliteral(comp, lv - rv); break;
++ case Equal: cf = new ASTliteral(comp, lv == rv ? 1 : 0); break;
++ case NotEqual: cf = new ASTliteral(comp, lv != rv ? 1 : 0); break;
++ case Greater: cf = new ASTliteral(comp, lv > rv ? 1 : 0); break;
++ case Less: cf = new ASTliteral(comp, lv < rv ? 1 : 0); break;
++ case GreaterEqual:
++ cf = new ASTliteral(comp, lv >= rv ? 1 : 0);
++ break;
++ case LessEqual: cf = new ASTliteral(comp, lv <= rv ? 1 : 0); break;
++ default: break;
++ }
++ }
++ if (cf) {
++ delete left;
++ delete right;
++ return cf;
++ }
++ }
++
++ return new ASTbinary_expression(comp, op, left, right);
++}
++
++
++
+ const char*
+ ASTbinary_expression::childname(size_t i) const
+ {
+diff --git a/src/liboslcomp/ast.h b/src/liboslcomp/ast.h
+index db9bd14e5..f4bd2eeec 100644
+--- a/src/liboslcomp/ast.h
++++ b/src/liboslcomp/ast.h
+@@ -832,6 +832,10 @@ class ASTbinary_expression final : public ASTNode {
+ ASTbinary_expression(OSLCompilerImpl* comp, Operator op, ASTNode* left,
+ ASTNode* right);
+
++ // Special consructor wrapper that can collapse ops between literals
++ static ASTNode* make(OSLCompilerImpl* comp, Operator op, ASTNode* left,
++ ASTNode* right);
++
+ const char* nodetypename() const { return "binary_expression"; }
+ const char* childname(size_t i) const;
+ const char* opname() const;
+diff --git a/src/liboslcomp/oslgram.y b/src/liboslcomp/oslgram.y
+index b65818193..b4f3ad2e1 100644
+--- a/src/liboslcomp/oslgram.y
++++ b/src/liboslcomp/oslgram.y
+@@ -858,109 +858,109 @@ variable_ref
+ binary_expression
+ : expression OR_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Or, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression AND_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::And, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '|' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::BitOr, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '^' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Xor, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '&' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::BitAnd, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression EQ_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Equal, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression NE_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::NotEqual, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '>' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Greater, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression GE_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::GreaterEqual, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '<' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Less, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression LE_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::LessEqual, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression SHL_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::ShiftLeft, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression SHR_OP expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::ShiftRight, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '+' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Add, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '-' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Sub, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '*' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Mul, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '/' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Div, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+ | expression '%' expression
+ {
+- $$ = new ASTbinary_expression (oslcompiler,
++ $$ = ASTbinary_expression::make(oslcompiler,
+ ASTNode::Mod, $1, $3);
+ $$->sourceline (@2.first_line);
+ }
+diff --git a/testsuite/oslc-literalfold/ref/out.txt b/testsuite/oslc-literalfold/ref/out.txt
+new file mode 100644
+index 000000000..9397357ff
+--- /dev/null
++++ b/testsuite/oslc-literalfold/ref/out.txt
+@@ -0,0 +1,28 @@
++Compiled test.osl -> test.oso
++int add_i = 8
++int sub_i = 2
++int mul_i = 15
++int div_i = 1
++int mod_i = 2
++int eq_i = 0
++int ne_i = 1
++int gt_i = 1
++int ge_i = 1
++int lt_i = 0
++int le_i = 0
++int and_i = 1
++int or_i = 7
++int xor_i = 6
++int shl_i = 40
++int shr_i = 0
++float add_f = 8.000000
++float sub_f = 2.000000
++float mul_f = 15.000000
++float div_f = 1.666667
++float eq_f = 0
++float ne_f = 1
++float gt_f = 1
++float ge_f = 1
++float lt_f = 0
++float le_f = 0
++
+diff --git a/testsuite/oslc-literalfold/run.py b/testsuite/oslc-literalfold/run.py
+new file mode 100755
+index 000000000..6836d5554
+--- /dev/null
++++ b/testsuite/oslc-literalfold/run.py
+@@ -0,0 +1,7 @@
++#!/usr/bin/env python
++
++# Copyright Contributors to the Open Shading Language project.
++# SPDX-License-Identifier: BSD-3-Clause
++# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
++
++command = testshade("test")
+diff --git a/testsuite/oslc-literalfold/test.osl b/testsuite/oslc-literalfold/test.osl
+new file mode 100644
+index 000000000..0f1b09e36
+--- /dev/null
++++ b/testsuite/oslc-literalfold/test.osl
+@@ -0,0 +1,69 @@
++// Copyright Contributors to the Open Shading Language project.
++// SPDX-License-Identifier: BSD-3-Clause
++// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
++
++// Test oslc-side constant folding of simple binary operators on literal
++// values
++
++#define three 3
++#define five 5
++
++
++shader test(
++ int add_i = five + three,
++ int sub_i = five - three,
++ int mul_i = five * three,
++ int div_i = five / three,
++ int mod_i = five % three,
++ int eq_i = five == three,
++ int ne_i = five != three,
++ int gt_i = five > three,
++ int ge_i = five >= three,
++ int lt_i = five < three,
++ int le_i = five <= three,
++ int and_i = five & three,
++ int or_i = five | three,
++ int xor_i = five ^ three,
++ int shl_i = five << three,
++ int shr_i = five >> three,
++
++ float add_f = float(five) + float(three),
++ float sub_f = float(five) - float(three),
++ float mul_f = float(five) * float(three),
++ float div_f = float(five) / float(three),
++ int eq_f = float(five) == float(three),
++ int ne_f = float(five) != float(three),
++ int gt_f = float(five) > float(three),
++ int ge_f = float(five) >= float(three),
++ int lt_f = float(five) < float(three),
++ int le_f = float(five) <= float(three),
++)
++{
++ printf("int add_i = %d\n", add_i);
++ printf("int sub_i = %d\n", sub_i);
++ printf("int mul_i = %d\n", mul_i);
++ printf("int div_i = %d\n", div_i);
++ printf("int mod_i = %d\n", mod_i);
++ printf("int eq_i = %d\n", eq_i);
++ printf("int ne_i = %d\n", ne_i);
++ printf("int gt_i = %d\n", gt_i);
++ printf("int ge_i = %d\n", ge_i);
++ printf("int lt_i = %d\n", lt_i);
++ printf("int le_i = %d\n", le_i);
++ printf("int and_i = %d\n", and_i);
++ printf("int or_i = %d\n", or_i);
++ printf("int xor_i = %d\n", xor_i);
++ printf("int shl_i = %d\n", shl_i);
++ printf("int shr_i = %d\n", shr_i);
++
++ printf("float add_f = %f\n", add_f);
++ printf("float sub_f = %f\n", sub_f);
++ printf("float mul_f = %f\n", mul_f);
++ printf("float div_f = %f\n", div_f);
++ printf("float eq_f = %d\n", eq_f);
++ printf("float ne_f = %d\n", ne_f);
++ printf("float gt_f = %d\n", gt_f);
++ printf("float ge_f = %d\n", ge_f);
++ printf("float lt_f = %d\n", lt_f);
++ printf("float le_f = %d\n", le_f);
++}
+From 977f2898b10b9688c4bd65260884e1e477d29806 Mon Sep 17 00:00:00 2001
+From: Larry Gritz <lg@larrygritz.com>
+Date: Sun, 20 Aug 2023 21:36:59 -0700
+Subject: [PATCH] fix: Recent journaling changes break with some fmtlib
+ versions
+
+Certain fmt library versions don't automatically know how to format
+atomics. Explicitly load them to turn into regular ints to avoid new
+build errors introduced by the recent journaling changes.
+
+Signed-off-by: Larry Gritz <lg@larrygritz.com>
+---
+ .github/workflows/ci.yml | 2 +-
+ src/liboslcomp/ast.cpp | 2 +-
+ src/liboslexec/journal.cpp | 6 +++---
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/liboslcomp/ast.cpp b/src/liboslcomp/ast.cpp
+index 74873e1c1..a8e5d75e4 100644
+--- a/src/liboslcomp/ast.cpp
++++ b/src/liboslcomp/ast.cpp
+@@ -46,7 +46,7 @@ ScopeExit print_node_counts([]() {
+ for (int i = 0; i < ASTNode::_last_node; ++i)
+ if (node_counts[i] > 0)
+ Strutil::print("ASTNode type {:2}: {:5} (peak {:5})\n", i,
+- node_counts[i], node_counts_peak[i]);
++ node_counts[i].load(), node_counts_peak[i].load());
+ });
+ } // namespace
+ #endif
diff --git a/media-libs/osl/files/osl-1.12.14.0-m_dz.patch b/media-libs/osl/files/osl-1.12.14.0-m_dz.patch
new file mode 100644
index 000000000000..fb50c53452bf
--- /dev/null
+++ b/media-libs/osl/files/osl-1.12.14.0-m_dz.patch
@@ -0,0 +1,23 @@
+From f8b8242f26a7d4676cf8e5e195f3b6ba0335bcfc Mon Sep 17 00:00:00 2001
+From: Larry Gritz <lg@larrygritz.com>
+Date: Mon, 23 Sep 2024 12:35:36 -0700
+Subject: [PATCH] fix: Typo in dual.h made invalid template DualStorage
+
+Signed-off-by: Larry Gritz <lg@larrygritz.com>
+---
+ src/include/OSL/dual.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/include/OSL/dual.h b/src/include/OSL/dual.h
+index a7b5e4063..60ec05ee8 100644
+--- a/src/include/OSL/dual.h
++++ b/src/include/OSL/dual.h
+@@ -204,7 +204,7 @@ class DualStorage<T, 3>
+ : m_val(other.m_val)
+ , m_dx(other.m_dx)
+ , m_dy(other.m_dy)
+- , m_dz(other.dz)
++ , m_dz(other.m_dz)
+ {}
+
+ OSL_HOSTDEVICE constexpr const T& elem (ConstIndex<0>) const { return m_val; }
diff --git a/media-libs/osl/files/osl-boost-config.patch b/media-libs/osl/files/osl-boost-config.patch
new file mode 100644
index 000000000000..0c0f3bbe71e0
--- /dev/null
+++ b/media-libs/osl/files/osl-boost-config.patch
@@ -0,0 +1,22 @@
+From 8a29f2263675bf9cb7a567f00fc257728b3ac3d8 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 9 Jan 2025 19:49:15 +0100
+Subject: [PATCH] boost config
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+
+diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
+index 7250633..1f032f8 100644
+--- a/src/cmake/externalpackages.cmake
++++ b/src/cmake/externalpackages.cmake
+@@ -57,6 +57,7 @@ else ()
+ checked_find_package (Boost REQUIRED
+ VERSION_MIN 1.55
+ COMPONENTS ${Boost_COMPONENTS}
++ CONFIG
+ RECOMMEND_MIN 1.66
+ RECOMMEND_MIN_REASON "Boost 1.66 is the oldest version our CI tests against"
+ PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES
+--
+2.47.1
+
diff --git a/media-libs/osl/files/osl-include-cstdint.patch b/media-libs/osl/files/osl-include-cstdint.patch
new file mode 100644
index 000000000000..efaa2f81b9b6
--- /dev/null
+++ b/media-libs/osl/files/osl-include-cstdint.patch
@@ -0,0 +1,20 @@
+--- a/src/include/OSL/platform.h
++++ b/src/include/OSL/platform.h
+@@ -18,6 +18,7 @@
+
+ #pragma once
+
++#include <cstdint>
+ #include <cstring>
+ #include <memory>
+
+--- a/src/include/osl_pvt.h
++++ b/src/include/osl_pvt.h
+@@ -4,6 +4,7 @@
+
+ #pragma once
+
++#include <cstdint>
+ #include <memory>
+
+ #include <OSL/oslconfig.h>
diff --git a/media-libs/osl/files/osl-oslfile.patch b/media-libs/osl/files/osl-oslfile.patch
new file mode 100644
index 000000000000..76e985c26372
--- /dev/null
+++ b/media-libs/osl/files/osl-oslfile.patch
@@ -0,0 +1,26 @@
+From 9abc5d56c8ae830355a10d6008b5925faef30af2 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 9 Jan 2025 19:59:01 +0100
+Subject: [PATCH] oslsrc
+
+This was snuck in via
+https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1914
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+
+diff --git a/src/shaders/CMakeLists.txt b/src/shaders/CMakeLists.txt
+index 1ea7bee..e96207d 100644
+--- a/src/shaders/CMakeLists.txt
++++ b/src/shaders/CMakeLists.txt
+@@ -40,7 +40,7 @@ macro (oslc_compile)
+ list (APPEND oslc_args "-I${CMAKE_SOURCE_DIR}/src/shaders")
+ add_custom_command (OUTPUT ${osofile}
+ COMMAND oslc ${oslc_args} "${oslfile}" -o "${osofile}"
+- MAIN_DEPENDENCY ${oslsrc}
++ MAIN_DEPENDENCY ${oslfile}
+ DEPENDS ${_shader_DEPENDS} "${stdosl_header}" oslc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "oslc ${oslsrc_we}")
+--
+2.47.1
+
diff --git a/media-libs/osl/osl-1.12.14.0-r2.ebuild b/media-libs/osl/osl-1.12.14.0-r3.ebuild
index 104c0702a449..92d756ff9fb0 100644
--- a/media-libs/osl/osl-1.12.14.0-r2.ebuild
+++ b/media-libs/osl/osl-1.12.14.0-r3.ebuild
@@ -24,7 +24,7 @@ else
fi
LICENSE="BSD"
-SLOT="0/$(ver_cut 1-3)"
+SLOT="0/$(ver_cut 1-2)" # based on SONAME
X86_CPU_FEATURES=(
sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4.1 sse4_2:sse4.2
@@ -33,19 +33,19 @@ X86_CPU_FEATURES=(
CPU_FEATURES=( "${X86_CPU_FEATURES[@]/#/cpu_flags_x86_}" )
IUSE="debug doc gui libcxx nofma partio test ${CPU_FEATURES[*]%:*} python"
+
RESTRICT="!test? ( test )"
+
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="
dev-libs/boost:=
dev-libs/pugixml
- >=media-libs/openexr-3:0=
>=media-libs/openimageio-2.4:=
$(llvm_gen_dep '
- llvm-core/clang:${LLVM_SLOT}
- llvm-core/llvm:${LLVM_SLOT}
+ llvm-core/clang:${LLVM_SLOT}=
+ llvm-core/llvm:${LLVM_SLOT}=
')
- sys-libs/zlib:=
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
@@ -59,13 +59,28 @@ RDEPEND="
)
"
-DEPEND="${RDEPEND}"
+DEPEND="${RDEPEND}
+ dev-util/patchelf
+ >=media-libs/openexr-3
+ sys-libs/zlib
+ test? (
+ media-fonts/droid
+ )
+"
BDEPEND="
sys-devel/bison
sys-devel/flex
virtual/pkgconfig
"
+PATCHES=(
+ "${FILESDIR}/${PN}-boost-config.patch"
+ "${FILESDIR}/${PN}-oslfile.patch"
+ "${FILESDIR}/${PN}-include-cstdint.patch"
+ "${FILESDIR}/${PN}-1.12.14.0-libfmt11.patch"
+ "${FILESDIR}/${PN}-1.12.14.0-m_dz.patch"
+)
+
pkg_setup() {
llvm-r1_pkg_setup
@@ -115,25 +130,24 @@ src_configure() {
"b8_AVX512_noFMA"
"b16_AVX512_noFMA"
)
- else
- mybatched+=(
- "b8_AVX512"
- "b16_AVX512"
- )
fi
+ mybatched+=(
+ "b8_AVX512"
+ "b16_AVX512"
+ )
fi
if use cpu_flags_x86_avx2 ; then
if use nofma; then
mybatched+=(
"b8_AVX2_noFMA"
)
- else
- mybatched+=(
- "b8_AVX2"
- )
fi
+ mybatched+=(
+ "b8_AVX2"
+ )
fi
- elif use cpu_flags_x86_avx ; then
+ fi
+ if use cpu_flags_x86_avx ; then
mybatched+=(
"b8_AVX"
)
@@ -182,7 +196,7 @@ src_configure() {
if use partio; then
mycmakeargs+=(
- -Dpartio_ROOT="${EPREFIX}/usr"
+ -Dpartio_DIR="${EPREFIX}/usr"
)
fi
@@ -204,7 +218,7 @@ src_test() {
ln -s "${CMAKE_USE_DIR}/src/cmake/" "${BUILD_DIR}/src/cmake" || die
CMAKE_SKIP_TESTS=(
- "broken"
+ "-broken$"
"^render"
# outright fail
@@ -213,6 +227,7 @@ src_test() {
"^color.batched$"
"^color.batched.opt$"
"^matrix.batched.opt$"
+ "^osl-imageio"
"^spline-reg.regress.batched.opt$"
"^transform-reg.regress.batched.opt$"
)
@@ -346,7 +361,7 @@ src_test() {
)
local -x DEBUG CXXFLAGS LD_LIBRARY_PATH DIR OSL_DIR OSL_SOURCE_DIR PYTHONPATH
- DEBUG=1 # doubles the floating point tolerance
+ DEBUG=1 # doubles the floating point tolerance so we avoid FMA related issues
CXXFLAGS="-I${T}/usr/include"
LD_LIBRARY_PATH="${T}/usr/$(get_libdir)"
OSL_DIR="${T}/usr/$(get_libdir)/cmake/OSL"
@@ -358,6 +373,10 @@ src_test() {
cmake_src_test
+ einfo ""
+ einfo "testing render tests in isolation"
+ einfo ""
+
CMAKE_SKIP_TESTS=(
"^render-background$"
"^render-bumptest$"
@@ -381,3 +400,21 @@ src_test() {
cmake_src_test
}
+
+src_install() {
+ cmake_src_install
+
+ if use test; then
+ rm \
+ "${ED}/usr/bin/test"{render,shade{,_dso}} \
+ "${ED}/usr/$(get_libdir)/libtestshade.so"* \
+ || die
+ fi
+
+ if use amd64; then
+ find "${ED}/usr/$(get_libdir)" -type f -name 'lib_*_oslexec.so' -print0 \
+ | while IFS= read -r -d $'\0' batched_lib; do
+ patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
+ done
+ fi
+}
diff --git a/media-libs/osl/osl-1.13.10.0.ebuild b/media-libs/osl/osl-1.13.10.0-r1.ebuild
index bd2b569e7e9c..ccf08a400628 100644
--- a/media-libs/osl/osl-1.13.10.0.ebuild
+++ b/media-libs/osl/osl-1.13.10.0-r1.ebuild
@@ -42,13 +42,11 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="
dev-libs/boost:=
dev-libs/pugixml
- >=media-libs/openexr-3:0=
>=media-libs/openimageio-2.4:=
$(llvm_gen_dep '
- llvm-core/clang:${LLVM_SLOT}
- llvm-core/llvm:${LLVM_SLOT}
+ llvm-core/clang:${LLVM_SLOT}=
+ llvm-core/llvm:${LLVM_SLOT}=
')
- sys-libs/zlib:=
optix? ( dev-libs/optix[-headers-only] )
python? (
${PYTHON_DEPS}
@@ -65,6 +63,8 @@ RDEPEND="
DEPEND="${RDEPEND}
dev-util/patchelf
+ >=media-libs/openexr-3
+ sys-libs/zlib
test? (
media-fonts/droid
)
@@ -75,6 +75,13 @@ BDEPEND="
virtual/pkgconfig
"
+PATCHES=(
+ "${FILESDIR}/${PN}-boost-config.patch"
+ "${FILESDIR}/${PN}-oslfile.patch"
+ "${FILESDIR}/${PN}-include-cstdint.patch"
+ "${FILESDIR}/${PN}-1.12.14.0-m_dz.patch"
+)
+
pkg_setup() {
llvm-r1_pkg_setup
@@ -264,6 +271,15 @@ src_test() {
"^osl-imageio.opt.rs_bitcode$"
)
+ if use optix; then
+ CMAKE_SKIP_TESTS+=(
+ "^color2.optix$"
+ "^color4.optix(|.opt|.fused)$"
+ "^vector2.optix$"
+ "^vector4.optix$"
+ )
+ fi
+
myctestargs=(
# src/build-scripts/ci-test.bash
'--force-new-ctest-process'
@@ -312,10 +328,20 @@ src_install() {
cmake_src_install
if [[ -d "${ED}/usr/build-scripts" ]]; then
- rm -rf "${ED}/usr/build-scripts" || die
+ rm -vr "${ED}/usr/build-scripts" || die
+ fi
+
+ if use test; then
+ rm \
+ "${ED}/usr/bin/test"{render,shade{,_dso}} \
+ "${ED}/usr/$(get_libdir)/libtestshade.so"* \
+ || die
fi
- for batched_lib in "${ED}/usr/$(get_libdir)/lib_"*"_oslexec.so"; do
- patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
- done
+ if use amd64; then
+ find "${ED}/usr/$(get_libdir)" -type f -name 'lib_*_oslexec.so' -print0 \
+ | while IFS= read -r -d $'\0' batched_lib; do
+ patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
+ done
+ fi
}
diff --git a/media-libs/osl/osl-1.13.12.0.ebuild b/media-libs/osl/osl-1.13.12.0-r1.ebuild
index 267c8484ce23..5f185caace4b 100644
--- a/media-libs/osl/osl-1.13.12.0.ebuild
+++ b/media-libs/osl/osl-1.13.12.0-r1.ebuild
@@ -42,13 +42,11 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="
dev-libs/boost:=
dev-libs/pugixml
- >=media-libs/openexr-3:0=
>=media-libs/openimageio-2.4:=
$(llvm_gen_dep '
- llvm-core/clang:${LLVM_SLOT}
- llvm-core/llvm:${LLVM_SLOT}
+ llvm-core/clang:${LLVM_SLOT}=
+ llvm-core/llvm:${LLVM_SLOT}=
')
- sys-libs/zlib:=
optix? ( dev-libs/optix[-headers-only] )
python? (
${PYTHON_DEPS}
@@ -65,6 +63,8 @@ RDEPEND="
DEPEND="${RDEPEND}
dev-util/patchelf
+ >=media-libs/openexr-3
+ sys-libs/zlib
test? (
media-fonts/droid
)
@@ -75,6 +75,12 @@ BDEPEND="
virtual/pkgconfig
"
+PATCHES=(
+ "${FILESDIR}/${PN}-boost-config.patch"
+ "${FILESDIR}/${PN}-oslfile.patch"
+ "${FILESDIR}/${PN}-include-cstdint.patch"
+)
+
pkg_setup() {
llvm-r1_pkg_setup
@@ -264,6 +270,15 @@ src_test() {
"^osl-imageio.opt.rs_bitcode$"
)
+ if use optix; then
+ CMAKE_SKIP_TESTS+=(
+ "^color2.optix$"
+ "^color4.optix(|.opt|.fused)$"
+ "^vector2.optix$"
+ "^vector4.optix$"
+ )
+ fi
+
myctestargs=(
# src/build-scripts/ci-test.bash
'--force-new-ctest-process'
@@ -312,10 +327,20 @@ src_install() {
cmake_src_install
if [[ -d "${ED}/usr/build-scripts" ]]; then
- rm -rf "${ED}/usr/build-scripts" || die
+ rm -vr "${ED}/usr/build-scripts" || die
+ fi
+
+ if use test; then
+ rm \
+ "${ED}/usr/bin/test"{render,shade{,_dso}} \
+ "${ED}/usr/$(get_libdir)/libtestshade.so"* \
+ || die
fi
- for batched_lib in "${ED}/usr/$(get_libdir)/lib_"*"_oslexec.so"; do
- patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
- done
+ if use amd64; then
+ find "${ED}/usr/$(get_libdir)" -type f -name 'lib_*_oslexec.so' -print0 \
+ | while IFS= read -r -d $'\0' batched_lib; do
+ patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
+ done
+ fi
}
diff --git a/media-libs/osl/osl-9999.ebuild b/media-libs/osl/osl-9999.ebuild
index 267c8484ce23..5f185caace4b 100644
--- a/media-libs/osl/osl-9999.ebuild
+++ b/media-libs/osl/osl-9999.ebuild
@@ -42,13 +42,11 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="
dev-libs/boost:=
dev-libs/pugixml
- >=media-libs/openexr-3:0=
>=media-libs/openimageio-2.4:=
$(llvm_gen_dep '
- llvm-core/clang:${LLVM_SLOT}
- llvm-core/llvm:${LLVM_SLOT}
+ llvm-core/clang:${LLVM_SLOT}=
+ llvm-core/llvm:${LLVM_SLOT}=
')
- sys-libs/zlib:=
optix? ( dev-libs/optix[-headers-only] )
python? (
${PYTHON_DEPS}
@@ -65,6 +63,8 @@ RDEPEND="
DEPEND="${RDEPEND}
dev-util/patchelf
+ >=media-libs/openexr-3
+ sys-libs/zlib
test? (
media-fonts/droid
)
@@ -75,6 +75,12 @@ BDEPEND="
virtual/pkgconfig
"
+PATCHES=(
+ "${FILESDIR}/${PN}-boost-config.patch"
+ "${FILESDIR}/${PN}-oslfile.patch"
+ "${FILESDIR}/${PN}-include-cstdint.patch"
+)
+
pkg_setup() {
llvm-r1_pkg_setup
@@ -264,6 +270,15 @@ src_test() {
"^osl-imageio.opt.rs_bitcode$"
)
+ if use optix; then
+ CMAKE_SKIP_TESTS+=(
+ "^color2.optix$"
+ "^color4.optix(|.opt|.fused)$"
+ "^vector2.optix$"
+ "^vector4.optix$"
+ )
+ fi
+
myctestargs=(
# src/build-scripts/ci-test.bash
'--force-new-ctest-process'
@@ -312,10 +327,20 @@ src_install() {
cmake_src_install
if [[ -d "${ED}/usr/build-scripts" ]]; then
- rm -rf "${ED}/usr/build-scripts" || die
+ rm -vr "${ED}/usr/build-scripts" || die
+ fi
+
+ if use test; then
+ rm \
+ "${ED}/usr/bin/test"{render,shade{,_dso}} \
+ "${ED}/usr/$(get_libdir)/libtestshade.so"* \
+ || die
fi
- for batched_lib in "${ED}/usr/$(get_libdir)/lib_"*"_oslexec.so"; do
- patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
- done
+ if use amd64; then
+ find "${ED}/usr/$(get_libdir)" -type f -name 'lib_*_oslexec.so' -print0 \
+ | while IFS= read -r -d $'\0' batched_lib; do
+ patchelf --set-soname "$(basename "${batched_lib}")" "${batched_lib}" || die
+ done
+ fi
}