Commit graph

57 commits

Author SHA1 Message Date
catbot
621016f264 feat(window): multi-frame-in-flight frame pacing (#40)
The renderer was effectively single-buffered despite allocating
triple-buffered infrastructure: Render() ended with an unconditional
vkQueueWaitIdle, and a single (presentComplete, renderComplete)
semaphore pair with zero fences was shared for the Window's lifetime.

Rework the pacing model so up to numFrames frames overlap:
- Per-swapchain-image VkFence, signaled by the submit and waited+reset
  before that image's command buffer / descriptor-heap slot is
  re-recorded. Keyed by acquired image index (drawCmdBuffers, the heap
  slots, and the swapchain images are all image-indexed — see
  WriteSwapchainDescriptors). Created signaled so first use passes.
- Per-image render-finished (present) semaphore: the presentation engine
  holds it until the image is re-acquired, so per-image is the only safe
  key (per-CPU-frame trips VUID-vkQueueSubmit-pSignalSemaphores-00067).
- Per-CPU-frame acquire semaphores (image index unknown until acquire
  returns), sized numFrames+1: in-flight depth is bounded by the
  per-image fences, so numFrames+1 distinct acquire semaphores guarantee
  the reused one has no pending op (VUID-vkAcquireNextImageKHR-01779).
- Drop the steady-state vkQueueWaitIdle; keep it on resize / OUT_OF_DATE
  / teardown.

Add tests/FrameLoopSync: drives the real frame loop against a live
Wayland compositor for 60 frames (>> in-flight slots) and asserts the
CPU frame counter advanced, the swapchain rotated across multiple
images, and the validation layer stayed silent — the load-bearing check,
since the old single-pair design only avoided being an active race
because the wait-idle masked it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 15:37:11 +00:00
catbot
419730f46b feat(input): wire native mouse-wheel scroll on Wayland + Win32, normalize all backends to ±1/detent (#32)
Window::onMouseScroll now fires on every backend and speaks one unit:
signed whole detents packed in the uint32 payload, +1 = wheel down
(DOM deltaY sign).

- Wayland: implement the previously-stubbed PointerListenerHandleAxis —
  vertical axis only, wl_fixed_to_double / 15 (libinput's units-per-
  detent), sub-detent remainder accumulated and reset on pointer leave.
- Win32: add the missing WM_MOUSEWHEEL case — -GET_WHEEL_DELTA_WPARAM /
  WHEEL_DELTA with a remainder accumulator for free-spinning wheels.
- DOM: dom-env.js normalizes WheelEvent.deltaY per deltaMode (100px /
  3 lines / 1 page per detent) with the same remainder scheme, so wasm
  delivers the identical unit instead of raw browser-specific deltas.
- Document the contract on Window::onMouseScroll.
- tests/MouseScroll: compositor-free regression test driving the
  Wayland axis handler directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 15:02:28 +00:00
catbot
cac433ee09 fix(vulkan): clear startup validation errors on native triangle
Two Vulkan validation errors fired on startup of every native (Vulkan)
example, reported in #5:

1. vkCreateDevice enabledLayerCount != 0. Device layers are deprecated
   and ignored since Vulkan 1.0; passing them is a spec violation
   (VUID-VkDeviceCreateInfo-enabledLayerCount-12384). The device-layer
   enumeration/match block in Device::Initialize is removed and
   enabledLayerCount is pinned to 0 — layers are enabled at the instance
   only.

2. vkQueueSubmit layout transition on a presentable image that "has not
   been acquired". StartInit() and RecreateSwapchainAndImages() eagerly
   transitioned every swapchain image UNDEFINED -> PRESENT_SRC_KHR before
   any vkAcquireNextImageKHR, which the spec forbids (a presentable image
   may only be touched after acquire). Those pre-transitions are removed.
   Each image's first layout transition now happens lazily in Render(),
   after acquire, from UNDEFINED; subsequent frames transition from
   PRESENT_SRC_KHR. A per-image `imageInitialised` flag (reset in
   CreateSwapchain) selects the correct oldLayout.

Verified under sway (headless, GPU renderer) + VK_LAYER_KHRONOS_validation:
the original code reproduces both errors on HelloUI; the fixed build emits
zero validation messages across initial render and swapchain recreation.

Resolves #5

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 20:59:10 +00:00
909a9b46d2 wasm fixes 2026-05-26 22:50:49 +02:00
dedf6b0467 webgpu support 2026-05-18 04:58:52 +02:00
5352ef69a2 browser DOM support 2026-05-18 02:07:48 +02:00
ac2eb7fb0a new input system 2026-05-12 00:24:48 +02:00
b3db40ebec update 2026-05-05 23:49:29 +02:00
1f5697326c UI rewrite 3rd attempt 2026-05-02 21:08:20 +02:00
c9fd1b1585 animated example 2026-05-02 00:03:24 +02:00
216972e73a new UI system 2026-05-01 23:35:37 +02:00
c9ebd448f9 update 2026-04-16 23:03:24 +02:00
3fcea6a3d7 writing ui descriptors 2026-04-10 22:26:15 +02:00
f8e142fb06 descriptor heap rewrite 2026-04-05 22:53:59 +02:00
22b8af7bfc update 2026-04-02 16:52:10 +02:00
477b7dd087 F16 rendering 2026-04-01 18:43:18 +02:00
bc97c13a0b rendertarget multi frame rewrite complete 2026-03-13 01:06:55 +01:00
2b22c16ce7 rendertarget multi frame rewrite 2026-03-12 21:13:53 +01:00
7f46ac13fa rendering improvements 2026-03-12 01:07:46 +01:00
LancenShield
38c8d57146 Added VK_CONTROL for same reason as VK_SHIFT. 2026-03-09 22:34:14 -05:00
103a35ee40 vk shift crash 2026-03-10 03:24:01 +01:00
123bb31f50 initalization 2026-03-10 03:05:10 +01:00
accc9ef8e7 typo 2026-03-10 02:47:28 +01:00
6effe88733 color format fix 2026-03-09 23:21:24 +01:00
cfebc896db color format fix 2026-03-09 23:21:10 +01:00
486775925b color format fix 2026-03-09 23:12:31 +01:00
1ff646ca01 color format fix 2026-03-09 23:05:32 +01:00
5fc7423387 time fix 2026-03-09 22:15:36 +01:00
3f18b3ae55 time fix 2026-03-09 22:12:40 +01:00
ef199b180e mouse fix 2026-03-09 21:50:24 +01:00
337cf1e43b wayland no refresh 2026-03-09 21:43:25 +01:00
6d031bacbe wayland no refresh 2026-03-09 21:32:16 +01:00
33312a5d01 crash fix 2026-03-09 21:16:14 +01:00
be9e3ceff2 crash fix 2026-03-09 21:15:15 +01:00
c26c7c2315 crash fix 2026-03-09 21:14:53 +01:00
91dbe7d8e9 crash fix 2026-03-09 21:14:10 +01:00
3400e56340 crash fix 2026-03-09 21:07:52 +01:00
faf94775df crash fix 2026-03-09 21:05:21 +01:00
c8ab2bf22e crash fix 2026-03-09 21:00:58 +01:00
fc8abaa38e crash fix 2026-03-09 20:59:24 +01:00
d661c88ee2 cleaned up renderer 2026-03-09 20:10:19 +01:00
d0cc3ad16a the great text and type rewrite 2025-12-30 23:28:38 +01:00
c84504331b scaling 2025-12-29 18:56:06 +01:00
3d40256bde rendering element rewrite 2025-12-28 00:05:03 +01:00
615d90c36f draw rect optimization 2025-11-26 23:36:08 +01:00
6df6355ba7 dirty rect 2025-11-26 20:41:54 +01:00
285e8c9182 optimization 2025-11-26 20:15:25 +01:00
9bb36c990d selective clearing 2025-11-26 18:48:58 +01:00
b41ec7960c timing 2025-11-25 23:36:43 +01:00
4baeca1603 better timing 2025-11-25 23:29:48 +01:00