cad-editor/src/shaders
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Hakan Seven 3d24dd5168 fix(viewport): blit UV crop for off-canvas viewports
Refactor the per-viewport blit so a content viewport whose screen rect
extends off the canvas composites the correct slice of its MSAA target
to the visible portion of the surface, instead of being slammed against
the canvas corner by an `(f32 as u32)` saturation on the negative
offset.

- blit.wgsl + Pipeline gain a small uniform buffer (`uv_offset` /
  `uv_scale`). `Primitive::prepare` computes the per-viewport crop from
  `screen_rect`'s on-canvas fraction and writes it via the new
  `upload_blit_uv` helper while it still has the `Queue`.
- `Pipeline::render` now takes `vp_size` (full vp — MSAA / camera size)
  and `surface_dest` (visible intersection — blit destination) and
  reads the crop from the uniform; passes that don't have a non-empty
  surface intersection are skipped.
- `Primitive::render` clips the full vp rect against the surface clip
  in `i32` and skips empty intersections. The earlier "skip GPU for
  inactive off-canvas viewports" workaround in `active_viewports` is
  no longer needed.
- ViewCube draws only when its hosting vp is fully on-canvas (its own
  pipeline writes directly to the surface and would distort under a
  clamped `set_viewport`).

With the GPU path correct for every vp position, drop
`viewport_content_wires` from `paper_canvas_wires` — the inactive
viewport CPU projection was only there to mask the blit bug and was
duplicating the unified shader's output. The hit-test / snap path
(`entity_wires_arc`, `wires_for_block`) still calls
`viewport_content_wires` directly, so picking through inactive
viewports keeps working.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 12:15:00 +03:00
..
blit.wgsl fix(viewport): blit UV crop for off-canvas viewports 2026-05-28 12:15:00 +03:00
face3d.wgsl perf: dedicated Face3D shader — N draw calls → 2 2026-04-28 21:53:31 +03:00
hatch.wgsl fix(scene): hatch boundary + pattern precision for large-WCS drawings 2026-05-16 08:41:23 +03:00
hatch_batched.wgsl feat(pipeline): per-instance visibility for batched hatches (Phase 4-B, step 4) 2026-05-17 20:11:28 +03:00
image.wgsl feat: raster image render pipeline (IMAGE command + GPU textured quad) 2026-04-06 23:19:08 +03:00
mesh.wgsl feat(render): Flat/Gouraud shading, WithEdges overlay, paper-viewport mode 2026-05-27 05:57:19 +03:00
viewcube.wgsl fix: ViewCube hover, glow, centroids, corner geometry and snap angles 2026-04-23 19:11:19 +03:00
viewcube_text.wgsl first commit 2026-03-22 14:56:27 +03:00
wire.wgsl perf(wire): switch wire pipeline to instanced rendering 2026-05-23 09:52:23 +03:00