|author||Raph Levien <email@example.com>||Fri May 13 10:18:29 2022 -0700|
|committer||Raph Levien <firstname.lastname@example.org>||Fri May 13 10:18:29 2022 -0700|
Fix blending math The blending math had two errors: first, colors were not separated for the purpose of blending (blending was wrongly applied to premultiplied values), and second, alpha was applied over-aggressively to the alpha channel. This PR does *not* address the issue of gamma correctness. That is a complex issue and should probably be handled in the short term by disabling sRGB conversions and doing the internal math in sRGB color space rather than linear. This will degrade the quality of antialiasing but on the other hand give spec-compliant results for compositing. We remove the plus-darker mode as its specification does not appear to be valid. The plus-lighter mode remains as it is quite useful for cross-fading effects. Also the generated shaders were compiled on mac so the DXIL is unsigned. Those should be compiled on Windows before this PR is merged. (and we should figure out a better strategy for all that)
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
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.
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.