转一篇关于Vulkan的介绍性文章。

Vulkan据说标准快要出来了;根据目前笔者了解,其实很多很AMD mantle很像。等正式发布后,笔者准备再写一系列文章研究新标准。毕竟这个才是未来的方向!

另外这个网站有很多SIGGRAPH2015上关于Vulkan的文档: http://nextgenapis.realtimerendering.com/

特别是AMD大牛GrahamSellers的PPT:  A Whirlwind Tour of Vulkan

A Brief Overview Of Vulkan API

So, what’s the big deal with this new Vulkan API anyway, and why should we care?

Here’s the Vulkan API in a hundred words or less: It’s a low-overhead, close-to-metal API for 3D graphics and compute applications. Vulkan is basically a follow-on to OpenGL. It was originally referred to as the “next generation OpenGL initiative,” and it includes a few bits and pieces from AMD’s Mantle API. Vulkan is supposed to provide numerous advantages over other GPU APIs, enabling superior cross-platform support, better support for multithreaded processors, lower CPU load, and a pinch of OS agnosticism. It should also make driver development easier, and allow the pre-compilation of drivers, including the use of shaders written in various languages.

Meet the new Vulkan API: Live Long And Render!

Meet the new Vulkan API: Live Long And Render!
Tweet

That’s 93 words, so if you’re not interested, you can skip the next 3,500. If, on the other hand, you want to know more about the upcoming graphics API that will be with us for years to come, I’ll get started on the basics.

How Vulkan API Came Into Being

Vulkan was originally announced by the Khronos Group in March 2015, with a tentative launch date set for late 2015. In case you are not familiar with Khronos, it’s a non-profit industry consortium founded fifteen years ago by some of the biggest names in the graphics industry, including ATI (now a part of AMD), Nvidia, Intel, Silicon Graphics, Discrete, and Sun Microsystems. Even if you haven’t heard of Khronos, you’ve probably heard of some of their standards, such as: OpenGL, OpenGL ES, WebGL, OpenCL, SPIR, SYCL, WebCL, OpenVX, EGL, OpenMAX, OpenVG, OpenSL ES, StreamInput, COLLADA, and glTF.

By now, you’re probably thinking “Ah, it’s those guys,” so I can skip the rest of the intro and focus on the API itself.

Unlike its predecessor, or predecessors, Vulkan is designed from the ground up to run on diverse platforms, ranging from mobiles and tablets, to gaming consoles and high-end desktops. The underlying design of the API is layered, or should we say modular, so it enables the creation of a common, yet extensible architecture for code validation, debugging, and profiling, without impacting performance. Krhonos claims the layered approach will deliver a lot more flexibility, catalyse strong innovation in cross-vendor GPU tools, and provide more direct GPU control demanded by sophisticated game engines.

Now, I understand that a lot of technophiles have their reservations about marketing terms like “flexible,” “extensible,” and “modular,” but this time around we are dealing with the real McCoy. As a matter of fact, that’s the basic idea behind Vulkan: It’s envisioned as an API for the masses, from kids gaming on smartphones, to their parents designing buildings and games on workstations.

In theory, Vulkan could be used in parallel computing hardware, to control tens of billions of GPU cores, in tiny wearables and toy drones, in 3D printers, cars, VR kit, and just about anything else with a compatible GPU inside.

For more details, I suggest you take a look at the official Vulkan overview in PDF.

AMD Mantle DNA

If the close-to-metal approach sounds eerily familiar, you may have been following AMD’s GPU announcements over the past two years or so. AMD surprised industry observers when it announced its Mantle API in 2013, and it surprised them once again when it decided to pull the plug on the API, announcing in March 2015 that it would not release Mantle 1.0 as a public SDK. In a nutshell, Mantle promised to deliver significant performance and efficiency improvements in some situations, especially on the CPU front since it would reduce processing overhead. It sounded like a good idea, as gamers could put together custom PCs with somewhat slower processors and invest more money in top notch graphics cards. It sounded very convenient for AMD, too, because the company hasn’t had a competitive high-end CPU in years, although it still has good GPU products.

