12#if defined(SK_GANESH) && defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 && defined(SK_VULKAN)
48#include <EGL/eglext.h>
50#include <GLES/glext.h>
56 virtual ~BaseTestHelper() {}
60 virtual void cleanup() = 0;
62 virtual void releaseSurfaceToExternal(
SkSurface*) = 0;
63 virtual void releaseImage() = 0;
70 virtual void doClientSync() = 0;
79 int getFdHandle() {
return fFdHandle; }
88class EGLTestHelper :
public BaseTestHelper {
92 ~EGLTestHelper()
override {}
94 void releaseImage()
override {
99 if (EGL_NO_IMAGE_KHR != fImage) {
100 fGLCtx->destroyEGLImage(fImage);
101 fImage = EGL_NO_IMAGE_KHR;
104 GR_GL_CALL(fGLCtx->gl(), DeleteTextures(1, &fTexID));
109 void releaseSurfaceToExternal(
SkSurface*)
override {}
111 void cleanup()
override {
112 this->releaseImage();
122 void doClientSync()
override;
127 void makeCurrent()
override { fGLCtx->makeCurrent(); }
134 typedef EGLClientBuffer (*EGLGetNativeClientBufferANDROIDProc)(
const struct AHardwareBuffer*);
135 typedef EGLImageKHR (*EGLCreateImageKHRProc)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer,
137 typedef void (*EGLImageTargetTexture2DOESProc)(EGLenum,
void*);
138 EGLGetNativeClientBufferANDROIDProc fEGLGetNativeClientBufferANDROID;
139 EGLCreateImageKHRProc fEGLCreateImageKHR;
140 EGLImageTargetTexture2DOESProc fEGLImageTargetTexture2DOES;
142 PFNEGLCREATESYNCKHRPROC fEGLCreateSyncKHR;
143 PFNEGLWAITSYNCKHRPROC fEGLWaitSyncKHR;
144 PFNEGLGETSYNCATTRIBKHRPROC fEGLGetSyncAttribKHR;
145 PFNEGLDUPNATIVEFENCEFDANDROIDPROC fEGLDupNativeFenceFDANDROID;
146 PFNEGLDESTROYSYNCKHRPROC fEGLDestroySyncKHR;
148 EGLImageKHR fImage = EGL_NO_IMAGE_KHR;
160 fDirectContext = fGLESContextInfo.directContext();
161 fGLCtx = fGLESContextInfo.glContext();
162 if (!fDirectContext || !fGLCtx) {
171 if (!fGLCtx->gl()->hasExtension(
"EGL_KHR_image") ||
172 !fGLCtx->gl()->hasExtension(
"EGL_ANDROID_get_native_client_buffer") ||
173 !fGLCtx->gl()->hasExtension(
"GL_OES_EGL_image_external") ||
174 !fGLCtx->gl()->hasExtension(
"GL_OES_EGL_image") ||
175 !fGLCtx->gl()->hasExtension(
"EGL_KHR_fence_sync") ||
176 !fGLCtx->gl()->hasExtension(
"EGL_ANDROID_native_fence_sync")) {
180 fEGLGetNativeClientBufferANDROID =
181 (EGLGetNativeClientBufferANDROIDProc) eglGetProcAddress(
"eglGetNativeClientBufferANDROID");
182 if (!fEGLGetNativeClientBufferANDROID) {
183 ERRORF(
reporter,
"Failed to get the eglGetNativeClientBufferAndroid proc");
187 fEGLCreateImageKHR = (EGLCreateImageKHRProc) eglGetProcAddress(
"eglCreateImageKHR");
188 if (!fEGLCreateImageKHR) {
193 fEGLImageTargetTexture2DOES =
194 (EGLImageTargetTexture2DOESProc) eglGetProcAddress(
"glEGLImageTargetTexture2DOES");
195 if (!fEGLImageTargetTexture2DOES) {
196 ERRORF(
reporter,
"Failed to get the proc EGLImageTargetTexture2DOES");
200 fEGLCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) eglGetProcAddress(
"eglCreateSyncKHR");
201 if (!fEGLCreateSyncKHR) {
206 fEGLWaitSyncKHR = (PFNEGLWAITSYNCKHRPROC) eglGetProcAddress(
"eglWaitSyncKHR");
207 if (!fEGLWaitSyncKHR) {
212 fEGLGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC) eglGetProcAddress(
"eglGetSyncAttribKHR");
213 if (!fEGLGetSyncAttribKHR) {
218 fEGLDupNativeFenceFDANDROID =
219 (PFNEGLDUPNATIVEFENCEFDANDROIDPROC) eglGetProcAddress(
"eglDupNativeFenceFDANDROID");
220 if (!fEGLDupNativeFenceFDANDROID) {
221 ERRORF(
reporter,
"Failed to get the proc eglDupNativeFenceFDANDROID");
225 fEGLDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) eglGetProcAddress(
"eglDestroySyncKHR");
226 if (!fEGLDestroySyncKHR) {
238 EGLClientBuffer eglClientBuffer = fEGLGetNativeClientBufferANDROID(
buffer);
239 EGLint eglAttribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
241 EGLDisplay eglDisplay = eglGetCurrentDisplay();
242 fImage = fEGLCreateImageKHR(eglDisplay, EGL_NO_CONTEXT,
243 EGL_NATIVE_BUFFER_ANDROID,
244 eglClientBuffer, eglAttribs);
245 if (EGL_NO_IMAGE_KHR == fImage) {
246 SkDebugf(
"Could not create EGL image, err = (%#x)\n", (
int) eglGetError() );
250 GR_GL_CALL(fGLCtx->gl(), GenTextures(1, &fTexID));
261 fEGLImageTargetTexture2DOES(GL_TEXTURE_2D, fImage);
278 textureInfo.
fID = fTexID;
306 textureInfo.
fID = fTexID;
332 EGLDisplay eglDisplay = eglGetCurrentDisplay();
333 EGLSyncKHR eglsync = fEGLCreateSyncKHR(eglDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID,
nullptr);
334 if (EGL_NO_SYNC_KHR == eglsync) {
335 ERRORF(
reporter,
"Failed to create EGLSync for EGL_SYNC_NATIVE_FENCE_ANDROID\n");
340 fFdHandle = fEGLDupNativeFenceFDANDROID(eglDisplay, eglsync);
342 EGLint
result = fEGLDestroySyncKHR(eglDisplay, eglsync);
353 EGLDisplay eglDisplay = eglGetCurrentDisplay();
355 EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fdHandle,
358 EGLSyncKHR eglsync = fEGLCreateSyncKHR(eglDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, attr);
359 if (EGL_NO_SYNC_KHR == eglsync) {
361 "Failed to create EGLSync when importing EGL_SYNC_NATIVE_FENCE_FD_ANDROID\n");
364 EGLint
result = fEGLWaitSyncKHR(eglDisplay, eglsync, 0);
369 result = fEGLDestroySyncKHR(eglDisplay, eglsync);
377void EGLTestHelper::doClientSync() {
378 this->directContext()->flush();
383#define DECLARE_VK_PROC(name) PFN_vk##name fVk##name
385#define ACQUIRE_INST_VK_PROC(name) \
387 fVk##name = reinterpret_cast<PFN_vk##name>(getProc("vk" #name, fBackendContext.fInstance,\
389 if (fVk##name == nullptr) { \
390 ERRORF(reporter, "Function ptr for vk%s could not be acquired\n", #name); \
395#define ACQUIRE_DEVICE_VK_PROC(name) \
397 fVk##name = reinterpret_cast<PFN_vk##name>(getProc("vk" #name, VK_NULL_HANDLE, fDevice)); \
398 if (fVk##name == nullptr) { \
399 ERRORF(reporter, "Function ptr for vk%s could not be acquired\n", #name); \
404class VulkanTestHelper :
public BaseTestHelper {
406 VulkanTestHelper() {}
408 ~VulkanTestHelper()
override {}
410 void releaseImage()
override {
415 fVkDestroyImage(fDevice, fImage,
nullptr);
420 fVkFreeMemory(fDevice, fMemory,
nullptr);
428 fDirectContext->flush(
surface, {}, &newState);
431 void cleanup()
override {
432 fDirectContext.reset();
433 this->releaseImage();
435 fVkDestroySemaphore(fDevice, fSignalSemaphore,
nullptr);
438 fBackendContext.fMemoryAllocator.reset();
440 fVkDeviceWaitIdle(fDevice);
441 fVkDestroyDevice(fDevice,
nullptr);
444#ifdef SK_ENABLE_VK_LAYERS
446 fDestroyDebugCallback(fBackendContext.fInstance, fDebugCallback,
nullptr);
450 fVkDestroyInstance(fBackendContext.fInstance,
nullptr);
456 sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures);
462 void doClientSync()
override {
463 if (!fDirectContext) {
482 GrDirectContext* directContext()
override {
return fDirectContext.get(); }
493 DECLARE_VK_PROC(DestroyInstance);
494 DECLARE_VK_PROC(DeviceWaitIdle);
495 DECLARE_VK_PROC(DestroyDevice);
497 DECLARE_VK_PROC(GetPhysicalDeviceExternalSemaphoreProperties);
498 DECLARE_VK_PROC(GetPhysicalDeviceImageFormatProperties2);
499 DECLARE_VK_PROC(GetPhysicalDeviceMemoryProperties2);
501 DECLARE_VK_PROC(GetAndroidHardwareBufferPropertiesANDROID);
503 DECLARE_VK_PROC(CreateImage);
504 DECLARE_VK_PROC(GetImageMemoryRequirements2);
505 DECLARE_VK_PROC(DestroyImage);
507 DECLARE_VK_PROC(AllocateMemory);
508 DECLARE_VK_PROC(BindImageMemory2);
509 DECLARE_VK_PROC(FreeMemory);
511 DECLARE_VK_PROC(CreateSemaphore);
512 DECLARE_VK_PROC(GetSemaphoreFdKHR);
513 DECLARE_VK_PROC(ImportSemaphoreFdKHR);
514 DECLARE_VK_PROC(DestroySemaphore);
535 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
543 fFeatures->pNext =
nullptr;
548 if (!sk_gpu_test::CreateVkBackendContext(instProc, &fBackendContext, fExtensions,
549 fFeatures, &fDebugCallback)) {
552 fDevice = fBackendContext.fDevice;
553 auto getProc = fBackendContext.fGetProc;
557 fBackendContext.fInstance,
"vkDestroyDebugReportCallbackEXT");
582 ACQUIRE_DEVICE_VK_PROC(GetAndroidHardwareBufferPropertiesANDROID);
584 ACQUIRE_DEVICE_VK_PROC(CreateImage);
585 ACQUIRE_DEVICE_VK_PROC(GetImageMemoryRequirements2);
586 ACQUIRE_DEVICE_VK_PROC(DestroyImage);
588 ACQUIRE_DEVICE_VK_PROC(AllocateMemory);
589 ACQUIRE_DEVICE_VK_PROC(BindImageMemory2);
590 ACQUIRE_DEVICE_VK_PROC(FreeMemory);
592 ACQUIRE_DEVICE_VK_PROC(CreateSemaphore);
593 ACQUIRE_DEVICE_VK_PROC(GetSemaphoreFdKHR);
594 ACQUIRE_DEVICE_VK_PROC(ImportSemaphoreFdKHR);
595 ACQUIRE_DEVICE_VK_PROC(DestroySemaphore);
599 if (!fDirectContext) {
603 return this->checkOptimalHardwareBuffer(
reporter);
610 externalImageFormatInfo.
sType =
612 externalImageFormatInfo.
pNext =
nullptr;
623 imageFormatInfo.
pNext = &externalImageFormatInfo;
627 imageFormatInfo.
usage = usageFlags;
628 imageFormatInfo.
flags = 0;
632 hwbUsage.
pNext =
nullptr;
636 externalImgFormatProps.
pNext = &hwbUsage;
640 imgFormProps.
pNext = &externalImgFormatProps;
642 err = fVkGetPhysicalDeviceImageFormatProperties2(fBackendContext.fPhysicalDevice,
643 &imageFormatInfo, &imgFormProps);
645 ERRORF(
reporter,
"vkGetPhysicalDeviceImageFormatProperites failed, err: %d", err);
674 hwbFormatProps.
pNext =
nullptr;
678 hwbProps.
pNext = &hwbFormatProps;
680 err = fVkGetAndroidHardwareBufferPropertiesANDROID(fDevice,
buffer, &hwbProps);
682 ERRORF(
reporter,
"GetAndroidHardwareBufferPropertiesAndroid failed, err: %d", err);
719 &externalMemoryImageInfo,
735 err = fVkCreateImage(fDevice, &imageCreateInfo,
nullptr, &fImage);
743 phyDevMemProps.
pNext =
nullptr;
745 uint32_t typeIndex = 0;
746 uint32_t heapIndex = 0;
747 bool foundHeap =
false;
748 fVkGetPhysicalDeviceMemoryProperties2(fBackendContext.fPhysicalDevice, &phyDevMemProps);
750 for (uint32_t
i = 0;
i < memTypeCnt && !foundHeap; ++
i) {
771 ERRORF(
reporter,
"Failed to find valid heap for imported memory");
777 hwbImportInfo.
pNext =
nullptr;
782 dedicatedAllocInfo.
pNext = &hwbImportInfo;
783 dedicatedAllocInfo.
image = fImage;
793 err = fVkAllocateMemory(fDevice, &allocInfo,
nullptr, &fMemory);
795 ERRORF(
reporter,
"AllocateMemory failed for imported buffer, err: %d", err);
801 bindImageInfo.
pNext =
nullptr;
802 bindImageInfo.
image = fImage;
803 bindImageInfo.
memory = fMemory;
806 err = fVkBindImageMemory2(fDevice, 1, &bindImageInfo);
808 ERRORF(
reporter,
"BindImageMemory failed for imported buffer, err: %d", err);
818 outImageInfo->
fImage = fImage;
819 outImageInfo->
fAlloc = alloc;
832 if (!this->importHardwareBuffer(
reporter,
buffer,
false, &imageInfo)) {
845 if (!wrappedImage.
get()) {
855 this->releaseSurfaceToExternal(
surface.get());
858 if (!this->setupSemaphoreForSignaling(
reporter, &semaphore)) {
862 info.fNumSemaphores = 1;
863 info.fSignalSemaphores = &semaphore;
865 fDirectContext->submit();
871 if (!this->exportSemaphore(
reporter, semaphore)) {
882 exSemInfo.
pNext =
nullptr;
887 exSemProps.
pNext =
nullptr;
889 fVkGetPhysicalDeviceExternalSemaphoreProperties(fBackendContext.fPhysicalDevice, &exSemInfo,
894 ERRORF(
reporter,
"HANDLE_TYPE_SYNC_FD not listed as exportFromImportedHandleTypes");
899 ERRORF(
reporter,
"HANDLE_TYPE_SYNC_FD not listed as compatibleHandleTypes");
906 ERRORF(
reporter,
"HANDLE_TYPE_SYNC_FD doesn't support export and import feature");
912 exportInfo.
pNext =
nullptr;
917 semaphoreInfo.
pNext = &exportInfo;
918 semaphoreInfo.
flags = 0;
920 VkSemaphore semaphore;
921 VkResult err = fVkCreateSemaphore(fDevice, &semaphoreInfo,
nullptr, &semaphore);
923 ERRORF(
reporter,
"Failed to create signal semaphore, err: %d", err);
940 getFdInfo.
pNext =
nullptr;
944 VkResult err = fVkGetSemaphoreFdKHR(fDevice, &getFdInfo, &fFdHandle);
946 ERRORF(
reporter,
"Failed to export signal semaphore, err: %d", err);
949 fSignalSemaphore = semaphore;
957 semaphoreInfo.
pNext =
nullptr;
958 semaphoreInfo.
flags = 0;
960 VkSemaphore semaphore;
961 VkResult err = fVkCreateSemaphore(fDevice, &semaphoreInfo,
nullptr, &semaphore);
963 ERRORF(
reporter,
"Failed to create import semaphore, err: %d", err);
969 importInfo.
pNext =
nullptr;
973 importInfo.
fd = fdHandle;
975 err = fVkImportSemaphoreFdKHR(fDevice, &importInfo);
982 if (!
surface->wait(1, &beSemaphore)) {
984 fVkDestroySemaphore(fDevice, semaphore,
nullptr);
993 if (!this->importHardwareBuffer(
reporter,
buffer,
true, &imageInfo)) {
1024 switch ((
x+
y) % 5) {
1049 intptr_t pixels =
reinterpret_cast<intptr_t
>(bmp.
getPixels());
1066 const uint32_t srcPixel = *srcBitmap.
getAddr32(
x,
y);
1067 const uint32_t dstPixel = *dstBitmap.
getAddr32(
x,
y);
1068 if (srcPixel != dstPixel) {
1069 ERRORF(
reporter,
"Expected readback pixel (%d, %d) value 0x%08x, got 0x%08x.",
1070 x,
y, srcPixel, dstPixel);
1082static void cleanup_resources(BaseTestHelper* srcHelper, BaseTestHelper* dstHelper,
1085 srcHelper->cleanup();
1088 dstHelper->cleanup();
1091 AHardwareBuffer_release(
buffer);
1107 SrcType srcType, DstType dstType,
bool shareSyncs) {
1108 if (SrcType::kCPU == srcType && shareSyncs) {
1112 std::unique_ptr<BaseTestHelper> srcHelper;
1113 std::unique_ptr<BaseTestHelper> dstHelper;
1116 srcHelper.
reset(
new VulkanTestHelper());
1117 }
else if (SrcType::kEGL == srcType) {
1119 srcHelper.reset(
new EGLTestHelper(
options));
1121 SkASSERTF(
false,
"SrcType::kEGL used without OpenGL support.");
1126 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1132 dstHelper.reset(
new VulkanTestHelper());
1135 SkASSERT(DstType::kEGL == dstType);
1136 dstHelper.reset(
new EGLTestHelper(
options));
1138 SkASSERTF(
false,
"DstType::kEGL used without OpenGL support.");
1143 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1152 SkBitmap srcBitmap = make_src_bitmap();
1162 AHardwareBuffer_Desc hwbDesc;
1163 hwbDesc.width =
DEV_W;
1164 hwbDesc.height =
DEV_H;
1166 if (SrcType::kCPU == srcType) {
1167 hwbDesc.usage = AHARDWAREBUFFER_USAGE_CPU_READ_NEVER |
1168 AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN |
1169 AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
1171 hwbDesc.usage = AHARDWAREBUFFER_USAGE_CPU_READ_NEVER |
1172 AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER |
1173 AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
1174 AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT;
1176 hwbDesc.format = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
1182 if (
int error = AHardwareBuffer_allocate(&hwbDesc, &
buffer)) {
1184 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1188 if (SrcType::kCPU == srcType) {
1190 AHardwareBuffer_describe(
buffer, &hwbDesc);
1192 uint32_t* bufferAddr;
1193 if (AHardwareBuffer_lock(
buffer, AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN, -1,
nullptr,
1194 reinterpret_cast<void**
>(&bufferAddr))) {
1196 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1202 uint32_t*
dst = bufferAddr;
1206 dst += hwbDesc.stride;
1211 const uint32_t srcPixel = *srcBitmap.
getAddr32(
x,
y);
1212 uint32_t dstPixel = bufferAddr[
y * hwbDesc.stride +
x];
1213 if (srcPixel != dstPixel) {
1214 ERRORF(
reporter,
"CPU HWB Expected readpix (%d, %d) value 0x%08x, got 0x%08x.",
1215 x,
y, srcPixel, dstPixel);
1220 AHardwareBuffer_unlock(
buffer,
nullptr);
1223 srcHelper->makeCurrent();
1227 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1232 surface->getCanvas()->drawImage(srcBmpImage, 0, 0);
1237 bool readResult =
surface->readPixels(dstBitmapSurface, 0, 0);
1241 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1252 if (!srcHelper->flushSurfaceAndSignalSemaphore(
reporter, std::move(
surface))) {
1253 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1257 srcHelper->releaseSurfaceToExternal(
surface.get());
1258 srcHelper->doClientSync();
1260 srcHelper->releaseImage();
1268 dstHelper->makeCurrent();
1271 if (!wrappedImage) {
1272 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1276 auto direct = dstHelper->directContext();
1284 if (!dstSurf.
get()) {
1286 wrappedImage.
reset();
1287 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1292 if (!dstHelper->importAndWaitOnSemaphore(
reporter, srcHelper->getFdHandle(), dstSurf)) {
1293 wrappedImage.
reset();
1294 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1300 bool readResult = dstSurf->
readPixels(dstBitmapFinal, 0, 0);
1303 wrappedImage.
reset();
1305 dstHelper->doClientSync();
1306 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1313 wrappedImage.
reset();
1314 dstHelper->doClientSync();
1315 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
static void run_test(GrDirectContext *dContext, skiatest::Reporter *reporter, BulkRectTest test)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
struct AHardwareBuffer AHardwareBuffer
#define GR_GL_CALL_NOERRCHECK(IFACE, X)
#define GR_GL_CALL(IFACE, X)
static bool check_read(skiatest::Reporter *reporter, const SkBitmap &bitmap)
@ kTopLeft_GrSurfaceOrigin
@ kTextureBinding_GrGLBackendState
static SkPMColor get_src_color(int x, int y)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERTF(cond, fmt,...)
static SkPMColor SkPremultiplyARGBInline(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static constexpr bool SkToBool(const T &x)
#define DEF_GANESH_TEST(name, reporter, options, ctsEnforcement)
#define REPORTER_ASSERT(r, cond,...)
#define ACQUIRE_INST_VK_PROC(name)
bool isInitialized() const
int bytesPerPixel() const
void allocN32Pixels(int width, int height, bool isOpaque=false)
uint32_t * getAddr32(int x, int y) const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
bool readPixels(const SkPixmap &dst, int srcX, int srcY)
void reset(T *ptr=nullptr)
const uint8_t uint32_t uint32_t GError ** error
SK_API GrBackendSemaphore MakeVk(VkSemaphore semaphore)
SK_API VkSemaphore GetVkSemaphore(const GrBackendSemaphore &)
SK_API GrBackendTexture MakeGL(int width, int height, skgpu::Mipmapped, const GrGLTextureInfo &glInfo, std::string_view label={})
SK_API GrBackendTexture MakeVk(int width, int height, const GrVkImageInfo &, std::string_view label={})
SK_API sk_sp< GrDirectContext > MakeVulkan(const skgpu::VulkanBackendContext &, const GrContextOptions &)
SK_API sk_sp< SkImage > RasterFromBitmap(const SkBitmap &bitmap)
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex)
SK_API void FlushAndSubmit(sk_sp< SkSurface >)
void Flush(SkSurface *surface)
skgpu::VulkanAlloc fAlloc
uint32_t fCurrentQueueFamily
VkImageLayout fImageLayout
VkImageUsageFlags fImageUsageFlags
VkImageTiling fImageTiling
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
VkDeviceSize allocationSize
uint64_t androidHardwareBufferUsage
VkDeviceSize memoryOffset
VkExternalSemaphoreHandleTypeFlags handleTypes
VkExternalMemoryFeatureFlags externalMemoryFeatures
VkExternalSemaphoreFeatureFlags externalSemaphoreFeatures
VkExternalSemaphoreHandleTypeFlags compatibleHandleTypes
VkExternalSemaphoreHandleTypeFlags exportFromImportedHandleTypes
struct AHardwareBuffer * buffer
VkSemaphoreImportFlags flags
VkExternalSemaphoreHandleTypeFlagBits handleType
VkMemoryPropertyFlags propertyFlags
VkExternalSemaphoreHandleTypeFlagBits handleType
VkPhysicalDeviceMemoryProperties memoryProperties
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
VkSemaphoreCreateFlags flags
VkExternalSemaphoreHandleTypeFlagBits handleType
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
@ VK_FORMAT_FEATURE_TRANSFER_DST_BIT
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
@ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
@ VK_IMAGE_LAYOUT_UNDEFINED
@ VK_SHARING_MODE_EXCLUSIVE
@ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
VkFlags VkImageUsageFlags
#define VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME
#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME
@ VK_IMAGE_TILING_OPTIMAL
@ VK_SEMAPHORE_IMPORT_TEMPORARY_BIT
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
@ VK_IMAGE_USAGE_SAMPLED_BIT
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
@ VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID
struct VkPhysicalDeviceFeatures2 VkPhysicalDeviceFeatures2
@ VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT
@ VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT
#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME
@ VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT
@ VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT
#define VK_QUEUE_FAMILY_EXTERNAL
@ VK_FORMAT_R8G8B8A8_UNORM
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
@ VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT
@ VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO
@ VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID
@ VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES
@ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
@ VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID
@ VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2
@ VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2
@ VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO
@ VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR
@ VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR
@ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
@ VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2
@ VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID
@ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO
@ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2
@ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO
@ VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID
@ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO