]> git.tdb.fi Git - libs/gl.git/blobdiff - source/builders/sequencebuilder.cpp
Add debug name capability to more classes
[libs/gl.git] / source / builders / sequencebuilder.cpp
index 658ded0bc697a57bc36f8ca8b6548c4083d7ec25..6cf34c0ee1b38307654699c43969e78b082cb59f 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/core/algorithm.h>
 #include <msp/core/maputils.h>
+#include <msp/strings/format.h>
 #include "error.h"
 #include "renderbuffer.h"
 #include "sequence.h"
@@ -33,8 +34,22 @@ void SequenceBuilder::set_postprocessor(const string &name, PostProcessor &pproc
        get_item(postprocessors, name) = &pproc;
 }
 
+void SequenceBuilder::set_debug_name(const string &name)
+{
+#ifdef DEBUG
+       debug_name = name;
+#else
+       (void)name;
+#endif
+}
+
 void SequenceBuilder::build(Sequence &sequence) const
 {
+#ifdef DEBUG
+       if(!debug_name.empty())
+               sequence.set_debug_name(debug_name);
+#endif
+
        sequence.set_hdr(tmpl.get_hdr());
        sequence.set_alpha(tmpl.get_alpha());
        unsigned samples = min(tmpl.get_maximum_multisample(), Renderbuffer::get_max_samples());
@@ -53,7 +68,7 @@ void SequenceBuilder::build(Sequence &sequence) const
                Sequence::Step &step = sequence.add_step(i->tag, *renderable);
                step.set_blend(i->blend.get());
                step.set_depth_test(i->depth_test.get());
-               step.set_lighting(i->lighting.get());
+               step.set_lighting(i->lighting);
        }
 
        const SequenceTemplate::PostProcessorArray &postprocs = tmpl.get_postprocessors();
@@ -66,9 +81,15 @@ void SequenceBuilder::build(Sequence &sequence) const
                        sequence.add_postprocessor(*proc);
                else if(i->postprocessor_template)
                {
-                       proc = i->postprocessor_template->create(tmpl.get_resources(), sequence.get_width(), sequence.get_height());
+                       proc = i->postprocessor_template->create(sequence.get_width(), sequence.get_height());
                        if(proc)
+                       {
+#ifdef DEBUG
+                               if(!debug_name.empty())
+                                       proc->set_debug_name(format("%s/%d.pproc", debug_name, i-postprocs.begin()));
+#endif
                                sequence.add_postprocessor_owned(proc);
+                       }
                }
        }
 }