Compare commits

..

6 Commits

Author SHA1 Message Date
hyde zhou 47ebc462e5 bump version to 4.0.0-alpha.35 (#353) 2026-09-20 17:33:35 +08:00
Tianze-Chen b4bea55859 fix(label): abnormal font display when label text is too long (#348)
A very long label string (e.g. 8000+ characters) makes the text layout
canvas exceed MAX_SIZE, so the font is meant to be scaled down by the
shrink ratio. Clamping _fontScale to a minimum of 1 defeated that
downscale and the text displayed abnormally; lower the floor to 0.1 so
the font can shrink with the canvas.

Fixes #344

Co-authored-by: ctz <ctz@ctzdeMacBook-Air.local>
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-09-20 17:27:24 +08:00
Cocos Robot 82f13c86e9 [ci skip][AUTO]: Automated clang-format update: d67d6ac324 (#341) (#342)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2026-09-20 17:22:37 +08:00
zxx43 0fd910220e reset bone.active after updateCache (#340)
* reset bone.active after updateCache

* upload version
2026-09-20 10:13:12 +08:00
MagicX 557b06f7e6 fix(scene): LOD screen usage distance truncated to int (native platform) (#343)
* Changed the GeometryRenderer and DebugRenderer from using intrusive calls to registering callbacks (custom pipeline).

* Changed the GeometryRenderer and DebugRenderer from using intrusive calls to registering callbacks. (old pipeline)

* CI error: Function parameter names cannot be omitted.

* Move the devil string to macro

* fix(mesh): hoose index format by max index value in createMesh

* perf(pipeline): reduce render queue sort to two packed key compares (native platform).

* fix CI error caused by native/cocos/base/Utils.h

* fix(scene): LOD screen usage distance truncated to int (native platform)
2026-09-17 18:59:26 +08:00
MagicX b46553e615 perf(pipeline): reduce render queue sort to two packed key compares (native platform). (#341)
* Changed the GeometryRenderer and DebugRenderer from using intrusive calls to registering callbacks (custom pipeline).

* Changed the GeometryRenderer and DebugRenderer from using intrusive calls to registering callbacks. (old pipeline)

* CI error: Function parameter names cannot be omitted.

* Move the devil string to macro

* fix(mesh): hoose index format by max index value in createMesh

* perf(pipeline): reduce render queue sort to two packed key compares (native platform).

* fix CI error caused by native/cocos/base/Utils.h
2026-09-17 09:35:05 +08:00
9 changed files with 77 additions and 33 deletions
+1 -1
View File
@@ -115,7 +115,7 @@ export class TextProcessing {
const maxValue = Math.max(outputLayoutData.canvasSize.width, outputLayoutData.canvasSize.height);
const canvasScaleToMaxSizeRatio = MAX_SIZE / maxValue;
this._fontScale *= canvasScaleToMaxSizeRatio;
this._fontScale = Math.max(1, this._fontScale);
this._fontScale = Math.max(0.1, this._fontScale);
}
this._updatePaddingRect(style, outputLayoutData);
+20 -2
View File
@@ -30,6 +30,7 @@
#include <bitset>
#include <cerrno>
#include <climits>
#include <cstring>
#include <limits>
#include "base/Macros.h"
#include "base/TypeDef.h"
@@ -145,10 +146,27 @@ CC_FORCE_INLINE Tgt bit_cast(const Src &src) { // NOLINT(readability-identifier-
Tgt tgt;
// Load src into registers first. This allows the memcpy to be elided by CUDA.
const Src staged = src;
memcpy(&tgt, &staged, sizeof(Tgt));
std::memcpy(&tgt, &staged, sizeof(Tgt));
return tgt;
}
// Map a float to a uint32 whose unsigned-integer ordering matches the float's
// numeric ordering (the classic radix-sort "flip"):
// * non-negative: flip the sign bit
// * negative: complement all bits
// This maps [-inf, -0.0] to [0, 2^31) and [+0.0, +inf] to [2^31, 2^32), so the
// unsigned comparison orders floats correctly. NaN must be excluded by the caller.
//
// Requires IEEE 754 binary32 (32-bit) floats, which every Cocos platform has.
static_assert(sizeof(float) == sizeof(uint32_t), "float must be 32-bit");
static_assert(std::numeric_limits<float>::is_iec559, "float must be IEEE 754");
CC_FORCE_INLINE uint32_t floatToSortableUint(float value) {
constexpr uint32_t signBit = 0x80000000U;
const auto bits = bit_cast<uint32_t>(value);
return (bits & signBit) ? ~bits : (bits ^ signBit);
}
} // namespace numext
// Following the Arm ACLE arm_neon.h should also include arm_fp16.h but not all
@@ -164,7 +182,7 @@ struct HalfRaw {
#if defined(CC_HAS_ARM64_FP16_SCALAR_ARITHMETIC)
explicit HalfRaw(uint16_t raw) : x(numext::bit_cast<__fp16>(raw)) {
}
__fp16 x;
__fp16 x; // NOLINT(modernize-use-default-member-init)
#else
explicit constexpr HalfRaw(uint16_t raw) : x(raw) {}
uint16_t x; // NOLINT(modernize-use-default-member-init)
@@ -751,7 +751,19 @@ void SpineSkeletonInstance::resizeSlotRegion(const spine::String &slotName, uint
releaseSlotCacheInfo(cacheInfo);
}
_slotTextureSet.put(slot, info);
auto &bones = _skeleton->getBones();
const size_t boneCount = bones.size();
std::vector<bool> activeBackup(boneCount);
for (size_t i = 0; i < boneCount; ++i) {
activeBackup[i] = bones[i]->isActive();
}
_skeleton->updateCache();
for (size_t i = 0; i < boneCount; ++i) {
bones[i]->setActive(activeBackup[i]);
}
}
void SpineSkeletonInstance::setSlotTexture(const spine::String &slotName, const spine::String& textureUuid) {
+15 -24
View File
@@ -73,6 +73,15 @@ struct CC_DLL RenderPass {
uint32_t hash = 0;
float depth = 0.0F;
uint32_t shaderID = 0;
/**
* Packed sort keys, computed once in RenderQueue::insertRenderPass so the
* comparator degenerates to a single uint64 compare.
* opaque: primaryKey = hash, secondaryKey = depthKey << 32 | shaderID
* transparent: primaryKey = priority << 32 | hash, secondaryKey = ~depthKey << 32 | shaderID
* depthKey is the order-preserving uint32 mapping of depth.
*/
uint64_t primaryKey = 0;
uint64_t secondaryKey = 0;
uint32_t passIndex = 0;
const scene::SubModel *subModel = nullptr;
};
@@ -175,35 +184,17 @@ using RenderQueueDescList = ccstd::vector<IntrusivePtr<RenderQueueDesc>>;
uint32_t getPhaseID(const ccstd::string &phase);
inline bool opaqueCompareFn(const RenderPass &a, const RenderPass &b) {
if (a.hash != b.hash) {
return a.hash < b.hash;
if (a.primaryKey != b.primaryKey) {
return a.primaryKey < b.primaryKey;
}
CC_ASSERT(!std::isnan(a.depth) && !std::isnan(b.depth));
if (a.depth != b.depth) {
return a.depth < b.depth;
}
return a.shaderID < b.shaderID;
return a.secondaryKey < b.secondaryKey;
}
inline bool transparentCompareFn(const RenderPass &a, const RenderPass &b) {
if (a.priority != b.priority) {
return a.priority < b.priority;
if (a.primaryKey != b.primaryKey) {
return a.primaryKey < b.primaryKey;
}
if (a.hash != b.hash) {
return a.hash < b.hash;
}
CC_ASSERT(!std::isnan(a.depth) && !std::isnan(b.depth));
if (a.depth != b.depth) {
return b.depth < a.depth;
}
return a.shaderID < b.shaderID;
return a.secondaryKey < b.secondaryKey;
}
inline uint32_t convertPhase(const ccstd::vector<ccstd::string> &stages) {
+24 -1
View File
@@ -24,10 +24,12 @@
#include "RenderQueue.h"
#include <cmath>
#include <utility>
#include "PipelineSceneData.h"
#include "PipelineStateManager.h"
#include "RenderPipeline.h"
#include "base/Utils.h"
#include "gfx-base/GFXCommandBuffer.h"
#include "gfx-base/GFXDevice.h"
#include "gfx-base/GFXShader.h"
@@ -60,7 +62,28 @@ bool RenderQueue::insertRenderPass(const RenderObject &renderObj, uint32_t subMo
auto shaderId = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(subModel->getShader(passIdx)));
const auto hash = (0 << 30) | (passPriority << 16) | (modelPriority << 8) | passIdx;
const auto priority = renderObj.model->getPriority();
RenderPass renderPass = {priority, hash, renderObj.depth, shaderId, passIdx, subModel};
RenderPass renderPass{};
renderPass.priority = priority;
renderPass.hash = hash;
renderPass.depth = renderObj.depth;
renderPass.shaderID = shaderId;
renderPass.passIndex = passIdx;
renderPass.subModel = subModel;
/**
* Pack the sort keys once here so the comparator only compares uint64 keys.
* secondaryKey: depthKey << 32 | shaderID (transparent inverts depth for back-to-front).
*/
CC_ASSERT(!std::isnan(renderObj.depth));
const uint32_t depthKey = utils::numext::floatToSortableUint(renderObj.depth);
if (isTransparent) {
const uint32_t invertedDepthKey = ~depthKey;
renderPass.primaryKey = (static_cast<uint64_t>(priority) << 32) | hash;
renderPass.secondaryKey = (static_cast<uint64_t>(invertedDepthKey) << 32) | shaderId;
} else {
renderPass.primaryKey = hash;
renderPass.secondaryKey = (static_cast<uint64_t>(depthKey) << 32) | shaderId;
}
_queue.emplace_back(renderPass);
return true;
+1 -1
View File
@@ -60,7 +60,7 @@ float LODGroup::getScreenUsagePercentage(const Camera *camera) const {
return 0;
}
auto distance = 0;
float distance = 0.0F;
if (camera->getProjectionType() == CameraProjection::PERSPECTIVE) {
Vec3 tmp{_localBoundaryCenter};
tmp.transformMat4(_node->getWorldMatrix());
+1 -1
View File
@@ -3,6 +3,6 @@
"type": "github",
"owner": "cocos",
"name": "cocos-engine-external",
"checkout": "v4.0.0-9"
"checkout": "v4.0.0-10"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.34",
"version": "4.0.0-alpha.35",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cocos-creator",
"version": "4.0.0-alpha.34",
"version": "4.0.0-alpha.35",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.34",
"version": "4.0.0-alpha.35",
"description": "Cocos Creator is a cross-platform 2D & 3D game engine written in C++ and TypeScript, licensed under MIT.",
"homepage": "http://www.cocos.com",
"license": "MIT",