As weeping AMD fanboys gathered to mourn the passing of their saviour, Mantle was miraculously resurrected. The good news came in the form of a blog post, penned by AMD VP of Visual and Perceptual Computing, Raja Koduri. Coincidentally, in keeping with the religious theme, on one occasion Koduri held a sermon on a mount, during AMD’s Hawaii launch event in 2013, but I digress.

Joking aside, Koduri’s team did a good job. While Mantle didn’t become a new industry standard, it did become a foundation for Vulkan. The biggest difference is that Vulkan will not be restricted to AMD GCN hardware; it will work on a lot more GPUs from different vendors. You can probably see where I am going with this; it’s a bit better to have a single low-overhead graphics API that works on different operating systems and hardware platforms than to have proprietary APIs for different GPU architectures, OSes and so on.

It sounds like a pun, but AMD's Mantle is actually at the core of the new Vulkan API.

It sounds like a pun, but AMD's Mantle is actually at the core of the new Vulkan API.
Tweet

Vulkan API simply takes a good chunk of the Mantle pie and shares it with everyone, regardless of OS, hardware, race or religion.

Oh, and there’s one more thing: Mantle eventually forced Microsoft and Khronos finally to do something about DirectX and OpenGL bloat and inefficiency. It was a gentle, friendly kick in the posterior, or “badonkadonk,” as one fellow Toptaler likes to put it.

How Does Vulkan Compare To OpenGL?

Obviously, I need to outline the basic differences between Vulkan and OpenGL. Khronos came up with a simple illustration, showing how much driver bloat could be eliminated with the new API.

Vulkan is a unified API for all platforms, and it enables simpler drivers as well.

Vulkan is a unified API for all platforms, and it enables simpler drivers as well.
Tweet

Vulkan allows applications to get closer to metal, thus eliminating the need for a lot of memory and error management, as well as a lot of shading language source. Drivers will be lighter, leaner and meaner. Vulkan will only rely on the SPIR-V intermediate language, and since it has a unified API for mobile, desktop and console markets, it should also get more tender, loving care from developers.

But wait, doesn’t this simply offload more work to game developers? Sure, they will be able to use hardware more efficiently, but what about their own man-hours? This is where the layered ecosystem approach enters the fray.

Developers will be able to choose three different levels, or tiers, of the Vulkan ecosystem.

  • Use Vulkan directly for maximum flexibility and control.
  • Use Vulkan libraries and layers to speed up development.
  • Use Vulkan via off-the-shelf game engines fully optimised over the new API.

The first option clearly won’t be for everyone, but I suspect it would make for some nice benchmarking software. Khronos expects the second option to be a “rich area for innovation” because many utilities and layers will be in open source, and will ease transition from OpenGL. If a publisher has some OpenGL titles that need tweaking and updating, this is what they would use.

The last option is, perhaps, the most tempting one because the heavy lifting has been done by industry heavyweights such as Unity, Oxide, Blizzard, Epic, EA, Valve and others.

Here is a quick OpenGL vs. Vulkan table:

OpenGL Vulkan
Originally created for graphics workstations with direct renderers, split memory. A better match for modern platforms, including mobile platforms with unified memory and tiled rendering support.
Driver handles state validation, dependency tracking, error checking. This may limit and randomise performance. The application has direct and predictable control over the GPU via an explicit API.
Obsolete threading model does not allow generation of graphics commands in parallel to command execution. API designed for multi-core, multi-thread platforms. Multiple command buffers can be created in parallel.
API choices can be complex, syntax evolved over twenty years. Removal of legacy requirements simplifies API design, simplifies usage guidance, reduces specification size.
Shader language compiler is a part of the driver, and it only supports GLSL. The shader source has to be shipped. SPIR-V is the new compiler target, enabling front-end language flexibility and reliability.
Developers have to take into account implementation variability between vendors. Due to the simpler API and common language front-ends, more rigorous testing will increase cross-vendor compatibility.

To be honest, I don’t think it is even fair to compare the two. Vulkan is a Mantle derivative, while OpenGL is a mastodon with 20 years’ worth of baggage. Vulkan is supposed to ditch loads of legacy stuff; that’s the whole point. Vulkan is supposed to streamline testing and implementation, make drivers leaner, and improve shader program portability via the SPIR-V intermediate language.

