OLD | NEW |
---|---|
1 Building the Vulkan backend | 1 Vulkan |
2 =========================== | 2 ====== |
3 | 3 |
4 Introduction | 4 Skis has a Vulkan implementation of its GPU backend. The Vulkan backend can be b uilt 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 ve ndors as we find them. |
5 ------------ | |
6 | 5 |
7 The Vulkan backend is experimental and not built by default. It currently replac es the 'gpu' config in the dm tool rather than running in addition to OpenGL. Vu lkan has been built on Windows and Linux. | 6 Build for Windows and Linux |
7 -------------------------------- | |
8 To build the Vulkan backend add skia_vulkan to your GYP_DEFINES: | |
8 | 9 |
9 Details | 10 <!--?prettify lang=sh?--> |
10 ------- | 11 export GYP_DEFINES="$GYP_DEFINES skia_vulkan=1" |
jvanverth1
2016/09/06 14:09:00
Don't we need skia_arch_width=64 skia_arch_type=x8
bsalomon
2016/09/06 14:27:47
Do we only support vulkan for 64bit builds?
| |
11 | 12 |
12 Add `skia_vulkan=1` to your `GYP_DEFINES` environment variable. Ensure cmake is installed and in your path. On Windows install the prebuilt cmake from https://c make.org/download/. The Vulkan SDK must also be installed. | 13 The Vulkan SDK must be installed and the VULKAN_SDK environment variable must po int to the installation location. |
egdaniel
2016/09/06 14:07:38
Not sure if its worth saying, but windows will set
bsalomon
2016/09/06 14:27:47
I'll add something about windows setting it up aut
| |
13 | 14 |
14 On Windows the 'msvs' gyp generator will not work. Use msvs-ninja for MSVS integ ration. | 15 Build as usual for your platform. |
15 | 16 |
16 Run: | |
17 | 17 |
18 python gyp_skia | 18 Build for Android |
19 ---------------------- | |
20 The Vulkan backend will run on a device running the N release with Vulkan driver s. To build the Vulkan backend simply add --vulkan to the flags passed to ./plat form_tools/android/bin/android_ninja | |
19 | 21 |
20 and build Skia as usual. | 22 |
23 Using the Vulkan Backend | |
24 ------------------------ | |
25 | |
26 To create a GrContext that is backend by Vulkan the client creates a Vulkan devi ce and queue, initializes a GrVkBackendContext to describe the context, and then calls GrContext::Create: | |
jvanverth1
2016/09/06 14:09:00
backend -> backed
bsalomon
2016/09/06 14:27:47
Done.
| |
27 | |
28 <!--?prettify lang=c++?--> | |
29 sk_sp<GrVkBackendContext> vkContext = new GrVkBackendContext; | |
30 vkBackendContext.fInstance = vkInstance; | |
31 vkBackendContext.fPhysicalDevice = vkPhysDevice; | |
32 ... | |
33 vkBackendContext.fInteface.reset(GrVkCreateInterface(instance, vkPhysDevice, extensionFlags); | |
bsalomon
2016/09/06 13:52:42
Should/do we require the client to create this GrV
egdaniel
2016/09/06 14:07:38
I guess it is left like this so that it could be u
jvanverth1
2016/09/06 14:09:00
fInterface.reset(). And I'm not sure on the need f
bsalomon
2016/09/06 14:27:47
Fixed the spelling. I see Greg's point about custo
jvanverth1
2016/09/06 14:32:53
The client is filling in the rest of the struct --
bsalomon
2016/09/06 16:01:52
I was thinking we'd store a GrVkInterface pointer
| |
34 ... | |
35 | |
36 sk_sp<GrContext> context = GrContext::Create(kVulkan_GrBackend, (GrBackendCo ntext) vkContext); | |
37 | |
38 When using the Vulkan backend the GrBackendObject field in GrBackendRenderTarget Desc and GrBackendTextureDesc is interpeted as a pointer to a GrVkImageInfo obje ct. GrVkImage specifies a VkImage and associated state (tiling, layout, format, etc). This allows the client to import externally created Vulkan images as desti nations for Skia rendering via SkSurface factory functions or for to composite S kia rendered content using SkImage::getTextureHandle(). | |
egdaniel
2016/09/06 14:07:38
GrVkImageInfo
jvanverth1
2016/09/06 14:09:00
GrVkImageInfo specifies a VkImage [...]
bsalomon
2016/09/06 14:27:47
Done.
| |
39 | |
egdaniel
2016/09/06 14:07:39
Should we add the following to the doc or just lea
egdaniel
2016/09/06 14:21:57
Also should we add something along the lines of, "
bsalomon
2016/09/06 14:27:47
Done.
| |
OLD | NEW |