tests: Fix testbinding alloc_mem method
authorJon Ashburn <jon@lunarg.com>
Thu, 22 Jan 2015 18:40:11 +0000 (11:40 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:09 +0000 (17:58 -0700)
Set memProps for BUFFER allocations. Keep track of primary_mem if have
multiple allocations based on which allocation req has a BUFFER or IMAGE type.

tests/xgltestbinding.cpp

index 56341f4..88528af 100644 (file)
@@ -300,7 +300,19 @@ void Object::alloc_memory(const Device &dev, bool for_buf, bool for_img)
     for (int i = 0; i < mem_reqs.size(); i++) {
         info = GpuMemory::alloc_info(mem_reqs[i], next_info);
 
-        primary_mem_ = &internal_mems_[i];
+        switch (info.memType) {
+        case XGL_MEMORY_TYPE_BUFFER:
+            EXPECT(for_buf);
+            info.memProps |= XGL_MEMORY_PROPERTY_CPU_VISIBLE_BIT;
+            primary_mem_ = &internal_mems_[i];
+            break;
+        case XGL_MEMORY_TYPE_IMAGE:
+            EXPECT(for_img);
+            primary_mem_ = &internal_mems_[i];
+            break;
+        default:
+            break;
+        }
 
         internal_mems_[i].init(dev, info);
         bind_memory(i, internal_mems_[i], 0);