From 308b7d99337bdf894ba814d5267f676b8cf3e14a Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Mon, 7 Nov 2016 10:24:27 -0500 Subject: [PATCH] update Vulkan docs for GN. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4458 NOTRY=true DOCS_PREVIEW= https://skia.org/?cl=4458 Change-Id: Ifb21b28440b5725775b40e79aef2a0286e1de103 Reviewed-on: https://skia-review.googlesource.com/4458 Reviewed-by: Greg Daniel Commit-Queue: Mike Klein --- site/user/special/vulkan.md | 58 ++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/site/user/special/vulkan.md b/site/user/special/vulkan.md index 6c1e4ac..8dfd26a 100644 --- a/site/user/special/vulkan.md +++ b/site/user/special/vulkan.md @@ -1,25 +1,22 @@ Vulkan ====== -Skis has a Vulkan implementation of its GPU backend. The Vulkan backend can be built alongside the OpenGL backend. The client can select between the OpenGL and Vulkan implementation at runtime. The Vulkan backend has reached feature parity with the OpenGL backend. At this time we find that many Vulkan drivers have bugs that Skia triggers for which we have no workaround. We are reporting bugs to vendors as we find them. - -Build for Windows and Linux ---------------------------- -To build the Vulkan backend add skia_vulkan=1 to your GYP_DEFINES and rerun gyp_skia. For example: - - - export GYP_DEFINES="$GYP_DEFINES skia_vulkan=1" - python ./gyp_skia - -The Vulkan SDK must be installed and the VULKAN_SDK environment variable must point to the installation location. The Windows installer will set the environment variable. However, on Linux it must be set after installation. - -Build as usual for your platform. - - -Build for Android +Skis has a Vulkan implementation of its GPU backend. The Vulkan backend can be +built alongside the OpenGL backend. The client can select between the OpenGL +and Vulkan implementation at runtime. The Vulkan backend has reached feature +parity with the OpenGL backend. At this time we find that many Vulkan drivers +have bugs that Skia triggers for which we have no workaround. We are reporting +bugs to vendors as we find them. + +Windows and Linux ----------------- -The Vulkan backend will run on a device running the N release with Vulkan drivers. To build the Vulkan backend simply add --vulkan to the flags passed to ./platform_tools/android/bin/android_ninja +To build the Vulkan backend, set `skia_vulkan_sdk` to the path to your Vulkan SDK in `args.gn`. +This defaults to the environment variable `VULKAN_SDK`. +Android +------- +The Vulkan backend can run on any device with Vulkan drivers, including all Android N+ devices. +To build the Vulkan backend, set `ndk_api = 24` in `args.gn` to target Android N. Using the Vulkan Backend ------------------------ @@ -33,12 +30,25 @@ To create a GrContext that is backed by Vulkan the client creates a Vulkan devic ... vkBackendContext.fInterface.reset(GrVkCreateInterface(instance, vkPhysDevice, extensionFlags); ... - - sk_sp context = GrContext::Create(kVulkan_GrBackend, (GrBackendContext) vkBackendContext); -When using the Vulkan backend the GrBackendObject field in GrBackendRenderTargetDesc and GrBackendTextureDesc is interpeted as a pointer to a GrVkImageInfo object. GrVkImageInfo specifies a VkImage and associated state (tiling, layout, format, etc). This allows the client to import externally created Vulkan images as destinations for Skia rendering via SkSurface factory functions or for to composite Skia rendered content using SkImage::getTextureHandle(). - -After getting a GrVkImageInfo* via getTextureHandle() or getRenderTargetHandle(), the client should check the fImageLayout field to know what layout Skia left the VkImage in before using the VkImage. If the client changes the layout of the VkImage, GrVkImageInfo::updateImageLayout(VkImageLayout layout) should be called before resuming Skia rendering. + sk_sp context = GrContext::Create(kVulkan_GrBackend, (GrBackendContext) vkBackendContext); -The client is responsible for any synchronization or barriers needed before Skia performs I/O on a VkImage imported into Skia via GrVkImageInfo. -Skia will assume it can start issuing commands referencing the VkImage without the need for additional synchronization. +When using the Vulkan backend the GrBackendObject field in +GrBackendRenderTargetDesc and GrBackendTextureDesc is interpeted as a pointer +to a GrVkImageInfo object. GrVkImageInfo specifies a VkImage and associated +state (tiling, layout, format, etc). This allows the client to import +externally created Vulkan images as destinations for Skia rendering via +SkSurface factory functions or for to composite Skia rendered content using +SkImage::getTextureHandle(). + +After getting a GrVkImageInfo* via getTextureHandle() or +getRenderTargetHandle(), the client should check the fImageLayout field to know +what layout Skia left the VkImage in before using the VkImage. If the client +changes the layout of the VkImage, +GrVkImageInfo::updateImageLayout(VkImageLayout layout) should be called before +resuming Skia rendering. + +The client is responsible for any synchronization or barriers needed before +Skia performs I/O on a VkImage imported into Skia via GrVkImageInfo. Skia will +assume it can start issuing commands referencing the VkImage without the need +for additional synchronization. -- 2.7.4