MCPcopy Create free account
hub / github.com/PixarAnimationStudios/OpenUSD / _Compile

Method _Compile

pxr/exec/exec/inputResolvingCompilationTask.cpp:19–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include "pxr/base/trace/trace.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21void
22Exec_InputResolvingCompilationTask::_Compile(
23 Exec_CompilationState &compilationState,
24 TaskPhases &taskPhases)
25{
26 TRACE_FUNCTION();
27 TfAutoMallocTag tag("Exec", __ARCH_PRETTY_FUNCTION__);
28
29 taskPhases.Invoke(
30 // Generate the output key (or multiple output keys) to compile from the
31 // input key, and create new subtasks for any outputs that still need to be
32 // compiled.
33 [this, &compilationState](TaskDependencies &deps) {
34 TRACE_FUNCTION_SCOPE("compile sources");
35
36 // Generate all the output keys for this input.
37 _outputKeys = Exec_ResolveInput(
38 compilationState.GetStage(),
39 _originObject,
40 // We use the schema config key of the dispatching prim for
41 // computation lookup if this input requests dispatched
42 // computations.
43 (_inputKey.fallsBackToDispatched
44 ? _dispatchingSchemaKey : EsfSchemaConfigKey()),
45 _inputKey,
46 _journal);
47 _resultOutputs->resize(_outputKeys.size());
48
49 // For every output key, make sure it's either already available or
50 // a task has been kicked off to produce it.
51 for (size_t i = 0; i < _outputKeys.size(); ++i) {
52 const Exec_OutputKey &outputKey = _outputKeys[i];
53 VdfMaskedOutput *const resultOutput = &(*_resultOutputs)[i];
54
55 const Exec_OutputKey::Identity outputKeyIdentity =
56 outputKey.MakeIdentity();
57 const Exec_CompiledOutputCache::MappedType *const cacheHit =
58 compilationState.GetProgram()->GetCompiledOutput(
59 outputKeyIdentity);
60 if (cacheHit) {
61 *resultOutput = cacheHit->output;
62 continue;
63 }
64
65 // Claim the task for producing the missing output.
66 if (deps.ClaimOutputProvidingTask(outputKeyIdentity)) {
67 // Run the task that produces the output.
68 deps.NewSubtask<Exec_OutputProvidingCompilationTask>(
69 compilationState,
70 outputKey,
71 resultOutput);
72 }
73 }
74 },
75
76 // Compiled outputs are now all available and can be retrieved from the

Callers

nothing calls this directly

Calls 10

Exec_ResolveInputFunction · 0.85
EsfSchemaConfigKeyFunction · 0.85
resizeMethod · 0.80
MakeIdentityMethod · 0.80
GetCompiledOutputMethod · 0.80
GetProgramMethod · 0.80
InvokeMethod · 0.45
GetStageMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected