szeged / webrender

A GPU-based renderer for the web
https://doc.servo.org/webrender/
Mozilla Public License 2.0
45 stars 7 forks source link

Refactor pipeline barriers #308

Closed zakorgy closed 4 years ago

zakorgy commented 4 years ago

Change the transition logic to be more transparent, and don't rely on the previous image state to pick the source pipeline stage. Changed the default layot to ShaderReadonlyOptiomal (SRO) for new images instead of ColorAttachmentOptimal (CAO). If a texture is bound as draw target it's corresponding image is transitioned to the CAO layout. If a new texture with a new images is bound as draw target we transit back the old image to SRO. If an image is transitioned for some purpose (copy, blit, clear) we always transit back to the previous state which could be only SRO or CAO. There are two exceptions frame and depth images:

Benefit: To rework our render pass logic it's good to know that our render target is in the proper state.

Things left:

zakorgy commented 4 years ago

The DX12 backend is depending on https://github.com/gfx-rs/gfx/issues/3009

zakorgy commented 4 years ago

assuming no validation errors

With Vulkan everything is fine. I will check the DX12 backend again after https://github.com/gfx-rs/gfx/pull/3014#issuecomment-531694250 is figured out.