Some GPUs expose “tile” or “subpass” data paths that let shaders read from on‑chip color/depth without a round trip to memory. VK_EXT_shader_tile_image is a portable way to tap into that.
In this sample we treat it as an optional optimization: the pipeline remains correct without it, and we only take a “fast path” when the device advertises support.
Post‑lighting texture reads from the just‑written color can be expensive. With tile image access, certain patterns become cheaper and more deterministic on supported hardware.
We enable the feature if present and expose a boolean you can check in code.
The renderer still uses clean Synchronization 2 barriers and ends dynamic rendering before formal layout transitions. That keeps the code understandable on devices that don’t support tile reads.
Use it as an optimization. Write code that’s correct everywhere, then add tile‑image fast paths when available.
Feature detection and enablement:
renderer_core.cpp
Dynamic rendering setup and attachment transitions (kept explicit for clarity):
renderer_rendering.cpp
renderer_pipelines.cpp
If you want to demonstrate tile-image usage more directly:
Add a small “local read” post effect that reads from the current color attachment and compares with a regular sampled path.
Add a device capability print (development-only) so students can see when the fast path is active.
Add a micro-benchmark scene and compare bandwidth on tile-based GPUs.
Vulkan 是 Khronos Group Inc. 的注册商标
教程内容版权归原作者,遵循 CC BY-SA 4.0;本站独立代码及设计除外。