21class VkTestContextImpl :
public sk_gpu_test::VkTestContext {
23 static VkTestContext*
Create(VkTestContext* sharedContext) {
27 bool ownsContext =
true;
31 backendContext = sharedContext->getVkBackendContext();
39 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
46 if (!sk_gpu_test::CreateVkBackendContext(instProc, &backendContext, extensions,
47 features, &debugCallback,
48 nullptr, sk_gpu_test::CanPresentFn(),
50 sk_gpu_test::FreeVulkanFeaturesStructs(features);
57 backendContext.
fInstance,
"vkDestroyDebugReportCallbackEXT");
60 return new VkTestContextImpl(backendContext, extensions, features, ownsContext,
61 debugCallback, destroyCallback);
64 ~VkTestContextImpl()
override { this->teardown(); }
66 void testAbandon()
override {}
73#define ACQUIRE_VK_PROC_LOCAL(name, inst) \
74 PFN_vk##name grVk##name = \
75 reinterpret_cast<PFN_vk##name>(fVk.fGetProc("vk" #name, inst, nullptr)); \
77 if (grVk##name == nullptr) { \
78 SkDebugf("Function ptr for vk%s could not be acquired\n", #name); \
83 void teardown()
override {
84 INHERITED::teardown();
85 fVk.fMemoryAllocator.reset();
90 grVkDeviceWaitIdle(fVk.fDevice);
91 grVkDestroyDevice(fVk.fDevice,
nullptr);
92#ifdef SK_ENABLE_VK_LAYERS
94 fDestroyDebugReportCallbackEXT(fVk.fInstance, fDebugCallback,
nullptr);
97 grVkDestroyInstance(fVk.fInstance,
nullptr);
100 sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures);
110 VkDebugReportCallbackEXT debugCallback,
112 : VkTestContext(backendContext,
extensions, features, ownsContext, debugCallback,
114 fFenceSupport =
true;
117 void onPlatformMakeNotCurrent()
const override {}
118 void onPlatformMakeCurrent()
const override {}
119 std::function<void()> onPlatformGetAutoContextRestore()
const override {
return nullptr; }
121 using INHERITED = sk_gpu_test::VkTestContext;
126VkTestContext* CreatePlatformVkTestContext(VkTestContext* sharedContext) {
127 return VkTestContextImpl::Create(sharedContext);
bool gCreateProtectedContext
#define ACQUIRE_VK_PROC_LOCAL(name, inst)
static sk_sp< Effect > Create()
#define INHERITED(method,...)
SK_API sk_sp< GrDirectContext > MakeVulkan(const GrVkBackendContext &, const GrContextOptions &)
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)