29#include <EASTL/algorithm.h>
60template <
size_t N = 4096, Safe safety = Safe::Yes>
92 template <Fragment Frag>
99 "Fragment too big to be inserted into an ordering table");
102 z = eastl::clamp(z, int32_t(0), int32_t(
N - 1));
105 frag.set(table[z].next, frag.getActualFragmentSize());
106 table[z].set(&frag, 0);
108 frag.set(&table[z], frag.getActualFragmentSize());
109 table[z].head =
reinterpret_cast<uint32_t
>(&frag) & 0xffffff;
127template <Safe safety = Safe::Yes>
133 "DynamicOrderingTable: needs storage and at least one bucket");
142 template <Fragment Frag>
145 "Fragment too big to be inserted into an ordering table");
148 z = eastl::clamp(z, int32_t(0), int32_t(m_size - 1));
151 frag.set(table[z].next, frag.getActualFragmentSize());
152 table[z].set(&frag, 0);
154 frag.set(&table[z], frag.getActualFragmentSize());
155 table[z].head =
reinterpret_cast<uint32_t
>(&frag) & 0xffffff;
158 size_t size()
const {
return m_size; }
An ordering table whose bucket count is chosen at runtime.
Definition ordering-table.hh:128
void insert(Frag &frag, int32_t z)
Inserts a fragment into the ordering table, as OrderingTable::insert.
Definition ordering-table.hh:143
void clear()
Definition ordering-table.hh:137
size_t size() const
Definition ordering-table.hh:158
DynamicOrderingTable(psyqo::Fragments::ChainEntry *storage, size_t buckets)
Definition ordering-table.hh:130
psyqo::Fragments::ChainEntry * m_table
Definition ordering-table.hh:161
The singleton GPU class.
Definition gpu.hh:83
Definition ordering-table.hh:41
static void clear(psyqo::Fragments::ChainEntry *table, size_t size)
Definition ordering-table.cpp:29
The ordering table. Used to sort fragments before sending them to the GPU.
Definition ordering-table.hh:61
psyqo::Fragments::ChainEntry m_table[N+1]
Definition ordering-table.hh:114
void insert(Frag &frag, int32_t z)
Inserts a fragment into the ordering table.
Definition ordering-table.hh:93
OrderingTable()
Definition ordering-table.hh:63
void clear()
Clears the ordering table.
Definition ordering-table.hh:73
static int size
Definition string.h:149
#define N
Definition main.c:37
void assert(bool condition, const char *message, std::source_location location=std::source_location::current())
A simple assert macro.
Definition kernel.hh:366
Definition fragments.hh:88