Flutter Engine
The Flutter Engine
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 ()
 
virtual skgpu::BackendApi backend ()=0
 
virtual skgpu::ContextType contextType ()=0
 
virtual std::unique_ptr< skgpu::graphite::ContextmakeContext (const TestOptions &)=0
 
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 70 of file GraphiteVulkanTestContext.cpp.

70 {
71 fVulkan.fMemoryAllocator.reset();
72 ACQUIRE_VK_PROC_LOCAL(DeviceWaitIdle, fVulkan.fInstance);
73 ACQUIRE_VK_PROC_LOCAL(DestroyDevice, fVulkan.fInstance);
74 ACQUIRE_VK_PROC_LOCAL(DestroyInstance, fVulkan.fInstance);
75 localVkDeviceWaitIdle(fVulkan.fDevice);
76 localVkDestroyDevice(fVulkan.fDevice, nullptr);
77#ifdef SK_ENABLE_VK_LAYERS
78 if (fDebugCallback != VK_NULL_HANDLE) {
79 fDestroyDebugReportCallbackEXT(fVulkan.fInstance, fDebugCallback, nullptr);
80 }
81#else
82 // Surpress unused private member variable warning
83 (void)fDebugCallback;
84 (void)fDestroyDebugReportCallbackEXT;
85#endif
86 localVkDestroyInstance(fVulkan.fInstance, nullptr);
87 delete fExtensions;
88
89 sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures);
90 delete fFeatures;
91}
#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 93 of file GraphiteVulkanTestContext.cpp.

93 {
95}
@ kVulkan
ANGLE on Metal ES 3 context.

◆ 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 24 of file GraphiteVulkanTestContext.cpp.

24 {
25 skgpu::VulkanBackendContext backendContext;
28 VkDebugReportCallbackEXT debugCallback = VK_NULL_HANDLE;
29 PFN_vkDestroyDebugReportCallbackEXT destroyCallback = nullptr;
30
32 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
33 return nullptr;
34 }
35
37 features = new VkPhysicalDeviceFeatures2;
38 memset(features, 0, sizeof(VkPhysicalDeviceFeatures2));
39 if (!sk_gpu_test::CreateVkBackendContext(instProc, &backendContext, extensions,
40 features, &debugCallback,
41 nullptr, sk_gpu_test::CanPresentFn(),
43 sk_gpu_test::FreeVulkanFeaturesStructs(features);
44 delete features;
45 delete extensions;
46 return nullptr;
47 }
48 if (debugCallback != VK_NULL_HANDLE) {
49 destroyCallback = (PFN_vkDestroyDebugReportCallbackEXT) instProc(
50 backendContext.fInstance, "vkDestroyDebugReportCallbackEXT");
51 }
52
53 return std::unique_ptr<GraphiteTestContext>(new VulkanTestContext(backendContext,
55 features,
56 debugCallback,
57 destroyCallback));
58}
bool gCreateProtectedContext
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)
Definition: vulkan_core.h:3989

◆ makeContext()

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

Implements skiatest::graphite::GraphiteTestContext.

Definition at line 97 of file GraphiteVulkanTestContext.cpp.

98 {
99 SkASSERT(!options.fNeverYieldToWebGPU);
100 skgpu::graphite::ContextOptions revisedContextOptions(options.fContextOptions);
101 skgpu::graphite::ContextOptionsPriv contextOptionsPriv;
102 if (!options.fContextOptions.fOptionsPriv) {
103 revisedContextOptions.fOptionsPriv = &contextOptionsPriv;
104 }
105 // Needed to make synchronous readPixels work
106 revisedContextOptions.fOptionsPriv->fStoreContextRefInRecorder = true;
107
108 return skgpu::graphite::ContextFactory::MakeVulkan(fVulkan, revisedContextOptions);
109}
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: