memory alloc: Remove memory_heap flags replace with memory_property flags
authorJon Ashburn <jon@lunarg.com>
Tue, 20 Jan 2015 20:55:32 +0000 (13:55 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:09 +0000 (17:58 -0700)
Conflicts:
include/xgl.h
tests/image_tests.cpp
tests/init.cpp
tests/xgltestbinding.h

demos/cube.c
demos/tri.c
include/xgl.h

index d7deecb3395f317b05304537f86e73610d0244d6..54237e8453d8f57b7a79be62d821dea974bef929 100644 (file)
@@ -472,6 +472,7 @@ static void demo_prepare_depth(struct demo *demo)
         .pNext = &img_alloc,
         .allocationSize = 0,
         .alignment = 0,
+        .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY,
         .flags = 0,
         .heapCount = 0,
         .memPriority = XGL_MEMORY_PRIORITY_NORMAL,
@@ -742,6 +743,7 @@ static void demo_prepare_textures(struct demo *demo)
             .pNext = &img_alloc,
             .allocationSize = 0,
             .alignment = 0,
+            .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY,
             .flags = 0,
             .heapCount = 0,
             .pHeaps = 0,
@@ -861,6 +863,7 @@ void demo_prepare_cube_data_buffer(struct demo *demo)
         .pNext = &buf_alloc,
         .allocationSize = 0,
         .alignment = 0,
+        .memProps = XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT,
         .flags = 0,
         .heapCount = 0,
         .memPriority = XGL_MEMORY_PRIORITY_NORMAL,
index 96c2219454cc6ff7e19c22118b54831611ca0cb0..3b21eb7426b4623fb24f92b54f49fd680dba8930 100644 (file)
@@ -290,6 +290,7 @@ static void demo_prepare_depth(struct demo *demo)
         .pNext = &img_alloc,
         .allocationSize = 0,
         .alignment = 0,
+        .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY,
         .flags = 0,
         .heapCount = 0,
         .memPriority = XGL_MEMORY_PRIORITY_NORMAL,
@@ -413,6 +414,7 @@ static void demo_prepare_textures(struct demo *demo)
             .pNext = &img_alloc,
             .allocationSize = 0,
             .alignment = 0,
+            .memProps = XGL_MEMORY_PROPERTY_GPU_ONLY,
             .flags = 0,
             .heapCount = 0,
             .memPriority = XGL_MEMORY_PRIORITY_NORMAL,
@@ -547,6 +549,7 @@ static void demo_prepare_vertices(struct demo *demo)
         .pNext = &buf_alloc,
         .allocationSize = 0,
         .alignment = 0,
+        .memProps = XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT,
         .flags = 0,
         .heapCount = 0,
         .pHeaps = 0,
index 45c69d4a756a4525d3e3ffdac41ff57b888300bd..fc1b38fb1aa2a7b2070374794762980372aae021 100644 (file)
@@ -976,16 +976,18 @@ typedef enum _XGL_QUEUE_FLAGS
     XGL_QUEUE_EXTENDED_BIT                                  = 0x80000000    // Extended queue
 } XGL_QUEUE_FLAGS;
 
-// Memory heap properties
-typedef enum _XGL_MEMORY_HEAP_FLAGS
-{
-    XGL_MEMORY_HEAP_CPU_VISIBLE_BIT                         = 0x00000001,
-    XGL_MEMORY_HEAP_CPU_GPU_COHERENT_BIT                    = 0x00000002,
-    XGL_MEMORY_HEAP_CPU_UNCACHED_BIT                        = 0x00000004,
-    XGL_MEMORY_HEAP_CPU_WRITE_COMBINED_BIT                  = 0x00000008,
-    XGL_MEMORY_HEAP_HOLDS_PINNED_BIT                        = 0x00000010,
-    XGL_MEMORY_HEAP_SHAREABLE_BIT                           = 0x00000020,
-} XGL_MEMORY_HEAP_FLAGS;
+// memory properties passed into xglAllocMemory().
+typedef enum _XGL_MEMORY_PROPERTY_FLAGS
+{
+    XGL_MEMORY_PROPERTY_GPU_ONLY                            = 0x00000000,   // If not set, then allocate memory on device (GPU)
+    XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT                     = 0x00000001,
+    XGL_MEMORY_PROPERTY_CPU_GPU_COHERENT_BIT                = 0x00000002,
+    XGL_MEMORY_PROPERTY_CPU_UNCACHED_BIT                    = 0x00000004,
+    XGL_MEMORY_PROPERTY_CPU_WRITE_COMBINED_BIT              = 0x00000008,
+    XGL_MEMORY_PROPERTY_PREFER_CPU_LOCAL                    = 0x00000010,   // all else being equal, prefer CPU access
+    XGL_MEMORY_PROPERTY_SHAREABLE_BIT                       = 0x00000020,
+    XGL_MAX_ENUM(_XGL_MEMORY_PROPERTY_FLAGS)
+} XGL_MEMORY_PROPERTY_FLAGS;
 
 // Memory allocation flags
 typedef enum _XGL_MEMORY_ALLOC_FLAGS
@@ -1317,6 +1319,7 @@ typedef struct _XGL_MEMORY_ALLOC_INFO
     XGL_UINT                                heapCount;
     const XGL_UINT*                         pHeaps;
     XGL_MEMORY_PRIORITY                     memPriority;
+    XGL_FLAGS                               memProps;                   // XGL_MEMORY_PROPERTY_FLAGS
 } XGL_MEMORY_ALLOC_INFO;
 
 // This structure is included in the XGL_MEMORY_ALLOC_INFO chain
@@ -1360,6 +1363,7 @@ typedef struct _XGL_MEMORY_REQUIREMENTS
     XGL_GPU_SIZE                            granularity;                // Granularity on which xglBindObjectMemoryRange can bind sub-ranges of memory specified in bytes (usually the page size)
     XGL_UINT                                heapCount;
     XGL_UINT*                               pHeaps;
+    XGL_FLAGS                               memProps;                   // XGL_MEMORY_PROPERTY_FLAGS
 } XGL_MEMORY_REQUIREMENTS;
 
 typedef struct _XGL_BUFFER_MEMORY_REQUIREMENTS