36 std::vector<RenderCommand> tempBuffer(n);
41 const int bitsPerPass = 8;
42 const int bucketCount = 1 << bitsPerPass;
43 const uint32_t mask = bucketCount - 1;
44 const uint16_t keySizeBits =
sizeof(
m_commands[0].m_SortingKey) * 8;
46 for (uint16_t shift = 0; shift < keySizeBits; shift += bitsPerPass)
48 uint32_t count[bucketCount] = { 0 };
50 for (
size_t i = 0; i < n; i++)
55 for (
int i = 1; i < bucketCount; ++i)
57 count[i] += count[i - 1];
60 for (
long long i = (
long long)
m_commands.size() - 1; i >= 0; --i)
63 dst[--count[bucket]] = src[i];
71 std::copy(tempBuffer.begin(), tempBuffer.end(),
m_commands.begin());