diff options
| author | Jon Ashburn <jon@lunarg.com> | 2015-01-20 15:06:59 -0700 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-02-04 17:58:09 -0700 |
| commit | bdee4e839ab2334284216116d5054bc3e57d11e0 (patch) | |
| tree | 1aaac39229230345ed6f17f009a53b5f3fee4991 | |
| parent | c483a8c437fa02f5264463bbb6c3fa827398d7b5 (diff) | |
| download | usermoji-bdee4e839ab2334284216116d5054bc3e57d11e0.tar.xz | |
memory alloc: Remove MEMORY_ALLOC_FLAGS add MEMORY_TYPE
| -rw-r--r-- | demos/cube.c | 6 | ||||
| -rw-r--r-- | demos/tri.c | 8 | ||||
| -rw-r--r-- | include/xgl.h | 13 |
3 files changed, 16 insertions, 11 deletions
diff --git a/demos/cube.c b/demos/cube.c index 54237e84..e482ffdf 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -473,7 +473,7 @@ static void demo_prepare_depth(struct demo *demo) .allocationSize = 0, .alignment = 0, .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY, - .flags = 0, + .memType = XGL_MEMORY_TYPE_IMAGE, .heapCount = 0, .memPriority = XGL_MEMORY_PRIORITY_NORMAL, }; @@ -744,7 +744,7 @@ static void demo_prepare_textures(struct demo *demo) .allocationSize = 0, .alignment = 0, .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY, - .flags = 0, + .memType = XGL_MEMORY_TYPE_IMAGE, .heapCount = 0, .pHeaps = 0, .memPriority = XGL_MEMORY_PRIORITY_NORMAL, @@ -864,7 +864,7 @@ void demo_prepare_cube_data_buffer(struct demo *demo) .allocationSize = 0, .alignment = 0, .memProps = XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT, - .flags = 0, + .memType = XGL_MEMORY_TYPE_BUFFER, .heapCount = 0, .memPriority = XGL_MEMORY_PRIORITY_NORMAL, }; diff --git a/demos/tri.c b/demos/tri.c index 3b21eb74..32a37a1c 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -291,7 +291,7 @@ static void demo_prepare_depth(struct demo *demo) .allocationSize = 0, .alignment = 0, .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY, - .flags = 0, + .memType = XGL_MEMORY_TYPE_IMAGE, .heapCount = 0, .memPriority = XGL_MEMORY_PRIORITY_NORMAL, }; @@ -415,7 +415,7 @@ static void demo_prepare_textures(struct demo *demo) .allocationSize = 0, .alignment = 0, .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY, - .flags = 0, + .memType = XGL_MEMORY_TYPE_IMAGE, .heapCount = 0, .memPriority = XGL_MEMORY_PRIORITY_NORMAL, }; @@ -550,7 +550,7 @@ static void demo_prepare_vertices(struct demo *demo) .allocationSize = 0, .alignment = 0, .memProps = XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT, - .flags = 0, + .memType = XGL_MEMORY_TYPE_BUFFER, .heapCount = 0, .pHeaps = 0, .memPriority = XGL_MEMORY_PRIORITY_NORMAL, @@ -590,7 +590,7 @@ static void demo_prepare_vertices(struct demo *demo) mem_alloc.alignment = mem_reqs[i].alignment; mem_alloc.heapCount = mem_reqs[i].heapCount; mem_alloc.pHeaps = mem_reqs[i].pHeaps; - memcpy(mem_alloc.pHeaps, mem_reqs[i].pHeaps, + memcpy((void *) mem_alloc.pHeaps, mem_reqs[i].pHeaps, sizeof(mem_reqs[i].pHeaps[0]) * mem_reqs[i].heapCount); err = xglAllocMemory(demo->device, &mem_alloc, &demo->vertices.mem[i]); diff --git a/include/xgl.h b/include/xgl.h index fc1b38fb..6f4659b0 100644 --- a/include/xgl.h +++ b/include/xgl.h @@ -990,10 +990,14 @@ typedef enum _XGL_MEMORY_PROPERTY_FLAGS } XGL_MEMORY_PROPERTY_FLAGS; // Memory allocation flags -typedef enum _XGL_MEMORY_ALLOC_FLAGS +typedef enum _XGL_MEMORY_TYPE { - XGL_MEMORY_ALLOC_SHAREABLE_BIT = 0x00000001, -} XGL_MEMORY_ALLOC_FLAGS; + XGL_MEMORY_TYPE_OTHER = 0x00000000, // device memory that is not any of the others + XGL_MEMORY_TYPE_BUFFER = 0x00000001, // memory for buffers and associated information + XGL_MEMORY_TYPE_IMAGE = 0x00000002, // memory for images and associated information + XGL_MEMORY_TYPE_PIPELINE = 0x00000003, // memory for pipeline objects + XGL_MAX_ENUM(_XGL_MEMORY_TYPE) +} XGL_MEMORY_TYPE; // Buffer and buffer allocation usage flags typedef enum _XGL_BUFFER_USAGE_FLAGS @@ -1315,11 +1319,11 @@ typedef struct _XGL_MEMORY_ALLOC_INFO XGL_VOID* pNext; // Pointer to next structure XGL_GPU_SIZE allocationSize; // Size of memory allocation XGL_GPU_SIZE alignment; - XGL_FLAGS flags; // XGL_MEMORY_ALLOC_FLAGS XGL_UINT heapCount; const XGL_UINT* pHeaps; XGL_MEMORY_PRIORITY memPriority; XGL_FLAGS memProps; // XGL_MEMORY_PROPERTY_FLAGS + XGL_MEMORY_TYPE memType; } XGL_MEMORY_ALLOC_INFO; // This structure is included in the XGL_MEMORY_ALLOC_INFO chain @@ -1364,6 +1368,7 @@ typedef struct _XGL_MEMORY_REQUIREMENTS XGL_UINT heapCount; XGL_UINT* pHeaps; XGL_FLAGS memProps; // XGL_MEMORY_PROPERTY_FLAGS + XGL_MEMORY_TYPE memType; } XGL_MEMORY_REQUIREMENTS; typedef struct _XGL_BUFFER_MEMORY_REQUIREMENTS |
