Commit: 23af8984bb6be579115a4b0e81b65f8cb5a31e83
Author: Sergey Sharybin
Date:   Thu Mar 5 20:24:41 2015 +0500
Branches: master
https://developer.blender.org/rB23af8984bb6be579115a4b0e81b65f8cb5a31e83

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.

===================================================================

M       source/blender/compositor/operations/COM_RenderLayersProg.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp 
b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index 27936c2..121998b 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) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to