The native ray-tracing examples never rewrite their swapchain image descriptors on onResize #171
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#171
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Sponza, SponzaBench, RTVolume and VulkanTriangle write
window.imageViews[]into their descriptor heaps once, at start-up, and none of them listens towindow.onResize.Windowrebuilds the swapchain, destroying the old images, on a resize, on an out-of-date acquire and on a suboptimal or out-of-date present, and firesonResizeso that passes holding those descriptors can rewrite them (interfaces/Crafter.Graphics-Window.cppm:82-85). After a rebuild, these examples' raygen writes through descriptors of destroyed images. Line numbers refer to670df31.Details
examples/Sponza/main.cpp:194Render(), thenStartSync()(:274-275)examples/RTVolume/main.cpp:189:231-232)examples/VulkanTriangle/main.cpp:122-134:215-216)examples/SponzaBench/main.cpp:207Render()(:254,:262)implementations/Crafter.Graphics-Window.cpp:1269-1278: an out-of-date acquire rebuilds the swapchain, firesonResizeand goes on to record the passes in the sameRender.:1462-1472: a suboptimal or out-of-date present rebuilds it too. Mesa's Wayland WSI reports suboptimal when the compositor's dmabuf feedback changes, which going fullscreen can do.So SponzaBench can fault mid-run, and the one-frame examples fault if their single acquire is out of date. The one-frame examples also never draw again, so a resized window shows a stale or undefined frame. That may be fine for a static scene, but these are the examples people copy, and they teach the missing
onResizealong with it.Found by reading the code; not reproduced.
Suggested fix
In each example, move the swapchain descriptor writes into a function and call it from an
onResizelistener as well, asUIRendererdoes for its own descriptors. For the one-frame examples, also render again after a resize, orStartUpdate, so the window shows the scene at its new size.Also, while in Sponza:
examples/Sponza/raygen.glsl:11-12still says its spec constant is "shared with closesthit.glsl". Since6e94cc6closesthit'sconstant_id = 0is the albedo's image slot, and the host passes each stage its own constants (main.cpp:87-113), so only the comment is wrong.