From f3ac81bc5c6ce65d5843dde3a1d5f230353453e3 Mon Sep 17 00:00:00 2001 From: Merlin Nimier-David Date: Wed, 7 Dec 2022 16:33:54 +0100 Subject: [PATCH] Spectral mode: fix accidental conversion to double The multiplication with a double-typed constant lead to a float -> double -> float round-trip, which breaks the AD graph. It was only triggered in spectral modes. --- include/mitsuba/core/spectrum.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mitsuba/core/spectrum.h b/include/mitsuba/core/spectrum.h index 1fa4a600c..ba37fc7e2 100644 --- a/include/mitsuba/core/spectrum.h +++ b/include/mitsuba/core/spectrum.h @@ -373,7 +373,7 @@ Color spectrum_to_xyz(const Spectrum &value, Color res = { dr::mean(XYZ.x() * value), dr::mean(XYZ.y() * value), dr::mean(XYZ.z() * value) }; - return res * MI_CIE_Y_NORMALIZATION; + return res * (dr::scalar_t) MI_CIE_Y_NORMALIZATION; } /** @@ -388,7 +388,7 @@ Color spectrum_to_srgb(const Spectrum &value, Color res = { dr::mean(rgb.x() * value), dr::mean(rgb.y() * value), dr::mean(rgb.z() * value) }; - return res * MI_CIE_Y_NORMALIZATION; + return res * (dr::scalar_t) MI_CIE_Y_NORMALIZATION; } /// Convert ITU-R Rec. BT.709 linear RGB to XYZ tristimulus values