Skip to content

Commit 392474e

Browse files
committed
test ci
1 parent 18456b6 commit 392474e

257 files changed

Lines changed: 3227 additions & 3332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

native/cocos/2d/renderer/Batcher2d.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ int32_t sorting2DCount{0};
4040

4141
CC_FORCE_INLINE void fillIndexBuffers(RenderDrawInfo* drawInfo) { // NOLINT(readability-convert-member-functions-to-static)
4242
uint16_t* ib = drawInfo->getIDataBuffer();
43-
43+
4444
UIMeshBuffer* buffer = drawInfo->getMeshBuffer();
4545
uint32_t indexOffset = buffer->getIndexOffset();
46-
46+
4747
uint16_t* indexb = drawInfo->getIbBuffer();
4848
uint32_t indexCount = drawInfo->getIbCount();
49-
49+
5050
memcpy(&ib[indexOffset], indexb, indexCount * sizeof(uint16_t));
5151
indexOffset += indexCount;
52-
52+
5353
buffer->setIndexOffset(indexOffset);
5454
}
5555

@@ -83,17 +83,17 @@ CC_FORCE_INLINE void fillColor(RenderEntity* entity, RenderDrawInfo* drawInfo) {
8383
uint32_t size = drawInfo->getVbCount() * stride;
8484
float* vbBuffer = drawInfo->getVbBuffer();
8585
Color temp = entity->getColor();
86-
86+
8787
uint32_t offset = 0;
8888
for (int i = 0; i < size; i += stride) {
8989
offset = i + 5;
9090
// NOTE: Only support RGBA32F (4 floats) color fomat now.
9191
// Spine set 'UIRenderer._useVertexOpacity = true', it uses RGBA32 (4 bytes) color and fills color in Skeleton._updateColor and spine/simple.ts assembler.
9292
// So for Spine rendering, it will never go here to fill color.
9393
vbBuffer[offset] = static_cast<float>(temp.r) / 255.0F;
94-
vbBuffer[offset+1] = static_cast<float>(temp.g) / 255.0F;
95-
vbBuffer[offset+2] = static_cast<float>(temp.b) / 255.0F;
96-
vbBuffer[offset+3] = entity->getOpacity();
94+
vbBuffer[offset + 1] = static_cast<float>(temp.g) / 255.0F;
95+
vbBuffer[offset + 2] = static_cast<float>(temp.b) / 255.0F;
96+
vbBuffer[offset + 3] = entity->getOpacity();
9797
}
9898
}
9999

@@ -110,7 +110,7 @@ Batcher2d::Batcher2d(Root* root)
110110
_root = root;
111111
_device = _root->getDevice();
112112
_stencilManager = StencilManager::getInstance();
113-
113+
114114
_recordedRendererInfoQueue.reserve(100);
115115
}
116116

@@ -138,7 +138,7 @@ Batcher2d::~Batcher2d() { // NOLINT
138138
_maskAttributes.clear();
139139
}
140140

