2016-05-11 17:09:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VkTestContext_DEFINED
|
|
|
|
#define VkTestContext_DEFINED
|
|
|
|
|
|
|
|
#include "TestContext.h"
|
|
|
|
|
|
|
|
#ifdef SK_VULKAN
|
|
|
|
|
2018-08-01 13:23:57 +00:00
|
|
|
#include "GrVulkanDefines.h"
|
2016-05-11 17:09:18 +00:00
|
|
|
#include "vk/GrVkBackendContext.h"
|
|
|
|
|
2018-08-01 17:25:41 +00:00
|
|
|
class GrVkExtensions;
|
|
|
|
|
2016-05-11 17:09:18 +00:00
|
|
|
namespace sk_gpu_test {
|
|
|
|
class VkTestContext : public TestContext {
|
|
|
|
public:
|
2018-10-12 13:31:11 +00:00
|
|
|
virtual GrBackendApi backend() override { return GrBackendApi::kVulkan; }
|
2016-05-11 17:09:18 +00:00
|
|
|
|
2018-08-01 17:25:41 +00:00
|
|
|
const GrVkBackendContext& getVkBackendContext() const {
|
2017-05-15 17:50:35 +00:00
|
|
|
return fVk;
|
|
|
|
}
|
|
|
|
|
2018-08-01 17:25:41 +00:00
|
|
|
const GrVkExtensions* getVkExtensions() const {
|
|
|
|
return fExtensions;
|
|
|
|
}
|
|
|
|
|
2018-08-08 13:23:18 +00:00
|
|
|
const VkPhysicalDeviceFeatures2* getVkFeatures() const {
|
|
|
|
return fFeatures;
|
|
|
|
}
|
|
|
|
|
2016-05-11 17:09:18 +00:00
|
|
|
protected:
|
2018-08-08 13:23:18 +00:00
|
|
|
VkTestContext(const GrVkBackendContext& vk, const GrVkExtensions* extensions,
|
|
|
|
const VkPhysicalDeviceFeatures2* features, bool ownsContext,
|
2018-08-01 20:48:52 +00:00
|
|
|
VkDebugReportCallbackEXT debugCallback,
|
|
|
|
PFN_vkDestroyDebugReportCallbackEXT destroyCallback)
|
2018-08-01 17:25:41 +00:00
|
|
|
: fVk(vk)
|
|
|
|
, fExtensions(extensions)
|
2018-08-08 13:23:18 +00:00
|
|
|
, fFeatures(features)
|
2018-08-01 17:25:41 +00:00
|
|
|
, fOwnsContext(ownsContext)
|
2018-08-01 20:48:52 +00:00
|
|
|
, fDebugCallback(debugCallback)
|
|
|
|
, fDestroyDebugReportCallbackEXT(destroyCallback) {}
|
|
|
|
|
|
|
|
GrVkBackendContext fVk;
|
|
|
|
const GrVkExtensions* fExtensions;
|
2018-08-08 13:23:18 +00:00
|
|
|
const VkPhysicalDeviceFeatures2* fFeatures;
|
2018-08-01 20:48:52 +00:00
|
|
|
bool fOwnsContext;
|
|
|
|
VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE;
|
|
|
|
PFN_vkDestroyDebugReportCallbackEXT fDestroyDebugReportCallbackEXT = nullptr;
|
2016-05-11 17:09:18 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef TestContext INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates Vk context object bound to the native Vk library.
|
|
|
|
*/
|
2017-05-15 17:50:35 +00:00
|
|
|
VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
|
2016-05-11 17:09:18 +00:00
|
|
|
|
|
|
|
} // namespace sk_gpu_test
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|