MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / GetNumActiveElements

Method GetNumActiveElements

GTE/Graphics/DX11/DX11StructuredBuffer.cpp:110–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110bool DX11StructuredBuffer::GetNumActiveElements(
111 ID3D11DeviceContext* context)
112{
113 // Copy the number of active elements from GPU to staging buffer.
114 context->CopyStructureCount(mCounterStaging, 0, mUAView);
115
116 // Map the staging buffer.
117 D3D11_MAPPED_SUBRESOURCE sub;
118 DX11Log(context->Map(mCounterStaging, 0, D3D11_MAP_READ, 0, &sub));
119
120 // Get the number of active elements in the buffer. The internal counter
121 // appears to increment even when the buffer is full, so it needs to be
122 // clamped to the maximum value. The clamping occurs in the call to
123 // SetNumActiveElements().
124 uint32_t numActive = *static_cast<uint32_t*>(sub.pData);
125 context->Unmap(mCounterStaging, 0);
126
127 // Copy the number to the CPU.
128 GetStructuredBuffer()->SetNumActiveElements(numActive);
129 return true;
130}
131
132void DX11StructuredBuffer::SetName(std::string const& name)
133{

Callers

nothing calls this directly

Calls 2

UnmapMethod · 0.45
SetNumActiveElementsMethod · 0.45

Tested by

no test coverage detected