Skip to content

Commit a452150

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 a452150

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/testrender/optixraytracer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,11 @@ OptixRaytracer::finalize_pixel_buffer()
12521252
reinterpret_cast<void*>(d_output_buffer),
12531253
m_xres * m_yres * 3 * sizeof(float),
12541254
cudaMemcpyDeviceToHost));
1255+
#if OIIO_VERSION_GREATER_EQUAL(3,1,0)
1256+
pixelbuf.set_pixels(OIIO::ROI::All(), OIIO::make_cspan(tmp_buff));
1257+
#else
12551258
pixelbuf.set_pixels(OIIO::ROI::All(), OIIO::TypeFloat, tmp_buff.data());
1259+
#endif
12561260
}
12571261

12581262

src/testshade/optixgridrender.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,13 @@ 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+
#if OIIO_VERSION_GREATER_EQUAL(3,1,0)
1093+
buf->set_pixels(OIIO::ROI::All(), OIIO::make_cspan(tmp_buff));
1094+
#else
10921095
buf->set_pixels(OIIO::ROI::All(), OIIO::TypeFloat, tmp_buff.data());
1096+
#endif
1097+
}
10931098
}
10941099

10951100

0 commit comments

Comments
 (0)