From 87092d3de453b34a879898e4288b30e172431493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Delgado=20Kr=C3=A4mer?= Date: Sat, 19 Oct 2024 15:31:16 +0200 Subject: [PATCH] Log OpenImageIO error on open failure --- src/libguc/src/image.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libguc/src/image.cpp b/src/libguc/src/image.cpp index dc52c7b..1b6d1d7 100644 --- a/src/libguc/src/image.cpp +++ b/src/libguc/src/image.cpp @@ -202,20 +202,23 @@ namespace detail int& channelCount) { #ifdef GUC_USE_OIIO - using namespace OIIO; + OIIO::Filesystem::IOMemReader memReader((void*) buffer.get(), bufferSize); - Filesystem::IOMemReader memReader((void*) buffer.get(), bufferSize); - - auto image = ImageInput::open(path, nullptr, &memReader); + auto image = OIIO::ImageInput::open(path, nullptr, &memReader); if (image) { assert(image->supports("ioproxy")); - const ImageSpec& spec = image->spec(); + const OIIO::ImageSpec& spec = image->spec(); channelCount = spec.nchannels; image->close(); return true; } + else + { + std::string errStr = OIIO::geterror(); + TF_RUNTIME_ERROR("OpenImageIO %s", errStr.c_str()); + } #else int width, height; int ok = stbi_info_from_memory((const stbi_uc*) buffer.get(), bufferSize, &width, &height, &channelCount);