aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-01-20 13:55:32 -0700
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-02-04 17:58:09 -0700
commitc483a8c437fa02f5264463bbb6c3fa827398d7b5 (patch)
treebb0a6e29cb39d6287c421980926a61c1fa3d7b96
parentae7c21c324727798ff100b17f3ac6a6bee20a506 (diff)
downloadusermoji-c483a8c437fa02f5264463bbb6c3fa827398d7b5.tar.xz
memory alloc: Remove memory_heap flags replace with memory_property flags
Conflicts: include/xgl.h tests/image_tests.cpp tests/init.cpp tests/xgltestbinding.h
-rw-r--r--demos/cube.c3
-rw-r--r--demos/tri.c3
-rw-r--r--include/xgl.h24
3 files changed, 20 insertions, 10 deletions
diff --git a/demos/cube.c b/demos/cube.c
index d7deecb3..54237e84 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -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,
diff --git a/demos/tri.c b/demos/tri.c
index 96c22194..3b21eb74 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -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,
diff --git a/include/xgl.h b/include/xgl.h
index 45c69d4a..fc1b38fb 100644
--- a/include/xgl.h
+++ b/include/xgl.h
@@ -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