diff --git a/app/render/pixelformat.cpp b/app/render/pixelformat.cpp index 59fd09d0e..89e481961 100644 --- a/app/render/pixelformat.cpp +++ b/app/render/pixelformat.cpp @@ -48,6 +48,27 @@ bool PixelFormat::FormatHasAlphaChannel(const PixelFormat::Format &format) return false; } +bool PixelFormat::FormatIsFloat(const PixelFormat::Format &format) +{ + switch (format) { + case PixelFormat::PIX_FMT_RGB16F: + case PixelFormat::PIX_FMT_RGBA16F: + case PixelFormat::PIX_FMT_RGB32F: + case PixelFormat::PIX_FMT_RGBA32F: + return true; + + case PixelFormat::PIX_FMT_RGB8: + case PixelFormat::PIX_FMT_RGBA8: + case PixelFormat::PIX_FMT_RGB16U: + case PixelFormat::PIX_FMT_RGBA16U: + case PixelFormat::PIX_FMT_INVALID: + case PixelFormat::PIX_FMT_COUNT: + break; + } + + return false; +} + OIIO::TypeDesc::BASETYPE PixelFormat::GetOIIOTypeDesc(const PixelFormat::Format &format) { switch (format) { diff --git a/app/render/pixelformat.h b/app/render/pixelformat.h index 7f9a59555..d4d26726c 100644 --- a/app/render/pixelformat.h +++ b/app/render/pixelformat.h @@ -114,6 +114,11 @@ public: */ static bool FormatHasAlphaChannel(const Format& format); + /** + * @brief Simple convenience function returning whether a pixel format is float-based or integer-based + */ + static bool FormatIsFloat(const Format& format); + /** * @brief Get corresponding OpenImageIO TypeDesc for a given pixel format */