Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f63a460949 | ||
|
|
4daf4d3717 | ||
|
|
9ed80c18fc | ||
|
|
88276b569f | ||
|
|
2aca8a1a70 | ||
|
|
ab43e6aee6 | ||
|
|
80755a0ad9 | ||
|
|
e01696b79b | ||
|
|
f27825ac6f | ||
|
|
f19fc760fa | ||
|
|
67d820d25a | ||
|
|
ec83eeff0b | ||
|
|
1b3aa7abe3 | ||
|
|
cc8f0d03e1 | ||
|
|
73fc3ba685 | ||
|
|
07b81ef7ac | ||
|
|
23e684f3c7 | ||
|
|
1cb17d3092 | ||
|
|
90477c990d | ||
|
|
10ec529e22 | ||
|
|
853f87b9fe | ||
|
|
53578ae635 | ||
|
|
e28c970266 | ||
|
|
f265b4f7c0 | ||
|
|
e81beb12d0 | ||
|
|
b0e2a455b3 | ||
|
|
ab48d84e21 | ||
|
|
fabb9d2231 | ||
|
|
8b88ad8873 | ||
|
|
37af00a3da | ||
|
|
910a967655 | ||
|
|
25c7d4d8bf | ||
|
|
b87cceb29c | ||
|
|
9b3ed783ac | ||
|
|
a49f8e03d4 | ||
|
|
3b45595c54 | ||
|
|
ea2b85537a | ||
|
|
c294cddad9 | ||
|
|
9176da32e0 | ||
|
|
0cc4ff4b1d | ||
|
|
89ba4196a5 | ||
|
|
060c89d007 | ||
|
|
b86f0b94bb | ||
|
|
e9a78a2824 | ||
|
|
2c7c4f2f36 | ||
|
|
54f36c42bb | ||
|
|
5eac061c6e | ||
|
|
b9907e1636 | ||
|
|
5e47ef444e | ||
|
|
e94b0fec1e | ||
|
|
ee3403a916 | ||
|
|
da77f89205 | ||
|
|
5fede29c6e | ||
|
|
434914e7ee | ||
|
|
726dc3ff0c | ||
|
|
a88d708bc8 | ||
|
|
90d94caecb | ||
|
|
5da8e8c8bb | ||
|
|
9ceac106fa | ||
|
|
726049ad49 | ||
|
|
710d1154b3 | ||
|
|
04645499ab | ||
|
|
0d9ab3c495 | ||
|
|
cbb0e28159 | ||
|
|
c9a37f5cd3 | ||
|
|
c59d74f72c | ||
|
|
facfe0b74a | ||
|
|
2cdd061a5f | ||
|
|
17e0449263 | ||
|
|
2d29966c48 | ||
|
|
0be867f7bf | ||
|
|
362b01ecdd | ||
|
|
657dab9da0 | ||
|
|
26ad18688d | ||
|
|
a5857c5525 | ||
|
|
e2a3153667 | ||
|
|
34fa5c3755 | ||
|
|
67a3c0b93c | ||
|
|
60dcec97e7 | ||
|
|
cf47571daa | ||
|
|
c9672c8a0d | ||
|
|
e8fce16d36 | ||
|
|
76f187e4d0 | ||
|
|
7678df2971 | ||
|
|
9ffb5fb2a3 | ||
|
|
f61edf2fdf | ||
|
|
b2190faa27 | ||
|
|
35aa264dc8 | ||
|
|
5c1617fec2 | ||
|
|
f1c2299ff7 | ||
|
|
c7aee41a1c | ||
|
|
79ab666246 | ||
|
|
c8b59032fb | ||
|
|
0a9070cb62 | ||
|
|
80dee64963 | ||
|
|
901bea3aac | ||
|
|
b7a1a87dc7 | ||
|
|
0c60a1a170 | ||
|
|
98cc66a2e2 | ||
|
|
5592be9f11 | ||
|
|
517d10934f | ||
|
|
8ac55309ab | ||
|
|
c882e823c1 | ||
|
|
a5777fddc5 | ||
|
|
c14bcd2785 | ||
|
|
a23c42fcc6 | ||
|
|
434f04d336 | ||
|
|
a1002c61c1 | ||
|
|
92b0135971 | ||
|
|
3896d22a21 | ||
|
|
500381cc64 | ||
|
|
b2b5e5eaba | ||
|
|
8e420b4bc8 | ||
|
|
a90ed53f88 | ||
|
|
7ee3e36dbb | ||
|
|
18d79314df | ||
|
|
6f9c907db8 | ||
|
|
b20183d13e | ||
|
|
cdbc05a2b2 | ||
|
|
b218c1853b | ||
|
|
a2b9334422 | ||
|
|
c17553af3f | ||
|
|
b08c484bca | ||
|
|
e5f0833d51 | ||
|
|
6979f995d9 | ||
|
|
a0c3665725 | ||
|
|
b88122e7ca | ||
|
|
100490bf8d | ||
|
|
7130058741 | ||
|
|
7394f997db | ||
|
|
f7399cee8e | ||
|
|
5dd94cf83d | ||
|
|
78ba7b8f0d | ||
|
|
2dd1883f95 | ||
|
|
410c04ead8 | ||
|
|
a31fba5505 | ||
|
|
98587dfdf8 | ||
|
|
822518f920 | ||
|
|
442b265940 | ||
|
|
09bfd07da7 | ||
|
|
74a53ff545 | ||
|
|
6ae6aef389 | ||
|
|
4a44416156 | ||
|
|
a30b4f4290 | ||
|
|
f31791b23a | ||
|
|
4a9fc9cc87 | ||
|
|
3e6c52366b | ||
|
|
a014de80fe | ||
|
|
e8bbd79b70 | ||
|
|
b75ce26416 | ||
|
|
c193b0753e | ||
|
|
cf725983de | ||
|
|
fc16c8dde2 | ||
|
|
257ca66afe | ||
|
|
fde2a3e5ee | ||
|
|
6906daebdc | ||
|
|
d80bbaa50a | ||
|
|
a1a77b86ab | ||
|
|
267c93104b | ||
|
|
d08f476b3c | ||
|
|
7e9ddadc0f | ||
|
|
0cdf072c22 | ||
|
|
9f033074fa | ||
|
|
6d9db5a761 | ||
|
|
6cd6849580 | ||
|
|
db1dcc1053 | ||
|
|
af15fb3b3d | ||
|
|
9e9acd1592 | ||
|
|
60975da4e2 | ||
|
|
c25cdd4eab | ||
|
|
01284d3af8 | ||
|
|
c0185c1482 | ||
|
|
93866b7c77 | ||
|
|
d9db605bed | ||
|
|
13d2c1914f | ||
|
|
61d10d6aaf | ||
|
|
3601a3fd1c | ||
|
|
2d6210a893 | ||
|
|
26e8da310b | ||
|
|
07b2d9fb15 | ||
|
|
6c06652cfd | ||
|
|
4ee62cd2ef | ||
|
|
68c67633f5 | ||
|
|
6f65f91b49 | ||
|
|
475a109281 | ||
|
|
91eb43227a | ||
|
|
8c2a10268f | ||
|
|
ec8ec11cfd | ||
|
|
61bb9ac11e | ||
|
|
bd7d138f04 | ||
|
|
38015b6be2 | ||
|
|
d42c5d3e1d | ||
|
|
162b355bc8 | ||
|
|
d383680521 | ||
|
|
95ed032dcd | ||
|
|
0c5544e4dc | ||
|
|
54844fe68d | ||
|
|
760561d74e | ||
|
|
354eb8576c | ||
|
|
a725f2b97e | ||
|
|
29e8d0bf50 | ||
|
|
422c0966a6 | ||
|
|
9b706d30bf | ||
|
|
ceda8c0d23 | ||
|
|
b561a67ad1 | ||
|
|
4e34e8dd20 | ||
|
|
905058ee13 | ||
|
|
d3e443b766 | ||
|
|
d860eae924 | ||
|
|
71a518e9a5 | ||
|
|
2bbd6610c8 | ||
|
|
5bcee23e34 |
@@ -4,7 +4,6 @@
|
||||
|
||||
Language: Cpp
|
||||
BasedOnStyle: WebKit
|
||||
SpaceBeforeParens: ControlStatements
|
||||
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
|
||||
@@ -43,3 +43,7 @@ c1045f2c2845a98e661c7181932a031eb3c76063
|
||||
# clang-format: the very last piece of the puzzle (#1555)
|
||||
4ee62cd2ef05543f818f4d95a19efc1d684a7381
|
||||
5be7c6bd4e7bd2e560cb6be8c06f11985384a87a
|
||||
|
||||
# Raise CI formatting standard to clang-format 17
|
||||
a9ce35135e6c022d538a4a184fee1b5ce908aed8
|
||||
90d94caecbb97141c9df63abc634be6e8394b6c3
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
- [ ] I have updated the documentation, if applicable.
|
||||
- [ ] I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
|
||||
- [ ] My code follows the prevailing code style of this project. If I haven't
|
||||
already run clang-format before submitting, I definitely will look at the CI
|
||||
test that runs clang-format and fix anything that it highlights as being
|
||||
nonconforming.
|
||||
already run clang-format v17 before submitting, I definitely will look at
|
||||
the CI test that runs clang-format and fix anything that it highlights as
|
||||
being nonconforming.
|
||||
|
||||
+63
-56
@@ -23,6 +23,8 @@ on:
|
||||
# Full nightly build, for the main project repo (not for forks)
|
||||
- cron: "0 6 * * *"
|
||||
if: github.repository == 'AcademySoftwareFoundation/OpenShadingLanguage'
|
||||
workflow_dispatch:
|
||||
# This allows manual triggering of the workflow from the web
|
||||
|
||||
|
||||
permissions: read-all
|
||||
@@ -102,7 +104,7 @@ jobs:
|
||||
cxx_std: 17
|
||||
openimageio_ver: master
|
||||
python_ver: 3.9
|
||||
pybind11_ver: v2.6.2
|
||||
pybind11_ver: v2.7.0
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2,b8_AVX512,b16_AVX512
|
||||
setenvs: USE_OPENVDB=0
|
||||
@@ -115,7 +117,14 @@ jobs:
|
||||
cxx_compiler: icpc
|
||||
cxx_std: 17
|
||||
fmt_ver: 7.1.3
|
||||
openimageio_ver: master
|
||||
openimageio_ver: release
|
||||
# Changes to OIIO's simd.h starting in commit 68666db9 (from PR
|
||||
# #4187) seem to trigger compiler bugs in icc and generate wrong
|
||||
# SIMD code. It's probably not worth tracking down for just this
|
||||
# obsolete compiler. Just lock down to OIIO 2.5 for icc builds to
|
||||
# avoid the problem.
|
||||
# openimageio_ver: e41ac03c0b21 # works
|
||||
# openimageio_ver: 68666db994d5 # broken
|
||||
python_ver: 3.9
|
||||
pybind11_ver: v2.9.0
|
||||
# simd: avx2,f16c
|
||||
@@ -138,6 +147,7 @@ jobs:
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2_noFMA
|
||||
setenvs: export OSL_CMAKE_FLAGS="-DSTOP_ON_WARNING=OFF" USE_OPENVDB=0
|
||||
OPENCOLORIO_VERSION=v2.3.2 OPENCOLORIO_CXX=g++
|
||||
- desc: gcc11/C++17 llvm15 py3.10 boost1.80 exr3.1 oiio-rel avx2
|
||||
nametag: linux-vfx2023
|
||||
runner: ubuntu-latest
|
||||
@@ -171,7 +181,7 @@ jobs:
|
||||
openexr_ver: v2.4.3
|
||||
openimageio_ver: v2.4.13.0
|
||||
python_ver: 2.7
|
||||
pybind11_ver: v2.6.2
|
||||
pybind11_ver: v2.7.0
|
||||
simd: 0
|
||||
setenvs: export PUGIXML_VERSION=v1.8
|
||||
CMAKE_VERSION=3.15.5
|
||||
@@ -217,25 +227,6 @@ jobs:
|
||||
# texture system adequately and is able to ignore the benign
|
||||
# "leaks."
|
||||
|
||||
# Test formatting. This test entry doesn't do a full build, it
|
||||
# just runs clang-format on everything, and passes if nothing is
|
||||
# misformatted. Upon failure, the build artifact will be the full
|
||||
# source code with the formatting fixed (diffs will also appear in
|
||||
# the console output).
|
||||
- desc: "clang-format"
|
||||
nametag: clang-format
|
||||
runner: ubuntu-latest
|
||||
container: aswftesting/ci-osl:2022-clang14
|
||||
vfxyear: 2022
|
||||
cxx_std: 17
|
||||
openimageio_ver: release
|
||||
python_ver: 3.9
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2
|
||||
skip_tests: 1
|
||||
setenvs: export BUILDTARGET=clang-format
|
||||
OPENIMAGEIO_CMAKE_FLAGS=-DUSE_PYTHON=0
|
||||
|
||||
# Test ABI stability. `abi_check` is the version or commit that we
|
||||
# believe is the current standard against which we don't want to
|
||||
# break the ABI. Basically, we will build that version as well as
|
||||
@@ -255,7 +246,7 @@ jobs:
|
||||
fmt_ver: 10.1.1
|
||||
pybind11_ver: v2.10.0
|
||||
skip_tests: 1
|
||||
abi_check: 8374278a07d88358a6931dc2492f98ca49b21038
|
||||
abi_check: 1726df72a9841df93bc74a5184d78cacb44b585d
|
||||
setenvs: export OSL_CMAKE_FLAGS="-DOSL_BUILD_TESTS=0 -DBUILD_TESTING=OFF -DUSE_QT=0"
|
||||
OPENIMAGEIO_CMAKE_FLAGS="-DUSE_PYTHON=0"
|
||||
CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
@@ -275,6 +266,8 @@ jobs:
|
||||
USE_BATCHED: ${{matrix.batched}}
|
||||
USE_SIMD: ${{matrix.simd}}
|
||||
ABI_CHECK: ${{matrix.abi_check}}
|
||||
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
|
||||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
||||
steps:
|
||||
# We would like to use harden-runner, but it flags too many false
|
||||
# positives, every time we download a dependency. We should use it only
|
||||
@@ -326,6 +319,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p abi_standard/build
|
||||
pushd abi_standard
|
||||
export LD_LIBRARY_PATH="${PWD}/build/lib:${LD_LIBRARY_PATH}"
|
||||
src/build-scripts/ci-build.bash
|
||||
popd
|
||||
- name: Check ABI
|
||||
@@ -379,7 +373,7 @@ jobs:
|
||||
setenvs: export LLVM_VERSION=10.0.0
|
||||
OPENIMAGEIO_CMAKE_FLAGS="-DBUILD_FMT_VERSION=7.0.1"
|
||||
PUGIXML_VERSION=v1.10
|
||||
- desc: latest releases gcc11/C++17 llvm15 boost1.71 exr3.2 py3.9 avx2 batch-b16avx512
|
||||
- desc: latest releases gcc11/C++17 llvm16 boost1.71 exr3.2 py3.9 avx2 batch-b16avx512
|
||||
nametag: linux-latest-releases
|
||||
runner: ubuntu-22.04
|
||||
cxx_compiler: g++-11
|
||||
@@ -391,11 +385,11 @@ jobs:
|
||||
python_ver: "3.10"
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2,b8_AVX512,b16_AVX512
|
||||
setenvs: export LLVM_VERSION=15.0.6
|
||||
LLVM_DISTRO_NAME=ubuntu-18.04
|
||||
setenvs: export LLVM_VERSION=16.0.4
|
||||
LLVM_DISTRO_NAME=ubuntu-22.04
|
||||
OPENCOLORIO_VERSION=v2.2.0
|
||||
PUGIXML_VERSION=v1.13
|
||||
- desc: bleeding edge gcc12/C++17 llvm16 oiio/ocio/exr/pybind-master boost1.71 py3.10 avx2 batch-b16avx512
|
||||
- desc: bleeding edge gcc12/C++17 llvm17 oiio/ocio/exr/pybind-master boost1.71 py3.10 avx2 batch-b16avx512
|
||||
nametag: linux-bleeding-edge
|
||||
runner: ubuntu-22.04
|
||||
cxx_compiler: g++-12
|
||||
@@ -407,7 +401,7 @@ jobs:
|
||||
python_ver: "3.10"
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2,b8_AVX512,b16_AVX512
|
||||
setenvs: export LLVM_VERSION=16.0.4
|
||||
setenvs: export LLVM_VERSION=17.0.6
|
||||
LLVM_DISTRO_NAME=ubuntu-22.04
|
||||
OPENCOLORIO_VERSION=main
|
||||
PUGIXML_VERSION=master
|
||||
@@ -428,6 +422,27 @@ jobs:
|
||||
LLVM_DISTRO_NAME=ubuntu-18.04
|
||||
OPENCOLORIO_VERSION=v2.1.2
|
||||
PUGIXML_VERSION=v1.11.4
|
||||
# Test formatting. This test entry doesn't do a full build, it
|
||||
# just runs clang-format on everything, and passes if nothing is
|
||||
# misformatted. Upon failure, the build artifact will be the full
|
||||
# source code with the formatting fixed (diffs will also appear in
|
||||
# the console output).
|
||||
- desc: "clang-format"
|
||||
nametag: clang-format
|
||||
runner: ubuntu-latest
|
||||
container: aswftesting/ci-osl:2022-clang14
|
||||
cxx_std: 17
|
||||
extra_artifacts: "src/*.*"
|
||||
openimageio_ver: release
|
||||
python_ver: "3.10"
|
||||
simd: avx2,f16c
|
||||
batched: b8_AVX2
|
||||
skip_tests: 1
|
||||
setenvs: export BUILDTARGET=clang-format
|
||||
LLVM_VERSION=17.0.6
|
||||
LLVM_DISTRO_NAME=ubuntu-22.04
|
||||
OPENIMAGEIO_CMAKE_FLAGS=-DUSE_PYTHON=0
|
||||
QT_VERSION=0
|
||||
|
||||
runs-on: ${{matrix.runner}}
|
||||
env:
|
||||
@@ -482,45 +497,37 @@ jobs:
|
||||
build/*.cmake
|
||||
build/CMake*
|
||||
build/testsuite/*/*.*
|
||||
${{ matrix.extra_artifacts }}
|
||||
|
||||
|
||||
macos:
|
||||
name: "${{matrix.runner}} appleclang${{matrix.aclang}}/C++${{matrix.cxx_std}} py${{matrix.python_ver}} ${{matrix.desc}}"
|
||||
name: "${{matrix.runner}} C++${{matrix.cxx_std}} py${{matrix.python_ver}} ${{matrix.desc}}"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# - desc: MacOS-11
|
||||
# runner: macos-11
|
||||
# nametag: macos11-py310
|
||||
# cc_compiler: /usr/local/opt/llvm@14/bin/clang
|
||||
# cxx_compiler: /usr/local/opt/llvm@14/bin/clang++
|
||||
# cxx_std: 17
|
||||
# python_ver: "3.10"
|
||||
# aclang: 13
|
||||
# setenvs: export LLVMBREWVER="@14" DO_BREW_UPDATE=1
|
||||
# OPENIMAGEIO_VERSION=release
|
||||
# QT_BREW_VERSION="@5"
|
||||
- desc: MacOS-12
|
||||
runner: macos-12
|
||||
nametag: macos12-p310
|
||||
cc_compiler: /usr/local/opt/llvm@15/bin/clang
|
||||
cxx_compiler: /usr/local/opt/llvm@15/bin/clang++
|
||||
cxx_std: 17
|
||||
python_ver: "3.10"
|
||||
aclang: 13
|
||||
setenvs: export LLVMBREWVER="@15" DO_BREW_UPDATE=1
|
||||
OPENIMAGEIO_VERSION=master
|
||||
- desc: MacOS-13
|
||||
- desc: MacOS-13 llvm17
|
||||
runner: macos-13
|
||||
nametag: macos13-p311
|
||||
cc_compiler: /usr/local/opt/llvm@15/bin/clang
|
||||
cxx_compiler: /usr/local/opt/llvm@15/bin/clang++
|
||||
cc_compiler: /usr/local/opt/llvm/bin/clang
|
||||
cxx_compiler: /usr/local/opt/llvm/bin/clang++
|
||||
cxx_std: 17
|
||||
openimageio_ver: master
|
||||
python_ver: "3.11"
|
||||
aclang: 14
|
||||
setenvs: export LLVMBREWVER="@15" DO_BREW_UPDATE=1
|
||||
OPENIMAGEIO_VERSION=master
|
||||
setenvs: export DO_BREW_UPDATE=1 CTEST_TEST_TIMEOUT=120
|
||||
- desc: MacOS-14-ARM llvm17
|
||||
runner: macos-14
|
||||
nametag: macos14-arm-p311
|
||||
cc_compiler: clang
|
||||
cxx_compiler: clang++
|
||||
Xcc_compiler: /usr/local/opt/llvm/bin/clang
|
||||
Xcxx_compiler: /usr/local/opt/llvm/bin/clang++
|
||||
cxx_std: 17
|
||||
openimageio_ver: master
|
||||
python_ver: "3.11"
|
||||
aclang: 15
|
||||
setenvs: export DO_BREW_UPDATE=1
|
||||
|
||||
runs-on: ${{matrix.runner}}
|
||||
env:
|
||||
@@ -549,7 +556,7 @@ jobs:
|
||||
run: |
|
||||
source src/build-scripts/install_homebrew_deps.bash
|
||||
if [[ "$OPENIMAGEIO_VERSION" != "" ]] ; then \
|
||||
OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0" ; \
|
||||
OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_OPENGL=0 -DCMAKE_UNITY_BUILD=ON" ; \
|
||||
source src/build-scripts/build_openimageio.bash ; \
|
||||
else \
|
||||
brew install --display-times -q openimageio ; \
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
# Copyright Contributors to the Open Shading Language project.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# https://github.com/AcademySoftwareFoundation/OpenshadingLanguage
|
||||
|
||||
|
||||
name: Publish Release Notice to ASWF Slack
|
||||
|
||||
on:
|
||||
@@ -14,5 +19,8 @@ jobs:
|
||||
- name: Notify Slack
|
||||
id: slack
|
||||
with:
|
||||
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_RELEASES_URL }}
|
||||
uses: fedecalendino/slack-release-notifier@8329c1c2d20055ff874ce3eaed7021735d17069d # v2.1.0
|
||||
project_name: "Open Shading Language"
|
||||
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
|
||||
slack_channel: "#release-announcements"
|
||||
project_logo: "https://artwork.aswf.io/projects/openshadinglanguage/Icon/Color/openshadinglanguage-Icon-Color.png"
|
||||
uses: jmertic/slack-release-notifier@main
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# This file establishes email equivalences so we can resolve what look like
|
||||
# multiple authors, but actually are the same author who has used multiple
|
||||
# emails over the course of their involvement with the project.
|
||||
#
|
||||
# The format is any of the following:
|
||||
# <CANONICAL-EMAIL> <alternate-email>
|
||||
# CANONICAL-NAME <CANONICAL-EMAIL> <alternate-email>
|
||||
# CANONICAL-NAME <CANONICAL-EMAIL> alternate-name <alternate-email>
|
||||
#
|
||||
# You can check for duplicates with this command:
|
||||
# git shortlog -sne --all
|
||||
# That command (and others) will use this file to collapse the duplicates.
|
||||
#
|
||||
# If you see any duplicates we don't account for here, or if you look at your
|
||||
# own entry here and want a different name or email to be your canonical one
|
||||
# (we may not have guessed correctly and matched your preferences), please
|
||||
# file a PR with the edits to this file.
|
||||
|
||||
Adam Martinez <amartinez.cg@gmail.com> amartinez-cg <amartinez.cg@gmail.com>
|
||||
Alejandro Conty <aconty@imageworks.com> aconty <aconty@gmail.com>
|
||||
Alejandro Conty <aconty@imageworks.com> Alejandro Conty <aconty@gmail.com>
|
||||
Alex M. Wells <alex.m.wells@intel.com> <alex.m.wells@intel.com>
|
||||
Alex M. Wells <alex.m.wells@intel.com> <AlexMWells@users.noreply.github.com>
|
||||
Alex M. Wells <alex.m.wells@intel.com> <awells-np@argon.sea.pixar.com>
|
||||
Alexis Oblet <alob@mikrosimage.eu> Alexis Oblet <aoblet@users.noreply.github.com>
|
||||
Brecht Van Lommel <brecht@blender.org> <brecht@solidangle.com>
|
||||
Brecht Van Lommel <brecht@blender.org> Brecht Van Lommel <brechtvanlommel@gmail.com>
|
||||
Chris Kulla <ckulla@gmail.com> <ckulla@imageworks.com>
|
||||
Chris Kulla <ckulla@gmail.com> <fpsunflower@users.noreply.github.com>
|
||||
Chris Kulla <ckulla@gmail.com> Christopher Kulla <ckulla@gmail.com>
|
||||
Chris Kulla <ckulla@gmail.com> fpsunflower <ckulla@gmail.com>
|
||||
Clifford Stein <cstein@imageworks.com> Cliff Stein <clifford.stein@gmail.com>
|
||||
Clifford Stein <cstein@imageworks.com> cmstein <cstein@imageworks.com>
|
||||
Declan Russell <declan.russell@autodesk.com> Declan Russell <i7709212@bournemouth.ac.uk>
|
||||
Derek Haase <derekhaase@gmail.com> Derek Haase <dhaase@imageworks.com>
|
||||
Esteban Tovagliari <ramenhdr@gmail.com> est77 <ramenhdr@gmail.com>
|
||||
Henri Fousse <henri.fousse@free.fr> darkhorse64 <henri.fousse@free.fr>
|
||||
Larry Gritz <lg@imageworks.com> <larrygritz@gmail.com>
|
||||
Larry Gritz <lg@imageworks.com> <lg@larrygritz.com>
|
||||
Roman Zulak <marsupial@users.noreply.github.com> <rzulak@imageworks.com>
|
||||
Roman Zulak <marsupial@users.noreply.github.com> Frederich Munch <marsupial@users.noreply.github.com>
|
||||
Roman Zulak <marsupial@users.noreply.github.com> marsupial <marsupial@users.noreply.github.com>
|
||||
Ronan Keryell <Ronan.Keryell@amd.com> Ronan Keryell <Ronan.Keryell@silkan.com>
|
||||
Steena Monteiro <steena.monteiro@intel.com> steena.monteiro <smonteir@ortce-sklaw.jf.intel.com>
|
||||
Sven-Hendrik Haase <sh@lutzhaase.com> Sven-Hendrik Haase <svenstaro@gmail.com>
|
||||
Tim Grant <tgrant@nvidia.com> Tim Grant <87798327+tgrant-nv@users.noreply.github.com>
|
||||
Tim Grant <tgrant@nvidia.com> timgrant <timgrant@users.noreply.github.com>
|
||||
+124
-28
@@ -1,20 +1,80 @@
|
||||
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
|
||||
<!-- Copyright Contributors to the Open Shading Language Project. -->
|
||||
|
||||
Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
--------------------------------------------------
|
||||
### Dependency and standards requirements changes:
|
||||
* OptiX 6.0 support has been removed. For GPU rendering with OptiX, a minimum
|
||||
of OptiX 7.0 is required.
|
||||
Release 1.13.11.0 -- 1 Sep 2024 (compared to 1.13.10.0)
|
||||
---------------------------------------------------------
|
||||
- *fix/batched*: Assume BatchedRendererServices texture derivatives are in st space. [#1828](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1828) (by sfriedmapixar) (1.13.10.0)
|
||||
- *fix*: Make backfacing shadeop indicate backfacing shader-global is needed [#1827](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1827) (by sfriedmapixar) (1.13.10.0)
|
||||
- *deps*: Handle various OpenImageIO deprecations and changes in the run-up to OIIO 3.0 [#1834](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1834) [#1806](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1806) [#1838](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1838) [#1842](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1842) [#1850](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1850) (1.13.10.0)
|
||||
- *deps*: Adjust to OIIO change to IC/TS API [#1848](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1848) (1.13.10.0)
|
||||
- *deps*: Llvm 18 compat issue - include libclangAPINotes [#1812](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1812) (1.13.10.0)
|
||||
- *deps*: Make finding bison work better on Apple Silicon Macs + homebrew [#1822](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1822) (1.13.10.0)
|
||||
- *ci*: Mods to CI to deal with OIIO master raising dependency mins [#1833](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1833) (1.13.10.0)
|
||||
- *ci*: Deal with CentOS 7 EOL and disappearance of yum mirrors [#1839](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1839) (1.13.10.0)
|
||||
- *ci*: Fix GHA CI after they upgraded nodejs [#1837](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1837) (1.13.10.0)
|
||||
- *admin*: Change release notice icon to use the icon vs the normal logo so it shows up better [#1777](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1777) (by John Mertic) (1.13.10.0)
|
||||
|
||||
|
||||
Release 1.13.10.0 -- 1 June 2024 (compared to 1.13.9.0)
|
||||
--------------------------------------------------------
|
||||
- *testrender*: Implement new Oren-Nayar model from OpenPBR [#1817](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1817) (by Christopher Kulla)
|
||||
- *docs*: Fix outdated or wrong repo URLs [#1811](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1811)
|
||||
|
||||
|
||||
Release 1.13.9.0 -- 1 May 2024 (compared to 1.13.8.0)
|
||||
--------------------------------------------------------
|
||||
- *deps*: Support for LLVM-18 [#1773](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1773) (by مهدي شينون (Mehdi Chinoune) [#1803](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1803) (by Larry Gritz)
|
||||
- *fix*: Make isconnected() work with downstream renderer "connections." [#1782](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1782) (by sfriedmapixar)
|
||||
- *cleanup*: Change OSL_CONSTEXPR14 to constexpr [#1805](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1805)
|
||||
- *internals build*: Fix ifdef typo [#1804](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1804)
|
||||
- *build*: Propagate cpp version [#1797](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1797)
|
||||
- *build*: Print commit hash of locally built dependencies [#1798](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1798)
|
||||
- *ci*: Lock down to OIIO 2.5 for icc tests [#1799](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1799)
|
||||
- *ci*: Suppress leak sanitizer warnings about internals of robin_hash [#1807](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1807)
|
||||
- *docs*: More detail about supported platforms in INSTALL.md [#1796](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1796)
|
||||
|
||||
|
||||
Release 1.13.8.0 -- 1 Apr 2024 (compared to 1.13.7.0)
|
||||
--------------------------------------------------------
|
||||
* *fix(batched)*: Codegen bug for compref with varying index for batched shading [#1776](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1776) (by Alex Wells)
|
||||
* *fix*: Calculatenormal needs fliphandedness [#1783](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1783) (by sfriedmapixar)
|
||||
* *fix*: Print closure missing error message at compile time instead of run time. [#1781](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1781) (by sfriedmapixar)
|
||||
* *int*: Change long-deprecated OIIO macro to new one [#1788](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1788)
|
||||
* *ci*: Fix broken Macos-13 CI [#1780](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1780)
|
||||
|
||||
Release 1.13.7.0 -- 1 Mar 2024 (compared to 1.13.6.1)
|
||||
--------------------------------------------------------
|
||||
* *fix*: Mute partio error prints [#1774](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1774) (by olegul)
|
||||
* *ci*: Test with Mac ARM runner [#1770](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1770)
|
||||
* *docs*: Fix links to RTD docs from github landing page [#1768](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1768)
|
||||
* *admin*: Switch release announcement workflow to jmertic's awesome action [#1766](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1766)
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
Release 1.13 -- Feb 1, 2024 (compared to 1.12)
|
||||
===============================================
|
||||
- beta 1: December 20, 2023
|
||||
- release v1.13.6.1: Feb 1, 2024
|
||||
|
||||
### New minimum dependencies and compatibility changes:
|
||||
|
||||
* For GPU/OptiX mode, OptiX 6.0 support has been removed. For GPU rendering
|
||||
with OptiX, a minimum of OptiX 7.0 is required, and the Cuda minimum has
|
||||
been raised to 9.0 [#1737](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1737)
|
||||
* The minimum version OpenImageIO has been raised from 2.2 to 2.4. [#1591](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1591) [#1722](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1722)
|
||||
(to 2.3 in 1.13.0.3, to 2.4 in 1.13.4.0)
|
||||
* Raise minimum CMake dependency from 3.12 to 3.15 [#1724](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1724) (1.13.5.0)
|
||||
* Raise minimum Imath/OpenEXR from 2.3 to 2.4.
|
||||
* The minimum CMake dependency has been raised from 3.12 to 3.15
|
||||
[#1724](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1724) (1.13.5.0)
|
||||
* The minimum Imath/OpenEXR has been raised from 2.3 to 2.4. (Note: OSL 1.13
|
||||
is probably the last major release family that will support Imath/OpenEXR
|
||||
2.x.)
|
||||
|
||||
### OSL Language and oslc compiler:
|
||||
|
||||
* There have been no substantive changes to the OSL language in this release.
|
||||
|
||||
### API changes, new options, new ShadingSystem features (for renderer writers):
|
||||
### ⛰️ API changes, new options, new ShadingSystem features (for renderer writers):
|
||||
|
||||
* A new `shadingStateUniform` pointer field was added to ShaderGlobals for
|
||||
planned future expansion and improved GPU support. #1585 (1.13.1.0)
|
||||
* Adding relaxed type-equivalency to ReParameter() [#1639](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1639) (by cmstein) (1.13.2.1)
|
||||
@@ -40,7 +100,8 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
* Rs fmt specification - Journaling Algorithm for error, warning, fprintf
|
||||
[#1702](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1702) (by Steena Monteiro) [#1711](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1711) [#1715](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1715) (1.13.5.0)
|
||||
|
||||
### SIMD batched shading mode
|
||||
### 🚀 SIMD batched shading mode
|
||||
|
||||
* Fix some array overruns (asymptomatic, but still potentially buggy) in
|
||||
common_ancestor_between. #1577 (1.13.0.2)
|
||||
* Fix issue with closure keyword parameters. #1620 (1.13.2.0/1.12.8.0)
|
||||
@@ -48,8 +109,11 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
(1.13.2.0/1.12.8.0)
|
||||
* Fix support for closures with array types. #1630 (1.13.2.0/1.12.8.0)
|
||||
* Fix bug with masked wide llvm_gen_closure() [#1637](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1637) (by danieldresser-ie) (1.13.2.1)
|
||||
* Fix Force LLVM Boolean [#1717](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1717) (by Alex Wells)
|
||||
* Batched pointcloud if "index" is not passed [#1753](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1753) (by Alex Wells)
|
||||
|
||||
### 🚀 OptiX GPU rendering
|
||||
|
||||
### OptiX GPU rendering
|
||||
* OptiX 6.0 support has been removed. For GPU rendering with OptiX, a minimum
|
||||
of OptiX 7.0 is required.
|
||||
* Big overhaul/simplification of how strings are represented on the GPU: the
|
||||
@@ -80,8 +144,10 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
* OptiX PTX pipeline overhaul [#1680](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1680) (by Tim Grant) (1.13.5.0)
|
||||
* Perf: Don't insert redundant run layer calls inside a basic block
|
||||
[#1665](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1665) [#1669](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1669) [#1672](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1672) (by Chris Hellmuth) (1.13.4.0)
|
||||
* Fix NVPTX TargetMachine leak, etc. [#1763](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/1763) (by Tim Grant)
|
||||
|
||||
### 🐛/🔧 Internals: fixes, improvements, and developer concerns
|
||||
|
||||
### 🐛 Fixes and other improvements (internals)
|
||||
* Fix memory leak in oslc ASTvariable_declaration. #1576 (1.13.0.2)
|
||||
* Fix memory leaks in LPE code in error conditions. #1593 #1594 (1.13.0.3)
|
||||
* Fix mismatched strides when calling OCIO for transformc with derivs [#1646](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1646) (1.13.4.0)
|
||||
@@ -98,8 +164,6 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
* oslc: Add missing `fmod()` variants [#1643](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1643) (1.13.4.0)
|
||||
* Simple constant folding of binary expressions now happen on the oslc side
|
||||
[#1653](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1653) (1.13.4.0)
|
||||
|
||||
### 🔧 Internals and developer concerns
|
||||
* platform.h:
|
||||
* New `OSL_ALLOCA` macro to allocate on the stack. #1589 (1.13.0.3)
|
||||
* Define OSL::bitcast utility. #1610 (1.13.2.0)
|
||||
@@ -115,8 +179,12 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
* Give ShadingSystemImpl a handy use_optix() method [#1682](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1682) (1.13.4.0)
|
||||
* Fix default fmt logic changing in latest openimageio release [#1725](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1725) (1.13.5.0)
|
||||
* The recently added SS::find_symloc can have const args [#1723](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1723) (1.13.5.0)
|
||||
* SymOverrideInfo bitfields should be the same type [#1745](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1745)
|
||||
* Fix wrong offset of MxSheen param [#1751](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1751) (by Rasmus Bonnedal)
|
||||
* Make get_texture_info robust to empty shaderglobals param [#1731](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1731)
|
||||
|
||||
### 🏗 Build/test/CI and platform ports
|
||||
|
||||
* CMake build system and scripts:
|
||||
* The version number is now a cache variable, and so can be overridden at
|
||||
build time using `-DOSL_VERSION=...`. Use with extreme caution! #1579
|
||||
@@ -127,8 +195,9 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
* Fix incorrect CMake variable name to control symbol visibility
|
||||
[#1681](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1681) (1.13.4.0)
|
||||
* Change cmake option `USE_OPTIX` -> `OSL_USE_OPTIX` [#1668](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1668) (1.13.4.0)
|
||||
* Fix duplicate osl lexing symbols when building as static libraries
|
||||
* Fix duplicate osl lexing symbols when building as static libraries
|
||||
[#1709](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1709) (by Brecht Van Lommel) (1.13.5.0)
|
||||
* Better cmake verbose behavior [#1752](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1752)
|
||||
* Dependency version support:
|
||||
* Fix some issues that came up with the new icx 2022.0 compiler. #1601
|
||||
(1.13.1.0)
|
||||
@@ -140,6 +209,12 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
* Qt6 compatibility [#1655](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1655) (1.13.4.0)
|
||||
* Fix warnings about Qt compilation and enums [#1661](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1661) (1.13.4.0)
|
||||
* Changes to support fmt 10.0 [#1691](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1691) (1.13.5.0)
|
||||
* Raise OpenEXR minimum to 2.4 [#1734](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1734)
|
||||
* Fix Partio build errors on pointcloud functions for MSVC [#1757](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1757) (by Alex Wells)
|
||||
* Bump Cuda minimum to 9.0 [#1737](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1737)
|
||||
* LLVM 16 and 17 support: LLVM opaque pointers support [#1728](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1728),
|
||||
LLVM new pass manager support [#1729](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1729),
|
||||
finish LLVM 16 and 17 support [#1730](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1730) (all by Brecht Van Lommel)
|
||||
* Testing and Continuous integration (CI) systems:
|
||||
* Dynamic analysis using address and leak sanitizers. #1581 (1.13.0.3)
|
||||
* `testshade --help` now prints TextureSystem options and all hardware
|
||||
@@ -158,20 +233,41 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
[#1660](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1660) (by Massimo Paladin) (1.13.4.0)
|
||||
* *ci*: Simplify build_llvm.bash script [#1703](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1703) (1.13.5.0)
|
||||
* Test interactive parameter initialization in optix testrender [#1687](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1687) (by Chris Hellmuth) (1.13.5.0)
|
||||
* Fix GPU job not actually enabling OptiX [#1738](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1738) (by Brecht Van Lommel)
|
||||
* Fix python-oslquery test failure on macOS [#1739](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1739) (by Brecht Van Lommel)
|
||||
* Disable MacOS-11 CI [#1746](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1746)
|
||||
* Skip analysis and scorecard workflows on push if only docs changed [#1744](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1744)
|
||||
* For clarity, use the term 'runner' instead of 'os' [#1743](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1743)
|
||||
* Test ABI compliance [#1748](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1748)
|
||||
* Fix tests passing when test commands fail [#1733](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1733) (by Brecht Van Lommel)
|
||||
* *ci*: Test against LLVM 17 [#1760](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1760)
|
||||
* Platform support:
|
||||
* Include `immintrin.h` only when needed. #1605 (1.13.1.0)
|
||||
* Changed snprintf formatting to satisfy some compilers.
|
||||
[#1640](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1640) (by pellerington) (1.13.4.0)
|
||||
* Fix some windows GPU build errors [#1638](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1638) (by Declan Russell) (1.13.4.0)
|
||||
* Fix for Apple clang 14+ warnings [#1697](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1697) (1.13.5.0)
|
||||
* Fix struct align/pack for MSVC [#1754](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1754) (by Rasmus Bonnedal)
|
||||
* Refactor icc/icx specific pragma macros [#1756](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1756) (by Alex Wells)
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
* First stab at ReadTheDocs -- new [Experimental OSL Documentation on
|
||||
ReadTheDocs](https://open-shading-language.readthedocs.io/)
|
||||
is still a little rough, but eventually will be our primary documentation.
|
||||
[#1736](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1736)
|
||||
* `doc/RELEASING.md` documents our release process and versioning policies.
|
||||
#1572 (1.13.0.2)
|
||||
* Improve documentation of `trace` function [#1671](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1671) (by AidanWelch) (1.13.4.0)
|
||||
* Update CONTRIBUTING [#1689](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1689) (1.13.5.0)
|
||||
* Update logos [#1705](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1705), Move logos and add an icon-only logo [#1707](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1707) (1.13.5.0)
|
||||
|
||||
### 🏢 Project Administration
|
||||
|
||||
* Alert slack "release-announcements" channel upon OSL release [#1740](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1740) [#1749](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1749)
|
||||
* Update pull request template [#1741](https://github.com/AcademySoftwareFoundation/OpenShadingLangauge/pull/1741)
|
||||
* Account for duplicate emails in the .mailmap [#1759](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1759)
|
||||
|
||||
|
||||
---
|
||||
---
|
||||
@@ -181,30 +277,30 @@ Release 1.13 -- October?? 2023 ?? (compared to 1.12)
|
||||
Release 1.12.13.0 -- 1 July 2023 (compared to 1.12.12.0)
|
||||
--------------------------------------------------------
|
||||
- *fix*: Fix constant float values being converted to ints
|
||||
[#1674](https://github.com/OpenImageIO/oiio/pull/1674) (by Declan Russell)
|
||||
[#1674](https://github.com/OpenShadingLanguage/oiio/pull/1674) (by Declan Russell)
|
||||
- *build*: Fix builds when USE_PYTHON=OFF
|
||||
[#1675](https://github.com/OpenImageIO/oiio/pull/1675) (by Declan Russell)
|
||||
[#1675](https://github.com/OpenShadingLanguage/oiio/pull/1675) (by Declan Russell)
|
||||
- *build*: Changes to support fmt 10.0
|
||||
[#1691](https://github.com/OpenImageIO/oiio/pull/1691)
|
||||
[#1691](https://github.com/OpenShadingLanguage/oiio/pull/1691)
|
||||
- *cleanup*: Switch deprecated oiio simd names to modern
|
||||
[#1679](https://github.com/OpenImageIO/oiio/pull/1679)
|
||||
[#1679](https://github.com/OpenShadingLanguage/oiio/pull/1679)
|
||||
- *testing*: Avoid deprecated OSLQuery ctr in test example
|
||||
[#1699](https://github.com/OpenImageIO/oiio/pull/1699)
|
||||
[#1699](https://github.com/OpenShadingLanguage/oiio/pull/1699)
|
||||
- *ci*: Fix package name for icc
|
||||
[#1690](https://github.com/OpenImageIO/oiio/pull/1690)
|
||||
[#1690](https://github.com/OpenShadingLanguage/oiio/pull/1690)
|
||||
- *ci*: Add VFX Platform 2023 tests using new ASWF containers
|
||||
[#1696](https://github.com/OpenImageIO/oiio/pull/1696)
|
||||
[#1696](https://github.com/OpenShadingLanguage/oiio/pull/1696)
|
||||
- *ci*: Switch oiio obsolete branch names to immutable tags
|
||||
[#1701](https://github.com/OpenImageIO/oiio/pull/1701)
|
||||
[#1701](https://github.com/OpenShadingLanguage/oiio/pull/1701)
|
||||
- *docs*: Improve documentation of `trace` function
|
||||
[#1671](https://github.com/OpenImageIO/oiio/pull/1671) (by AidanWelch)
|
||||
[#1671](https://github.com/OpenShadingLanguage/oiio/pull/1671) (by AidanWelch)
|
||||
- *docs*: README.md: added filmography and Siggraph OSL course info.
|
||||
[#1692](https://github.com/OpenImageIO/oiio/pull/1692)
|
||||
[#1694](https://github.com/OpenImageIO/oiio/pull/1694) (by Mitch Prater)
|
||||
[#1692](https://github.com/OpenShadingLanguage/oiio/pull/1692)
|
||||
[#1694](https://github.com/OpenShadingLanguage/oiio/pull/1694) (by Mitch Prater)
|
||||
- *docs*: Amend the filmography
|
||||
[#1695](https://github.com/OpenImageIO/oiio/pull/1695)
|
||||
[#1695](https://github.com/OpenShadingLanguage/oiio/pull/1695)
|
||||
- *docs*: Fix incorrect links in CONTRIBUTING
|
||||
[#1688](https://github.com/OpenImageIO/oiio/pull/1688)
|
||||
[#1688](https://github.com/OpenShadingLanguage/oiio/pull/1688)
|
||||
|
||||
Release 1.12.12.0 -- 1 May 2023 (compared to 1.12.11.0)
|
||||
--------------------------------------------------------
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@
|
||||
|
||||
cmake_minimum_required (VERSION 3.15)
|
||||
|
||||
set (OSL_VERSION "1.13.5.0")
|
||||
set (OSL_VERSION "1.13.11.0")
|
||||
set (OSL_VERSION_OVERRIDE "" CACHE STRING
|
||||
"Version override (use with caution)!")
|
||||
mark_as_advanced (OSL_VERSION_OVERRIDE)
|
||||
@@ -18,12 +18,12 @@ project (OSL VERSION ${OSL_VERSION}
|
||||
set (PROJ_NAME ${PROJECT_NAME}) # short name
|
||||
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
|
||||
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
|
||||
set (PROJECT_VERSION_RELEASE_TYPE "dev" CACHE STRING
|
||||
set (PROJECT_VERSION_RELEASE_TYPE "" CACHE STRING
|
||||
"Build type, for example: dev, beta2, RC1 (empty string for normal release)")
|
||||
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
|
||||
set (PROJECT_AUTHORS "Contributors to the Open Shading Language project")
|
||||
option (${PROJECT_NAME}_SUPPORTED_RELEASE
|
||||
"Set ON for supported release branch, OFF for master" OFF)
|
||||
"Set ON for supported release branch, OFF for master" ON)
|
||||
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
|
||||
set (${PROJECT_NAME}_DEV_RELEASE OFF)
|
||||
else ()
|
||||
@@ -139,7 +139,7 @@ add_definitions (-DOSL_INTERNAL=1)
|
||||
|
||||
# To make sure we aren't relying on deprecated OIIO features, we define
|
||||
# OIIO_DISABLE_DEPRECATED before including any OIIO headers.
|
||||
add_definitions (-DOIIO_DISABLE_DEPRECATED=1)
|
||||
add_definitions (-DOIIO_DISABLE_DEPRECATED=900000)
|
||||
|
||||
# Set the default namespace. For symbol hiding reasons, it's important that
|
||||
# the project name is a subset of the namespace name.
|
||||
|
||||
+4
-3
@@ -115,7 +115,8 @@ own repository on GitHub, and then clone it to get a repository on your
|
||||
local machine.
|
||||
|
||||
2. Edit, compile, and test your changes. Run clang-format (see the
|
||||
instructions on coding style below).
|
||||
instructions on coding style below). Our current formatting standard,
|
||||
as checked by our CI, uses clang-format 17.0.
|
||||
|
||||
3. Push your changes to your fork (each unrelated pull request to a separate
|
||||
"topic branch", please).
|
||||
@@ -170,14 +171,14 @@ file in which it appears.
|
||||
|
||||
#### Formatting
|
||||
|
||||
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
|
||||
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) v17
|
||||
to uniformly format our source code prior to PR submission. Make sure that
|
||||
clang-format is installed on your local machine, and just run
|
||||
|
||||
make clang-format
|
||||
|
||||
and it will automatically reformat your code according to the configuration
|
||||
file found in the `.clang-format` file at the root directory of the OIIO
|
||||
file found in the `.clang-format` file at the root directory of the OSL
|
||||
source code checkout.
|
||||
|
||||
One of the CI test matrix entries runs clang-format and fails if any
|
||||
|
||||
+19
-13
@@ -4,7 +4,14 @@
|
||||
Building OSL
|
||||
============
|
||||
|
||||
OSL currently compiles and runs cleanly on Linux, Mac OS X, and Windows.
|
||||
OSL currently compiles and runs cleanly on Linux (x86_64), Mac OS X (x86_64
|
||||
and aarch64), and Windows (x86_64). It may build and run on other platforms as
|
||||
well, but we don't officially support or test other than these platforms.
|
||||
|
||||
Shader execution is supported on the native architectures of those x86_64 and
|
||||
aarch64 platforms, a special batched 8- or 16-wide SIMD execution mode
|
||||
requiring x86_64 with AVX2 or AVX-512 instructions, as well as on NVIDIA GPUs
|
||||
using Cuda+OptiX.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
@@ -12,11 +19,11 @@ Dependencies
|
||||
OSL requires the following dependencies or tools.
|
||||
NEW or CHANGED dependencies since the last major release are **bold**.
|
||||
|
||||
* Build system: [CMake](https://cmake.org/) **3.15 or newer** (tested through 3.27)
|
||||
* Build system: [CMake](https://cmake.org/) **3.15 or newer** (tested through 3.29)
|
||||
|
||||
* A suitable C++14 or C++17 compiler to build OSL itself, which may be any of:
|
||||
- GCC 6.1 or newer (tested through gcc 12.1)
|
||||
- Clang 3.4 or newer (tested through clang 16)
|
||||
- Clang 3.4 or newer (tested through clang 18)
|
||||
- Microsoft Visual Studio 2017 or newer
|
||||
- Intel C++ compiler icc version 17 or newer or LLVM-based icx compiler
|
||||
version 2022 or newer.
|
||||
@@ -40,19 +47,18 @@ NEW or CHANGED dependencies since the last major release are **bold**.
|
||||
$OpenImageIO_ROOT/lib to be in your LD_LIBRARY_PATH (or
|
||||
DYLD_LIBRARY_PATH on OS X).
|
||||
|
||||
* [LLVM](http://www.llvm.org) 9, 10, 11, 12, 13, 14, or 15, including
|
||||
clang libraries. LLVM 16 doesn't work yet, we need to make changes
|
||||
on the OSL side to be compatible.
|
||||
* [LLVM](http://www.llvm.org) 9, 10, 11, 12, 13, 14, 15, 16, 17, or 18, including
|
||||
clang libraries.
|
||||
|
||||
* (optional) For GPU rendering on NVIDIA GPUs:
|
||||
* [OptiX](https://developer.nvidia.com/rtx/ray-tracing/optix) 7.0 or higher.
|
||||
* [Cuda](https://developer.nvidia.com/cuda-downloads) 9.0 or higher. It is
|
||||
recommended that you use 11.0 or higher.
|
||||
|
||||
* [Boost](https://www.boost.org) 1.55 or newer (tested through boost 1.82)
|
||||
* [Boost](https://www.boost.org) 1.55 or newer (tested through boost 1.85)
|
||||
* [Ilmbase or Imath](https://github.com/AcademySoftwareFoundation/Imath) 2.4
|
||||
or newer (recommended: 3.1 or higher; tested through 3.2)
|
||||
NOTE: It is likely that 1.13 is the last release that will support
|
||||
NOTE: OSL 1.13.x is the last release family that will support
|
||||
Imath/OpenEXR 2.x.
|
||||
* [Flex](https://github.com/westes/flex) 2.5.35 or newer and
|
||||
[GNU Bison](https://www.gnu.org/software/bison/) 2.7 or newer.
|
||||
@@ -65,12 +71,12 @@ NEW or CHANGED dependencies since the last major release are **bold**.
|
||||
be operative.
|
||||
* (optional) Python: If you are building the Python bindings or running the
|
||||
testsuite:
|
||||
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9, 3.10)
|
||||
NOTE: It is likely that 1.13 is the last release that will support
|
||||
Python 2.7.
|
||||
* pybind11 >= 2.4.2 (Tested through 2.10)
|
||||
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12)
|
||||
NOTE: OSL 1.13.x is the last release family that will support Python 2.7.
|
||||
* pybind11 >= 2.4.2 (Tested through 2.12. Note that pybind11 v2.10+ does
|
||||
not support Python < 3.6.)
|
||||
* NumPy
|
||||
* (optional) Qt5 >= 5.6 or Qt6 (tested Qt5 through 5.15 and Qt6 through 6.4).
|
||||
* (optional) Qt5 >= 5.6 or Qt6 (tested Qt5 through 5.15 and Qt6 through 6.7).
|
||||
If not found at build time, the `osltoy` application will be disabled.
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
[](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/actions)
|
||||
[](https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/LICENSE.md)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/3061)
|
||||
|
||||
[](https://open-shading-language.readthedocs.io/en/main/?badge=main)
|
||||
|
||||
|
||||
Introduction
|
||||
@@ -426,7 +426,7 @@ nominated for major awards.)
|
||||
Obi-Wan Kenobi (series),
|
||||
The Boys (S3),
|
||||
Andor (S1)
|
||||
* **(2023 / upcoming)**
|
||||
* **(2023)**
|
||||
Ant-Man and the Wasp: Quantumania,
|
||||
The Mandalorian S3,
|
||||
The Magician's Elephant,
|
||||
@@ -434,6 +434,10 @@ nominated for major awards.)
|
||||
Guardians of the Galaxy 3,
|
||||
Spider-Man: Across the Spider-Verse,
|
||||
Elemental,
|
||||
The Marvels,
|
||||
Leo
|
||||
* **(2024 / upcoming)**
|
||||
Ghostbusters: Frozen Empire,
|
||||
...
|
||||
|
||||
|
||||
@@ -452,7 +456,18 @@ The OSL language specification can be found at
|
||||
distribution) or in the share/doc/OSL/osl-languagespec.pdf file of an
|
||||
installed binary distribution.
|
||||
|
||||
For those interested in learning to program in OSL, there is the
|
||||
[Experimental OSL Documentation on ReadTheDocs](https://open-shading-language.readthedocs.io/)
|
||||
This will be the future documentation. It's probably as complete as the PDF,
|
||||
but it needs some proofreading, so the PDF is still considered the
|
||||
authoritative source for now. But some time soon, the old PDF specification
|
||||
will be deprecated in favor of
|
||||
this online documentation.
|
||||
<!-- is the best place to start if you are interested in how to use OSL,
|
||||
its APIs. -->
|
||||
There is also a [PDF
|
||||
version](https://readthedocs.org/projects/open-shading-language/downloads/pdf/latest/).
|
||||
|
||||
For those interested in learning to program shaders in OSL, there is the
|
||||
[Siggraph 2022 Educator's Forum](https://dl.acm.org/doi/proceedings/10.1145/3532724)
|
||||
[OSL Shaders for RenderMan](https://dl.acm.org/doi/abs/10.1145/3532724.3535604) course,
|
||||
which uses RenderMan in the examples and
|
||||
@@ -515,21 +530,22 @@ The current project leadership is documented in the
|
||||
|
||||
Many people have contributed features, bug fixes, and other changes to OSL
|
||||
over the years: Steve Agland, Shane Ambler, Martijn Berger, Farchad
|
||||
Bidgolirad, Nicholas Bishop, Solomon Boulos, Stefan Bruens, Stefan Büttner,
|
||||
Matthaus G. Chajdas, Clark Chen, Alejandro Conty, Damien Courtois, Dieter De
|
||||
Baets, Thomas Dinges, Daniel Dresser, Mads Drøschler, Peter Ellerington, Luke
|
||||
Emrose, Louis Feng, Mark Final, Henri Fousse, Stephen Friedman, Syoyo Fujita,
|
||||
Tim Grant, Larry Gritz, Nicolas Guiard, Euan Haahr, Derek Haase, Sven-Hendrik
|
||||
Haase, John Haddon, Niklas Harrysson, Daniel Heckenberg, Chris Hellmuth,
|
||||
Adrien Herubel, Dan Horák, Thiago Ize, Matt Johnson, Ronan Keryell, Chris
|
||||
Kulla, Elvic Liang, Max Liani, Adam Martinez, John Mertic, Bastien Montagne,
|
||||
Steena Monteiro, Patrick Mours, Alexis Oblet, Erich Ocean, Mikko Ohtamaa, Jino
|
||||
Park, Alexei Pawlow, Jay Reynolds, Declan Russell, Benoit Ruiz, Patrick
|
||||
Scheibe, Alex Schworer, Jonathan Scruggs, Sergey Sharybin, Mark Sisson, Sandip
|
||||
Shukla, Cliff Stein, Stephan Steinbach, Luya Tshimbalanga, Esteban Tovagliari,
|
||||
Brecht Van Lommel, Alexander von Knorring, Alex Wells, Roman Zulak. (Listed
|
||||
alphabetically; if we've left anybody out, it is inadvertent, please let us
|
||||
know.)
|
||||
Bidgolirad, Nicholas Bishop, Curtis Black, Rasmus Bonnedal, Solomon Boulos,
|
||||
Stefan Bruens, Stefan Büttner, Matthaus G. Chajdas, Clark Chen, Alejandro
|
||||
Conty, Damien Courtois, Dieter De Baets, Thomas Dinges, Daniel Dresser, Mads
|
||||
Drøschler, Peter Ellerington, Luke Emrose, Louis Feng, Mark Final, Henri
|
||||
Fousse, Stephen Friedman, Syoyo Fujita, Tim Grant, Larry Gritz, Nicolas
|
||||
Guiard, Ole Gulbrandsen, Euan Haahr, Derek Haase, Sven-Hendrik Haase, John
|
||||
Haddon, Niklas Harrysson, Daniel Heckenberg, Chris Hellmuth, Adrien Herubel,
|
||||
Dan Horák, Thiago Ize, Matt Johnson, Ronan Keryell, Chris Kulla, Elvic Liang,
|
||||
Max Liani, Adam Martinez, John Mertic, Bastien Montagne, Steena Monteiro, John
|
||||
Mertic, Patrick Mours, Alexis Oblet, Erich Ocean, Mikko Ohtamaa, Jino Park,
|
||||
Alexei Pawlow, Jay Reynolds, Declan Russell, Benoit Ruiz, Patrick Scheibe,
|
||||
Alex Schworer, Jonathan Scruggs, Sergey Sharybin, Mark Sisson, Sandip Shukla,
|
||||
Cliff Stein, Stephan Steinbach, Luya Tshimbalanga, Esteban Tovagliari, Brecht
|
||||
Van Lommel, Thibault Vergne, Alexander von Knorring, Aidan Welch, Alex Wells,
|
||||
Roman Zulak. (Listed alphabetically; if we've left anybody out, it is
|
||||
inadvertent, please let us know.)
|
||||
|
||||
We cannot possibly express sufficient gratitude to the managers at Sony
|
||||
Pictures Imageworks who allowed this project to proceed, supported it
|
||||
|
||||
+24
-6
@@ -12,12 +12,6 @@ In no particular order:
|
||||
BSD 3-Clause License
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
* OpenImageIO Copyright (c) Larry Gritz, et al.
|
||||
https://github.com/OpenImageIO/oiio
|
||||
|
||||
Many bits of code flow back and forth between OIIO and OSL, especially
|
||||
parts of the CMake build system.
|
||||
|
||||
* OpenEXR, Copyright (c) Contributors to the OpenEXR Project.
|
||||
https://github.com/AcademySoftwareFoundation/OpenEXR
|
||||
|
||||
@@ -107,6 +101,30 @@ Public domain
|
||||
but of course I'd appreciate it if you kept my name somewhere.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Apache 2.0 License.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
* OpenImageIO Copyright (c) Contributors to the OpenImageIO Project.
|
||||
https://github.com/AcademySoftwareFoundation/OpenImageIO
|
||||
|
||||
Many bits of code flow back and forth between OIIO and OSL, especially
|
||||
parts of the CMake build system.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Modified Apache 2.0 License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright Contributors to the Open Shading Language project.
|
||||
# SPDX-License-Identifier: Modified Apache 2.0 License
|
||||
# Coyright Notice From Pixar USD (Modified Apache 2.0 License)
|
||||
# Copyright Notice From Pixar USD (Modified Apache 2.0 License)
|
||||
# 90% of the content is changed to be compatible for installing OSL and its dependencies
|
||||
#
|
||||
# Based on USD build_scripts by Pixar Animation Studio
|
||||
@@ -1331,8 +1331,8 @@ OPENVDB = Dependency("OpenVDB", InstallOpenVDB, "include/openvdb/openvdb.h")
|
||||
############################################################
|
||||
# OpenImageIO
|
||||
|
||||
# OIIO_URL = "https://github.com/OpenImageIO/oiio/archive/Release-2.2.7.0.zip"
|
||||
OIIO_URL = "https://github.com/OpenImageIO/oiio/archive/Release-2.1.20.0.zip"
|
||||
# OIIO_URL = "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/Release-2.2.7.0.zip"
|
||||
OIIO_URL = "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/Release-2.1.20.0.zip"
|
||||
|
||||
|
||||
def InstallOpenImageIO(context, force, buildArgs):
|
||||
|
||||
@@ -19,6 +19,7 @@ OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
|
||||
OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build}
|
||||
OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
|
||||
OPENCOLORIO_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE:=Release}
|
||||
OPENCOLORIO_CXX=${OPENCOLORIO_CXX:=g++}
|
||||
OPENCOLORIO_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
|
||||
# Just need libs:
|
||||
OPENCOLORIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
|
||||
@@ -43,9 +44,12 @@ cd ${OPENCOLORIO_SOURCE_DIR}
|
||||
|
||||
echo "git checkout ${OPENCOLORIO_VERSION} --force"
|
||||
git checkout ${OPENCOLORIO_VERSION} --force
|
||||
echo "Building OpenColorIO from commit" `git rev-parse --short HEAD`
|
||||
|
||||
time cmake -S . -B ${OPENCOLORIO_BUILD_DIR} \
|
||||
-DCMAKE_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \
|
||||
-DCMAKE_CXX_COMPILER=${OPENCOLORIO_CXX} \
|
||||
-DCMAKE_CXX_FLAGS="${OPENCOLORIO_CXX_FLAGS}" \
|
||||
${OPENCOLORIO_BUILDOPTS}
|
||||
time cmake --build ${OPENCOLORIO_BUILD_DIR} --config Release --target install
|
||||
|
||||
@@ -40,6 +40,7 @@ mkdir -p ${OPENEXR_INSTALL_DIR} && true
|
||||
|
||||
pushd ${OPENEXR_SOURCE_DIR}
|
||||
git checkout ${OPENEXR_VERSION} --force
|
||||
echo "Building OpenEXR from commit" `git rev-parse --short HEAD`
|
||||
|
||||
cmake -S . -B ${OPENEXR_BUILD_DIR} \
|
||||
-DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} \
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# Exit the whole script if any command fails.
|
||||
set -ex
|
||||
|
||||
OPENIMAGEIO_REPO=${OPENIMAGEIO_REPO:=OpenImageIO/oiio}
|
||||
OPENIMAGEIO_REPO=${OPENIMAGEIO_REPO:=AcademySoftwareFoundation/OpenImageIO}
|
||||
OPENIMAGEIO_VERSION=${OPENIMAGEIO_VERSION:=release}
|
||||
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
|
||||
OPENIMAGEIO_SRCDIR=${OPENIMAGEIO_SRCDIR:=${LOCAL_DEPS_DIR}/OpenImageIO}
|
||||
@@ -32,6 +32,7 @@ mkdir -p ${OPENIMAGEIO_BUILD_DIR} && true
|
||||
pushd $OPENIMAGEIO_SRCDIR
|
||||
git fetch --all -p
|
||||
git checkout $OPENIMAGEIO_VERSION --force
|
||||
echo "Building OpenImageIO from commit" `git rev-parse --short HEAD`
|
||||
|
||||
if [[ "$USE_SIMD" != "" ]] ; then
|
||||
OPENIMAGEIO_CMAKE_FLAGS="$OPENIMAGEIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
|
||||
|
||||
@@ -37,6 +37,7 @@ cd ${PUGIXML_SRC_DIR}
|
||||
|
||||
echo "git checkout ${PUGIXML_VERSION} --force"
|
||||
git checkout ${PUGIXML_VERSION} --force
|
||||
echo "Building pugixml from commit" `git rev-parse --short HEAD`
|
||||
|
||||
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
|
||||
time cmake -S . -B ${PUGIXML_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
|
||||
|
||||
@@ -41,6 +41,7 @@ cd ${PYBIND11_SRC_DIR}
|
||||
|
||||
echo "git checkout ${PYBIND11_VERSION} --force"
|
||||
git checkout ${PYBIND11_VERSION} --force
|
||||
echo "Building pybind11 from commit" `git rev-parse --short HEAD`
|
||||
|
||||
if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
|
||||
time cmake -S . -B ${PYBIND11_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release \
|
||||
|
||||
@@ -39,11 +39,6 @@ export CMAKE_GENERATOR=${CMAKE_GENERATOR:=Ninja}
|
||||
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release}
|
||||
export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=11}
|
||||
|
||||
export PARALLEL=${PARALLEL:=4}
|
||||
export PAR_MAKEFLAGS=-j${PARALLEL}
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=${PARALLEL}}
|
||||
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:=${PARALLEL}}
|
||||
|
||||
export LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=$HOME/ext}
|
||||
export CMAKE_PREFIX_PATH=${LOCAL_DEPS_DIR}/dist:${CMAKE_PREFIX_PATH}
|
||||
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH
|
||||
@@ -52,6 +47,28 @@ export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH
|
||||
|
||||
export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1}
|
||||
|
||||
# For CI, default to building missing dependencies automatically
|
||||
export OpenImageIO_BUILD_MISSING_DEPS=${OpenImageIO_BUILD_MISSING_DEPS:=all}
|
||||
|
||||
# Parallel builds
|
||||
if [[ `uname -s` == "Linux" ]] ; then
|
||||
echo "procs: " `nproc`
|
||||
head -40 /proc/cpuinfo
|
||||
export PARALLEL=${PARALLEL:=$((2 + `nproc`))}
|
||||
elif [[ "${RUNNER_OS}" == "macOS" ]] ; then
|
||||
echo "procs: " `sysctl -n hw.ncpu`
|
||||
sysctl machdep.cpu.features
|
||||
export PARALLEL=${PARALLEL:=$((2 + `sysctl -n hw.ncpu`))}
|
||||
elif [[ "${RUNNER_OS}" == "Windows" ]] ; then
|
||||
# Presumably Windows
|
||||
export PARALLEL=${PARALLEL:=$((2 + ${NUMBER_OF_PROCESSORS}))}
|
||||
else
|
||||
export PARALLEL=${PARALLEL:=6}
|
||||
fi
|
||||
export PAR_MAKEFLAGS=-j${PARALLEL}
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=${PARALLEL}}
|
||||
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:=${PARALLEL}}
|
||||
|
||||
mkdir -p build dist
|
||||
|
||||
echo "HOME = $HOME"
|
||||
|
||||
@@ -12,12 +12,19 @@ set -ex
|
||||
# Install system packages when those are acceptable for dependencies.
|
||||
#
|
||||
if [[ "$ASWF_ORG" != "" ]] ; then
|
||||
# Using ASWF CentOS container
|
||||
# Using ASWF container
|
||||
|
||||
export PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:$PATH
|
||||
|
||||
#ls /etc/yum.repos.d
|
||||
|
||||
if [[ "$ASWF_VFXPLATFORM_VERSION" == "2021" || "$ASWF_VFXPLATFORM_VERSION" == "2022" ]] ; then
|
||||
# CentOS 7 based containers need the now-nonexistant centos repo to be
|
||||
# excluded or all the subsequent yum install commands will fail.
|
||||
yum-config-manager --disable centos-sclo-rh && true
|
||||
sed -i 's,^mirrorlist=,#,; s,^#baseurl=http://mirror\.centos\.org/centos/$releasever,baseurl=https://vault.centos.org/7.9.2009,' /etc/yum.repos.d/CentOS-Base.repo
|
||||
fi
|
||||
|
||||
sudo /usr/bin/yum install -y giflib giflib-devel && true
|
||||
# sudo /usr/bin/yum install -y ffmpeg ffmpeg-devel && true
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ if [[ `which brew` == "" ]] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -ex
|
||||
# set -ex
|
||||
|
||||
if [[ "$DO_BREW_UPDATE" != "" ]] ; then
|
||||
if [[ "${DO_BREW_UPDATE:=0}" != "0" ]] ; then
|
||||
brew update >/dev/null
|
||||
fi
|
||||
echo ""
|
||||
@@ -31,42 +31,40 @@ brew list --versions
|
||||
brew install --display-times -q gcc ccache cmake ninja boost || true
|
||||
brew link --overwrite gcc
|
||||
brew install --display-times -q python@${PYTHON_VERSION} || true
|
||||
# brew unlink python@2.7 || true
|
||||
# brew unlink python@3.8 || true
|
||||
# brew unlink python@3.9 || true
|
||||
brew unlink python@3.10 || true
|
||||
brew link --overwrite --force python@${PYTHON_VERSION} || true
|
||||
brew upgrade --display-times -q cmake || true
|
||||
brew install --display-times -q imath openexr
|
||||
#brew upgrade --display-times -q cmake || true
|
||||
brew install --display-times -q imath openexr opencolorio || true
|
||||
#brew install --display-times -q freetype
|
||||
brew install --display-times -q --overwrite --force opencolorio || true
|
||||
brew install --display-times -q partio pugixml
|
||||
brew install --display-times -q partio pugixml || true
|
||||
brew install --display-times -q pybind11 numpy || true
|
||||
brew install --display-times -q tbb || true
|
||||
brew install --display-times -q openvdb || true
|
||||
brew install --display-times -q flex bison
|
||||
brew install --display-times -q fmt
|
||||
brew install --display-times -q llvm${LLVMBREWVER}
|
||||
brew install --display-times -q qt${QT_BREW_VERSION}
|
||||
if [[ "${USE_QT}" != "0" ]] ; then
|
||||
brew install --display-times -q qt${QT_VERSION}
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "After brew installs:"
|
||||
brew list --versions
|
||||
|
||||
# Needed on some systems
|
||||
if [[ $PYTHON_VERSION != "2.7" ]] ; then
|
||||
pip3 install numpy
|
||||
else
|
||||
pip install numpy
|
||||
fi
|
||||
pip${PYTHON_VERSION} install numpy || true
|
||||
|
||||
# Set up paths. These will only affect the caller if this script is
|
||||
# run with 'source' rather than in a separate shell.
|
||||
export PATH=/usr/local/opt/qt5/bin:$PATH
|
||||
export PATH=/usr/local/opt/python/libexec/bin:$PATH
|
||||
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
|
||||
# export PATH=/usr/local/opt/llvm${LLVMBREWVER}/bin:$PATH
|
||||
export LLVM_DIRECTORY=/usr/local/opt/llvm${LLVMBREWVER}
|
||||
export LLVM_ROOT=/usr/local/opt/llvm${LLVMBREWVER}
|
||||
export PATH=/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH
|
||||
export PATH=${HOMEBREW_PREFIX}/opt/qt5/bin:$PATH
|
||||
export PATH=${HOMEBREW_PREFIX}/opt/python/libexec/bin:$PATH
|
||||
export PYTHONPATH=${HOMEBREW_PREFIX}/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
|
||||
# export PATH=${HOMEBREW_PREFIX}/opt/llvm${LLVMBREWVER}/bin:$PATH
|
||||
export LLVM_DIRECTORY=${HOMEBREW_PREFIX}/opt/llvm${LLVMBREWVER}
|
||||
export LLVM_ROOT=${HOMEBREW_PREFIX}/opt/llvm${LLVMBREWVER}
|
||||
export PATH=${HOMEBREW_PREFIX}/opt/flex/bin:${HOMEBREW_PREFIX}/opt/bison/bin:$PATH
|
||||
|
||||
# Save the env for use by other stages
|
||||
src/build-scripts/save-env.bash
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# Small leaks that make CI fail, suppress until cause is identified.
|
||||
leak:__cxa_thread_atexit
|
||||
leak:std::string::_Rep::_S_create
|
||||
leak:tsl::detail_robin_hash::robin_hash
|
||||
|
||||
@@ -59,13 +59,17 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lan
|
||||
set (CMAKE_CXX_COMPILER_ID "AppleClang")
|
||||
set (CMAKE_COMPILER_IS_APPLECLANG 1)
|
||||
string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" APPLECLANG_VERSION_STRING ${clang_full_version_string})
|
||||
set (ANY_CLANG_VERSION_STRING ${APPLECLANG_VERSION_STRING})
|
||||
message (VERBOSE "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${APPLECLANG_VERSION_STRING}")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
|
||||
set (CMAKE_COMPILER_IS_INTELCLANG 1)
|
||||
string (REGEX MATCH "[0-9]+(\\.[0-9]+)+" INTELCLANG_VERSION_STRING ${clang_full_version_string})
|
||||
set (ANY_CLANG_VERSION_STRING ${INTELCLANG_VERSION_STRING})
|
||||
message (VERBOSE "The compiler is Intel Clang: ${CMAKE_CXX_COMPILER_ID} version ${INTELCLANG_VERSION_STRING}")
|
||||
else ()
|
||||
set (CMAKE_COMPILER_IS_GENERICCLANG 1)
|
||||
string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string})
|
||||
set (ANY_CLANG_VERSION_STRING ${CLANG_VERSION_STRING})
|
||||
message (VERBOSE "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${CLANG_VERSION_STRING}")
|
||||
endif ()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
|
||||
@@ -51,7 +51,9 @@ function ( NVCC_COMPILE cuda_src extra_headers ptx_generated extra_nvcc_args )
|
||||
${LLVM_COMPILE_FLAGS}
|
||||
-DOSL_USE_FAST_MATH=1
|
||||
-m64 -arch ${CUDA_TARGET_ARCH} -ptx
|
||||
--std=c++14 -dc --use_fast_math ${CUDA_OPT_FLAG_NVCC} ${NVCC_FTZ_FLAG} --expt-relaxed-constexpr
|
||||
--std=c++${CMAKE_CXX_STANDARD}
|
||||
-dc --use_fast_math ${CUDA_OPT_FLAG_NVCC} ${NVCC_FTZ_FLAG}
|
||||
--expt-relaxed-constexpr
|
||||
${extra_nvcc_args}
|
||||
${OSL_EXTRA_NVCC_ARGS}
|
||||
${cuda_src} -o ${cuda_ptx}
|
||||
@@ -138,6 +140,16 @@ function ( MAKE_CUDA_BITCODE src suffix generated_bc extra_clang_args )
|
||||
set (CLANG_FTZ_FLAG "-fcuda-flush-denormals-to-zero")
|
||||
endif ()
|
||||
|
||||
if ("${CUDA_VERSION}" VERSION_GREATER_EQUAL "12.0")
|
||||
# The textureReference API was removed in CUDA 12.0, but it's still referenced
|
||||
# in the clang headers, so compilation will fail with 12.0 and newer toolkits
|
||||
# due to the missing definitions.
|
||||
#
|
||||
# We don't actually require any of the clang CUDA texture intrinsics, so we can
|
||||
# side-step the issue by preventing them from being included by the preprocessor.
|
||||
set (CUDA_TEXREF_FIX "-D__CLANG_CUDA_TEXTURE_INTRINSICS_H__")
|
||||
endif()
|
||||
|
||||
list (TRANSFORM IMATH_INCLUDES PREPEND -I
|
||||
OUTPUT_VARIABLE ALL_IMATH_INCLUDES)
|
||||
list (TRANSFORM OPENEXR_INCLUDES PREPEND -I
|
||||
@@ -158,7 +170,7 @@ function ( MAKE_CUDA_BITCODE src suffix generated_bc extra_clang_args )
|
||||
${ALL_IMATH_INCLUDES}
|
||||
${ALL_OPENEXR_INCLUDES}
|
||||
"-I${Boost_INCLUDE_DIRS}"
|
||||
${LLVM_COMPILE_FLAGS} ${CUDA_LIB_FLAGS} ${CLANG_MSVC_FIX}
|
||||
${LLVM_COMPILE_FLAGS} ${CUDA_LIB_FLAGS} ${CLANG_MSVC_FIX} ${CUDA_TEXREF_FIX}
|
||||
-D__CUDACC__ -DOSL_COMPILING_TO_BITCODE=1 -DNDEBUG -DOIIO_NO_SSE -D__CUDADEVRT_INTERNAL__
|
||||
--language=cuda --cuda-device-only --cuda-gpu-arch=${CUDA_TARGET_ARCH}
|
||||
-Wno-deprecated-register -Wno-format-security
|
||||
|
||||
@@ -117,7 +117,7 @@ checked_find_package (pugixml REQUIRED
|
||||
# LLVM library setup
|
||||
checked_find_package (LLVM REQUIRED
|
||||
VERSION_MIN 9.0
|
||||
VERSION_MAX 17.9
|
||||
VERSION_MAX 18.9
|
||||
PRINT LLVM_SYSTEM_LIBRARIES CLANG_LIBRARIES)
|
||||
# ensure include directory is added (in case of non-standard locations
|
||||
include_directories (BEFORE SYSTEM "${LLVM_INCLUDES}")
|
||||
@@ -139,9 +139,8 @@ if (APPLE AND LLVM_VERSION VERSION_EQUAL 10.0.1 AND EXISTS "/usr/local/Cellar/ll
|
||||
" brew upgrade llvm \n"
|
||||
"${ColorReset}\n")
|
||||
endif ()
|
||||
if (LLVM_VERSION VERSION_GREATER_EQUAL 15.0
|
||||
AND ( (CMAKE_COMPILER_IS_APPLECLANG AND APPLECLANG_VERSION_STRING VERSION_LESS 15.0)
|
||||
OR (CMAKE_COMPILER_IS_CLANG AND CLANG_VERSION_STRING VERSION_LESS 15.0)))
|
||||
if (LLVM_VERSION VERSION_GREATER_EQUAL 15.0 AND CMAKE_COMPILER_IS_CLANG
|
||||
AND ANY_CLANG_VERSION_STRING VERSION_LESS 15.0)
|
||||
message (WARNING
|
||||
"${ColorYellow}"
|
||||
"If you are using LLVM 15 or higher, you should also use clang version "
|
||||
@@ -155,7 +154,8 @@ if (LLVM_VERSION VERSION_GREATER_EQUAL 16.0)
|
||||
if (CMAKE_COMPILER_IS_GNUCC AND (GCC_VERSION VERSION_LESS 7.0))
|
||||
message (WARNING "${ColorYellow}LLVM 16+ requires gcc 7.0 or higher.${ColorReset}\n")
|
||||
endif ()
|
||||
if (CMAKE_COMPILER_IS_CLANG AND (CLANG_VERSION_STRING VERSION_LESS 5.0))
|
||||
if (CMAKE_COMPILER_IS_CLANG AND (CLANG_VERSION_STRING VERSION_LESS 5.0
|
||||
OR APPLE_CLANG_VERSION_STRING VERSION_LESS 5.0))
|
||||
message (WARNING "${ColorYellow}LLVM 16+ requires clang 5.0 or higher.${ColorReset}\n")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -21,9 +21,14 @@
|
||||
# MacOS/xcode in /usr/bin, which seems to be too old for the reentrant
|
||||
# parser directives we use. Only do this if there is no BISON_ROOT
|
||||
# specifying a particular Bison to use.
|
||||
if (APPLE AND EXISTS /usr/local/opt
|
||||
AND NOT BISON_ROOT AND NOT DEFINED ENV{BISON_ROOT})
|
||||
find_program(BISON_EXECUTABLE NAMES /usr/local/opt/bison/bin/bison
|
||||
if (APPLE AND NOT BISON_ROOT AND NOT DEFINED ENV{BISON_ROOT}
|
||||
AND (EXISTS /usr/local/opt OR EXISTS /opt/homebrew
|
||||
OR DEFINED ENV{HOMEBREW_PREFIX}))
|
||||
find_program(BISON_EXECUTABLE
|
||||
NAMES
|
||||
ENV{HOMEBREW_PREFIX}/opt/bison/bin/bison
|
||||
/opt/homebrew/opt/bison/bin/bison
|
||||
/usr/local/opt/bison/bin/bison
|
||||
DOC "path to the bison executable")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ endif ()
|
||||
foreach (COMPONENT clangFrontend clangDriver clangSerialization
|
||||
clangParse clangSema clangAnalysis clangAST
|
||||
clangASTMatchers clangBasic clangEdit clangLex
|
||||
clangSupport)
|
||||
clangSupport clangAPINotes)
|
||||
find_library ( _CLANG_${COMPONENT}_LIBRARY
|
||||
NAMES ${COMPONENT}
|
||||
PATHS ${LLVM_LIB_DIR})
|
||||
|
||||
@@ -289,6 +289,7 @@ macro (osl_add_all_tests)
|
||||
metadata-braces min-reg miscmath missing-shader
|
||||
mix-reg
|
||||
named-components
|
||||
nestedloop-reg
|
||||
noise noise-cell
|
||||
noise-gabor noise-gabor2d-filter noise-gabor3d-filter
|
||||
noise-gabor-reg
|
||||
|
||||
@@ -67,7 +67,7 @@ Editor: Larry Gritz \\
|
||||
\emph{lg@imageworks.com}
|
||||
}
|
||||
\date{{\large Date: 27 Oct 2023 \\
|
||||
% (with corrections, 24 Nov 2021)
|
||||
(with corrections, 24 May 2024)
|
||||
}
|
||||
\bigskip
|
||||
\bigskip
|
||||
@@ -4640,7 +4640,7 @@ properties of the physically-based shading nodes of MaterialX v1.38
|
||||
|
||||
\subsection{Surface BSDF closures}
|
||||
|
||||
\apiitem{\closurecolor\ {\ce oren_nayar_diffuse_bsdf}(normal N, color albedo, float roughness)}
|
||||
\apiitem{\closurecolor\ {\ce oren_nayar_diffuse_bsdf}(normal N, color albedo, float roughness, int energy_compensation=0)}
|
||||
\indexapi{oren_nayar_diffuse_bsdf()}
|
||||
|
||||
Constructs a diffuse reflection BSDF based on the Oren-Nayar reflectance
|
||||
@@ -4671,10 +4671,17 @@ model.
|
||||
% Optional string parameter to name this component. For use in AOVs / LPEs.
|
||||
% \apiend
|
||||
|
||||
\apiitem{energy_compensation}
|
||||
\vspace{12pt}
|
||||
Optional int parameter to select if energy compensation should be applied.
|
||||
\apiend
|
||||
|
||||
The Oren-Nayar reflection model is described in M.\ Oren and S.\ K.\
|
||||
Nayar, ``Generalization of Lambert's Reflectance Model,'' Proceedings of
|
||||
SIGGRAPH 1994, pp.239-246 (July, 1994).
|
||||
|
||||
The energy compensated model is described in the white paper: ``An energy-preserving Qualitative Oren-Nayar model'' by Jamie Portsmouth.
|
||||
|
||||
\apiend
|
||||
|
||||
|
||||
|
||||
+5
-1
@@ -1266,7 +1266,7 @@ properties of the physically-based shading nodes of MaterialX v1.38
|
||||
|
||||
### Surface BSDF closures
|
||||
|
||||
`closure color` **`oren_nayar_diffuse_bsdf`** `(normal N, color albedo, float roughness)`
|
||||
`closure color` **`oren_nayar_diffuse_bsdf`** `(normal N, color albedo, float roughness, int energy_compensation=0)`
|
||||
|
||||
: Constructs a diffuse reflection BSDF based on the Oren-Nayar reflectance
|
||||
model.
|
||||
@@ -1282,10 +1282,14 @@ properties of the physically-based shading nodes of MaterialX v1.38
|
||||
`roughness`
|
||||
: Surface roughness [0,1]. A value of 0.0 gives Lambertian reflectance.
|
||||
|
||||
`energy_compensation`
|
||||
: Optional int parameter to select if energy compensation should be applied.
|
||||
|
||||
The Oren-Nayar reflection model is described in M. Oren and S. K.
|
||||
Nayar, "Generalization of Lambert's Reflectance Model," Proceedings of
|
||||
SIGGRAPH 1994, pp.239-246 (July, 1994).
|
||||
|
||||
The energy compensated model is described in the white paper: "An energy-preserving Qualitative Oren-Nayar model" by Jamie Portsmouth.
|
||||
|
||||
`closure color` **`burley_diffuse_bsdf`** `(normal N, color albedo, float roughness)`
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
void* errormessage, Mask<WidthT> mask)
|
||||
: m_result(result)
|
||||
, m_resultHasDerivs(resultHasDerivs)
|
||||
, m_resultType((chans == 1) ? TypeDesc::TypeFloat : TypeDesc::TypeColor)
|
||||
, m_resultType((chans == 1) ? TypeFloat : TypeColor)
|
||||
, m_alpha(alpha)
|
||||
, m_alphaHasDerivs(alphaHasDerivs)
|
||||
, m_errormessage(errormessage)
|
||||
@@ -240,15 +240,13 @@ public:
|
||||
// The return value maybe invalid or be Masked<float, WidthT>
|
||||
OSL_FORCEINLINE MaskedData<WidthT> alpha()
|
||||
{
|
||||
return MaskedData<WidthT>(TypeDesc::TypeFloat, m_alphaHasDerivs, m_mask,
|
||||
m_alpha);
|
||||
return MaskedData<WidthT>(TypeFloat, m_alphaHasDerivs, m_mask, m_alpha);
|
||||
}
|
||||
|
||||
// The return value maybe invalid or be Masked<ustring, WidthT>
|
||||
OSL_FORCEINLINE MaskedData<WidthT> errormessage()
|
||||
{
|
||||
return MaskedData<WidthT>(TypeDesc::TypeString, false, m_mask,
|
||||
m_errormessage);
|
||||
return MaskedData<WidthT>(TypeString, false, m_mask, m_errormessage);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -32,36 +32,21 @@ public:
|
||||
#ifdef __CUDA_ARCH__
|
||||
/// On device, act as a pointer. None of these things are allowed on the
|
||||
/// host.
|
||||
T* operator->() const
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
T& operator*() const
|
||||
{
|
||||
return *m_ptr;
|
||||
}
|
||||
T* operator->() const { return m_ptr; }
|
||||
T& operator*() const { return *m_ptr; }
|
||||
#endif
|
||||
|
||||
/// Extract the raw device-side pointer. Use with caution! On the host,
|
||||
/// this will not point to valid memory.
|
||||
T* d_get() const
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
T* d_get() const { return m_ptr; }
|
||||
|
||||
/// Evaluate as bool is a null pointer check.
|
||||
operator bool() const noexcept
|
||||
{
|
||||
return m_ptr != nullptr;
|
||||
}
|
||||
operator bool() const noexcept { return m_ptr != nullptr; }
|
||||
|
||||
/// Reset the pointer to `dptr`, which must be a device-side raw pointer,
|
||||
/// or null. Since this device_ptr is non-owning, any previous value is
|
||||
/// simply overwritten.
|
||||
void reset(T* dptr = nullptr)
|
||||
{
|
||||
m_ptr = dptr;
|
||||
}
|
||||
void reset(T* dptr = nullptr) { m_ptr = dptr; }
|
||||
|
||||
private:
|
||||
T* m_ptr = nullptr; // underlying pointer, initializes to null
|
||||
|
||||
@@ -53,10 +53,7 @@ struct DeviceString {
|
||||
// In OptiX 7 we can't return the string's contents. Make this a compile
|
||||
// time error.
|
||||
#ifndef __CUDA_ARCH__
|
||||
OSL_HOSTDEVICE const char* c_str() const
|
||||
{
|
||||
return m_chars;
|
||||
}
|
||||
OSL_HOSTDEVICE const char* c_str() const { return m_chars; }
|
||||
#endif
|
||||
|
||||
OSL_HOSTDEVICE bool operator==(const DeviceString& other) const
|
||||
@@ -81,10 +78,7 @@ struct DeviceString {
|
||||
return hash() != other;
|
||||
}
|
||||
|
||||
OSL_HOSTDEVICE operator size_t() const
|
||||
{
|
||||
return hash();
|
||||
}
|
||||
OSL_HOSTDEVICE operator size_t() const { return hash(); }
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
+37
-37
@@ -130,12 +130,12 @@ public:
|
||||
// To better enable Scalar Replacement of Aggregates and other
|
||||
// transformations, CLANG has easier time if the per element
|
||||
// constructors declared.
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage() {}
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage(const T & val, const T & dx)
|
||||
OSL_HOSTDEVICE constexpr DualStorage() {}
|
||||
OSL_HOSTDEVICE constexpr DualStorage(const T & val, const T & dx)
|
||||
: m_val(val)
|
||||
, m_dx(dx)
|
||||
{}
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage(const DualStorage &other)
|
||||
OSL_HOSTDEVICE constexpr DualStorage(const DualStorage &other)
|
||||
: m_val(other.m_val)
|
||||
, m_dx(other.m_dx)
|
||||
{}
|
||||
@@ -159,13 +159,13 @@ public:
|
||||
// To better enable Scalar Replacement of Aggregates and other
|
||||
// transformations, CLANG has easier time if the per element
|
||||
// constructors declared.
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage() {}
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage(const T & val, const T & dx, const T & dy)
|
||||
OSL_HOSTDEVICE constexpr DualStorage() {}
|
||||
OSL_HOSTDEVICE constexpr DualStorage(const T & val, const T & dx, const T & dy)
|
||||
: m_val(val)
|
||||
, m_dx(dx)
|
||||
, m_dy(dy)
|
||||
{}
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage(const DualStorage &other)
|
||||
OSL_HOSTDEVICE constexpr DualStorage(const DualStorage &other)
|
||||
: m_val(other.m_val)
|
||||
, m_dx(other.m_dx)
|
||||
, m_dy(other.m_dy)
|
||||
@@ -192,15 +192,15 @@ public:
|
||||
// To better enable Scalar Replacement of Aggregates and other
|
||||
// transformations, CLANG has easier time if the per element
|
||||
// constructors declared.
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage() {}
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage(const T & val, const T & dx, const T & dy, const T & dz)
|
||||
OSL_HOSTDEVICE constexpr DualStorage() {}
|
||||
OSL_HOSTDEVICE constexpr DualStorage(const T & val, const T & dx, const T & dy, const T & dz)
|
||||
: m_val(val)
|
||||
, m_dx(dx)
|
||||
, m_dy(dy)
|
||||
, m_dz(dz)
|
||||
{}
|
||||
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 DualStorage(const DualStorage &other)
|
||||
OSL_HOSTDEVICE constexpr DualStorage(const DualStorage &other)
|
||||
: m_val(other.m_val)
|
||||
, m_dx(other.m_dx)
|
||||
, m_dy(other.m_dy)
|
||||
@@ -230,7 +230,7 @@ class Dual : public DualStorage<T, PARTIALS> {
|
||||
static_assert (PARTIALS>=1, "Can't have a Dual with 0 partials");
|
||||
public:
|
||||
using value_type = T;
|
||||
static OSL_FORCEINLINE OSL_HOSTDEVICE OSL_CONSTEXPR14 T zero() { return T(0.0); }
|
||||
static OSL_FORCEINLINE OSL_HOSTDEVICE constexpr T zero() { return T(0.0); }
|
||||
|
||||
using DualStorage<T, PARTIALS>::elem;
|
||||
template<int N>
|
||||
@@ -240,13 +240,13 @@ public:
|
||||
|
||||
/// Default ctr leaves everything uninitialized
|
||||
///
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 Dual ()
|
||||
OSL_HOSTDEVICE constexpr Dual ()
|
||||
: DualStorage<T, PARTIALS>()
|
||||
{}
|
||||
|
||||
/// Construct a Dual from just a real value (derivs set to 0)
|
||||
///
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 Dual (const T &x)
|
||||
OSL_HOSTDEVICE constexpr Dual (const T &x)
|
||||
: DualStorage<T, PARTIALS>()
|
||||
{
|
||||
val() = x;
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
/// Copy constructor from another Dual of same dimension and different,
|
||||
/// but castable, data type.
|
||||
template<class F>
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 Dual (const Dual<F,PARTIALS> &x)
|
||||
OSL_HOSTDEVICE constexpr Dual (const Dual<F,PARTIALS> &x)
|
||||
: DualStorage<T, PARTIALS>()
|
||||
{
|
||||
OSL_INDEX_LOOP(i, elements, {
|
||||
@@ -266,8 +266,8 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
//OSL_HOSTDEVICE OSL_CONSTEXPR14 Dual (const Dual &x) = default;
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 Dual (const Dual &x)
|
||||
//OSL_HOSTDEVICE constexpr Dual (const Dual &x) = default;
|
||||
OSL_HOSTDEVICE constexpr Dual (const Dual &x)
|
||||
: DualStorage<T, PARTIALS>(x)
|
||||
{}
|
||||
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
set_expander(pvt::make_int_sequence<elements>(), values...);
|
||||
}
|
||||
|
||||
OSL_HOSTDEVICE OSL_CONSTEXPR14 Dual (std::initializer_list<T> vals) {
|
||||
OSL_HOSTDEVICE constexpr Dual (std::initializer_list<T> vals) {
|
||||
#if OIIO_CPLUSPLUS_VERSION >= 14
|
||||
static_assert (vals.size() == elements, "Wrong number of initializers");
|
||||
#endif
|
||||
@@ -401,7 +401,7 @@ template<class T> using Dual2 = Dual<T,2>;
|
||||
/// Addition of duals.
|
||||
///
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator+ (const Dual<T,P> &a, const Dual<T,P> &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator+ (const Dual<T,P> &a, const Dual<T,P> &b)
|
||||
{
|
||||
Dual<T,P> result = a;
|
||||
OSL_INDEX_LOOP(i, P+1, {
|
||||
@@ -412,7 +412,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator+ (const Dual<T
|
||||
|
||||
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator+ (const Dual<T,P> &a, const T &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator+ (const Dual<T,P> &a, const T &b)
|
||||
{
|
||||
Dual<T,P> result = a;
|
||||
result.val() += b;
|
||||
@@ -421,7 +421,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator+ (const Dual<T
|
||||
|
||||
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator+ (const T &a, const Dual<T,P> &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator+ (const T &a, const Dual<T,P> &b)
|
||||
{
|
||||
Dual<T,P> result = b;
|
||||
result.val() += a;
|
||||
@@ -450,7 +450,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE Dual<T,P>& operator+= (Dual<T,P> &a, const T &b)
|
||||
/// Subtraction of duals.
|
||||
///
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const Dual<T,P> &a, const Dual<T,P> &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator- (const Dual<T,P> &a, const Dual<T,P> &b)
|
||||
{
|
||||
Dual<T,P> result;
|
||||
OSL_INDEX_LOOP(i, P+1, {
|
||||
@@ -461,7 +461,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const Dual<T
|
||||
|
||||
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const Dual<T,P> &a, const T &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator- (const Dual<T,P> &a, const T &b)
|
||||
{
|
||||
Dual<T,P> result = a;
|
||||
result.val() -= b;
|
||||
@@ -470,7 +470,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const Dual<T
|
||||
|
||||
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const T &a, const Dual<T,P> &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator- (const T &a, const Dual<T,P> &b)
|
||||
{
|
||||
Dual<T,P> result;
|
||||
result.val() = a - b.val();
|
||||
@@ -503,7 +503,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE Dual<T,P>& operator-= (Dual<T,P> &a, const T &b)
|
||||
/// Negation of duals.
|
||||
///
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const Dual<T,P> &a)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator- (const Dual<T,P> &a)
|
||||
{
|
||||
Dual<T,P> result;
|
||||
OSL_INDEX_LOOP(i, P+1, {
|
||||
@@ -516,7 +516,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator- (const Dual<T
|
||||
/// Multiplication of duals. This will work for any Dual<T>*Dual<S>
|
||||
/// where T*S is meaningful.
|
||||
template<class T, int P, class S>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 auto
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr auto
|
||||
operator* (const Dual<T,P> &a, const Dual<S,P> &b) -> Dual<decltype(a.val()*b.val()),P>
|
||||
{
|
||||
// Use the chain rule
|
||||
@@ -533,7 +533,7 @@ operator* (const Dual<T,P> &a, const Dual<S,P> &b) -> Dual<decltype(a.val()*b.va
|
||||
/// Dual<T> * S where T*S is meaningful.
|
||||
template<class T, int P, class S,
|
||||
DUAL_REQUIRES(is_Dual<S>::value == false)>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 auto
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr auto
|
||||
operator* (const Dual<T,P> &a, const S &b) -> Dual<decltype(a.val()*b),P>
|
||||
{
|
||||
Dual<decltype(a.val()*b),P> result;
|
||||
@@ -562,7 +562,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE const Dual<T,P>& operator*= (Dual<T,P> &a, const
|
||||
/// Dual<T> * S where T*S is meaningful.
|
||||
template<class T, int P, class S,
|
||||
DUAL_REQUIRES(is_Dual<S>::value == false)>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 auto
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr auto
|
||||
operator* (const S &b, const Dual<T,P> &a) -> Dual<decltype(a.val()*b),P>
|
||||
{
|
||||
return a*b;
|
||||
@@ -573,7 +573,7 @@ operator* (const S &b, const Dual<T,P> &a) -> Dual<decltype(a.val()*b),P>
|
||||
/// Division of duals.
|
||||
///
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator/ (const Dual<T,P> &a, const Dual<T,P> &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator/ (const Dual<T,P> &a, const Dual<T,P> &b)
|
||||
{
|
||||
T bvalinv = T(1) / b.val();
|
||||
T aval_bval = a.val() / b.val();
|
||||
@@ -589,7 +589,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator/ (const Dual<T
|
||||
/// Division of dual by scalar.
|
||||
///
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator/ (const Dual<T,P> &a, const T &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator/ (const Dual<T,P> &a, const T &b)
|
||||
{
|
||||
T bvalinv = T(1) / b;
|
||||
T aval_bval = a.val() / b;
|
||||
@@ -605,7 +605,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator/ (const Dual<T
|
||||
/// Division of scalar by dual.
|
||||
///
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> operator/ (const T &aval, const Dual<T,P> &b)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> operator/ (const T &aval, const Dual<T,P> &b)
|
||||
{
|
||||
T bvalinv = T(1) / b.val();
|
||||
T aval_bval = aval / b.val();
|
||||
@@ -742,12 +742,12 @@ OSL_HOSTDEVICE OSL_FORCEINLINE constexpr bool equalVal (const T &x, const Dual<T
|
||||
/// equalAll is the same as equalVal generally, but for two Duals of the same
|
||||
/// type, they also compare derivs.
|
||||
template<class T>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 bool equalAll (const T &x, const T &y) {
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr bool equalAll (const T &x, const T &y) {
|
||||
return equalVal(x, y);
|
||||
}
|
||||
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 bool equalAll (const Dual<T,P> &x, const Dual<T,P> &y) {
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr bool equalAll (const Dual<T,P> &x, const Dual<T,P> &y) {
|
||||
bool r = true;
|
||||
OSL_INDEX_LOOP(i, P+1, {
|
||||
r &= (x.elem(i) == y.elem(i));
|
||||
@@ -763,7 +763,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 bool equalAll (const Dual<T,P> &x
|
||||
// function f(scalar), then the dual function F(<u,u'>) is defined as:
|
||||
// F(<u,u'>) = < f(u), f'(u)*u' >
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P>
|
||||
dualfunc (const Dual<T,P>& u, const T& f_val, const T& df_val)
|
||||
{
|
||||
Dual<T,P> result;
|
||||
@@ -781,7 +781,7 @@ dualfunc (const Dual<T,P>& u, const T& f_val, const T& df_val)
|
||||
// F(<u,u'>, <v,v'>) = < f(u,v), dfdu(u,v)u' + dfdv(u,v)v' >
|
||||
// (from http://en.wikipedia.org/wiki/Automatic_differentiation)
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P>
|
||||
dualfunc (const Dual<T,P>& u, const Dual<T,P>& v,
|
||||
const T& f_val, const T& dfdu_val, const T& dfdv_val)
|
||||
{
|
||||
@@ -796,7 +796,7 @@ dualfunc (const Dual<T,P>& u, const Dual<T,P>& v,
|
||||
|
||||
// Helper for construction the result of a Dual function of three variables.
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P>
|
||||
dualfunc (const Dual<T,P>& u, const Dual<T,P>& v, const Dual<T,P>& w,
|
||||
const T& f_val, const T& dfdu_val, const T& dfdv_val, const T& dfdw_val)
|
||||
{
|
||||
@@ -815,7 +815,7 @@ dualfunc (const Dual<T,P>& u, const Dual<T,P>& v, const Dual<T,P>& w,
|
||||
/// OIIO's fast_math.h fast_neg for a more full explanation of why this is
|
||||
/// faster.
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> fast_neg (const Dual<T,P> &a)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> fast_neg (const Dual<T,P> &a)
|
||||
{
|
||||
Dual<T,P> result;
|
||||
OSL_INDEX_LOOP(i, P+1, {
|
||||
@@ -1210,7 +1210,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE Dual<T,P> fast_erfc(const Dual<T,P> &a)
|
||||
|
||||
// f(x) = sqrt(x), f'(x) = 1/(2*sqrt(x))
|
||||
template<class T, int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<T,P> sqrt (const Dual<T,P> &a)
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<T,P> sqrt (const Dual<T,P> &a)
|
||||
{
|
||||
Dual<T,P> result;
|
||||
if (OSL_LIKELY(a.val() > T(0))) {
|
||||
@@ -1336,7 +1336,7 @@ OSL_HOSTDEVICE OSL_FORCEINLINE Dual<T,P> smoothstep (const Dual<T,P> &e0, const
|
||||
|
||||
|
||||
#ifdef __CUDA_ARCH__
|
||||
template<> inline OSL_HOSTDEVICE OSL_CONSTEXPR14 float3 Dual<float3, 2>::zero() {
|
||||
template<> inline OSL_HOSTDEVICE constexpr float3 Dual<float3, 2>::zero() {
|
||||
return float3{0.f, 0.f, 0.f};
|
||||
}
|
||||
#endif
|
||||
|
||||
+17
-17
@@ -147,7 +147,7 @@ comp_x (const Vec3 &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Vec3::BaseType, P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Vec3::BaseType, P>
|
||||
comp_x (const Dual<Vec3,P> &v)
|
||||
{
|
||||
Dual<Vec3::BaseType, P> result;
|
||||
@@ -164,7 +164,7 @@ comp_y (const Vec3 &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Vec3::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Vec3::BaseType,P>
|
||||
comp_y (const Dual<Vec3,P> &v)
|
||||
{
|
||||
Dual<Vec3::BaseType,P> result;
|
||||
@@ -182,7 +182,7 @@ comp_z (const Vec3 &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Vec3::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Vec3::BaseType,P>
|
||||
comp_z (const Dual<Vec3,P> &v)
|
||||
{
|
||||
Dual<Vec3::BaseType,P> result;
|
||||
@@ -211,7 +211,7 @@ comp_z (const Color3 &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Color3::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Color3::BaseType,P>
|
||||
comp_x (const Dual<Color3,P> &v)
|
||||
{
|
||||
Dual<Color3::BaseType, P> result;
|
||||
@@ -222,7 +222,7 @@ comp_x (const Dual<Color3,P> &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Color3::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Color3::BaseType,P>
|
||||
comp_y (const Dual<Color3,P> &v)
|
||||
{
|
||||
Dual<Color3::BaseType,P> result;
|
||||
@@ -233,7 +233,7 @@ comp_y (const Dual<Color3,P> &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Color3::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Color3::BaseType,P>
|
||||
comp_z (const Dual<Color3,P> &v)
|
||||
{
|
||||
Dual<Color3::BaseType,P> result;
|
||||
@@ -252,7 +252,7 @@ comp_x (const Vec2 &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Vec2::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Vec2::BaseType,P>
|
||||
comp_x (const Dual<Vec2,P> &v)
|
||||
{
|
||||
Dual<Vec2::BaseType,P> result;
|
||||
@@ -270,7 +270,7 @@ comp_y (const Vec2 &v)
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE OSL_CONSTEXPR14 Dual<Vec2::BaseType,P>
|
||||
OSL_HOSTDEVICE OSL_FORCEINLINE constexpr Dual<Vec2::BaseType,P>
|
||||
comp_y (const Dual<Vec2,P> &v)
|
||||
{
|
||||
Dual<Vec2::BaseType,P> result;
|
||||
@@ -302,7 +302,7 @@ multMatrix (const Imath::Matrix33<T> &M, const Dual<Vec3,P> &src,
|
||||
|
||||
/// Multiply a row 3-vector (with derivatives) by a 3x3 matrix (no derivs).
|
||||
///
|
||||
template <class T, int P> OSL_HOSTDEVICE inline OSL_CONSTEXPR14
|
||||
template <class T, int P> OSL_HOSTDEVICE inline constexpr
|
||||
Dual<Vec3,P>
|
||||
operator* (const Dual<Vec3,P> &src, const Imath::Matrix33<T> &M)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ operator* (const Dual<Vec3,P> &src, const Imath::Matrix33<T> &M)
|
||||
|
||||
/// Multiply a row 3-vector (with derivatives) by a 3x3 matrix (no derivs).
|
||||
///
|
||||
template <class T, int P> OSL_HOSTDEVICE inline OSL_CONSTEXPR14
|
||||
template <class T, int P> OSL_HOSTDEVICE inline constexpr
|
||||
Dual<Color3,P>
|
||||
operator* (const Dual<Color3,P> &src, const Imath::Matrix33<T> &M)
|
||||
{
|
||||
@@ -408,7 +408,7 @@ multiplyDirByMatrix (const Imath::Matrix44<S> &M,
|
||||
}
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec3::BaseType, P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec3::BaseType, P>
|
||||
dot (const Dual<Vec3,P> &a, const Dual<Vec3,P> &b)
|
||||
{
|
||||
auto ax = comp_x (a);
|
||||
@@ -423,7 +423,7 @@ dot (const Dual<Vec3,P> &a, const Dual<Vec3,P> &b)
|
||||
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec3::BaseType,P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec3::BaseType,P>
|
||||
dot (const Dual<Vec3,P> &a, const Vec3 &b)
|
||||
{
|
||||
auto ax = comp_x (a);
|
||||
@@ -438,7 +438,7 @@ dot (const Dual<Vec3,P> &a, const Vec3 &b)
|
||||
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec3::BaseType,P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec3::BaseType,P>
|
||||
dot (const Vec3 &a, const Dual<Vec3,P> &b)
|
||||
{
|
||||
return dot (b, a);
|
||||
@@ -447,7 +447,7 @@ dot (const Vec3 &a, const Dual<Vec3,P> &b)
|
||||
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec2::BaseType,P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec2::BaseType,P>
|
||||
dot (const Dual<Vec2,P> &a, const Dual<Vec2,P> &b)
|
||||
{
|
||||
auto ax = comp_x (a);
|
||||
@@ -460,7 +460,7 @@ dot (const Dual<Vec2,P> &a, const Dual<Vec2,P> &b)
|
||||
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec2::BaseType,P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec2::BaseType,P>
|
||||
dot (const Dual<Vec2,P> &a, const Vec2 &b)
|
||||
{
|
||||
auto ax = comp_x (a);
|
||||
@@ -473,7 +473,7 @@ dot (const Dual<Vec2,P> &a, const Vec2 &b)
|
||||
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec2::BaseType,P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec2::BaseType,P>
|
||||
dot (const Vec2 &a, const Dual<Vec2,P> &b)
|
||||
{
|
||||
auto ax = comp_x (a);
|
||||
@@ -504,7 +504,7 @@ cross (const Dual<Vec3,P> &a, const Dual<Vec3,P> &b)
|
||||
|
||||
|
||||
template<int P>
|
||||
OSL_HOSTDEVICE inline OSL_CONSTEXPR14 Dual<Vec3::BaseType,P>
|
||||
OSL_HOSTDEVICE inline constexpr Dual<Vec3::BaseType,P>
|
||||
length (const Dual<Vec3,P> &a)
|
||||
{
|
||||
auto ax = comp_x (a);
|
||||
|
||||
@@ -24,15 +24,15 @@ struct ClosureParam {
|
||||
#define fieldsize(st, fld) sizeof(((st *)0)->fld)
|
||||
|
||||
#define CLOSURE_INT_PARAM(st, fld) \
|
||||
{ TypeDesc::TypeInt, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
{ TypeInt, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
#define CLOSURE_FLOAT_PARAM(st, fld) \
|
||||
{ TypeDesc::TypeFloat, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
{ TypeFloat, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
#define CLOSURE_COLOR_PARAM(st, fld) \
|
||||
{ TypeDesc::TypeColor, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
{ TypeColor, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
#define CLOSURE_VECTOR_PARAM(st, fld) \
|
||||
{ TypeDesc::TypeVector, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
{ TypeVector, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
#define CLOSURE_STRING_PARAM(st, fld) \
|
||||
{ TypeDesc::TypeString, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
{ TypeString, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
#define CLOSURE_CLOSURE_PARAM(st, fld) \
|
||||
{ TypeDesc::PTR, (int)reckless_offsetof(st, fld), NULL, fieldsize(st, fld) }
|
||||
|
||||
@@ -49,15 +49,15 @@ struct ClosureParam {
|
||||
|
||||
// NOTE: this keyword args have to be always at the end of the list
|
||||
#define CLOSURE_INT_KEYPARAM(st, fld, key) \
|
||||
{ TypeDesc::TypeInt, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
{ TypeInt, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
#define CLOSURE_FLOAT_KEYPARAM(st, fld, key) \
|
||||
{ TypeDesc::TypeFloat, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
{ TypeFloat, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
#define CLOSURE_COLOR_KEYPARAM(st, fld, key) \
|
||||
{ TypeDesc::TypeColor, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
{ TypeColor, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
#define CLOSURE_VECTOR_KEYPARAM(st, fld, key) \
|
||||
{ TypeDesc::TypeVector, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
{ TypeVector, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
#define CLOSURE_STRING_KEYPARAM(st, fld, key) \
|
||||
{ TypeDesc::TypeString, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
{ TypeString, (int)reckless_offsetof(st, fld), key, fieldsize(st, fld) }
|
||||
|
||||
#define CLOSURE_FINISH_PARAM(st) { TypeDesc(), sizeof(st), nullptr, alignof(st) }
|
||||
|
||||
|
||||
+9
-36
@@ -171,22 +171,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
OSL_FORCEINLINE ValueType value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
OSL_FORCEINLINE ValueType value() const { return m_value; }
|
||||
|
||||
// count number of active bits
|
||||
OSL_FORCEINLINE int count() const
|
||||
{
|
||||
return OSL::popcount(m_value);
|
||||
}
|
||||
OSL_FORCEINLINE int count() const { return OSL::popcount(m_value); }
|
||||
|
||||
// NOTE: undefined result if no bits are on
|
||||
OSL_FORCEINLINE int first_on() const
|
||||
{
|
||||
return OSL::countr_zero(m_value);
|
||||
}
|
||||
OSL_FORCEINLINE int first_on() const { return OSL::countr_zero(m_value); }
|
||||
|
||||
OSL_FORCEINLINE Mask invert() const
|
||||
{
|
||||
@@ -239,10 +230,7 @@ public:
|
||||
return (m_value != static_cast<ValueType>(0));
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE bool any_off() const
|
||||
{
|
||||
return (m_value < valid_bits);
|
||||
}
|
||||
OSL_FORCEINLINE bool any_off() const { return (m_value < valid_bits); }
|
||||
|
||||
OSL_FORCEINLINE bool any_off(const Mask& mask) const
|
||||
{
|
||||
@@ -257,39 +245,27 @@ public:
|
||||
// So really only set_on or set_off is required
|
||||
// Choose to not provide a generic set(int lane, bool flag)
|
||||
|
||||
OSL_FORCEINLINE void set_on(int lane)
|
||||
{
|
||||
m_value |= (1 << lane);
|
||||
}
|
||||
OSL_FORCEINLINE void set_on(int lane) { m_value |= (1 << lane); }
|
||||
|
||||
OSL_FORCEINLINE void set_on_if(int lane, bool cond)
|
||||
{
|
||||
m_value |= (cond << lane);
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE void set_all_on()
|
||||
{
|
||||
m_value = valid_bits;
|
||||
}
|
||||
OSL_FORCEINLINE void set_all_on() { m_value = valid_bits; }
|
||||
OSL_FORCEINLINE void set_count_on(int count)
|
||||
{
|
||||
m_value = valid_bits >> (width - count);
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE void set_off(int lane)
|
||||
{
|
||||
m_value &= (~(1 << lane));
|
||||
}
|
||||
OSL_FORCEINLINE void set_off(int lane) { m_value &= (~(1 << lane)); }
|
||||
|
||||
OSL_FORCEINLINE void set_off_if(int lane, bool cond)
|
||||
{
|
||||
m_value &= (~(cond << lane));
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE void set_all_off()
|
||||
{
|
||||
m_value = static_cast<ValueType>(0);
|
||||
}
|
||||
OSL_FORCEINLINE void set_all_off() { m_value = static_cast<ValueType>(0); }
|
||||
|
||||
OSL_FORCEINLINE bool operator==(const Mask& other) const
|
||||
{
|
||||
@@ -323,10 +299,7 @@ public:
|
||||
return Mask(m_value | other.m_value);
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE Mask operator~() const
|
||||
{
|
||||
return invert();
|
||||
}
|
||||
OSL_FORCEINLINE Mask operator~() const { return invert(); }
|
||||
|
||||
|
||||
template<int MinOccupancyT, int MaxOccupancyT = width, typename FunctorT>
|
||||
|
||||
@@ -109,14 +109,8 @@ OSL_ALIGNAS(16) ClosureComponent : public ClosureColor
|
||||
Vec3 w; ///< Weight of this component
|
||||
|
||||
/// Handy method for getting the parameter memory as a void*.
|
||||
OSL_HOSTDEVICE void* data()
|
||||
{
|
||||
return (char*)(this + 1);
|
||||
}
|
||||
OSL_HOSTDEVICE const void* data() const
|
||||
{
|
||||
return (const char*)(this + 1);
|
||||
}
|
||||
OSL_HOSTDEVICE void* data() { return (char*)(this + 1); }
|
||||
OSL_HOSTDEVICE const void* data() const { return (const char*)(this + 1); }
|
||||
|
||||
/// Handy methods for extracting the underlying parameters as a struct
|
||||
template<typename T> OSL_HOSTDEVICE const T* as() const
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
# ifdef OIIO_ERRORHANDLER_HIDE_PRINTF
|
||||
# define OIIO_ERRORHANDLER_HIDE_PRINTF 1
|
||||
# endif
|
||||
# ifdef OIIO_HIDE_FORMAT
|
||||
# ifndef OIIO_HIDE_FORMAT
|
||||
# define OIIO_HIDE_FORMAT 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -576,7 +576,7 @@ public:
|
||||
// float blur = 0.001;
|
||||
// ss->Parameter (*group, "blur", blur);
|
||||
// Vec3 colorfilter (0.5f, 0.5f, 1.0f);
|
||||
// ss->Parameter (*group, "colorfilter", TypeDesc::TypeColor,
|
||||
// ss->Parameter (*group, "colorfilter", TypeColor,
|
||||
// &colorfilter);
|
||||
// ss->Shader ("surface", "texmap", "texturelayer");
|
||||
// /* Second layer - generate the BSDF closure: */
|
||||
|
||||
+15
-15
@@ -154,28 +154,28 @@ bitcast_to_uint (float x)
|
||||
OSL_FORCEINLINE void
|
||||
bjmix(vint4& a, vint4& b, vint4& c)
|
||||
{
|
||||
using OIIO::simd::rotl32;
|
||||
a -= c; a ^= rotl32(c, 4); c += b;
|
||||
b -= a; b ^= rotl32(a, 6); a += c;
|
||||
c -= b; c ^= rotl32(b, 8); b += a;
|
||||
a -= c; a ^= rotl32(c,16); c += b;
|
||||
b -= a; b ^= rotl32(a,19); a += c;
|
||||
c -= b; c ^= rotl32(b, 4); b += a;
|
||||
using OIIO::simd::rotl;
|
||||
a -= c; a ^= rotl(c, 4); c += b;
|
||||
b -= a; b ^= rotl(a, 6); a += c;
|
||||
c -= b; c ^= rotl(b, 8); b += a;
|
||||
a -= c; a ^= rotl(c,16); c += b;
|
||||
b -= a; b ^= rotl(a,19); a += c;
|
||||
c -= b; c ^= rotl(b, 4); b += a;
|
||||
}
|
||||
|
||||
// Perform a bjfinal (see OpenImageIO/hash.h) on 4 sets of values at once.
|
||||
OSL_FORCEINLINE vint4
|
||||
bjfinal(const vint4& a_, const vint4& b_, const vint4& c_)
|
||||
{
|
||||
using OIIO::simd::rotl32;
|
||||
using OIIO::simd::rotl;
|
||||
vint4 a(a_), b(b_), c(c_);
|
||||
c ^= b; c -= rotl32(b,14);
|
||||
a ^= c; a -= rotl32(c,11);
|
||||
b ^= a; b -= rotl32(a,25);
|
||||
c ^= b; c -= rotl32(b,16);
|
||||
a ^= c; a -= rotl32(c,4);
|
||||
b ^= a; b -= rotl32(a,14);
|
||||
c ^= b; c -= rotl32(b,24);
|
||||
c ^= b; c -= rotl(b,14);
|
||||
a ^= c; a -= rotl(c,11);
|
||||
b ^= a; b -= rotl(a,25);
|
||||
c ^= b; c -= rotl(b,16);
|
||||
a ^= c; a -= rotl(c,4);
|
||||
b ^= a; b -= rotl(a,14);
|
||||
c ^= b; c -= rotl(b,24);
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,7 @@ struct ShaderGlobals;
|
||||
class ShaderGroup;
|
||||
|
||||
// Tags for polymorphic dispatch
|
||||
template<int SimdWidthT> class WidthOf {
|
||||
};
|
||||
template<int SimdWidthT> class WidthOf {};
|
||||
|
||||
|
||||
/// Opaque pointer to whatever the renderer uses to represent a
|
||||
|
||||
+13
-25
@@ -299,16 +299,13 @@ public:
|
||||
|
||||
// Specializations
|
||||
template<int WidthT>
|
||||
struct Block<float, WidthT> : public BlockOfBuiltin<float, WidthT> {
|
||||
};
|
||||
struct Block<float, WidthT> : public BlockOfBuiltin<float, WidthT> {};
|
||||
|
||||
template<int WidthT>
|
||||
struct Block<int, WidthT> : public BlockOfBuiltin<int, WidthT> {
|
||||
};
|
||||
struct Block<int, WidthT> : public BlockOfBuiltin<int, WidthT> {};
|
||||
|
||||
template<typename DataT, int WidthT>
|
||||
struct Block<DataT*, WidthT> : public BlockOfBuiltin<DataT*, WidthT> {
|
||||
};
|
||||
struct Block<DataT*, WidthT> : public BlockOfBuiltin<DataT*, WidthT> {};
|
||||
|
||||
|
||||
// Vec4 isn't used by external interfaces, but some internal
|
||||
@@ -2283,15 +2280,9 @@ template<typename DataT, int WidthT> struct MaskedLaneProxy {
|
||||
// visibility to end user whose IDE
|
||||
// might display these methods vs. free
|
||||
// functions
|
||||
OSL_FORCEINLINE bool is_on() const
|
||||
{
|
||||
return m_mask.is_on(m_lane);
|
||||
}
|
||||
OSL_FORCEINLINE bool is_on() const { return m_mask.is_on(m_lane); }
|
||||
|
||||
OSL_FORCEINLINE bool is_off() const
|
||||
{
|
||||
return m_mask.is_off(m_lane);
|
||||
}
|
||||
OSL_FORCEINLINE bool is_off() const { return m_mask.is_off(m_lane); }
|
||||
|
||||
private:
|
||||
Block<DataT, WidthT>& m_ref_wide_data;
|
||||
@@ -2353,15 +2344,9 @@ struct MaskedArrayLaneProxy {
|
||||
// visibility to end user whose IDE
|
||||
// might display these methods vs. free
|
||||
// functions
|
||||
OSL_FORCEINLINE bool is_on() const
|
||||
{
|
||||
return m_mask.is_on(m_lane);
|
||||
}
|
||||
OSL_FORCEINLINE bool is_on() const { return m_mask.is_on(m_lane); }
|
||||
|
||||
OSL_FORCEINLINE bool is_off() const
|
||||
{
|
||||
return m_mask.is_off(m_lane);
|
||||
}
|
||||
OSL_FORCEINLINE bool is_off() const { return m_mask.is_off(m_lane); }
|
||||
|
||||
OSL_FORCEINLINE MaskedLaneProxy<DataT, WidthT>
|
||||
operator[](int array_index) const
|
||||
@@ -2726,7 +2711,8 @@ struct MaskedDeriv : public Masked<DataT, WidthT> {
|
||||
template<typename FirstT, typename... ListT,
|
||||
std::enable_if_t<std::is_same<typename std::decay<FirstT>::type,
|
||||
MaskedDeriv>::value,
|
||||
bool> = true>
|
||||
bool>
|
||||
= true>
|
||||
OSL_FORCEINLINE MaskedDeriv(FirstT&& first, ListT&&... argList)
|
||||
: Masked<DataT, WidthT>(std::forward<FirstT>(first),
|
||||
std::forward<ListT>(argList)...)
|
||||
@@ -2737,7 +2723,8 @@ struct MaskedDeriv : public Masked<DataT, WidthT> {
|
||||
template<typename FirstT, typename... ListT,
|
||||
std::enable_if_t<!std::is_same<typename std::decay<FirstT>::type,
|
||||
MaskedDeriv>::value,
|
||||
bool> = true>
|
||||
bool>
|
||||
= true>
|
||||
OSL_FORCEINLINE MaskedDeriv(FirstT&& first, ListT&&... argList)
|
||||
: Masked<DataT, WidthT>(std::forward<FirstT>(first),
|
||||
std::forward<ListT>(argList)...,
|
||||
@@ -3188,7 +3175,8 @@ template<typename DataT, int DerivIndexT> struct RefDeriv : public Ref<DataT> {
|
||||
template<typename FirstT, typename... ListT,
|
||||
std::enable_if_t<!std::is_same<typename std::decay<FirstT>::type,
|
||||
RefDeriv>::value,
|
||||
bool> = true>
|
||||
bool>
|
||||
= true>
|
||||
explicit OSL_FORCEINLINE RefDeriv(FirstT&& first, ListT&&... argList)
|
||||
: Ref<DataT>(std::forward<FirstT>(first),
|
||||
std::forward<ListT>(argList)...,
|
||||
|
||||
+69
-267
@@ -244,46 +244,25 @@ public:
|
||||
// m_simple is always UNKNOWN for structures.
|
||||
|
||||
/// Is it a simple scalar int?
|
||||
bool is_int() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeInt && !is_closure();
|
||||
}
|
||||
bool is_int() const { return m_simple == TypeInt && !is_closure(); }
|
||||
|
||||
/// Is it a simple scalar float?
|
||||
bool is_float() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeFloat && !is_closure();
|
||||
}
|
||||
bool is_float() const { return m_simple == TypeFloat && !is_closure(); }
|
||||
|
||||
/// Is it a color?
|
||||
bool is_color() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeColor && !is_closure();
|
||||
}
|
||||
bool is_color() const { return m_simple == TypeColor && !is_closure(); }
|
||||
|
||||
/// Is it a point?
|
||||
bool is_point() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypePoint && !is_closure();
|
||||
}
|
||||
bool is_point() const { return m_simple == TypePoint && !is_closure(); }
|
||||
|
||||
/// Is it a vector?
|
||||
bool is_vector() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeVector && !is_closure();
|
||||
}
|
||||
bool is_vector() const { return m_simple == TypeVector && !is_closure(); }
|
||||
|
||||
/// Is it a normal?
|
||||
bool is_normal() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeNormal && !is_closure();
|
||||
}
|
||||
bool is_normal() const { return m_simple == TypeNormal && !is_closure(); }
|
||||
|
||||
/// Is it a simple string?
|
||||
bool is_string() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeString && !is_closure();
|
||||
}
|
||||
bool is_string() const { return m_simple == TypeString && !is_closure(); }
|
||||
|
||||
/// Is it a string or an array of strings?
|
||||
///
|
||||
@@ -357,9 +336,8 @@ public:
|
||||
bool is_vectriple() const
|
||||
{
|
||||
return !is_closure()
|
||||
&& (m_simple == TypeDesc::TypePoint
|
||||
|| m_simple == TypeDesc::TypeVector
|
||||
|| m_simple == TypeDesc::TypeNormal);
|
||||
&& (m_simple == TypePoint || m_simple == TypeVector
|
||||
|| m_simple == TypeNormal);
|
||||
}
|
||||
|
||||
/// Is it based on a vector-like triple (point, vector, or normal)?
|
||||
@@ -367,16 +345,12 @@ public:
|
||||
bool is_vectriple_based() const
|
||||
{
|
||||
auto elem = m_simple.elementtype();
|
||||
return (elem == TypeDesc::TypePoint || elem == TypeDesc::TypeVector
|
||||
|| elem == TypeDesc::TypeNormal);
|
||||
return (elem == TypePoint || elem == TypeVector || elem == TypeNormal);
|
||||
}
|
||||
|
||||
/// Is it a simple matrix (but not an array or closure)?
|
||||
///
|
||||
bool is_matrix() const
|
||||
{
|
||||
return m_simple == TypeDesc::TypeMatrix && !is_closure();
|
||||
}
|
||||
bool is_matrix() const { return m_simple == TypeMatrix && !is_closure(); }
|
||||
|
||||
/// Is it a color closure?
|
||||
///
|
||||
@@ -647,133 +621,55 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void dataoffset(int d)
|
||||
{
|
||||
m_dataoffset = d;
|
||||
}
|
||||
int dataoffset() const
|
||||
{
|
||||
return m_dataoffset;
|
||||
}
|
||||
void dataoffset(int d) { m_dataoffset = d; }
|
||||
int dataoffset() const { return m_dataoffset; }
|
||||
|
||||
void wide_dataoffset(int d)
|
||||
{
|
||||
m_wide_dataoffset = d;
|
||||
}
|
||||
int wide_dataoffset() const
|
||||
{
|
||||
return m_wide_dataoffset;
|
||||
}
|
||||
void wide_dataoffset(int d) { m_wide_dataoffset = d; }
|
||||
int wide_dataoffset() const { return m_wide_dataoffset; }
|
||||
|
||||
SymArena arena() const
|
||||
{
|
||||
return static_cast<SymArena>(m_arena);
|
||||
}
|
||||
SymArena arena() const { return static_cast<SymArena>(m_arena); }
|
||||
|
||||
void initializers(int d)
|
||||
{
|
||||
m_initializers = d;
|
||||
}
|
||||
int initializers() const
|
||||
{
|
||||
return m_initializers;
|
||||
}
|
||||
void initializers(int d) { m_initializers = d; }
|
||||
int initializers() const { return m_initializers; }
|
||||
|
||||
bool has_derivs() const
|
||||
{
|
||||
return m_has_derivs;
|
||||
}
|
||||
void has_derivs(bool new_derivs)
|
||||
{
|
||||
m_has_derivs = new_derivs;
|
||||
}
|
||||
int size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
void size(size_t newsize)
|
||||
{
|
||||
m_size = (int)newsize;
|
||||
}
|
||||
bool has_derivs() const { return m_has_derivs; }
|
||||
void has_derivs(bool new_derivs) { m_has_derivs = new_derivs; }
|
||||
int size() const { return m_size; }
|
||||
void size(size_t newsize) { m_size = (int)newsize; }
|
||||
|
||||
/// Return the size for each point, including derivs.
|
||||
///
|
||||
int derivsize() const
|
||||
{
|
||||
return m_has_derivs ? 3 * m_size : m_size;
|
||||
}
|
||||
int derivsize() const { return m_has_derivs ? 3 * m_size : m_size; }
|
||||
|
||||
bool connected() const
|
||||
{
|
||||
return valuesource() == ConnectedVal;
|
||||
}
|
||||
bool connected_down() const
|
||||
{
|
||||
return m_connected_down;
|
||||
}
|
||||
void connected_down(bool c)
|
||||
{
|
||||
m_connected_down = c;
|
||||
}
|
||||
bool connected() const { return valuesource() == ConnectedVal; }
|
||||
bool connected_down() const { return m_connected_down; }
|
||||
void connected_down(bool c) { m_connected_down = c; }
|
||||
|
||||
/// Where did the symbol's value come from?
|
||||
///
|
||||
enum ValueSource { DefaultVal, InstanceVal, GeomVal, ConnectedVal };
|
||||
|
||||
ValueSource valuesource() const
|
||||
{
|
||||
return (ValueSource)m_valuesource;
|
||||
}
|
||||
void valuesource(ValueSource v)
|
||||
{
|
||||
m_valuesource = v;
|
||||
}
|
||||
ValueSource valuesource() const { return (ValueSource)m_valuesource; }
|
||||
void valuesource(ValueSource v) { m_valuesource = v; }
|
||||
const char* valuesourcename() const;
|
||||
static const char* valuesourcename(ValueSource v);
|
||||
|
||||
int fieldid() const
|
||||
{
|
||||
return m_fieldid;
|
||||
}
|
||||
void fieldid(int id)
|
||||
{
|
||||
m_fieldid = id;
|
||||
}
|
||||
int fieldid() const { return m_fieldid; }
|
||||
void fieldid(int id) { m_fieldid = id; }
|
||||
|
||||
int layer() const
|
||||
{
|
||||
return m_layer;
|
||||
}
|
||||
void layer(int id)
|
||||
{
|
||||
m_layer = id;
|
||||
}
|
||||
int layer() const { return m_layer; }
|
||||
void layer(int id) { m_layer = id; }
|
||||
|
||||
int initbegin() const
|
||||
{
|
||||
return m_initbegin;
|
||||
}
|
||||
void initbegin(int i)
|
||||
{
|
||||
m_initbegin = i;
|
||||
}
|
||||
int initend() const
|
||||
{
|
||||
return m_initend;
|
||||
}
|
||||
void initend(int i)
|
||||
{
|
||||
m_initend = i;
|
||||
}
|
||||
int initbegin() const { return m_initbegin; }
|
||||
void initbegin(int i) { m_initbegin = i; }
|
||||
int initend() const { return m_initend; }
|
||||
void initend(int i) { m_initend = i; }
|
||||
void set_initrange(int b = 0, int e = 0)
|
||||
{
|
||||
m_initbegin = b;
|
||||
m_initend = e;
|
||||
}
|
||||
bool has_init_ops() const
|
||||
{
|
||||
return m_initbegin != m_initend;
|
||||
}
|
||||
bool has_init_ops() const { return m_initbegin != m_initend; }
|
||||
|
||||
/// Clear read/write usage info.
|
||||
///
|
||||
@@ -817,42 +713,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int firstread() const
|
||||
{
|
||||
return m_firstread;
|
||||
}
|
||||
int lastread() const
|
||||
{
|
||||
return m_lastread;
|
||||
}
|
||||
int firstwrite() const
|
||||
{
|
||||
return m_firstwrite;
|
||||
}
|
||||
int lastwrite() const
|
||||
{
|
||||
return m_lastwrite;
|
||||
}
|
||||
int firstuse() const
|
||||
{
|
||||
return std::min(firstread(), firstwrite());
|
||||
}
|
||||
int lastuse() const
|
||||
{
|
||||
return std::max(lastread(), lastwrite());
|
||||
}
|
||||
bool everread() const
|
||||
{
|
||||
return lastread() >= 0;
|
||||
}
|
||||
bool everwritten() const
|
||||
{
|
||||
return lastwrite() >= 0;
|
||||
}
|
||||
bool everused() const
|
||||
{
|
||||
return everread() || everwritten();
|
||||
}
|
||||
int firstread() const { return m_firstread; }
|
||||
int lastread() const { return m_lastread; }
|
||||
int firstwrite() const { return m_firstwrite; }
|
||||
int lastwrite() const { return m_lastwrite; }
|
||||
int firstuse() const { return std::min(firstread(), firstwrite()); }
|
||||
int lastuse() const { return std::max(lastread(), lastwrite()); }
|
||||
bool everread() const { return lastread() >= 0; }
|
||||
bool everwritten() const { return lastwrite() >= 0; }
|
||||
bool everused() const { return everread() || everwritten(); }
|
||||
// everused_in_group is an even more stringent test -- not only must
|
||||
// the symbol not be used within the shader but it also must not be
|
||||
// used elsewhere in the group, by being connected to something downstream
|
||||
@@ -873,14 +742,8 @@ public:
|
||||
m_lastwrite = last;
|
||||
}
|
||||
|
||||
bool initialized() const
|
||||
{
|
||||
return m_initialized;
|
||||
}
|
||||
void initialized(bool init)
|
||||
{
|
||||
m_initialized = init;
|
||||
}
|
||||
bool initialized() const { return m_initialized; }
|
||||
void initialized(bool init) { m_initialized = init; }
|
||||
|
||||
bool lockgeom() const
|
||||
{
|
||||
@@ -889,76 +752,34 @@ public:
|
||||
return !m_interpolated && !m_interactive;
|
||||
}
|
||||
|
||||
bool interpolated() const
|
||||
{
|
||||
return m_interpolated;
|
||||
}
|
||||
void interpolated(bool val)
|
||||
{
|
||||
m_interpolated = val;
|
||||
}
|
||||
bool interpolated() const { return m_interpolated; }
|
||||
void interpolated(bool val) { m_interpolated = val; }
|
||||
|
||||
bool interactive() const
|
||||
{
|
||||
return m_interactive;
|
||||
}
|
||||
void interactive(bool val)
|
||||
{
|
||||
m_interactive = val;
|
||||
}
|
||||
bool interactive() const { return m_interactive; }
|
||||
void interactive(bool val) { m_interactive = val; }
|
||||
|
||||
bool noninteractive() const
|
||||
{
|
||||
return m_noninteractive;
|
||||
}
|
||||
void noninteractive(bool val)
|
||||
{
|
||||
m_noninteractive = val;
|
||||
}
|
||||
bool noninteractive() const { return m_noninteractive; }
|
||||
void noninteractive(bool val) { m_noninteractive = val; }
|
||||
|
||||
bool allowconnect() const
|
||||
{
|
||||
return m_allowconnect;
|
||||
}
|
||||
void allowconnect(bool val)
|
||||
{
|
||||
m_allowconnect = val;
|
||||
}
|
||||
bool allowconnect() const { return m_allowconnect; }
|
||||
void allowconnect(bool val) { m_allowconnect = val; }
|
||||
|
||||
int arraylen() const
|
||||
{
|
||||
return m_typespec.arraylength();
|
||||
}
|
||||
int arraylen() const { return m_typespec.arraylength(); }
|
||||
void arraylen(int len)
|
||||
{
|
||||
m_typespec.make_array(len);
|
||||
m_size = m_typespec.simpletype().size();
|
||||
}
|
||||
|
||||
bool renderer_output() const
|
||||
{
|
||||
return m_renderer_output;
|
||||
}
|
||||
void renderer_output(bool v)
|
||||
{
|
||||
m_renderer_output = v;
|
||||
}
|
||||
bool renderer_output() const { return m_renderer_output; }
|
||||
void renderer_output(bool v) { m_renderer_output = v; }
|
||||
|
||||
// When not uniform a symbol will have a varying value under batched
|
||||
// execution and must use a Wide data type to hold different values
|
||||
// for each data lane executing
|
||||
bool is_uniform() const
|
||||
{
|
||||
return m_is_uniform;
|
||||
}
|
||||
bool is_varying() const
|
||||
{
|
||||
return (m_is_uniform == 0);
|
||||
}
|
||||
void make_varying()
|
||||
{
|
||||
m_is_uniform = false;
|
||||
}
|
||||
bool is_uniform() const { return m_is_uniform; }
|
||||
bool is_varying() const { return (m_is_uniform == 0); }
|
||||
void make_varying() { m_is_uniform = false; }
|
||||
|
||||
// Results of a compare_op and other ops with logically boolean
|
||||
// results under certain conditions could be forced to be represented
|
||||
@@ -972,32 +793,14 @@ public:
|
||||
// The value of forced_llvm_bool() is currently only respected during
|
||||
// batched execution. Forced bools should not be coalesced with regular
|
||||
// ints, only other forced bools.
|
||||
bool forced_llvm_bool() const
|
||||
{
|
||||
return m_forced_llvm_bool;
|
||||
}
|
||||
void forced_llvm_bool(bool v)
|
||||
{
|
||||
m_forced_llvm_bool = v;
|
||||
}
|
||||
bool forced_llvm_bool() const { return m_forced_llvm_bool; }
|
||||
void forced_llvm_bool(bool v) { m_forced_llvm_bool = v; }
|
||||
|
||||
bool readonly() const
|
||||
{
|
||||
return m_readonly;
|
||||
}
|
||||
void readonly(bool v)
|
||||
{
|
||||
m_readonly = v;
|
||||
}
|
||||
bool readonly() const { return m_readonly; }
|
||||
void readonly(bool v) { m_readonly = v; }
|
||||
|
||||
bool is_constant() const
|
||||
{
|
||||
return symtype() == SymTypeConst;
|
||||
}
|
||||
bool is_temp() const
|
||||
{
|
||||
return symtype() == SymTypeTemp;
|
||||
}
|
||||
bool is_constant() const { return symtype() == SymTypeConst; }
|
||||
bool is_temp() const { return symtype() == SymTypeTemp; }
|
||||
|
||||
// Retrieve the const float value (must be a const float!)
|
||||
float get_float(int index = 0) const
|
||||
@@ -1332,7 +1135,6 @@ OSL_NAMESPACE_EXIT
|
||||
// Supply a fmtlib compatible custom formatter for TypeSpec.
|
||||
#if FMT_VERSION >= 100000
|
||||
FMT_BEGIN_NAMESPACE
|
||||
template<> struct formatter<OSL::pvt::TypeSpec> : ostream_formatter {
|
||||
};
|
||||
template<> struct formatter<OSL::pvt::TypeSpec> : ostream_formatter {};
|
||||
FMT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
@@ -1032,19 +1032,19 @@ public:
|
||||
ASTliteral(OSLCompilerImpl* comp, int i)
|
||||
: ASTNode(literal_node, comp), m_i(i)
|
||||
{
|
||||
m_typespec = TypeDesc::TypeInt;
|
||||
m_typespec = TypeInt;
|
||||
}
|
||||
|
||||
ASTliteral(OSLCompilerImpl* comp, float f)
|
||||
: ASTNode(literal_node, comp), m_f(f)
|
||||
{
|
||||
m_typespec = TypeDesc::TypeFloat;
|
||||
m_typespec = TypeFloat;
|
||||
}
|
||||
|
||||
ASTliteral(OSLCompilerImpl* comp, ustring s)
|
||||
: ASTNode(literal_node, comp), m_s(s)
|
||||
{
|
||||
m_typespec = TypeDesc::TypeString;
|
||||
m_typespec = TypeString;
|
||||
}
|
||||
|
||||
const char* nodetypename() const { return "literal"; }
|
||||
|
||||
@@ -354,7 +354,7 @@ ASTNode::codegen_int(Symbol*, bool boolify, bool invert)
|
||||
if (!type.is_int() || boolify || invert) {
|
||||
// If they're not using an int as the condition, then it's an
|
||||
// implied comparison to zero.
|
||||
Symbol* tempvar = m_compiler->make_temporary(TypeDesc::TypeInt);
|
||||
Symbol* tempvar = m_compiler->make_temporary(TypeInt);
|
||||
Symbol* zerovar = NULL;
|
||||
if (type.is_closure())
|
||||
zerovar = m_compiler->make_constant((int)0);
|
||||
@@ -1543,7 +1543,7 @@ ASTbinary_expression::codegen(Symbol* dest)
|
||||
if (m_op == Mul || m_op == Div) {
|
||||
// Need to coerce the weight into a color.
|
||||
// N.B. The typecheck always reorders c=k*c into c=c*k.
|
||||
rsym = coerce(rsym, TypeDesc::TypeColor, true);
|
||||
rsym = coerce(rsym, TypeColor, true);
|
||||
}
|
||||
emitcode(opword(), dest, lsym, rsym);
|
||||
return dest;
|
||||
|
||||
+15
-16
@@ -26,7 +26,11 @@
|
||||
#include <clang/Frontend/TextDiagnosticPrinter.h>
|
||||
#include <clang/Frontend/Utils.h>
|
||||
#include <clang/Lex/PreprocessorOptions.h>
|
||||
#include <llvm/Support/Host.h>
|
||||
#if OSL_LLVM_VERSION < 160
|
||||
# include <llvm/Support/Host.h>
|
||||
#else
|
||||
# include <llvm/TargetParser/Host.h>
|
||||
#endif
|
||||
#include <llvm/Support/MemoryBuffer.h>
|
||||
#include <llvm/Support/ToolOutputFile.h>
|
||||
#include <llvm/Support/raw_ostream.h>
|
||||
@@ -628,20 +632,15 @@ struct GlobalTable {
|
||||
void
|
||||
OSLCompilerImpl::initialize_globals()
|
||||
{
|
||||
static GlobalTable globals[]
|
||||
= { { "P", TypeDesc::TypePoint, false },
|
||||
{ "I", TypeDesc::TypeVector, false },
|
||||
{ "N", TypeDesc::TypeNormal, false },
|
||||
{ "Ng", TypeDesc::TypeNormal },
|
||||
{ "u", TypeDesc::TypeFloat },
|
||||
{ "v", TypeDesc::TypeFloat },
|
||||
{ "dPdu", TypeDesc::TypeVector },
|
||||
{ "dPdv", TypeDesc::TypeVector },
|
||||
{ "Ps", TypeDesc::TypePoint },
|
||||
{ "Ci", TypeSpec(TypeDesc::TypeColor, true), false },
|
||||
{ "time", TypeDesc::TypeFloat },
|
||||
{ "dtime", TypeDesc::TypeFloat },
|
||||
{ "dPdtime", TypeDesc::TypeVector } };
|
||||
static GlobalTable globals[] = {
|
||||
{ "P", TypePoint, false }, { "I", TypeVector, false },
|
||||
{ "N", TypeNormal, false }, { "Ng", TypeNormal },
|
||||
{ "u", TypeFloat }, { "v", TypeFloat },
|
||||
{ "dPdu", TypeVector }, { "dPdv", TypeVector },
|
||||
{ "Ps", TypePoint }, { "Ci", TypeSpec(TypeColor, true), false },
|
||||
{ "time", TypeFloat }, { "dtime", TypeFloat },
|
||||
{ "dPdtime", TypeVector }
|
||||
};
|
||||
|
||||
for (auto& g : globals) {
|
||||
Symbol* s = new Symbol(ustring(g.name), g.type, SymTypeGlobal);
|
||||
@@ -702,7 +701,7 @@ OSLCompilerImpl::write_oso_const_value(const ConstantSymbol* sym) const
|
||||
else if (elemtype == TypeDesc::FLOAT)
|
||||
for (int i = 0; i < nelements; ++i)
|
||||
osofmt("{:.9g}{}", sym->floatval(i), nelements > 1 ? " " : "");
|
||||
else if (equivalent(elemtype, TypeDesc::TypeVector))
|
||||
else if (equivalent(elemtype, TypeVector))
|
||||
for (int i = 0; i < nelements; ++i) {
|
||||
Vec3 v = sym->get_vec3(i);
|
||||
osofmt("{:.9g} {:.9g} {:.9g}{}", v.x, v.y, v.z,
|
||||
|
||||
@@ -1110,14 +1110,14 @@ inline TypeDesc
|
||||
OSL::pvt::osllextype (int lex)
|
||||
{
|
||||
switch (lex) {
|
||||
case COLORTYPE : return TypeDesc::TypeColor;
|
||||
case FLOATTYPE : return TypeDesc::TypeFloat;
|
||||
case INTTYPE : return TypeDesc::TypeInt;
|
||||
case MATRIXTYPE : return TypeDesc::TypeMatrix;
|
||||
case NORMALTYPE : return TypeDesc::TypeNormal;
|
||||
case POINTTYPE : return TypeDesc::TypePoint;
|
||||
case STRINGTYPE : return TypeDesc::TypeString;
|
||||
case VECTORTYPE : return TypeDesc::TypeVector;
|
||||
case COLORTYPE : return TypeColor;
|
||||
case FLOATTYPE : return TypeFloat;
|
||||
case INTTYPE : return TypeInt;
|
||||
case MATRIXTYPE : return TypeMatrix;
|
||||
case NORMALTYPE : return TypeNormal;
|
||||
case POINTTYPE : return TypePoint;
|
||||
case STRINGTYPE : return TypeString;
|
||||
case VECTORTYPE : return TypeVector;
|
||||
case VOIDTYPE : return TypeDesc::NONE;
|
||||
default: return TypeDesc::UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -114,20 +114,17 @@ private:
|
||||
/// the parent class to properly free it upon destruction.
|
||||
class ConstantSymbol final : public Symbol {
|
||||
public:
|
||||
ConstantSymbol(ustring n, ustring val)
|
||||
: Symbol(n, TypeDesc::TypeString, SymTypeConst)
|
||||
ConstantSymbol(ustring n, ustring val) : Symbol(n, TypeString, SymTypeConst)
|
||||
{
|
||||
m_val.s = val.c_str();
|
||||
set_dataptr(SymArena::Absolute, &m_val.s);
|
||||
}
|
||||
ConstantSymbol(ustring n, int val)
|
||||
: Symbol(n, TypeDesc::TypeInt, SymTypeConst)
|
||||
ConstantSymbol(ustring n, int val) : Symbol(n, TypeInt, SymTypeConst)
|
||||
{
|
||||
m_val.i = val;
|
||||
set_dataptr(SymArena::Absolute, &m_val.i);
|
||||
}
|
||||
ConstantSymbol(ustring n, float val)
|
||||
: Symbol(n, TypeDesc::TypeFloat, SymTypeConst)
|
||||
ConstantSymbol(ustring n, float val) : Symbol(n, TypeFloat, SymTypeConst)
|
||||
{
|
||||
m_val.f = val;
|
||||
set_dataptr(SymArena::Absolute, &m_val.f);
|
||||
@@ -148,7 +145,7 @@ public:
|
||||
set_dataptr(SymArena::Absolute, &m_val.i);
|
||||
else if (type == TypeDesc::STRING)
|
||||
set_dataptr(SymArena::Absolute, &m_val.s);
|
||||
else if (equivalent(type, TypeDesc::TypeVector))
|
||||
else if (equivalent(type, TypeVector))
|
||||
set_dataptr(SymArena::Absolute, &m_val.v);
|
||||
else {
|
||||
OSL_DASSERT(arena() == SymArena::Unknown);
|
||||
|
||||
@@ -426,7 +426,7 @@ ASTunary_expression::typecheck(TypeSpec expected)
|
||||
m_typespec = t;
|
||||
break;
|
||||
case Not:
|
||||
m_typespec = TypeDesc::TypeInt; // ! is always an int
|
||||
m_typespec = TypeInt; // ! is always an int
|
||||
break;
|
||||
case Compl:
|
||||
if (!t.is_int()) {
|
||||
@@ -515,7 +515,7 @@ ASTbinary_expression::typecheck(TypeSpec expected)
|
||||
if (m_op == And || m_op == Or) {
|
||||
// Logical ops work can work on closures (since they test
|
||||
// for nonemptiness, but always return int.
|
||||
return m_typespec = TypeDesc::TypeInt;
|
||||
return m_typespec = TypeInt;
|
||||
}
|
||||
// If we got this far, it's an op that's not allowed
|
||||
errorfmt("Not allowed: '{} {} {}'", l, opname(), r);
|
||||
@@ -538,10 +538,10 @@ ASTbinary_expression::typecheck(TypeSpec expected)
|
||||
if (equivalent(l, r)) {
|
||||
// handle a few couple special cases
|
||||
if (m_op == Sub && l.is_point() && r.is_point()) // p-p == v
|
||||
return m_typespec = TypeDesc::TypeVector;
|
||||
return m_typespec = TypeVector;
|
||||
if ((m_op == Add || m_op == Sub)
|
||||
&& (l.is_point() || r.is_point())) // p +/- v, v +/- p == p
|
||||
return m_typespec = TypeDesc::TypePoint;
|
||||
return m_typespec = TypePoint;
|
||||
// everything else: the first operand is also the return type
|
||||
return m_typespec = l;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ ASTbinary_expression::typecheck(TypeSpec expected)
|
||||
case Mod:
|
||||
// Mod only works with ints, and return ints.
|
||||
if (l.is_int() && r.is_int())
|
||||
return m_typespec = TypeDesc::TypeInt;
|
||||
return m_typespec = TypeInt;
|
||||
break;
|
||||
|
||||
case Equal:
|
||||
@@ -563,7 +563,7 @@ ASTbinary_expression::typecheck(TypeSpec expected)
|
||||
// Result is always an int.
|
||||
if (equivalent(l, r) || (l.is_numeric() && r.is_int_or_float())
|
||||
|| (l.is_int_or_float() && r.is_numeric()))
|
||||
return m_typespec = TypeDesc::TypeInt;
|
||||
return m_typespec = TypeInt;
|
||||
break;
|
||||
|
||||
case Greater:
|
||||
@@ -573,7 +573,7 @@ ASTbinary_expression::typecheck(TypeSpec expected)
|
||||
// G/L comparisons only work with floats or ints, and always
|
||||
// return int.
|
||||
if (l.is_int_or_float() && r.is_int_or_float())
|
||||
return m_typespec = TypeDesc::TypeInt;
|
||||
return m_typespec = TypeInt;
|
||||
break;
|
||||
|
||||
case BitAnd:
|
||||
@@ -583,14 +583,14 @@ ASTbinary_expression::typecheck(TypeSpec expected)
|
||||
case ShiftRight:
|
||||
// Bitwise ops only work with ints, and return ints.
|
||||
if (l.is_int() && r.is_int())
|
||||
return m_typespec = TypeDesc::TypeInt;
|
||||
return m_typespec = TypeInt;
|
||||
break;
|
||||
|
||||
case And:
|
||||
case Or:
|
||||
// Logical ops work on any simple type (since they test for
|
||||
// nonzeroness), but always return int.
|
||||
return m_typespec = TypeDesc::TypeInt;
|
||||
return m_typespec = TypeInt;
|
||||
|
||||
default: errorfmt("unknown binary operator");
|
||||
}
|
||||
@@ -606,7 +606,7 @@ TypeSpec
|
||||
ASTternary_expression::typecheck(TypeSpec expected)
|
||||
{
|
||||
// FIXME - closures
|
||||
TypeSpec c = typecheck_list(cond(), TypeDesc::TypeInt);
|
||||
TypeSpec c = typecheck_list(cond(), TypeInt);
|
||||
TypeSpec t = typecheck_list(trueexpr(), expected);
|
||||
TypeSpec f = typecheck_list(falseexpr(), expected);
|
||||
|
||||
@@ -1268,9 +1268,9 @@ ASTfunction_call::typecheck_builtin_specialcase()
|
||||
if (m_name == "transform") {
|
||||
// Special case for transform: under the covers, it selects
|
||||
// vector or normal special versions depending on its use.
|
||||
if (typespec().simpletype() == TypeDesc::TypeVector)
|
||||
if (typespec().simpletype() == TypeVector)
|
||||
m_name = ustring("transformv");
|
||||
else if (typespec().simpletype() == TypeDesc::TypeNormal)
|
||||
else if (typespec().simpletype() == TypeNormal)
|
||||
m_name = ustring("transformn");
|
||||
}
|
||||
|
||||
@@ -1760,21 +1760,21 @@ public:
|
||||
OSL_DASSERT(!s.is_closure() || s.is_color_closure());
|
||||
|
||||
const TypeDesc& td = s.simpletype();
|
||||
if (td == TypeDesc::TypeFloat)
|
||||
if (td == TypeFloat)
|
||||
return 0;
|
||||
if (td == TypeDesc::TypeInt)
|
||||
if (td == TypeInt)
|
||||
return 1;
|
||||
if (td == TypeDesc::TypeColor)
|
||||
if (td == TypeColor)
|
||||
return 2;
|
||||
if (td == TypeDesc::TypeVector)
|
||||
if (td == TypeVector)
|
||||
return 3;
|
||||
if (td == TypeDesc::TypePoint)
|
||||
if (td == TypePoint)
|
||||
return 4;
|
||||
if (td == TypeDesc::TypeNormal)
|
||||
if (td == TypeNormal)
|
||||
return 5;
|
||||
if (td == TypeDesc::TypeMatrix)
|
||||
if (td == TypeMatrix)
|
||||
return 6;
|
||||
if (td == TypeDesc::TypeString)
|
||||
if (td == TypeString)
|
||||
return 7;
|
||||
|
||||
if (s.is_color_closure())
|
||||
@@ -2238,20 +2238,20 @@ OSLCompilerImpl::type_from_code(const char* code, int* advance)
|
||||
TypeSpec t;
|
||||
int i = 0;
|
||||
switch (code[i]) {
|
||||
case 'i': t = TypeDesc::TypeInt; break;
|
||||
case 'f': t = TypeDesc::TypeFloat; break;
|
||||
case 'c': t = TypeDesc::TypeColor; break;
|
||||
case 'p': t = TypeDesc::TypePoint; break;
|
||||
case 'v': t = TypeDesc::TypeVector; break;
|
||||
case 'n': t = TypeDesc::TypeNormal; break;
|
||||
case 'm': t = TypeDesc::TypeMatrix; break;
|
||||
case 's': t = TypeDesc::TypeString; break;
|
||||
case 'i': t = TypeInt; break;
|
||||
case 'f': t = TypeFloat; break;
|
||||
case 'c': t = TypeColor; break;
|
||||
case 'p': t = TypePoint; break;
|
||||
case 'v': t = TypeVector; break;
|
||||
case 'n': t = TypeNormal; break;
|
||||
case 'm': t = TypeMatrix; break;
|
||||
case 's': t = TypeString; break;
|
||||
case 'h': t = OSL::TypeUInt64; break; // ustringhash_pod
|
||||
case 'x': t = TypeDesc(TypeDesc::NONE); break;
|
||||
case 'X': t = TypeDesc(TypeDesc::PTR); break;
|
||||
case 'L': t = TypeDesc(TypeDesc::LONGLONG); break;
|
||||
case 'C': // color closure
|
||||
t = TypeSpec(TypeDesc::TypeColor, true);
|
||||
t = TypeSpec(TypeColor, true);
|
||||
break;
|
||||
case 'S': // structure
|
||||
// Following the 'S' is the numeric structure ID
|
||||
@@ -2337,21 +2337,21 @@ OSLCompilerImpl::code_from_type(TypeSpec type) const
|
||||
} else if (type.is_closure() || type.is_closure_array()) {
|
||||
out = 'C';
|
||||
} else {
|
||||
if (elem == TypeDesc::TypeInt)
|
||||
if (elem == TypeInt)
|
||||
out = 'i';
|
||||
else if (elem == TypeDesc::TypeFloat)
|
||||
else if (elem == TypeFloat)
|
||||
out = 'f';
|
||||
else if (elem == TypeDesc::TypeColor)
|
||||
else if (elem == TypeColor)
|
||||
out = 'c';
|
||||
else if (elem == TypeDesc::TypePoint)
|
||||
else if (elem == TypePoint)
|
||||
out = 'p';
|
||||
else if (elem == TypeDesc::TypeVector)
|
||||
else if (elem == TypeVector)
|
||||
out = 'v';
|
||||
else if (elem == TypeDesc::TypeNormal)
|
||||
else if (elem == TypeNormal)
|
||||
out = 'n';
|
||||
else if (elem == TypeDesc::TypeMatrix)
|
||||
else if (elem == TypeMatrix)
|
||||
out = 'm';
|
||||
else if (elem == TypeDesc::TypeString)
|
||||
else if (elem == TypeString)
|
||||
out = 's';
|
||||
else if (elem == TypeDesc::NONE)
|
||||
out = 'x';
|
||||
|
||||
@@ -319,11 +319,11 @@ BackendLLVM::addCUDAGlobalVariable(const std::string& name, int size,
|
||||
|
||||
llvm::Constant* constant = nullptr;
|
||||
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
constant = ll.constant(*(const float*)init_data);
|
||||
} else if (type == TypeDesc::TypeInt) {
|
||||
} else if (type == TypeInt) {
|
||||
constant = ll.constant(*(const int*)init_data);
|
||||
} else if (type == TypeDesc::TypeString) {
|
||||
} else if (type == TypeString) {
|
||||
constant = ll.constant64(((const ustring*)init_data)->hash());
|
||||
// N.B. Since this is the OptiX side specifically, we will represent
|
||||
// strings as the ustringhash, so we know it as a constant.
|
||||
@@ -456,13 +456,13 @@ BackendLLVM::llvm_load_value(const Symbol& sym, int deriv,
|
||||
if (sym.is_constant() && !sym.typespec().is_array() && !arrayindex) {
|
||||
// Shortcut for simple constants
|
||||
if (sym.typespec().is_float()) {
|
||||
if (cast == TypeDesc::TypeInt)
|
||||
if (cast == TypeInt)
|
||||
return ll.constant((int)sym.get_float());
|
||||
else
|
||||
return ll.constant(sym.get_float());
|
||||
}
|
||||
if (sym.typespec().is_int()) {
|
||||
if (cast == TypeDesc::TypeFloat)
|
||||
if (cast == TypeFloat)
|
||||
return ll.constant((float)sym.get_int());
|
||||
else
|
||||
return ll.constant(sym.get_int());
|
||||
@@ -516,9 +516,9 @@ BackendLLVM::llvm_load_value(llvm::Value* ptr, const TypeSpec& type, int deriv,
|
||||
return result;
|
||||
|
||||
// Handle int<->float type casting
|
||||
if (type.is_float_based() && !type.is_array() && cast == TypeDesc::TypeInt)
|
||||
if (type.is_float_based() && !type.is_array() && cast == TypeInt)
|
||||
result = ll.op_float_to_int(result);
|
||||
else if (type.is_int() && cast == TypeDesc::TypeFloat)
|
||||
else if (type.is_int() && cast == TypeFloat)
|
||||
result = ll.op_int_to_float(result);
|
||||
else if (type.is_string() && cast == TypeDesc::LONGLONG) {
|
||||
result = ll.ptr_to_cast(result, ll.type_longlong());
|
||||
@@ -552,13 +552,13 @@ BackendLLVM::llvm_load_constant_value(const Symbol& sym, int arrayindex,
|
||||
&& "Called llvm_load_constant_value with negative array index");
|
||||
|
||||
if (sym.typespec().is_float()) {
|
||||
if (cast == TypeDesc::TypeInt)
|
||||
if (cast == TypeInt)
|
||||
return ll.constant((int)sym.get_float(arrayindex));
|
||||
else
|
||||
return ll.constant(sym.get_float(arrayindex));
|
||||
}
|
||||
if (sym.typespec().is_int()) {
|
||||
if (cast == TypeDesc::TypeFloat)
|
||||
if (cast == TypeFloat)
|
||||
return ll.constant((float)sym.get_int(arrayindex));
|
||||
else
|
||||
return ll.constant(sym.get_int(arrayindex));
|
||||
@@ -802,7 +802,7 @@ BackendLLVM::llvm_test_nonzero(Symbol& val, bool test_derivs)
|
||||
TypeDesc t = ts.simpletype();
|
||||
|
||||
// Handle int case -- guaranteed no derivs, no multi-component
|
||||
if (t == TypeDesc::TypeInt)
|
||||
if (t == TypeInt)
|
||||
return ll.op_ne(llvm_load_value(val), ll.constant(0));
|
||||
|
||||
// float-based
|
||||
|
||||
@@ -304,20 +304,14 @@ public:
|
||||
|
||||
/// Return the ShaderGlobals pointer.
|
||||
///
|
||||
llvm::Value* sg_ptr() const
|
||||
{
|
||||
return m_llvm_shaderglobals_ptr;
|
||||
}
|
||||
llvm::Value* sg_ptr() const { return m_llvm_shaderglobals_ptr; }
|
||||
|
||||
llvm::Type* llvm_type_closure_component();
|
||||
llvm::Type* llvm_type_closure_component_ptr();
|
||||
|
||||
/// Return the ShaderGlobals pointer cast as a void*.
|
||||
///
|
||||
llvm::Value* sg_void_ptr()
|
||||
{
|
||||
return ll.void_ptr(m_llvm_shaderglobals_ptr);
|
||||
}
|
||||
llvm::Value* sg_void_ptr() { return ll.void_ptr(m_llvm_shaderglobals_ptr); }
|
||||
|
||||
/// Cast the pointer variable specified by val to a pointer to the
|
||||
/// basic type comprising `type`.
|
||||
@@ -343,10 +337,7 @@ public:
|
||||
|
||||
/// Return the group data pointer.
|
||||
///
|
||||
llvm::Value* groupdata_ptr() const
|
||||
{
|
||||
return m_llvm_groupdata_ptr;
|
||||
}
|
||||
llvm::Value* groupdata_ptr() const { return m_llvm_groupdata_ptr; }
|
||||
|
||||
/// Return the group data pointer cast as a void*.
|
||||
///
|
||||
@@ -364,22 +355,13 @@ public:
|
||||
TypeDesc type = TypeDesc::UNKNOWN);
|
||||
|
||||
/// Return the userdata base pointer.
|
||||
llvm::Value* userdata_base_ptr() const
|
||||
{
|
||||
return m_llvm_userdata_base_ptr;
|
||||
}
|
||||
llvm::Value* userdata_base_ptr() const { return m_llvm_userdata_base_ptr; }
|
||||
|
||||
/// Return the output base pointer.
|
||||
llvm::Value* output_base_ptr() const
|
||||
{
|
||||
return m_llvm_output_base_ptr;
|
||||
}
|
||||
llvm::Value* output_base_ptr() const { return m_llvm_output_base_ptr; }
|
||||
|
||||
/// Return the shade index
|
||||
llvm::Value* shadeindex() const
|
||||
{
|
||||
return m_llvm_shadeindex;
|
||||
}
|
||||
llvm::Value* shadeindex() const { return m_llvm_shadeindex; }
|
||||
|
||||
// For a symloc, compute the llvm::Value of the pointer to its true,
|
||||
// offset location from the base pointer for shade index `sindex`
|
||||
@@ -507,10 +489,7 @@ public:
|
||||
|
||||
/// Return the basic block of the exit for the whole instance.
|
||||
///
|
||||
bool llvm_has_exit_instance_block() const
|
||||
{
|
||||
return m_exit_instance_block;
|
||||
}
|
||||
bool llvm_has_exit_instance_block() const { return m_exit_instance_block; }
|
||||
|
||||
/// Return the basic block of the exit for the whole instance.
|
||||
///
|
||||
@@ -531,10 +510,7 @@ public:
|
||||
/// Print debugging line for the op
|
||||
void llvm_generate_debug_op_printf(const Opcode& op);
|
||||
|
||||
llvm::Function* layer_func() const
|
||||
{
|
||||
return ll.current_function();
|
||||
}
|
||||
llvm::Function* layer_func() const { return ll.current_function(); }
|
||||
|
||||
/// Call this when JITing a texture-like call, to track how many.
|
||||
void generated_texture_call(bool handle)
|
||||
@@ -544,10 +520,7 @@ public:
|
||||
shadingsys().m_stat_tex_calls_as_handles += 1;
|
||||
}
|
||||
|
||||
void increment_useparam_ops()
|
||||
{
|
||||
shadingsys().m_stat_useparam_ops++;
|
||||
}
|
||||
void increment_useparam_ops() { shadingsys().m_stat_useparam_ops++; }
|
||||
|
||||
/// Return the mapping from symbol names to GlobalVariables.
|
||||
std::map<std::string, llvm::GlobalVariable*>& get_const_map()
|
||||
@@ -556,16 +529,10 @@ public:
|
||||
}
|
||||
|
||||
/// Return whether or not we are compiling for an OptiX-based renderer.
|
||||
bool use_optix()
|
||||
{
|
||||
return m_use_optix;
|
||||
}
|
||||
bool use_optix() { return m_use_optix; }
|
||||
|
||||
/// Return if we should compile against free function versions of Renderer Service.
|
||||
bool use_rs_bitcode()
|
||||
{
|
||||
return m_use_rs_bitcode;
|
||||
}
|
||||
bool use_rs_bitcode() { return m_use_rs_bitcode; }
|
||||
|
||||
/// Return the userdata index for the given Symbol. Return -1 if the Symbol
|
||||
/// is not an input parameter or is constant and therefore doesn't have an
|
||||
|
||||
@@ -838,11 +838,12 @@ private:
|
||||
std::vector<Position> m_function_stack;
|
||||
std::vector<Position> m_before_if_block_stack;
|
||||
std::vector<Position> m_after_if_block_stack;
|
||||
std::vector<int> m_loop_depth_stack;
|
||||
|
||||
public:
|
||||
OSL_FORCEINLINE FunctionTreeTracker() : m_top_of_stack(end_pos())
|
||||
{
|
||||
push_function_call();
|
||||
push_function_call(0);
|
||||
}
|
||||
|
||||
FunctionTreeTracker(const FunctionTreeTracker&) = delete;
|
||||
@@ -977,11 +978,12 @@ public:
|
||||
|
||||
OSL_FORCEINLINE Iterator end() const { return Iterator(*this, end_pos()); }
|
||||
|
||||
OSL_FORCEINLINE void push_function_call()
|
||||
OSL_FORCEINLINE void push_function_call(int loop_depth_at_function)
|
||||
{
|
||||
OSL_DEV_ONLY(std::cout << "DependencyTreeTracker push_function_call"
|
||||
<< std::endl);
|
||||
m_function_stack.push_back(m_top_of_stack);
|
||||
m_loop_depth_stack.push_back(loop_depth_at_function);
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE void push_if_block()
|
||||
@@ -1062,7 +1064,16 @@ public:
|
||||
|
||||
OSL_FORCEINLINE Position top_pos() const { return m_top_of_stack; }
|
||||
|
||||
OSL_FORCEINLINE void pop_function_call()
|
||||
OSL_FORCEINLINE int loop_depth_at_start_of_call()
|
||||
{
|
||||
if (m_loop_depth_stack.empty()) {
|
||||
return 0;
|
||||
} else {
|
||||
return m_loop_depth_stack.back();
|
||||
}
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE void pop_function_call(int loop_depth_at_function)
|
||||
{
|
||||
OSL_DEV_ONLY(std::cout << "DependencyTreeTracker pop_function_call"
|
||||
<< std::endl);
|
||||
@@ -1090,6 +1101,9 @@ public:
|
||||
process_exit(early_out.dtt_pos);
|
||||
}
|
||||
}
|
||||
|
||||
OSL_ASSERT(m_loop_depth_stack.back() == loop_depth_at_function);
|
||||
m_loop_depth_stack.pop_back();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1182,15 +1196,9 @@ public:
|
||||
}
|
||||
|
||||
#ifdef OSL_DEV
|
||||
OSL_FORCEINLINE int op_num() const
|
||||
{
|
||||
return m_op_num;
|
||||
}
|
||||
OSL_FORCEINLINE int op_num() const { return m_op_num; }
|
||||
|
||||
OSL_FORCEINLINE int loop_op_index() const
|
||||
{
|
||||
return m_loop_op_index;
|
||||
}
|
||||
OSL_FORCEINLINE int loop_op_index() const { return m_loop_op_index; }
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1220,8 +1228,11 @@ class LoopStack {
|
||||
|
||||
std::vector<LoopInfo> m_loop_info_by_depth;
|
||||
|
||||
bool is_inside_loop() const { return depth() != 0; }
|
||||
|
||||
public:
|
||||
bool is_inside_loop() const { return !m_loop_info_by_depth.empty(); }
|
||||
int depth() const { return m_loop_info_by_depth.size(); }
|
||||
|
||||
|
||||
int current_loop_op_index() const
|
||||
{
|
||||
@@ -1609,7 +1620,7 @@ struct Analyzer {
|
||||
|
||||
OSL_NOINLINE void make_loops_control_flow_depend_on_early_out_conditions()
|
||||
{
|
||||
// Need change the loop control flow which is dependent upon
|
||||
// Need to change the loop control flow which is dependent upon
|
||||
// a conditional. By making a circular dependency between the this
|
||||
// [return|exit|break|continue] operation and the conditionals value,
|
||||
// any varying values in the conditional controlling
|
||||
@@ -1992,9 +2003,11 @@ struct Analyzer {
|
||||
// as the current block, there was no conditionals involved
|
||||
OSL_DEV_ONLY(std::cout << " FUNCTION CALL BLOCK BEGIN"
|
||||
<< std::endl);
|
||||
m_execution_scope_stack.push_function_call();
|
||||
m_execution_scope_stack.push_function_call(
|
||||
m_loop_stack.depth());
|
||||
discover_symbols_between(op_index + 1, opcode.jump(0));
|
||||
m_execution_scope_stack.pop_function_call();
|
||||
m_execution_scope_stack.pop_function_call(
|
||||
m_loop_stack.depth());
|
||||
OSL_DEV_ONLY(std::cout << " FUNCTION CALL BLOCK END"
|
||||
<< std::endl);
|
||||
|
||||
@@ -2026,12 +2039,16 @@ struct Analyzer {
|
||||
m_execution_scope_stack.process_return(
|
||||
m_conditional_symbol_stack.top_pos());
|
||||
|
||||
// The return will need change the loop control flow which is dependent upon
|
||||
// IF AND ONLY IF, the current loop control exists inside
|
||||
// the current function, because the return should only early
|
||||
// out of those loops, not any higher in the call stack.
|
||||
// The return will need to change the loop control flow which is dependent upon
|
||||
// a conditional. By making a circular dependency between the return operation
|
||||
// and the conditionals value, any varying values in the conditional controlling
|
||||
// the return should flow back to the loop control variable, which might need to
|
||||
// be varying so allow lanes to terminate the loop independently
|
||||
if (m_loop_stack.is_inside_loop()) {
|
||||
if (m_loop_stack.depth()
|
||||
> m_execution_scope_stack.loop_depth_at_start_of_call()) {
|
||||
make_loops_control_flow_depend_on_early_out_conditions();
|
||||
}
|
||||
}
|
||||
@@ -2043,12 +2060,18 @@ struct Analyzer {
|
||||
m_execution_scope_stack.process_exit(
|
||||
m_conditional_symbol_stack.top_pos());
|
||||
|
||||
// The exit will need change the loop control flow which is dependent upon
|
||||
// IF AND ONLY IF, the current loop control exists inside
|
||||
// the current function, because the return should only early
|
||||
// out of those loops, not any higher in the call stack.
|
||||
// A different mechanism will look for early outs when
|
||||
// unwinding up the callstack.
|
||||
// The exit will need to change the loop control flow which is dependent upon
|
||||
// a conditional. By making a circular dependency between the exit operation
|
||||
// and the conditionals value, any varying values in the conditional controlling
|
||||
// the exit should flow back to the loop control variable, which might need to
|
||||
// be varying so allow lanes to terminate the loop independently
|
||||
if (m_loop_stack.is_inside_loop()) {
|
||||
if (m_loop_stack.depth()
|
||||
> m_execution_scope_stack.loop_depth_at_start_of_call()) {
|
||||
make_loops_control_flow_depend_on_early_out_conditions();
|
||||
}
|
||||
}
|
||||
@@ -2101,6 +2124,10 @@ struct Analyzer {
|
||||
|| symbol_to_be_varying->typespec().is_closure()
|
||||
|| symbol_to_be_varying->connected()
|
||||
|| symbol_to_be_varying->connected_down());
|
||||
OSL_DEV_ONLY(std::cout << "<<<< make_varying symbol: "
|
||||
<< symbol_to_be_varying->unmangled().c_str()
|
||||
<< " force=" << force << std::endl);
|
||||
|
||||
symbol_to_be_varying->make_varying();
|
||||
auto range = m_symbols_dependent_upon.equal_range(
|
||||
symbol_to_be_varying);
|
||||
@@ -2113,6 +2140,9 @@ struct Analyzer {
|
||||
recursively_mark_varying(dependent_symbol);
|
||||
}
|
||||
};
|
||||
OSL_DEV_ONLY(std::cout << ">>>> end make_varying symbol: "
|
||||
<< symbol_to_be_varying->unmangled().c_str()
|
||||
<< std::endl);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2599,7 +2629,7 @@ struct Analyzer {
|
||||
#endif
|
||||
const auto& early_out = *earlyOutIter;
|
||||
auto begin_dep_iter = m_conditional_symbol_stack.begin_at(
|
||||
early_out.dtt_pos);
|
||||
early_out.dtt_pos);
|
||||
auto end_dep_iter = m_conditional_symbol_stack.end();
|
||||
|
||||
const Opcode& opcode = m_opcodes[op_index];
|
||||
@@ -2645,6 +2675,8 @@ struct Analyzer {
|
||||
|
||||
OSL_NOINLINE void push_varying_of_shader_globals()
|
||||
{
|
||||
OSL_DEV_ONLY(std::cout << "push_varying_of_shader_globals begin"
|
||||
<< std::endl);
|
||||
for (auto&& s : inst()->symbols()) {
|
||||
if (s.symtype() == SymTypeGlobal) {
|
||||
// TODO: now that symbol has is_uniform()
|
||||
@@ -2665,10 +2697,14 @@ struct Analyzer {
|
||||
// so force their dependents to get marked
|
||||
recursively_mark_varying(sym_ptr, true /*force*/);
|
||||
}
|
||||
OSL_DEV_ONLY(std::cout << "push_varying_of_shader_globals end"
|
||||
<< std::endl);
|
||||
}
|
||||
|
||||
OSL_NOINLINE void make_renderer_outputs_varying()
|
||||
{
|
||||
OSL_DEV_ONLY(std::cout << "make_renderer_outputs_varying begin"
|
||||
<< std::endl);
|
||||
// Mark all output parameters as varying to catch
|
||||
// output parameters written to by uniform variables,
|
||||
// as nothing would have made them varying, however as
|
||||
@@ -2685,10 +2721,14 @@ struct Analyzer {
|
||||
}
|
||||
}
|
||||
}
|
||||
OSL_DEV_ONLY(std::cout << "make_renderer_outputs_varying end"
|
||||
<< std::endl);
|
||||
}
|
||||
|
||||
OSL_NOINLINE void make_interpolated_parameters_varying()
|
||||
{
|
||||
OSL_DEV_ONLY(std::cout << "make_interpolated_parameters_varying begin"
|
||||
<< std::endl);
|
||||
// Mark all interpolated parameters as varying,
|
||||
// As we expect interpolated data, get_userdata will
|
||||
// only provide varying values, so we must mark
|
||||
@@ -2700,10 +2740,13 @@ struct Analyzer {
|
||||
recursively_mark_varying(&s);
|
||||
}
|
||||
}
|
||||
OSL_DEV_ONLY(std::cout << "make_interpolated_parameters_varying end"
|
||||
<< std::endl);
|
||||
}
|
||||
|
||||
OSL_NOINLINE void make_closures_varying()
|
||||
{
|
||||
OSL_DEV_ONLY(std::cout << "make_closures_varying begin" << std::endl);
|
||||
// We assume that closures are always stored as varying pointers
|
||||
FOREACH_SYM(Symbol & s, inst())
|
||||
{
|
||||
@@ -2713,6 +2756,7 @@ struct Analyzer {
|
||||
recursively_mark_varying(&s);
|
||||
}
|
||||
}
|
||||
OSL_DEV_ONLY(std::cout << "make_closures_varying end" << std::endl);
|
||||
}
|
||||
|
||||
OSL_NOINLINE void push_varying_of_upstream_connections()
|
||||
|
||||
@@ -381,7 +381,7 @@ BatchedBackendLLVM::llvm_zero_derivs(const Symbol& sym, llvm::Value* count)
|
||||
llvm::Value* post_condition_mask = ll.op_and(condition_mask,
|
||||
pre_condition_mask);
|
||||
llvm::Value* cond_val = ll.test_if_mask_is_non_zero(
|
||||
post_condition_mask);
|
||||
post_condition_mask);
|
||||
|
||||
// Jump to either LoopBody or AfterLoop
|
||||
ll.op_branch(cond_val, body_block, after_block);
|
||||
@@ -702,7 +702,7 @@ BatchedBackendLLVM::llvm_widen_value_into_temp(const Symbol& sym, int deriv)
|
||||
auto disable_masked_stores = ll.create_masking_scope(false);
|
||||
for (int c = 0; c < t.aggregate(); ++c) {
|
||||
// NOTE: we use the passed deriv to load, but store to value (deriv==0)
|
||||
llvm::Value* v = llvm_load_value(sym, deriv, c, TypeDesc::UNKNOWN,
|
||||
llvm::Value* v = llvm_load_value(sym, deriv, c, TypeUnknown,
|
||||
/*is_uniform*/ false);
|
||||
llvm_store_value(v, widePtr, t, 0, NULL, c, /*is_uniform*/ false);
|
||||
}
|
||||
@@ -739,7 +739,7 @@ BatchedBackendLLVM::llvm_load_value(const Symbol& sym, int deriv,
|
||||
// Shortcut for simple constants
|
||||
if (sym.typespec().is_float()) {
|
||||
float float_val = sym.get_float();
|
||||
if (cast == TypeDesc::TypeInt) {
|
||||
if (cast == TypeInt) {
|
||||
int int_val = static_cast<int>(float_val);
|
||||
if (op_is_uniform) {
|
||||
return ll.constant(int_val);
|
||||
@@ -754,7 +754,7 @@ BatchedBackendLLVM::llvm_load_value(const Symbol& sym, int deriv,
|
||||
}
|
||||
if (sym.typespec().is_int()) {
|
||||
int int_val = sym.get_int();
|
||||
if (cast == TypeDesc::TypeFloat) {
|
||||
if (cast == TypeFloat) {
|
||||
float float_val = static_cast<float>(int_val);
|
||||
if (op_is_uniform) {
|
||||
return ll.constant(float_val);
|
||||
@@ -806,9 +806,9 @@ BatchedBackendLLVM::llvm_load_mask(const Symbol& cond)
|
||||
llvm::Value* llvm_mask = nullptr;
|
||||
llvm::Value* llvm_mask_or_wide_int
|
||||
= llvm_load_value(cond, /*deriv*/ 0, /*component*/ 0,
|
||||
/*cast*/ TypeDesc::UNKNOWN, /*op_is_uniform*/ false);
|
||||
/*cast*/ TypeUnknown, /*op_is_uniform*/ false);
|
||||
if (cond.forced_llvm_bool()) {
|
||||
// The llvm_load_value + TypeDesc::UNKNOWN will check and convert to llvm mask already
|
||||
// The llvm_load_value + TypeUnknown will check and convert to llvm mask already
|
||||
llvm_mask = llvm_mask_or_wide_int;
|
||||
} else {
|
||||
OSL_ASSERT(ll.llvm_typeof(llvm_mask_or_wide_int) == ll.type_wide_int());
|
||||
@@ -890,19 +890,19 @@ BatchedBackendLLVM::llvm_load_value(llvm::Value* src_ptr, const TypeSpec& type,
|
||||
result = ll.native_to_llvm_mask(result);
|
||||
}
|
||||
|
||||
if (cast != TypeDesc::UNKNOWN) {
|
||||
if (cast == TypeDesc::TypeInt) {
|
||||
if (cast != TypeUnknown) {
|
||||
if (cast == TypeInt) {
|
||||
result = ll.op_bool_to_int(result);
|
||||
} else if (cast == TypeDesc::TypeFloat) {
|
||||
} else if (cast == TypeFloat) {
|
||||
result = ll.op_bool_to_float(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle int<->float type casting
|
||||
if (type.is_float_based() && cast == TypeDesc::TypeInt)
|
||||
if (type.is_float_based() && cast == TypeInt)
|
||||
result = ll.op_float_to_int(result);
|
||||
else if (type.is_int() && cast == TypeDesc::TypeFloat)
|
||||
else if (type.is_int() && cast == TypeFloat)
|
||||
result = ll.op_int_to_float(result);
|
||||
else if (type.is_string() && cast == TypeDesc::LONGLONG)
|
||||
result = ll.ptr_to_cast(result, ll.type_longlong());
|
||||
@@ -911,12 +911,11 @@ BatchedBackendLLVM::llvm_load_value(llvm::Value* src_ptr, const TypeSpec& type,
|
||||
// TODO: remove this assert once we have confirmed correct handling off all the
|
||||
// different data types. Using OSL_ASSERT as a checklist to verify what we have
|
||||
// handled so far during development
|
||||
OSL_ASSERT(
|
||||
cast == TypeDesc::UNKNOWN || cast == TypeDesc::TypeColor
|
||||
|| cast == TypeDesc::TypeVector || cast == TypeDesc::TypePoint
|
||||
|| cast == TypeDesc::TypeNormal || cast == TypeDesc::TypeFloat
|
||||
|| cast == TypeDesc::TypeInt || cast == TypeDesc::TypeString
|
||||
|| cast == TypeDesc::TypeMatrix || cast == TypeDesc::LONGLONG);
|
||||
OSL_ASSERT(cast == TypeUnknown || cast == TypeColor
|
||||
|| cast == TypeVector || cast == TypePoint
|
||||
|| cast == TypeNormal || cast == TypeFloat
|
||||
|| cast == TypeInt || cast == TypeString
|
||||
|| cast == TypeMatrix || cast == TypeDesc::LONGLONG);
|
||||
|
||||
if ((ll.llvm_typeof(result) == ll.type_bool())
|
||||
|| (ll.llvm_typeof(result) == ll.type_float())
|
||||
@@ -991,9 +990,9 @@ BatchedBackendLLVM::llvm_load_value(llvm::Value* src_ptr, const TypeSpec& type,
|
||||
OSL_ASSERT(ll.llvm_typeof(result) != ll.type_wide_bool());
|
||||
|
||||
// Handle int<->float type casting
|
||||
if (type.is_float_based() && cast == TypeDesc::TypeInt)
|
||||
if (type.is_float_based() && cast == TypeInt)
|
||||
result = ll.op_float_to_int(result);
|
||||
else if (type.is_int() && cast == TypeDesc::TypeFloat)
|
||||
else if (type.is_int() && cast == TypeFloat)
|
||||
result = ll.op_int_to_float(result);
|
||||
else if (type.is_string() && cast == TypeDesc::LONGLONG)
|
||||
result = ll.ptr_to_cast(result, ll.type_longlong());
|
||||
@@ -1027,7 +1026,7 @@ BatchedBackendLLVM::llvm_load_constant_value(const Symbol& sym, int arrayindex,
|
||||
|
||||
if (elementType.is_float()) {
|
||||
float float_elem = sym.get_float(arrayindex);
|
||||
if (cast == TypeDesc::TypeInt) {
|
||||
if (cast == TypeInt) {
|
||||
int int_elem = static_cast<int>(float_elem);
|
||||
if (op_is_uniform) {
|
||||
return ll.constant(int_elem);
|
||||
@@ -1042,7 +1041,7 @@ BatchedBackendLLVM::llvm_load_constant_value(const Symbol& sym, int arrayindex,
|
||||
}
|
||||
if (elementType.is_int()) {
|
||||
int int_elem = sym.get_int(arrayindex);
|
||||
if (cast == TypeDesc::TypeFloat) {
|
||||
if (cast == TypeFloat) {
|
||||
float float_elem = static_cast<float>(int_elem);
|
||||
if (op_is_uniform) {
|
||||
return ll.constant(float_elem);
|
||||
@@ -1164,14 +1163,14 @@ BatchedBackendLLVM::llvm_load_arg(const Symbol& sym, bool derivs,
|
||||
// get passed as a pointer instead of by value
|
||||
// So let this case fall through
|
||||
if (op_is_uniform) {
|
||||
return llvm_load_value(sym, 0, 0, TypeDesc::UNKNOWN, op_is_uniform);
|
||||
return llvm_load_value(sym, 0, 0, TypeUnknown, op_is_uniform);
|
||||
} else if (sym.symtype() == SymTypeConst) {
|
||||
// As the case to deliver a pointer to a symbol data
|
||||
// doesn't provide an opportunity to promote a uniform constant
|
||||
// to a wide value that the non-uniform function is expecting
|
||||
// we will handle it here.
|
||||
llvm::Value* wide_constant_value
|
||||
= llvm_load_constant_value(sym, 0, 0, TypeDesc::UNKNOWN,
|
||||
= llvm_load_constant_value(sym, 0, 0, TypeUnknown,
|
||||
op_is_uniform);
|
||||
|
||||
// Have to have a place on the stack for the pointer to the wide constant to point to
|
||||
@@ -1208,7 +1207,7 @@ BatchedBackendLLVM::llvm_load_arg(const Symbol& sym, bool derivs,
|
||||
for (int c = 0; c < t.aggregate(); ++c) {
|
||||
// Will automatically widen value if needed
|
||||
llvm::Value* v = llvm_load_value(sym, d, arrayIndex, c,
|
||||
TypeDesc::UNKNOWN,
|
||||
TypeUnknown,
|
||||
op_is_uniform);
|
||||
llvm_store_value(v, tmpptr, t, d, arrayIndex, c,
|
||||
op_is_uniform);
|
||||
@@ -1460,10 +1459,11 @@ BatchedBackendLLVM::llvm_broadcast_uniform_value_from_mem(
|
||||
// Load the uniform component from the temporary
|
||||
// base passing false for op_is_uniform, the llvm_load_value will
|
||||
// automatically broadcast the uniform value to a vector type
|
||||
llvm::Value* wide_component_value = llvm_load_value(
|
||||
pointerTotempUniform, dest_type, derivIndex,
|
||||
llvm_array_index, componentIndex, true /*src_is_uniform*/,
|
||||
TypeDesc::UNKNOWN, false /*op_is_uniform*/);
|
||||
llvm::Value* wide_component_value
|
||||
= llvm_load_value(pointerTotempUniform, dest_type,
|
||||
derivIndex, llvm_array_index,
|
||||
componentIndex, true /*src_is_uniform*/,
|
||||
TypeUnknown, false /*op_is_uniform*/);
|
||||
bool success = llvm_store_value(wide_component_value,
|
||||
Destination, derivIndex,
|
||||
llvm_array_index,
|
||||
@@ -1556,7 +1556,7 @@ BatchedBackendLLVM::groupdata_field_ptr(int fieldnum, TypeDesc type,
|
||||
bool is_uniform, bool forceBool)
|
||||
{
|
||||
llvm::Value* result = ll.void_ptr(groupdata_field_ref(fieldnum));
|
||||
if (type != TypeDesc::UNKNOWN) {
|
||||
if (type != TypeUnknown) {
|
||||
if (is_uniform) {
|
||||
result = ll.ptr_to_cast(result, forceBool ? ll.type_bool()
|
||||
: llvm_type(type));
|
||||
@@ -1713,9 +1713,10 @@ BatchedBackendLLVM::llvm_call_function(const FuncSpec& name,
|
||||
int numDeriv = s.has_derivs() ? 3 : 1;
|
||||
for (int d = 0; d < numDeriv; ++d) {
|
||||
for (int c = 0; c < t.simpletype().aggregate; ++c) {
|
||||
llvm::Value* wide_value = llvm_load_value(
|
||||
s, /*deriv=*/d, /*component*/ c,
|
||||
TypeDesc::UNKNOWN, function_is_uniform);
|
||||
llvm::Value* wide_value
|
||||
= llvm_load_value(s, /*deriv=*/d,
|
||||
/*component*/ c, TypeUnknown,
|
||||
function_is_uniform);
|
||||
// Store our wide pointer on the stack
|
||||
llvm_store_value(wide_value, tmpptr, t, d, NULL, c,
|
||||
/*dst_is_uniform*/ false);
|
||||
@@ -1748,7 +1749,7 @@ BatchedBackendLLVM::llvm_call_function(const FuncSpec& name,
|
||||
auto disable_masked_stores = ll.create_masking_scope(false);
|
||||
for (int a = 0; a < t.simpletype().aggregate; ++a) {
|
||||
llvm::Value* wide_constant_value
|
||||
= llvm_load_constant_value(s, 0, a, TypeDesc::UNKNOWN,
|
||||
= llvm_load_constant_value(s, 0, a, TypeUnknown,
|
||||
function_is_uniform);
|
||||
// Store our wide pointer on the stack
|
||||
llvm_store_value(wide_constant_value, tmpptr, t, 0, NULL, a,
|
||||
@@ -1765,8 +1766,7 @@ BatchedBackendLLVM::llvm_call_function(const FuncSpec& name,
|
||||
OSL_DEV_ONLY(std::cout << "....pushing " << s.name().c_str()
|
||||
<< " as value" << std::endl);
|
||||
valargs[i] = llvm_load_value(s, /*deriv*/ 0, /*component*/ 0,
|
||||
TypeDesc::UNKNOWN,
|
||||
function_is_uniform);
|
||||
TypeUnknown, function_is_uniform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1852,7 +1852,7 @@ BatchedBackendLLVM::llvm_test_nonzero(const Symbol& val, bool test_derivs)
|
||||
TypeDesc t = ts.simpletype();
|
||||
|
||||
// Handle int case -- guaranteed no derivs, no multi-component
|
||||
if (t == TypeDesc::TypeInt) {
|
||||
if (t == TypeInt) {
|
||||
// Because we allow temporaries and local results of comparison operations
|
||||
// to use the native bool type of i1, we will need to build an matching constant 0
|
||||
// for comparisons.
|
||||
@@ -1911,8 +1911,7 @@ BatchedBackendLLVM::llvm_assign_impl(const Symbol& Result, const Symbol& Src,
|
||||
if (Result.typespec().is_closure() || Src.typespec().is_closure()) {
|
||||
if (Src.typespec().is_closure()) {
|
||||
llvm::Value* srcval = llvm_load_value(Src, 0, arrind, 0,
|
||||
TypeDesc::UNKNOWN,
|
||||
op_is_uniform);
|
||||
TypeUnknown, op_is_uniform);
|
||||
llvm_store_value(srcval, Result, 0, arrind, 0);
|
||||
} else {
|
||||
llvm::Value* null_value = ll.constant_ptr(NULL, ll.type_void_ptr());
|
||||
@@ -2030,8 +2029,7 @@ BatchedBackendLLVM::llvm_assign_impl(const Symbol& Result, const Symbol& Src,
|
||||
// src and result both have derivs -- copy them
|
||||
// allow a uniform Src to store to a varying Result,
|
||||
val = llvm_load_value(Src, d, arrind, i,
|
||||
TypeDesc::UNKNOWN,
|
||||
op_is_uniform);
|
||||
TypeUnknown, op_is_uniform);
|
||||
}
|
||||
llvm_store_value(val, Result, d, arrind, i);
|
||||
}
|
||||
@@ -2041,7 +2039,7 @@ BatchedBackendLLVM::llvm_assign_impl(const Symbol& Result, const Symbol& Src,
|
||||
// src and result both have derivs -- copy them
|
||||
// allow a uniform Src to store to a varying Result,
|
||||
val = llvm_load_value(Src, d, arrind, srccomp,
|
||||
TypeDesc::UNKNOWN, op_is_uniform);
|
||||
TypeUnknown, op_is_uniform);
|
||||
}
|
||||
|
||||
if (dstcomp == -1) {
|
||||
@@ -2085,13 +2083,13 @@ BatchedBackendLLVM::append_arg_to(llvm::raw_svector_ostream& OS,
|
||||
|
||||
const TypeDesc& td = arg.type();
|
||||
const char* name = nullptr;
|
||||
if (td == TypeDesc::TypeInt)
|
||||
if (td == TypeInt)
|
||||
name = "i";
|
||||
else if (td == TypeDesc::TypeMatrix)
|
||||
else if (td == TypeMatrix)
|
||||
name = "m";
|
||||
else if (td == TypeDesc::TypeString)
|
||||
else if (td == TypeString)
|
||||
name = "s";
|
||||
else if (td == TypeDesc::TypeFloat)
|
||||
else if (td == TypeFloat)
|
||||
name = arg.has_derivs() ? "df" : "f";
|
||||
else if (td.aggregate == 3 && td.basetype == TypeDesc::FLOAT
|
||||
&& td.arraylen == 0)
|
||||
|
||||
@@ -597,7 +597,7 @@ LLVMGEN(llvm_gen_aref)
|
||||
bool index_is_uniform = Index.is_uniform();
|
||||
|
||||
// Get array index we're interested in
|
||||
llvm::Value* index = rop.loadLLVMValue(Index, 0, 0, TypeDesc::TypeInt,
|
||||
llvm::Value* index = rop.loadLLVMValue(Index, 0, 0, TypeInt,
|
||||
index_is_uniform);
|
||||
if (!index)
|
||||
return false;
|
||||
@@ -680,7 +680,7 @@ LLVMGEN(llvm_gen_aassign)
|
||||
OSL_ASSERT(index_is_uniform || !resultIsUniform);
|
||||
|
||||
// Get array index we're interested in
|
||||
llvm::Value* index = rop.loadLLVMValue(Index, 0, 0, TypeDesc::TypeInt,
|
||||
llvm::Value* index = rop.loadLLVMValue(Index, 0, 0, TypeInt,
|
||||
index_is_uniform);
|
||||
|
||||
if (!index)
|
||||
@@ -1006,11 +1006,9 @@ LLVMGEN(llvm_gen_andor)
|
||||
bool result_is_uniform = result.is_uniform();
|
||||
|
||||
|
||||
llvm::Value* i1_res = NULL;
|
||||
llvm::Value* a_val = rop.llvm_load_value(a, 0, 0, TypeDesc::TypeInt,
|
||||
op_is_uniform);
|
||||
llvm::Value* b_val = rop.llvm_load_value(b, 0, 0, TypeDesc::TypeInt,
|
||||
op_is_uniform);
|
||||
llvm::Value* i1_res = NULL;
|
||||
llvm::Value* a_val = rop.llvm_load_value(a, 0, 0, TypeInt, op_is_uniform);
|
||||
llvm::Value* b_val = rop.llvm_load_value(b, 0, 0, TypeInt, op_is_uniform);
|
||||
llvm::Value* zero_set = op_is_uniform ? rop.ll.constant(0)
|
||||
: rop.ll.wide_constant(0);
|
||||
|
||||
@@ -2104,7 +2102,7 @@ LLVMGEN(llvm_gen_bitwise_binary_op)
|
||||
bool op_is_uniform = A.is_uniform() && B.is_uniform();
|
||||
bool result_is_uniform = Result.is_uniform();
|
||||
|
||||
TypeDesc type = TypeDesc::TypeInt;
|
||||
TypeDesc type = TypeInt;
|
||||
bool is_logical_op = op.opname() == op_bitand || op.opname() == op_bitor
|
||||
|| op.opname() == op_xor;
|
||||
if (is_logical_op) {
|
||||
@@ -2287,7 +2285,8 @@ LLVMGEN(llvm_gen_compref)
|
||||
|
||||
bool op_is_uniform = Result.is_uniform();
|
||||
|
||||
llvm::Value* c = rop.llvm_load_value(Index);
|
||||
llvm::Value* c = rop.llvm_load_value(Index, /*deriv=*/0, /*component=*/0,
|
||||
TypeDesc::UNKNOWN, Index.is_uniform());
|
||||
|
||||
if (Index.is_uniform()) {
|
||||
if (rop.inst()->master()->range_checking()) {
|
||||
@@ -2425,8 +2424,7 @@ LLVMGEN(llvm_gen_compassign)
|
||||
}
|
||||
|
||||
for (int d = 0; d < 3; ++d) { // deriv
|
||||
llvm::Value* val = rop.llvm_load_value(Val, d, 0,
|
||||
TypeDesc::TypeFloat,
|
||||
llvm::Value* val = rop.llvm_load_value(Val, d, 0, TypeFloat,
|
||||
op_is_uniform);
|
||||
if (Index.is_constant()) {
|
||||
int i = Index.get_int();
|
||||
@@ -2485,8 +2483,7 @@ LLVMGEN(llvm_gen_compassign)
|
||||
|
||||
for (int d = 0; d < 3; ++d) { // deriv
|
||||
|
||||
llvm::Value* val = rop.llvm_load_value(Val, d, 0,
|
||||
TypeDesc::TypeFloat,
|
||||
llvm::Value* val = rop.llvm_load_value(Val, d, 0, TypeFloat,
|
||||
op_is_uniform);
|
||||
|
||||
llvm::Value* valc0 = rop.llvm_load_value(Result, d, 0,
|
||||
@@ -2601,8 +2598,7 @@ LLVMGEN(llvm_gen_mxcompref)
|
||||
int r = Imath::clamp(Row.get_int(), 0, 3);
|
||||
int c = Imath::clamp(Col.get_int(), 0, 3);
|
||||
int comp = 4 * r + c;
|
||||
val = rop.llvm_load_value(M, 0, comp, TypeDesc::TypeFloat,
|
||||
op_is_uniform);
|
||||
val = rop.llvm_load_value(M, 0, comp, TypeFloat, op_is_uniform);
|
||||
} else {
|
||||
llvm::Value* comp = rop.ll.op_mul(row, components_are_uniform
|
||||
? rop.ll.constant(4)
|
||||
@@ -2700,8 +2696,7 @@ LLVMGEN(llvm_gen_mxcompassign)
|
||||
}
|
||||
}
|
||||
|
||||
llvm::Value* val = rop.llvm_load_value(Val, 0, 0, TypeDesc::TypeFloat,
|
||||
op_is_uniform);
|
||||
llvm::Value* val = rop.llvm_load_value(Val, 0, 0, TypeFloat, op_is_uniform);
|
||||
|
||||
if (Row.is_constant() && Col.is_constant()) {
|
||||
int r = Imath::clamp(Row.get_int(), 0, 3);
|
||||
@@ -2758,9 +2753,8 @@ LLVMGEN(llvm_gen_construct_color)
|
||||
for (int d = 0; d < dmax; ++d) { // loop over derivs
|
||||
for (int c = 0; c < 3; ++c) { // loop over components
|
||||
const Symbol& comp = *rop.opargsym(op, c + 1 + using_space);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0,
|
||||
TypeDesc::TypeFloat,
|
||||
result_is_uniform);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0, TypeFloat,
|
||||
result_is_uniform);
|
||||
rop.llvm_store_value(val, Result, d, NULL, c);
|
||||
}
|
||||
}
|
||||
@@ -2924,7 +2918,8 @@ LLVMGEN(llvm_gen_filterwidth)
|
||||
}
|
||||
|
||||
rop.ll.call_function(rop.build_name(func_spec),
|
||||
{ &args[0], argCount });
|
||||
{ &args[0],
|
||||
cspan<llvm::Value*>::size_type(argCount) });
|
||||
// Don't have 2nd order derivs
|
||||
rop.llvm_zero_derivs(Result);
|
||||
}
|
||||
@@ -3236,9 +3231,8 @@ LLVMGEN(llvm_gen_construct_triple)
|
||||
for (int d = 0; d < dmax; ++d) { // loop over derivs
|
||||
for (int c = 0; c < 3; ++c) { // loop over components
|
||||
const Symbol& comp = *rop.opargsym(op, c + 1 + using_space);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0,
|
||||
TypeDesc::TypeFloat,
|
||||
op_is_uniform);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0, TypeFloat,
|
||||
op_is_uniform);
|
||||
|
||||
if (op_is_uniform && !resultIsUniform) {
|
||||
rop.llvm_broadcast_uniform_value(val, Result, d, c);
|
||||
@@ -3250,9 +3244,8 @@ LLVMGEN(llvm_gen_construct_triple)
|
||||
|
||||
// Do the transformation in-place, if called for
|
||||
if (using_space) {
|
||||
ustring from, to; // N.B. initialize to empty strings
|
||||
if (Space.is_constant()) {
|
||||
from = Space.get_string();
|
||||
ustring from = Space.get_string();
|
||||
if (from == Strings::common
|
||||
|| from == rop.shadingsys().commonspace_synonym())
|
||||
return true; // no transformation necessary
|
||||
@@ -3302,9 +3295,9 @@ LLVMGEN(llvm_gen_construct_triple)
|
||||
|
||||
// Dynamically build function name
|
||||
FuncSpec func_spec("build_transform_matrix");
|
||||
func_spec.arg_varying(TypeDesc::TypeMatrix);
|
||||
func_spec.arg_varying(TypeMatrix);
|
||||
func_spec.arg(Space, false /*derivs*/, space_is_uniform);
|
||||
func_spec.arg_uniform(TypeDesc::TypeString);
|
||||
func_spec.arg_uniform(TypeString);
|
||||
func_spec.mask();
|
||||
|
||||
succeeded_as_int = rop.ll.call_function(rop.build_name(func_spec),
|
||||
@@ -3326,7 +3319,7 @@ LLVMGEN(llvm_gen_construct_triple)
|
||||
FuncSpec func_spec(transform_name);
|
||||
func_spec.arg(Result, Result.has_derivs(), resultIsUniform);
|
||||
func_spec.arg(Result, Result.has_derivs(), resultIsUniform);
|
||||
func_spec.arg_varying(TypeDesc::TypeMatrix44);
|
||||
func_spec.arg_varying(TypeMatrix);
|
||||
func_spec.mask();
|
||||
|
||||
rop.ll.call_function(rop.build_name(func_spec), args);
|
||||
@@ -3583,7 +3576,7 @@ LLVMGEN(llvm_gen_transform)
|
||||
rop.ll.mask_as_int(rop.ll.current_mask()) };
|
||||
|
||||
FuncSpec func_spec("build_transform_matrix");
|
||||
func_spec.arg_varying(TypeDesc::TypeMatrix44);
|
||||
func_spec.arg_varying(TypeMatrix);
|
||||
// Ignore derivatives if unneeded or unsupplied
|
||||
func_spec.arg(*From, from_is_uniform);
|
||||
func_spec.arg(*To, to_is_uniform);
|
||||
@@ -3613,7 +3606,7 @@ LLVMGEN(llvm_gen_transform)
|
||||
// The matrix is always varying if we looked it up,
|
||||
// if it was passed directly in "To", then we respect to's uniformity
|
||||
// otherwise it will be the varying result of the callback to the renderer
|
||||
func_spec.arg(TypeDesc::TypeMatrix44,
|
||||
func_spec.arg(TypeMatrix,
|
||||
To->typespec().is_matrix() ? to_is_uniform : false);
|
||||
func_spec.arg(*Result, has_derivs, result_is_uniform);
|
||||
|
||||
@@ -3638,7 +3631,7 @@ LLVMGEN(llvm_gen_transform)
|
||||
// The matrix is always varying if we looked it up,
|
||||
// if it was passed directly in "To", then we respect to's uniformity
|
||||
// otherwise it will be the varying result of the callback to the renderer
|
||||
func_spec.arg(TypeDesc::TypeMatrix44,
|
||||
func_spec.arg(TypeMatrix,
|
||||
To->typespec().is_matrix() ? to_is_uniform : false);
|
||||
func_spec.mask();
|
||||
|
||||
@@ -4271,7 +4264,7 @@ llvm_batched_texture_options(BatchedBackendLLVM& rop, int opnum,
|
||||
llvm::Value* wide_const_fone_value = rop.ll.wide_constant(1.0f);
|
||||
llvm::Value* const_zero_value = rop.ll.constant(0);
|
||||
llvm::Value* wrap_default_value = rop.ll.constant(
|
||||
static_cast<int>(Tex::Wrap::Default));
|
||||
static_cast<int>(Tex::Wrap::Default));
|
||||
|
||||
llvm::Value* sblur = wide_const_fzero_value;
|
||||
llvm::Value* tblur = wide_const_fzero_value;
|
||||
@@ -4290,7 +4283,7 @@ llvm_batched_texture_options(BatchedBackendLLVM& rop, int opnum,
|
||||
llvm::Value* twrap = wrap_default_value;
|
||||
llvm::Value* rwrap = wrap_default_value;
|
||||
llvm::Value* mipmode = rop.ll.constant(
|
||||
static_cast<int>(Tex::MipMode::Default));
|
||||
static_cast<int>(Tex::MipMode::Default));
|
||||
llvm::Value* interpmode = rop.ll.constant(
|
||||
static_cast<int>(Tex::InterpMode::SmartBicubic));
|
||||
llvm::Value* anisotropic = rop.ll.constant(32);
|
||||
@@ -4495,8 +4488,7 @@ llvm_batched_texture_options(BatchedBackendLLVM& rop, int opnum,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name == Strings::missingcolor
|
||||
&& equivalent(valtype, TypeDesc::TypeColor)) {
|
||||
if (name == Strings::missingcolor && equivalent(valtype, TypeColor)) {
|
||||
if (!missingcolor_buffer) {
|
||||
// If not already done, allocate enough storage for the
|
||||
// missingcolor value (4 floats), and call the special
|
||||
@@ -4825,8 +4817,7 @@ llvm_batched_texture_varying_options(BatchedBackendLLVM& rop, int opnum,
|
||||
PARAM_VARYING_STRING_CODE(interp, osl_texture_decode_interpmode,
|
||||
interpmode)
|
||||
|
||||
if (name == Strings::missingcolor
|
||||
&& equivalent(valtype, TypeDesc::TypeColor)) {
|
||||
if (name == Strings::missingcolor && equivalent(valtype, TypeColor)) {
|
||||
OSL_ASSERT(missingcolor_buffer != nullptr);
|
||||
|
||||
int num_components = valtype.aggregate;
|
||||
@@ -5826,7 +5817,7 @@ llvm_batched_noise_options(BatchedBackendLLVM& rop, int opnum,
|
||||
}
|
||||
rop.ll.call_function("osl_noiseparams_set_bandwidth", opt,
|
||||
rop.llvm_load_value(Val, 0, NULL, 0,
|
||||
TypeDesc::TypeFloat));
|
||||
TypeFloat));
|
||||
} else if (name == Strings::impulses
|
||||
&& (Val.typespec().is_float() || Val.typespec().is_int())) {
|
||||
if (!Val.is_uniform()) {
|
||||
@@ -5835,7 +5826,7 @@ llvm_batched_noise_options(BatchedBackendLLVM& rop, int opnum,
|
||||
}
|
||||
rop.ll.call_function("osl_noiseparams_set_impulses", opt,
|
||||
rop.llvm_load_value(Val, 0, NULL, 0,
|
||||
TypeDesc::TypeFloat));
|
||||
TypeFloat));
|
||||
} else {
|
||||
rop.shadingcontext()->errorfmt(
|
||||
"Unknown {} optional argument: \"{}\", <{}> ({}:{})",
|
||||
@@ -5915,7 +5906,7 @@ llvm_batched_noise_varying_options(BatchedBackendLLVM& rop, int opnum,
|
||||
llvm::Value* wide_bandwidth
|
||||
= rop.llvm_load_value(Val,
|
||||
/*deriv=*/0, /*component=*/0,
|
||||
/*cast=*/TypeDesc::TypeFloat,
|
||||
/*cast=*/TypeFloat,
|
||||
/*op_is_uniform=*/false);
|
||||
llvm::Value* scalar_bandwidth = rop.ll.op_extract(wide_bandwidth,
|
||||
leadLane);
|
||||
@@ -5930,7 +5921,7 @@ llvm_batched_noise_varying_options(BatchedBackendLLVM& rop, int opnum,
|
||||
llvm::Value* wide_impulses
|
||||
= rop.llvm_load_value(Val,
|
||||
/*deriv=*/0, /*component=*/0,
|
||||
/*cast=*/TypeDesc::TypeFloat,
|
||||
/*cast=*/TypeFloat,
|
||||
/*op_is_uniform=*/false);
|
||||
llvm::Value* scalar_impulses = rop.ll.op_extract(wide_impulses,
|
||||
leadLane);
|
||||
@@ -6758,13 +6749,18 @@ LLVMGEN(llvm_gen_getmessage)
|
||||
rop.ll.call_function(rop.build_name(FuncSpec("getmessage").mask()),
|
||||
args);
|
||||
} else {
|
||||
llvm::Value* nameVal = rop.llvm_load_value(Name);
|
||||
llvm::Value* nameVal
|
||||
= rop.llvm_load_value(Name, /*deriv=*/0, /*component=*/0,
|
||||
TypeDesc::UNKNOWN, nameVal_is_uniform);
|
||||
if (nameVal_is_uniform) {
|
||||
args[nameArgumentIndex] = nameVal;
|
||||
}
|
||||
|
||||
llvm::Value* sourceVal = has_source ? rop.llvm_load_value(Source)
|
||||
: rop.ll.constant(ustring());
|
||||
llvm::Value* sourceVal
|
||||
= has_source
|
||||
? rop.llvm_load_value(Source, /*deriv=*/0, /*component=*/0,
|
||||
TypeDesc::UNKNOWN, sourceVal_is_uniform)
|
||||
: rop.ll.constant(ustring());
|
||||
if (sourceVal_is_uniform) {
|
||||
args[sourceArgumentIndex] = sourceVal;
|
||||
}
|
||||
@@ -6928,7 +6924,9 @@ LLVMGEN(llvm_gen_calculatenormal)
|
||||
args[arg_count++] = rop.ll.mask_as_int(rop.ll.current_mask());
|
||||
func_spec.mask();
|
||||
}
|
||||
rop.ll.call_function(rop.build_name(func_spec), { &args[0], arg_count });
|
||||
rop.ll.call_function(rop.build_name(func_spec),
|
||||
{ &args[0],
|
||||
cspan<llvm::Value*>::size_type(arg_count) });
|
||||
|
||||
if (Result.has_derivs())
|
||||
rop.llvm_zero_derivs(Result);
|
||||
@@ -7002,6 +7000,16 @@ LLVMGEN(llvm_gen_spline)
|
||||
&& (!has_knot_count
|
||||
|| (has_knot_count && Knot_count.typespec().is_int())));
|
||||
|
||||
if (has_knot_count && !Knot_count.is_uniform()) {
|
||||
// TODO: varying knot count support could be added below as we already
|
||||
// have a loop to handle varying spline basis. Just need to add tests
|
||||
// to exercise and verify functions properly, until then...
|
||||
rop.shadingcontext()->errorfmt(
|
||||
"spline nknots parameter is varying, batched code gen requires a constant or uniform nknots, called from ({}:{})",
|
||||
op.sourcefile(), op.sourceline());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool op_is_uniform = Spline.is_uniform() && Value.is_uniform()
|
||||
&& Knots.is_uniform();
|
||||
|
||||
@@ -7052,7 +7060,8 @@ LLVMGEN(llvm_gen_spline)
|
||||
args.push_back(rop.llvm_void_ptr(Value)); // make things easy
|
||||
args.push_back(rop.llvm_void_ptr(Knots));
|
||||
if (has_knot_count)
|
||||
args.push_back(rop.llvm_load_value(Knot_count));
|
||||
args.push_back(rop.llvm_load_value(
|
||||
Knot_count)); // TODO: add support for varying Knot_count
|
||||
else
|
||||
args.push_back(rop.ll.constant((int)Knots.typespec().arraylength()));
|
||||
args.push_back(rop.ll.constant((int)Knots.typespec().arraylength()));
|
||||
@@ -7094,7 +7103,7 @@ LLVMGEN(llvm_gen_spline)
|
||||
leadLane);
|
||||
args[splineNameArgumentIndex] = scalar_splineName;
|
||||
lanesMatchingSplineName = rop.ll.op_lanes_that_match_masked(
|
||||
scalar_splineName, splineNameVal, remainingMask);
|
||||
scalar_splineName, splineNameVal, remainingMask);
|
||||
|
||||
OSL_ASSERT(lanesMatchingSplineName);
|
||||
//rop.llvm_print_mask("lanesMatchingSplineName", lanesMatchingSplineName);
|
||||
@@ -7340,7 +7349,7 @@ LLVMGEN(llvm_gen_closure)
|
||||
|
||||
llvm::Value* dest_base = rop.ll.offset_ptr(mem_void_ptr, p.offset);
|
||||
llvm::Type* dest_type = rop.ll.llvm_type(
|
||||
static_cast<const TypeSpec&>(p.type).simpletype());
|
||||
static_cast<const TypeSpec&>(p.type).simpletype());
|
||||
dest_base = rop.ll.ptr_to_cast(dest_base, dest_type);
|
||||
|
||||
if (num_elements > 1) {
|
||||
|
||||
@@ -1203,7 +1203,7 @@ BatchedBackendLLVM::llvm_assign_initial_value(
|
||||
ll.constant(ncomps),
|
||||
ll.constant("<get_userdata>") };
|
||||
ll.call_function(build_name(FuncSpec("naninf_check_offset")
|
||||
.arg_uniform(TypeDesc::TypeInt)
|
||||
.arg_uniform(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ BatchedBackendLLVM::llvm_generate_debugnan(const Opcode& op)
|
||||
ncheck,
|
||||
ll.constant(op.opname()) };
|
||||
ll.call_function(build_name(FuncSpec("naninf_check_offset")
|
||||
.arg_varying(TypeDesc::TypeInt)
|
||||
.arg_varying(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
|
||||
@@ -1495,7 +1495,7 @@ BatchedBackendLLVM::llvm_generate_debugnan(const Opcode& op)
|
||||
ncheck,
|
||||
ll.constant(op.opname()) };
|
||||
ll.call_function(build_name(FuncSpec("naninf_check_offset")
|
||||
.arg_uniform(TypeDesc::TypeInt)
|
||||
.arg_uniform(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
}
|
||||
@@ -1639,14 +1639,14 @@ BatchedBackendLLVM::llvm_generate_debug_uninit(const Opcode& op)
|
||||
ll.call_function(build_name(
|
||||
FuncSpec("uninit_check_values_offset")
|
||||
.arg_uniform(TypeDesc::PTR)
|
||||
.arg_varying(TypeDesc::TypeInt)
|
||||
.arg_varying(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
} else {
|
||||
ll.call_function(build_name(
|
||||
FuncSpec("uninit_check_values_offset")
|
||||
.arg_varying(TypeDesc::PTR)
|
||||
.arg_varying(TypeDesc::TypeInt)
|
||||
.arg_varying(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
}
|
||||
@@ -1671,7 +1671,7 @@ BatchedBackendLLVM::llvm_generate_debug_uninit(const Opcode& op)
|
||||
ll.call_function(build_name(
|
||||
FuncSpec("uninit_check_values_offset")
|
||||
.arg_uniform(TypeDesc::PTR)
|
||||
.arg_uniform(TypeDesc::TypeInt)),
|
||||
.arg_uniform(TypeInt)),
|
||||
args);
|
||||
} else {
|
||||
llvm::Value* args[]
|
||||
@@ -1694,7 +1694,7 @@ BatchedBackendLLVM::llvm_generate_debug_uninit(const Opcode& op)
|
||||
ll.call_function(build_name(
|
||||
FuncSpec("uninit_check_values_offset")
|
||||
.arg_varying(TypeDesc::PTR)
|
||||
.arg_uniform(TypeDesc::TypeInt)
|
||||
.arg_uniform(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
}
|
||||
@@ -2109,10 +2109,9 @@ BatchedBackendLLVM::build_llvm_instance(bool groupentry)
|
||||
ll.constant(0),
|
||||
ll.constant(ncomps),
|
||||
ll.constant("<none>") };
|
||||
ll.call_function(build_name(
|
||||
FuncSpec("naninf_check_offset")
|
||||
.arg_uniform(TypeDesc::TypeInt)
|
||||
.mask()),
|
||||
ll.call_function(build_name(FuncSpec("naninf_check_offset")
|
||||
.arg_uniform(TypeInt)
|
||||
.mask()),
|
||||
args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,15 @@ using namespace OSL::pvt;
|
||||
OSL_NAMESPACE_ENTER
|
||||
|
||||
|
||||
#ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
namespace {
|
||||
std::mutex shared_texturesys_mutex;
|
||||
std::shared_ptr<TextureSystem> shared_texturesys;
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template<int WidthT>
|
||||
BatchedRendererServices<WidthT>::BatchedRendererServices(TextureSystem* texsys)
|
||||
: m_texturesys(texsys)
|
||||
@@ -27,7 +36,17 @@ BatchedRendererServices<WidthT>::BatchedRendererServices(TextureSystem* texsys)
|
||||
OSL_ASSERT(
|
||||
0 && "RendererServices was not passed a working TextureSystem*");
|
||||
#else
|
||||
# ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(shared_texturesys_mutex);
|
||||
if (!shared_texturesys) {
|
||||
shared_texturesys = TextureSystem::create(true /* shared */);
|
||||
}
|
||||
m_texturesys = shared_texturesys.get();
|
||||
}
|
||||
# else
|
||||
m_texturesys = TextureSystem::create(true /* shared */);
|
||||
# endif
|
||||
// Make some good guesses about default options
|
||||
m_texturesys->attribute("automip", 1);
|
||||
m_texturesys->attribute("autotile", 64);
|
||||
|
||||
@@ -43,17 +43,17 @@ print_component_value(std::ostream& out, ShadingSystemImpl* ss, TypeDesc type,
|
||||
const void* data)
|
||||
|
||||
{
|
||||
if (type == TypeDesc::TypeInt)
|
||||
if (type == TypeInt)
|
||||
out << *(int*)data;
|
||||
else if (type == TypeDesc::TypeFloat)
|
||||
else if (type == TypeFloat)
|
||||
out << *(float*)data;
|
||||
else if (type == TypeDesc::TypeColor)
|
||||
else if (type == TypeColor)
|
||||
out << "(" << ((Color3*)data)->x << ", " << ((Color3*)data)->y << ", "
|
||||
<< ((Color3*)data)->z << ")";
|
||||
else if (type == TypeDesc::TypeVector)
|
||||
else if (type == TypeVector)
|
||||
out << "(" << ((Vec3*)data)->x << ", " << ((Vec3*)data)->y << ", "
|
||||
<< ((Vec3*)data)->z << ")";
|
||||
else if (type == TypeDesc::TypeString)
|
||||
else if (type == TypeString)
|
||||
out << "\"" << *((ustring*)data) << "\"";
|
||||
else if (type == TypeDesc::PTR) // this only happens for closures
|
||||
print_closure(out, *(const ClosureColor**)data, ss);
|
||||
|
||||
@@ -291,7 +291,7 @@ DECLFOLDER(constfold_dot)
|
||||
if (A.is_constant() && B.is_constant()) {
|
||||
OSL_DASSERT(A.typespec().is_triple() && B.typespec().is_triple());
|
||||
float result = A.get_vec3().dot(B.get_vec3());
|
||||
int cind = rop.add_constant(TypeDesc::TypeFloat, &result);
|
||||
int cind = rop.add_constant(TypeFloat, &result);
|
||||
rop.turn_into_assign(op, cind, "dot(const,const)");
|
||||
return 1;
|
||||
}
|
||||
@@ -376,8 +376,7 @@ DECLFOLDER(constfold_eq)
|
||||
}
|
||||
// Turn the 'eq R A B' into 'assign R X' where X is 0 or 1.
|
||||
static const int int_zero = 0, int_one = 1;
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const == const");
|
||||
return 1;
|
||||
}
|
||||
@@ -404,8 +403,7 @@ DECLFOLDER(constfold_neq)
|
||||
}
|
||||
// Turn the 'neq R A B' into 'assign R X' where X is 0 or 1.
|
||||
static const int int_zero = 0, int_one = 1;
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const != const");
|
||||
return 1;
|
||||
}
|
||||
@@ -436,8 +434,7 @@ DECLFOLDER(constfold_lt)
|
||||
} else {
|
||||
return 0; // unhandled case
|
||||
}
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const < const");
|
||||
return 1;
|
||||
}
|
||||
@@ -468,8 +465,7 @@ DECLFOLDER(constfold_le)
|
||||
} else {
|
||||
return 0; // unhandled case
|
||||
}
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const <= const");
|
||||
return 1;
|
||||
}
|
||||
@@ -500,8 +496,7 @@ DECLFOLDER(constfold_gt)
|
||||
} else {
|
||||
return 0; // unhandled case
|
||||
}
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const > const");
|
||||
return 1;
|
||||
}
|
||||
@@ -532,8 +527,7 @@ DECLFOLDER(constfold_ge)
|
||||
} else {
|
||||
return 0; // unhandled case
|
||||
}
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const >= const");
|
||||
return 1;
|
||||
}
|
||||
@@ -552,8 +546,7 @@ DECLFOLDER(constfold_or)
|
||||
bool val = A.get_int() || B.get_int();
|
||||
// Turn the 'or R A B' into 'assign R X' where X is 0 or 1.
|
||||
static const int int_zero = 0, int_one = 1;
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const || const");
|
||||
return 1;
|
||||
}
|
||||
@@ -572,8 +565,7 @@ DECLFOLDER(constfold_and)
|
||||
OSL_DASSERT(A.typespec().is_int() && B.typespec().is_int());
|
||||
bool val = A.get_int() && B.get_int();
|
||||
static const int int_zero = 0, int_one = 1;
|
||||
int cind = rop.add_constant(TypeDesc::TypeInt,
|
||||
val ? &int_one : &int_zero);
|
||||
int cind = rop.add_constant(TypeInt, val ? &int_one : &int_zero);
|
||||
rop.turn_into_assign(op, cind, "const && const");
|
||||
return 1;
|
||||
}
|
||||
@@ -1300,7 +1292,7 @@ DECLFOLDER(constfold_concat)
|
||||
}
|
||||
// If we made it this far, all args were constants, and the
|
||||
// concatenation is in result.
|
||||
int cind = rop.add_constant(TypeDesc::TypeString, &result);
|
||||
int cind = rop.add_constant(TypeString, &result);
|
||||
rop.turn_into_assign(op, cind, "const fold concat");
|
||||
return 1;
|
||||
}
|
||||
@@ -1604,7 +1596,7 @@ DECLFOLDER(constfold_mix)
|
||||
if (B.connected()) {
|
||||
// Add the test and conditional for X==0, in which case we can
|
||||
// just R=A and not have to access B
|
||||
int cond = rop.add_temp(TypeDesc::TypeInt);
|
||||
int cond = rop.add_temp(TypeInt);
|
||||
int fzero = rop.add_constant(0.0f);
|
||||
rop.insert_code(opnum++, u_eq, RuntimeOptimizer::GroupWithNext,
|
||||
cond, Xind, fzero);
|
||||
@@ -1621,7 +1613,7 @@ DECLFOLDER(constfold_mix)
|
||||
if (A.connected()) {
|
||||
// Add the test and conditional for X==1, in which case we can
|
||||
// just R=B and not have to access A
|
||||
int cond = rop.add_temp(TypeDesc::TypeInt);
|
||||
int cond = rop.add_temp(TypeInt);
|
||||
int fone = rop.add_constant(1.0f);
|
||||
rop.insert_code(opnum++, u_eq, RuntimeOptimizer::GroupWithNext,
|
||||
cond, Xind, fone);
|
||||
@@ -2043,7 +2035,7 @@ DECLFOLDER(constfold_matrix)
|
||||
// turn it into a constant rather than calling getmatrix at
|
||||
// execution time.
|
||||
Matrix44 Mresult = Mfrom * Mto;
|
||||
int cind = rop.add_constant(TypeDesc::TypeMatrix, &Mresult);
|
||||
int cind = rop.add_constant(TypeMatrix, &Mresult);
|
||||
rop.turn_into_assign(op, cind, "const fold matrix");
|
||||
return 1;
|
||||
}
|
||||
@@ -2079,7 +2071,7 @@ DECLFOLDER(constfold_matrix)
|
||||
}
|
||||
}
|
||||
if (all_const) {
|
||||
rop.turn_into_assign(op, rop.add_constant(TypeDesc::TypeMatrix, M),
|
||||
rop.turn_into_assign(op, rop.add_constant(TypeMatrix, M),
|
||||
"const fold matrix");
|
||||
return 1;
|
||||
}
|
||||
@@ -2142,14 +2134,14 @@ DECLFOLDER(constfold_getmatrix)
|
||||
rop.inst()->args()[op.firstarg() + 0] = dataarg;
|
||||
// Now turn it into an assignment
|
||||
Matrix44 Mresult = Mfrom * Mto;
|
||||
int cind = rop.add_constant(TypeDesc::TypeMatrix, &Mresult);
|
||||
int cind = rop.add_constant(TypeMatrix, &Mresult);
|
||||
rop.turn_into_assign(op, cind, "getmatrix of known matrix");
|
||||
|
||||
// Now insert a new instruction that assigns 1 to the
|
||||
// original return result of getmatrix.
|
||||
const int one = 1;
|
||||
const int args_to_add[] = { resultarg,
|
||||
rop.add_constant(TypeDesc::TypeInt, &one) };
|
||||
rop.add_constant(TypeInt, &one) };
|
||||
rop.insert_code(opnum, u_assign, args_to_add,
|
||||
RuntimeOptimizer::RecomputeRWRanges,
|
||||
RuntimeOptimizer::GroupWithNext);
|
||||
@@ -2316,22 +2308,19 @@ DECLFOLDER(constfold_getattribute)
|
||||
bool found = false;
|
||||
|
||||
// Check global things first
|
||||
if (attr_name == "osl:version" && attr_type == TypeDesc::TypeInt) {
|
||||
if (attr_name == "osl:version" && attr_type == TypeInt) {
|
||||
int* val = (int*)(char*)buf;
|
||||
*val = OSL_VERSION;
|
||||
found = true;
|
||||
} else if (attr_name == "shader:shadername"
|
||||
&& attr_type == TypeDesc::TypeString) {
|
||||
} else if (attr_name == "shader:shadername" && attr_type == TypeString) {
|
||||
ustring* up = (ustring*)(char*)buf;
|
||||
*up = ustring(rop.inst()->shadername());
|
||||
found = true;
|
||||
} else if (attr_name == "shader:layername"
|
||||
&& attr_type == TypeDesc::TypeString) {
|
||||
} else if (attr_name == "shader:layername" && attr_type == TypeString) {
|
||||
ustring* up = (ustring*)(char*)buf;
|
||||
*up = rop.inst()->layername();
|
||||
found = true;
|
||||
} else if (attr_name == "shader:groupname"
|
||||
&& attr_type == TypeDesc::TypeString) {
|
||||
} else if (attr_name == "shader:groupname" && attr_type == TypeString) {
|
||||
ustring* up = (ustring*)(char*)buf;
|
||||
*up = rop.group().name();
|
||||
found = true;
|
||||
@@ -2374,7 +2363,7 @@ DECLFOLDER(constfold_getattribute)
|
||||
// original return result of getattribute.
|
||||
const int one = 1;
|
||||
const int args_to_add[] = { oldresultarg,
|
||||
rop.add_constant(TypeDesc::TypeInt, &one) };
|
||||
rop.add_constant(TypeInt, &one) };
|
||||
rop.insert_code(opnum, u_assign, args_to_add,
|
||||
RuntimeOptimizer::RecomputeRWRanges,
|
||||
RuntimeOptimizer::GroupWithNext);
|
||||
@@ -2438,9 +2427,9 @@ DECLFOLDER(constfold_gettextureinfo)
|
||||
|
||||
// Now insert a new instruction that assigns 1 to the
|
||||
// original return result of gettextureinfo.
|
||||
int one = 1;
|
||||
const int args_to_add[]
|
||||
= { oldresultarg, rop.add_constant(TypeDesc::TypeInt, &one) };
|
||||
int one = 1;
|
||||
const int args_to_add[] = { oldresultarg,
|
||||
rop.add_constant(TypeInt, &one) };
|
||||
rop.insert_code(opnum, u_assign, args_to_add,
|
||||
RuntimeOptimizer::RecomputeRWRanges,
|
||||
RuntimeOptimizer::GroupWithNext);
|
||||
@@ -2587,7 +2576,7 @@ DECLFOLDER(constfold_texture)
|
||||
// Just turn the param name into empty string and it will
|
||||
// be skipped.
|
||||
ustring empty;
|
||||
int cind = rop.add_constant(TypeDesc::TypeString, &empty);
|
||||
int cind = rop.add_constant(TypeString, &empty);
|
||||
rop.inst()->args()[op.firstarg() + i] = cind;
|
||||
rop.inst()->args()[op.firstarg() + i + 1] = cind;
|
||||
any_elided = true;
|
||||
@@ -2739,8 +2728,7 @@ DECLFOLDER(constfold_pointcloud_search)
|
||||
|
||||
// Query results all copied. The only thing left to do is to assign
|
||||
// status (query result count) to the original "result".
|
||||
const int args_to_add[] = { result_sym,
|
||||
rop.add_constant(TypeDesc::TypeInt, &count) };
|
||||
const int args_to_add[] = { result_sym, rop.add_constant(TypeInt, &count) };
|
||||
rop.insert_code(opnum, u_assign, args_to_add,
|
||||
RuntimeOptimizer::RecomputeRWRanges,
|
||||
RuntimeOptimizer::GroupWithNext);
|
||||
@@ -2789,7 +2777,7 @@ DECLFOLDER(constfold_pointcloud_get)
|
||||
&data[0]);
|
||||
rop.shadingsys().pointcloud_stats(0, 1, 0);
|
||||
|
||||
rop.turn_into_assign(op, rop.add_constant(TypeDesc::TypeInt, &ok),
|
||||
rop.turn_into_assign(op, rop.add_constant(TypeInt, &ok),
|
||||
"Folded constant pointcloud_get");
|
||||
|
||||
// Now make a constant array for those results we just retrieved...
|
||||
@@ -2908,7 +2896,7 @@ DECLFOLDER(constfold_noise)
|
||||
cell(n, Vec3(input[0], input[1], input[2]));
|
||||
else
|
||||
cell(n, Vec3(input[0], input[1], input[2]), input[3]);
|
||||
int cind = rop.add_constant(TypeDesc::TypePoint, &n);
|
||||
int cind = rop.add_constant(TypePoint, &n);
|
||||
rop.turn_into_assign(op, cind, "const fold cellnoise");
|
||||
return 1;
|
||||
}
|
||||
|
||||
+11
-15
@@ -59,7 +59,6 @@ static ustring op_xor("xor");
|
||||
|
||||
static ustring u_distance("distance");
|
||||
static ustring u_index("index");
|
||||
static ustring u__empty; // empty/default ustring
|
||||
|
||||
|
||||
|
||||
@@ -1560,7 +1559,7 @@ LLVMGEN(llvm_gen_compassign)
|
||||
}
|
||||
|
||||
for (int d = 0; d < 3; ++d) { // deriv
|
||||
llvm::Value* val = rop.llvm_load_value(Val, d, 0, TypeDesc::TypeFloat);
|
||||
llvm::Value* val = rop.llvm_load_value(Val, d, 0, TypeFloat);
|
||||
if (Index.is_constant()) {
|
||||
int i = Index.get_int();
|
||||
i = Imath::clamp(i, 0, 2);
|
||||
@@ -1671,7 +1670,7 @@ LLVMGEN(llvm_gen_mxcompassign)
|
||||
}
|
||||
}
|
||||
|
||||
llvm::Value* val = rop.llvm_load_value(Val, 0, 0, TypeDesc::TypeFloat);
|
||||
llvm::Value* val = rop.llvm_load_value(Val, 0, 0, TypeFloat);
|
||||
|
||||
if (Row.is_constant() && Col.is_constant()) {
|
||||
int r = Imath::clamp(Row.get_int(), 0, 3);
|
||||
@@ -1831,8 +1830,7 @@ LLVMGEN(llvm_gen_construct_color)
|
||||
for (int d = 0; d < dmax; ++d) { // loop over derivs
|
||||
for (int c = 0; c < 3; ++c) { // loop over components
|
||||
const Symbol& comp = *rop.opargsym(op, c + 1 + using_space);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0,
|
||||
TypeDesc::TypeFloat);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0, TypeFloat);
|
||||
rop.llvm_store_value(val, Result, d, NULL, c);
|
||||
}
|
||||
}
|
||||
@@ -1877,8 +1875,7 @@ LLVMGEN(llvm_gen_construct_triple)
|
||||
for (int d = 0; d < dmax; ++d) { // loop over derivs
|
||||
for (int c = 0; c < 3; ++c) { // loop over components
|
||||
const Symbol& comp = *rop.opargsym(op, c + 1 + using_space);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0,
|
||||
TypeDesc::TypeFloat);
|
||||
llvm::Value* val = rop.llvm_load_value(comp, d, NULL, 0, TypeFloat);
|
||||
rop.llvm_store_value(val, Result, d, NULL, c);
|
||||
}
|
||||
}
|
||||
@@ -2440,8 +2437,8 @@ LLVMGEN(llvm_gen_andor)
|
||||
Symbol& b = *rop.opargsym(op, 2);
|
||||
|
||||
llvm::Value* i1_res = NULL;
|
||||
llvm::Value* a_val = rop.llvm_load_value(a, 0, 0, TypeDesc::TypeInt);
|
||||
llvm::Value* b_val = rop.llvm_load_value(b, 0, 0, TypeDesc::TypeInt);
|
||||
llvm::Value* a_val = rop.llvm_load_value(a, 0, 0, TypeInt);
|
||||
llvm::Value* b_val = rop.llvm_load_value(b, 0, 0, TypeInt);
|
||||
if (op.opname() == op_and) {
|
||||
// From the old bitcode generated
|
||||
// define i32 @osl_and_iii(i32 %a, i32 %b) nounwind readnone ssp {
|
||||
@@ -2721,8 +2718,7 @@ llvm_gen_texture_options(BackendLLVM& rop, int opnum, int first_optional_arg,
|
||||
errormessage = rop.llvm_get_pointer(Val);
|
||||
continue;
|
||||
}
|
||||
if (name == Strings::missingcolor
|
||||
&& equivalent(valtype, TypeDesc::TypeColor)) {
|
||||
if (name == Strings::missingcolor && equivalent(valtype, TypeColor)) {
|
||||
if (!missingcolor) {
|
||||
// If not already done, allocate enough storage for the
|
||||
// missingcolor value (4 floats), and call the special
|
||||
@@ -3091,12 +3087,12 @@ llvm_gen_noise_options(BackendLLVM& rop, int opnum, int first_optional_arg)
|
||||
&& (Val.typespec().is_float() || Val.typespec().is_int())) {
|
||||
rop.ll.call_function("osl_noiseparams_set_bandwidth", opt,
|
||||
rop.llvm_load_value(Val, 0, NULL, 0,
|
||||
TypeDesc::TypeFloat));
|
||||
TypeFloat));
|
||||
} else if (name == Strings::impulses
|
||||
&& (Val.typespec().is_float() || Val.typespec().is_int())) {
|
||||
rop.ll.call_function("osl_noiseparams_set_impulses", opt,
|
||||
rop.llvm_load_value(Val, 0, NULL, 0,
|
||||
TypeDesc::TypeFloat));
|
||||
TypeFloat));
|
||||
} else {
|
||||
rop.shadingcontext()->errorfmt(
|
||||
"Unknown {} optional argument: \"{}\", <{}> ({}:{})",
|
||||
@@ -3831,11 +3827,11 @@ LLVMGEN(llvm_gen_closure)
|
||||
const ClosureRegistry::ClosureEntry* clentry
|
||||
= rop.shadingsys().find_closure(closure_name);
|
||||
if (!clentry) {
|
||||
rop.llvm_gen_error(fmtformat(
|
||||
rop.shadingcontext()->errorfmt(
|
||||
"Closure '{}' is not supported by the current renderer, called from {}:{} in shader \"{}\", layer {} \"{}\", group \"{}\"",
|
||||
closure_name, op.sourcefile(), op.sourceline(),
|
||||
rop.inst()->shadername(), rop.layer(), rop.inst()->layername(),
|
||||
rop.group().name()));
|
||||
rop.group().name());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -482,6 +482,9 @@ BackendLLVM::build_offsets_of_ShaderGlobals(
|
||||
offset_by_index.push_back(offsetof(ShaderGlobals, flipHandedness));
|
||||
offset_by_index.push_back(offsetof(ShaderGlobals, backfacing));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
BackendLLVM::llvm_assign_initial_value(const Symbol& sym, bool force)
|
||||
{
|
||||
@@ -1626,7 +1629,13 @@ BackendLLVM::prepare_module_for_cuda_jit()
|
||||
for (llvm::Function& fn : *ll.module()) {
|
||||
if (fn.hasFnAttribute("osl-lib-function")) {
|
||||
fn.setLinkage(llvm::GlobalValue::ExternalLinkage);
|
||||
} else if (fn.getName().startswith(group().name().c_str())) {
|
||||
}
|
||||
#if OSL_LLVM_VERSION >= 180
|
||||
else if (fn.getName().starts_with(group().name().c_str()))
|
||||
#else
|
||||
else if (fn.getName().startswith(group().name().c_str()))
|
||||
#endif
|
||||
{
|
||||
fn.setLinkage(llvm::GlobalValue::PrivateLinkage);
|
||||
}
|
||||
}
|
||||
@@ -1638,9 +1647,15 @@ BackendLLVM::prepare_module_for_cuda_jit()
|
||||
// Don't modify the inlining attribute for:
|
||||
// * group entry functions
|
||||
// * llvm library functions
|
||||
#if OSL_LLVM_VERSION >= 180
|
||||
if (fn.getName().starts_with("__direct_callable__")
|
||||
|| fn.getName().starts_with("llvm."))
|
||||
continue;
|
||||
#else
|
||||
if (fn.getName().startswith("__direct_callable__")
|
||||
|| fn.getName().startswith("llvm."))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
// Merge layer functions which are only called from one place
|
||||
if (merge_layer_funcs && !fn.hasFnAttribute("osl-lib-function")
|
||||
|
||||
@@ -639,19 +639,19 @@ osl_step_vvv(void* result, void* edge, void* x)
|
||||
OSL_SHADEOP int
|
||||
osl_isnan_if(float f)
|
||||
{
|
||||
return OIIO::isnan(f);
|
||||
return std::isnan(f);
|
||||
}
|
||||
|
||||
OSL_SHADEOP int
|
||||
osl_isinf_if(float f)
|
||||
{
|
||||
return OIIO::isinf(f);
|
||||
return std::isinf(f);
|
||||
}
|
||||
|
||||
OSL_SHADEOP int
|
||||
osl_isfinite_if(float f)
|
||||
{
|
||||
return OIIO::isfinite(f);
|
||||
return std::isfinite(f);
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ safe_div(float a, float b)
|
||||
// to see if is finite and return 0.0f when it is not.
|
||||
// Typical implementation isfinite is (fabs(v) != INF), so not too expensive.
|
||||
float q = a / b;
|
||||
return OIIO::isfinite(q) ? q : 0.0f;
|
||||
return std::isfinite(q) ? q : 0.0f;
|
||||
// TODO: add a FTZ mode and only add checking the result when FTZ is disabled
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -349,7 +349,11 @@ public:
|
||||
// Should handle promoting whatever the constant value is (most likely zeroinitializer)
|
||||
llvm::ConstantFolder Folder;
|
||||
auto* signExtConstant
|
||||
#if OSL_LLVM_VERSION < 180
|
||||
= Folder.CreateCast(
|
||||
#else
|
||||
= Folder.FoldCast(
|
||||
#endif
|
||||
llvm::Instruction::SExt,
|
||||
constant, m_native_mask_type);
|
||||
|
||||
|
||||
@@ -45,7 +45,11 @@
|
||||
#include <llvm/Support/CommandLine.h>
|
||||
#include <llvm/Support/ErrorOr.h>
|
||||
#include <llvm/Support/FileSystem.h>
|
||||
#include <llvm/Support/Host.h>
|
||||
#if OSL_LLVM_VERSION < 160
|
||||
# include <llvm/Support/Host.h>
|
||||
#else
|
||||
# include <llvm/TargetParser/Host.h>
|
||||
#endif
|
||||
#include <llvm/Support/raw_os_ostream.h>
|
||||
#if OSL_LLVM_VERSION < 140
|
||||
# include <llvm/Support/TargetRegistry.h>
|
||||
@@ -359,10 +363,7 @@ public:
|
||||
{
|
||||
mm->registerEHFrames(Addr, LoadAddr, Size);
|
||||
}
|
||||
void deregisterEHFrames() override
|
||||
{
|
||||
mm->deregisterEHFrames();
|
||||
}
|
||||
void deregisterEHFrames() override { mm->deregisterEHFrames(); }
|
||||
|
||||
uint64_t getSymbolAddress(const std::string& Name) override
|
||||
{
|
||||
@@ -431,6 +432,7 @@ LLVM_Util::LLVM_Util(const PerThreadInfo& per_thread_info, int debuglevel,
|
||||
, m_llvm_func_passes(NULL)
|
||||
, m_new_pass_manager(NULL)
|
||||
, m_llvm_exec(NULL)
|
||||
, m_nvptx_target_machine(nullptr)
|
||||
, m_vector_width(vector_width)
|
||||
, m_llvm_type_native_mask(nullptr)
|
||||
, mVTuneNotifier(nullptr)
|
||||
@@ -488,26 +490,20 @@ LLVM_Util::LLVM_Util(const PerThreadInfo& per_thread_info, int debuglevel,
|
||||
else
|
||||
m_llvm_type_addrint = (llvm::Type*)llvm::Type::getInt64Ty(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_int_ptr = (llvm::PointerType*)llvm::Type::getInt32PtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_int8_ptr = (llvm::PointerType*)llvm::Type::getInt8PtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_int64_ptr = (llvm::PointerType*)llvm::Type::getInt64PtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_bool = (llvm::Type*)llvm::Type::getInt1Ty(*m_llvm_context);
|
||||
m_llvm_type_bool_ptr = (llvm::PointerType*)llvm::Type::getInt1PtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_char = (llvm::Type*)llvm::Type::getInt8Ty(*m_llvm_context);
|
||||
m_llvm_type_longlong = (llvm::Type*)llvm::Type::getInt64Ty(*m_llvm_context);
|
||||
m_llvm_type_void = (llvm::Type*)llvm::Type::getVoidTy(*m_llvm_context);
|
||||
m_llvm_type_char_ptr = (llvm::PointerType*)llvm::Type::getInt8PtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_float_ptr = (llvm::PointerType*)llvm::Type::getFloatPtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_longlong_ptr = (llvm::PointerType*)llvm::Type::getInt64PtrTy(
|
||||
*m_llvm_context);
|
||||
m_llvm_type_void_ptr = m_llvm_type_char_ptr;
|
||||
m_llvm_type_double_ptr = llvm::Type::getDoublePtrTy(*m_llvm_context);
|
||||
|
||||
m_llvm_type_int_ptr = llvm::PointerType::get(m_llvm_type_int, 0);
|
||||
m_llvm_type_int8_ptr = llvm::PointerType::get(m_llvm_type_int8, 0);
|
||||
m_llvm_type_int64_ptr = llvm::PointerType::get(m_llvm_type_int64, 0);
|
||||
m_llvm_type_bool_ptr = llvm::PointerType::get(m_llvm_type_bool, 0);
|
||||
m_llvm_type_char_ptr = llvm::PointerType::get(m_llvm_type_char, 0);
|
||||
m_llvm_type_void_ptr = m_llvm_type_char_ptr;
|
||||
m_llvm_type_float_ptr = llvm::PointerType::get(m_llvm_type_float, 0);
|
||||
m_llvm_type_longlong_ptr = llvm::PointerType::get(m_llvm_type_int64, 0);
|
||||
m_llvm_type_double_ptr = llvm::PointerType::get(m_llvm_type_double, 0);
|
||||
|
||||
// A triple is a struct composed of 3 floats
|
||||
std::vector<llvm::Type*> triplefields(3, m_llvm_type_float);
|
||||
@@ -561,7 +557,7 @@ void
|
||||
LLVM_Util::ustring_rep(UstringRep rep)
|
||||
{
|
||||
m_ustring_rep = rep;
|
||||
m_llvm_type_ustring = llvm::Type::getInt8PtrTy(*m_llvm_context);
|
||||
m_llvm_type_ustring = m_llvm_type_int8_ptr;
|
||||
// ^^ When m_ustring_rep != UstringRep::charptr, we'd ideally want to make
|
||||
// it a uint directly, but that is wreaking havoc with function
|
||||
// signatures, so continue to disguise it as a pointer.
|
||||
@@ -585,6 +581,7 @@ LLVM_Util::~LLVM_Util()
|
||||
delete m_new_pass_manager;
|
||||
delete m_builder;
|
||||
delete m_llvm_debug_builder;
|
||||
delete m_nvptx_target_machine;
|
||||
module(NULL);
|
||||
// DO NOT delete m_llvm_jitmm; // just the dummy wrapper around the real MM
|
||||
}
|
||||
@@ -775,17 +772,17 @@ LLVM_Util::debug_push_inlined_function(OIIO::ustring function_name,
|
||||
llvm::DINode::FlagPrototyped | llvm::DINode::FlagNoReturn);
|
||||
llvm::DISubprogram* function = nullptr;
|
||||
function = m_llvm_debug_builder->createFunction(
|
||||
mDebugCU, // Scope
|
||||
function_name.c_str(), // Name
|
||||
// We are inlined function so not sure supplying a linkage name
|
||||
// makes sense
|
||||
/*function_name.c_str()*/ llvm::StringRef(), // Linkage Name
|
||||
file, // File
|
||||
static_cast<unsigned int>(sourceline), // Line Number
|
||||
mSubTypeForInlinedFunction, // subroutine type
|
||||
method_scope_line, // Scope Line,
|
||||
fnFlags,
|
||||
llvm::DISubprogram::toSPFlags(true /*isLocalToUnit*/,
|
||||
mDebugCU, // Scope
|
||||
function_name.c_str(), // Name
|
||||
// We are inlined function so not sure supplying a linkage name
|
||||
// makes sense
|
||||
/*function_name.c_str()*/ llvm::StringRef(), // Linkage Name
|
||||
file, // File
|
||||
static_cast<unsigned int>(sourceline), // Line Number
|
||||
mSubTypeForInlinedFunction, // subroutine type
|
||||
method_scope_line, // Scope Line,
|
||||
fnFlags,
|
||||
llvm::DISubprogram::toSPFlags(true /*isLocalToUnit*/,
|
||||
true /*isDefinition*/,
|
||||
true /*false*/ /*isOptimized*/));
|
||||
|
||||
@@ -1511,8 +1508,14 @@ LLVM_Util::make_jit_execengine(std::string* err, TargetISA requestedISA,
|
||||
std::unique_ptr<llvm::RTDyldMemoryManager>(
|
||||
new MemoryManager(m_llvm_jitmm)));
|
||||
|
||||
#if OSL_LLVM_VERSION >= 180
|
||||
engine_builder.setOptLevel(jit_aggressive()
|
||||
? llvm::CodeGenOptLevel::Aggressive
|
||||
: llvm::CodeGenOptLevel::Default);
|
||||
#else
|
||||
engine_builder.setOptLevel(jit_aggressive() ? llvm::CodeGenOpt::Aggressive
|
||||
: llvm::CodeGenOpt::Default);
|
||||
#endif
|
||||
|
||||
llvm::TargetOptions options;
|
||||
// Enables FMA's in IR generation.
|
||||
@@ -1814,7 +1817,12 @@ LLVM_Util::nvptx_target_machine()
|
||||
m_nvptx_target_machine = llvm_target->createTargetMachine(
|
||||
ModuleTriple.str(), CUDA_TARGET_ARCH, "+ptx50", options,
|
||||
llvm::Reloc::Static, llvm::CodeModel::Small,
|
||||
llvm::CodeGenOpt::Default);
|
||||
#if OSL_LLVM_VERSION >= 180
|
||||
llvm::CodeGenOptLevel::Default
|
||||
#else
|
||||
llvm::CodeGenOpt::Default
|
||||
#endif
|
||||
);
|
||||
|
||||
OSL_ASSERT(m_nvptx_target_machine
|
||||
&& "Unable to create TargetMachine for NVPTX");
|
||||
@@ -2954,7 +2962,12 @@ LLVM_Util::prune_and_internalize_module(
|
||||
|| llvm::cast<llvm::GlobalValue>(val)
|
||||
->hasLocalLinkage()) {
|
||||
if (!debug()
|
||||
|| !val->getName().startswith("llvm.dbg")) {
|
||||
#if OSL_LLVM_VERSION >= 180
|
||||
|| !val->getName().starts_with("llvm.dbg")
|
||||
#else
|
||||
|| !val->getName().startswith("llvm.dbg")
|
||||
#endif
|
||||
) {
|
||||
__OSL_PRUNE_ONLY(
|
||||
std::cout
|
||||
<< "remove symbol table for value: "
|
||||
@@ -4666,8 +4679,8 @@ LLVM_Util::op_gather(llvm::Type* src_type, llvm::Value* src_ptr,
|
||||
|
||||
llvm::Value* unmasked_value = wide_constant(0.0f);
|
||||
llvm::Value* args[] = {
|
||||
unmasked_value, void_ptr(src_ptr), wide_index, int_mask,
|
||||
constant(4) // not sure why the scale
|
||||
unmasked_value, void_ptr(src_ptr), wide_index, int_mask,
|
||||
constant(4) // not sure why the scale
|
||||
};
|
||||
return builder().CreateCall(func_avx512_gather_ps,
|
||||
toArrayRef(args));
|
||||
@@ -5602,9 +5615,9 @@ LLVM_Util::apply_return_to(llvm::Value* existing_mask)
|
||||
OSL_ASSERT(masked_function_context().return_count > 0);
|
||||
|
||||
llvm::Value* loc_of_return_mask = masked_function_context().location_of_mask;
|
||||
llvm::Value* rs_mask = op_load_mask(loc_of_return_mask);
|
||||
llvm::Value* result = builder().CreateSelect(rs_mask, existing_mask,
|
||||
rs_mask);
|
||||
llvm::Value* rs_mask = op_load_mask(loc_of_return_mask);
|
||||
llvm::Value* result = builder().CreateSelect(rs_mask, existing_mask,
|
||||
rs_mask);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6483,7 +6496,11 @@ LLVM_Util::ptx_compile_group(llvm::Module*, const std::string& name,
|
||||
llvm::raw_svector_ostream assembly_stream(assembly);
|
||||
|
||||
// TODO: Make sure rounding modes, etc., are set correctly
|
||||
# if OSL_LLVM_VERSION >= 100
|
||||
# if OSL_LLVM_VERSION >= 180
|
||||
target_machine->addPassesToEmitFile(mpm, assembly_stream,
|
||||
nullptr, // FIXME: Correct?
|
||||
llvm::CodeGenFileType::AssemblyFile);
|
||||
# elif OSL_LLVM_VERSION >= 100
|
||||
target_machine->addPassesToEmitFile(mpm, assembly_stream,
|
||||
nullptr, // FIXME: Correct?
|
||||
llvm::CGFT_AssemblyFile);
|
||||
|
||||
@@ -417,21 +417,21 @@ OSOReaderToMaster::hint(string_view hintstring)
|
||||
if (m_master->m_symbols.size()) {
|
||||
// metadata is attached to a particular symbol
|
||||
Symbol& sym(m_master->m_symbols.back());
|
||||
if (type == TypeDesc::TypeInt && ident == "lockgeom"
|
||||
if (type == TypeInt && ident == "lockgeom"
|
||||
&& Strutil::parse_int(h, ival) && ival >= 0)
|
||||
sym.interpolated(!ival); // soft deprecated
|
||||
else if (type == TypeDesc::TypeInt && ident == "interpolated"
|
||||
else if (type == TypeInt && ident == "interpolated"
|
||||
&& Strutil::parse_int(h, ival) && ival >= 0)
|
||||
sym.interpolated(ival);
|
||||
else if (type == TypeDesc::TypeInt && ident == "interactive"
|
||||
else if (type == TypeInt && ident == "interactive"
|
||||
&& Strutil::parse_int(h, ival) && ival >= 0)
|
||||
sym.interactive(ival);
|
||||
else if (type == TypeDesc::TypeInt && ident == "allowconnect"
|
||||
else if (type == TypeInt && ident == "allowconnect"
|
||||
&& Strutil::parse_int(h, ival) && ival >= 0)
|
||||
sym.allowconnect(ival);
|
||||
} else {
|
||||
// metadata is attached at the shader level
|
||||
if (type == TypeDesc::TypeInt && ident == "range_checking"
|
||||
if (type == TypeInt && ident == "range_checking"
|
||||
&& Strutil::parse_int(h, ival) && ival >= 0)
|
||||
m_master->range_checking(ival != 0);
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ ColorSystem::lookup_blackbody_rgb(float T /*Kelvin*/) const
|
||||
constexpr int stride = sizeof(Color3) / sizeof(float);
|
||||
int sti = stride * ti;
|
||||
Color3 rgb = OIIO::lerp(
|
||||
// Have all gathers use the same indices by having different base registers
|
||||
// Have all gathers use the same indices by having different base registers
|
||||
// for each of the 6 components
|
||||
Color3((blackbody_components + 0)[sti], (blackbody_components + 1)[sti],
|
||||
(blackbody_components + 2)[sti]),
|
||||
|
||||
+30
-113
@@ -805,10 +805,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
void clear_symlocs()
|
||||
{
|
||||
m_symlocs.clear();
|
||||
}
|
||||
void clear_symlocs() { m_symlocs.clear(); }
|
||||
void add_symlocs(cspan<SymLocationDesc> symlocs)
|
||||
{
|
||||
for (auto& s : symlocs)
|
||||
@@ -874,7 +871,8 @@ private:
|
||||
void setup_op_descriptors();
|
||||
|
||||
RendererServices* m_renderer; ///< Renderer services
|
||||
TextureSystem* m_texturesys; ///< Texture system
|
||||
std::shared_ptr<TextureSystem> m_texturesys_sp;
|
||||
TextureSystem* m_texturesys; ///< Texture system
|
||||
|
||||
ErrorHandler* m_err; ///< Error handler
|
||||
mutable std::list<std::string> m_errseen, m_warnseen;
|
||||
@@ -1518,10 +1516,7 @@ public:
|
||||
typedef std::vector<SymOverrideInfo> SymOverrideInfoVec;
|
||||
static_assert(sizeof(SymOverrideInfo) == 8, "SymOverrideInfo size");
|
||||
|
||||
SymOverrideInfo* instoverride(int i)
|
||||
{
|
||||
return &m_instoverrides[i];
|
||||
}
|
||||
SymOverrideInfo* instoverride(int i) { return &m_instoverrides[i]; }
|
||||
const SymOverrideInfo* instoverride(int i) const
|
||||
{
|
||||
return &m_instoverrides[i];
|
||||
@@ -1838,19 +1833,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
// Is this shader group equivalent to ret void?
|
||||
bool does_nothing() const
|
||||
{
|
||||
return m_does_nothing;
|
||||
}
|
||||
void does_nothing(bool new_val)
|
||||
{
|
||||
m_does_nothing = new_val;
|
||||
}
|
||||
bool does_nothing() const { return m_does_nothing; }
|
||||
void does_nothing(bool new_val) { m_does_nothing = new_val; }
|
||||
|
||||
long long int executions() const
|
||||
{
|
||||
return m_executions;
|
||||
}
|
||||
long long int executions() const { return m_executions; }
|
||||
|
||||
void start_running()
|
||||
{
|
||||
@@ -1859,25 +1845,13 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void name(ustring name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
ustring name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
void name(ustring name) { m_name = name; }
|
||||
ustring name() const { return m_name; }
|
||||
|
||||
std::string serialize() const;
|
||||
|
||||
void lock() const
|
||||
{
|
||||
m_mutex.lock();
|
||||
}
|
||||
void unlock() const
|
||||
{
|
||||
m_mutex.unlock();
|
||||
}
|
||||
void lock() const { m_mutex.lock(); }
|
||||
void unlock() const { m_mutex.unlock(); }
|
||||
|
||||
// Find which layer index corresponds to the layer name. Return -1 if
|
||||
// not found.
|
||||
@@ -1889,10 +1863,7 @@ public:
|
||||
|
||||
/// Return a unique ID of this group.
|
||||
///
|
||||
int id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
int id() const { return m_id; }
|
||||
|
||||
/// Mark all layers as not entry points and set m_num_entry_layers to 0.
|
||||
void clear_entry_layers();
|
||||
@@ -1906,15 +1877,9 @@ public:
|
||||
mark_entry_layer(find_layer(layername));
|
||||
}
|
||||
|
||||
int num_entry_layers() const
|
||||
{
|
||||
return m_num_entry_layers;
|
||||
}
|
||||
int num_entry_layers() const { return m_num_entry_layers; }
|
||||
|
||||
bool is_last_layer(int layer) const
|
||||
{
|
||||
return layer == nlayers() - 1;
|
||||
}
|
||||
bool is_last_layer(int layer) const { return layer == nlayers() - 1; }
|
||||
|
||||
/// Is the given layer an entry point? It is if explicitly tagged as
|
||||
/// such, or if no layers are so tagged then the last layer is the one
|
||||
@@ -1925,10 +1890,7 @@ public:
|
||||
: is_last_layer(layer);
|
||||
}
|
||||
|
||||
int raytype_queries() const
|
||||
{
|
||||
return m_raytype_queries;
|
||||
}
|
||||
int raytype_queries() const { return m_raytype_queries; }
|
||||
|
||||
/// Optionally set which ray types are known to be on or off (0 means
|
||||
/// not known at optimize time).
|
||||
@@ -1937,19 +1899,10 @@ public:
|
||||
m_raytypes_on = raytypes_on;
|
||||
m_raytypes_off = raytypes_off;
|
||||
}
|
||||
int raytypes_on() const
|
||||
{
|
||||
return m_raytypes_on;
|
||||
}
|
||||
int raytypes_off() const
|
||||
{
|
||||
return m_raytypes_off;
|
||||
}
|
||||
int raytypes_on() const { return m_raytypes_on; }
|
||||
int raytypes_off() const { return m_raytypes_off; }
|
||||
|
||||
void clear_symlocs()
|
||||
{
|
||||
m_symlocs.clear();
|
||||
}
|
||||
void clear_symlocs() { m_symlocs.clear(); }
|
||||
void add_symlocs(cspan<SymLocationDesc> symlocs)
|
||||
{
|
||||
for (auto& s : symlocs) {
|
||||
@@ -1989,10 +1942,7 @@ public:
|
||||
// live with the group and copy the initial data.
|
||||
void setup_interactive_arena(cspan<uint8_t> paramblock);
|
||||
|
||||
uint8_t* interactive_arena_ptr()
|
||||
{
|
||||
return m_interactive_arena.get();
|
||||
}
|
||||
uint8_t* interactive_arena_ptr() { return m_interactive_arena.get(); }
|
||||
|
||||
device_ptr<uint8_t>& device_interactive_arena()
|
||||
{
|
||||
@@ -2331,25 +2281,13 @@ public:
|
||||
|
||||
/// Return a pointer to the shading group for this context.
|
||||
///
|
||||
ShaderGroup* group()
|
||||
{
|
||||
return m_group;
|
||||
}
|
||||
const ShaderGroup* group() const
|
||||
{
|
||||
return m_group;
|
||||
}
|
||||
void group(ShaderGroup* grp)
|
||||
{
|
||||
m_group = grp;
|
||||
}
|
||||
ShaderGroup* group() { return m_group; }
|
||||
const ShaderGroup* group() const { return m_group; }
|
||||
void group(ShaderGroup* grp) { m_group = grp; }
|
||||
|
||||
/// Return a reference to the MessageList containing messages.
|
||||
///
|
||||
MessageList& messages()
|
||||
{
|
||||
return m_messages;
|
||||
}
|
||||
MessageList& messages() { return m_messages; }
|
||||
#if OSL_USE_BATCHED
|
||||
BatchedMessageBuffer& batched_messages_buffer()
|
||||
{
|
||||
@@ -2376,10 +2314,7 @@ public:
|
||||
int array_lookup, int index, TypeDesc attr_type,
|
||||
void* attr_dest);
|
||||
|
||||
PerThreadInfo* thread_info() const
|
||||
{
|
||||
return m_threadinfo;
|
||||
}
|
||||
PerThreadInfo* thread_info() const { return m_threadinfo; }
|
||||
|
||||
TextureSystem::Perthread* texture_thread_info() const
|
||||
{
|
||||
@@ -2399,20 +2334,11 @@ public:
|
||||
return thread_info()->llvm_thread_info;
|
||||
}
|
||||
|
||||
TextureOpt* texture_options_ptr()
|
||||
{
|
||||
return &m_textureopt;
|
||||
}
|
||||
TextureOpt* texture_options_ptr() { return &m_textureopt; }
|
||||
|
||||
RendererServices::NoiseOpt* noise_options_ptr()
|
||||
{
|
||||
return &m_noiseopt;
|
||||
}
|
||||
RendererServices::NoiseOpt* noise_options_ptr() { return &m_noiseopt; }
|
||||
|
||||
RendererServices::TraceOpt* trace_options_ptr()
|
||||
{
|
||||
return &m_traceopt;
|
||||
}
|
||||
RendererServices::TraceOpt* trace_options_ptr() { return &m_traceopt; }
|
||||
|
||||
void* alloc_scratch(size_t size, size_t align = 1)
|
||||
{
|
||||
@@ -2423,15 +2349,9 @@ public:
|
||||
bool ocio_transform(StringParam fromspace, StringParam tospace,
|
||||
const Color& C, Color& Cout);
|
||||
|
||||
void incr_layers_executed()
|
||||
{
|
||||
++m_stat_layers_executed;
|
||||
}
|
||||
void incr_layers_executed() { ++m_stat_layers_executed; }
|
||||
|
||||
void incr_get_userdata_calls()
|
||||
{
|
||||
++m_stat_get_userdata_calls;
|
||||
}
|
||||
void incr_get_userdata_calls() { ++m_stat_get_userdata_calls; }
|
||||
|
||||
// Clear the stats we record per-execution in this context (unlocked)
|
||||
void clear_runtime_stats()
|
||||
@@ -2581,10 +2501,7 @@ private:
|
||||
// When interpreting symbol addresses we need to know if the
|
||||
// wide data offsets should be used
|
||||
int batch_size_executed;
|
||||
bool execution_is_batched() const
|
||||
{
|
||||
return batch_size_executed != 0;
|
||||
}
|
||||
bool execution_is_batched() const { return batch_size_executed != 0; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -330,14 +330,14 @@ inline TypeDesc
|
||||
OSL::pvt::osolextype (int lex)
|
||||
{
|
||||
switch (lex) {
|
||||
case COLORTYPE : return TypeDesc::TypeColor;
|
||||
case FLOATTYPE : return TypeDesc::TypeFloat;
|
||||
case INTTYPE : return TypeDesc::TypeInt;
|
||||
case MATRIXTYPE : return TypeDesc::TypeMatrix;
|
||||
case NORMALTYPE : return TypeDesc::TypeNormal;
|
||||
case POINTTYPE : return TypeDesc::TypePoint;
|
||||
case STRINGTYPE : return TypeDesc::TypeString;
|
||||
case VECTORTYPE : return TypeDesc::TypeVector;
|
||||
case COLORTYPE : return TypeColor;
|
||||
case FLOATTYPE : return TypeFloat;
|
||||
case INTTYPE : return TypeInt;
|
||||
case MATRIXTYPE : return TypeMatrix;
|
||||
case NORMALTYPE : return TypeNormal;
|
||||
case POINTTYPE : return TypePoint;
|
||||
case STRINGTYPE : return TypeString;
|
||||
case VECTORTYPE : return TypeVector;
|
||||
case VOIDTYPE : return TypeDesc::NONE;
|
||||
default: return TypeDesc::UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
|
||||
|
||||
#include <cstdarg>
|
||||
#include <sstream>
|
||||
|
||||
#include "pointcloud.h"
|
||||
|
||||
@@ -29,7 +30,13 @@ PointCloud::get(ustringhash filename, bool write)
|
||||
// Not found. Create a new one.
|
||||
Partio::ParticlesDataMutable* partio_cloud = nullptr;
|
||||
if (!write) {
|
||||
partio_cloud = Partio::read(filename.c_str(), false);
|
||||
// Mute Partio error prints: by default Partio::read sends errors directly
|
||||
// to std::err, but in most cases we want errors to go via errorfmt so the
|
||||
// renderer can recognize the message as an error, as we do in
|
||||
// pointcloud_search and pointcloud_get.
|
||||
std::stringstream m_errorStream;
|
||||
|
||||
partio_cloud = Partio::read(filename.c_str(), false, m_errorStream);
|
||||
if (!partio_cloud)
|
||||
return nullptr;
|
||||
} else {
|
||||
|
||||
@@ -72,13 +72,13 @@ struct SortedPointCompare {
|
||||
inline Partio::ParticleAttributeType
|
||||
PartioType(TypeDesc t)
|
||||
{
|
||||
if (t == TypeDesc::TypeFloat)
|
||||
if (t == TypeFloat)
|
||||
return Partio::FLOAT;
|
||||
if (t.basetype == TypeDesc::FLOAT && t.aggregate == TypeDesc::VEC3)
|
||||
return Partio::VECTOR;
|
||||
if (t == TypeDesc::TypeInt)
|
||||
if (t == TypeInt)
|
||||
return Partio::INT;
|
||||
if (t == TypeDesc::TypeString)
|
||||
if (t == TypeString)
|
||||
return Partio::INDEXEDSTR;
|
||||
return Partio::NONE;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,14 @@ using namespace OSL::pvt;
|
||||
OSL_NAMESPACE_ENTER
|
||||
|
||||
|
||||
#ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
namespace {
|
||||
std::mutex shared_texturesys_mutex;
|
||||
std::shared_ptr<TextureSystem> shared_texturesys;
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
RendererServices::RendererServices(TextureSystem* texsys) : m_texturesys(texsys)
|
||||
{
|
||||
@@ -31,7 +39,17 @@ RendererServices::RendererServices(TextureSystem* texsys) : m_texturesys(texsys)
|
||||
OSL_ASSERT(
|
||||
0 && "RendererServices was not passed a working TextureSystem*");
|
||||
#else
|
||||
# ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(shared_texturesys_mutex);
|
||||
if (!shared_texturesys) {
|
||||
shared_texturesys = TextureSystem::create(true /* shared */);
|
||||
}
|
||||
m_texturesys = shared_texturesys.get();
|
||||
}
|
||||
# else
|
||||
m_texturesys = TextureSystem::create(true /* shared */);
|
||||
# endif
|
||||
// Make some good guesses about default options
|
||||
m_texturesys->attribute("automip", 1);
|
||||
m_texturesys->attribute("autotile", 64);
|
||||
|
||||
@@ -42,6 +42,8 @@ static ustring u_setmessage("setmessage");
|
||||
static ustring u_getmessage("getmessage");
|
||||
static ustring u_getattribute("getattribute");
|
||||
static ustring u_backfacing("backfacing");
|
||||
static ustring u_calculatenormal("calculatenormal");
|
||||
static ustring u_flipHandedness("flipHandedness");
|
||||
static ustring u_N("N");
|
||||
static ustring u_I("I");
|
||||
|
||||
@@ -2499,8 +2501,9 @@ RuntimeOptimizer::resolve_isconnected()
|
||||
bool upconnected = s->connected();
|
||||
if (s->interpolated() && shadingsys().userdata_isconnected())
|
||||
upconnected = true;
|
||||
int val = (upconnected ? 1 : 0) + (s->connected_down() ? 2 : 0);
|
||||
turn_into_assign(op, add_constant(TypeDesc::TypeInt, &val),
|
||||
bool downconnected = s->connected_down() || s->renderer_output();
|
||||
int val = (upconnected ? 1 : 0) + (downconnected ? 2 : 0);
|
||||
turn_into_assign(op, add_constant(TypeInt, &val),
|
||||
"resolve isconnected()");
|
||||
}
|
||||
}
|
||||
@@ -3350,8 +3353,9 @@ RuntimeOptimizer::run()
|
||||
m_unknown_closures_needed = true;
|
||||
}
|
||||
} else if (op.opname() == u_backfacing) {
|
||||
m_globals_needed.insert(u_N);
|
||||
m_globals_needed.insert(u_I);
|
||||
m_globals_needed.insert(u_backfacing);
|
||||
} else if (op.opname() == u_calculatenormal) {
|
||||
m_globals_needed.insert(u_flipHandedness);
|
||||
} else if (op.opname() == u_getattribute) {
|
||||
Symbol* sym1 = opargsym(op, 1);
|
||||
OSL_DASSERT(sym1 && sym1->typespec().is_string());
|
||||
|
||||
@@ -81,20 +81,11 @@ public:
|
||||
/// and returning its index.
|
||||
int add_constant(const TypeSpec& type, const void* data,
|
||||
TypeDesc datatype = TypeDesc::UNKNOWN);
|
||||
int add_constant(float c) { return add_constant(TypeDesc::TypeFloat, &c); }
|
||||
int add_constant(int c) { return add_constant(TypeDesc::TypeInt, &c); }
|
||||
int add_constant(ustring s)
|
||||
{
|
||||
return add_constant(TypeDesc::TypeString, &s);
|
||||
}
|
||||
int add_constant(const Matrix44& c)
|
||||
{
|
||||
return add_constant(TypeDesc::TypeMatrix, &c);
|
||||
}
|
||||
int add_constantc(const Color3& c)
|
||||
{
|
||||
return add_constant(TypeDesc::TypeColor, &c);
|
||||
}
|
||||
int add_constant(float c) { return add_constant(TypeFloat, &c); }
|
||||
int add_constant(int c) { return add_constant(TypeInt, &c); }
|
||||
int add_constant(ustring s) { return add_constant(TypeString, &s); }
|
||||
int add_constant(const Matrix44& c) { return add_constant(TypeMatrix, &c); }
|
||||
int add_constantc(const Color3& c) { return add_constant(TypeColor, &c); }
|
||||
int add_constantv(const Vec3& c, const TypeSpec& vectype)
|
||||
{
|
||||
return add_constant(vectype, &c);
|
||||
@@ -102,7 +93,7 @@ public:
|
||||
int add_constant(string_view s)
|
||||
{
|
||||
ustring u(s);
|
||||
return add_constant(TypeDesc::TypeString, &s);
|
||||
return add_constant(TypeString, &s);
|
||||
}
|
||||
|
||||
/// Create a new temporary variable of the given type, return its index.
|
||||
|
||||
@@ -905,17 +905,17 @@ ShadingSystem::convert_value(void* dst, TypeDesc dsttype, const void* src,
|
||||
tmp_int = *(const unsigned char*)src;
|
||||
src = &tmp_int;
|
||||
}
|
||||
srctype = TypeDesc::TypeInt;
|
||||
srctype = TypeInt;
|
||||
}
|
||||
|
||||
float tmp_float;
|
||||
if (srctype == TypeDesc::TypeInt && dsttype.basetype == TypeDesc::FLOAT) {
|
||||
if (srctype == TypeInt && dsttype.basetype == TypeDesc::FLOAT) {
|
||||
// int -> float-based : up-convert the source to float
|
||||
if (src) {
|
||||
tmp_float = (float)(*(const int*)src);
|
||||
src = &tmp_float;
|
||||
}
|
||||
srctype = TypeDesc::TypeFloat;
|
||||
srctype = TypeFloat;
|
||||
}
|
||||
|
||||
// Just copy equivalent types
|
||||
@@ -925,9 +925,9 @@ ShadingSystem::convert_value(void* dst, TypeDesc dsttype, const void* src,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (srctype == TypeDesc::TypeFloat) {
|
||||
if (srctype == TypeFloat) {
|
||||
// float->triple conversion
|
||||
if (equivalent(dsttype, TypeDesc::TypePoint)) {
|
||||
if (equivalent(dsttype, TypePoint)) {
|
||||
if (dst && src) {
|
||||
float f = *(const float*)src;
|
||||
((OSL::Vec3*)dst)->setValue(f, f, f);
|
||||
@@ -935,7 +935,7 @@ ShadingSystem::convert_value(void* dst, TypeDesc dsttype, const void* src,
|
||||
return true;
|
||||
}
|
||||
// float->int
|
||||
if (dsttype == TypeDesc::TypeInt) {
|
||||
if (dsttype == TypeInt) {
|
||||
if (dst && src)
|
||||
*(int*)dst = (int)*(const float*)src;
|
||||
return true;
|
||||
@@ -964,26 +964,23 @@ ShadingSystem::convert_value(void* dst, TypeDesc dsttype, const void* src,
|
||||
}
|
||||
|
||||
// float[3] -> triple
|
||||
if ((srctype == TypeFloatArray3 && equivalent(dsttype, TypeDesc::TypePoint))
|
||||
|| (dsttype == TypeFloatArray3
|
||||
&& equivalent(srctype, TypeDesc::TypePoint))) {
|
||||
if ((srctype == TypeFloatArray3 && equivalent(dsttype, TypePoint))
|
||||
|| (dsttype == TypeFloatArray3 && equivalent(srctype, TypePoint))) {
|
||||
if (dst && src)
|
||||
memmove(dst, src, dsttype.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
// float[4] -> vec4
|
||||
if ((srctype == TypeFloatArray4 && equivalent(dsttype, TypeDesc::TypeFloat4))
|
||||
|| (dsttype == TypeFloatArray4
|
||||
&& equivalent(srctype, TypeDesc::TypeFloat4))) {
|
||||
if ((srctype == TypeFloatArray4 && equivalent(dsttype, TypeFloat4))
|
||||
|| (dsttype == TypeFloatArray4 && equivalent(srctype, TypeFloat4))) {
|
||||
if (dst && src)
|
||||
memmove(dst, src, dsttype.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
// float[2] -> triple
|
||||
if (srctype == TypeFloatArray2
|
||||
&& equivalent(dsttype, TypeDesc::TypePoint)) {
|
||||
if (srctype == TypeFloatArray2 && equivalent(dsttype, TypePoint)) {
|
||||
if (dst && src) {
|
||||
float f0 = ((const float*)src)[0];
|
||||
float f1 = ((const float*)src)[1];
|
||||
@@ -1203,7 +1200,12 @@ ShadingSystemImpl::ShadingSystemImpl(RendererServices* renderer,
|
||||
OSL_ASSERT(0
|
||||
&& "ShadingSystem was not passed a working TextureSystem*");
|
||||
#else
|
||||
# if OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
m_texturesys_sp = TextureSystem::create(true /* shared */);
|
||||
m_texturesys = m_texturesys_sp.get();
|
||||
# else
|
||||
m_texturesys = TextureSystem::create(true /* shared */);
|
||||
# endif
|
||||
// Make some good guesses about default options
|
||||
m_texturesys->attribute("automip", 1);
|
||||
m_texturesys->attribute("autotile", 64);
|
||||
@@ -2031,11 +2033,11 @@ ShadingSystemImpl::attribute(ShaderGroup* group, string_view name,
|
||||
group->mark_entry_layer(ustring(((const char**)val)[i]));
|
||||
return true;
|
||||
}
|
||||
if (name == "exec_repeat" && type == TypeDesc::TypeInt) {
|
||||
if (name == "exec_repeat" && type == TypeInt) {
|
||||
group->m_exec_repeat = *(const int*)val;
|
||||
return true;
|
||||
}
|
||||
if (name == "groupname" && type == TypeDesc::TypeString) {
|
||||
if (name == "groupname" && type == TypeString) {
|
||||
group->name(ustring(((const char**)val)[0]));
|
||||
return true;
|
||||
}
|
||||
@@ -2051,11 +2053,11 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
if (!group)
|
||||
return false;
|
||||
|
||||
if (name == "groupname" && type == TypeDesc::TypeString) {
|
||||
if (name == "groupname" && type == TypeString) {
|
||||
*(ustring*)val = group->name();
|
||||
return true;
|
||||
}
|
||||
if (name == "num_layers" && type == TypeDesc::TypeInt) {
|
||||
if (name == "num_layers" && type == TypeInt) {
|
||||
*(int*)val = group->nlayers();
|
||||
return true;
|
||||
}
|
||||
@@ -2123,7 +2125,7 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
*(ustring*)val = ustring(group->serialize());
|
||||
return true;
|
||||
}
|
||||
if (name == "exec_repeat" && type == TypeDesc::TypeInt) {
|
||||
if (name == "exec_repeat" && type == TypeInt) {
|
||||
*(int*)val = group->m_exec_repeat;
|
||||
return true;
|
||||
}
|
||||
@@ -2151,7 +2153,7 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
destroy_thread_info(threadinfo);
|
||||
}
|
||||
|
||||
if (name == "num_textures_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "num_textures_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_textures_needed.size();
|
||||
return true;
|
||||
}
|
||||
@@ -2160,12 +2162,12 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
*(ustring**)val = n ? &group->m_textures_needed[0] : NULL;
|
||||
return true;
|
||||
}
|
||||
if (name == "unknown_textures_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "unknown_textures_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_unknown_textures_needed;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (name == "num_closures_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "num_closures_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_closures_needed.size();
|
||||
return true;
|
||||
}
|
||||
@@ -2174,12 +2176,12 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
*(ustring**)val = n ? &group->m_closures_needed[0] : NULL;
|
||||
return true;
|
||||
}
|
||||
if (name == "unknown_closures_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "unknown_closures_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_unknown_closures_needed;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (name == "num_globals_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "num_globals_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_globals_needed.size();
|
||||
return true;
|
||||
}
|
||||
@@ -2197,7 +2199,7 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (name == "num_userdata" && type == TypeDesc::TypeInt) {
|
||||
if (name == "num_userdata" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_userdata_names.size();
|
||||
return true;
|
||||
}
|
||||
@@ -2221,7 +2223,7 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
*(char**)val = n ? &group->m_userdata_derivs[0] : NULL;
|
||||
return true;
|
||||
}
|
||||
if (name == "num_attributes_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "num_attributes_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_attributes_needed.size();
|
||||
return true;
|
||||
}
|
||||
@@ -2240,11 +2242,11 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
*(TypeDesc**)val = n ? &group->m_attribute_types[0] : NULL;
|
||||
return true;
|
||||
}
|
||||
if (name == "unknown_attributes_needed" && type == TypeDesc::TypeInt) {
|
||||
if (name == "unknown_attributes_needed" && type == TypeInt) {
|
||||
*(int*)val = (int)group->m_unknown_attributes_needed;
|
||||
return true;
|
||||
}
|
||||
if (name == "group_id" && type == TypeDesc::TypeInt) {
|
||||
if (name == "group_id" && type == TypeInt) {
|
||||
*(int*)val = (int)group->id();
|
||||
return true;
|
||||
}
|
||||
@@ -2260,7 +2262,7 @@ ShadingSystemImpl::getattribute(ShaderGroup* group, string_view name,
|
||||
*(void**)val = n ? &group->m_userdata_init_vals[0] : NULL;
|
||||
return true;
|
||||
}
|
||||
if (name == "llvm_groupdata_size" && type == TypeDesc::TypeInt) {
|
||||
if (name == "llvm_groupdata_size" && type == TypeInt) {
|
||||
*(int*)val = (int)group->llvm_groupdata_size();
|
||||
return true;
|
||||
}
|
||||
@@ -3089,21 +3091,21 @@ ShadingSystemImpl::ShaderGroupBegin(string_view groupname, string_view usage,
|
||||
}
|
||||
TypeDesc type;
|
||||
if (typestring == "int")
|
||||
type = TypeDesc::TypeInt;
|
||||
type = TypeInt;
|
||||
else if (typestring == "float")
|
||||
type = TypeDesc::TypeFloat;
|
||||
type = TypeFloat;
|
||||
else if (typestring == "color")
|
||||
type = TypeDesc::TypeColor;
|
||||
type = TypeColor;
|
||||
else if (typestring == "point")
|
||||
type = TypeDesc::TypePoint;
|
||||
type = TypePoint;
|
||||
else if (typestring == "vector")
|
||||
type = TypeDesc::TypeVector;
|
||||
type = TypeVector;
|
||||
else if (typestring == "normal")
|
||||
type = TypeDesc::TypeNormal;
|
||||
type = TypeNormal;
|
||||
else if (typestring == "matrix")
|
||||
type = TypeDesc::TypeMatrix;
|
||||
type = TypeMatrix;
|
||||
else if (typestring == "string")
|
||||
type = TypeDesc::TypeString;
|
||||
type = TypeString;
|
||||
else {
|
||||
err = true;
|
||||
errdesc = fmtformat("Unknown type: {}", typestring);
|
||||
@@ -4591,7 +4593,7 @@ osl_naninf_check(int ncomps, const void* vals_, int has_derivs, void* sg,
|
||||
for (int d = 0; d < (has_derivs ? 3 : 1); ++d) {
|
||||
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
|
||||
int i = d * ncomps + c;
|
||||
if (!OIIO::isfinite(vals[i])) {
|
||||
if (!std::isfinite(vals[i])) {
|
||||
OSL::errorfmt(ec, "Detected {} value in {}{} at {}:{} (op {})",
|
||||
vals[i], d > 0 ? "the derivatives of " : "",
|
||||
OSL::ustringhash_from(symbolname_),
|
||||
@@ -4627,7 +4629,7 @@ osl_uninit_check(long long typedesc_, void* vals_, void* sg,
|
||||
if (typedesc.basetype == TypeDesc::FLOAT) {
|
||||
float* vals = (float*)vals_;
|
||||
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
|
||||
if (!OIIO::isfinite(vals[c])) {
|
||||
if (!std::isfinite(vals[c])) {
|
||||
uninit = true;
|
||||
vals[c] = 0;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace pvt {
|
||||
|
||||
OIIO_CONSTEXPR14 inline size_t
|
||||
constexpr inline size_t
|
||||
pvtstrlen(const char* s)
|
||||
{
|
||||
if (s == nullptr)
|
||||
@@ -23,7 +23,7 @@ pvtstrlen(const char* s)
|
||||
} // namespace pvt
|
||||
|
||||
namespace UStringHash {
|
||||
OIIO_CONSTEXPR14 inline size_t
|
||||
constexpr inline size_t
|
||||
Hash(const char* s)
|
||||
{
|
||||
size_t len = pvt::pvtstrlen(s);
|
||||
|
||||
@@ -74,8 +74,8 @@ __OSL_MASKED_OP3(dict_find, Wi, Wi, Ws)(void* bsg_, void* wout, void* wnodeID,
|
||||
int nodeID = wNID[lane];
|
||||
ustring query = wQ[lane];
|
||||
wOut[lane] = bsg->uniform.context->dict_find(
|
||||
nullptr /*causes errors be reported through ShadingContext*/,
|
||||
nodeID, query);
|
||||
nullptr /*causes errors be reported through ShadingContext*/,
|
||||
nodeID, query);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ __OSL_MASKED_OP3(dict_find, Wi, Ws, Ws)(void* bsg_, void* wout,
|
||||
ustring dictionary = wD[lane];
|
||||
ustring query = wQ[lane];
|
||||
wOut[lane] = bsg->uniform.context->dict_find(
|
||||
nullptr /*causes errors be reported through ShadingContext*/,
|
||||
dictionary, query);
|
||||
nullptr /*causes errors be reported through ShadingContext*/,
|
||||
dictionary, query);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -300,8 +300,8 @@ splineinverse_search(const MatrixT& M, R_T& result, X_T& xval, KArrayT knots,
|
||||
// We can NOT use the low and high knot values,
|
||||
// so will need to extract 2 more knot values
|
||||
// to detect if we are increasing
|
||||
K_T k1 = knots[1]; // knots is proxy, must export to local
|
||||
K_T k2 = knots[knot_count - 2];
|
||||
K_T k1 = knots[1]; // knots is proxy, must export to local
|
||||
K_T k2 = knots[knot_count - 2];
|
||||
increasing = k1 < k2;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,17 +25,14 @@ OSL_USING_DATA_WIDTH(__OSL_WIDTH)
|
||||
|
||||
#include "define_opname_macros.h"
|
||||
|
||||
#define __OSL_XMACRO_ARGS (isnan, OIIO::isnan)
|
||||
//#define __OSL_XMACRO_ARGS (isnan,std::isnan)
|
||||
#define __OSL_XMACRO_ARGS (isnan, std::isnan)
|
||||
#include "wide_optest_float_xmacro.h"
|
||||
|
||||
#define __OSL_XMACRO_ARGS (isinf, OIIO::isinf)
|
||||
#define __OSL_XMACRO_ARGS (isinf, std::isinf)
|
||||
//#define __OSL_XMACRO_ARGS (isinf, sfm::isinf)
|
||||
//#define __OSL_XMACRO_ARGS (isinf, std::isinf)
|
||||
#include "wide_optest_float_xmacro.h"
|
||||
|
||||
#define __OSL_XMACRO_ARGS (isfinite, OIIO::isfinite)
|
||||
//#define __OSL_XMACRO_ARGS (isfinite,std::isfinite)
|
||||
#define __OSL_XMACRO_ARGS (isfinite, std::isfinite)
|
||||
#include "wide_optest_float_xmacro.h"
|
||||
|
||||
|
||||
|
||||
@@ -112,19 +112,11 @@ default_texture(BatchedRendererServices* bsr, ustring filename,
|
||||
float dsdy = wdsdy[lane];
|
||||
float dtdy = wdtdy[lane];
|
||||
retVal = bsr->texturesys()->texture(
|
||||
texture_handle, texture_thread_info, opt, ws[lane], wt[lane], dsdx,
|
||||
dtdx, dsdy, dtdy, 4, (float*)&result_simd,
|
||||
texture_handle, texture_thread_info, opt, ws[lane], wt[lane], dsdx,
|
||||
dtdx, dsdy, dtdy, 4, (float*)&result_simd,
|
||||
has_derivs ? (float*)&dresultds_simd : NULL,
|
||||
has_derivs ? (float*)&dresultdt_simd : NULL);
|
||||
|
||||
OIIO::simd::vfloat4 dresultdx_simd;
|
||||
OIIO::simd::vfloat4 dresultdy_simd;
|
||||
if (has_derivs) {
|
||||
// Correct our st texture space gradients into xy-space gradients
|
||||
dresultdx_simd = dresultds_simd * dsdx + dresultdt_simd * dtdx;
|
||||
dresultdy_simd = dresultds_simd * dsdy + dresultdt_simd * dtdy;
|
||||
}
|
||||
|
||||
// NOTE: regardless of the value of "retVal" we will always copy over the texture system's results.
|
||||
// We are relying on the texture system properly filling in missing or fill colors
|
||||
|
||||
@@ -142,10 +134,10 @@ default_texture(BatchedRendererServices* bsr, ustring filename,
|
||||
MaskedDx<Color3> resultDx(resultRef);
|
||||
MaskedDy<Color3> resultDy(resultRef);
|
||||
|
||||
resultDx[lane] = Color3(dresultdx_simd[0], dresultdx_simd[1],
|
||||
dresultdx_simd[2]);
|
||||
resultDy[lane] = Color3(dresultdy_simd[0], dresultdy_simd[1],
|
||||
dresultdy_simd[2]);
|
||||
resultDx[lane] = Color3(dresultds_simd[0], dresultds_simd[1],
|
||||
dresultds_simd[2]);
|
||||
resultDy[lane] = Color3(dresultdt_simd[0], dresultdt_simd[1],
|
||||
dresultdt_simd[2]);
|
||||
}
|
||||
} else if (Masked<float>::is(resultRef)) {
|
||||
alphaChannelIndex = 1;
|
||||
@@ -154,8 +146,8 @@ default_texture(BatchedRendererServices* bsr, ustring filename,
|
||||
MaskedDy<float> resultDy(resultRef);
|
||||
result[lane] = result_simd[0];
|
||||
if (resultRef.has_derivs()) {
|
||||
resultDx[lane] = dresultdx_simd[0];
|
||||
resultDy[lane] = dresultdy_simd[0];
|
||||
resultDx[lane] = dresultds_simd[0];
|
||||
resultDy[lane] = dresultdt_simd[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,8 +157,8 @@ default_texture(BatchedRendererServices* bsr, ustring filename,
|
||||
if (alphaRef.has_derivs()) {
|
||||
MaskedDx<float> alphaDx(alphaRef);
|
||||
MaskedDy<float> alphaDy(alphaRef);
|
||||
alphaDx[lane] = dresultdx_simd[alphaChannelIndex];
|
||||
alphaDy[lane] = dresultdy_simd[alphaChannelIndex];
|
||||
alphaDx[lane] = dresultds_simd[alphaChannelIndex];
|
||||
alphaDy[lane] = dresultdt_simd[alphaChannelIndex];
|
||||
}
|
||||
}
|
||||
//std::cout << "s: " << s.get(i) << " t: " << t.get(i) << " color: " << resultColor << " " << wideResult.get(i) << std::endl;
|
||||
@@ -311,16 +303,6 @@ default_texture3d(BatchedRendererServices* bsr, ustring filename,
|
||||
has_derivs ? (float*)&dresultdt_simd : nullptr,
|
||||
has_derivs ? (float*)&dresultdr_simd : nullptr);
|
||||
|
||||
OIIO::simd::vfloat4 dresultdx_simd;
|
||||
OIIO::simd::vfloat4 dresultdy_simd;
|
||||
if (has_derivs) {
|
||||
// Correct our str texture space gradients into xyz-space gradients
|
||||
dresultdx_simd = dresultds_simd * dPdx.x + dresultdt_simd * dPdx.y
|
||||
+ dresultdr_simd * dPdx.z;
|
||||
dresultdy_simd = dresultds_simd * dPdy.x + dresultdt_simd * dPdy.y
|
||||
+ dresultdr_simd * dPdy.z;
|
||||
}
|
||||
|
||||
// NOTE: regardless of the value of "retVal" we will always copy over the texture system's results.
|
||||
// We are relying on the texture system properly filling in missing or fill colors
|
||||
|
||||
@@ -337,10 +319,10 @@ default_texture3d(BatchedRendererServices* bsr, ustring filename,
|
||||
if (resultRef.has_derivs()) {
|
||||
MaskedDx<Color3> resultDx(resultRef);
|
||||
MaskedDy<Color3> resultDy(resultRef);
|
||||
resultDx[lane] = Color3(dresultdx_simd[0], dresultdx_simd[1],
|
||||
dresultdx_simd[2]);
|
||||
resultDy[lane] = Color3(dresultdy_simd[0], dresultdy_simd[1],
|
||||
dresultdy_simd[2]);
|
||||
resultDx[lane] = Color3(dresultds_simd[0], dresultds_simd[1],
|
||||
dresultds_simd[2]);
|
||||
resultDy[lane] = Color3(dresultdt_simd[0], dresultdt_simd[1],
|
||||
dresultdt_simd[2]);
|
||||
}
|
||||
} else if (Masked<float>::is(resultRef)) {
|
||||
alphaChannelIndex = 1;
|
||||
@@ -349,8 +331,8 @@ default_texture3d(BatchedRendererServices* bsr, ustring filename,
|
||||
if (resultRef.has_derivs()) {
|
||||
MaskedDx<float> resultDx(resultRef);
|
||||
MaskedDy<float> resultDy(resultRef);
|
||||
resultDx[lane] = dresultdx_simd[0];
|
||||
resultDy[lane] = dresultdy_simd[0];
|
||||
resultDx[lane] = dresultds_simd[0];
|
||||
resultDy[lane] = dresultdt_simd[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,8 +343,8 @@ default_texture3d(BatchedRendererServices* bsr, ustring filename,
|
||||
if (alphaRef.has_derivs()) {
|
||||
MaskedDx<float> alphaDx(alphaRef);
|
||||
MaskedDy<float> alphaDy(alphaRef);
|
||||
alphaDx[lane] = dresultdx_simd[alphaChannelIndex];
|
||||
alphaDy[lane] = dresultdy_simd[alphaChannelIndex];
|
||||
alphaDx[lane] = dresultds_simd[alphaChannelIndex];
|
||||
alphaDy[lane] = dresultdt_simd[alphaChannelIndex];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,6 +543,164 @@ dispatch_environment(BatchedRendererServices* bsr, ustring filename,
|
||||
} // namespace
|
||||
|
||||
|
||||
static OSL_NOINLINE void
|
||||
transformWideTextureGradients(BatchedTextureOutputs& outputs,
|
||||
Wide<const float> dsdx, Wide<const float> dtdx,
|
||||
Wide<const float> dsdy, Wide<const float> dtdy)
|
||||
{
|
||||
MaskedData resultRef = outputs.result();
|
||||
if (resultRef.valid() && resultRef.has_derivs()) {
|
||||
if (Masked<float>::is(resultRef)) {
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
{
|
||||
MaskedDx<float> drds(resultRef);
|
||||
MaskedDy<float> drdt(resultRef);
|
||||
|
||||
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
|
||||
for (int i = 0; i < __OSL_WIDTH; ++i) {
|
||||
float drdsVal = drds[i];
|
||||
float drdtVal = drdt[i];
|
||||
float drdx = drdsVal * dsdx[i] + drdtVal * dtdx[i];
|
||||
float drdy = drdsVal * dsdy[i] + drdtVal * dtdy[i];
|
||||
drds[i] = drdx;
|
||||
drdt[i] = drdy;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// keep assert out of inlined code
|
||||
OSL_DASSERT(Masked<Color3>::is(resultRef));
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
{
|
||||
//printf("doint color\n");
|
||||
MaskedDx<Color3> widedrds(resultRef);
|
||||
MaskedDy<Color3> widedrdt(resultRef);
|
||||
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
|
||||
for (int i = 0; i < __OSL_WIDTH; ++i) {
|
||||
Color3 drdsColor = widedrds[i];
|
||||
Color3 drdtColor = widedrdt[i];
|
||||
|
||||
widedrds[i] = drdsColor * dsdx[i] + drdtColor * dtdx[i];
|
||||
widedrdt[i] = drdsColor * dsdy[i] + drdtColor * dtdy[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MaskedData alphaRef = outputs.alpha();
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
if (alphaRef.valid() && alphaRef.has_derivs()) {
|
||||
MaskedDx<float> dads(alphaRef);
|
||||
MaskedDy<float> dadt(alphaRef);
|
||||
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
|
||||
for (int i = 0; i < __OSL_WIDTH; ++i) {
|
||||
float dadsVal = dads[i];
|
||||
float dadtVal = dadt[i];
|
||||
float dadx = dadsVal * dsdx[i] + dadtVal * dtdx[i];
|
||||
float dady = dadsVal * dsdy[i] + dadtVal * dtdy[i];
|
||||
dads[i] = dadx;
|
||||
dadt[i] = dady;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static OSL_NOINLINE void
|
||||
transformWideTextureGradientsTexture3d(BatchedTextureOutputs& outputs,
|
||||
Wide<const Vec3> Pdx,
|
||||
Wide<const Vec3> Pdy,
|
||||
Wide<const Vec3> Pdz)
|
||||
{
|
||||
MaskedData resultRef = outputs.result();
|
||||
if (resultRef.valid() && resultRef.has_derivs()) {
|
||||
if (Masked<float>::is(resultRef)) {
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
{
|
||||
MaskedDx<float> drds(resultRef);
|
||||
MaskedDy<float> drdt(resultRef);
|
||||
//MaskedDz<float> drdr(resultRef); // our duals don't actually have space for this
|
||||
|
||||
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
|
||||
for (int i = 0; i < __OSL_WIDTH; ++i) {
|
||||
float dres_xVal = drds[i];
|
||||
float dres_yVal = drdt[i];
|
||||
//float dres_zVal = drdr[i];
|
||||
|
||||
Vec3 v3pdx = Pdx[i];
|
||||
Vec3 v3pdy = Pdy[i];
|
||||
//Vec3 v3pdz = Pdz[i];
|
||||
|
||||
float dres_x = dres_xVal * v3pdx.x
|
||||
+ dres_yVal
|
||||
* v3pdx.y; // + dres_zVal * v3pdx.z;
|
||||
float dres_y = dres_xVal * v3pdy.x
|
||||
+ dres_yVal
|
||||
* v3pdy.y; // + dres_zVal * v3pdy.z;
|
||||
//float dres_z = dres_xVal * v3pdz.x + dres_yVal * v3pdz.y + dres_zVal * v3pdz.z;
|
||||
|
||||
drds[i] = dres_x;
|
||||
drdt[i] = dres_y;
|
||||
//drdr[i] = dres_z;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// keep assert out of inlined code
|
||||
OSL_DASSERT(Masked<Color3>::is(resultRef));
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
{
|
||||
MaskedDx<Color3> widedrp1(resultRef);
|
||||
MaskedDy<Color3> widedrp2(resultRef);
|
||||
//MaskedDz<Color3> widedrp3(resultRef);
|
||||
|
||||
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
|
||||
for (int i = 0; i < __OSL_WIDTH; ++i) {
|
||||
Color3 drdp1Color = widedrp1[i];
|
||||
Color3 drdp2Color = widedrp2[i];
|
||||
//Color3 drdp3Color = widedrp3[i];
|
||||
|
||||
Vec3 v3pdx = Pdx[i];
|
||||
Vec3 v3pdy = Pdy[i];
|
||||
//Vec3 v3pdz = Pdz[i];
|
||||
|
||||
widedrp1[i] = drdp1Color * v3pdx.x
|
||||
+ drdp2Color
|
||||
* v3pdx.y; // + drdp3Color * v3pdx.z;
|
||||
widedrp2[i] = drdp1Color * v3pdy.x
|
||||
+ drdp2Color
|
||||
* v3pdy.y; // + drdp3Color * v3pdy.z;
|
||||
//widedrp3[i] = drdp1Color * v3pdz.x + drdp2Color * v3pdz.y + drdp3Color * v3pdz.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MaskedData alphaRef = outputs.alpha();
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
if (alphaRef.valid() && alphaRef.has_derivs()) {
|
||||
MaskedDx<float> dap1(alphaRef);
|
||||
MaskedDy<float> dap2(alphaRef);
|
||||
// MaskedDz<float> dap3(alphaRef);
|
||||
|
||||
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
|
||||
for (int i = 0; i < __OSL_WIDTH; ++i) {
|
||||
float dadp1Val = dap1[i];
|
||||
float dadp2Val = dap2[i];
|
||||
//float dadp3Val = dap3[i];
|
||||
|
||||
Vec3 v3pdx = Pdx[i];
|
||||
Vec3 v3pdy = Pdy[i];
|
||||
//Vec3 v3pdz = Pdz[i];
|
||||
|
||||
float dadpx = dadp1Val * v3pdx.x
|
||||
+ dadp2Val * v3pdx.y; // + dadp3Val * v3pdx.z;
|
||||
float dadpy = dadp1Val * v3pdy.x
|
||||
+ dadp2Val * v3pdy.y; // + dadp3Val * v3pdy.z;
|
||||
//float dadpz = dadp1Val * v3pdz.x + dadp2Val * v3pdz.y + dadp3Val * v3pdz.z;
|
||||
|
||||
dap1[i] = dadpx;
|
||||
dap2[i] = dadpy;
|
||||
//dap3[i] = dadpz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OSL_BATCHOP int
|
||||
__OSL_MASKED_OP(texture)(void* bsg_, void* name, void* handle, const void* opt_,
|
||||
@@ -590,6 +730,14 @@ __OSL_MASKED_OP(texture)(void* bsg_, void* name, void* handle, const void* opt_,
|
||||
Wide<const float>(dsdy), Wide<const float>(dtdy),
|
||||
outputs);
|
||||
|
||||
// Correct our st texture space gradients into xy-space gradients
|
||||
if (resultHasDerivs || alphaHasDerivs) {
|
||||
transformWideTextureGradients(outputs, Wide<const float>(dsdx),
|
||||
Wide<const float>(dtdx),
|
||||
Wide<const float>(dsdy),
|
||||
Wide<const float>(dtdy));
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
if (outputs.errormessage().valid()) {
|
||||
Masked<ustring> err(outputs.errormessage());
|
||||
@@ -637,6 +785,13 @@ __OSL_MASKED_OP(texture3d)(void* bsg_, void* name, void* handle,
|
||||
Wide<const Vec3>(wPdy), Wide<const Vec3>(wPdz),
|
||||
outputs);
|
||||
|
||||
// Correct our P (Vec3) space gradients into xyz-space gradients
|
||||
if (resultHasDerivs || alphaHasDerivs) {
|
||||
transformWideTextureGradientsTexture3d(outputs, Wide<const Vec3>(wPdx),
|
||||
Wide<const Vec3>(wPdy),
|
||||
Wide<const Vec3>(wPdz));
|
||||
}
|
||||
|
||||
OSL_FORCEINLINE_BLOCK
|
||||
if (outputs.errormessage().valid()) {
|
||||
Masked<ustring> err(outputs.errormessage());
|
||||
|
||||
@@ -39,7 +39,7 @@ __OSL_OP(naninf_check)(int ncomps, const void* vals_, int has_derivs,
|
||||
for (int d = 0; d < (has_derivs ? 3 : 1); ++d) {
|
||||
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
|
||||
int i = d * ncomps + c;
|
||||
if (!OIIO::isfinite(vals[i])) {
|
||||
if (!std::isfinite(vals[i])) {
|
||||
ctx->errorfmt("Detected {} value in {}{} at {}:{} (op {})",
|
||||
vals[i], d > 0 ? "the derivatives of " : "",
|
||||
USTR(symbolname), USTR(sourcefile), sourceline,
|
||||
@@ -68,7 +68,7 @@ __OSL_MASKED_OP1(naninf_check_offset,
|
||||
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
|
||||
int i = d * ncomps + c;
|
||||
mask.foreach ([=](ActiveLane lane) -> void {
|
||||
if (!OIIO::isfinite(vals[i * __OSL_WIDTH + lane])) {
|
||||
if (!std::isfinite(vals[i * __OSL_WIDTH + lane])) {
|
||||
ctx->errorfmt(
|
||||
"Detected {} value in {}{} at {}:{} (op {}) batch lane:{}",
|
||||
vals[i * __OSL_WIDTH + lane],
|
||||
@@ -107,7 +107,7 @@ __OSL_MASKED_OP1(naninf_check_offset,
|
||||
int firstcheck = wOffsets[lane];
|
||||
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
|
||||
int i = d * ncomps + c;
|
||||
if (!OIIO::isfinite(vals[i * __OSL_WIDTH + lane])) {
|
||||
if (!std::isfinite(vals[i * __OSL_WIDTH + lane])) {
|
||||
ctx->errorfmt(
|
||||
"Detected {} value in {}{} at {}:{} (op {}) batch lane:{}",
|
||||
vals[i * __OSL_WIDTH + lane],
|
||||
@@ -143,7 +143,7 @@ __OSL_OP2(uninit_check_values_offset, X,
|
||||
if (typedesc.basetype == TypeDesc::FLOAT) {
|
||||
float* vals = (float*)vals_;
|
||||
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
|
||||
if (!OIIO::isfinite(vals[c])) {
|
||||
if (!std::isfinite(vals[c])) {
|
||||
uninit = true;
|
||||
vals[c] = 0;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ __OSL_MASKED_OP2(uninit_check_values_offset, WX,
|
||||
float* vals = (float*)vals_;
|
||||
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
|
||||
mask.foreach ([=, &lanes_uninit](ActiveLane lane) -> void {
|
||||
if (!OIIO::isfinite(vals[c * __OSL_WIDTH + lane])) {
|
||||
if (!std::isfinite(vals[c * __OSL_WIDTH + lane])) {
|
||||
lanes_uninit.set_on(lane);
|
||||
vals[c * __OSL_WIDTH + lane] = 0;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ __OSL_MASKED_OP2(uninit_check_values_offset, X,
|
||||
mask.foreach ([=, &lanes_uninit](ActiveLane lane) -> void {
|
||||
int firstcheck = wOffsets[lane];
|
||||
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
|
||||
if (!OIIO::isfinite(vals[c])) {
|
||||
if (!std::isfinite(vals[c])) {
|
||||
lanes_uninit.set_on(lane);
|
||||
vals[c] = 0;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ __OSL_MASKED_OP2(uninit_check_values_offset, WX,
|
||||
mask.foreach ([=, &lanes_uninit](ActiveLane lane) -> void {
|
||||
int firstcheck = wOffsets[lane];
|
||||
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
|
||||
if (!OIIO::isfinite(vals[c * __OSL_WIDTH + lane])) {
|
||||
if (!std::isfinite(vals[c * __OSL_WIDTH + lane])) {
|
||||
lanes_uninit.set_on(lane);
|
||||
vals[c * __OSL_WIDTH + lane] = 0;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ gabor_cell(GaborParams& gp, const Vec3& c_i, const Dual2<Vec3>& x_c_i,
|
||||
Dual2<float> gk = gabor_kernel(w_i_t_s_f, omega_i_t_s_f,
|
||||
phi_i_t_s_f, a_i_t_s_f,
|
||||
x_k_i_t); // 2D
|
||||
if (!OIIO::isfinite(gk.val())) {
|
||||
if (!std::isfinite(gk.val())) {
|
||||
// Numeric failure of the filtered version. Fall
|
||||
// back on the unfiltered.
|
||||
gk = gabor_kernel(gp.weight, omega_i, phi_i, gp.a,
|
||||
|
||||
@@ -367,7 +367,7 @@ gabor_cell(const sfm::GaborUniformParams& gup, const sfm::GaborParams& gp,
|
||||
//bool not_finite = std::isnan(gk.val()) | std::isinf(gk.val());
|
||||
bool not_finite = std::isnan(gk.val()) || std::isinf(gk.val());
|
||||
#else
|
||||
bool not_finite = !OIIO::isfinite(gk.val());
|
||||
bool not_finite = !std::isfinite(gk.val());
|
||||
#endif
|
||||
if (OSL_UNLIKELY(not_finite)) {
|
||||
// Numeric failure of the filtered version. Fall
|
||||
@@ -563,16 +563,16 @@ scalar_gabor3(const Dual2<Vec3>& P, const sfm::GaborUniformParams& gup,
|
||||
// to better enable SROA (Scalar Replacement of Aggregates) optimizations
|
||||
if (seed == 0) {
|
||||
result.val().x = resultPart.val();
|
||||
result.dx().x = resultPart.dx();
|
||||
result.dy().x = resultPart.dy();
|
||||
result.dx().x = resultPart.dx();
|
||||
result.dy().x = resultPart.dy();
|
||||
} else if (seed == 1) {
|
||||
result.val().y = resultPart.val();
|
||||
result.dx().y = resultPart.dx();
|
||||
result.dy().y = resultPart.dy();
|
||||
result.dx().y = resultPart.dx();
|
||||
result.dy().y = resultPart.dy();
|
||||
} else {
|
||||
result.val().z = resultPart.val();
|
||||
result.dx().z = resultPart.dx();
|
||||
result.dy().z = resultPart.dy();
|
||||
result.dx().z = resultPart.dx();
|
||||
result.dy().z = resultPart.dy();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -646,16 +646,16 @@ scalar_pgabor3(const Dual2<Vec3>& P, const Vec3& Pperiod,
|
||||
// to better enable SROA (Scalar Replacement of Aggregates) optimizations
|
||||
if (seed == 0) {
|
||||
result.val().x = resultPart.val();
|
||||
result.dx().x = resultPart.dx();
|
||||
result.dy().x = resultPart.dy();
|
||||
result.dx().x = resultPart.dx();
|
||||
result.dy().x = resultPart.dy();
|
||||
} else if (seed == 1) {
|
||||
result.val().y = resultPart.val();
|
||||
result.dx().y = resultPart.dx();
|
||||
result.dy().y = resultPart.dy();
|
||||
result.dx().y = resultPart.dx();
|
||||
result.dy().y = resultPart.dy();
|
||||
} else {
|
||||
result.val().z = resultPart.val();
|
||||
result.dx().z = resultPart.dx();
|
||||
result.dy().z = resultPart.dy();
|
||||
result.dx().z = resultPart.dx();
|
||||
result.dy().z = resultPart.dy();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -218,7 +218,7 @@ static OIIO::mutex shading_mutex;
|
||||
static ShadingSystem* shadingsys = NULL;
|
||||
static OIIO_RendererServices* renderer = NULL;
|
||||
static ErrorRecorder errhandler;
|
||||
|
||||
static std::shared_ptr<TextureSystem> shared_texsys;
|
||||
|
||||
|
||||
static void
|
||||
@@ -226,7 +226,14 @@ setup_shadingsys()
|
||||
{
|
||||
OIIO::lock_guard lock(shading_mutex);
|
||||
if (!shadingsys) {
|
||||
renderer = new OIIO_RendererServices(TextureSystem::create(true));
|
||||
#if OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
if (!shared_texsys)
|
||||
shared_texsys = TextureSystem::create(true);
|
||||
auto ts = shared_texsys.get();
|
||||
#else
|
||||
auto ts = TextureSystem::create(true);
|
||||
#endif
|
||||
renderer = new OIIO_RendererServices(ts);
|
||||
shadingsys = new ShadingSystem(renderer, NULL, &errhandler);
|
||||
}
|
||||
}
|
||||
@@ -381,16 +388,16 @@ parse_param(string_view paramname, string_view val, ImageSpec& spec)
|
||||
// Surrounded by quotes? it's a string (strip off the quotes)
|
||||
val.remove_prefix(1);
|
||||
val.remove_suffix(1);
|
||||
type = TypeDesc::TypeString;
|
||||
type = TypeString;
|
||||
} else if (Strutil::string_is<int>(val)) {
|
||||
// Looks like an int, is an int
|
||||
type = TypeDesc::TypeInt;
|
||||
type = TypeInt;
|
||||
} else if (Strutil::string_is<float>(val)) {
|
||||
// Looks like a float, is a float
|
||||
type = TypeDesc::TypeFloat;
|
||||
type = TypeFloat;
|
||||
} else {
|
||||
// Everything else is assumed a string
|
||||
type = TypeDesc::TypeString;
|
||||
type = TypeString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -432,9 +432,8 @@ OSLToyMainWindow::OSLToyMainWindow(OSLToyRenderer* rend, int xr, int yr)
|
||||
QPixmap pixmap(xres, yres);
|
||||
OIIO::ImageBuf checks(
|
||||
OIIO::ImageSpec(xres, yres, 3, OIIO::TypeDesc::UINT8));
|
||||
const float white[] = { 1, 1, 1 };
|
||||
const float black[] = { 0, 0, 0 };
|
||||
OIIO::ImageBufAlgo::checker(checks, 16, 16, 1, white, black);
|
||||
OIIO::ImageBufAlgo::checker(checks, 16, 16, 1, 1.0f /* white */,
|
||||
0.0f /* black */);
|
||||
renderView->update(checks);
|
||||
|
||||
textTabs = new QTabWidget;
|
||||
@@ -798,7 +797,7 @@ OSLToyMainWindow::osl_do_rerender(float /*frametime*/)
|
||||
float start = timer();
|
||||
renderer()->set_time(start);
|
||||
renderer()->render_image();
|
||||
OIIO_UNUSED_OK float rendertime = timer() - start;
|
||||
OIIO_MAYBE_UNUSED float rendertime = timer() - start;
|
||||
|
||||
renderView->update(renderer()->framebuffer());
|
||||
|
||||
@@ -1052,14 +1051,14 @@ OSLToyMainWindow::make_param_adjustment_row(ParamRec* param,
|
||||
auto label_and_adjust_layout = new QHBoxLayout;
|
||||
label_and_adjust->setLayout(label_and_adjust_layout);
|
||||
std::string labeltext;
|
||||
if (param->type == TypeDesc::TypeColor)
|
||||
if (param->type == TypeColor)
|
||||
labeltext = string_view(&("RGB"[c]), 1);
|
||||
else
|
||||
labeltext = string_view(&("xyz"[c]), 1);
|
||||
auto channellabel = QtUtils::make_qlabelfmt("{}", labeltext);
|
||||
label_and_adjust_layout->addWidget(channellabel);
|
||||
auto adjustWidget = new QtUtils::DoubleSpinBox(param->fdefault[c]);
|
||||
if (param->type == TypeDesc::TypeColor) {
|
||||
if (param->type == TypeColor) {
|
||||
adjustWidget->setRange(0.0, 1.0);
|
||||
}
|
||||
label_and_adjust_layout->addWidget(adjustWidget);
|
||||
|
||||
@@ -298,8 +298,7 @@ OSLToyRenderer::get_array_attribute(ShaderGlobals* sg, bool derivatives,
|
||||
|
||||
// In order to test getattribute(), respond positively to
|
||||
// "options"/"blahblah"
|
||||
if (object == "options" && name == "blahblah"
|
||||
&& type == TypeDesc::TypeFloat) {
|
||||
if (object == "options" && name == "blahblah" && type == TypeFloat) {
|
||||
*(float*)val = 3.14159;
|
||||
return true;
|
||||
}
|
||||
@@ -333,7 +332,7 @@ OSLToyRenderer::get_userdata(bool derivatives, ustring name, TypeDesc type,
|
||||
// look up something specific to the primitive, rather than have hard-
|
||||
// coded names.
|
||||
|
||||
if (name == u_s && type == TypeDesc::TypeFloat) {
|
||||
if (name == u_s && type == TypeFloat) {
|
||||
((float*)val)[0] = sg->u;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dudx;
|
||||
@@ -341,7 +340,7 @@ OSLToyRenderer::get_userdata(bool derivatives, ustring name, TypeDesc type,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (name == u_t && type == TypeDesc::TypeFloat) {
|
||||
if (name == u_t && type == TypeFloat) {
|
||||
((float*)val)[0] = sg->v;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dvdx;
|
||||
@@ -359,7 +358,7 @@ OSLToyRenderer::get_osl_version(ShaderGlobals* /*sg*/, bool /*derivs*/,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeInt) {
|
||||
if (type == TypeInt) {
|
||||
((int*)val)[0] = OSL_VERSION;
|
||||
return true;
|
||||
}
|
||||
@@ -386,7 +385,7 @@ OSLToyRenderer::get_camera_projection(ShaderGlobals* /*sg*/, bool /*derivs*/,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeString) {
|
||||
if (type == TypeString) {
|
||||
((ustring*)val)[0] = m_projection;
|
||||
return true;
|
||||
}
|
||||
@@ -400,7 +399,7 @@ OSLToyRenderer::get_camera_fov(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
// N.B. in a real renderer, this may be time-dependent
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_fov;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -415,7 +414,7 @@ OSLToyRenderer::get_camera_pixelaspect(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_pixelaspect;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -446,7 +445,7 @@ OSLToyRenderer::get_camera_clip_near(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_hither;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -461,7 +460,7 @@ OSLToyRenderer::get_camera_clip_far(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_yon;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -493,7 +492,7 @@ OSLToyRenderer::get_camera_shutter_open(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_shutter[0];
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -508,7 +507,7 @@ OSLToyRenderer::get_camera_shutter_close(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustring /*object*/, TypeDesc type,
|
||||
ustring /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_shutter[1];
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
|
||||
@@ -105,7 +105,7 @@ ImageBuf_to_QImage(const OIIO::ImageBuf& ib)
|
||||
return {};
|
||||
|
||||
if (ib.cachedpixels())
|
||||
const_cast<ImageBuf*>(&ib)->make_writeable(true);
|
||||
const_cast<ImageBuf*>(&ib)->make_writable(true);
|
||||
return QImage((const uchar*)ib.localpixels(), spec.width, spec.height,
|
||||
(int)spec.scanline_bytes(), format);
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ struct Background {
|
||||
#if 0 // DEBUG: visualize importance table
|
||||
using namespace OIIO;
|
||||
ImageOutput* out = ImageOutput::create("bg.exr");
|
||||
ImageSpec spec(res, res, 3, TypeDesc::TypeFloat);
|
||||
ImageSpec spec(res, res, 3, TypeFloat);
|
||||
if (out && out->open("bg.exr", spec))
|
||||
out->write_image(TypeDesc::TypeFloat, &values[0]);
|
||||
out->write_image(TypeFloat, &values[0]);
|
||||
delete out;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ OptixRaytracer::make_optix_materials()
|
||||
quad_hitgroup_desc.hitgroup.moduleCH = wrapper_module;
|
||||
quad_hitgroup_desc.hitgroup.entryFunctionNameCH
|
||||
= "__closesthit__closest_hit_osl";
|
||||
quad_hitgroup_desc.hitgroup.moduleAH = wrapper_module;
|
||||
quad_hitgroup_desc.hitgroup.moduleAH = wrapper_module;
|
||||
quad_hitgroup_desc.hitgroup.entryFunctionNameAH = "__anyhit__any_hit_shadow";
|
||||
quad_hitgroup_desc.hitgroup.moduleIS = quad_module;
|
||||
quad_hitgroup_desc.hitgroup.entryFunctionNameIS = "__intersection__quad";
|
||||
@@ -494,7 +494,7 @@ OptixRaytracer::make_optix_materials()
|
||||
sphere_hitgroup_desc.hitgroup.moduleAH = wrapper_module;
|
||||
sphere_hitgroup_desc.hitgroup.entryFunctionNameAH
|
||||
= "__anyhit__any_hit_shadow";
|
||||
sphere_hitgroup_desc.hitgroup.moduleIS = sphere_module;
|
||||
sphere_hitgroup_desc.hitgroup.moduleIS = sphere_module;
|
||||
sphere_hitgroup_desc.hitgroup.entryFunctionNameIS = "__intersection__sphere";
|
||||
OptixProgramGroup sphere_hitgroup;
|
||||
create_optix_pg(&sphere_hitgroup_desc, 1, &program_options,
|
||||
|
||||
+94
-16
@@ -101,6 +101,7 @@ struct MxOrenNayarDiffuseParams {
|
||||
float roughness;
|
||||
// optional
|
||||
ustring label;
|
||||
int energy_compensation;
|
||||
};
|
||||
|
||||
struct MxBurleyDiffuseParams {
|
||||
@@ -316,6 +317,8 @@ register_closures(OSL::ShadingSystem* shadingsys)
|
||||
CLOSURE_COLOR_PARAM(MxOrenNayarDiffuseParams, albedo),
|
||||
CLOSURE_FLOAT_PARAM(MxOrenNayarDiffuseParams, roughness),
|
||||
CLOSURE_STRING_KEYPARAM(MxOrenNayarDiffuseParams, label, "label"),
|
||||
CLOSURE_INT_KEYPARAM(MxOrenNayarDiffuseParams, energy_compensation,
|
||||
"energy_compensation"),
|
||||
CLOSURE_FINISH_PARAM(MxOrenNayarDiffuseParams) } },
|
||||
{ "burley_diffuse_bsdf",
|
||||
MX_BURLEY_DIFFUSE_ID,
|
||||
@@ -459,23 +462,24 @@ template<int trans> struct Diffuse final : public BSDF, DiffuseParams {
|
||||
struct OrenNayar final : public BSDF, OrenNayarParams {
|
||||
OrenNayar(const OrenNayarParams& params) : BSDF(), OrenNayarParams(params)
|
||||
{
|
||||
// precompute some constants
|
||||
float s2 = sigma * sigma;
|
||||
A = 1 - 0.50f * s2 / (s2 + 0.33f);
|
||||
B = 0.45f * s2 / (s2 + 0.09f);
|
||||
}
|
||||
Sample eval(const Vec3& wo, const OSL::Vec3& wi) const override
|
||||
{
|
||||
float NL = N.dot(wi);
|
||||
float NV = N.dot(wo);
|
||||
if (NL > 0 && NV > 0) {
|
||||
float LV = wo.dot(wi);
|
||||
float s = LV - NL * NV;
|
||||
// Simplified math from: "A tiny improvement of Oren-Nayar reflectance model"
|
||||
// by Yasuhiro Fujii
|
||||
// http://mimosa-pudica.net/improved-oren-nayar.html
|
||||
// NOTE: This is using the math to match the original ON model, not the tweak
|
||||
// proposed in the text which is a slightly different BRDF
|
||||
float LV = wo.dot(wi);
|
||||
float s = LV - NL * NV;
|
||||
// NOTE: This is using the math to match the original qualitative ON model
|
||||
// (QON in the paper above) and not the tweak proposed in the text which
|
||||
// is a slightly different BRDF (FON in the paper above). This is done for
|
||||
// backwards compatibility purposes only.
|
||||
float s2 = sigma * sigma;
|
||||
float A = 1 - 0.50f * s2 / (s2 + 0.33f);
|
||||
float B = 0.45f * s2 / (s2 + 0.09f);
|
||||
float stinv = s > 0 ? s / std::max(NL, NV) : 0.0f;
|
||||
return { wi, Color3(A + B * stinv), NL * float(M_1_PI), 1.0f };
|
||||
}
|
||||
@@ -489,9 +493,77 @@ struct OrenNayar final : public BSDF, OrenNayarParams {
|
||||
Sampling::sample_cosine_hemisphere(N, rx, ry, out_dir, pdf);
|
||||
return eval(wo, out_dir);
|
||||
}
|
||||
};
|
||||
|
||||
struct EnergyCompensatedOrenNayar : public BSDF, MxOrenNayarDiffuseParams {
|
||||
EnergyCompensatedOrenNayar(const MxOrenNayarDiffuseParams& params)
|
||||
: BSDF(), MxOrenNayarDiffuseParams(params)
|
||||
{
|
||||
}
|
||||
Sample eval(const Vec3& wo, const OSL::Vec3& wi) const override
|
||||
{
|
||||
float NL = N.dot(wi);
|
||||
float NV = N.dot(wo);
|
||||
if (NL > 0 && NV > 0) {
|
||||
float LV = wo.dot(wi);
|
||||
float s = LV - NL * NV;
|
||||
// Code below from Jamie Portsmouth's tech report on Energy conversion Oren-Nayar
|
||||
// See slack thread for whitepaper:
|
||||
// https://academysoftwarefdn.slack.com/files/U03SWQFPD08/F06S50CUKV1/oren_nayar.pdf
|
||||
|
||||
// TODO: rho should be the albedo which is a parameter of the closure in the Mx parameters
|
||||
// This only matters for the color-saturation aspect of the BRDF which is rather subtle anyway
|
||||
// and not always desireable for artists. Hardcoding to 1 leaves the coloring entirely up to the
|
||||
// closure weight.
|
||||
|
||||
const Color3 rho = albedo;
|
||||
const float sigma = roughness;
|
||||
|
||||
float AF = 1.0f / (1.0f + constant1_FON * sigma);
|
||||
float stinv = s > 0 ? s / std::max(NL, NV) : s;
|
||||
float f_ss = AF * (1.0 + sigma * stinv); // single-scatt. BRDF
|
||||
float EFo = E_FON_analytic(NV); // EFo at rho=1 (analytic)
|
||||
float EFi = E_FON_analytic(NL); // EFi at rho=1 (analytic)
|
||||
float avgEF = AF * (1.0f + constant2_FON * sigma); // avg. albedo
|
||||
Color3 rho_ms = (rho * rho) * avgEF
|
||||
/ (Color3(1.0f)
|
||||
- rho * std::max(0.0f, 1.0f - avgEF));
|
||||
float f_ms = std::max(1e-7f, 1.0f - EFo)
|
||||
* std::max(1e-7f, 1.0f - EFi)
|
||||
/ std::max(1e-7f, 1.0f - avgEF); // multi-scatter lobe
|
||||
return { wi, Color3(rho * f_ss + rho_ms * f_ms), NL * float(M_1_PI),
|
||||
1.0f };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Sample sample(const Vec3& wo, float rx, float ry,
|
||||
float /*rz*/) const override
|
||||
{
|
||||
Vec3 out_dir;
|
||||
float pdf;
|
||||
Sampling::sample_cosine_hemisphere(N, rx, ry, out_dir, pdf);
|
||||
return eval(wo, out_dir);
|
||||
}
|
||||
|
||||
private:
|
||||
float A, B;
|
||||
static constexpr float constant1_FON = float(0.5 - 2.0 / (3.0 * M_PI));
|
||||
static constexpr float constant2_FON = float(2.0 / 3.0
|
||||
- 28.0 / (15.0 * M_PI));
|
||||
|
||||
float E_FON_analytic(float mu) const
|
||||
{
|
||||
const float sigma = roughness;
|
||||
float AF = 1.0f
|
||||
/ (1.0f
|
||||
+ constant1_FON * sigma); // Fujii model A coefficient
|
||||
float BF = sigma * AF; // Fujii model B coefficient
|
||||
float Si = sqrtf(std::max(0.0f, 1.0f - mu * mu));
|
||||
float G = Si * (OIIO::fast_acos(mu) - Si * mu)
|
||||
+ 2.0 * ((Si / mu) * (1.0 - Si * Si * Si) - Si) / 3.0f;
|
||||
float E = AF + (BF * float(M_1_PI)) * G;
|
||||
return E;
|
||||
}
|
||||
};
|
||||
|
||||
struct Phong final : public BSDF, PhongParams {
|
||||
@@ -1615,14 +1687,20 @@ process_bsdf_closure(const OSL::ShaderGlobals& sg, ShadingResult& result,
|
||||
ok = result.bsdf.add_bsdf<Transparent>(cw);
|
||||
break;
|
||||
case MX_OREN_NAYAR_DIFFUSE_ID: {
|
||||
// translate MaterialX parameters into existing closure
|
||||
const MxOrenNayarDiffuseParams* srcparams
|
||||
= comp->as<MxOrenNayarDiffuseParams>();
|
||||
OrenNayarParams params = {};
|
||||
params.N = srcparams->N;
|
||||
params.sigma = srcparams->roughness;
|
||||
ok = result.bsdf.add_bsdf<OrenNayar>(cw * srcparams->albedo,
|
||||
params);
|
||||
if (srcparams->energy_compensation) {
|
||||
// energy compensation handled by its own BSDF
|
||||
ok = result.bsdf.add_bsdf<EnergyCompensatedOrenNayar>(
|
||||
cw, *srcparams);
|
||||
} else {
|
||||
// translate MaterialX parameters into existing closure
|
||||
OrenNayarParams params = {};
|
||||
params.N = srcparams->N;
|
||||
params.sigma = srcparams->roughness;
|
||||
ok = result.bsdf.add_bsdf<OrenNayar>(cw * srcparams->albedo,
|
||||
params);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MX_BURLEY_DIFFUSE_ID: {
|
||||
@@ -1646,7 +1724,7 @@ process_bsdf_closure(const OSL::ShaderGlobals& sg, ShadingResult& result,
|
||||
}
|
||||
case MX_CONDUCTOR_ID: {
|
||||
const MxConductorParams& params = *comp->as<MxConductorParams>();
|
||||
ok = result.bsdf.add_bsdf<
|
||||
ok = result.bsdf.add_bsdf<
|
||||
MxMicrofacet<MxConductorParams, GGXDist, false>>(cw, params,
|
||||
1.0f);
|
||||
break;
|
||||
|
||||
@@ -35,8 +35,8 @@ struct BSDF {
|
||||
BSDF() {}
|
||||
virtual Color3 get_albedo(const Vec3& /*wo*/) const { return Color3(1); }
|
||||
virtual Sample eval(const Vec3& wo, const Vec3& wi) const = 0;
|
||||
virtual Sample sample(const Vec3& wo, float rx, float ry,
|
||||
float rz) const = 0;
|
||||
virtual Sample sample(const Vec3& wo, float rx, float ry, float rz) const
|
||||
= 0;
|
||||
};
|
||||
|
||||
/// Represents a weighted sum of BSDFS
|
||||
|
||||
@@ -364,28 +364,23 @@ SimpleRaytracer::parse_scene_xml(const std::string& scenefile)
|
||||
float f[3];
|
||||
string_view val(attr.value());
|
||||
if (parse_prefix_and_ints(val, "int ", 1, &i))
|
||||
shadingsys->Parameter(*group, attr.name(),
|
||||
TypeDesc::TypeInt,
|
||||
shadingsys->Parameter(*group, attr.name(), TypeInt,
|
||||
store.Int(i));
|
||||
else if (parse_prefix_and_floats(val, "float ", 1, f))
|
||||
shadingsys->Parameter(*group, attr.name(),
|
||||
TypeDesc::TypeFloat,
|
||||
store.Float(f[0]));
|
||||
TypeFloat, store.Float(f[0]));
|
||||
else if (parse_prefix_and_floats(val, "vector ", 3, f))
|
||||
shadingsys->Parameter(*group, attr.name(),
|
||||
TypeDesc::TypeVector,
|
||||
store.Vec(f));
|
||||
TypeVector, store.Vec(f));
|
||||
else if (parse_prefix_and_floats(val, "point ", 3, f))
|
||||
shadingsys->Parameter(*group, attr.name(),
|
||||
TypeDesc::TypePoint,
|
||||
store.Vec(f));
|
||||
TypePoint, store.Vec(f));
|
||||
else if (parse_prefix_and_floats(val, "color ", 3, f))
|
||||
shadingsys->Parameter(*group, attr.name(),
|
||||
TypeDesc::TypeColor,
|
||||
store.Vec(f));
|
||||
TypeColor, store.Vec(f));
|
||||
else
|
||||
shadingsys->Parameter(*group, attr.name(),
|
||||
TypeDesc::TypeString,
|
||||
TypeString,
|
||||
store.Str(attr.value()));
|
||||
}
|
||||
} else if (strcmp(gnode.name(), "Shader") == 0) {
|
||||
@@ -589,7 +584,7 @@ SimpleRaytracer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
// look up something specific to the primitive, rather than have hard-
|
||||
// coded names.
|
||||
|
||||
if (name == u_s && type == TypeDesc::TypeFloat) {
|
||||
if (name == u_s && type == TypeFloat) {
|
||||
((float*)val)[0] = sg->u;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dudx;
|
||||
@@ -597,7 +592,7 @@ SimpleRaytracer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (name == u_t && type == TypeDesc::TypeFloat) {
|
||||
if (name == u_t && type == TypeFloat) {
|
||||
((float*)val)[0] = sg->v;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dvdx;
|
||||
@@ -615,7 +610,7 @@ SimpleRaytracer::get_osl_version(ShaderGlobals* /*sg*/, bool /*derivs*/,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeInt) {
|
||||
if (type == TypeInt) {
|
||||
((int*)val)[0] = OSL_VERSION;
|
||||
return true;
|
||||
}
|
||||
@@ -642,7 +637,7 @@ SimpleRaytracer::get_camera_projection(ShaderGlobals* /*sg*/, bool /*derivs*/,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeString) {
|
||||
if (type == TypeString) {
|
||||
((ustring*)val)[0] = m_projection;
|
||||
return true;
|
||||
}
|
||||
@@ -656,7 +651,7 @@ SimpleRaytracer::get_camera_fov(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
// N.B. in a real renderer, this may be time-dependent
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_fov;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -671,7 +666,7 @@ SimpleRaytracer::get_camera_pixelaspect(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_pixelaspect;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -702,7 +697,7 @@ SimpleRaytracer::get_camera_clip_near(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_hither;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -717,7 +712,7 @@ SimpleRaytracer::get_camera_clip_far(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_yon;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -749,7 +744,7 @@ SimpleRaytracer::get_camera_shutter_open(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_shutter[0];
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -764,7 +759,7 @@ SimpleRaytracer::get_camera_shutter_close(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_shutter[1];
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
|
||||
@@ -57,7 +57,7 @@ static std::string scenefile, imagefile;
|
||||
static std::string shaderpath;
|
||||
static bool shadingsys_options_set = false;
|
||||
static bool use_optix = OIIO::Strutil::stoi(
|
||||
OIIO::Sysutil::getenv("TESTSHADE_OPTIX"));
|
||||
OIIO::Sysutil::getenv("TESTSHADE_OPTIX"));
|
||||
static bool optix_no_inline = false;
|
||||
static bool optix_no_inline_layer_funcs = false;
|
||||
static bool optix_no_merge_layer_funcs = false;
|
||||
|
||||
@@ -470,14 +470,12 @@ SimpleRenderer::get_array_attribute(ShaderGlobals* sg, bool derivatives,
|
||||
|
||||
// In order to test getattribute(), respond positively to
|
||||
// "options"/"blahblah"
|
||||
if (object == "options" && name == "blahblah"
|
||||
&& type == TypeDesc::TypeFloat) {
|
||||
if (object == "options" && name == "blahblah" && type == TypeFloat) {
|
||||
*(float*)val = 3.14159;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (object.empty() && name == "shading:index"
|
||||
&& type == TypeDesc::TypeInt) {
|
||||
if (object.empty() && name == "shading:index" && type == TypeInt) {
|
||||
*(int*)val = OSL::get_shade_index(sg);
|
||||
return true;
|
||||
}
|
||||
@@ -511,7 +509,7 @@ SimpleRenderer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
// look up something specific to the primitive, rather than have hard-
|
||||
// coded names.
|
||||
|
||||
if (name == u_s && type == TypeDesc::TypeFloat) {
|
||||
if (name == u_s && type == TypeFloat) {
|
||||
((float*)val)[0] = sg->u;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dudx;
|
||||
@@ -519,7 +517,7 @@ SimpleRenderer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (name == u_t && type == TypeDesc::TypeFloat) {
|
||||
if (name == u_t && type == TypeFloat) {
|
||||
((float*)val)[0] = sg->v;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dvdx;
|
||||
@@ -527,7 +525,7 @@ SimpleRenderer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (name == u_red && type == TypeDesc::TypeFloat && sg->P.x > 0.5f) {
|
||||
if (name == u_red && type == TypeFloat && sg->P.x > 0.5f) {
|
||||
((float*)val)[0] = sg->u;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dudx;
|
||||
@@ -535,7 +533,7 @@ SimpleRenderer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (name == u_green && type == TypeDesc::TypeFloat && sg->P.x < 0.5f) {
|
||||
if (name == u_green && type == TypeFloat && sg->P.x < 0.5f) {
|
||||
((float*)val)[0] = sg->v;
|
||||
if (derivatives) {
|
||||
((float*)val)[1] = sg->dvdx;
|
||||
@@ -543,7 +541,7 @@ SimpleRenderer::get_userdata(bool derivatives, ustringhash name, TypeDesc type,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (name == u_blue && type == TypeDesc::TypeFloat
|
||||
if (name == u_blue && type == TypeFloat
|
||||
&& ((static_cast<int>(sg->P.y * 12) % 2) == 0)) {
|
||||
((float*)val)[0] = 1.0f - sg->u;
|
||||
if (derivatives) {
|
||||
@@ -743,7 +741,7 @@ SimpleRenderer::get_osl_version(ShaderGlobals* /*sg*/, bool /*derivs*/,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeInt) {
|
||||
if (type == TypeInt) {
|
||||
((int*)val)[0] = OSL_VERSION;
|
||||
return true;
|
||||
}
|
||||
@@ -770,7 +768,7 @@ SimpleRenderer::get_camera_projection(ShaderGlobals* /*sg*/, bool /*derivs*/,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeString) {
|
||||
if (type == TypeString) {
|
||||
((ustring*)val)[0] = m_projection;
|
||||
return true;
|
||||
}
|
||||
@@ -784,7 +782,7 @@ SimpleRenderer::get_camera_fov(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
// N.B. in a real renderer, this may be time-dependent
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_fov;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -799,7 +797,7 @@ SimpleRenderer::get_camera_pixelaspect(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_pixelaspect;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -830,7 +828,7 @@ SimpleRenderer::get_camera_clip_near(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_hither;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -845,7 +843,7 @@ SimpleRenderer::get_camera_clip_far(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_yon;
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -877,7 +875,7 @@ SimpleRenderer::get_camera_shutter_open(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_shutter[0];
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
@@ -892,7 +890,7 @@ SimpleRenderer::get_camera_shutter_close(ShaderGlobals* /*sg*/, bool derivs,
|
||||
ustringhash /*object*/, TypeDesc type,
|
||||
ustringhash /*name*/, void* val)
|
||||
{
|
||||
if (type == TypeDesc::TypeFloat) {
|
||||
if (type == TypeFloat) {
|
||||
((float*)val)[0] = m_shutter[1];
|
||||
if (derivs)
|
||||
memset((char*)val + type.size(), 0, 2 * type.size());
|
||||
|
||||
+28
-20
@@ -87,7 +87,7 @@ static bool userdata_isconnected = false;
|
||||
static bool print_outputs = false;
|
||||
static bool output_placement = true;
|
||||
static bool use_optix = OIIO::Strutil::stoi(
|
||||
OIIO::Sysutil::getenv("TESTSHADE_OPTIX"));
|
||||
OIIO::Sysutil::getenv("TESTSHADE_OPTIX"));
|
||||
static bool optix_no_inline = false;
|
||||
static bool optix_no_inline_layer_funcs = false;
|
||||
static bool optix_no_merge_layer_funcs = false;
|
||||
@@ -129,7 +129,6 @@ static char* userdata_base_ptr = nullptr;
|
||||
static char* output_base_ptr = nullptr;
|
||||
static bool use_rs_bitcode
|
||||
= false; // use free function bitcode version of renderer services
|
||||
|
||||
static int jbufferMB = 16;
|
||||
|
||||
// Testshade thread tracking and assignment.
|
||||
@@ -522,24 +521,24 @@ add_param(ParamValueList& params, string_view command, string_view paramname,
|
||||
}
|
||||
|
||||
// If it is or might be a matrix, look for 16 comma-separated floats
|
||||
if ((type == TypeDesc::UNKNOWN || type == TypeDesc::TypeMatrix)
|
||||
if ((type == TypeDesc::UNKNOWN || type == TypeMatrix)
|
||||
&& parse_float_list(stringval, f, 16)) {
|
||||
params.emplace_back(paramname, TypeDesc::TypeMatrix, 1, f);
|
||||
params.emplace_back(paramname, TypeMatrix, 1, f);
|
||||
param_hints.push_back(hint);
|
||||
return;
|
||||
}
|
||||
// If it is or might be a vector type, look for 3 comma-separated floats
|
||||
if ((type == TypeDesc::UNKNOWN || equivalent(type, TypeDesc::TypeVector))
|
||||
if ((type == TypeDesc::UNKNOWN || equivalent(type, TypeVector))
|
||||
&& parse_float_list(stringval, f, 3)) {
|
||||
if (type == TypeDesc::UNKNOWN)
|
||||
type = TypeDesc::TypeVector;
|
||||
type = TypeVector;
|
||||
params.emplace_back(paramname, type, 1, f);
|
||||
param_hints.push_back(hint);
|
||||
return;
|
||||
}
|
||||
// If it is or might be an int, look for an int that takes up the whole
|
||||
// string.
|
||||
if ((type == TypeDesc::UNKNOWN || type == TypeDesc::TypeInt)
|
||||
if ((type == TypeDesc::UNKNOWN || type == TypeInt)
|
||||
&& OIIO::Strutil::string_is<int>(stringval)) {
|
||||
params.emplace_back(paramname, OIIO::Strutil::stoi(stringval));
|
||||
param_hints.push_back(hint);
|
||||
@@ -547,7 +546,7 @@ add_param(ParamValueList& params, string_view command, string_view paramname,
|
||||
}
|
||||
// If it is or might be an float, look for a float that takes up the
|
||||
// whole string.
|
||||
if ((type == TypeDesc::UNKNOWN || type == TypeDesc::TypeFloat)
|
||||
if ((type == TypeDesc::UNKNOWN || type == TypeFloat)
|
||||
&& OIIO::Strutil::string_is<float>(stringval)) {
|
||||
params.emplace_back(paramname, OIIO::Strutil::stof(stringval));
|
||||
param_hints.push_back(hint);
|
||||
@@ -595,7 +594,7 @@ add_param(ParamValueList& params, string_view command, string_view paramname,
|
||||
|
||||
// All remaining cases -- it's a string
|
||||
const char* s = ustring(stringval).c_str();
|
||||
params.emplace_back(paramname, TypeDesc::TypeString, 1, &s);
|
||||
params.emplace_back(paramname, TypeString, 1, &s);
|
||||
param_hints.push_back(hint);
|
||||
}
|
||||
|
||||
@@ -675,8 +674,12 @@ print_info()
|
||||
else
|
||||
#endif
|
||||
rend = new SimpleRenderer;
|
||||
TextureSystem* texturesys = TextureSystem::create();
|
||||
auto texturesys = TextureSystem::create();
|
||||
#if OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
shadingsys = new ShadingSystem(rend, texturesys.get(), &errhandler);
|
||||
#else
|
||||
shadingsys = new ShadingSystem(rend, texturesys, &errhandler);
|
||||
#endif
|
||||
rend->init_shadingsys(shadingsys);
|
||||
set_shadingsys_options();
|
||||
|
||||
@@ -1269,8 +1272,8 @@ save_outputs(SimpleRenderer* rend, ShadingSystem* shadingsys,
|
||||
// We are outputting an integer variable, so we need to
|
||||
// convert it to floating point.
|
||||
float* pixel = OSL_ALLOCA(float, nchans);
|
||||
OIIO::convert_types(TypeDesc::BASETYPE(t.basetype), data,
|
||||
TypeDesc::FLOAT, pixel, nchans);
|
||||
OIIO::convert_pixel_values(TypeDesc::BASETYPE(t.basetype), data,
|
||||
TypeDesc::FLOAT, pixel, nchans);
|
||||
outputimg->setpixel(x, y, &pixel[0]);
|
||||
if (print_outputs) {
|
||||
print(" {} :", outputvarnames[i]);
|
||||
@@ -1418,9 +1421,9 @@ batched_save_outputs(SimpleRenderer* rend, ShadingSystem* shadingsys,
|
||||
int y = by[batchIndex];
|
||||
int data = batchResults[batchIndex];
|
||||
float pixel[1];
|
||||
OIIO::convert_types(TypeDesc::BASETYPE(t.basetype), &data,
|
||||
TypeDesc::FLOAT, &pixel[0],
|
||||
1 /*nchans*/);
|
||||
OIIO::convert_pixel_values(TypeDesc::BASETYPE(t.basetype),
|
||||
&data, TypeDesc::FLOAT,
|
||||
&pixel[0], 1 /*nchans*/);
|
||||
outputimg->setpixel(x, y, &pixel[0]);
|
||||
if (print_outputs) {
|
||||
*oStreams[batchIndex]
|
||||
@@ -1442,9 +1445,9 @@ batched_save_outputs(SimpleRenderer* rend, ShadingSystem* shadingsys,
|
||||
intPixel[c] = batchResults[batchIndex][c];
|
||||
}
|
||||
|
||||
OIIO::convert_types(TypeDesc::BASETYPE(t.basetype),
|
||||
intPixel, TypeDesc::FLOAT, floatPixel,
|
||||
3 /*nchans*/);
|
||||
OIIO::convert_pixel_values(TypeDesc::BASETYPE(t.basetype),
|
||||
intPixel, TypeDesc::FLOAT,
|
||||
floatPixel, 3 /*nchans*/);
|
||||
outputimg->setpixel(x, y, floatPixel);
|
||||
if (print_outputs) {
|
||||
(*oStreams[batchIndex])
|
||||
@@ -1963,7 +1966,12 @@ test_shade(int argc, const char* argv[])
|
||||
// Request a TextureSystem (by default it will be the global shared
|
||||
// one). This isn't strictly necessary, if you pass nullptr to
|
||||
// ShadingSystem ctr, it will ask for the shared one internally.
|
||||
#if OIIO_TEXTURESYSTEM_CREATE_SHARED
|
||||
std::shared_ptr<TextureSystem> texturesys_owned = TextureSystem::create();
|
||||
TextureSystem* texturesys = texturesys_owned.get();
|
||||
#else
|
||||
TextureSystem* texturesys = TextureSystem::create();
|
||||
#endif
|
||||
|
||||
// Create a new shading system. We pass it the RendererServices
|
||||
// object that services callbacks from the shading system, the
|
||||
@@ -2327,8 +2335,8 @@ test_shade(int argc, const char* argv[])
|
||||
std::cout << "ERRORS left in TextureSystem:\n" << err << "\n";
|
||||
retcode = EXIT_FAILURE;
|
||||
}
|
||||
OIIO::ImageCache* ic = texturesys->imagecache();
|
||||
err = ic ? ic->geterror() : std::string();
|
||||
auto ic = texturesys->imagecache();
|
||||
err = ic ? ic->geterror() : std::string();
|
||||
if (!err.empty()) {
|
||||
std::cout << "ERRORS left in ImageCache:\n" << err << "\n";
|
||||
retcode = EXIT_FAILURE;
|
||||
|
||||
@@ -20,7 +20,7 @@ testing with spaces:
|
||||
color ("hsl", 0, 0, 0.5) = 0.5 0.5 0.5
|
||||
color ("hsl", 0.5, 1, 0.1) = 0 0.2 0.2
|
||||
color ("YIQ", 0.5, 0.25, 0.25) = 0.8939 0.270375 0.649225
|
||||
color ("XYZ", 0.25, 0.5, 0.25) = -0.0831534 0.705882 0.176283
|
||||
color ("XYZ", 0.25, 0.5, 0.25) = -0.08315 0.7059 0.1763
|
||||
|
||||
luminance(0.5 0.75 0.75) = 0.696873
|
||||
luminance(0.5 0.5 0.5) = 0.5
|
||||
|
||||
@@ -20,7 +20,7 @@ testing with spaces:
|
||||
color ("hsl", 0, 0, 0.5) = 0.5 0.5 0.5
|
||||
color ("hsl", 0.5, 1, 0.1) = 0 0.2 0.2
|
||||
color ("YIQ", 0.5, 0.25, 0.25) = 0.8939 0.270375 0.649225
|
||||
color ("XYZ", 0.25, 0.5, 0.25) = -0.0831534 0.705883 0.176283
|
||||
color ("XYZ", 0.25, 0.5, 0.25) = -0.08315 0.7059 0.1763
|
||||
|
||||
luminance(0.5 0.75 0.75) = 0.696873
|
||||
luminance(0.5 0.5 0.5) = 0.5
|
||||
|
||||
@@ -63,7 +63,7 @@ test (color cparam = color (.1, .7, .2),
|
||||
printf (" color (\"YIQ\", %g, %g, %g) = %g\n",
|
||||
pretty(Y), pretty(I), pretty(Q), pretty(color("YIQ", Y,I,Q)));
|
||||
float x = 0.25, y = 0.5, z = 0.25;
|
||||
printf (" color (\"XYZ\", %g, %g, %g) = %g\n",
|
||||
printf (" color (\"XYZ\", %0.4g, %0.4g, %0.4g) = %0.4g\n",
|
||||
pretty(x), pretty(y), pretty(z), pretty(color("XYZ",x,y,z)));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,13 @@ find_library(CUDA_cuda_LIBRARY cuda HINTS ${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES
|
||||
# TODO: move to sm_60?
|
||||
set(CUDA_TARGET_ARCH sm_35)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 14 CACHE STRING
|
||||
"C++ standard to build with (14, 17, 20, etc.)")
|
||||
|
||||
# Compile our "renderer" to PTX
|
||||
cuda_compile_ptx(CUDA_PTX_FILES cuda_grid_renderer.cu
|
||||
OPTIONS --gpu-architecture=${CUDA_TARGET_ARCH} --use_fast_math -dc --std=c++14
|
||||
OPTIONS --gpu-architecture=${CUDA_TARGET_ARCH} --use_fast_math -dc
|
||||
--std=c++${CMAKE_CXX_STANDARD}
|
||||
--expt-relaxed-constexpr
|
||||
-I${OSL_INCLUDES}
|
||||
-I${IMATH_INCLUDES}
|
||||
@@ -58,7 +62,8 @@ add_custom_target(cuda_grid_renderer_ptx ALL
|
||||
|
||||
# Compile the rend_lib shadeops to PTX
|
||||
cuda_compile_ptx(CUDA_PTX_FILES rend_lib.cu
|
||||
OPTIONS --gpu-architecture=${CUDA_TARGET_ARCH} --use_fast_math -dc --std=c++14
|
||||
OPTIONS --gpu-architecture=${CUDA_TARGET_ARCH} --use_fast_math -dc
|
||||
--std=c++${CMAKE_CXX_STANDARD}
|
||||
--expt-relaxed-constexpr
|
||||
-I${OSL_INCLUDES}
|
||||
-I${IMATH_INCLUDES}
|
||||
|
||||
@@ -337,7 +337,7 @@ register_closures(ShadingSystem& ss)
|
||||
|
||||
const char* cuda_compile_options[] = { "--gpu-architecture=compute_35",
|
||||
"--use_fast_math", "-dc",
|
||||
"--std=c++11" };
|
||||
"--std=c++" #OSL_CPLUSPLUS_VERSION };
|
||||
|
||||
std::string
|
||||
build_trampoline_ptx(OSL::ShaderGroup& group, std::string init_name,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright Contributors to the Open Shading Language project.
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
|
||||
|
||||
shader printcalculatenormal ()
|
||||
{
|
||||
normal n2 = calculatenormal(P+1);
|
||||
printf ("calculatenormal = %f", n2);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user