commit | fe28490657f39c7003c3cbedbffbdaffe4cebd60 | [log] [tgz] |
---|---|---|
author | Raph Levien <raph.levien@gmail.com> | Wed Nov 03 08:35:28 2021 -0700 |
committer | Raph Levien <raph.levien@gmail.com> | Fri Nov 05 13:39:06 2021 -0700 |
tree | 1063704f33f7c145911af2f26624a82e8f44612c | |
parent | b0b0f33c3c41fdcd5fe6505a4c49b12ee3815801 [diff] |
Alternative strategies for elements barrier This patch provides an #ifdef METAL for switching between two different strategies for the barriers in the elements shader. With it enabled, the barriers are in workgroup uniform control flow, which is compatible with translation to Metal, but fails to compile in FXC, as FXC's uniformity analysis fails. With it disabled, the lookback logic (including barriers) runs only in a single thread, which compiles in FXC (though not tested), but creates problems in Metal. In testing on Android, the METAL version seems slightly faster. On AMD 5700 XT, there is no measurable difference. I'm inclined not to commit this, but it's potentially useful if we want to explore cs_5_0 compatibility.
This repo contains the new prototype for a new compute-centric 2D GPU renderer.
It succeeds the previous prototype, piet-metal.
The main goal is to answer research questions about the future of 2D rendering:
Is a compute-centered approach better than rasterization (Direct2D)? How much so?
To what extent do “advanced” GPU features (subgroups, descriptor arrays) help?
Can we improve quality and extend the imaging model in useful ways?
Another goal is to explore a standards-based, portable approach to GPU compute.
Much of the research progress on piet-gpu is documented in blog entries. See doc/blogs.md for pointers to those.
There is a much larger and detailed vision that explains the longer-term goals of the project, and how we might get there.
It makes a lot of sense to use gfx-hal, as it addresses the ability to write kernel and runtime code once and run it portably. But in exploring it I‘ve found some points of friction, especially in using more “advanced” features. To serve the research goals, I’m enjoying using Vulkan directly, through ash, which I've found does a good job tracking Vulkan releases. One example is experimenting with VK_EXT_subgroup_size_control
.
The hal layer in this repo is strongly inspired by gfx-hal, but with some differences. One is that we‘re shooting for a compile-time pipeline to generate GPU IR on DX12 and Metal, while gfx-hal ships SPIRV-Cross in the runtime. To access Shader Model 6, that would also require bundling DXC at runtime, which is not yet implemented (though it’s certainly possible).
The case for wgpu is also strong, but it‘s even less mature. I’d love to see it become a solid foundation, at which point I'd use it as the main integration with Druid.
In short, the goal is to facilitate the research now, collect the data, and then use that to choose a best path for shipping later.
The piet-gpu project is dual-licensed under both Apache 2.0 and MIT licenses.
In addition, the shaders are provided under the terms of the Unlicense. The intent is for this research to be used in as broad a context as possible.
The dx12 backend was adapted from piet-dx12 by Brian Merchant.
Contributions are welcome by pull request. The Rust code of conduct applies.