@@ -33,6 +33,9 @@ Index of this file:
3333#include "pl_shader_ext.h"
3434#include "pl_tools_ext.h"
3535#include "pl_gpu_allocators_ext.h"
36+ #include "pl_vfs_ext.h"
37+ #include "pl_platform_ext.h"
38+ #include "pl_resource_ext.h"
3639
3740// unstable extensions
3841#include "pl_stage_ext.h"
@@ -58,6 +61,9 @@ Index of this file:
5861 static const plToolsI * gptTools = NULL ;
5962 static const plGPUAllocatorsI * gptGpuAllocators = NULL ;
6063 static const plStageI * gptStage = NULL ;
64+ static const plVfsI * gptVfs = NULL ;
65+ static const plFileI * gptFile = NULL ;
66+ static const plResourceI * gptResource = NULL ;
6167
6268#endif
6369
@@ -69,7 +75,6 @@ Index of this file:
6975typedef struct _plStarterContext plStarterContext ;
7076
7177// helpers
72- static void pl__starter_create_render_pass (void );
7378static void pl__starter_activate_msaa (void );
7479static void pl__starter_deactivate_msaa (void );
7580static void pl__starter_activate_depth_buffer (void );
@@ -140,13 +145,18 @@ pl_starter_initialize(plStarterInit tInit)
140145
141146 if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_SHADER_EXT )
142147 {
148+ gptVfs -> mount_directory ("/shader-temp" , "../shader-temp" , PL_VFS_MOUNT_FLAGS_NONE );
149+ gptFile -> create_directory ("../shader-temp" );
143150 static const plShaderOptions tDefaultShaderOptions = {
144151 .apcIncludeDirectories = {
145- "../shaders/"
152+ "../shaders/" ,
153+ "../dependencies/pilotlight/shaders/"
146154 },
147155 .apcDirectories = {
148- "../shaders/"
156+ "../shaders/" ,
157+ "../dependencies/pilotlight/shaders/"
149158 },
159+ .pcCacheOutputDirectory = "/shader-temp/" ,
150160 .eFlags = PL_SHADER_FLAGS_AUTO_OUTPUT
151161 };
152162 gptShader -> initialize (& tDefaultShaderOptions );
@@ -174,6 +184,15 @@ pl_starter_initialize(plStarterInit tInit)
174184 plDevice * ptDevice = pl_starter_create_device (ptSurface );
175185 gptStarterCtx -> ptDevice = ptDevice ;
176186
187+ if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_RESOURCE_EXT )
188+ {
189+ plResourceManagerInit tResourceInit = {
190+ .pcCacheDirectory = "../cache" ,
191+ .ptDevice = gptStarterCtx -> ptDevice
192+ };
193+ gptResource -> initialize (tResourceInit );
194+ }
195+
177196 if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_TOOLS_EXT )
178197 gptTools -> initialize ((plToolsInit ){.ptDevice = ptDevice });
179198
@@ -290,7 +309,6 @@ pl_starter_initialize(plStarterInit tInit)
290309void
291310pl_starter_finalize (void )
292311{
293-
294312 plFontAtlas * ptCurrentAtlas = gptDraw -> get_current_font_atlas ();
295313 if (gptStarterCtx -> ptDefaultFont == NULL )
296314 gptStarterCtx -> ptDefaultFont = gptDraw -> get_first_font (ptCurrentAtlas );
@@ -451,6 +469,11 @@ pl_starter_cleanup(void)
451469 gptGfx -> cleanup_semaphore (gptStarterCtx -> aptSemaphores [i ]);
452470 }
453471
472+ if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_RESOURCE_EXT )
473+ {
474+ gptResource -> cleanup ();
475+ }
476+
454477 if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_SHADER_EXT )
455478 gptShader -> cleanup ();
456479 if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_DRAW_EXT )
@@ -565,6 +588,11 @@ pl_starter_begin_frame(void)
565588 }
566589 }
567590
591+
592+ if (gptStarterCtx -> eFlags & PL_STARTER_FLAGS_RESOURCE_EXT )
593+ {
594+ gptResource -> new_frame ();
595+ }
568596 return true;
569597}
570598
@@ -1451,6 +1479,9 @@ pl_load_starter_ext(plApiRegistryI* ptApiRegistry, bool bReload)
14511479 gptTools = pl_get_api_latest (ptApiRegistry , plToolsI );
14521480 gptGpuAllocators = pl_get_api_latest (ptApiRegistry , plGPUAllocatorsI );
14531481 gptStage = pl_get_api_latest (ptApiRegistry , plStageI );
1482+ gptVfs = pl_get_api_latest (ptApiRegistry , plVfsI );
1483+ gptFile = pl_get_api_latest (ptApiRegistry , plFileI );
1484+ gptResource = pl_get_api_latest (ptApiRegistry , plResourceI );
14541485
14551486 if (bReload )
14561487 {
0 commit comments