Skip to content

Commit 438e5c8

Browse files
committed
Use more modern span-based set_pixels with sufficienty new OIIO
Signed-off-by: Larry Gritz <[email protected]>
1 parent 525e148 commit 438e5c8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/testrender/optixraytracer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,12 @@ OptixRaytracer::finalize_pixel_buffer()
12521252
reinterpret_cast<void*>(d_output_buffer),
12531253
m_xres * m_yres * 3 * sizeof(float),
12541254
cudaMemcpyDeviceToHost));
1255+
#ifdef OIIO_VERSION_GREATER_EQUAL(3,1,0)
1256+
pixelbuf.set_pixels(OIIO::ROI::All(), OIIO::TypeFloat,
1257+
OIIO::make_cspan(tmp_buff));
1258+
#else
12551259
pixelbuf.set_pixels(OIIO::ROI::All(), OIIO::TypeFloat, tmp_buff.data());
1260+
#endif
12561261
}
12571262

12581263

src/testshade/optixgridrender.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,14 @@ OptixGridRenderer::finalize_pixel_buffer()
10881088
m_xres * m_yres * 3 * sizeof(float),
10891089
cudaMemcpyDeviceToHost));
10901090
OIIO::ImageBuf* buf = outputbuf(0);
1091-
if (buf)
1091+
if (buf) {
1092+
#ifdef OIIO_VERSION_GREATER_EQUAL(3,1,0)
1093+
buf->set_pixels(OIIO::ROI::All(), OIIO::TypeFloat,
1094+
OIIO::make_cspan(tmp_buff));
1095+
#else
10921096
buf->set_pixels(OIIO::ROI::All(), OIIO::TypeFloat, tmp_buff.data());
1097+
#endif
1098+
}
10931099
}
10941100

10951101

0 commit comments

Comments
 (0)