EDIT: folder structure refactoring
This commit is contained in:
@@ -202,7 +202,7 @@ Benefits:
|
||||
- Integrated barrier management with other passes.
|
||||
- Per-frame synchronization tracking.
|
||||
|
||||
Reference: `src/render/vk_renderpass_background.cpp`.
|
||||
Reference: `src/render/passes/background.cpp`.
|
||||
|
||||
### Synchronization
|
||||
|
||||
@@ -279,9 +279,9 @@ src/core/
|
||||
└── vk_resource.h/cpp # immediate_submit() for GPU-blocking
|
||||
|
||||
src/render/
|
||||
├── vk_renderpass_background.cpp # Example: gradient/sky compute passes
|
||||
├── rg_types.h # RGPassType::Compute, RGImageUsage::ComputeWrite
|
||||
└── rg_graph.h # Render graph integration
|
||||
├── passes/background.cpp # Example: gradient/sky compute passes
|
||||
├── graph/types.h # RGPassType::Compute, RGImageUsage::ComputeWrite
|
||||
└── graph/graph.h # Render graph integration
|
||||
|
||||
shaders/
|
||||
├── gradient_color.comp # Example: gradient background
|
||||
|
||||
@@ -21,15 +21,15 @@ Lightweight render graph that builds a per‑frame DAG from pass declarations, c
|
||||
- `RenderGraph::add_pass(name, RGPassType type, BuildCallback build, RecordCallback record)`
|
||||
- Declare image/buffer accesses and attachments inside `build` using `RGPassBuilder`.
|
||||
- Do your actual rendering/copies in `record` using resolved Vulkan objects from `RGPassResources`.
|
||||
- See: `src/render/rg_graph.h:36`, `src/render/rg_graph.cpp:51`.
|
||||
- See: `src/render/graph/graph.h:36`, `src/render/graph/graph.cpp:51`.
|
||||
|
||||
- `RenderGraph::compile()` → builds ordering and per‑pass `Vk*MemoryBarrier2` lists. See `src/render/rg_graph.cpp:83`.
|
||||
- `RenderGraph::compile()` → builds ordering and per‑pass `Vk*MemoryBarrier2` lists. See `src/render/graph/graph.cpp:83`.
|
||||
|
||||
- `RenderGraph::execute(cmd)` → emits barriers and dynamic rendering begin/end. See `src/render/rg_graph.cpp:592`.
|
||||
- `RenderGraph::execute(cmd)` → emits barriers and dynamic rendering begin/end. See `src/render/graph/graph.cpp:592`.
|
||||
|
||||
- Import helpers for engine images: `import_draw_image()`, `import_depth_image()`, `import_gbuffer_*()`, `import_swapchain_image(index)`. See `src/render/rg_graph.cpp:740`.
|
||||
- Import helpers for engine images: `import_draw_image()`, `import_depth_image()`, `import_gbuffer_*()`, `import_swapchain_image(index)`. See `src/render/graph/graph.cpp:740`.
|
||||
|
||||
- Present chain: `add_present_chain(draw, swapchain, appendExtra)` inserts Copy→Present passes and lets you inject extra passes (e.g., ImGui) in between. See `src/render/rg_graph.cpp:705`.
|
||||
- Present chain: `add_present_chain(draw, swapchain, appendExtra)` inserts Copy→Present passes and lets you inject extra passes (e.g., ImGui) in between. See `src/render/graph/graph.cpp:705`.
|
||||
|
||||
### Declaring a Pass
|
||||
|
||||
@@ -75,14 +75,14 @@ void MyPass::register_graph(RenderGraph* graph,
|
||||
- `read_buffer(RGBufferHandle, RGBufferUsage)` / `write_buffer(RGBufferHandle, RGBufferUsage)`.
|
||||
- Convenience import: `read_buffer(VkBuffer, RGBufferUsage, size, name)` and `write_buffer(VkBuffer, ...)` dedup by raw handle.
|
||||
|
||||
See `src/render/rg_builder.h:39` and impl in `src/render/rg_builder.cpp:20`.
|
||||
See `src/render/graph/builder.h:39` and impl in `src/render/graph/builder.cpp:20`.
|
||||
|
||||
### Resource Model (`RGResourceRegistry`)
|
||||
|
||||
- Imported vs transient resources are tracked uniformly with lifetime indices (`firstUse/lastUse`).
|
||||
- Imports are deduplicated by `VkImage`/`VkBuffer` and keep initial layout/stage/access as the starting state.
|
||||
- Transients are created via `ResourceManager` and auto‑destroyed at end of frame using the frame deletion queue.
|
||||
- See `src/render/rg_resources.h:11` and `src/render/rg_resources.cpp:1`.
|
||||
- See `src/render/graph/resources.h:11` and `src/render/graph/resources.cpp:1`.
|
||||
|
||||
### Synchronization and Layouts
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ Thin scene layer that produces `RenderObject`s for the renderer. It gathers opaq
|
||||
|
||||
### Sorting / Culling
|
||||
|
||||
- Opaque (geometry): stable sort by `material` then `indexBuffer` (see `src/render/vk_renderpass_geometry.cpp`).
|
||||
- Transparent: sort by camera‑space depth far→near (see `src/render/vk_renderpass_transparent.cpp`).
|
||||
- An example frustum test exists in `vk_renderpass_geometry.cpp` (`is_visible`) and can be enabled to cull meshes.
|
||||
- Opaque (geometry): stable sort by `material` then `indexBuffer` (see `src/render/passes/geometry.cpp`).
|
||||
- Transparent: sort by camera‑space depth far→near (see `src/render/passes/transparent.cpp`).
|
||||
- An example frustum test exists in `passes/geometry.cpp` (`is_visible`) and can be enabled to cull meshes.
|
||||
|
||||
### Dynamic Instances
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Overview
|
||||
- Materials: layouts use `UPDATE_AFTER_BIND`; descriptors can be rewritten after bind.
|
||||
- glTF loader: `src/scene/vk_loader.cpp` builds keys, requests handles, and registers descriptor patches with the cache.
|
||||
- Primitives/adhoc: `src/core/asset_manager.cpp` builds materials and registers texture watches.
|
||||
- Visibility: `src/render/vk_renderpass_geometry.cpp` and `src/render/vk_renderpass_transparent.cpp` call `TextureCache::markSetUsed(...)` for sets that are actually drawn.
|
||||
- Visibility: `src/render/passes/geometry.cpp` and `src/render/passes/transparent.cpp` call `TextureCache::markSetUsed(...)` for sets that are actually drawn.
|
||||
- IBL: high‑dynamic‑range environment textures are typically loaded directly as `.ktx2` via `IBLManager` instead of the generic streaming cache. See “Image‑Based Lighting (IBL)” below.
|
||||
|
||||
Data Flow
|
||||
@@ -114,6 +114,6 @@ Image‑Based Lighting (IBL) Textures
|
||||
- binding 1: `COMBINED_IMAGE_SAMPLER` — BRDF LUT 2D.
|
||||
- binding 2: `UNIFORM_BUFFER` — SH coefficients (`vec4 sh[9]`, RGB in `.xyz`).
|
||||
- Render passes that use IBL fetch this layout from `EngineContext::ibl` and allocate per‑frame sets:
|
||||
- `vk_renderpass_lighting.cpp`: deferred lighting (set=3).
|
||||
- `vk_renderpass_transparent.cpp`: forward/transparent PBR materials (set=3).
|
||||
- `vk_renderpass_background.cpp`: environment background (set=3; only binding 0 is used in the shader).
|
||||
- `passes/lighting.cpp`: deferred lighting (set=3).
|
||||
- `passes/transparent.cpp`: forward/transparent PBR materials (set=3).
|
||||
- `passes/background.cpp`: environment background (set=3; only binding 0 is used in the shader).
|
||||
|
||||
Reference in New Issue
Block a user