Skip to content

Commit ceeaa87

Browse files
committed
build: Prepare for OIIO 3.0 by replacing long-deprecated ASSERT (#1881)
Signed-off-by: Larry Gritz <[email protected]>
1 parent f365786 commit ceeaa87

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

src/include/OSL/batched_texture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ template<int WidthT> class BatchedTextureOutputs {
225225
, m_errormessage(errormessage)
226226
, m_mask(mask)
227227
{
228-
ASSERT(chans == 1 || chans == 3);
228+
OSL_ASSERT(chans == 1 || chans == 3);
229229
}
230230

231231
OSL_FORCEINLINE Mask<WidthT> mask() const { return m_mask; }

src/liboslexec/batched_backendllvm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class BatchedBackendLLVM : public OSOProcessorBase {
296296

297297
inline llvm::Value* getTempMask(const std::string& name = "")
298298
{
299-
ASSERT(
299+
OSL_ASSERT(
300300
!m_temp_scopes.empty()
301301
&& "An instance of BatchedBackendLLVM::TempScope must exist higher up in the call stack");
302302
return getOrAllocateTemp(TypeSpec(TypeDesc::INT), false /*derivs*/,

src/liboslexec/batched_llvm_instance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ init_wide_function_map(const ConcreteT&, ShadingSystemImpl& shadingsys)
307307
<< std::endl
308308
<< "OIIO::Plugin::geterror()="
309309
<< OIIO::Plugin::geterror();
310-
ASSERT(
310+
OSL_ASSERT(
311311
0
312312
&& "Unable to find precompiled OSL library function in shared library. This indicates a build/configuration problem. We can't continue");
313313
}

src/liboslexec/wide/wide_optexture.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ default_texture3d(BatchedRendererServices* bsr, ustring filename,
218218
Wide<const Vec3> wdPdz, BatchedTextureOutputs& outputs)
219219
{
220220
Mask status(false);
221-
ASSERT(nullptr != bsg);
221+
OSL_ASSERT(nullptr != bsg);
222222
ShadingContext* context = bsg->uniform.context;
223223
if (!texture_thread_info)
224224
texture_thread_info = context->texture_thread_info();
@@ -233,7 +233,7 @@ default_texture3d(BatchedRendererServices* bsr, ustring filename,
233233
MaskedData alphaRef = outputs.alpha();
234234
bool has_derivs = resultRef.has_derivs() | alphaRef.has_derivs();
235235

236-
ASSERT(resultRef.valid());
236+
OSL_ASSERT(resultRef.valid());
237237

238238
// Convert our BatchedTextureOptions to a single TextureOpt
239239
// and submit them 1 at a time through existing non-batched interface
@@ -403,7 +403,7 @@ default_environment(BatchedRendererServices* bsr, ustring filename,
403403
BatchedTextureOutputs& outputs)
404404
{
405405
Mask status(false);
406-
ASSERT(nullptr != bsg);
406+
OSL_ASSERT(nullptr != bsg);
407407
ShadingContext* context = bsg->uniform.context;
408408
if (!texture_thread_info)
409409
texture_thread_info = context->texture_thread_info();
@@ -417,7 +417,7 @@ default_environment(BatchedRendererServices* bsr, ustring filename,
417417
MaskedData resultRef = outputs.result();
418418
MaskedData alphaRef = outputs.alpha();
419419

420-
ASSERT(resultRef.valid());
420+
OSL_ASSERT(resultRef.valid());
421421

422422
// Convert our BatchedTextureOptions to a single TextureOpt
423423
// and submit them 1 at a time through existing non-batched interface
@@ -567,7 +567,7 @@ transformWideTextureGradients(BatchedTextureOutputs& outputs,
567567
}
568568
}
569569
} else {
570-
// keep assert out of inlined code
570+
// keep OSL_assert out of inlined code
571571
OSL_DASSERT(Masked<Color3>::is(resultRef));
572572
OSL_FORCEINLINE_BLOCK
573573
{
@@ -642,7 +642,7 @@ transformWideTextureGradientsTexture3d(BatchedTextureOutputs& outputs,
642642
}
643643
}
644644
} else {
645-
// keep assert out of inlined code
645+
// keep OSL_assert out of inlined code
646646
OSL_DASSERT(Masked<Color3>::is(resultRef));
647647
OSL_FORCEINLINE_BLOCK
648648
{
@@ -762,7 +762,7 @@ __OSL_MASKED_OP(texture3d)(void* bsg_, void* name, void* handle,
762762
int alphaHasDerivs, void* errormessage, int mask_)
763763
{
764764
Mask mask(mask_);
765-
ASSERT(!mask.all_off());
765+
OSL_ASSERT(!mask.all_off());
766766

767767
auto* bsg = reinterpret_cast<BatchedShaderGlobals*>(bsg_);
768768
auto& opt = *reinterpret_cast<const BatchedTextureOptions*>(opt_);
@@ -815,7 +815,7 @@ __OSL_MASKED_OP(environment)(void* bsg_, void* name, void* handle,
815815
int alphaHasDerivs, void* errormessage, int mask_)
816816
{
817817
Mask mask(mask_);
818-
ASSERT(!mask.all_off());
818+
OSL_ASSERT(!mask.all_off());
819819

820820
auto* bsg = reinterpret_cast<BatchedShaderGlobals*>(bsg_);
821821
auto& opt = *reinterpret_cast<const BatchedTextureOptions*>(opt_);

src/liboslexec/wide/wide_shadingsys.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ __OSL_OP1(get_attribute, s)(void* bsg_, int dest_derivs, ustring_pod obj_name_,
447447
int mask_)
448448
{
449449
Mask mask(mask_);
450-
ASSERT(mask.any_on());
450+
OSL_ASSERT(mask.any_on());
451451

452452
auto* bsg = reinterpret_cast<BatchedShaderGlobals*>(bsg_);
453453
ustringrep obj_name = USTR(obj_name_);
@@ -478,7 +478,7 @@ __OSL_MASKED_OP1(get_attribute,
478478
const void* attr_type, void* wide_attr_dest, int mask_)
479479
{
480480
Mask mask(mask_);
481-
ASSERT(mask.any_on());
481+
OSL_ASSERT(mask.any_on());
482482

483483
auto* bsg = reinterpret_cast<BatchedShaderGlobals*>(bsg_);
484484
ustringrep obj_name = USTR(obj_name_);

src/testshade/batched_simplerend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ BatchedSimpleRenderer<WidthT>::get_array_attribute_uniform(
589589
BatchedShaderGlobals* bsg, ustringhash object, ustringhash name, int index,
590590
RefData val)
591591
{
592-
ASSERT(!name.empty());
592+
OSL_ASSERT(!name.empty());
593593

594594
auto g = m_uniform_attr_getters.find(name);
595595
if (g != m_uniform_attr_getters.end()) {

src/testshade/testshade.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ setup_output_images(SimpleRenderer* rend, ShadingSystem* shadingsys,
11981198
if (batch_size == 16) {
11991199
shadingsys->batched<16>().jit_group(shadergroup.get(), ctx);
12001200
} else {
1201-
ASSERT((batch_size == 8) && "Unsupported batch size");
1201+
OSL_ASSERT((batch_size == 8) && "Unsupported batch size");
12021202
shadingsys->batched<8>().jit_group(shadergroup.get(), ctx);
12031203
}
12041204
} else
@@ -2204,7 +2204,7 @@ test_shade(int argc, const char* argv[])
22042204
sub_roi, save);
22052205
});
22062206
} else {
2207-
ASSERT((batch_size == 8) && "Unsupported batch size");
2207+
OSL_ASSERT((batch_size == 8) && "Unsupported batch size");
22082208
OIIO::ImageBufAlgo::parallel_image(
22092209
roi, num_threads, [&](OIIO::ROI sub_roi) -> void {
22102210
batched_shade_region<8>(rend, shadergroup.get(),

0 commit comments

Comments
 (0)