Merge branch 'main' into feat/llm-chat-tab
C++ / fmt (pull_request) Failing after 29s
C++ / build (pull_request) Failing after 33s
C++ / clang-tidy (pull_request) Failing after 11s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 28s
Rust / build (pull_request) Successful in 51s
Python / verify (pull_request) Successful in 1m36s
Rust / fmt (pull_request) Successful in 43s
Rust / clippy (pull_request) Successful in 1m4s
C++ / fmt (pull_request) Failing after 29s
C++ / build (pull_request) Failing after 33s
C++ / clang-tidy (pull_request) Failing after 11s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 28s
Rust / build (pull_request) Successful in 51s
Python / verify (pull_request) Successful in 1m36s
Rust / fmt (pull_request) Successful in 43s
Rust / clippy (pull_request) Successful in 1m4s
This commit is contained in:
@@ -189,6 +189,9 @@ void BlobGroup2::ensureDataBuilt() {
|
||||
|
||||
const int count = static_cast<int>(m_data.rects.size());
|
||||
|
||||
// Which shape is the source for the bar edge.
|
||||
resolveSources(entryShapes);
|
||||
|
||||
// Exclusion gates only the smooth blend.
|
||||
for (int i = 0; i < count; ++i) {
|
||||
int mask = 0;
|
||||
@@ -251,8 +254,8 @@ void BlobGroup2::ensureDataBuilt() {
|
||||
ri.radius[3] = std::max(ri.radius[3] * fTl, minR);
|
||||
}
|
||||
|
||||
// Inverted rect. The frame term is evaluated for every pixel in the bounds,
|
||||
// so the group flag cannot be gated per shape.
|
||||
// Inverted rect. The frame term is evaluated for every pixel in the bounds, so the
|
||||
// group flag cannot be gated per shape.
|
||||
if (!m_invertedRect) return;
|
||||
|
||||
auto* inv = static_cast<BlobShape2*>(m_invertedRect);
|
||||
@@ -299,6 +302,28 @@ void BlobGroup2::ensureDataBuilt() {
|
||||
2.0 * (static_cast<double>(outerHH) + extent)));
|
||||
}
|
||||
|
||||
// A point on the bar edge can only have one source. A shape that is not pushing is not
|
||||
// the source: it still fills its own area, but inside the border strip it must not add
|
||||
// its own outline to a span another shape is already shaping. That is the case that
|
||||
// matters — one panel at rest next to one that is bouncing — where the edge showed
|
||||
// several steps instead of one smooth indent of the closing panel. Only one shape can be
|
||||
// pushing at a time, so the flag is just that, and the shader gates the strip with it.
|
||||
void BlobGroup2::resolveSources(const QVector<BlobShape2*>& entryShapes) {
|
||||
const int count = static_cast<int>(m_data.rects.size());
|
||||
|
||||
// With nothing pushing there is no span being shaped, so a shape at rest keeps its
|
||||
// own outline and nothing is gated.
|
||||
bool anyPushing = false;
|
||||
for (int i = 0; i < count; ++i)
|
||||
if (entryShapes[i]->isMoving()) {
|
||||
anyPushing = true;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
m_data.rects[i].source = !anyPushing || entryShapes[i]->isMoving();
|
||||
}
|
||||
|
||||
void BlobGroup2::fillMaterial(BlobMaterial* material) {
|
||||
material->m_paddedX = static_cast<float>(m_bounds.x());
|
||||
material->m_paddedY = static_cast<float>(m_bounds.y());
|
||||
|
||||
@@ -22,9 +22,11 @@ class BlobInvertedRect2;
|
||||
// disagree with the first. That is what makes overlapping shapes read as one
|
||||
// surface - one value, one writer, one alpha per pixel.
|
||||
struct BlobGroupData {
|
||||
// The shader reads rectData[80] = 16 entries, and excludeMask is a 32-bit
|
||||
// mask. The shared list is capped at 16, in group order, so the cap is the
|
||||
// same list for every pixel.
|
||||
// The shader reads rectData[80] = 16 entries of 5 vec4, and excludeMask is a
|
||||
// 32-bit mask. The shared list is capped at 16, in group order, so the cap is the
|
||||
// same list for every pixel. Each entry is either a source for its span or not; the
|
||||
// flag is in the third vec4 alongside the screen half-extents, so no extra data is
|
||||
// needed.
|
||||
static constexpr int kMaxRects = 16;
|
||||
|
||||
QVector<BlobRectData> rects;
|
||||
@@ -109,6 +111,7 @@ class BlobGroup2 : public QQuickItem {
|
||||
private:
|
||||
void ensurePhysicsUpdated();
|
||||
void ensureDataBuilt();
|
||||
void resolveSources(const QVector<BlobShape2*>& entryShapes);
|
||||
void fillMaterial(BlobMaterial* material);
|
||||
|
||||
qreal m_smoothing = 32.0;
|
||||
|
||||
@@ -92,7 +92,12 @@ bool BlobMaterialShader::updateUniformData(
|
||||
memcpy(&maskAsFloat, &r.excludeMask, sizeof(float));
|
||||
const float d0[4] = {r.cx, r.cy, r.hw, r.hh};
|
||||
const float d1[4] = {maskAsFloat, r.offsetX, r.offsetY, r.minEig};
|
||||
const float d3[4] = {r.screenHalfX, r.screenHalfY, 0.0f, 0.0f};
|
||||
const float d3[4] = {
|
||||
r.screenHalfX,
|
||||
r.screenHalfY,
|
||||
r.source ? 1.0f : 0.0f,
|
||||
0.0f,
|
||||
};
|
||||
memcpy(buf->data() + base, d0, 16);
|
||||
memcpy(buf->data() + base + 16, d1, 16);
|
||||
memcpy(buf->data() + base + 32, r.invDeform, 16);
|
||||
|
||||
@@ -17,6 +17,11 @@ struct BlobRectData {
|
||||
// Bitmask of indices in this rect's m_cachedRects that mutually exclude (or are excluded by) this rect.
|
||||
// Used by the shader to skip smin between excluded pairs.
|
||||
int excludeMask = 0;
|
||||
// Whether this entry is pushing on the bar edge. Only the shape that is pushing can
|
||||
// shape the edge; a shape at rest still fills its own area, but the shader gives it
|
||||
// no contribution inside the border strip, so it cannot add its own outline to a span
|
||||
// another shape is shaping.
|
||||
bool source = true;
|
||||
};
|
||||
|
||||
class BlobMaterial : public QSGMaterial {
|
||||
|
||||
@@ -71,6 +71,9 @@ class BlobRect2 : public BlobShape2 {
|
||||
|
||||
bool isExcluded(const BlobShape2* other) const override;
|
||||
bool isCornerExcluded(const BlobShape2* other) const override;
|
||||
// The shape that is pushing is the one that can shape the bar edge. A shape that is
|
||||
// retiring still counts, because the retire curve is still moving the surface.
|
||||
bool isMoving() const override { return m_physicsActive || m_retiring; }
|
||||
void cornerRadii(float out[4]) const override;
|
||||
|
||||
[[nodiscard]] qreal topLeftRadius() const { return m_topLeftRadius; }
|
||||
|
||||
@@ -56,6 +56,10 @@ class BlobShape2 : public QQuickItem {
|
||||
|
||||
virtual bool isExcluded(const BlobShape2*) const { return false; }
|
||||
|
||||
// Whether this shape is currently pushing on a border. Only the shape that is pushing
|
||||
// can shape the bar edge, so this decides the source flag.
|
||||
virtual bool isMoving() const { return false; }
|
||||
|
||||
virtual bool isCornerExcluded(const BlobShape2* /*other*/) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,19 @@ float smaxSharpA(float a, float b, float k) {
|
||||
void main() {
|
||||
vec2 pixel = vec2(paddedX, paddedY) + qt_TexCoord0 * vec2(paddedW, paddedH);
|
||||
|
||||
// The frame distances are needed before the per-rect pass. In the border strip the
|
||||
// boundary is the frame, displaced only by the shape that is pushing, so a shape that
|
||||
// is not the source must not define the boundary there. It still fills the inner area,
|
||||
// so this only gates the strip, which is the bar edge.
|
||||
float dOuter = 0.0;
|
||||
float dInner = 0.0;
|
||||
bool inStrip = false;
|
||||
if (hasInverted != 0) {
|
||||
dOuter = sdBox(pixel, invertedOuter.xy, invertedOuter.zw) - 1.0;
|
||||
dInner = sdRoundedBox(pixel, invertedInner.xy, invertedInner.zw, invertedRadius);
|
||||
inStrip = dOuter < 0.0 && dInner > 0.0;
|
||||
}
|
||||
|
||||
// Phase 1: compute per-rect SDF, and track which rect owns the pixel for the
|
||||
// per-shape path (BlobGroup). The single group draw (BlobGroup2) has no owner:
|
||||
// myIndex stays -2, so the ownership test is skipped and this pass writes every
|
||||
@@ -78,10 +91,17 @@ void main() {
|
||||
vec4 props =
|
||||
rectData[i * 5 + 1]; // excludeMask(int bits), offsetX, offsetY, minEig
|
||||
vec4 invDm = rectData[i * 5 + 2]; // inverse deform matrix
|
||||
vec4 sh = rectData[i * 5 + 3]; // screenHalfX, screenHalfY, 0, 0
|
||||
vec4 sh = rectData[i * 5 + 3]; // screenHalfX, screenHalfY, isSource, 0
|
||||
vec4 radii =
|
||||
rectData[i * 5 + 4]; // effective per-corner radii (tr, br, bl, tl)
|
||||
|
||||
// A shape that is not pushing does not shape the bar edge, so inside the strip it
|
||||
// must not add its own outline to a span another shape is already shaping.
|
||||
if (inStrip && sh.z < 0.5) {
|
||||
dArr[i] = 1e10;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Offset center for asymmetric deformation
|
||||
vec2 center = rect.xy + props.yz;
|
||||
|
||||
@@ -182,10 +202,6 @@ void main() {
|
||||
}
|
||||
|
||||
if (hasInverted != 0) {
|
||||
float dOuter = sdBox(pixel, invertedOuter.xy, invertedOuter.zw) - 1.0;
|
||||
float dInner =
|
||||
sdRoundedBox(pixel, invertedInner.xy, invertedInner.zw, invertedRadius);
|
||||
|
||||
// Border sinks: track the opposite rect edge, clamped to border thickness
|
||||
float innerTop = invertedInner.y - invertedInner.w;
|
||||
float innerBot = invertedInner.y + invertedInner.w;
|
||||
@@ -198,6 +214,10 @@ void main() {
|
||||
|
||||
float sinkValue = 0.0;
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
// Only a shape that is pushing can move the border.
|
||||
if (rectData[i * 5 + 3].z < 0.5)
|
||||
continue;
|
||||
|
||||
vec4 rect = rectData[i * 5];
|
||||
vec4 sinkProps = rectData[i * 5 + 1];
|
||||
vec2 sinkSh = rectData[i * 5 + 3].xy;
|
||||
@@ -208,7 +228,7 @@ void main() {
|
||||
// Delay sink to absorb smin blend depth (cubic smin max = k/6)
|
||||
float preOff = smoothFactor * (1.0 / 6.0);
|
||||
|
||||
// Top border: track rect's BOTTOM edge, only within border thickness
|
||||
// Top border: track rect's BOTTOM edge, clamped to border thickness
|
||||
float topPen = clamp(innerTop - (ctr.y + sinkSh.y) - preOff, 0.0,
|
||||
innerTop - outerTop);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user