Merge remote-tracking branch 'origin/master' into claude/issue-47

# Conflicts:
#	interfaces/Crafter.Graphics-UI.cppm
#	project.cpp
This commit is contained in:
catbot 2026-06-16 17:09:06 +00:00
commit e8f1c7cff9
15 changed files with 732 additions and 39 deletions

View file

@ -27,10 +27,19 @@ struct UIDispatchHeader {
vec4 clipRectPx; // (xy, wh) — every standard shader honors this
uint itemCount;
uint frameIdx;
uint flags; // user-defined feature bits
uint flags; // feature bits — high bit reserved by the renderer
uint _pad; // reserved — keep zeroed
};
// ─── header flag bits ───────────────────────────────────────────────────
// `flags` is otherwise free for user-defined feature bits, but the renderer
// reserves the high bit: UI_FLAG_CLIP is set by UIRenderer::FillHeader when
// the clip rect does not already cover the whole surface. uiResolveScreenPixel
// gates its four clipRectPx compares on this bit so the overwhelmingly common
// full-surface case (clipRect == {0,0,1e9,1e9}) skips them entirely. The
// branch is push-constant-uniform across the dispatch, so it never diverges.
const uint UI_FLAG_CLIP = 0x80000000u;
// ─── standard item structs ──────────────────────────────────────────────
// These match the C++ Crafter::QuadItem / CircleItem / ImageItem / GlyphItem
// byte-for-byte under std430.
@ -121,9 +130,11 @@ QuadItem LoadQuadItem(uint heap, uint i) {
bool uiResolveScreenPixel(UIDispatchHeader hdr, out ivec2 screenPx) {
uvec2 px = gl_GlobalInvocationID.xy;
if (px.x >= hdr.surfaceSize.x || px.y >= hdr.surfaceSize.y) return false;
if (float(px.x) < hdr.clipRectPx.x || float(px.y) < hdr.clipRectPx.y) return false;
if (float(px.x) >= hdr.clipRectPx.x + hdr.clipRectPx.z) return false;
if (float(px.y) >= hdr.clipRectPx.y + hdr.clipRectPx.w) return false;
if ((hdr.flags & UI_FLAG_CLIP) != 0u) {
if (float(px.x) < hdr.clipRectPx.x || float(px.y) < hdr.clipRectPx.y) return false;
if (float(px.x) >= hdr.clipRectPx.x + hdr.clipRectPx.z) return false;
if (float(px.y) >= hdr.clipRectPx.y + hdr.clipRectPx.w) return false;
}
screenPx = ivec2(px);
return true;
}