memory alloc: Remove MEMORY_ALLOC_FLAGS add MEMORY_TYPE
authorJon Ashburn <jon@lunarg.com>
Tue, 20 Jan 2015 22:06:59 +0000 (15:06 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:09 +0000 (17:58 -0700)
demos/cube.c
demos/tri.c
include/xgl.h

index 54237e8..e482ffd 100644 (file)
@@ -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,
     };
index 3b21eb7..32a37a1 100644 (file)
@@ -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]);
index fc1b38f..6f4659b 100644 (file)
@@ -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