Skip to content

Commit

Permalink
Merge branch 'AcademySoftwareFoundation:main' into testminimal
Browse files Browse the repository at this point in the history
Signed-off-by: Tuomas Tonteri <[email protected]>
  • Loading branch information
johnfea committed Jun 25, 2024
2 parents beca645 + b20a55e commit be092fc
Show file tree
Hide file tree
Showing 51 changed files with 228 additions and 113 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,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
Expand Down Expand Up @@ -180,7 +180,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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,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.
Expand Down
3 changes: 3 additions & 0 deletions src/build-scripts/ci-startup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ 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`
Expand Down
2 changes: 1 addition & 1 deletion src/cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ message (STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
###########################################################################
# C++ language standard
#
set (CMAKE_CXX_STANDARD 14 CACHE STRING
set (CMAKE_CXX_STANDARD 17 CACHE STRING
"C++ standard to build with (14, 17, 20, etc.)")
set (DOWNSTREAM_CXX_STANDARD 14 CACHE STRING
"C++ minimum standard to impose on downstream clients")
Expand Down
22 changes: 7 additions & 15 deletions src/doc/languagespec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5049,27 +5049,19 @@ \subsection{Surface BSDF closures}

\apiitem{albedo}
\vspace{12pt}
Single-scattering albedo of the medium.
\apiend
\vspace{-16pt}

\apiitem{transmission_depth}
\vspace{12pt}
Distance travelled inside the medium by white light before its color becomes
transmission_color by Beer's law. Given in scene length units, range
[0,infinity). Together with transmission_color this determines the
extinction coefficient of the medium.
Effective albedo of the medium (after multiple scattering). The renderer is expected to
invert this color to derive the appropriate single-scattering albedo that will produce
this color for the average random walk.
\apiend
\vspace{-16pt}

\apiitem{transmission_color}
\apiitem{radius}
\vspace{12pt}
Desired color resulting from white light transmitted a distance of
'transmission_depth' through the medium. Together with transmission_depth
this determines the extinction coefficient of the medium.
Average distance travelled inside the medium per color channel. This is typically taken
to be the mean-free path of the volume.
\apiend
\vspace{-16pt}

\apiitem{anisotropy}
\vspace{12pt}
Scattering anisotropy [-1,1]. Negative values give backwards scattering,
Expand Down
11 changes: 4 additions & 7 deletions src/doc/stdlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -1506,14 +1506,11 @@ properties of the physically-based shading nodes of MaterialX v1.38
: Normal vector of the surface point being shaded.

`albedo`
: Single-scattering albedo of the medium.

`transmission_depth`
: Distance travelled inside the medium by white light before its color becomes transmission_color by Beer's law. Given in scene length units, range [0,infinity). Together with transmission_color this determines the extinction coefficient of the medium.

`transmission_color`
: Desired color resulting from white light transmitted a distance of 'transmission_depth' through the medium. Together with transmission_depth this determines the extinction coefficient of the medium.
: Effective albedo of the medium (after multiple scattering). The renderer is expected to invert this color to derive the appropriate single-scattering albedo that will produce this color for the average random walk.

`radius`
: Average distance travelled inside the medium per color channel. This is typically taken to be the mean-free path of the volume.

`anisotropy`
: Scattering anisotropy [-1,1]. Negative values give backwards scattering, positive values give forward scattering, and 0.0 gives uniform scattering.

Expand Down
30 changes: 15 additions & 15 deletions src/include/OSL/oslnoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/liboslexec/builtindecl_wide_xmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ DECL(__OSL_MASKED_OP3(transform_normal, Wdv, Wdv, Wm), "xXXXii")
DECL(__OSL_MASKED_OP3(transform_normal, Wv, Wv, m), "xXXXii")
DECL(__OSL_MASKED_OP3(transform_normal, Wdv, Wdv, m), "xXXXii")

DECL(__OSL_MASKED_OP3(transform_color, Wv, s, s), "xXXiXissi")
DECL(__OSL_OP3(transform_color, v, s, s), "xXXiXiss")
DECL(__OSL_MASKED_OP3(transform_color, Wv, s, s), "xXXiXihhi")
DECL(__OSL_OP3(transform_color, v, s, s), "xXXiXihh")

DECL(__OSL_OP3(dot, Wf, Wv, Wv), "xXXX")
DECL(__OSL_MASKED_OP3(dot, Wf, Wv, Wv), "xXXXi")
Expand Down
8 changes: 4 additions & 4 deletions src/liboslexec/llvm_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,19 +628,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);
}


Expand Down Expand Up @@ -694,7 +694,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
}
Expand Down
3 changes: 1 addition & 2 deletions src/liboslexec/optexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ OSL_SHADEOP void
osl_texture_set_interp(void* opt, ustringhash_pod modename_)
{
ustringhash modename_hash = ustringhash_from(modename_);
ustring modename = ustring_from(modename_hash);
int mode = tex_interp_to_code(modename);
int mode = tex_interp_to_code(modename_hash);
if (mode >= 0)
((TextureOpt*)opt)->interpmode = (TextureOpt::InterpMode)mode;
}
Expand Down
3 changes: 1 addition & 2 deletions src/liboslexec/runtimeoptimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3348,8 +3348,7 @@ 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) {
Expand Down
4 changes: 2 additions & 2 deletions src/liboslexec/shadingsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4599,7 +4599,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_),
Expand Down Expand Up @@ -4635,7 +4635,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;
}
Expand Down
9 changes: 3 additions & 6 deletions src/liboslexec/wide/wide_optest_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
14 changes: 7 additions & 7 deletions src/liboslexec/wide/wide_shadingsys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 " : "",
ustring_from(symbolname),
Expand Down Expand Up @@ -69,7 +69,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],
Expand Down Expand Up @@ -108,7 +108,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],
Expand Down Expand Up @@ -145,7 +145,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;
}
Expand Down Expand Up @@ -202,7 +202,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;
}
Expand Down Expand Up @@ -268,7 +268,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;
}
Expand Down Expand Up @@ -335,7 +335,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/liboslnoise/gabornoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/liboslnoise/sfm_gabornoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/shaders/stdosl.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,17 +587,13 @@ closure color transparent_bsdf() BUILTIN;
// Constructs a BSSRDF for subsurface scattering within a homogeneous medium.
//
// \param N Normal vector of the surface point being shaded.
// \param albedo Single-scattering albedo of the medium.
// \param transmission_depth Distance travelled inside the medium by white light before its color becomes transmission_color by Beer's law.
// Given in scene length units, range [0,infinity). Together with transmission_color this determines the extinction
// coefficient of the medium.
// \param transmission_color Desired color resulting from white light transmitted a distance of 'transmission_depth' through the medium.
// Together with transmission_depth this determines the extinction coefficient of the medium.
// \param albedo Effective albedo of the medium (after multiple scattering). The renderer is expected to invert this color to derive the appropriate single-scattering albedo that will produce this color for the average random walk.
// \param radius Average distance travelled inside the medium per color channel. This is typically taken to be the mean-free path of the volume.
// \param anisotropy Scattering anisotropy [-1,1]. Negative values give backwards scattering, positive values give forward scattering,
// and 0.0 gives uniform scattering.
// \param label Optional string parameter to name this component. For use in AOVs / LPEs.
//
closure color subsurface_bssrdf(normal N, color albedo, float transmission_depth, color transmission_color, float anisotropy) BUILTIN;
closure color subsurface_bssrdf(normal N, color albedo, color radius, float anisotropy) BUILTIN;

// Constructs a microfacet BSDF for the back-scattering properties of cloth-like materials.
// This closure may be vertically layered over a base BSDF, where energy that is not reflected
Expand Down
Loading

0 comments on commit be092fc

Please sign in to comment.