Deps: Include OIIO PR 4630

OIIO triggered some asserts in the debug configuration on windows
during file save, upstream PR 4630 is required to resolve these.
This commit is contained in:
Ray Molenkamp
2025-02-09 10:40:15 -07:00
parent 227750926d
commit 675bf068fe
2 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
diff --git a/src/libOpenImageIO/imagebuf.cpp b/src/libOpenImageIO/imagebuf.cpp
index 1cae86b9c9..b015995e9c 100644
--- a/src/libOpenImageIO/imagebuf.cpp
+++ b/src/libOpenImageIO/imagebuf.cpp
@@ -99,20 +99,20 @@ span_from_buffer(void* data, TypeDesc format, int nchannels, int width,
if (xstride >= 0) {
bufend += xstride * (width - 1);
} else {
- bufstart -= xstride * (width - 1);
+ bufstart += xstride * (width - 1);
}
// Expand to the span range for a whole image plane.
if (ystride >= 0) {
bufend += ystride * (height - 1);
} else {
- bufstart -= ystride * (height - 1);
+ bufstart += ystride * (height - 1);
}
// Expand to the span range for a whole volume.
if (depth > 1 && zstride != 0) {
if (zstride >= 0) {
bufend += zstride * (depth - 1);
} else {
- bufstart -= zstride * (depth - 1);
+ bufstart += zstride * (depth - 1);
}
}
return { bufstart, size_t(bufend - bufstart) };
@@ -905,7 +905,7 @@ ImageBufImpl::set_bufspan_localpixels(span<std::byte> bufspan,
}
m_bufspan = bufspan;
m_localpixels = (char*)buforigin;
- OIIO_DASSERT(check_span(m_bufspan, m_localpixels, spec().format));
+ OIIO_ASSERT(check_span(m_bufspan, m_localpixels, spec().format));
}
diff --git a/src/libOpenImageIO/imagebuf_test.cpp b/src/libOpenImageIO/imagebuf_test.cpp
index 2785ccf96c..9ef4219f73 100644
--- a/src/libOpenImageIO/imagebuf_test.cpp
+++ b/src/libOpenImageIO/imagebuf_test.cpp
@@ -300,6 +300,31 @@ ImageBuf_test_appbuffer_strided()
}
}
}
+
+ // Test negative strides by filling with yellow, backwards
+ {
+ ImageBufAlgo::fill(wrapped, cspan<float>(green));
+ // Use the ImageBuf constructor from a pointer to the last pixel and
+ // negative strides. But don't include the edge pixels of the original
+ // buffer.
+ ImageBuf neg(ImageSpec(res - 2, res - 2, nchans, TypeFloat),
+ &mem[res - 2][res - 2][0] /* point to last pixel */,
+ -nchans * sizeof(float) /* negative x stride */,
+ -res * nchans * sizeof(float) /* negative y stride*/);
+ const float yellow[nchans] = { 1.0f, 1.0f, 0.0f };
+ ImageBufAlgo::fill(neg, cspan<float>(yellow));
+
+ for (int y = 0; y < res; ++y) {
+ for (int x = 0; x < res; ++x) {
+ if (x == 0 || x == res - 1 || y == 0 || y == res - 1)
+ OIIO_CHECK_ASSERT(make_cspan(mem[y][x], nchans)
+ == make_cspan(green));
+ else
+ OIIO_CHECK_ASSERT(make_cspan(mem[y][x], nchans)
+ == make_cspan(yellow));
+ }
+ }
+ }
}

View File

@@ -131,6 +131,9 @@ ExternalProject_Add(external_openimageio
${PATCH_CMD} -p 1 -N -d
${BUILD_DIR}/openimageio/src/external_openimageio/ <
${PATCH_DIR}/openimageio.diff &&
${PATCH_CMD} -p 1 -N -d
${BUILD_DIR}/openimageio/src/external_openimageio/ <
${PATCH_DIR}/oiio_4630.diff &&
${PATCH_CMD} -p 1 -N -d
${BUILD_DIR}/openimageio/src/external_openimageio/ <
${PATCH_DIR}/oiio_windows_arm64.diff