Skip to content

Commit

Permalink
hal: more implementation comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Jun 30, 2021
1 parent 2106d49 commit a6ed424
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*!
# Metal API internals.
## Pipeline Layout
In Metal, push constants, vertex buffers, and resources in the bind groups
are all placed together in the native resource bindings, which work similarly to D3D11:
there are tables of textures, buffers, and samplers.
We put push constants first (if any) in the table, followed by bind group 0
resources, followed by other bind groups. The vertex buffers are bound at the very
end of the VS buffer table.
!*/

mod adapter;
mod command;
mod conv;
Expand Down
22 changes: 22 additions & 0 deletions wgpu-hal/src/vulkan/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*!
# Vulkan API internals.
## Stack memory
Ash expects slices, which we don't generally have available.
We cope with this requirement by the combination of the following ways:
- temporarily allocating `Vec` on heap, where overhead is permitted
- growing temporary local storage
- using `implace_it` on iterators
## Framebuffers and Render passes
Render passes are cached on the device and kept forever.
Framebuffers are also cached on the device, but they are removed when
any of the image views (they have) gets removed.
If Vulkan supports image-less framebuffers,
then the actual views are excluded from the framebuffer key.
!*/

mod adapter;
mod command;
mod conv;
Expand Down

0 comments on commit a6ed424

Please sign in to comment.