MCPcopy Create free account
hub / github.com/defold/defold / RenderListAlloc

Function RenderListAlloc

engine/render/src/render/render.cpp:263–282  ·  view source on GitHub ↗

Allocate a buffer (from the array) with room for 'entries' entries. NOTE: Pointer might go invalid after a consecutive call to RenderListAlloc if reallocation of backing buffer happens.

Source from the content-addressed store, hash-verified

261 // NOTE: Pointer might go invalid after a consecutive call to RenderListAlloc if reallocation
262 // of backing buffer happens.
263 RenderListEntry* RenderListAlloc(HRenderContext render_context, uint32_t entries)
264 {
265 dmArray<RenderListEntry> & render_list = render_context->m_RenderList;
266
267 if (render_list.Remaining() < entries)
268 {
269 const uint32_t needed = entries - render_list.Remaining();
270 render_list.OffsetCapacity(dmMath::Max<uint32_t>(256, needed));
271 render_context->m_RenderListSortIndices.SetCapacity(render_list.Capacity());
272 }
273
274 uint32_t size = render_list.Size();
275 render_list.SetSize(size + entries);
276
277 // If we push new items after the last frustum culling, we need to reevaluate them.
278 RenderListEntry* start = render_list.Begin() + size;
279 memset(start, 0, entries * sizeof(RenderListEntry));
280
281 return start;
282 }
283
284 // Submit a range of entries (pointers must be from a range allocated by RenderListAlloc, and not between two alloc calls).
285 void RenderListSubmit(HRenderContext render_context, RenderListEntry *begin, RenderListEntry *end)

Callers 9

TEST_FFunction · 0.85
FlushDebugFunction · 0.85
FlushTextsFunction · 0.85
CompMeshRenderFunction · 0.85
CompGuiRenderFunction · 0.85
CompSpriteRenderFunction · 0.85
CompModelRenderFunction · 0.85
CompTileGridRenderFunction · 0.85
CompParticleFXRenderFunction · 0.85

Calls 7

RemainingMethod · 0.45
OffsetCapacityMethod · 0.45
SetCapacityMethod · 0.45
CapacityMethod · 0.45
SizeMethod · 0.45
SetSizeMethod · 0.45
BeginMethod · 0.45

Tested by 1

TEST_FFunction · 0.68