Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
skiatest Namespace Reference

Namespaces

namespace  graphite
 

Classes

struct  Failure
 
class  Reporter
 
class  ReporterContext
 
struct  Test
 
class  Timer
 

Typedefs

using ContextType = skgpu::ContextType
 
using CPUTestProc = void(*)(Reporter *)
 
using GaneshTestProc = void(*)(Reporter *, const GrContextOptions &)
 
using GaneshContextOptionsProc = void(*)(GrContextOptions *)
 
using GraphiteTestProc = void(*)(Reporter *, const graphite::TestOptions &)
 
using GraphiteContextOptionsProc = void(*)(skgpu::graphite::ContextOptions *)
 
using TestRegistry = sk_tools::Registry< Test >
 
using GpuContextType = nullptr_t
 
typedef void GrContextTestFn(Reporter *, const sk_gpu_test::ContextInfo &)
 
typedef bool ContextTypeFilterFn(GpuContextType)
 

Enumerations

enum class  TestType : uint8_t { kCPU , kCPUSerial , kGanesh , kGraphite }
 

Functions

bool IsGLContextType (skgpu::ContextType type)
 
bool IsVulkanContextType (skgpu::ContextType type)
 
bool IsMetalContextType (skgpu::ContextType type)
 
bool IsDirect3DContextType (skgpu::ContextType type)
 
bool IsDawnContextType (skgpu::ContextType type)
 
bool IsMockContextType (skgpu::ContextType type)
 
void RunWithGaneshTestContexts (GrContextTestFn *testFn, ContextTypeFilterFn *filter, Reporter *reporter, const GrContextOptions &options)
 
SkString GetTmpDir ()
 
bool IsGLContextType (GpuContextType)
 
bool IsVulkanContextType (GpuContextType)
 
bool IsMetalContextType (GpuContextType)
 
bool IsDawnContextType (GpuContextType)
 
bool IsDirect3DContextType (GpuContextType)
 
bool IsMockContextType (GpuContextType)
 
static bool vk_has_physical_devices ()
 
static bool skip_context (skgpu::ContextType contextType)
 
static DEFINE_string (fontTestDataPath, "", "Path to extracted data from googlefonts_testdata CIPD file.")
 
void SetFontTestDataDirectory ()
 

Variables

static constexpr auto kNativeGLType = skgpu::ContextType::kGLES
 

Typedef Documentation

◆ ContextType

Definition at line 271 of file gm_bindings.cpp.

◆ ContextTypeFilterFn

typedef bool skiatest::ContextTypeFilterFn(GpuContextType)

Definition at line 214 of file Test.h.

◆ CPUTestProc

using skiatest::CPUTestProc = typedef void (*)(Reporter*)

Definition at line 113 of file Test.h.

◆ GaneshContextOptionsProc

Definition at line 115 of file Test.h.

◆ GaneshTestProc

using skiatest::GaneshTestProc = typedef void (*)(Reporter*, const GrContextOptions&)

Definition at line 114 of file Test.h.

◆ GpuContextType

using skiatest::GpuContextType = typedef nullptr_t

Definition at line 210 of file Test.h.

◆ GraphiteContextOptionsProc

Definition at line 117 of file Test.h.

◆ GraphiteTestProc

using skiatest::GraphiteTestProc = typedef void (*)(Reporter*, const graphite::TestOptions&)

Definition at line 116 of file Test.h.

◆ GrContextTestFn

typedef void skiatest::GrContextTestFn(Reporter *, const sk_gpu_test::ContextInfo &)

Definition at line 213 of file Test.h.

◆ TestRegistry

Definition at line 205 of file Test.h.

Enumeration Type Documentation

◆ TestType

enum class skiatest::TestType : uint8_t
strong
Enumerator
kCPU 
kCPUSerial 
kGanesh 
kGraphite 

Definition at line 17 of file TestType.h.

Function Documentation

◆ DEFINE_string()

static skiatest::DEFINE_string ( fontTestDataPath  ,
""  ,
"Path to extracted data from googlefonts_testdata CIPD file."   
)
static

◆ GetTmpDir()

SkString skiatest::GetTmpDir ( )

