MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / allocate

Method allocate

Source/Falcor/Utils/Algorithm/ParallelReduction.cpp:57–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void ParallelReduction::allocate(uint32_t elementCount, uint32_t elementSize)
58{
59 if (mpBuffers[0] == nullptr || mpBuffers[0]->getElementCount() < elementCount * elementSize)
60 {
61 // Buffer 0 has one element per tile.
62 mpBuffers[0] = mpDevice->createTypedBuffer<uint4>(elementCount * elementSize);
63 mpBuffers[0]->setName("ParallelReduction::mpBuffers[0]");
64
65 // Buffer 1 has one element per N elements in buffer 0.
66 const uint32_t numElem1 = div_round_up(elementCount, mpFinalProgram->getReflector()->getThreadGroupSize().x);
67 if (mpBuffers[1] == nullptr || mpBuffers[1]->getElementCount() < numElem1 * elementSize)
68 {
69 mpBuffers[1] = mpDevice->createTypedBuffer<uint4>(numElem1 * elementSize);
70 mpBuffers[1]->setName("ParallelReduction::mpBuffers[1]");
71 }
72 }
73}
74
75template<typename T>
76void ParallelReduction::execute(

Callers

nothing calls this directly

Calls 2

div_round_upFunction · 0.85
setNameMethod · 0.45

Tested by

no test coverage detected