Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
job-ticket.cpp
Go to the documentation of this file.
1/*
2 JobTicket - execution plan for render jobs
3
4 Copyright (C)
5 2012, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
26#include "lib/hash-combine.hpp"
27#include "lib/depend.hpp"
28#include "lib/util.hpp"
29
30
31namespace steam {
32namespace engine {
33
34 using vault::gear::Job;
36 using lib::HashVal;
37 using lib::unConst;
38 using lib::time::FSecs;
39
40
41 namespace { // Details...
43
44 /* ======== hard wired =================*/
45 const FSecs JOB_MINIMUM_RUNTIME{1,1000};
46
47 } // (END) Details...
48
49
50
51
52
54 JobTicket JobTicket::NOP{};
55
57 : provision_{nopFunctor(), ExitNode::NIL}
58 { }
59
60
70 Job
72 {
73 if (this->empty())
74 {
75 return Job(nopFunctor(), InvocationInstanceID(), nominalTime);
76 }
77 else
78 {
79 REQUIRE (this->isValid(), "Attempt to generate render job for incomplete or unspecified render plan.");
80 JobClosure& functor = static_cast<JobClosure&> (unConst(provision_.jobFunctor));
82
83 return Job(functor, invoKey, nominalTime);
84 }
85 }
86
87
95 {
96 if (this->empty())
97 return Duration{JOB_MINIMUM_RUNTIME};
98 else
99 {
100 REQUIRE (isValid(), "Attempt to determine timings for incomplete or unspecified render plan.");
102 }
103 }
104
105
111 {
112 InvocationInstanceID res{seed};
113 HashVal timeMark = res.part.t;
114 lib::hash::combine (timeMark, hash_value (nominalTime));
115 res.part.t = timeMark;
116 return res;
117 }
118
119
120 namespace {
121 inline bool
122 operator== (InvocationInstanceID const& l, InvocationInstanceID const& r)
123 {
124 return lumiera_invokey_eq (unConst(&l), unConst(&r));
125 }
126 }
127
131 bool
132 JobTicket::verifyInstance (JobFunctor& functor, InvocationInstanceID const& invoKey, Time nominalTime) const
133 {
135 and invoKey == timeHash (nominalTime, provision_.invocationSeed);
136 }
137
138
139
140
141}} // namespace steam::engine
Access point to singletons and other kinds of dependencies designated by type.
Definition depend.hpp:281
Duration is the internal Lumiera time metric.
Lumiera's internal time value datatype.
A top-level point in the render node network where data generation can be driven.
Definition exit-node.hpp:65
Duration getUpperBoundRuntime() const
Duration getExpectedRuntime()
Core operation: guess expected runtime for rendering.
Job createJobFor(Time nominalTime)
Core operation: build a concrete render job based on this blueprint.
bool verifyInstance(JobFunctor &, InvocationInstanceID const &, Time) const
Helper for tests: verify the given invocation parameters match this JobTicket.
static JobTicket NOP
special »do nothing« JobTicket marker
static InvocationInstanceID timeHash(Time, InvocationInstanceID const &)
Tag the precomputed invocation ID with the nominal frame time.
Interface of the closure for frame rendering jobs.
Definition job.h:244
Individual frame rendering task, forwarding to a closure.
Definition job.h:276
Singleton services and Dependency Injection.
Hash combine function extracted from LibBoost 1.67 Combine two hash values to form a composite depend...
Execution plan to generate render jobs within a specific render process.
int lumiera_invokey_eq(void *l, void *r)
Definition job.cpp:154
opaque ID attached to each individual job invocation.
Definition job.h:105
void combine(size_t &combinedHash, size_t additionalHash)
meld the additional hash value into the given base hash value.
boost::rational< int64_t > FSecs
rational representation of fractional seconds
size_t HashVal
a STL compatible hash value
Definition hash-value.h:52
lib::Depend< vault::gear::NopJobFunctor > nopFunctor
@ NIL
abstract entry, not yet allocated
Steam-Layer implementation namespace root.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
Definition util.hpp:421
Generic implementation of a JobFunctor to perform no calculations.
InvocationInstanceID invocationSeed
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...