ifcviewer: move edge silhouette subsystem into ViewportCore (#84-s)

buildEdgePipeline, encodeEdgePass, releaseEdgeResources + the EDGE_WGSL
shader source all move to ViewportCore. The edge_bind_group_ + the
edges_enabled_ flag come along too (the latter aliased on VW so the
edge-toggle keybind keeps compiling).

The pass binds the now-core-side depth_view_ directly, so there's no
remaining cross-side state dependency for edge rendering. render()
still calls core_.encodeEdgePass(enc, surface_view) — once render()
itself moves, the call collapses to a sibling method invocation.
This commit is contained in:
Dion Moult
2026-06-06 18:26:57 +10:00
parent 138973830b
commit fa3b0f90d8
4 changed files with 205 additions and 168 deletions
+18
View File
@@ -375,6 +375,22 @@ public:
void ensureMsaaColorTexture(int w, int h);
void releaseMsaaColorTexture();
// ---- Edge silhouette post-process (#84-s) -----------------------------
//
// Build the edge pipeline + shader + BGL. Run after initWgpu's
// device is up. Returns false on pipeline creation failure.
bool buildEdgePipeline();
// Encode the edge silhouette fullscreen pass into the supplied
// command encoder. No-op when edges_enabled_ is false or the
// pipeline / depth view / surface view is null. Lazily builds the
// bind group on first call after a surface resize.
void encodeEdgePass(WGPUCommandEncoder enc, WGPUTextureView surface_view);
// Tear down the edge pipeline + bind group + supporting state.
// Called from shutdown() before the device dies.
void releaseEdgeResources();
// ---- Cull (#84-p) -----------------------------------------------------
//
// Per-instance occlusion test, supplied by the caller. Wired by
@@ -535,6 +551,8 @@ private:
WGPUBindGroupLayout edge_bgl_ = nullptr;
WGPUPipelineLayout edge_pipeline_layout_ = nullptr;
WGPURenderPipeline edge_pipeline_ = nullptr;
WGPUBindGroup edge_bind_group_ = nullptr;
bool edges_enabled_ = true;
// Pick pass. Reuses pipeline_layout_ — same set of bindings as the
// main pass since the pick fragment also vertex-pulls instance data.