-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpl_gpu_allocators_ext.h
82 lines (64 loc) · 2.72 KB
/
pl_gpu_allocators_ext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
pl_gpu_allocators_ext.h
*/
/*
Index of this file:
// [SECTION] header mess
// [SECTION] includes
// [SECTION] forward declarations
// [SECTION] APIs
// [SECTION] public api structs
// [SECTION] structs
*/
//-----------------------------------------------------------------------------
// [SECTION] header mess
//-----------------------------------------------------------------------------
#ifndef PL_GPU_ALLOCATORS_EXT_H
#define PL_GPU_ALLOCATORS_EXT_H
//-----------------------------------------------------------------------------
// [SECTION] includes
//-----------------------------------------------------------------------------
#include <stdint.h>
//-----------------------------------------------------------------------------
// [SECTION] forward declarations
//-----------------------------------------------------------------------------
// basic types
typedef struct _plDeviceAllocationRange plDeviceAllocationRange;
typedef struct _plDeviceMemoryAllocation plDeviceMemoryAllocation;
// external (pl_graphics_ext.h)
typedef struct _plDeviceMemoryAllocatorI plDeviceMemoryAllocatorI;
typedef struct _plDevice plDevice;
//-----------------------------------------------------------------------------
// [SECTION] APIs
//-----------------------------------------------------------------------------
#define plGPUAllocatorsI_version (plVersion){1, 1, 0}
//-----------------------------------------------------------------------------
// [SECTION] public api structs
//-----------------------------------------------------------------------------
typedef struct _plGPUAllocatorsI
{
// allocators
plDeviceMemoryAllocatorI* (*get_local_dedicated_allocator) (plDevice*);
plDeviceMemoryAllocatorI* (*get_local_buddy_allocator) (plDevice*);
plDeviceMemoryAllocatorI* (*get_staging_uncached_allocator) (plDevice*);
plDeviceMemoryAllocatorI* (*get_staging_uncached_buddy_allocator)(plDevice*);
plDeviceMemoryAllocatorI* (*get_staging_cached_allocator) (plDevice*);
void (*cleanup)(plDevice*);
// for debug viewing
plDeviceMemoryAllocation* (*get_blocks)(const plDeviceMemoryAllocatorI*, uint32_t* sizeOut);
plDeviceAllocationRange* (*get_ranges)(const plDeviceMemoryAllocatorI*, uint32_t* sizeOut);
} plGPUAllocatorsI;
//-----------------------------------------------------------------------------
// [SECTION] structs
//-----------------------------------------------------------------------------
typedef struct _plDeviceAllocationRange
{
char acName[PL_MAX_NAME_LENGTH];
uint64_t ulOffset;
uint64_t ulUsedSize;
uint64_t ulTotalSize;
uint64_t ulBlockIndex;
uint32_t uNodeIndex;
uint32_t uNextNode;
} plDeviceAllocationRange;
#endif // PL_GPU_ALLOCATORS_EXT_H