#include "vkRef.hpp"
#include "vkQueryUtil.hpp"
#include "vkDeviceUtil.hpp"
+#include "vkMemUtil.hpp"
#include "vkPlatform.hpp"
#include "deMemory.h"
return queue;
}
+// Allocator utilities
+
+vk::Allocator* createAllocator (DefaultDevice* device)
+{
+ const VkPhysicalDeviceMemoryProperties memoryProperties = vk::getPhysicalDeviceMemoryProperties(device->getInstanceInterface(), device->getPhysicalDevice());
+
+ // \todo [2015-07-24 jarkko] support allocator selection/configuration from command line (or compile time)
+ return new SimpleAllocator(device->getDeviceInterface(), device->getDevice(), memoryProperties);
+}
+
// Context
Context::Context (tcu::TestContext& testCtx,
, m_platformInterface (platformInterface)
, m_progCollection (progCollection)
, m_device (new DefaultDevice(m_platformInterface, testCtx.getCommandLine()))
+ , m_allocator (createAllocator(m_device.get()))
{
}
Context::~Context (void)
{
- delete m_device;
}
vk::VkInstance Context::getInstance (void) const { return m_device->getInstance(); }
const vk::DeviceInterface& Context::getDeviceInterface (void) const { return m_device->getDeviceInterface(); }
deUint32 Context::getUniversalQueueFamilyIndex (void) const { return m_device->getUniversalQueueFamilyIndex(); }
vk::VkQueue Context::getUniversalQueue (void) const { return m_device->getUniversalQueue(); }
+vk::Allocator& Context::getDefaultAllocator (void) const { return *m_allocator; }
// TestCase
#include "tcuDefs.hpp"
#include "tcuTestCase.hpp"
#include "vkDefs.hpp"
+#include "deUniquePtr.hpp"
namespace glu
{
class PlatformInterface;
class ProgramBinary;
template<typename Program> class ProgramCollection;
+class Allocator;
}
namespace vkt
deUint32 getUniversalQueueFamilyIndex (void) const;
vk::VkQueue getUniversalQueue (void) const;
+ vk::Allocator& getDefaultAllocator (void) const;
+
protected:
tcu::TestContext& m_testCtx;
const vk::PlatformInterface& m_platformInterface;
vk::ProgramCollection<vk::ProgramBinary>& m_progCollection;
- DefaultDevice* const m_device;
+ const de::UniquePtr<DefaultDevice> m_device;
+ const de::UniquePtr<vk::Allocator> m_allocator;
private:
Context (const Context&); // Not allowed