Definition at line 53 of file Test.cpp.

53 {
54 if (!FLAGS_tmpDir.isEmpty()) {
55 return SkString(FLAGS_tmpDir[0]);
56 }
57#ifdef SK_BUILD_FOR_ANDROID
58 const char* environmentVariable = "TMPDIR";
59 const char* defaultValue = "/data/local/tmp";
60#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX)
61 const char* environmentVariable = "TMPDIR";
62 const char* defaultValue = "/tmp";
63#elif defined(SK_BUILD_FOR_WIN)
64 const char* environmentVariable = "TEMP";
65 const char* defaultValue = nullptr;
66#else
67 const char* environmentVariable = nullptr;
68 const char* defaultValue = nullptr;
69#endif
70 const char* tmpdir = environmentVariable ? getenv(environmentVariable) : nullptr;
71 return SkString(tmpdir ? tmpdir : defaultValue);
72}

◆ IsDawnContextType() [1/2]

bool skiatest::IsDawnContextType ( GpuContextType  )
extern

◆ IsDawnContextType() [2/2]

bool skiatest::IsDawnContextType ( skgpu::ContextType  type)

Definition at line 65 of file DMGpuTestProcs.cpp.

65 {
66#if defined(SK_GRAPHITE)
68#else
69 return false;
70#endif
71}
skgpu::BackendApi ContextTypeBackend(skgpu::ContextType type)

◆ IsDirect3DContextType() [1/2]

bool skiatest::IsDirect3DContextType ( GpuContextType  )
extern

◆ IsDirect3DContextType() [2/2]

bool skiatest::IsDirect3DContextType ( skgpu::ContextType  type)

Definition at line 57 of file DMGpuTestProcs.cpp.

57 {
58#if defined(SK_GANESH)
60#else
61 return false;
62#endif
63}
GrBackendApi ContextTypeBackend(skgpu::ContextType type)

◆ IsGLContextType() [1/2]

bool skiatest::IsGLContextType ( GpuContextType  )
extern

◆ IsGLContextType() [2/2]

bool skiatest::IsGLContextType ( skgpu::ContextType  type)

Definition at line 29 of file DMGpuTestProcs.cpp.

29 {
30#if defined(SK_GANESH)
32#else
33 return false;
34#endif
35}

◆ IsMetalContextType() [1/2]

bool skiatest::IsMetalContextType ( GpuContextType  )
extern

◆ IsMetalContextType() [2/2]

bool skiatest::IsMetalContextType ( skgpu::ContextType  type)

Definition at line 47 of file DMGpuTestProcs.cpp.

47 {
48#if defined(SK_GANESH)
50#elif defined(SK_GRAPHITE)
51 return skgpu::graphite::ContextTypeBackend(type) == BackendApi::kMetal;
52#else
53 return false;
54#endif
55}

◆ IsMockContextType() [1/2]

bool skiatest::IsMockContextType ( GpuContextType  )
extern

◆ IsMockContextType() [2/2]

bool skiatest::IsMockContextType ( skgpu::ContextType  type)

Definition at line 73 of file DMGpuTestProcs.cpp.

73 {
74 return type == skgpu::ContextType::kMock;
75}

◆ IsVulkanContextType() [1/2]

bool skiatest::IsVulkanContextType ( GpuContextType  )
extern

◆ IsVulkanContextType() [2/2]

bool skiatest::IsVulkanContextType ( skgpu::ContextType  type)

Definition at line 37 of file DMGpuTestProcs.cpp.

37 {
38#if defined(SK_GANESH)
40#elif defined(SK_GRAPHITE)
41 return skgpu::graphite::ContextTypeBackend(type) == BackendApi::kVulkan;
42#else
43 return false;
44#endif
45}

◆ RunWithGaneshTestContexts()

void skiatest::RunWithGaneshTestContexts ( GrContextTestFn testFn,
ContextTypeFilterFn filter,
Reporter reporter,
const GrContextOptions options 
)

Definition at line 77 of file DMGpuTestProcs.cpp.

