Skip to content

Commit b20a55e

Browse files
authored
cleanup: OIIO deprecations (#1834)
Various minor changes to eliminate reference to some long-ago deprecated OIIO items (mostly which simply alias to std versions) before then disappear for real. Signed-off-by: Larry Gritz <[email protected]>
1 parent 2362523 commit b20a55e

File tree

9 files changed

+36
-39
lines changed

9 files changed

+36
-39
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ add_definitions (-DOSL_INTERNAL=1)
139139

140140
# To make sure we aren't relying on deprecated OIIO features, we define
141141
# OIIO_DISABLE_DEPRECATED before including any OIIO headers.
142-
add_definitions (-DOIIO_DISABLE_DEPRECATED=1)
142+
add_definitions (-DOIIO_DISABLE_DEPRECATED=900000)
143143

144144
# Set the default namespace. For symbol hiding reasons, it's important that
145145
# the project name is a subset of the namespace name.

src/include/OSL/oslnoise.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,28 +154,28 @@ bitcast_to_uint (float x)
154154
OSL_FORCEINLINE void
155155
bjmix(vint4& a, vint4& b, vint4& c)
156156
{
157-
using OIIO::simd::rotl32;
158-
a -= c; a ^= rotl32(c, 4); c += b;
159-
b -= a; b ^= rotl32(a, 6); a += c;
160-
c -= b; c ^= rotl32(b, 8); b += a;
161-
a -= c; a ^= rotl32(c,16); c += b;
162-
b -= a; b ^= rotl32(a,19); a += c;
163-
c -= b; c ^= rotl32(b, 4); b += a;
157+
using OIIO::simd::rotl;
158+
a -= c; a ^= rotl(c, 4); c += b;
159+
b -= a; b ^= rotl(a, 6); a += c;
160+
c -= b; c ^= rotl(b, 8); b += a;
161+
a -= c; a ^= rotl(c,16); c += b;
162+
b -= a; b ^= rotl(a,19); a += c;
163+
c -= b; c ^= rotl(b, 4); b += a;
164164
}
165165

166166
// Perform a bjfinal (see OpenImageIO/hash.h) on 4 sets of values at once.
167167
OSL_FORCEINLINE vint4
168168
bjfinal(const vint4& a_, const vint4& b_, const vint4& c_)
169169
{
170-
using OIIO::simd::rotl32;
170+
using OIIO::simd::rotl;
171171
vint4 a(a_), b(b_), c(c_);
172-
c ^= b; c -= rotl32(b,14);
173-
a ^= c; a -= rotl32(c,11);
174-
b ^= a; b -= rotl32(a,25);
175-
c ^= b; c -= rotl32(b,16);
176-
a ^= c; a -= rotl32(c,4);
177-
b ^= a; b -= rotl32(a,14);
178-
c ^= b; c -= rotl32(b,24);
172+
c ^= b; c -= rotl(b,14);
173+
a ^= c; a -= rotl(c,11);
174+
b ^= a; b -= rotl(a,25);
175+
c ^= b; c -= rotl(b,16);
176+
a ^= c; a -= rotl(c,4);
177+
b ^= a; b -= rotl(a,14);
178+
c ^= b; c -= rotl(b,24);
179179
return c;
180180
}
181181
#endif

src/liboslexec/llvm_ops.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,19 +628,19 @@ osl_step_vvv(void* result, void* edge, void* x)
628628
OSL_SHADEOP int
629629
osl_isnan_if(float f)
630630
{
631-
return OIIO::isnan(f);
631+
return std::isnan(f);
632632
}
633633

634634
OSL_SHADEOP int
635635
osl_isinf_if(float f)
636636
{
637-
return OIIO::isinf(f);
637+
return std::isinf(f);
638638
}
639639

640640
OSL_SHADEOP int
641641
osl_isfinite_if(float f)
642642
{
643-
return OIIO::isfinite(f);
643+
return std::isfinite(f);
644644
}
645645

646646

@@ -694,7 +694,7 @@ safe_div(float a, float b)
694694
// to see if is finite and return 0.0f when it is not.
695695
// Typical implementation isfinite is (fabs(v) != INF), so not too expensive.
696696
float q = a / b;
697-
return OIIO::isfinite(q) ? q : 0.0f;
697+
return std::isfinite(q) ? q : 0.0f;
698698
// TODO: add a FTZ mode and only add checking the result when FTZ is disabled
699699
#endif
700700
}

