From 23af8984bb6be579115a4b0e81b65f8cb5a31e83 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 5 Mar 2015 20:24:41 +0500 Subject: Compositor: Add sanity check around pass element size and compositor data type Only happening in the debug builds, avoids issues like recent AO one from happening. --- .../compositor/operations/COM_RenderLayersProg.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/blender/compositor') diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index 27936c21545..121998b5569 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -135,6 +135,27 @@ void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y int iy = y - dy; #endif +#ifndef NDEBUG + { + const DataType data_type = this->getOutputSocket()->getDataType(); + int actual_element_size = this->m_elementsize; + int expected_element_size; + if (data_type == COM_DT_VALUE) { + expected_element_size = 1; + } + else if (data_type == COM_DT_VECTOR) { + expected_element_size = 3; + } + else if (data_type == COM_DT_COLOR) { + expected_element_size = 4; + } + else { + BLI_assert(!"Something horribly wrong just happened"); + } + BLI_assert(expected_element_size == actual_element_size); + } +#endif + if (this->m_inputBuffer == NULL) { int elemsize = this->m_elementsize; if (elemsize == 1) { -- cgit v1.2.3