Epok Engine

EPOK RUNTIME

epok::sort_draw_order

Function template · 1 overload

Function template

Bounded, allocation-free, stable insertion sort of an index array by draw key.

Belongs to
epok
Header
world2d.hpp
Overloads
1

Declaration

template
Declaration
template <class Key> inline void sort_draw_order(uint16_t* indices, size_t count, Key&& key)

Bounded, allocation-free, stable insertion sort of an index array by draw key.

ParameterTypeMeaning
indicesuint16_t *Value supplied for indices. Keep referenced or pointed-to data valid for the complete call.
countsize_tValue supplied for count. Keep referenced or pointed-to data valid for the complete call.
keyKey &&Value supplied for key. Keep referenced or pointed-to data valid for the complete call.

Returns: Nothing (void).

Example

C++ example
#include "world2d.hpp"

// Replace these template arguments with types or values accepted by the declaration:
// Key

// Assume these named values have been initialized with valid data:
// uint16_t * indices
// size_t count
// Key && key

epok::sort_draw_order<Key>(indices, count, key);

Why use it

Template dispatch is resolved at compile time and normally adds no runtime indirection. The API maps closely to PSX GPU work, giving predictable ordering and low overhead.

Trade-offs and warnings

Every instantiated type must satisfy the header's compile-time requirements; extra instantiations can increase code size. Respect packet lifetime, ordering-table direction and per-frame GPU/VRAM budgets; submission is not a desktop immediate-mode draw call. Pointer/reference arguments are borrowed unless the source contract says otherwise; keep them valid for the complete operation and never assume null is accepted.

Declared in runtime/world2d.hpp:272

Related members