This brings us to the next question. What does Vulkan really mean for developers?

SPIR-V Is Expected To Transform The Language Ecosystem

So where does SPIR-V come into play, and what happens to good old GLSL?

GSLS will stay alive for now, and it will be the first shading language supported by Vulkan. A GLSL to SPIR-V translator will do the heavy lifting, and voila!, you’ll get SPIR-V ready to feed the hungry Vulkan runtime. Game developers will be able to use SPIR-V and Vulkan back-ends, probably relying on open-sourced compiler front-ends. In addition to GLSL, Vulkan can support OpenCL C kernels, while work on adding support for C++ is progressing. Future domain-specific languages, frameworks and tools are another option. Khronos even mentions the possibility of developing new experimental languages.

The SPIR-V language is the glue that will bind different platforms in Vulkan API.

The SPIR-V language is the glue that will bind different platforms in Vulkan API.
Tweet

Whatever developers choose to do, all roads lead to Vulkan, via SPIR-V, and then to a multitude of different devices.

SPIR-V is supposed to improve portability in three ways:

  • Shared tools
  • Single tool set for a single ISV
  • Simplicity

Since there will be no need for every hardware platform to feature a high-level language translator, developers will deal with less of them.

An individual ISV can generate SPIR-V using a single tool set, thus eliminating portability issues of the high-level language.

SPIR-V is simpler than a typical high-level language, making implementation and processing easier.

Performance will be improved in a number of ways, depending on how Vulkan is implemented:

  • No more compiler front-end, a lot of processing can be done offline
  • Optimisation passes can settle faster, optimisations executed offline
  • Multiple source shaders reduce to the same intermediate language instruction stream

Khronos does not specify any performance numbers and notes that “mileage will definitely vary.” It will all depend on how Vulkan is used. If you want to check out the gritty details, be sure to check out the SPIR-V white paper.

Like what you're reading?
Get the latest updates first.

Vulkan Looks Promising From A Developer Perspective

I have outlined a number of features that should make Vulkan and SPIR-V popular in the dev community, and Khronos is keen to get this point across as well. The prospect of using the same tools and skills to develop for multiple platforms appears intriguing, especially now that the performance gap between various platforms is closing.

Of course, developing a big-budget AAA game for PCs will remain an extremely complex and time-consuming process, involving heaps of cash and human resources, but mobile platforms and integrated GPUs employed in the latest Intel and AMD processors already deliver a lot of GPU performance for the casual gamer. Besides, small, independent developers, or freelancers, are more likely to work on cross-platform casual games than AAA titles churned out by major publishers.

Khronos outlines the following advantages made possible by SPIR-V:

  • Developers can use the same front-end compiler across multiple platforms to eliminate cross-vendor portability issues
  • Runtime shader/kernel compilation time will be reduced since the driver only has to process SPIR-V
  • Developers do not have to distribute shader/kernel source code, so they enjoy an added level of IP protection
  • Drivers are simpler and more reliable since there is no need to include front-end compilers
  • Developers have a better picture of memory allocation and can tweak their memory allocation approach accordingly

I am sure you’ll agree that this sounds good, but there is still a long way to go.

Vulkan: It Works, But It’s A Work In Progress

As I said, Vulkan is still pretty much a work in progress, and we should have the full spec by the end of the year. However, from what we have seen so far, the new API can unlock a lot of performance even with current-generation hardware.

The best illustration of Vulkan I’ve seen so far comes from Imagination Technologies, one of the leading mobile GPU outfits out there. Imagination Technologies GPU IP is used in all iOS gadgets, along with numerous other ARM-based System-on-Chip designs, and even in some low-voltage Intel x86 chips.

Last week Imagination published a blog post detailing the performance gains made possible by Vulkan. Its choice of hardware was somewhat unusual: a Google Nexus Player, based on a rarely used Intel quad-core processor with PowerVR G6430 GPU. The device was tested with the latest Vulkan API driver for PowerVR GPUs, while the reference run was performed on OpenGL ES 3.0. The performance gap was nothing short of staggering.