src/liboslexec/shadingsys.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,7 +4599,7 @@ osl_naninf_check(int ncomps, const void* vals_, int has_derivs, void* sg,
45994599
for (int d = 0; d < (has_derivs ? 3 : 1); ++d) {
46004600
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
46014601
int i = d * ncomps + c;
4602-
if (!OIIO::isfinite(vals[i])) {
4602+
if (!std::isfinite(vals[i])) {
46034603
OSL::errorfmt(ec, "Detected {} value in {}{} at {}:{} (op {})",
46044604
vals[i], d > 0 ? "the derivatives of " : "",
46054605
OSL::ustringhash_from(symbolname_),
@@ -4635,7 +4635,7 @@ osl_uninit_check(long long typedesc_, void* vals_, void* sg,
46354635
if (typedesc.basetype == TypeDesc::FLOAT) {
46364636
float* vals = (float*)vals_;
46374637
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
4638-
if (!OIIO::isfinite(vals[c])) {
4638+
if (!std::isfinite(vals[c])) {
46394639
uninit = true;
46404640
vals[c] = 0;
46414641
}

src/liboslexec/wide/wide_optest_float.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,14 @@ OSL_USING_DATA_WIDTH(__OSL_WIDTH)
2525

2626
#include "define_opname_macros.h"
2727

28-
#define __OSL_XMACRO_ARGS (isnan, OIIO::isnan)
29-
//#define __OSL_XMACRO_ARGS (isnan,std::isnan)
28+
#define __OSL_XMACRO_ARGS (isnan, std::isnan)
3029
#include "wide_optest_float_xmacro.h"
3130

32-
#define __OSL_XMACRO_ARGS (isinf, OIIO::isinf)
31+
#define __OSL_XMACRO_ARGS (isinf, std::isinf)
3332
//#define __OSL_XMACRO_ARGS (isinf, sfm::isinf)
34-
//#define __OSL_XMACRO_ARGS (isinf, std::isinf)
3533
#include "wide_optest_float_xmacro.h"
3634

37-
#define __OSL_XMACRO_ARGS (isfinite, OIIO::isfinite)
38-
//#define __OSL_XMACRO_ARGS (isfinite,std::isfinite)
35+
#define __OSL_XMACRO_ARGS (isfinite, std::isfinite)
3936
#include "wide_optest_float_xmacro.h"
4037

4138

src/liboslexec/wide/wide_shadingsys.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ __OSL_OP(naninf_check)(int ncomps, const void* vals_, int has_derivs,
3939
for (int d = 0; d < (has_derivs ? 3 : 1); ++d) {
4040
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
4141
int i = d * ncomps + c;
42-
if (!OIIO::isfinite(vals[i])) {
42+
if (!std::isfinite(vals[i])) {
4343
ctx->errorfmt("Detected {} value in {}{} at {}:{} (op {})",
4444
vals[i], d > 0 ? "the derivatives of " : "",
4545
USTR(symbolname), USTR(sourcefile), sourceline,
@@ -68,7 +68,7 @@ __OSL_MASKED_OP1(naninf_check_offset,
6868
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
6969
int i = d * ncomps + c;
7070
mask.foreach ([=](ActiveLane lane) -> void {
71-
if (!OIIO::isfinite(vals[i * __OSL_WIDTH + lane])) {
71+
if (!std::isfinite(vals[i * __OSL_WIDTH + lane])) {
7272
ctx->errorfmt(
7373
"Detected {} value in {}{} at {}:{} (op {}) batch lane:{}",
7474
vals[i * __OSL_WIDTH + lane],
@@ -107,7 +107,7 @@ __OSL_MASKED_OP1(naninf_check_offset,
107107
int firstcheck = wOffsets[lane];
108108
for (int c = firstcheck, e = c + nchecks; c < e; ++c) {
109109
int i = d * ncomps + c;
110-
if (!OIIO::isfinite(vals[i * __OSL_WIDTH + lane])) {
110+
if (!std::isfinite(vals[i * __OSL_WIDTH + lane])) {
111111
ctx->errorfmt(
112112
"Detected {} value in {}{} at {}:{} (op {}) batch lane:{}",
113113
vals[i * __OSL_WIDTH + lane],
@@ -143,7 +143,7 @@ __OSL_OP2(uninit_check_values_offset, X,
143143
if (typedesc.basetype == TypeDesc::FLOAT) {
144144
float* vals = (float*)vals_;
145145
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
146-
if (!OIIO::isfinite(vals[c])) {
146+
if (!std::isfinite(vals[c])) {
147147
uninit = true;
148148
vals[c] = 0;
149149
}
@@ -200,7 +200,7 @@ __OSL_MASKED_OP2(uninit_check_values_offset, WX,
200200
float* vals = (float*)vals_;
201201
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
202202
mask.foreach ([=, &lanes_uninit](ActiveLane lane) -> void {
203-
if (!OIIO::isfinite(vals[c * __OSL_WIDTH + lane])) {
203+
if (!std::isfinite(vals[c * __OSL_WIDTH + lane])) {
204204
lanes_uninit.set_on(lane);
205205
vals[c * __OSL_WIDTH + lane] = 0;
206206
}
@@ -265,7 +265,7 @@ __OSL_MASKED_OP2(uninit_check_values_offset, X,
265265
mask.foreach ([=, &lanes_uninit](ActiveLane lane) -> void {
266266
int firstcheck = wOffsets[lane];
267267
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
268-
if (!OIIO::isfinite(vals[c])) {
268+
if (!std::isfinite(vals[c])) {
269269
lanes_uninit.set_on(lane);
270270
vals[c] = 0;
271271
}
@@ -331,7 +331,7 @@ __OSL_MASKED_OP2(uninit_check_values_offset, WX,
331331
mask.foreach ([=, &lanes_uninit](ActiveLane lane) -> void {
332332
int firstcheck = wOffsets[lane];
333333
for (int c = firstcheck, e = firstcheck + nchecks; c < e; ++c)
334-
if (!OIIO::isfinite(vals[c * __OSL_WIDTH + lane])) {
334+
if (!std::isfinite(vals[c * __OSL_WIDTH + lane])) {
335335
lanes_uninit.set_on(lane);
336336
vals[c * __OSL_WIDTH + lane] = 0;
337337
}

src/liboslnoise/gabornoise.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ gabor_cell(GaborParams& gp, const Vec3& c_i, const Dual2<Vec3>& x_c_i,
175175
Dual2<float> gk = gabor_kernel(w_i_t_s_f, omega_i_t_s_f,
176176
phi_i_t_s_f, a_i_t_s_f,
177177
x_k_i_t); // 2D
178-
if (!OIIO::isfinite(gk.val())) {
178+
if (!std::isfinite(gk.val())) {
179179
// Numeric failure of the filtered version. Fall
180180
// back on the unfiltered.
181181
gk = gabor_kernel(gp.weight, omega_i, phi_i, gp.a,

src/liboslnoise/sfm_gabornoise.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ gabor_cell(const sfm::GaborUniformParams& gup, const sfm::GaborParams& gp,
367367
//bool not_finite = std::isnan(gk.val()) | std::isinf(gk.val());
368368
bool not_finite = std::isnan(gk.val()) || std::isinf(gk.val());
369369
#else
370-
bool not_finite = !OIIO::isfinite(gk.val());
370+
bool not_finite = !std::isfinite(gk.val());
371371
#endif
372372
if (OSL_UNLIKELY(not_finite)) {
373373
// Numeric failure of the filtered version. Fall

src/testshade/testshade.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,8 @@ save_outputs(SimpleRenderer* rend, ShadingSystem* shadingsys,
12691269
// We are outputting an integer variable, so we need to
12701270
// convert it to floating point.
12711271
float* pixel = OSL_ALLOCA(float, nchans);
1272-
OIIO::convert_types(TypeDesc::BASETYPE(t.basetype), data,
1273-
TypeDesc::FLOAT, pixel, nchans);
1272+
OIIO::convert_pixel_values(TypeDesc::BASETYPE(t.basetype), data,
1273+
TypeDesc::FLOAT, pixel, nchans);
12741274
outputimg->setpixel(x, y, &pixel[0]);
12751275
if (print_outputs) {
12761276
print(" {} :", outputvarnames[i]);

0 commit comments

Comments
 (0)