diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-08-18 19:26:45 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-08-24 12:52:39 +0200 |
commit | ddcdc2077fab2b6d9c4def4e4615185411cbe80a (patch) | |
tree | b5a6ae5cc158def6c52e02f9448ee3ec1fac6c37 /external | |
parent | 4efd9f8a4bebe88841b5c3e27d2f7ef3ff10a8d0 (diff) |
build Skia with Metal support
Change-Id: I7a9abde4101164af8c47433acfa35f4f9d3b3d04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120907
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/skia/Library_skia.mk | 65 | ||||
-rw-r--r-- | external/skia/make-api-visible.patch.1 | 13 | ||||
-rw-r--r-- | external/skia/swap-buffers-rect.patch.1 | 26 |
3 files changed, 96 insertions, 8 deletions
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk index 517b5585496e..65006ca5db61 100644 --- a/external/skia/Library_skia.mk +++ b/external/skia/Library_skia.mk @@ -63,6 +63,8 @@ else ifeq ($(OS),MACOSX) $(eval $(call gb_Library_use_system_darwin_frameworks,skia,\ Cocoa \ + Metal \ + QuartzCore \ )) ifneq ($(SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX),) @@ -527,6 +529,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/src/xps/SkXPSDocument \ )) +ifneq ($(SKIA_GPU),) $(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/src/core/SkGpuBlurUtils \ UnpackedTarball/skia/src/gpu/ccpr/GrCCAtlas \ @@ -791,6 +794,10 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/src/image/SkImage_Gpu \ UnpackedTarball/skia/src/image/SkImage_GpuYUVA \ UnpackedTarball/skia/src/image/SkSurface_Gpu \ +)) + +#ifeq ($(SKIA_GPU),VULKAN) +$(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/src/gpu/vk/GrVkAMDMemoryAllocator \ UnpackedTarball/skia/src/gpu/vk/GrVkAttachment \ UnpackedTarball/skia/src/gpu/vk/GrVkBuffer \ @@ -830,6 +837,15 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ )) $(eval $(call gb_Library_add_generated_exception_objects,skia,\ + UnpackedTarball/skia/tools/gpu/vk/VkTestUtils \ + UnpackedTarball/skia/tools/sk_app/VulkanWindowContext \ + UnpackedTarball/skia/third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator \ +)) + +#endif +endif + +$(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/src/ports/SkGlobalInitialization_default \ UnpackedTarball/skia/src/ports/SkImageGenerator_none \ UnpackedTarball/skia/src/ports/SkOSFile_stdio \ @@ -861,8 +877,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ )) $(eval $(call gb_Library_add_generated_exception_objects,skia,\ - UnpackedTarball/skia/tools/gpu/vk/VkTestUtils \ - UnpackedTarball/skia/tools/sk_app/VulkanWindowContext \ UnpackedTarball/skia/tools/sk_app/WindowContext \ )) @@ -887,8 +901,13 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/tools/sk_app/win/RasterWindowContext_win \ +)) + +#ifeq ($(SKIA_GPU),VULKAN) +$(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/tools/sk_app/win/VulkanWindowContext_win \ )) +#endif else ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_generated_exception_objects,skia,\ @@ -905,10 +924,39 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/src/utils/mac/SkCreateCGImageRef \ )) +ifeq ($(SKIA_GPU),METAL) +$(eval $(call gb_Library_add_generated_objcxxobjects,skia,\ + UnpackedTarball/skia/tools/sk_app/MetalWindowContext \ + UnpackedTarball/skia/tools/sk_app/mac/MetalWindowContext_mac \ +)) + # Not used, uses OpenGL - UnpackedTarball/skia/tools/sk_app/mac/RasterWindowContext_mac -# UnpackedTarball/skia/tools/sk_app/mac/VulkanWindowContext_mac \ -# UnpackedTarball/skia/tools/sk_app/mac/MetalWindowContext_mac \ +$(eval $(call gb_Library_add_generated_objcxxobjects,skia,\ + UnpackedTarball/skia/src/gpu/mtl/GrMtlAttachment \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlBuffer \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlCaps \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlCommandBuffer \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlDepthStencil \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlGpu \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlOpsRenderPass \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlPipelineState \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlPipelineStateBuilder \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlPipelineStateDataManager \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlRenderTarget \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlResourceProvider \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlSampler \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlSemaphore \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlTexture \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlTextureRenderTarget \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlTrampoline \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlUniformHandler \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlUtil \ + UnpackedTarball/skia/src/gpu/mtl/GrMtlVaryingHandler \ + UnpackedTarball/skia/src/image/SkSurface_GpuMtl \ + , -fobjc-arc \ +)) +endif else $(eval $(call gb_Library_add_generated_exception_objects,skia,\ @@ -927,13 +975,14 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ $(eval $(call gb_Library_add_generated_exception_objects,skia,\ UnpackedTarball/skia/tools/sk_app/unix/RasterWindowContext_unix \ - UnpackedTarball/skia/tools/sk_app/unix/VulkanWindowContext_unix \ )) -endif - +#ifeq ($(SKIA_GPU),VULKAN) $(eval $(call gb_Library_add_generated_exception_objects,skia,\ - UnpackedTarball/skia/third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator \ + UnpackedTarball/skia/tools/sk_app/unix/VulkanWindowContext_unix \ )) +#endif + +endif # Skcms code is used by png writer, which is used by SkiaHelper::dump(). Building # this without optimizations would mean having each pixel of saved images be diff --git a/external/skia/make-api-visible.patch.1 b/external/skia/make-api-visible.patch.1 index 822313006dc6..6dbaf82b13bd 100644 --- a/external/skia/make-api-visible.patch.1 +++ b/external/skia/make-api-visible.patch.1 @@ -65,3 +65,16 @@ index c05a4f0acf..fc27cd2afb 100644 } // namespace window_context_factory +diff --git a/tools/sk_app/mac/WindowContextFactory_mac.h b/tools/sk_app/mac/WindowContextFactory_mac.h +index acf860ae4b..cdb2ee8027 100644 +--- a/tools/sk_app/mac/WindowContextFactory_mac.h ++++ b/tools/sk_app/mac/WindowContextFactory_mac.h +@@ -48,7 +48,7 @@ std::unique_ptr<WindowContext> MakeDawnMTLForMac(const MacWindowInfo&, const Dis + + std::unique_ptr<WindowContext> MakeRasterForMac(const MacWindowInfo&, const DisplayParams&); + #ifdef SK_METAL +-std::unique_ptr<WindowContext> MakeMetalForMac(const MacWindowInfo&, const DisplayParams&); ++SK_API std::unique_ptr<WindowContext> MakeMetalForMac(const MacWindowInfo&, const DisplayParams&); + #endif + + } // namespace window_context_factory diff --git a/external/skia/swap-buffers-rect.patch.1 b/external/skia/swap-buffers-rect.patch.1 index 7673a358ebc4..a6e6fd4904a7 100644 --- a/external/skia/swap-buffers-rect.patch.1 +++ b/external/skia/swap-buffers-rect.patch.1 @@ -11,6 +11,32 @@ index c519903006..5dc5bcd180 100644 void setDisplayParams(const DisplayParams& params) override; +diff --git a/tools/sk_app/MetalWindowContext.h b/tools/sk_app/MetalWindowContext.h +index e8c8392a15..0d8fd1df6e 100644 +--- a/tools/sk_app/MetalWindowContext.h ++++ b/tools/sk_app/MetalWindowContext.h +@@ -24,7 +24,7 @@ public: + + bool isValid() override { return fValid; } + +- void swapBuffers() override; ++ void swapBuffers(const SkIRect* rect = nullptr) override; + + void setDisplayParams(const DisplayParams& params) override; + +diff --git a/tools/sk_app/MetalWindowContext.mm b/tools/sk_app/MetalWindowContext.mm +index 5b623811ed..bae6b24138 100644 +--- a/tools/sk_app/MetalWindowContext.mm ++++ b/tools/sk_app/MetalWindowContext.mm +@@ -152,7 +152,7 @@ GrBackendRenderTarget backendRT(fWidth, + return surface; + } + +-void MetalWindowContext::swapBuffers() { ++void MetalWindowContext::swapBuffers(const SkIRect*) { + id<CAMetalDrawable> currentDrawable = (id<CAMetalDrawable>)fDrawableHandle; + + id<MTLCommandBuffer> commandBuffer([*fQueue commandBuffer]); diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp index 2b36d60076..d73978c9e4 100644 --- a/tools/sk_app/VulkanWindowContext.cpp |