23class VkTestContextImpl :
public sk_gpu_test::VkTestContext {
25 static VkTestContext*
Create(VkTestContext* sharedContext) {
29 bool ownsContext =
true;
33 backendContext = sharedContext->getVkBackendContext();
41 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
48 if (!sk_gpu_test::CreateVkBackendContext(instProc, &backendContext,
extensions,
49 features, &debugCallback,
50 nullptr, sk_gpu_test::CanPresentFn(),
52 sk_gpu_test::FreeVulkanFeaturesStructs(features);
59 backendContext.
fInstance,
"vkDestroyDebugReportCallbackEXT");
62 return new VkTestContextImpl(backendContext,
extensions, features, ownsContext,
63 debugCallback, destroyCallback);
66 ~VkTestContextImpl()
override { this->teardown(); }
68 void testAbandon()
override {}
75#define ACQUIRE_VK_PROC_LOCAL(name, inst) \
76 PFN_vk##name grVk##name = \
77 reinterpret_cast<PFN_vk##name>(fVk.fGetProc("vk" #name, inst, nullptr)); \
79 if (grVk##name == nullptr) { \
80 SkDebugf("Function ptr for vk%s could not be acquired\n", #name); \
85 void teardown()
override {
86 INHERITED::teardown();
87 fVk.fMemoryAllocator.reset();
92 grVkDeviceWaitIdle(fVk.fDevice);
93 grVkDestroyDevice(fVk.fDevice,
nullptr);
94#ifdef SK_ENABLE_VK_LAYERS
96 fDestroyDebugReportCallbackEXT(fVk.fInstance, fDebugCallback,
nullptr);
99 grVkDestroyInstance(fVk.fInstance,
nullptr);
102 sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures);
112 VkDebugReportCallbackEXT debugCallback,
114 : VkTestContext(backendContext,
120 fFenceSupport =
true;
123 void onPlatformMakeNotCurrent()
const override {}
124 void onPlatformMakeCurrent()
const override {}
125 std::function<void()> onPlatformGetAutoContextRestore()
const override {
return nullptr; }
127 using INHERITED = sk_gpu_test::VkTestContext;
132VkTestContext* CreatePlatformVkTestContext(VkTestContext* sharedContext) {
bool gCreateProtectedContext
#define ACQUIRE_VK_PROC_LOCAL(name, inst)
static sk_sp< Effect > Create()
#define INHERITED(method,...)
Dart_NativeFunction function
SK_API sk_sp< GrDirectContext > MakeVulkan(const skgpu::VulkanBackendContext &, const GrContextOptions &)
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
struct VkPhysicalDeviceFeatures2 VkPhysicalDeviceFeatures2
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)