Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
skiatest::graphite::VulkanTestContext Class Reference

#include <GraphiteVulkanTestContext.h>

Inheritance diagram for skiatest::graphite::VulkanTestContext:
skiatest::graphite::GraphiteTestContext

Public Member Functions

 ~VulkanTestContext () override
 
skgpu::BackendApi backend () override
 
skgpu::ContextType contextType () override
 
std::unique_ptr< skgpu::graphite::ContextmakeContext (const TestOptions &) override
 
const skgpu::VulkanBackendContextgetBackendContext () const
 
- Public Member Functions inherited from skiatest::graphite::GraphiteTestContext
 GraphiteTestContext (const GraphiteTestContext &)=delete
 
GraphiteTestContextoperator= (const GraphiteTestContext &)=delete
 
virtual ~GraphiteTestContext ()
 
bool getMaxGpuFrameLag (int *maxFrameLag) const
 
void submitRecordingAndWaitOnSync (skgpu::graphite::Context *, skgpu::graphite::Recording *)
 
virtual void tick ()
 
void syncedSubmit (skgpu::graphite::Context *)
 

Static Public Member Functions

static std::unique_ptr< GraphiteTestContextMake ()
 

Additional Inherited Members

- Protected Member Functions inherited from skiatest::graphite::GraphiteTestContext
 GraphiteTestContext ()
 
- Protected Attributes inherited from skiatest::graphite::GraphiteTestContext
sk_sp< sk_gpu_test::FlushFinishTrackerfFinishTrackers [kMaxFrameLag - 1]
 
int fCurrentFlushIdx = 0
 
- Static Protected Attributes inherited from skiatest::graphite::GraphiteTestContext
static constexpr int kMaxFrameLag = 3
 

Detailed Description

Definition at line 17 of file GraphiteVulkanTestContext.h.

Constructor & Destructor Documentation

◆ ~VulkanTestContext()

skiatest::graphite::VulkanTestContext::~VulkanTestContext ( )
override

Definition at line 69 of file GraphiteVulkanTestContext.cpp.

69 {
70 fVulkan.fMemoryAllocator.reset();
71 ACQUIRE_VK_PROC_LOCAL(DeviceWaitIdle, fVulkan.fInstance);
72 ACQUIRE_VK_PROC_LOCAL(DestroyDevice, fVulkan.fInstance);
73 ACQUIRE_VK_PROC_LOCAL(DestroyInstance, fVulkan.fInstance);
74 localVkDeviceWaitIdle(fVulkan.fDevice);
75 localVkDestroyDevice(fVulkan.fDevice, nullptr);
76#ifdef SK_ENABLE_VK_LAYERS
77 if (fDebugCallback != VK_NULL_HANDLE) {
78 fDestroyDebugReportCallbackEXT(fVulkan.fInstance, fDebugCallback, nullptr);
79 }
80#else
81 // Surpress unused private member variable warning
82 (void)fDebugCallback;
83 (void)fDestroyDebugReportCallbackEXT;
84#endif
85 localVkDestroyInstance(fVulkan.fInstance, nullptr);
86 delete fExtensions;
87
88 sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures);
89 delete fFeatures;
90}
#define ACQUIRE_VK_PROC_LOCAL(name, inst)
sk_sp< VulkanMemoryAllocator > fMemoryAllocator
#define VK_NULL_HANDLE
Definition vulkan_core.h:46

Member Function Documentation

◆ backend()

skgpu::BackendApi skiatest::graphite::VulkanTestContext::backend ( )
inlineoverridevirtual

◆ contextType()

skgpu::ContextType skiatest::graphite::VulkanTestContext::contextType ( )
overridevirtual

Implements skiatest::graphite::GraphiteTestContext.

Definition at line 92 of file GraphiteVulkanTestContext.cpp.

92 {
93 return skgpu::ContextType::kVulkan;
94}

◆ getBackendContext()

const skgpu::VulkanBackendContext & skiatest::graphite::VulkanTestContext::getBackendContext ( ) const
inline

Definition at line 29 of file GraphiteVulkanTestContext.h.

29 {
30 return fVulkan;
31 }

◆ Make()

std::unique_ptr< GraphiteTestContext > skiatest::graphite::VulkanTestContext::Make ( )
static

Definition at line 23 of file GraphiteVulkanTestContext.cpp.

23 {
24 skgpu::VulkanBackendContext backendContext;
27 VkDebugReportCallbackEXT debugCallback = VK_NULL_HANDLE;
28 PFN_vkDestroyDebugReportCallbackEXT destroyCallback = nullptr;
29
31 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
32 return nullptr;
33 }
34
36 features = new VkPhysicalDeviceFeatures2;
37 memset(features, 0, sizeof(VkPhysicalDeviceFeatures2));
38 if (!sk_gpu_test::CreateVkBackendContext(instProc, &backendContext, extensions,
39 features, &debugCallback,
40 nullptr, sk_gpu_test::CanPresentFn(),
42 sk_gpu_test::FreeVulkanFeaturesStructs(features);
43 delete features;
44 delete extensions;
45 return nullptr;
46 }
47 if (debugCallback != VK_NULL_HANDLE) {
48 destroyCallback = (PFN_vkDestroyDebugReportCallbackEXT) instProc(
49 backendContext.fInstance, "vkDestroyDebugReportCallbackEXT");
50 }
51
52 return std::unique_ptr<GraphiteTestContext>(new VulkanTestContext(backendContext,
53 extensions,
54 features,
55 debugCallback,
56 destroyCallback));
57}
bool gCreateProtectedContext
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)

◆ makeContext()

std::unique_ptr< skgpu::graphite::Context > skiatest::graphite::VulkanTestContext::makeContext ( const TestOptions options)
overridevirtual

Implements skiatest::graphite::GraphiteTestContext.

Definition at line 96 of file GraphiteVulkanTestContext.cpp.

97 {
98 SkASSERT(!options.fNeverYieldToWebGPU);
99 skgpu::graphite::ContextOptions revisedContextOptions(options.fContextOptions);
100 skgpu::graphite::ContextOptionsPriv contextOptionsPriv;
101 if (!options.fContextOptions.fOptionsPriv) {
102 revisedContextOptions.fOptionsPriv = &contextOptionsPriv;
103 }
104 // Needed to make synchronous readPixels work
105 revisedContextOptions.fOptionsPriv->fStoreContextRefInRecorder = true;
106
107 return skgpu::graphite::ContextFactory::MakeVulkan(fVulkan, revisedContextOptions);
108}
const char * options
#define SkASSERT(cond)
Definition SkAssert.h:116
SK_API std::unique_ptr< Context > MakeVulkan(const VulkanBackendContext &, const ContextOptions &)

The documentation for this class was generated from the following files: