Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/render/film.cpp')
-rw-r--r--intern/cycles/render/film.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index bc51384b873..376e9d6d0ca 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -21,12 +21,20 @@
#include "film.h"
#include "scene.h"
+#include "util_algorithm.h"
#include "util_foreach.h"
CCL_NAMESPACE_BEGIN
/* Pass */
+static bool compare_pass_order(const Pass& a, const Pass& b)
+{
+ if(a.components == b.components)
+ return (a.type < b.type);
+ return (a.components > b.components);
+}
+
void Pass::add(PassType type, vector<Pass>& passes)
{
Pass pass;
@@ -106,6 +114,10 @@ void Pass::add(PassType type, vector<Pass>& passes)
}
passes.push_back(pass);
+
+ /* order from by components, to ensure alignment so passes with size 4
+ come first and then passes with size 1 */
+ sort(passes.begin(), passes.end(), compare_pass_order);
}
bool Pass::equals(const vector<Pass>& A, const vector<Pass>& B)
@@ -219,6 +231,8 @@ void Film::device_update(Device *device, DeviceScene *dscene)
kfilm->pass_stride += pass.components;
}
+ kfilm->pass_stride = align_up(kfilm->pass_stride, 4);
+
need_update = false;
}