141-
ccstd::vector<RecordedRendererInfo> &Batcher2d::getRecordedRendererInfoQueue() {
141+
ccstd::vector<RecordedRendererInfo>& Batcher2d::getRecordedRendererInfoQueue() {
142142
return _recordedRendererInfoQueue;
143143
}
144144

@@ -170,11 +170,11 @@ void Batcher2d::fillBuffersAndMergeBatches() {
170170
for (auto* rootNode : _rootNodeArr) {
171171
// _batches will add by generateBatch
172172
walk(rootNode, 1, false);
173-
173+
174174
if (ENABLE_SORTING_2D && sorting2DCount > 0) {
175175
flushRecordedUIRenderers();
176176
}
177-
177+
178178
generateBatch(_currEntity, _currDrawInfo);
179179

180180
auto* scene = rootNode->getScene()->getRenderScene();
@@ -186,7 +186,7 @@ void Batcher2d::fillBuffersAndMergeBatches() {
186186
}
187187
}
188188

189-
void Batcher2d::handleUIRenderer(RenderEntity *entity) { // NOLINT(misc-no-recursion)
189+
void Batcher2d::handleUIRenderer(RenderEntity* entity) { // NOLINT(misc-no-recursion)
190190
uint32_t size = entity->getRenderDrawInfosSize();
191191
for (uint32_t i = 0; i < size; i++) {
192192
auto* drawInfo = entity->getRenderDrawInfoAt(i);
@@ -195,25 +195,25 @@ void Batcher2d::handleUIRenderer(RenderEntity *entity) { // NOLINT(misc-no-recur
195195
entity->setVBColorDirty(false);
196196
}
197197

198-
int32_t Batcher2d::recordUIRenderer(RenderEntity *entity) {
198+
int32_t Batcher2d::recordUIRenderer(RenderEntity* entity) {
199199
if (!ENABLE_SORTING_2D) return -1;
200-
auto &queue = getRecordedRendererInfoQueue();
201-
auto &info = queue.emplace_back();
200+
auto& queue = getRecordedRendererInfoQueue();
201+
auto& info = queue.emplace_back();
202202
info.renderEntity = entity;
203203
return static_cast<int32_t>(queue.size() - 1);
204204
}
205205

206206
void Batcher2d::flushRecordedUIRenderers() { // NOLINT(misc-no-recursion)
207207
if (!ENABLE_SORTING_2D) return;
208-
auto &queue = getRecordedRendererInfoQueue();
208+
auto& queue = getRecordedRendererInfoQueue();
209209
if (queue.empty()) return;
210210

211-
std::stable_sort(queue.begin(), queue.end(), [](const auto &a, const auto &b){
211+
std::stable_sort(queue.begin(), queue.end(), [](const auto& a, const auto& b) {
212212
return a.renderEntity->getPriority() < b.renderEntity->getPriority();
213213
});
214214

215-
for (const auto &info : queue) {
216-
auto *entity = info.renderEntity;
215+
for (const auto& info : queue) {
216+
auto* entity = info.renderEntity;
217217
if (entity) {
218218
handleUIRenderer(entity);
219219
}
@@ -227,13 +227,13 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
227227
}
228228
bool breakWalk = false;
229229
auto* entity = static_cast<RenderEntity*>(node->getUserData());
230-
230+
231231
const bool isCurrentColorDirty = node->_isColorDirty() || parentColorDirty;
232232
const float localOpacity = node->_getLocalOpacity();
233233
// Keep the same logic as which in batcher-2d.ts
234234
const float finalOpacity = parentOpacity * localOpacity * (entity ? entity->getColorAlpha() : 1.F);
235235
node->_setFinalOpacity(finalOpacity);
236-
236+
237237
const bool visible = math::isNotEqualF(finalOpacity, 0);
238238

239239
if (entity) {
@@ -244,7 +244,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
244244
entity->setOpacity(finalOpacity);
245245
entity->setVBColorDirty(true);
246246
}
247-
247+
248248
if (ENABLE_SORTING_2D && sorting2DCount > 0) {
249249
if (entity->getIsMask()) {
250250
flushRecordedUIRenderers();
@@ -257,7 +257,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
257257
handleUIRenderer(entity);
258258
}
259259
}
260-
260+
261261
if (entity->getRenderEntityType() == RenderEntityType::CROSSED) {
262262
breakWalk = true;
263263
}
@@ -271,7 +271,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
271271
walk(child, thisOpacity, isCurrentColorDirty);
272272
}
273273
}
274-
274+
275275
if (isCurrentColorDirty) {
276276
node->_setColorDirty(false);
277277
}
@@ -283,7 +283,7 @@ void Batcher2d::walk(Node* node, float parentOpacity, bool parentColorDirty) { /
283283
flushRecordedUIRenderers();
284284
}
285285
}
286-
286+
287287
if (visible && _stencilManager->getMaskStackSize() > 0) {
288288
handlePostRender(entity);
289289
}
@@ -521,7 +521,7 @@ void Batcher2d::generateBatch(RenderEntity* entity, RenderDrawInfo* drawInfo) {
521521
curdrawBatch->setFirstIndex(indexOffset);
522522
curdrawBatch->setIndexCount(indexCount);
523523
curdrawBatch->fillPass(_currMaterial, depthStencil, dssHash);
524-
const auto &passes = curdrawBatch->getPasses();
524+
const auto& passes = curdrawBatch->getPasses();
525525
if (!passes.empty()) {
526526
const auto& pass = passes.at(0);
527527
if (entity->getUseLocal()) {

native/cocos/2d/renderer/Batcher2d.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ using UIMeshBufferArray = ccstd::vector<UIMeshBuffer*>;
4141
using UIMeshBufferMap = ccstd::unordered_map<uint16_t, UIMeshBufferArray>;
4242

4343
struct RecordedRendererInfo {
44-
RenderEntity *renderEntity{nullptr};
44+
RenderEntity* renderEntity{nullptr};
4545
};
4646

4747
class Batcher2d final {
4848
public:
4949
static void setSorting2DCount(int32_t v);
50-
50+
5151
Batcher2d();
5252
explicit Batcher2d(Root* root);
5353
~Batcher2d();
@@ -87,10 +87,10 @@ class Batcher2d final {
8787
void createClearModel();
8888

8989
gfx::DescriptorSet* getDescriptorSet(gfx::Texture* texture, gfx::Sampler* sampler, const gfx::DescriptorSetLayout* dsLayout);
90-
91-
ccstd::vector<RecordedRendererInfo> &getRecordedRendererInfoQueue();
92-
void handleUIRenderer(RenderEntity *entity);
93-
int32_t recordUIRenderer(RenderEntity *entity);
90+
91+
ccstd::vector<RecordedRendererInfo>& getRecordedRendererInfoQueue();
92+
void handleUIRenderer(RenderEntity* entity);
93+
int32_t recordUIRenderer(RenderEntity* entity);
9494
void flushRecordedUIRenderers();
9595

9696
StencilManager* _stencilManager{nullptr};
@@ -103,7 +103,7 @@ class Batcher2d final {
103103
// manage memory manually
104104
ccstd::vector<scene::DrawBatch2D*> _batches;
105105
memop::Pool<scene::DrawBatch2D> _drawBatchPool;
106-
106+
107107
ccstd::vector<RecordedRendererInfo> _recordedRendererInfoQueue;
108108

109109
// weak reference

native/cocos/2d/renderer/RenderDrawInfo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
#pragma once
2626
#include "2d/renderer/UIMeshBuffer.h"
27-
#include "base/Ptr.h"
2827
#include "base/Macros.h"
28+
#include "base/Ptr.h"
2929
#include "base/TypeDef.h"
3030
#include "bindings/utils/BindingUtils.h"
3131
#include "core/ArrayBuffer.h"
@@ -115,7 +115,7 @@ class RenderDrawInfo final {
115115
inline void setIsMeshBuffer(bool isMeshBuffer) {
116116
_drawInfoAttrs._isMeshBuffer = isMeshBuffer ? 1 : 0;
117117
}
118-
118+
119119
inline bool isVertexPositionInWorld() const {
120120
return _drawInfoAttrs._isVertexPositionInWorld != 0;
121121
}
@@ -262,9 +262,9 @@ class RenderDrawInfo final {
262262
struct DrawInfoAttrs {
263263
RenderDrawInfoType _drawInfoType{RenderDrawInfoType::COMP};
264264
bool _vertDirty{false};
265-
uint8_t _isMeshBuffer: 1;
266-
uint8_t _isVertexPositionInWorld: 1;
267-
uint8_t _padding: 6;
265+
uint8_t _isMeshBuffer : 1;
266+
uint8_t _isVertexPositionInWorld : 1;
267+
uint8_t _padding : 6;
268268
uint8_t _stride{0};
269269
uint16_t _bufferId{0};
270270
uint16_t _accId{0};

native/cocos/2d/renderer/RenderEntity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ RenderEntity::RenderEntity(RenderEntityType type) : _renderEntityType(type) {
3333
} else {
3434
ccnew_placement(&_dynamicDrawInfos) ccstd::vector<RenderDrawInfo*>();
3535
}
36-
36+
3737
_entityAttrLayout.enabledIndex = 0;
3838
_entityAttrLayout.useLocal = 0;
3939
_entityAttrLayout.paddings = 0;
40-
40+
4141
_entitySharedBufferActor.initialize(&_entityAttrLayout, sizeof(EntityAttrLayout));
4242
}
4343

native/cocos/2d/renderer/RenderEntity.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ enum class MaskMode : uint8_t {
4949
MASK_NODE_INVERTED
5050
};
5151

52-
enum class FillColorType: uint8_t {
52+
enum class FillColorType : uint8_t {
5353
COLOR = 0,
5454
VERTEX,
5555
};
@@ -62,9 +62,9 @@ struct EntityAttrLayout {
6262
uint8_t colorA{255};
6363
uint8_t maskMode{0};
6464
FillColorType fillColorType{FillColorType::COLOR};
65-
uint8_t enabledIndex: 1;
66-
uint8_t useLocal: 1;
67-
uint8_t paddings: 6;
65+
uint8_t enabledIndex : 1;
66+
uint8_t useLocal : 1;
67+
uint8_t paddings : 6;
6868
uint8_t paddings2{0};
6969
};
7070

@@ -99,7 +99,7 @@ class RenderEntity final : public Node::UserData {
9999
inline void setUseLocal(bool useLocal) {
100100
_entityAttrLayout.useLocal = useLocal;
101101
}
102-
102+
103103
inline FillColorType getFillColorType() const { return _entityAttrLayout.fillColorType; }
104104

105105
inline Node* getNode() const { return _node; }
@@ -142,7 +142,7 @@ class RenderEntity final : public Node::UserData {
142142
inline RenderDrawInfo* getRenderDrawInfoAt(uint32_t index) {
143143
return _renderEntityType == RenderEntityType::STATIC ? &(_staticDrawInfos[index]) : _dynamicDrawInfos[index];
144144
}
145-
145+
146146
inline uint32_t getPriority() const { return _entityAttrLayout.priority; }
147147

148148
private:
@@ -152,21 +152,21 @@ class RenderEntity final : public Node::UserData {
152152

153153
// weak reference
154154
Node* _renderTransform{nullptr};
155-
155+
156156
bindings::NativeMemorySharedToScriptActor _entitySharedBufferActor;
157157

158158
union {
159159
std::array<RenderDrawInfo, RenderEntity::STATIC_DRAW_INFO_CAPACITY> _staticDrawInfos;
160160
ccstd::vector<RenderDrawInfo*> _dynamicDrawInfos;
161161
};
162162
EntityAttrLayout _entityAttrLayout;
163-
163+
164164
StencilStage _stencilStage{StencilStage::DISABLED};
165165
RenderEntityType _renderEntityType{RenderEntityType::STATIC};
166166
uint8_t _staticDrawInfoSize{0};
167167
bool _vbColorDirty{true};
168168
uint8_t _paddings[1];
169-
169+
170170
float _opacity{1.0F};
171171
};
172172

native/cocos/2d/renderer/UIMeshBuffer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
****************************************************************************/
2424

2525
#pragma once
26-
#include "base/Ptr.h"
2726
#include "base/Macros.h"
27+
#include "base/Ptr.h"
2828
#include "base/TypeDef.h"
29-
#include "renderer/gfx-base/GFXInputAssembler.h"
30-
#include "renderer/gfx-base/GFXDef-common.h"
3129
#include "renderer/gfx-base/GFXBuffer.h"
30+
#include "renderer/gfx-base/GFXDef-common.h"
31+
#include "renderer/gfx-base/GFXInputAssembler.h"
3232

3333
namespace cc {
3434

native/cocos/2d/renderer/UIModelProxy.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ void UIModelProxy::activeSubModels() {
5858
auto* vertexBuffer = _device->createBuffer({
5959
gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST,
6060
gfx::MemoryUsageBit::DEVICE,
61-
65536 * _stride, // Uint16 can address 65536 vertices (indices 0–65535)
61+
65536 * _stride, // Uint16 can address 65536 vertices (indices 0–65535)
6262
_stride,
6363
});
6464
auto* indexBuffer = _device->createBuffer({
6565
gfx::BufferUsageBit::INDEX | gfx::BufferUsageBit::TRANSFER_DST,
6666
gfx::MemoryUsageBit::DEVICE,
67-
65536 * sizeof(uint16_t) * 2, // Uint16 can address 65536 vertices (indices 0–65535)
67+
65536 * sizeof(uint16_t) * 2, // Uint16 can address 65536 vertices (indices 0–65535)
6868
sizeof(uint16_t),
6969
});
7070
gfx::BufferList vbReference;
@@ -133,8 +133,8 @@ void UIModelProxy::clear() {
133133
return;
134134
}
135135
const auto& subModels = _model->getSubModels();
136-
for (const auto &subModel : subModels) {
137-
auto *ia = subModel->getInputAssembler();
136+
for (const auto& subModel : subModels) {
137+
auto* ia = subModel->getInputAssembler();
138138
ia->setVertexCount(0);
139139
ia->setIndexCount(0);
140140
}

native/cocos/3d/assets/Mesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,14 +531,14 @@ void Mesh::initialize() {
531531
uint32_t vertexCount = _struct.vertexBundles[prim.vertexBundelIndices[0]].view.count;
532532
#if CC_OPTIMIZE_MESH_DATA
533533
if (vertexCount <= 65536) { // Uint16 can address 65536 vertices (indices 0–65535)
534-
dstStride >>= 1; // Reduce to short.
534+
dstStride >>= 1; // Reduce to short.
535535
dstSize >>= 1;
536536
} else if (!gfxDevice->hasFeature(gfx::Feature::ELEMENT_INDEX_UINT)) {
537537
continue; // Ignore this primitive
538538
}
539539
#else
540540
if (!gfxDevice->hasFeature(gfx::Feature::ELEMENT_INDEX_UINT)) {
541-
if (vertexCount > 65536) { // Uint16 can address 65536 vertices (indices 0–65535)
541+
if (vertexCount > 65536) { // Uint16 can address 65536 vertices (indices 0–65535)
542542
CC_LOG_WARNING("Device does not support UINT element index type and vertexCount (%u) is larger than ushort", vertexCount);
543543
continue;
544544
}

native/cocos/3d/misc/CreateMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Mesh::ICreateInfo MeshUtils::createDynamicMeshInfo(const IDynamicGeometry &geome
310310
if (aOptions.has_value()) {
311311
options = aOptions.value();
312312
}
313-
313+
314314
gfx::AttributeList attributes;
315315
uint32_t stream = 0U;
316316

0 commit comments

Comments
 (0)