Skip to content

Commit

Permalink
feat: moved gpu allocators into extension
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Apr 16, 2024
1 parent 30b9c0e commit 980f18c
Show file tree
Hide file tree
Showing 11 changed files with 1,439 additions and 1,383 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
if not exist ../out/pl_image_ext.dll exit 1
if not exist ../out/pl_stats_ext.dll exit 1
if not exist ../out/pl_debug_ext.dll exit 1
if not exist ../out/pl_gpu_allocators_ext.dll exit 1
if not exist ../out/pl_resource_ext.dll exit 1
if not exist ../out/pl_ecs_ext.dll exit 1
if not exist ../out/pl_ref_renderer_ext.dll exit 1
Expand Down Expand Up @@ -102,6 +103,7 @@ jobs:
test -f ./out/pl_image_ext.dylib || exit 1
test -f ./out/pl_debug_ext.dylib || exit 1
test -f ./out/pl_graphics_ext.dylib || exit 1
test -f ./out/pl_gpu_allocators_ext.dylib || exit 1
test -f ./out/pl_resource_ext.dylib || exit 1
test -f ./out/pl_ecs_ext.dylib || exit 1
test -f ./out/pl_ref_renderer_ext.dylib || exit 1
Expand Down Expand Up @@ -165,6 +167,7 @@ jobs:
test -f ./out/pl_image_ext.so || exit 1
test -f ./out/pl_stats_ext.so || exit 1
test -f ./out/pl_debug_ext.so || exit 1
test -f ./out/pl_gpu_allocators_ext.so || exit 1
test -f ./out/pl_resource_ext.so || exit 1
test -f ./out/pl_ecs_ext.so || exit 1
test -f ./out/pl_ref_renderer_ext.so || exit 1
Expand Down
17 changes: 10 additions & 7 deletions extensions/pl_debug_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ Index of this file:
#include "pl_ui_internal.h"
#include "pl_stats_ext.h"
#include "pl_graphics_ext.h"
#include "pl_gpu_allocators_ext.h"

//-----------------------------------------------------------------------------
// [SECTION] global data
//-----------------------------------------------------------------------------

// apis
static const plApiRegistryI* gptApiRegistry = NULL;
static const plStatsI* ptStatsApi = NULL;
static const plDataRegistryI* ptDataRegistry = NULL;
static const plApiRegistryI* gptApiRegistry = NULL;
static const plStatsI* ptStatsApi = NULL;
static const plDataRegistryI* ptDataRegistry = NULL;
static const plGPUAllocatorsI* gptGpuAllocators = NULL;

// contexts
static plMemoryContext* ptMemoryCtx = NULL;
Expand Down Expand Up @@ -803,10 +805,10 @@ pl__show_device_memory(bool* bValue)
pl_text("Host Memory: %llu bytes", (double)ptDevice->ptGraphics->szHostMemoryInUse);

const plDeviceMemoryAllocatorI atAllocators[] = {
ptDevice->tLocalBuddyAllocator,
ptDevice->tLocalDedicatedAllocator,
ptDevice->tStagingUnCachedAllocator,
ptDevice->tStagingCachedAllocator
*gptGpuAllocators->create_local_buddy_allocator(ptDevice),
*gptGpuAllocators->create_local_dedicated_allocator(ptDevice),
*gptGpuAllocators->create_staging_uncached_allocator(ptDevice),
*gptGpuAllocators->create_staging_uncached_allocator(ptDevice)
};

const char* apcAllocatorNames[] = {
Expand Down Expand Up @@ -1072,6 +1074,7 @@ pl_load_ext(plApiRegistryI* ptApiRegistry, bool bReload)
pl_set_context(ptDataRegistry->get_data("ui"));

ptStatsApi = ptApiRegistry->first(PL_API_STATS);
gptGpuAllocators = ptApiRegistry->first(PL_API_GPU_ALLOCATORS);
ptIOCtx = pl_get_io();

if(bReload)
Expand Down
Loading

0 comments on commit 980f18c

Please sign in to comment.