Check out this Vulkan API demo: smooth gnomes vs. choppy gnomes

Check out this Vulkan API demo: smooth gnomes vs. choppy gnomes
Tweet

The scene includes a total of 400,000 objects, with different levels of detail, ranging from 13,000 to 300 vertices. The wide shot shows an estimated one million triangles, some alpha on the plants and about ten different textures for the gnomes and plants. Each object type uses a different shader and the gnomes are not instanced, each draw call could be an entirely different object, with different materials, but the end-result would be similar.

Still, there’s a big caveat: This is not the sort of performance boost you can expect in real life. The Imagination Technologies team used an exaggerated scenario to highlight Vulkan’s superiority, to push it to its limits, and in this particular scenario the limit is in favour of Vulkan vs. OpenGL ES. Also, keep in mind that this test is GPU-bound, but it is still a good illustration of Vulkan’s superior CPU utilisation.

How Does Vulkan Reduce CPU Utilisation?

Remember that OpenGL vs. Vulkan table we had earlier, or to be more specific, that tiled rendering bit? Probably not, so here it is, in a nutshell: Imagination used Vulkan to batch draw calls into tiles and render a tile at a time. Depending on where the tile is at the moment the frame is rendered, it can come into or go out of view, change its level of detail, and so on. In OpenGL ES, all draw calls are dynamic, they are submitted with each frame, according to what is in the field of view. Draw calls that have already been executed cannot be cached.

As a result, OpenGL ES needs many calls into kernel mode to change the state of the driver and validate it. Vulkan does not because it relies on pre-generated commands (command buffers) to reduce CPU overhead and eliminate the need to validate or compile during the render loop. The Imagination team described the ability to re-use command buffers as “useful in some circumstances,” and possible to use “to a great extent” in many games and applications.

The second game changer is parallel buffer generation, which enables Vulkan to harness the power of all CPU cores. OpenGL ES was designed before the advent of multi-core mobile chips, but over the past three years, the industry has gone from two, through four, to eight and ten CPU cores, with Apple’s A-series SoCs and Denver-based Nvidia Tegra chips as the only notable exceptions. I talked about mobile SoC trends in one of my previous blog pieces, covering the upcoming Optimizing Android compiler, so you can check it out for additional info.

Let’s try an analogy: If Vulkan was an internal combustion engine, it would be storing and reusing part of its power, in much the same way a turbocharger and intercooler would (command buffers), and it would be able to use four, six, eight or even ten cylinders with no loss in efficiency (parallel buffer generation). Comparing Vulkan to OpenGL ES sounds a bit like comparing a new, downsized turbo engine to an old, single-cylinder engine on your granddad’s Triumph Trophy.

Well, at least granddad was a proper rocker, not a mod.

The end result is a vastly more efficient environment, capable of putting all available hardware to good use, unlike OpenGL ES, which is CPU bound in most scenarios. This means Vulkan can deliver similar levels of performance while keeping the CPU at lower clocks, thus reducing power consumption and throttling.

Potential Vulkan API Downsides (Spoiler Alert: There Aren’t That Many)

I am not nit-picking; I feel it’s also important to list the pros and cons of Vulkan API . Fortunately, there aren’t that many cons other than a few minor ones and, potentially, one or two big ones. If you think Vulkan is the best thing since sliced bread, and you’re eager to give it a go in your next project, you may want to consider a few of these points:

  • Added code complexity in certain scenarios
  • Time-to-Market
  • Level of industry support
  • Vulkan may not be as relevant or effective on some platforms (desktops)
  • Convincing developers to use Vulkan on some platforms
  • Limited compatibility with legacy hardware

If a developer wants to implement some of the neat features outlined in this post, it will involve a fair amount of work. Each will have to be implemented in code, but the good news is that industry leaders will make the process easier with new driver updates.

There aren't that many downsides to the Vulkan API, but it will take a while before we see it in action.

There aren't that many downsides to the Vulkan API, but it will take a while before we see it in action.
Tweet

Time-to-market is another concern, as is the implementation of Vulkan in older apps and games. Vulkan is still a technical preview; initial specifications and implementations are expected by the end of 2015, so, realistically, we probably won’t see many real-world applications before mid-2016.