78 {
79#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_MAC)
80 static constexpr auto kNativeGLType = skgpu::ContextType::kGL;
81#else
82 static constexpr auto kNativeGLType = skgpu::ContextType::kGLES;
83#endif
84
85 for (int typeInt = 0; typeInt < skgpu::kContextTypeCount; ++typeInt) {
86 skgpu::ContextType contextType = static_cast<skgpu::ContextType>(typeInt);
87 // Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on
88 // desktop since tests do not account for not fixing http://skbug.com/2809
89 if (contextType == skgpu::ContextType::kGL ||
90 contextType == skgpu::ContextType::kGLES) {
91 if (contextType != kNativeGLType) {
92 continue;
93 }
94 }
95 // We destroy the factory and its associated contexts after each test. This is due to the
96 // fact that the command buffer sits on top of the native GL windowing (cgl, wgl, ...) but
97 // also tracks which of its contexts is current above that API and gets tripped up if the
98 // native windowing API is used directly outside of the command buffer code.
100 ContextInfo ctxInfo = factory.getContextInfo(contextType);
101 if (filter && !(*filter)(contextType)) {
102 continue;
103 }
104
105 ReporterContext ctx(reporter, SkString(skgpu::ContextTypeName(contextType)));
106 if (ctxInfo.directContext()) {
107 (*testFn)(reporter, ctxInfo);
108 // In case the test changed the current context make sure we move it back before
109 // calling flush.
110 ctxInfo.testContext()->makeCurrent();
111 // Sync so any release/finished procs get called.
113 }
114 }
115}
const char * options
reporter
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
GrDirectContext * directContext() const
TestContext * testContext() const
static const int kContextTypeCount
Definition ContextType.h:42
const char * ContextTypeName(skgpu::ContextType type)

◆ SetFontTestDataDirectory()

void skiatest::SetFontTestDataDirectory ( )

Set font test data directory. Overrides the location of the extracted googlefonts_testdata CIPD archive.

Definition at line 25 of file TestFontDataProvider.cpp.

25 {
26 if (FLAGS_fontTestDataPath.isEmpty()) {
27 return;
28 }
29 if (strlen(FLAGS_fontTestDataPath[0])) {
30 gFontTestDataBasePath = FLAGS_fontTestDataPath[0];
31 }
32}
std::atomic< const char * > gFontTestDataBasePath

◆ skip_context()

static bool skiatest::skip_context ( skgpu::ContextType  contextType)
static

Definition at line 76 of file skqp_GpuTestProcs.cpp.

76 {
77 // Use "native" instead of explicitly trying both OpenGL and OpenGL ES.
78 if (contextType == skgpu::ContextType::kGL || contextType == skgpu::ContextType::kGLES) {
79 if (contextType != kNativeGLType) {
80 return true;
81 }
82 }
83
84 // The Android CDD (https://source.android.com/compatibility/12/android-12-cdd.pdf) does not
85 // require Vulkan, but if it enumerates at least one VkPhysicalDevice then it is expected that
86 // Vulkan is supported
87 if (contextType == skgpu::ContextType::kVulkan && !vk_has_physical_devices()) {
88 return true;
89 }
90 return false;
91}
static bool vk_has_physical_devices()

◆ vk_has_physical_devices()

static bool skiatest::vk_has_physical_devices ( )
static

Definition at line 48 of file skqp_GpuTestProcs.cpp.

48 {
49 static bool supported = false;
50#ifdef SK_VULKAN
51 static std::once_flag flag;
52 std::call_once(flag, []() {
53 // We could create a VkInstance and call vkEnumeratePhysicalDevices devices directly, but
54 // CreatePlatformVkTestContext is already configured to do that and will return nullptr if
55 // there are no available devices.
56 std::unique_ptr<TestContext> testCtx(sk_gpu_test::CreatePlatformVkTestContext(nullptr));
57 if (testCtx) {
58 supported = true;
59 }
60 });
61#endif
62 return supported;
63}
FlutterSemanticsFlag flag

Variable Documentation

◆ kNativeGLType

constexpr auto skiatest::kNativeGLType = skgpu::ContextType::kGLES
staticconstexpr

Definition at line 69 of file skqp_GpuTestProcs.cpp.