12#if defined(SK_GANESH) && defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 && defined(SK_VULKAN)
47#include <EGL/eglext.h>
49#include <GLES/glext.h>
55 virtual ~BaseTestHelper() {}
59 virtual void cleanup() = 0;
61 virtual void releaseSurfaceToExternal(
SkSurface*) = 0;
62 virtual void releaseImage() = 0;
69 virtual void doClientSync() = 0;
78 int getFdHandle() {
return fFdHandle; }
87class EGLTestHelper :
public BaseTestHelper {
91 ~EGLTestHelper()
override {}
93 void releaseImage()
override {
98 if (EGL_NO_IMAGE_KHR != fImage) {
99 fGLCtx->destroyEGLImage(fImage);
100 fImage = EGL_NO_IMAGE_KHR;
103 GR_GL_CALL(fGLCtx->gl(), DeleteTextures(1, &fTexID));
108 void releaseSurfaceToExternal(
SkSurface*)
override {}
110 void cleanup()
override {
111 this->releaseImage();
121 void doClientSync()
override;
126 void makeCurrent()
override { fGLCtx->makeCurrent(); }
133 typedef EGLClientBuffer (*EGLGetNativeClientBufferANDROIDProc)(
const struct AHardwareBuffer*);
134 typedef EGLImageKHR (*EGLCreateImageKHRProc)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer,
136 typedef void (*EGLImageTargetTexture2DOESProc)(EGLenum,
void*);
137 EGLGetNativeClientBufferANDROIDProc fEGLGetNativeClientBufferANDROID;
138 EGLCreateImageKHRProc fEGLCreateImageKHR;
139 EGLImageTargetTexture2DOESProc fEGLImageTargetTexture2DOES;
141 PFNEGLCREATESYNCKHRPROC fEGLCreateSyncKHR;
142 PFNEGLWAITSYNCKHRPROC fEGLWaitSyncKHR;
143 PFNEGLGETSYNCATTRIBKHRPROC fEGLGetSyncAttribKHR;
144 PFNEGLDUPNATIVEFENCEFDANDROIDPROC fEGLDupNativeFenceFDANDROID;
145 PFNEGLDESTROYSYNCKHRPROC fEGLDestroySyncKHR;
147 EGLImageKHR fImage = EGL_NO_IMAGE_KHR;
158 fGLESContextInfo = fFactory.getContextInfo(skgpu::ContextType::kGLES);
159 fDirectContext = fGLESContextInfo.directContext();
160 fGLCtx = fGLESContextInfo.glContext();
161 if (!fDirectContext || !fGLCtx) {
170 if (!fGLCtx->gl()->hasExtension(
"EGL_KHR_image") ||
171 !fGLCtx->gl()->hasExtension(
"EGL_ANDROID_get_native_client_buffer") ||
172 !fGLCtx->gl()->hasExtension(
"GL_OES_EGL_image_external") ||
173 !fGLCtx->gl()->hasExtension(
"GL_OES_EGL_image") ||
174 !fGLCtx->gl()->hasExtension(
"EGL_KHR_fence_sync") ||
175 !fGLCtx->gl()->hasExtension(
"EGL_ANDROID_native_fence_sync")) {
179 fEGLGetNativeClientBufferANDROID =
180 (EGLGetNativeClientBufferANDROIDProc) eglGetProcAddress(
"eglGetNativeClientBufferANDROID");
181 if (!fEGLGetNativeClientBufferANDROID) {
182 ERRORF(
reporter,
"Failed to get the eglGetNativeClientBufferAndroid proc");
186 fEGLCreateImageKHR = (EGLCreateImageKHRProc) eglGetProcAddress(
"eglCreateImageKHR");
187 if (!fEGLCreateImageKHR) {
192 fEGLImageTargetTexture2DOES =
193 (EGLImageTargetTexture2DOESProc) eglGetProcAddress(
"glEGLImageTargetTexture2DOES");
194 if (!fEGLImageTargetTexture2DOES) {
195 ERRORF(
reporter,
"Failed to get the proc EGLImageTargetTexture2DOES");
199 fEGLCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) eglGetProcAddress(
"eglCreateSyncKHR");
200 if (!fEGLCreateSyncKHR) {
205 fEGLWaitSyncKHR = (PFNEGLWAITSYNCKHRPROC) eglGetProcAddress(
"eglWaitSyncKHR");
206 if (!fEGLWaitSyncKHR) {
211 fEGLGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC) eglGetProcAddress(
"eglGetSyncAttribKHR");
212 if (!fEGLGetSyncAttribKHR) {
217 fEGLDupNativeFenceFDANDROID =
218 (PFNEGLDUPNATIVEFENCEFDANDROIDPROC) eglGetProcAddress(
"eglDupNativeFenceFDANDROID");
219 if (!fEGLDupNativeFenceFDANDROID) {
220 ERRORF(
reporter,
"Failed to get the proc eglDupNativeFenceFDANDROID");
224 fEGLDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) eglGetProcAddress(
"eglDestroySyncKHR");
225 if (!fEGLDestroySyncKHR) {
237 EGLClientBuffer eglClientBuffer = fEGLGetNativeClientBufferANDROID(
buffer);
238 EGLint eglAttribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
240 EGLDisplay eglDisplay = eglGetCurrentDisplay();
241 fImage = fEGLCreateImageKHR(eglDisplay, EGL_NO_CONTEXT,
242 EGL_NATIVE_BUFFER_ANDROID,
243 eglClientBuffer, eglAttribs);
244 if (EGL_NO_IMAGE_KHR == fImage) {
245 SkDebugf(
"Could not create EGL image, err = (%#x)\n", (
int) eglGetError() );
249 GR_GL_CALL(fGLCtx->gl(), GenTextures(1, &fTexID));
260 fEGLImageTargetTexture2DOES(GL_TEXTURE_2D, fImage);
277 textureInfo.
fID = fTexID;
305 textureInfo.
fID = fTexID;
331 EGLDisplay eglDisplay = eglGetCurrentDisplay();
332 EGLSyncKHR eglsync = fEGLCreateSyncKHR(eglDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID,
nullptr);
333 if (EGL_NO_SYNC_KHR == eglsync) {
334 ERRORF(
reporter,
"Failed to create EGLSync for EGL_SYNC_NATIVE_FENCE_ANDROID\n");
339 fFdHandle = fEGLDupNativeFenceFDANDROID(eglDisplay, eglsync);
341 EGLint
result = fEGLDestroySyncKHR(eglDisplay, eglsync);
352 EGLDisplay eglDisplay = eglGetCurrentDisplay();
354 EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fdHandle,
357 EGLSyncKHR eglsync = fEGLCreateSyncKHR(eglDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, attr);
358 if (EGL_NO_SYNC_KHR == eglsync) {
360 "Failed to create EGLSync when importing EGL_SYNC_NATIVE_FENCE_FD_ANDROID\n");
363 EGLint
result = fEGLWaitSyncKHR(eglDisplay, eglsync, 0);
368 result = fEGLDestroySyncKHR(eglDisplay, eglsync);
376void EGLTestHelper::doClientSync() {
377 this->directContext()->flush();
382#define DECLARE_VK_PROC(name) PFN_vk##name fVk##name
384#define ACQUIRE_INST_VK_PROC(name) \
386 fVk##name = reinterpret_cast<PFN_vk##name>(getProc("vk" #name, fBackendContext.fInstance,\
388 if (fVk##name == nullptr) { \
389 ERRORF(reporter, "Function ptr for vk%s could not be acquired\n", #name); \
394#define ACQUIRE_DEVICE_VK_PROC(name) \
396 fVk##name = reinterpret_cast<PFN_vk##name>(getProc("vk" #name, VK_NULL_HANDLE, fDevice)); \
397 if (fVk##name == nullptr) { \
398 ERRORF(reporter, "Function ptr for vk%s could not be acquired\n", #name); \
403class VulkanTestHelper :
public BaseTestHelper {
405 VulkanTestHelper() {}
407 ~VulkanTestHelper()
override {}
409 void releaseImage()
override {
414 fVkDestroyImage(fDevice, fImage,
nullptr);
419 fVkFreeMemory(fDevice, fMemory,
nullptr);
427 fDirectContext->flush(
surface, {}, &newState);
430 void cleanup()
override {
431 fDirectContext.reset();
432 this->releaseImage();
434 fVkDestroySemaphore(fDevice, fSignalSemaphore,
nullptr);
437 fBackendContext.fMemoryAllocator.reset();
439 fVkDeviceWaitIdle(fDevice);
440 fVkDestroyDevice(fDevice,
nullptr);
443#ifdef SK_ENABLE_VK_LAYERS
445 fDestroyDebugCallback(fBackendContext.fInstance, fDebugCallback,
nullptr);
449 fVkDestroyInstance(fBackendContext.fInstance,
nullptr);
455 sk_gpu_test::FreeVulkanFeaturesStructs(fFeatures);
461 void doClientSync()
override {
462 if (!fDirectContext) {
481 GrDirectContext* directContext()
override {
return fDirectContext.get(); }
492 DECLARE_VK_PROC(DestroyInstance);
493 DECLARE_VK_PROC(DeviceWaitIdle);
494 DECLARE_VK_PROC(DestroyDevice);
496 DECLARE_VK_PROC(GetPhysicalDeviceExternalSemaphoreProperties);
497 DECLARE_VK_PROC(GetPhysicalDeviceImageFormatProperties2);
498 DECLARE_VK_PROC(GetPhysicalDeviceMemoryProperties2);
500 DECLARE_VK_PROC(GetAndroidHardwareBufferPropertiesANDROID);
502 DECLARE_VK_PROC(CreateImage);
503 DECLARE_VK_PROC(GetImageMemoryRequirements2);
504 DECLARE_VK_PROC(DestroyImage);
506 DECLARE_VK_PROC(AllocateMemory);
507 DECLARE_VK_PROC(BindImageMemory2);
508 DECLARE_VK_PROC(FreeMemory);
510 DECLARE_VK_PROC(CreateSemaphore);
511 DECLARE_VK_PROC(GetSemaphoreFdKHR);
512 DECLARE_VK_PROC(ImportSemaphoreFdKHR);
513 DECLARE_VK_PROC(DestroySemaphore);
534 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
542 fFeatures->pNext =
nullptr;
547 if (!sk_gpu_test::CreateVkBackendContext(instProc, &fBackendContext, fExtensions,
548 fFeatures, &fDebugCallback)) {
551 fDevice = fBackendContext.fDevice;
552 auto getProc = fBackendContext.fGetProc;
556 fBackendContext.fInstance,
"vkDestroyDebugReportCallbackEXT");
581 ACQUIRE_DEVICE_VK_PROC(GetAndroidHardwareBufferPropertiesANDROID);
583 ACQUIRE_DEVICE_VK_PROC(CreateImage);
584 ACQUIRE_DEVICE_VK_PROC(GetImageMemoryRequirements2);
585 ACQUIRE_DEVICE_VK_PROC(DestroyImage);
587 ACQUIRE_DEVICE_VK_PROC(AllocateMemory);
588 ACQUIRE_DEVICE_VK_PROC(BindImageMemory2);
589 ACQUIRE_DEVICE_VK_PROC(FreeMemory);
591 ACQUIRE_DEVICE_VK_PROC(CreateSemaphore);
592 ACQUIRE_DEVICE_VK_PROC(GetSemaphoreFdKHR);
593 ACQUIRE_DEVICE_VK_PROC(ImportSemaphoreFdKHR);
594 ACQUIRE_DEVICE_VK_PROC(DestroySemaphore);
598 if (!fDirectContext) {
602 return this->checkOptimalHardwareBuffer(
reporter);
609 externalImageFormatInfo.
sType =
611 externalImageFormatInfo.
pNext =
nullptr;
622 imageFormatInfo.
pNext = &externalImageFormatInfo;
626 imageFormatInfo.
usage = usageFlags;
627 imageFormatInfo.
flags = 0;
631 hwbUsage.
pNext =
nullptr;
635 externalImgFormatProps.
pNext = &hwbUsage;
639 imgFormProps.
pNext = &externalImgFormatProps;
641 err = fVkGetPhysicalDeviceImageFormatProperties2(fBackendContext.fPhysicalDevice,
642 &imageFormatInfo, &imgFormProps);
644 ERRORF(
reporter,
"vkGetPhysicalDeviceImageFormatProperites failed, err: %d", err);
673 hwbFormatProps.
pNext =
nullptr;
677 hwbProps.
pNext = &hwbFormatProps;
679 err = fVkGetAndroidHardwareBufferPropertiesANDROID(fDevice,
buffer, &hwbProps);
681 ERRORF(
reporter,
"GetAndroidHardwareBufferPropertiesAndroid failed, err: %d", err);
718 &externalMemoryImageInfo,
734 err = fVkCreateImage(fDevice, &imageCreateInfo,
nullptr, &fImage);
742 phyDevMemProps.
pNext =
nullptr;
744 uint32_t typeIndex = 0;
745 uint32_t heapIndex = 0;
746 bool foundHeap =
false;
747 fVkGetPhysicalDeviceMemoryProperties2(fBackendContext.fPhysicalDevice, &phyDevMemProps);
749 for (uint32_t i = 0; i < memTypeCnt && !foundHeap; ++i) {
770 ERRORF(
reporter,
"Failed to find valid heap for imported memory");
776 hwbImportInfo.
pNext =
nullptr;
781 dedicatedAllocInfo.
pNext = &hwbImportInfo;
782 dedicatedAllocInfo.
image = fImage;
792 err = fVkAllocateMemory(fDevice, &allocInfo,
nullptr, &fMemory);
794 ERRORF(
reporter,
"AllocateMemory failed for imported buffer, err: %d", err);
800 bindImageInfo.
pNext =
nullptr;
801 bindImageInfo.
image = fImage;
802 bindImageInfo.
memory = fMemory;
805 err = fVkBindImageMemory2(fDevice, 1, &bindImageInfo);
807 ERRORF(
reporter,
"BindImageMemory failed for imported buffer, err: %d", err);
817 outImageInfo->
fImage = fImage;
818 outImageInfo->
fAlloc = alloc;
831 if (!this->importHardwareBuffer(
reporter,
buffer,
false, &imageInfo)) {
844 if (!wrappedImage.
get()) {
854 this->releaseSurfaceToExternal(
surface.get());
857 if (!this->setupSemaphoreForSignaling(
reporter, &semaphore)) {
862 info.fSignalSemaphores = &semaphore;
864 fDirectContext->submit();
870 if (!this->exportSemaphore(
reporter, semaphore)) {
881 exSemInfo.
pNext =
nullptr;
886 exSemProps.
pNext =
nullptr;
888 fVkGetPhysicalDeviceExternalSemaphoreProperties(fBackendContext.fPhysicalDevice, &exSemInfo,
893 ERRORF(
reporter,
"HANDLE_TYPE_SYNC_FD not listed as exportFromImportedHandleTypes");
898 ERRORF(
reporter,
"HANDLE_TYPE_SYNC_FD not listed as compatibleHandleTypes");
905 ERRORF(
reporter,
"HANDLE_TYPE_SYNC_FD doesn't support export and import feature");
911 exportInfo.
pNext =
nullptr;
916 semaphoreInfo.
pNext = &exportInfo;
917 semaphoreInfo.
flags = 0;
919 VkSemaphore semaphore;
920 VkResult err = fVkCreateSemaphore(fDevice, &semaphoreInfo,
nullptr, &semaphore);
922 ERRORF(
reporter,
"Failed to create signal semaphore, err: %d", err);
939 getFdInfo.
pNext =
nullptr;
943 VkResult err = fVkGetSemaphoreFdKHR(fDevice, &getFdInfo, &fFdHandle);
945 ERRORF(
reporter,
"Failed to export signal semaphore, err: %d", err);
948 fSignalSemaphore = semaphore;
956 semaphoreInfo.
pNext =
nullptr;
957 semaphoreInfo.
flags = 0;
959 VkSemaphore semaphore;
960 VkResult err = fVkCreateSemaphore(fDevice, &semaphoreInfo,
nullptr, &semaphore);
962 ERRORF(
reporter,
"Failed to create import semaphore, err: %d", err);
968 importInfo.
pNext =
nullptr;
972 importInfo.
fd = fdHandle;
974 err = fVkImportSemaphoreFdKHR(fDevice, &importInfo);
981 if (!
surface->wait(1, &beSemaphore)) {
983 fVkDestroySemaphore(fDevice, semaphore,
nullptr);
992 if (!this->importHardwareBuffer(
reporter,
buffer,
true, &imageInfo)) {
1023 switch ((
x+
y) % 5) {
1048 intptr_t pixels =
reinterpret_cast<intptr_t
>(bmp.
getPixels());
1065 const uint32_t srcPixel = *srcBitmap.
getAddr32(
x,
y);
1066 const uint32_t dstPixel = *dstBitmap.
getAddr32(
x,
y);
1067 if (srcPixel != dstPixel) {
1068 ERRORF(
reporter,
"Expected readback pixel (%d, %d) value 0x%08x, got 0x%08x.",
1069 x,
y, srcPixel, dstPixel);
1081static void cleanup_resources(BaseTestHelper* srcHelper, BaseTestHelper* dstHelper,
1084 srcHelper->cleanup();
1087 dstHelper->cleanup();
1090 AHardwareBuffer_release(
buffer);
1106 SrcType srcType, DstType dstType,
bool shareSyncs) {
1107 if (SrcType::kCPU == srcType && shareSyncs) {
1111 std::unique_ptr<BaseTestHelper> srcHelper;
1112 std::unique_ptr<BaseTestHelper> dstHelper;
1114 if (SrcType::kVulkan == srcType) {
1115 srcHelper.reset(
new VulkanTestHelper());
1116 }
else if (SrcType::kEGL == srcType) {
1118 srcHelper.reset(
new EGLTestHelper(
options));
1120 SkASSERTF(
false,
"SrcType::kEGL used without OpenGL support.");
1125 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1130 if (DstType::kVulkan == dstType) {
1131 dstHelper.reset(
new VulkanTestHelper());
1134 SkASSERT(DstType::kEGL == dstType);
1135 dstHelper.reset(
new EGLTestHelper(
options));
1137 SkASSERTF(
false,
"DstType::kEGL used without OpenGL support.");
1142 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1151 SkBitmap srcBitmap = make_src_bitmap();
1161 AHardwareBuffer_Desc hwbDesc;
1162 hwbDesc.width =
DEV_W;
1163 hwbDesc.height =
DEV_H;
1165 if (SrcType::kCPU == srcType) {
1166 hwbDesc.usage = AHARDWAREBUFFER_USAGE_CPU_READ_NEVER |
1167 AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN |
1168 AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
1170 hwbDesc.usage = AHARDWAREBUFFER_USAGE_CPU_READ_NEVER |
1171 AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER |
1172 AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
1173 AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT;
1175 hwbDesc.format = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
1181 if (
int error = AHardwareBuffer_allocate(&hwbDesc, &
buffer)) {
1183 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1187 if (SrcType::kCPU == srcType) {
1189 AHardwareBuffer_describe(
buffer, &hwbDesc);
1191 uint32_t* bufferAddr;
1192 if (AHardwareBuffer_lock(
buffer, AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN, -1,
nullptr,
1193 reinterpret_cast<void**
>(&bufferAddr))) {
1195 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1201 uint32_t*
dst = bufferAddr;
1203 memcpy(dst, src,
DEV_W * bbp);
1205 dst += hwbDesc.stride;
1210 const uint32_t srcPixel = *srcBitmap.
getAddr32(
x,
y);
1211 uint32_t dstPixel = bufferAddr[
y * hwbDesc.stride +
x];
1212 if (srcPixel != dstPixel) {
1213 ERRORF(
reporter,
"CPU HWB Expected readpix (%d, %d) value 0x%08x, got 0x%08x.",
1214 x,
y, srcPixel, dstPixel);
1219 AHardwareBuffer_unlock(
buffer,
nullptr);
1222 srcHelper->makeCurrent();
1226 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1231 surface->getCanvas()->drawImage(srcBmpImage, 0, 0);
1236 bool readResult =
surface->readPixels(dstBitmapSurface, 0, 0);
1240 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1251 if (!srcHelper->flushSurfaceAndSignalSemaphore(
reporter, std::move(
surface))) {
1252 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1256 srcHelper->releaseSurfaceToExternal(
surface.get());
1257 srcHelper->doClientSync();
1259 srcHelper->releaseImage();
1267 dstHelper->makeCurrent();
1270 if (!wrappedImage) {
1271 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1275 auto direct = dstHelper->directContext();
1283 if (!dstSurf.
get()) {
1285 wrappedImage.
reset();
1286 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1291 if (!dstHelper->importAndWaitOnSemaphore(
reporter, srcHelper->getFdHandle(), dstSurf)) {
1292 wrappedImage.
reset();
1293 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1297 dstSurf->getCanvas()->drawImage(wrappedImage, 0, 0);
1299 bool readResult = dstSurf->readPixels(dstBitmapFinal, 0, 0);
1302 wrappedImage.
reset();
1304 dstHelper->doClientSync();
1305 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
1312 wrappedImage.
reset();
1313 dstHelper->doClientSync();
1314 cleanup_resources(srcHelper.get(), dstHelper.get(),
buffer);
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 reset(T *ptr=nullptr)
static const uint8_t buffer[]
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 GrVkBackendContext &, 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_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)
SK_API MutableTextureState MakeVulkan(VkImageLayout layout, uint32_t queueFamilyIndex)
SK_API void FlushAndSubmit(sk_sp< SkSurface >)
void run_test(skiatest::Reporter *reporter, Context *context, SkISize surfaceSize, SkISize recordingSize, SkISize replayOffset, DrawCallback draw, const std::vector< Expectation > &expectations)
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
@ 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