Industry support should not be an issue; After all, this is a Khronos standard, but it may take a while. That’s one of the reasons I focused this post on the mobile segment; Mobile software and hardware evolve more quickly, and it may take a few more quarters before we see Vulkan making an impact on desktop platforms. That’s just how the industry works, there is a lot more stuff to worry about in the desktop niche: support for professional applications, hordes of pitchfork-wielding gamers going ape over every torn frame, and so on. However, the fact that Vulkan is derived from AMD’s Mantle is encouraging.

While Vulkan can do wonders in a CPU-bound setting, especially with multi-core mobile SoCs, these performance gains will be limited on desktop platforms. Desktops handle multi-core processors with a greater level of efficiency, and most graphically demanding applications are GPU-bound.

Until all pieces of the puzzle fall into place, some developers may be reluctant to take the plunge and mess around with Vulkan. A lot of people simply don’t have time to experiment, and they learn new skills only when absolutely necessary. Burning a lot of money and wasting man-hours to tweak existing mobile games to use Vulkan at this early stage won’t be an option for many developers and publishers.

Compatibility with older hardware could be another source of concern. Vulkan will need OpenGL ES 3.1 or OpenGL 4.1 hardware, accompanied by new drivers. For example, Imagination Technologies’ PowerVR series 6 GPUs can support it, but series 5 cannot. Qualcomm’s Adreno 400 series supports OpenGL ES 3.1, but the 300 series does not. ARM’s Mali T600- and T700-series support OpenGL ES 3.1, but support is lacking on older T400-series designs. Luckily, by the time Vulkan becomes relevant, most devices with unsupported GPUs will be out of the picture. These include the iPhone 5/5C, fourth generation iPad and Samsung devices based on certain 5000-series Exynos chips. Qualcomm-based devices may not be as lucky since Adreno 300-series GPUs are used on relatively recent and prolific designs such as the Snapdragon 410, Snapdragon 600, Snapdragon 800 and 801. However, I suspect most of them will be gone by the time Vulkan becomes truly relevant.

Live Long And Render

It is still too early to say whether or not Vulkan will be a game-changer, but I think you will agree that it has plenty of potential. I think it will be a big deal, and I base that assumption on a decade of experience covering the GPU industry. It will take time, however, and I suspect Vulkan will make its presence felt in mobile before it starts changing the desktop landscape.

At about the same time Vulkan-optimised drivers, game engines, and games, we will get new hardware to play around with, and I don’t mean just minor hardware tweaks. Mobile SoC development has stalled for a number of reasons I won’t go into now, but 2016 will be a big year for the industry, as 14/16nm FinFET nodes become available to more manufacturers, and become economically viable for mainstream hardware rather than flagship chips.

Developers will have vastly more powerful and efficient hardware to play around with, and a new low-overhead graphics API will be the icing on the cake. I sincerely hope hardware vendors will stop using display resolution as a marketing gimmick, as pointlessly high resolutions do nothing for visual quality but still waste power. Unfortunately, since the average consumer doesn’t get this, and wants to see bigger numbers on the box, I suspect this won’t happen anytime soon. I intend to examine this weird issue in one of my upcoming posts, so if you’re annoyed by it, stay tuned and feel free to vent in the comment section.

A Brief Overview Of Vulkan API相关推荐

  1. CryEngine最新版发布,支持Vulkan API

    (52VR.com优质翻译) Crytek宣布,CryEngine发布最新版了!最新版本的 CryEngine 5.4,不仅集成了Vulkan API,还集成了Substance Designer 工 ...

  2. 怎么通过Unity使用Vulkan API 移动端Vulkan GPU 大PK

    本文转自Unity Connect博主 梦想在路上的LPP 逢人皆言Vulkan好,到底好在哪里?如何在Unity 工程中使用Vulkan API?支持Vukan的GPU都有哪些?我的手机支持Vulk ...

  3. Vulkan Programming Guide::Chapter1::Overview of VulKan(纵观VulKan)

    VulKan 编程指南::第一章::纵观VulKan 在这一章你将会学习什么 什么是VulKan和背后的原理 如何去创建最简单的VulKan应用 本书会用到的一些专业术语和概念 在这一章我们将会介绍并 ...

  4. Vulkan统一所有平台的API

    本文是系列博客文章中的第一篇,旨在更深入地探讨在"2015计算机图形图像特别兴趣小组(SIGGRAPH)"大会上披露的有关Vulkan的信息.我不是要透露任何新信息,新信息我会留待 ...

  5. vulkan api_Vulkan开放标准API支持,针对Linux的新游戏以及更多游戏

    vulkan api 您好,开放游戏迷! 在本周的版本中,我们将介绍对新的开放标准API Vulkan的支持,以及本周针对Linux的新游戏和扩展. 2016年2月14日至20日开放游戏摘要 武尔坎 ...

  6. Google宣布支持Vulkan作为Android的底层图形API

    很多人在刚听到底层图形API的时候似乎都不怎么激动,但是苹果已经在去年的iOS 8上推出了Metal,并计划于今秋将之推送至Mac OS X EI Capitan.此外,刚刚发布的Windows 10 ...

  7. 在PowerVR GPU上试用新Vulkan图形处理API

    由 创新网小编 于 星期五, 2015-04-03 10:58 发表 Vulkan™是Khronos Group研发的新一代高性能图像处理和计算API.Vulkan没出来以前,人们都称它为glNext ...

  8. 没有任何秘密的 API:Vulkan* 简介第 1 部分:序言

    目录 教程 1: Vulkan* – 序言 加载 Vulkan Runtime 库并获取导出函数指示器 获取全局级函数指示器 创建 Vulkan 实例 获取实例级函数指示器 创建逻辑设备 设备属性 设 ...

  9. 图形API学习工程(4):梳理:以Vulkan为中心梳理当前初始化阶段的代码

    工程GIT地址:https://gitee.com/yaksue/yaksue-graphics 目标 目前工程所能达成的效果是:以一固定色填充窗口(clear命令).为此,所需要的操作大致有: 创建 ...

最新文章

  1. sql和python的区别_数据处理简单对比:Excel,SQL,Python
  2. 在linux中解压.tgz
  3. python 网页樱花动态图_python,tensorflow线性回归Django网页显示Gif动态图
  4. lua实现继承(lua程序设计21.7 练习21.2题)
  5. Java查询图书信息
  6. antimalware可以关闭吗_“对方正在输入...”什么时候会出现?可以关闭吗?
  7. Ethercat解析(九)之过程数据
  8. 那个花457万美元拍下巴菲特20周年慈善午宴的90后是他!
  9. python html5交互方式,python+Django(5)—回传至前端几种方式
  10. java DTO循环_Java Stream与for循环比较
  11. 1. OpenMAX系列 —— ACodec和OMX的联系
  12. 转载:iOS 8 自适应 Cell
  13. C++中两种计算时间方法的比较
  14. 【数位dp】模版总结
  15. GBaseDataStudio管理工具
  16. 普通文档怎么换成php,腾讯在线文档如何转化为普通文档
  17. 史上最全各种简历模板,自荐信模板和面试技巧
  18. 云安全成下一个市场热点,三方云安全厂商出路在哪里?
  19. Element-UI安装与使用
  20. 《算法图解》学习笔记(十一):十种经典的算法与数据结构

热门文章

  1. php分页类示例下载,PHP 通用分页类的简单示例
  2. unix iorp等待队列_FreeRTOS+POSIX之消息队列API详解
  3. java 删除桌面快捷方式_能否在桌面创建快捷方式运行java程序?
  4. java ide下载_jGRASP|轻量级Java IDE(jGRASP)下载v2.0.4.03官方版 - 欧普软件下载
  5. linux ssh非交互脚本,sshpass-Linux命令之非交互SSH
  6. 组态软件运行在云服务器是上,如何将本地组态画面发布到云服务器
  7. jQuery+CSS动态改变class
  8. SQL 查找重复记录
  9. 怎样在CSDN的博客里面显示上传的图片,教你一招
  10. 《天天数学》连载28:一月二十八日