diff --git a/native/.clang-tidy b/native/.clang-tidy index 4eb2096e84..6bc579c740 100644 --- a/native/.clang-tidy +++ b/native/.clang-tidy @@ -1,6 +1,7 @@ --- # Here are the reasons for disabled checks: # +# -google-runtime-references # -misc-non-private-member-variables-in-classes # -modernize-avoid-c-arrays # Legacy reasons @@ -26,6 +27,7 @@ Checks: > portability-*, readability-*, + -google-runtime-references, -misc-non-private-member-variables-in-classes, -modernize-avoid-c-arrays, diff --git a/native/cocos/base/Agent.h b/native/cocos/base/Agent.h index 907afe7aef..062a8ba194 100644 --- a/native/cocos/base/Agent.h +++ b/native/cocos/base/Agent.h @@ -30,8 +30,6 @@ namespace cc { -static constexpr uint MAX_CPU_FRAME_AHEAD = 1U; - template class CC_DLL Agent : public Actor { public: diff --git a/native/cocos/base/Macros.h b/native/cocos/base/Macros.h index f33f8f3622..e46f09205f 100644 --- a/native/cocos/base/Macros.h +++ b/native/cocos/base/Macros.h @@ -169,20 +169,6 @@ It should work same as apples CFSwapInt32LittleToHost(..) #define CC_BREAK_IF(cond) \ if (cond) break -/** @def CC_DISALLOW_COPY_AND_ASSIGN(TypeName) -* A macro to disallow the copy constructor and operator= functions. -* This should be used in the private: declarations for a class -*/ -#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) || (defined(__clang__) && (__clang_major__ >= 3)) || (_MSC_VER >= 1800) - #define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName &) = delete; \ - TypeName &operator=(const TypeName &) = delete; -#else - #define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName &); \ - TypeName &operator=(const TypeName &); -#endif - /** @def CC_DEPRECATED_ATTRIBUTE * Only certain compilers support __attribute__((deprecated)). */ diff --git a/native/cocos/base/StringPool.h b/native/cocos/base/StringPool.h index fbb28a54d4..dc921b9d2a 100644 --- a/native/cocos/base/StringPool.h +++ b/native/cocos/base/StringPool.h @@ -105,7 +105,7 @@ StringHandle StringPool::find(const char *str) const noexcept { template inline StringHandle StringPool::doStringToHandle(const char *str) noexcept { - auto const it = _stringToHandles.find(str); + const auto it = _stringToHandles.find(str); if (it == _stringToHandles.end()) { size_t const strLength = strlen(str) + 1; diff --git a/native/cocos/base/TypeDef.h b/native/cocos/base/TypeDef.h index 07bce4f465..e937e1fe30 100755 --- a/native/cocos/base/TypeDef.h +++ b/native/cocos/base/TypeDef.h @@ -32,7 +32,10 @@ using ushort = uint16_t; using ulong = uint32_t; using FlagBits = uint32_t; -#define CC_ENUM_OPERATORS(T) \ +#define CC_ENUM_CONVERSION_OPERATOR(T) \ + inline std::underlying_type::type toNumber(const T v) { return static_cast::type>(v); } + +#define CC_ENUM_BITWISE_OPERATORS(T) \ inline T operator~(const T v) { return static_cast(~static_cast::type>(v)); } \ inline bool operator||(const T lhs, const T rhs) { return (static_cast::type>(lhs) || static_cast::type>(rhs)); } \ inline bool operator&&(const T lhs, const T rhs) { return (static_cast::type>(lhs) && static_cast::type>(rhs)); } \ @@ -58,4 +61,5 @@ using FlagBits = uint32_t; return (static_cast(flags) & static_cast(flagsToTest)) == static_cast(flagsToTest); \ } \ inline T addFlags(const T flags, const T flagsToAdd) { return (flags | flagsToAdd); } \ - inline T removeFlags(const T flags, const T flagsToRemove) { return (flags & ~flagsToRemove); } + inline T removeFlags(const T flags, const T flagsToRemove) { return (flags & ~flagsToRemove); } \ + CC_ENUM_CONVERSION_OPERATOR(T) diff --git a/native/cocos/base/threading/MessageQueue.cpp b/native/cocos/base/threading/MessageQueue.cpp index 14e7f6619a..8e2bc02d29 100644 --- a/native/cocos/base/threading/MessageQueue.cpp +++ b/native/cocos/base/threading/MessageQueue.cpp @@ -30,7 +30,6 @@ namespace cc { namespace { -uint32_t constexpr MEMORY_CHUNK_SIZE = 4096 * 16; uint32_t constexpr MEMORY_CHUNK_POOL_CAPACITY = 64; uint32_t constexpr SWITCH_CHUNK_MEMORY_REQUIREMENT = sizeof(MemoryChunkSwitchMessage) + sizeof(DummyMessage); } // namespace @@ -100,10 +99,6 @@ MessageQueue::MessageQueue() { --_reader.newMessageCount; } -uint32_t MessageQueue::getChunckSize() { - return MEMORY_CHUNK_SIZE; -} - void MessageQueue::kick() noexcept { pushMessages(); _event.signal(); @@ -148,7 +143,7 @@ void MessageQueue::terminateConsumerThread() noexcept { event.wait(); } -void MessageQueue::finishWriting(bool wait) noexcept { +void MessageQueue::finishWriting() noexcept { if (!_immediateMode) { bool *const flushingFinished = &_reader.flushingFinished; @@ -158,11 +153,7 @@ void MessageQueue::finishWriting(bool wait) noexcept { *flushingFinished = true; }); - if (wait) { - kickAndWait(); - } else { - kick(); - } + kick(); } } diff --git a/native/cocos/base/threading/MessageQueue.h b/native/cocos/base/threading/MessageQueue.h index 9f7cb8d6e1..63df31ffa9 100644 --- a/native/cocos/base/threading/MessageQueue.h +++ b/native/cocos/base/threading/MessageQueue.h @@ -87,14 +87,14 @@ struct alignas(64) ReaderContext final { // Both the messages and their submitting data should be allocated from here. class alignas(64) MessageQueue final { public: + static constexpr uint32_t MEMORY_CHUNK_SIZE = 4096 * 16; + MessageQueue(); ~MessageQueue() = default; MessageQueue(MessageQueue const &) = delete; MessageQueue(MessageQueue &&) = delete; MessageQueue &operator=(MessageQueue const &) = delete; MessageQueue &operator=(MessageQueue &&) = delete; - - static uint32_t getChunckSize(); // message allocation template @@ -118,11 +118,10 @@ public: void runConsumerThread() noexcept; void terminateConsumerThread() noexcept; - void finishWriting(bool wait) noexcept; + void finishWriting() noexcept; void flushMessages() noexcept; inline bool isImmediateMode() const noexcept { return _immediateMode; } - inline void finishWriting() noexcept { finishWriting(false); } void recycleMemoryChunk(uint8_t *chunk) const noexcept; static void freeChunksInFreeQueue(MessageQueue *mainMessageQueue) noexcept; diff --git a/native/cocos/bindings/auto/jsb_pipeline_auto.cpp b/native/cocos/bindings/auto/jsb_pipeline_auto.cpp index 848a4d7429..6d74cdc2f1 100644 --- a/native/cocos/bindings/auto/jsb_pipeline_auto.cpp +++ b/native/cocos/bindings/auto/jsb_pipeline_auto.cpp @@ -30,7 +30,7 @@ se::Object* __jsb_cc_pipeline_RenderQueueDesc_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderQueueDesc_class = nullptr; -static bool js_pipeline_RenderQueueDesc_get_isTransparent(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_get_isTransparent(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderQueueDesc_get_isTransparent : Invalid Native Object"); @@ -44,7 +44,7 @@ static bool js_pipeline_RenderQueueDesc_get_isTransparent(se::State& s) // NOLIN } SE_BIND_PROP_GET(js_pipeline_RenderQueueDesc_get_isTransparent) -static bool js_pipeline_RenderQueueDesc_set_isTransparent(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_set_isTransparent(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -57,7 +57,7 @@ static bool js_pipeline_RenderQueueDesc_set_isTransparent(se::State& s) // NOLIN } SE_BIND_PROP_SET(js_pipeline_RenderQueueDesc_set_isTransparent) -static bool js_pipeline_RenderQueueDesc_get_sortMode(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_get_sortMode(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderQueueDesc_get_sortMode : Invalid Native Object"); @@ -71,7 +71,7 @@ static bool js_pipeline_RenderQueueDesc_get_sortMode(se::State& s) // NOLINT(rea } SE_BIND_PROP_GET(js_pipeline_RenderQueueDesc_get_sortMode) -static bool js_pipeline_RenderQueueDesc_set_sortMode(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_set_sortMode(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -84,7 +84,7 @@ static bool js_pipeline_RenderQueueDesc_set_sortMode(se::State& s) // NOLINT(rea } SE_BIND_PROP_SET(js_pipeline_RenderQueueDesc_set_sortMode) -static bool js_pipeline_RenderQueueDesc_get_stages(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_get_stages(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderQueueDesc_get_stages : Invalid Native Object"); @@ -98,7 +98,7 @@ static bool js_pipeline_RenderQueueDesc_get_stages(se::State& s) // NOLINT(reada } SE_BIND_PROP_GET(js_pipeline_RenderQueueDesc_get_stages) -static bool js_pipeline_RenderQueueDesc_set_stages(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_set_stages(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -141,7 +141,7 @@ bool sevalue_to_native(const se::Value &from, cc::pipeline::RenderQueueDesc * to SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_RenderQueueDesc_finalize) -static bool js_pipeline_RenderQueueDesc_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderQueueDesc_constructor(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -198,7 +198,7 @@ SE_BIND_CTOR(js_pipeline_RenderQueueDesc_constructor, __jsb_cc_pipeline_RenderQu -static bool js_cc_pipeline_RenderQueueDesc_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_RenderQueueDesc_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -211,7 +211,7 @@ static bool js_cc_pipeline_RenderQueueDesc_finalize(se::State& s) // NOLINT(read } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_RenderQueueDesc_finalize) -bool js_register_pipeline_RenderQueueDesc(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderQueueDesc(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderQueueDesc", obj, nullptr, _SE(js_pipeline_RenderQueueDesc_constructor)); @@ -231,7 +231,7 @@ bool js_register_pipeline_RenderQueueDesc(se::Object* obj) // NOLINT(readability se::Object* __jsb_cc_pipeline_GlobalDSManager_proto = nullptr; se::Class* __jsb_cc_pipeline_GlobalDSManager_class = nullptr; -static bool js_pipeline_GlobalDSManager_bindBuffer(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_bindBuffer(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_bindBuffer : Invalid Native Object"); @@ -252,7 +252,7 @@ static bool js_pipeline_GlobalDSManager_bindBuffer(se::State& s) // NOLINT(reada } SE_BIND_FUNC(js_pipeline_GlobalDSManager_bindBuffer) -static bool js_pipeline_GlobalDSManager_bindSampler(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_bindSampler(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_bindSampler : Invalid Native Object"); @@ -273,7 +273,7 @@ static bool js_pipeline_GlobalDSManager_bindSampler(se::State& s) // NOLINT(read } SE_BIND_FUNC(js_pipeline_GlobalDSManager_bindSampler) -static bool js_pipeline_GlobalDSManager_bindTexture(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_bindTexture(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_bindTexture : Invalid Native Object"); @@ -294,7 +294,7 @@ static bool js_pipeline_GlobalDSManager_bindTexture(se::State& s) // NOLINT(read } SE_BIND_FUNC(js_pipeline_GlobalDSManager_bindTexture) -static bool js_pipeline_GlobalDSManager_getDescriptorSetLayout(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_getDescriptorSetLayout(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getDescriptorSetLayout : Invalid Native Object"); @@ -313,7 +313,7 @@ static bool js_pipeline_GlobalDSManager_getDescriptorSetLayout(se::State& s) // } SE_BIND_FUNC(js_pipeline_GlobalDSManager_getDescriptorSetLayout) -static bool js_pipeline_GlobalDSManager_getDescriptorSetMap(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_getDescriptorSetMap(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getDescriptorSetMap : Invalid Native Object"); @@ -332,7 +332,7 @@ static bool js_pipeline_GlobalDSManager_getDescriptorSetMap(se::State& s) // NOL } SE_BIND_FUNC(js_pipeline_GlobalDSManager_getDescriptorSetMap) -static bool js_pipeline_GlobalDSManager_getGlobalDescriptorSet(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_getGlobalDescriptorSet(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getGlobalDescriptorSet : Invalid Native Object"); @@ -351,7 +351,26 @@ static bool js_pipeline_GlobalDSManager_getGlobalDescriptorSet(se::State& s) // } SE_BIND_FUNC(js_pipeline_GlobalDSManager_getGlobalDescriptorSet) -static bool js_pipeline_GlobalDSManager_getOrCreateDescriptorSet(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_getLinearSampler(se::State& s) // NOLINT(readability-identifier-naming) +{ + auto* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getLinearSampler : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::gfx::Sampler* result = cobj->getLinearSampler(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_GlobalDSManager_getLinearSampler : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_GlobalDSManager_getLinearSampler) + +static bool js_pipeline_GlobalDSManager_getOrCreateDescriptorSet(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getOrCreateDescriptorSet : Invalid Native Object"); @@ -373,26 +392,26 @@ static bool js_pipeline_GlobalDSManager_getOrCreateDescriptorSet(se::State& s) / } SE_BIND_FUNC(js_pipeline_GlobalDSManager_getOrCreateDescriptorSet) -static bool js_pipeline_GlobalDSManager_getShadowMapSampler(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_getPointSampler(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getShadowMapSampler : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_getPointSampler : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - cc::gfx::Sampler* result = cobj->getShadowMapSampler(); + cc::gfx::Sampler* result = cobj->getPointSampler(); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_pipeline_GlobalDSManager_getShadowMapSampler : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_pipeline_GlobalDSManager_getPointSampler : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_pipeline_GlobalDSManager_getShadowMapSampler) +SE_BIND_FUNC(js_pipeline_GlobalDSManager_getPointSampler) -static bool js_pipeline_GlobalDSManager_update(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GlobalDSManager_update(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_GlobalDSManager_update : Invalid Native Object"); @@ -409,7 +428,7 @@ SE_BIND_FUNC(js_pipeline_GlobalDSManager_update) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_GlobalDSManager_finalize) -static bool js_pipeline_GlobalDSManager_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_GlobalDSManager_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::GlobalDSManager* cobj = JSB_ALLOC(cc::pipeline::GlobalDSManager); s.thisObject()->setPrivateData(cobj); @@ -420,7 +439,7 @@ SE_BIND_CTOR(js_pipeline_GlobalDSManager_constructor, __jsb_cc_pipeline_GlobalDS -static bool js_cc_pipeline_GlobalDSManager_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_GlobalDSManager_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -433,7 +452,7 @@ static bool js_cc_pipeline_GlobalDSManager_finalize(se::State& s) // NOLINT(read } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_GlobalDSManager_finalize) -bool js_register_pipeline_GlobalDSManager(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_GlobalDSManager(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("GlobalDSManager", obj, nullptr, _SE(js_pipeline_GlobalDSManager_constructor)); @@ -443,8 +462,9 @@ bool js_register_pipeline_GlobalDSManager(se::Object* obj) // NOLINT(readability cls->defineFunction("getDescriptorSetLayout", _SE(js_pipeline_GlobalDSManager_getDescriptorSetLayout)); cls->defineFunction("getDescriptorSetMap", _SE(js_pipeline_GlobalDSManager_getDescriptorSetMap)); cls->defineFunction("getGlobalDescriptorSet", _SE(js_pipeline_GlobalDSManager_getGlobalDescriptorSet)); + cls->defineFunction("getLinearSampler", _SE(js_pipeline_GlobalDSManager_getLinearSampler)); cls->defineFunction("getOrCreateDescriptorSet", _SE(js_pipeline_GlobalDSManager_getOrCreateDescriptorSet)); - cls->defineFunction("getShadowMapSampler", _SE(js_pipeline_GlobalDSManager_getShadowMapSampler)); + cls->defineFunction("getPointSampler", _SE(js_pipeline_GlobalDSManager_getPointSampler)); cls->defineFunction("update", _SE(js_pipeline_GlobalDSManager_update)); cls->defineFinalizeFunction(_SE(js_cc_pipeline_GlobalDSManager_finalize)); cls->install(); @@ -459,7 +479,7 @@ bool js_register_pipeline_GlobalDSManager(se::Object* obj) // NOLINT(readability se::Object* __jsb_cc_pipeline_RenderPipelineInfo_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderPipelineInfo_class = nullptr; -static bool js_pipeline_RenderPipelineInfo_get_tag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipelineInfo_get_tag(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipelineInfo_get_tag : Invalid Native Object"); @@ -473,7 +493,7 @@ static bool js_pipeline_RenderPipelineInfo_get_tag(se::State& s) // NOLINT(reada } SE_BIND_PROP_GET(js_pipeline_RenderPipelineInfo_get_tag) -static bool js_pipeline_RenderPipelineInfo_set_tag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipelineInfo_set_tag(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -486,7 +506,7 @@ static bool js_pipeline_RenderPipelineInfo_set_tag(se::State& s) // NOLINT(reada } SE_BIND_PROP_SET(js_pipeline_RenderPipelineInfo_set_tag) -static bool js_pipeline_RenderPipelineInfo_get_flows(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipelineInfo_get_flows(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipelineInfo_get_flows : Invalid Native Object"); @@ -500,7 +520,7 @@ static bool js_pipeline_RenderPipelineInfo_get_flows(se::State& s) // NOLINT(rea } SE_BIND_PROP_GET(js_pipeline_RenderPipelineInfo_get_flows) -static bool js_pipeline_RenderPipelineInfo_set_flows(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipelineInfo_set_flows(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -539,7 +559,7 @@ bool sevalue_to_native(const se::Value &from, cc::pipeline::RenderPipelineInfo * SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_RenderPipelineInfo_finalize) -static bool js_pipeline_RenderPipelineInfo_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipelineInfo_constructor(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -593,7 +613,7 @@ SE_BIND_CTOR(js_pipeline_RenderPipelineInfo_constructor, __jsb_cc_pipeline_Rende -static bool js_cc_pipeline_RenderPipelineInfo_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_RenderPipelineInfo_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -606,7 +626,7 @@ static bool js_cc_pipeline_RenderPipelineInfo_finalize(se::State& s) // NOLINT(r } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_RenderPipelineInfo_finalize) -bool js_register_pipeline_RenderPipelineInfo(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderPipelineInfo(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderPipelineInfo", obj, nullptr, _SE(js_pipeline_RenderPipelineInfo_constructor)); @@ -625,7 +645,7 @@ bool js_register_pipeline_RenderPipelineInfo(se::Object* obj) // NOLINT(readabil se::Object* __jsb_cc_pipeline_RenderPipeline_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderPipeline_class = nullptr; -static bool js_pipeline_RenderPipeline_activate(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_activate(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_activate : Invalid Native Object"); @@ -644,7 +664,7 @@ static bool js_pipeline_RenderPipeline_activate(se::State& s) // NOLINT(readabil } SE_BIND_FUNC(js_pipeline_RenderPipeline_activate) -static bool js_pipeline_RenderPipeline_destroy(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_destroy(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_destroy : Invalid Native Object"); @@ -659,7 +679,7 @@ static bool js_pipeline_RenderPipeline_destroy(se::State& s) // NOLINT(readabili } SE_BIND_FUNC(js_pipeline_RenderPipeline_destroy) -static bool js_pipeline_RenderPipeline_getConstantMacros(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_getConstantMacros(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getConstantMacros : Invalid Native Object"); @@ -678,7 +698,7 @@ static bool js_pipeline_RenderPipeline_getConstantMacros(se::State& s) // NOLINT } SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getConstantMacros) -static bool js_pipeline_RenderPipeline_getDescriptorSet(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_getDescriptorSet(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getDescriptorSet : Invalid Native Object"); @@ -697,7 +717,7 @@ static bool js_pipeline_RenderPipeline_getDescriptorSet(se::State& s) // NOLINT( } SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getDescriptorSet) -static bool js_pipeline_RenderPipeline_getDescriptorSetLayout(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_getDescriptorSetLayout(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getDescriptorSetLayout : Invalid Native Object"); @@ -716,7 +736,7 @@ static bool js_pipeline_RenderPipeline_getDescriptorSetLayout(se::State& s) // N } SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getDescriptorSetLayout) -static bool js_pipeline_RenderPipeline_getDevice(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_getDevice(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getDevice : Invalid Native Object"); @@ -735,7 +755,7 @@ static bool js_pipeline_RenderPipeline_getDevice(se::State& s) // NOLINT(readabi } SE_BIND_FUNC(js_pipeline_RenderPipeline_getDevice) -static bool js_pipeline_RenderPipeline_getGlobalDSManager(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_getGlobalDSManager(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getGlobalDSManager : Invalid Native Object"); @@ -754,7 +774,7 @@ static bool js_pipeline_RenderPipeline_getGlobalDSManager(se::State& s) // NOLIN } SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getGlobalDSManager) -static bool js_pipeline_RenderPipeline_initialize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_initialize(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_initialize : Invalid Native Object"); @@ -776,7 +796,7 @@ static bool js_pipeline_RenderPipeline_initialize(se::State& s) // NOLINT(readab } SE_BIND_FUNC(js_pipeline_RenderPipeline_initialize) -static bool js_pipeline_RenderPipeline_render(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_render(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_render : Invalid Native Object"); @@ -795,7 +815,7 @@ static bool js_pipeline_RenderPipeline_render(se::State& s) // NOLINT(readabilit } SE_BIND_FUNC(js_pipeline_RenderPipeline_render) -static bool js_pipeline_RenderPipeline_resize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_resize(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_resize : Invalid Native Object"); @@ -816,7 +836,7 @@ static bool js_pipeline_RenderPipeline_resize(se::State& s) // NOLINT(readabilit } SE_BIND_FUNC(js_pipeline_RenderPipeline_resize) -static bool js_pipeline_RenderPipeline_setPipelineSharedSceneData(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_setPipelineSharedSceneData(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_setPipelineSharedSceneData : Invalid Native Object"); @@ -835,7 +855,7 @@ static bool js_pipeline_RenderPipeline_setPipelineSharedSceneData(se::State& s) } SE_BIND_FUNC(js_pipeline_RenderPipeline_setPipelineSharedSceneData) -static bool js_pipeline_RenderPipeline_setValue(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_setValue(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_setValue : Invalid Native Object"); @@ -856,7 +876,7 @@ static bool js_pipeline_RenderPipeline_setValue(se::State& s) // NOLINT(readabil } SE_BIND_FUNC(js_pipeline_RenderPipeline_setValue) -static bool js_pipeline_RenderPipeline_getInstance(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderPipeline_getInstance(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -875,7 +895,7 @@ SE_BIND_FUNC(js_pipeline_RenderPipeline_getInstance) -bool js_register_pipeline_RenderPipeline(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderPipeline(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderPipeline", obj, nullptr, nullptr); @@ -906,7 +926,7 @@ se::Class* __jsb_cc_pipeline_ForwardPipeline_class = nullptr; SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ForwardPipeline_finalize) -static bool js_pipeline_ForwardPipeline_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_ForwardPipeline_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::ForwardPipeline* cobj = JSB_ALLOC(cc::pipeline::ForwardPipeline); s.thisObject()->setPrivateData(cobj); @@ -917,7 +937,7 @@ SE_BIND_CTOR(js_pipeline_ForwardPipeline_constructor, __jsb_cc_pipeline_ForwardP -static bool js_cc_pipeline_ForwardPipeline_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_ForwardPipeline_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -930,7 +950,7 @@ static bool js_cc_pipeline_ForwardPipeline_finalize(se::State& s) // NOLINT(read } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_ForwardPipeline_finalize) -bool js_register_pipeline_ForwardPipeline(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_ForwardPipeline(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("ForwardPipeline", obj, __jsb_cc_pipeline_RenderPipeline_proto, _SE(js_pipeline_ForwardPipeline_constructor)); @@ -947,7 +967,7 @@ bool js_register_pipeline_ForwardPipeline(se::Object* obj) // NOLINT(readability se::Object* __jsb_cc_pipeline_RenderFlowInfo_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderFlowInfo_class = nullptr; -static bool js_pipeline_RenderFlowInfo_get_name(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_get_name(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlowInfo_get_name : Invalid Native Object"); @@ -961,7 +981,7 @@ static bool js_pipeline_RenderFlowInfo_get_name(se::State& s) // NOLINT(readabil } SE_BIND_PROP_GET(js_pipeline_RenderFlowInfo_get_name) -static bool js_pipeline_RenderFlowInfo_set_name(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_set_name(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -974,7 +994,7 @@ static bool js_pipeline_RenderFlowInfo_set_name(se::State& s) // NOLINT(readabil } SE_BIND_PROP_SET(js_pipeline_RenderFlowInfo_set_name) -static bool js_pipeline_RenderFlowInfo_get_priority(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_get_priority(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlowInfo_get_priority : Invalid Native Object"); @@ -988,7 +1008,7 @@ static bool js_pipeline_RenderFlowInfo_get_priority(se::State& s) // NOLINT(read } SE_BIND_PROP_GET(js_pipeline_RenderFlowInfo_get_priority) -static bool js_pipeline_RenderFlowInfo_set_priority(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_set_priority(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1001,7 +1021,7 @@ static bool js_pipeline_RenderFlowInfo_set_priority(se::State& s) // NOLINT(read } SE_BIND_PROP_SET(js_pipeline_RenderFlowInfo_set_priority) -static bool js_pipeline_RenderFlowInfo_get_tag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_get_tag(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlowInfo_get_tag : Invalid Native Object"); @@ -1015,7 +1035,7 @@ static bool js_pipeline_RenderFlowInfo_get_tag(se::State& s) // NOLINT(readabili } SE_BIND_PROP_GET(js_pipeline_RenderFlowInfo_get_tag) -static bool js_pipeline_RenderFlowInfo_set_tag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_set_tag(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1028,7 +1048,7 @@ static bool js_pipeline_RenderFlowInfo_set_tag(se::State& s) // NOLINT(readabili } SE_BIND_PROP_SET(js_pipeline_RenderFlowInfo_set_tag) -static bool js_pipeline_RenderFlowInfo_get_stages(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_get_stages(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlowInfo_get_stages : Invalid Native Object"); @@ -1042,7 +1062,7 @@ static bool js_pipeline_RenderFlowInfo_get_stages(se::State& s) // NOLINT(readab } SE_BIND_PROP_GET(js_pipeline_RenderFlowInfo_get_stages) -static bool js_pipeline_RenderFlowInfo_set_stages(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_set_stages(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1089,7 +1109,7 @@ bool sevalue_to_native(const se::Value &from, cc::pipeline::RenderFlowInfo * to, SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_RenderFlowInfo_finalize) -static bool js_pipeline_RenderFlowInfo_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlowInfo_constructor(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -1149,7 +1169,7 @@ SE_BIND_CTOR(js_pipeline_RenderFlowInfo_constructor, __jsb_cc_pipeline_RenderFlo -static bool js_cc_pipeline_RenderFlowInfo_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_RenderFlowInfo_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1162,7 +1182,7 @@ static bool js_cc_pipeline_RenderFlowInfo_finalize(se::State& s) // NOLINT(reada } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_RenderFlowInfo_finalize) -bool js_register_pipeline_RenderFlowInfo(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderFlowInfo(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderFlowInfo", obj, nullptr, _SE(js_pipeline_RenderFlowInfo_constructor)); @@ -1183,7 +1203,7 @@ bool js_register_pipeline_RenderFlowInfo(se::Object* obj) // NOLINT(readability- se::Object* __jsb_cc_pipeline_RenderFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderFlow_class = nullptr; -static bool js_pipeline_RenderFlow_activate(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlow_activate(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlow_activate : Invalid Native Object"); @@ -1202,7 +1222,7 @@ static bool js_pipeline_RenderFlow_activate(se::State& s) // NOLINT(readability- } SE_BIND_FUNC(js_pipeline_RenderFlow_activate) -static bool js_pipeline_RenderFlow_getTag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlow_getTag(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlow_getTag : Invalid Native Object"); @@ -1221,7 +1241,7 @@ static bool js_pipeline_RenderFlow_getTag(se::State& s) // NOLINT(readability-id } SE_BIND_FUNC(js_pipeline_RenderFlow_getTag) -static bool js_pipeline_RenderFlow_initialize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderFlow_initialize(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderFlow_initialize : Invalid Native Object"); @@ -1245,7 +1265,7 @@ SE_BIND_FUNC(js_pipeline_RenderFlow_initialize) -bool js_register_pipeline_RenderFlow(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderFlow(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderFlow", obj, nullptr, nullptr); @@ -1264,7 +1284,7 @@ bool js_register_pipeline_RenderFlow(se::Object* obj) // NOLINT(readability-iden se::Object* __jsb_cc_pipeline_ForwardFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_ForwardFlow_class = nullptr; -static bool js_pipeline_ForwardFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_ForwardFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -1283,7 +1303,7 @@ SE_BIND_FUNC(js_pipeline_ForwardFlow_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ForwardFlow_finalize) -static bool js_pipeline_ForwardFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_ForwardFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::ForwardFlow* cobj = JSB_ALLOC(cc::pipeline::ForwardFlow); s.thisObject()->setPrivateData(cobj); @@ -1294,7 +1314,7 @@ SE_BIND_CTOR(js_pipeline_ForwardFlow_constructor, __jsb_cc_pipeline_ForwardFlow_ -static bool js_cc_pipeline_ForwardFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_ForwardFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1307,7 +1327,7 @@ static bool js_cc_pipeline_ForwardFlow_finalize(se::State& s) // NOLINT(readabil } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_ForwardFlow_finalize) -bool js_register_pipeline_ForwardFlow(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_ForwardFlow(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("ForwardFlow", obj, __jsb_cc_pipeline_RenderFlow_proto, _SE(js_pipeline_ForwardFlow_constructor)); @@ -1325,7 +1345,7 @@ bool js_register_pipeline_ForwardFlow(se::Object* obj) // NOLINT(readability-ide se::Object* __jsb_cc_pipeline_RenderStageInfo_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderStageInfo_class = nullptr; -static bool js_pipeline_RenderStageInfo_get_name(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_get_name(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStageInfo_get_name : Invalid Native Object"); @@ -1339,7 +1359,7 @@ static bool js_pipeline_RenderStageInfo_get_name(se::State& s) // NOLINT(readabi } SE_BIND_PROP_GET(js_pipeline_RenderStageInfo_get_name) -static bool js_pipeline_RenderStageInfo_set_name(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_set_name(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1352,7 +1372,7 @@ static bool js_pipeline_RenderStageInfo_set_name(se::State& s) // NOLINT(readabi } SE_BIND_PROP_SET(js_pipeline_RenderStageInfo_set_name) -static bool js_pipeline_RenderStageInfo_get_priority(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_get_priority(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStageInfo_get_priority : Invalid Native Object"); @@ -1366,7 +1386,7 @@ static bool js_pipeline_RenderStageInfo_get_priority(se::State& s) // NOLINT(rea } SE_BIND_PROP_GET(js_pipeline_RenderStageInfo_get_priority) -static bool js_pipeline_RenderStageInfo_set_priority(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_set_priority(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1379,7 +1399,7 @@ static bool js_pipeline_RenderStageInfo_set_priority(se::State& s) // NOLINT(rea } SE_BIND_PROP_SET(js_pipeline_RenderStageInfo_set_priority) -static bool js_pipeline_RenderStageInfo_get_tag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_get_tag(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStageInfo_get_tag : Invalid Native Object"); @@ -1393,7 +1413,7 @@ static bool js_pipeline_RenderStageInfo_get_tag(se::State& s) // NOLINT(readabil } SE_BIND_PROP_GET(js_pipeline_RenderStageInfo_get_tag) -static bool js_pipeline_RenderStageInfo_set_tag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_set_tag(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1406,7 +1426,7 @@ static bool js_pipeline_RenderStageInfo_set_tag(se::State& s) // NOLINT(readabil } SE_BIND_PROP_SET(js_pipeline_RenderStageInfo_set_tag) -static bool js_pipeline_RenderStageInfo_get_renderQueues(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_get_renderQueues(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStageInfo_get_renderQueues : Invalid Native Object"); @@ -1420,7 +1440,7 @@ static bool js_pipeline_RenderStageInfo_get_renderQueues(se::State& s) // NOLINT } SE_BIND_PROP_GET(js_pipeline_RenderStageInfo_get_renderQueues) -static bool js_pipeline_RenderStageInfo_set_renderQueues(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_set_renderQueues(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT(s); @@ -1467,7 +1487,7 @@ bool sevalue_to_native(const se::Value &from, cc::pipeline::RenderStageInfo * to SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_RenderStageInfo_finalize) -static bool js_pipeline_RenderStageInfo_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStageInfo_constructor(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -1527,7 +1547,7 @@ SE_BIND_CTOR(js_pipeline_RenderStageInfo_constructor, __jsb_cc_pipeline_RenderSt -static bool js_cc_pipeline_RenderStageInfo_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_RenderStageInfo_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1540,7 +1560,7 @@ static bool js_cc_pipeline_RenderStageInfo_finalize(se::State& s) // NOLINT(read } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_RenderStageInfo_finalize) -bool js_register_pipeline_RenderStageInfo(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderStageInfo(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderStageInfo", obj, nullptr, _SE(js_pipeline_RenderStageInfo_constructor)); @@ -1561,7 +1581,7 @@ bool js_register_pipeline_RenderStageInfo(se::Object* obj) // NOLINT(readability se::Object* __jsb_cc_pipeline_RenderStage_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderStage_class = nullptr; -static bool js_pipeline_RenderStage_activate(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStage_activate(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStage_activate : Invalid Native Object"); @@ -1582,7 +1602,7 @@ static bool js_pipeline_RenderStage_activate(se::State& s) // NOLINT(readability } SE_BIND_FUNC(js_pipeline_RenderStage_activate) -static bool js_pipeline_RenderStage_getFlow(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStage_getFlow(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStage_getFlow : Invalid Native Object"); @@ -1601,7 +1621,7 @@ static bool js_pipeline_RenderStage_getFlow(se::State& s) // NOLINT(readability- } SE_BIND_FUNC(js_pipeline_RenderStage_getFlow) -static bool js_pipeline_RenderStage_getTag(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStage_getTag(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStage_getTag : Invalid Native Object"); @@ -1620,7 +1640,7 @@ static bool js_pipeline_RenderStage_getTag(se::State& s) // NOLINT(readability-i } SE_BIND_FUNC(js_pipeline_RenderStage_getTag) -static bool js_pipeline_RenderStage_initialize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_RenderStage_initialize(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStage_initialize : Invalid Native Object"); @@ -1644,7 +1664,7 @@ SE_BIND_FUNC(js_pipeline_RenderStage_initialize) -bool js_register_pipeline_RenderStage(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_RenderStage(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("RenderStage", obj, nullptr, nullptr); @@ -1664,7 +1684,7 @@ bool js_register_pipeline_RenderStage(se::Object* obj) // NOLINT(readability-ide se::Object* __jsb_cc_pipeline_ForwardStage_proto = nullptr; se::Class* __jsb_cc_pipeline_ForwardStage_class = nullptr; -static bool js_pipeline_ForwardStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_ForwardStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -1683,7 +1703,7 @@ SE_BIND_FUNC(js_pipeline_ForwardStage_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ForwardStage_finalize) -static bool js_pipeline_ForwardStage_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_ForwardStage_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::ForwardStage* cobj = JSB_ALLOC(cc::pipeline::ForwardStage); s.thisObject()->setPrivateData(cobj); @@ -1694,7 +1714,7 @@ SE_BIND_CTOR(js_pipeline_ForwardStage_constructor, __jsb_cc_pipeline_ForwardStag -static bool js_cc_pipeline_ForwardStage_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_ForwardStage_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1707,7 +1727,7 @@ static bool js_cc_pipeline_ForwardStage_finalize(se::State& s) // NOLINT(readabi } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_ForwardStage_finalize) -bool js_register_pipeline_ForwardStage(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_ForwardStage(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("ForwardStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_ForwardStage_constructor)); @@ -1725,7 +1745,7 @@ bool js_register_pipeline_ForwardStage(se::Object* obj) // NOLINT(readability-id se::Object* __jsb_cc_pipeline_ShadowFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_ShadowFlow_class = nullptr; -static bool js_pipeline_ShadowFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_ShadowFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -1744,7 +1764,7 @@ SE_BIND_FUNC(js_pipeline_ShadowFlow_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ShadowFlow_finalize) -static bool js_pipeline_ShadowFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_ShadowFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::ShadowFlow* cobj = JSB_ALLOC(cc::pipeline::ShadowFlow); s.thisObject()->setPrivateData(cobj); @@ -1755,7 +1775,7 @@ SE_BIND_CTOR(js_pipeline_ShadowFlow_constructor, __jsb_cc_pipeline_ShadowFlow_cl -static bool js_cc_pipeline_ShadowFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_ShadowFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1768,7 +1788,7 @@ static bool js_cc_pipeline_ShadowFlow_finalize(se::State& s) // NOLINT(readabili } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_ShadowFlow_finalize) -bool js_register_pipeline_ShadowFlow(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_ShadowFlow(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("ShadowFlow", obj, __jsb_cc_pipeline_RenderFlow_proto, _SE(js_pipeline_ShadowFlow_constructor)); @@ -1786,7 +1806,7 @@ bool js_register_pipeline_ShadowFlow(se::Object* obj) // NOLINT(readability-iden se::Object* __jsb_cc_pipeline_ShadowStage_proto = nullptr; se::Class* __jsb_cc_pipeline_ShadowStage_class = nullptr; -static bool js_pipeline_ShadowStage_setFramebuffer(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_ShadowStage_setFramebuffer(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_ShadowStage_setFramebuffer : Invalid Native Object"); @@ -1805,7 +1825,7 @@ static bool js_pipeline_ShadowStage_setFramebuffer(se::State& s) // NOLINT(reada } SE_BIND_FUNC(js_pipeline_ShadowStage_setFramebuffer) -static bool js_pipeline_ShadowStage_setUseData(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_ShadowStage_setUseData(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_ShadowStage_setUseData : Invalid Native Object"); @@ -1826,7 +1846,7 @@ static bool js_pipeline_ShadowStage_setUseData(se::State& s) // NOLINT(readabili } SE_BIND_FUNC(js_pipeline_ShadowStage_setUseData) -static bool js_pipeline_ShadowStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_ShadowStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -1845,7 +1865,7 @@ SE_BIND_FUNC(js_pipeline_ShadowStage_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ShadowStage_finalize) -static bool js_pipeline_ShadowStage_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_ShadowStage_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::ShadowStage* cobj = JSB_ALLOC(cc::pipeline::ShadowStage); s.thisObject()->setPrivateData(cobj); @@ -1856,7 +1876,7 @@ SE_BIND_CTOR(js_pipeline_ShadowStage_constructor, __jsb_cc_pipeline_ShadowStage_ -static bool js_cc_pipeline_ShadowStage_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_ShadowStage_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1869,7 +1889,7 @@ static bool js_cc_pipeline_ShadowStage_finalize(se::State& s) // NOLINT(readabil } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_ShadowStage_finalize) -bool js_register_pipeline_ShadowStage(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_ShadowStage(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("ShadowStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_ShadowStage_constructor)); @@ -1889,7 +1909,7 @@ bool js_register_pipeline_ShadowStage(se::Object* obj) // NOLINT(readability-ide se::Object* __jsb_cc_pipeline_InstancedBuffer_proto = nullptr; se::Class* __jsb_cc_pipeline_InstancedBuffer_class = nullptr; -static bool js_pipeline_InstancedBuffer_destroy(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_InstancedBuffer_destroy(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_InstancedBuffer_destroy : Invalid Native Object"); @@ -1904,7 +1924,7 @@ static bool js_pipeline_InstancedBuffer_destroy(se::State& s) // NOLINT(readabil } SE_BIND_FUNC(js_pipeline_InstancedBuffer_destroy) -static bool js_pipeline_InstancedBuffer_setDynamicOffset(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_InstancedBuffer_setDynamicOffset(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_pipeline_InstancedBuffer_setDynamicOffset : Invalid Native Object"); @@ -1925,7 +1945,7 @@ static bool js_pipeline_InstancedBuffer_setDynamicOffset(se::State& s) // NOLINT } SE_BIND_FUNC(js_pipeline_InstancedBuffer_setDynamicOffset) -static bool js_pipeline_InstancedBuffer_get(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_InstancedBuffer_get(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -1964,7 +1984,7 @@ SE_BIND_FUNC(js_pipeline_InstancedBuffer_get) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_InstancedBuffer_finalize) -static bool js_pipeline_InstancedBuffer_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_InstancedBuffer_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -1980,7 +2000,7 @@ SE_BIND_CTOR(js_pipeline_InstancedBuffer_constructor, __jsb_cc_pipeline_Instance -static bool js_cc_pipeline_InstancedBuffer_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_InstancedBuffer_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -1993,7 +2013,7 @@ static bool js_cc_pipeline_InstancedBuffer_finalize(se::State& s) // NOLINT(read } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_InstancedBuffer_finalize) -bool js_register_pipeline_InstancedBuffer(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_InstancedBuffer(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("InstancedBuffer", obj, nullptr, _SE(js_pipeline_InstancedBuffer_constructor)); @@ -2015,7 +2035,7 @@ se::Class* __jsb_cc_pipeline_DeferredPipeline_class = nullptr; SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_DeferredPipeline_finalize) -static bool js_pipeline_DeferredPipeline_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_DeferredPipeline_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::DeferredPipeline* cobj = JSB_ALLOC(cc::pipeline::DeferredPipeline); s.thisObject()->setPrivateData(cobj); @@ -2026,7 +2046,7 @@ SE_BIND_CTOR(js_pipeline_DeferredPipeline_constructor, __jsb_cc_pipeline_Deferre -static bool js_cc_pipeline_DeferredPipeline_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_DeferredPipeline_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -2039,7 +2059,7 @@ static bool js_cc_pipeline_DeferredPipeline_finalize(se::State& s) // NOLINT(rea } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_DeferredPipeline_finalize) -bool js_register_pipeline_DeferredPipeline(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_DeferredPipeline(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("DeferredPipeline", obj, __jsb_cc_pipeline_RenderPipeline_proto, _SE(js_pipeline_DeferredPipeline_constructor)); @@ -2056,7 +2076,7 @@ bool js_register_pipeline_DeferredPipeline(se::Object* obj) // NOLINT(readabilit se::Object* __jsb_cc_pipeline_GbufferFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_GbufferFlow_class = nullptr; -static bool js_pipeline_GbufferFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GbufferFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -2075,7 +2095,7 @@ SE_BIND_FUNC(js_pipeline_GbufferFlow_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_GbufferFlow_finalize) -static bool js_pipeline_GbufferFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_GbufferFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::GbufferFlow* cobj = JSB_ALLOC(cc::pipeline::GbufferFlow); s.thisObject()->setPrivateData(cobj); @@ -2086,7 +2106,7 @@ SE_BIND_CTOR(js_pipeline_GbufferFlow_constructor, __jsb_cc_pipeline_GbufferFlow_ -static bool js_cc_pipeline_GbufferFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_GbufferFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -2099,7 +2119,7 @@ static bool js_cc_pipeline_GbufferFlow_finalize(se::State& s) // NOLINT(readabil } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_GbufferFlow_finalize) -bool js_register_pipeline_GbufferFlow(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_GbufferFlow(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("GbufferFlow", obj, __jsb_cc_pipeline_RenderFlow_proto, _SE(js_pipeline_GbufferFlow_constructor)); @@ -2117,7 +2137,7 @@ bool js_register_pipeline_GbufferFlow(se::Object* obj) // NOLINT(readability-ide se::Object* __jsb_cc_pipeline_GbufferStage_proto = nullptr; se::Class* __jsb_cc_pipeline_GbufferStage_class = nullptr; -static bool js_pipeline_GbufferStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_GbufferStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -2136,7 +2156,7 @@ SE_BIND_FUNC(js_pipeline_GbufferStage_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_GbufferStage_finalize) -static bool js_pipeline_GbufferStage_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_GbufferStage_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::GbufferStage* cobj = JSB_ALLOC(cc::pipeline::GbufferStage); s.thisObject()->setPrivateData(cobj); @@ -2147,7 +2167,7 @@ SE_BIND_CTOR(js_pipeline_GbufferStage_constructor, __jsb_cc_pipeline_GbufferStag -static bool js_cc_pipeline_GbufferStage_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_GbufferStage_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -2160,7 +2180,7 @@ static bool js_cc_pipeline_GbufferStage_finalize(se::State& s) // NOLINT(readabi } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_GbufferStage_finalize) -bool js_register_pipeline_GbufferStage(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_GbufferStage(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("GbufferStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_GbufferStage_constructor)); @@ -2178,7 +2198,7 @@ bool js_register_pipeline_GbufferStage(se::Object* obj) // NOLINT(readability-id se::Object* __jsb_cc_pipeline_LightingFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_LightingFlow_class = nullptr; -static bool js_pipeline_LightingFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_LightingFlow_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -2197,7 +2217,7 @@ SE_BIND_FUNC(js_pipeline_LightingFlow_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_LightingFlow_finalize) -static bool js_pipeline_LightingFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_LightingFlow_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::LightingFlow* cobj = JSB_ALLOC(cc::pipeline::LightingFlow); s.thisObject()->setPrivateData(cobj); @@ -2208,7 +2228,7 @@ SE_BIND_CTOR(js_pipeline_LightingFlow_constructor, __jsb_cc_pipeline_LightingFlo -static bool js_cc_pipeline_LightingFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_LightingFlow_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -2221,7 +2241,7 @@ static bool js_cc_pipeline_LightingFlow_finalize(se::State& s) // NOLINT(readabi } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_LightingFlow_finalize) -bool js_register_pipeline_LightingFlow(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_LightingFlow(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("LightingFlow", obj, __jsb_cc_pipeline_RenderFlow_proto, _SE(js_pipeline_LightingFlow_constructor)); @@ -2239,7 +2259,7 @@ bool js_register_pipeline_LightingFlow(se::Object* obj) // NOLINT(readability-id se::Object* __jsb_cc_pipeline_LightingStage_proto = nullptr; se::Class* __jsb_cc_pipeline_LightingStage_class = nullptr; -static bool js_pipeline_LightingStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_pipeline_LightingStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); @@ -2258,7 +2278,7 @@ SE_BIND_FUNC(js_pipeline_LightingStage_getInitializeInfo) SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_LightingStage_finalize) -static bool js_pipeline_LightingStage_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_LightingStage_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::LightingStage* cobj = JSB_ALLOC(cc::pipeline::LightingStage); s.thisObject()->setPrivateData(cobj); @@ -2269,7 +2289,7 @@ SE_BIND_CTOR(js_pipeline_LightingStage_constructor, __jsb_cc_pipeline_LightingSt -static bool js_cc_pipeline_LightingStage_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_LightingStage_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -2282,7 +2302,7 @@ static bool js_cc_pipeline_LightingStage_finalize(se::State& s) // NOLINT(readab } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_LightingStage_finalize) -bool js_register_pipeline_LightingStage(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_LightingStage(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("LightingStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_LightingStage_constructor)); @@ -2302,7 +2322,7 @@ se::Class* __jsb_cc_pipeline_PostprocessStage_class = nullptr; SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_PostprocessStage_finalize) -static bool js_pipeline_PostprocessStage_constructor(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool js_pipeline_PostprocessStage_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { cc::pipeline::PostprocessStage* cobj = JSB_ALLOC(cc::pipeline::PostprocessStage); s.thisObject()->setPrivateData(cobj); @@ -2313,7 +2333,7 @@ SE_BIND_CTOR(js_pipeline_PostprocessStage_constructor, __jsb_cc_pipeline_Postpro -static bool js_cc_pipeline_PostprocessStage_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_cc_pipeline_PostprocessStage_finalize(se::State& s) // NOLINT(readability-identifier-naming) { auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) @@ -2326,7 +2346,7 @@ static bool js_cc_pipeline_PostprocessStage_finalize(se::State& s) // NOLINT(rea } SE_BIND_FINALIZE_FUNC(js_cc_pipeline_PostprocessStage_finalize) -bool js_register_pipeline_PostprocessStage(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_pipeline_PostprocessStage(se::Object* obj) // NOLINT(readability-identifier-naming) { auto* cls = se::Class::create("PostprocessStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_PostprocessStage_constructor)); @@ -2353,25 +2373,25 @@ bool register_all_pipeline(se::Object* obj) se::Object* ns = nsVal.toObject(); js_register_pipeline_RenderQueueDesc(ns); - js_register_pipeline_RenderFlow(ns); - js_register_pipeline_RenderStage(ns); - js_register_pipeline_LightingStage(ns); - js_register_pipeline_RenderPipeline(ns); - js_register_pipeline_RenderStageInfo(ns); - js_register_pipeline_ForwardPipeline(ns); - js_register_pipeline_GbufferStage(ns); - js_register_pipeline_RenderPipelineInfo(ns); - js_register_pipeline_ForwardStage(ns); - js_register_pipeline_ShadowStage(ns); js_register_pipeline_GlobalDSManager(ns); + js_register_pipeline_RenderPipelineInfo(ns); + js_register_pipeline_RenderPipeline(ns); + js_register_pipeline_ForwardPipeline(ns); js_register_pipeline_RenderFlowInfo(ns); - js_register_pipeline_PostprocessStage(ns); + js_register_pipeline_RenderFlow(ns); js_register_pipeline_ForwardFlow(ns); + js_register_pipeline_RenderStageInfo(ns); + js_register_pipeline_RenderStage(ns); + js_register_pipeline_ForwardStage(ns); + js_register_pipeline_ShadowFlow(ns); + js_register_pipeline_ShadowStage(ns); js_register_pipeline_InstancedBuffer(ns); js_register_pipeline_DeferredPipeline(ns); js_register_pipeline_GbufferFlow(ns); + js_register_pipeline_GbufferStage(ns); js_register_pipeline_LightingFlow(ns); - js_register_pipeline_ShadowFlow(ns); + js_register_pipeline_LightingStage(ns); + js_register_pipeline_PostprocessStage(ns); return true; } diff --git a/native/cocos/bindings/auto/jsb_pipeline_auto.h b/native/cocos/bindings/auto/jsb_pipeline_auto.h index 8a091fec71..987666e21b 100644 --- a/native/cocos/bindings/auto/jsb_pipeline_auto.h +++ b/native/cocos/bindings/auto/jsb_pipeline_auto.h @@ -46,8 +46,9 @@ SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_bindTexture); SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getDescriptorSetLayout); SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getDescriptorSetMap); SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getGlobalDescriptorSet); +SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getLinearSampler); SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getOrCreateDescriptorSet); -SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getShadowMapSampler); +SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getPointSampler); SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_update); SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_GlobalDSManager); diff --git a/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp b/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp index 4463096034..e5e34884df 100644 --- a/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp +++ b/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp @@ -122,7 +122,7 @@ se::Value oldConsoleWarn; se::Value oldConsoleError; se::Value oldConsoleAssert; -bool jsbConsoleFormatLog(State &state, const char *prefix, int msgIndex = 0) { //NOLINT(google-runtime-references) +bool jsbConsoleFormatLog(State &state, const char *prefix, int msgIndex = 0) { if (msgIndex < 0) { return false; } @@ -150,42 +150,42 @@ bool jsbConsoleFormatLog(State &state, const char *prefix, int msgIndex = 0) { / return true; } -bool jsbConsoleLog(State &s) { //NOLINT(google-runtime-references) +bool jsbConsoleLog(State &s) { jsbConsoleFormatLog(s, ""); oldConsoleLog.toObject()->call(s.args(), s.thisObject()); return true; } SE_BIND_FUNC(jsbConsoleLog) -bool jsbConsoleDebug(State &s) { //NOLINT(google-runtime-references) +bool jsbConsoleDebug(State &s) { jsbConsoleFormatLog(s, "[DEBUG]: "); oldConsoleDebug.toObject()->call(s.args(), s.thisObject()); return true; } SE_BIND_FUNC(jsbConsoleDebug) -bool jsbConsoleInfo(State &s) { //NOLINT(google-runtime-references) +bool jsbConsoleInfo(State &s) { jsbConsoleFormatLog(s, "[INFO]: "); oldConsoleInfo.toObject()->call(s.args(), s.thisObject()); return true; } SE_BIND_FUNC(jsbConsoleInfo) -bool jsbConsoleWarn(State &s) { //NOLINT(google-runtime-references) +bool jsbConsoleWarn(State &s) { jsbConsoleFormatLog(s, "[WARN]: "); oldConsoleWarn.toObject()->call(s.args(), s.thisObject()); return true; } SE_BIND_FUNC(jsbConsoleWarn) -bool jsbConsoleError(State &s) { //NOLINT(google-runtime-references) +bool jsbConsoleError(State &s) { jsbConsoleFormatLog(s, "[ERROR]: "); oldConsoleError.toObject()->call(s.args(), s.thisObject()); return true; } SE_BIND_FUNC(jsbConsoleError) -bool jsbConsoleAssert(State &s) { //NOLINT(google-runtime-references) +bool jsbConsoleAssert(State &s) { const auto &args = s.args(); if (!args.empty()) { if (args[0].isBoolean() && !args[0].toBoolean()) { diff --git a/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp b/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp index 7c19a40ebf..432c16ba9d 100644 --- a/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp +++ b/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp @@ -462,21 +462,21 @@ bool JavaScriptJavaBridge::convertReturnValue(ReturnValue retValue, ValueType ty se::Class *__jsb_JavaScriptJavaBridge_class = nullptr; // NOLINT -static bool JavaScriptJavaBridge_finalize(se::State &s) { //NOLINT(readability-identifier-naming,google-runtime-references) +static bool JavaScriptJavaBridge_finalize(se::State &s) { //NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); delete cobj; return true; } SE_BIND_FINALIZE_FUNC(JavaScriptJavaBridge_finalize) -static bool JavaScriptJavaBridge_constructor(se::State &s) { //NOLINT(readability-identifier-naming,google-runtime-references) +static bool JavaScriptJavaBridge_constructor(se::State &s) { //NOLINT(readability-identifier-naming) auto *cobj = new (std::nothrow) JavaScriptJavaBridge(); s.thisObject()->setPrivateData(cobj); return true; } SE_BIND_CTOR(JavaScriptJavaBridge_constructor, __jsb_JavaScriptJavaBridge_class, JavaScriptJavaBridge_finalize) -static bool JavaScriptJavaBridge_callStaticMethod(se::State &s) { //NOLINT(readability-identifier-naming,google-runtime-references) +static bool JavaScriptJavaBridge_callStaticMethod(se::State &s) { //NOLINT(readability-identifier-naming) const auto &args = s.args(); auto argc = static_cast(args.size()); diff --git a/native/cocos/bindings/manual/jsb_cocos_manual.cpp b/native/cocos/bindings/manual/jsb_cocos_manual.cpp index 8c71cfbac6..28e4c7f095 100644 --- a/native/cocos/bindings/manual/jsb_cocos_manual.cpp +++ b/native/cocos/bindings/manual/jsb_cocos_manual.cpp @@ -69,7 +69,7 @@ private: }; // cc.PlistParser.getInstance() -static bool js_PlistParser_getInstance(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_PlistParser_getInstance(se::State &s) { // NOLINT(readability-identifier-naming) JSPlistDelegator *delegator = JSPlistDelegator::getInstance(); cc::SAXParser *parser = delegator->getParser(); @@ -82,7 +82,7 @@ static bool js_PlistParser_getInstance(se::State &s) { // NOLINT(readability-ide SE_BIND_FUNC(js_PlistParser_getInstance) // NOLINT(readability-identifier-naming) // cc.PlistParser.getInstance().parse(text) -static bool js_PlistParser_parse(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_PlistParser_parse(se::State &s) { // NOLINT(readability-identifier-naming) const auto &args = s.args(); size_t argc = args.size(); JSPlistDelegator *delegator = JSPlistDelegator::getInstance(); @@ -200,7 +200,7 @@ static bool register_plist_parser(se::Object */*obj*/) { // NOLINT(readability-i // cc.sys.localStorage -static bool JSB_localStorageGetItem(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool JSB_localStorageGetItem(se::State &s) { // NOLINT(readability-identifier-naming) const auto &args = s.args(); size_t argc = args.size(); if (argc == 1) { @@ -276,7 +276,7 @@ static bool JSB_localStorageClear(const se::State &s) { // NOLINT(readability-id } SE_BIND_FUNC(JSB_localStorageClear) // NOLINT(readability-identifier-naming) -static bool JSB_localStorageKey(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool JSB_localStorageKey(se::State &s) { // NOLINT(readability-identifier-naming) const auto &args = s.args(); size_t argc = args.size(); if (argc == 1) { @@ -295,7 +295,7 @@ static bool JSB_localStorageKey(se::State &s) { // NOLINT(readability-identifier } SE_BIND_FUNC(JSB_localStorageKey) // NOLINT(readability-identifier-naming) -static bool JSB_localStorage_getLength(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool JSB_localStorage_getLength(se::State &s) { // NOLINT(readability-identifier-naming) const auto &args = s.args(); size_t argc = args.size(); if (argc == 0) { @@ -343,7 +343,7 @@ static bool register_sys_localStorage(se::Object *obj) { // NOLINT(readability-i } //IDEA: move to auto bindings. -static bool js_CanvasRenderingContext2D_setCanvasBufferUpdatedCallback(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_CanvasRenderingContext2D_setCanvasBufferUpdatedCallback(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_CanvasRenderingContext2D_setCanvasBufferUpdatedCallback : Invalid Native Object"); const auto &args = s.args(); @@ -423,7 +423,7 @@ static void setCanvasRenderingContext2DProps(cc::CanvasRenderingContext2D *conte if (!propVal.isUndefined()) context->setGlobalCompositeOperation(propVal.toString()); } -static bool js_engine_CanvasRenderingContext2D_measureText(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_engine_CanvasRenderingContext2D_measureText(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_engine_CanvasRenderingContext2D_measureText : Invalid Native Object"); const auto &args = s.args(); @@ -535,7 +535,7 @@ static bool js_engine_CanvasRenderingContext2D_strokeText(const se::State &s) { SE_BIND_FUNC(js_engine_CanvasRenderingContext2D_strokeText) // NOLINT(readability-identifier-naming) static se::Object *deviceMotionObject = nullptr; -static bool JSB_getDeviceMotionValue(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool JSB_getDeviceMotionValue(se::State &s) { // NOLINT(readability-identifier-naming) if (deviceMotionObject == nullptr) { deviceMotionObject = se::Object::createArrayObject(9); deviceMotionObject->root(); @@ -576,7 +576,7 @@ static bool register_device(se::Object */*obj*/) { // NOLINT(readability-identif return true; } -static bool register_canvas_context2d(se::Object */*obj*/) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool register_canvas_context2d(se::Object */*obj*/) { // NOLINT(readability-identifier-naming) __jsb_cc_CanvasRenderingContext2D_proto->defineFunction("_setCanvasBufferUpdatedCallback", _SE(js_CanvasRenderingContext2D_setCanvasBufferUpdatedCallback)); __jsb_cc_CanvasRenderingContext2D_proto->defineFunction("fillText", _SE(js_engine_CanvasRenderingContext2D_fillText)); __jsb_cc_CanvasRenderingContext2D_proto->defineFunction("strokeText", _SE(js_engine_CanvasRenderingContext2D_strokeText)); @@ -613,7 +613,7 @@ static bool js_engine_FileUtils_listFilesRecursively(const se::State &s) { // NO } SE_BIND_FUNC(js_engine_FileUtils_listFilesRecursively) // NOLINT(readability-identifier-naming) -static bool js_se_setExceptionCallback(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_se_setExceptionCallback(se::State &s) { // NOLINT(readability-identifier-naming) const auto &args = s.args(); if (args.size() != 1 || !args[0].isObject() || !args[0].toObject()->isFunction()) { SE_REPORT_ERROR("expect 1 arguments of Function type, %d provided", (int)args.size()); diff --git a/native/cocos/bindings/manual/jsb_gfx_manual.cpp b/native/cocos/bindings/manual/jsb_gfx_manual.cpp index 2fec1dc218..214b293ebe 100644 --- a/native/cocos/bindings/manual/jsb_gfx_manual.cpp +++ b/native/cocos/bindings/manual/jsb_gfx_manual.cpp @@ -32,7 +32,7 @@ #include #include -bool js_gfx_Device_copyBuffersToTexture(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_gfx_Device_copyBuffersToTexture(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_Device_copyBuffersToTexture : Invalid Native Object"); @@ -66,7 +66,7 @@ bool js_gfx_Device_copyBuffersToTexture(se::State &s) { // NOLINT(readability-id } else { assert(false); } - } else { + } else { unsigned long address = 0; //NOLINT(google-runtime-int) seval_to_ulong(value, &address); ptr = reinterpret_cast(address); @@ -88,7 +88,7 @@ bool js_gfx_Device_copyBuffersToTexture(se::State &s) { // NOLINT(readability-id } SE_BIND_FUNC(js_gfx_Device_copyBuffersToTexture) -bool js_gfx_Device_copyTexImagesToTexture(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_gfx_Device_copyTexImagesToTexture(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_Device_copyBuffersToTexture : Invalid Native Object"); @@ -111,7 +111,7 @@ bool js_gfx_Device_copyTexImagesToTexture(se::State &s) { // NOLINT(readability- for (uint32_t i = 0; i < length; ++i) { if (dataObj->getArrayElement(i, &value)) { if (value.isObject()) { - + uint8_t * address = nullptr; value.toObject()->getTypedArrayData(&address, &dataLength); arg0[i] = address; @@ -134,7 +134,7 @@ bool js_gfx_Device_copyTexImagesToTexture(se::State &s) { // NOLINT(readability- } SE_BIND_FUNC(js_gfx_Device_copyTexImagesToTexture) -static bool js_gfx_Device_createBuffer(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_Device_createBuffer(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_Device_createBuffer : Invalid Native Object"); const auto &args = s.args(); @@ -167,7 +167,7 @@ static bool js_gfx_Device_createBuffer(se::State &s) { // NOLINT(readability-ide } SE_BIND_FUNC(js_gfx_Device_createBuffer) -static bool js_gfx_Device_createTexture(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_Device_createTexture(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_Device_createTexture : Invalid Native Object"); const auto &args = s.args(); @@ -197,7 +197,7 @@ static bool js_gfx_Device_createTexture(se::State &s) { // NOLINT(readability-id } SE_BIND_FUNC(js_gfx_Device_createTexture) -static bool js_gfx_Buffer_initialize(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_Buffer_initialize(se::State &s) { // NOLINT(readability-identifier-naming) CC_UNUSED bool ok = true; auto * cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_Buffer_initialize : Invalid Native Object"); @@ -226,7 +226,7 @@ static bool js_gfx_Buffer_initialize(se::State &s) { // NOLINT(readability-ident } SE_BIND_FUNC(js_gfx_Buffer_initialize) -static bool js_gfx_Texture_initialize(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_Texture_initialize(se::State &s) { // NOLINT(readability-identifier-naming) CC_UNUSED bool ok = true; auto * cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_Texture_initialize : Invalid Native Object"); @@ -255,7 +255,7 @@ static bool js_gfx_Texture_initialize(se::State &s) { // NOLINT(readability-iden } SE_BIND_FUNC(js_gfx_Texture_initialize) -static bool js_gfx_GFXBuffer_update(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_GFXBuffer_update(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_GFXBuffer_update : Invalid Native Object"); const auto & args = s.args(); @@ -292,7 +292,7 @@ static bool js_gfx_GFXBuffer_update(se::State &s) { // NOLINT(readability-identi } SE_BIND_FUNC(js_gfx_GFXBuffer_update) -static bool js_gfx_CommandBuffer_execute(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_CommandBuffer_execute(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_execute : Invalid Native Object"); const auto & args = s.args(); @@ -335,7 +335,7 @@ static bool js_gfx_CommandBuffer_execute(se::State &s) { // NOLINT(readability-i } SE_BIND_FUNC(js_gfx_CommandBuffer_execute) -static bool js_gfx_CommandBuffer_updateBuffer(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_CommandBuffer_updateBuffer(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_updateBuffer : Invalid Native Object"); @@ -371,7 +371,7 @@ static bool js_gfx_CommandBuffer_updateBuffer(se::State &s) { // NOLINT(readabil } SE_BIND_FUNC(js_gfx_CommandBuffer_updateBuffer) -static bool js_gfx_CommandBuffer_copyBuffersToTexture(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_CommandBuffer_copyBuffersToTexture(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_copyBuffersToTexture : Invalid Native Object"); @@ -419,7 +419,7 @@ static bool js_gfx_CommandBuffer_copyBuffersToTexture(se::State &s) { // NOLINT( } SE_BIND_FUNC(js_gfx_CommandBuffer_copyBuffersToTexture) -static bool js_gfx_InputAssembler_extractDrawInfo(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_gfx_InputAssembler_extractDrawInfo(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_extractDrawInfo : Invalid Native Object"); const auto &args = s.args(); @@ -457,7 +457,7 @@ static bool js_gfx_InputAssembler_extractDrawInfo(se::State &s) { // NOLINT(read } SE_BIND_FUNC(js_gfx_InputAssembler_extractDrawInfo) -bool js_gfx_get_deviceInstance(se::State &s) { // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_gfx_get_deviceInstance(se::State &s) { // NOLINT(readability-identifier-naming) nativevalue_to_se(cc::gfx::Device::getInstance(), s.rval(), nullptr); return true; } diff --git a/native/cocos/bindings/manual/jsb_network_manual.cpp b/native/cocos/bindings/manual/jsb_network_manual.cpp index c305c77f13..38479a2e69 100644 --- a/native/cocos/bindings/manual/jsb_network_manual.cpp +++ b/native/cocos/bindings/manual/jsb_network_manual.cpp @@ -30,7 +30,7 @@ #include "network/Downloader.h" #include "bindings/auto/jsb_network_auto.h" -static bool js_cocos2dx_network_Downloader_createDownloadFileTask(se::State &s) { // NOLINT(google-runtime-references,readability-identifier-naming) +static bool js_cocos2dx_network_Downloader_createDownloadFileTask(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_network_Downloader_createDownloadFileTask : Invalid Native Object"); @@ -79,7 +79,7 @@ static bool js_cocos2dx_network_Downloader_createDownloadFileTask(se::State &s) SE_BIND_FUNC(js_cocos2dx_network_Downloader_createDownloadFileTask) -static bool js_network_Downloader_setOnFileTaskSuccess(se::State &s) { // NOLINT(google-runtime-references,readability-identifier-naming) +static bool js_network_Downloader_setOnFileTaskSuccess(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_network_Downloader_setOnFileTaskSuccess : Invalid Native Object"); const auto &args = s.args(); @@ -123,9 +123,9 @@ static bool js_network_Downloader_setOnFileTaskSuccess(se::State &s) { // NOLINT SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_network_Downloader_setOnFileTaskSuccess) // NOLINT(google-runtime-references,readability-identifier-naming) +SE_BIND_FUNC(js_network_Downloader_setOnFileTaskSuccess) // NOLINT(readability-identifier-naming) -static bool js_network_Downloader_setOnTaskError(se::State &s) { // NOLINT(google-runtime-references,readability-identifier-naming) +static bool js_network_Downloader_setOnTaskError(se::State &s) { // NOLINT(readability-identifier-naming) auto *cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_network_Downloader_setOnTaskError : Invalid Native Object"); const auto &args = s.args(); @@ -172,7 +172,7 @@ static bool js_network_Downloader_setOnTaskError(se::State &s) { // NOLINT(googl SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_network_Downloader_setOnTaskError) // NOLINT(google-runtime-references,readability-identifier-naming) +SE_BIND_FUNC(js_network_Downloader_setOnTaskError) // NOLINT(readability-identifier-naming) bool register_all_network_manual(se::Object * /*obj*/) { __jsb_cc_network_Downloader_proto->defineFunction("createDownloadFileTask", diff --git a/native/cocos/bindings/manual/jsb_scene_manual.cpp b/native/cocos/bindings/manual/jsb_scene_manual.cpp index 8b1dfb8c33..bd28caea30 100644 --- a/native/cocos/bindings/manual/jsb_scene_manual.cpp +++ b/native/cocos/bindings/manual/jsb_scene_manual.cpp @@ -1,8 +1,8 @@ /**************************************************************************** Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. - + http://www.cocos.com - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license @@ -10,10 +10,10 @@ not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. - + The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -36,7 +36,7 @@ #define JSB_FREE(ptr) delete ptr #endif -static bool js_scene_Pass_setRootBufferAndBlock(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_scene_Pass_setRootBufferAndBlock(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_scene_Pass_setRootBlock : Invalid Native Object"); @@ -54,9 +54,9 @@ static bool js_scene_Pass_setRootBufferAndBlock(se::State& s) // NOLINT(readabil SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_scene_Pass_setRootBufferAndBlock) // NOLINT(readability-identifier-naming, google-runtime-references) +SE_BIND_FUNC(js_scene_Pass_setRootBufferAndBlock) // NOLINT(readability-identifier-naming) -static bool js_scene_RenderScene_updateBatches(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_scene_RenderScene_updateBatches(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT(s); SE_PRECONDITION2(cobj, false, "js_scene_RenderScene_updateBatches : Invalid Native Object"); @@ -73,9 +73,9 @@ static bool js_scene_RenderScene_updateBatches(se::State& s) // NOLINT(readabili SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_scene_RenderScene_updateBatches) // NOLINT(readability-identifier-naming, google-runtime-references) +SE_BIND_FUNC(js_scene_RenderScene_updateBatches) // NOLINT(readability-identifier-naming) -static bool js_scene_Model_setInstancedAttrBlock(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_scene_Model_setInstancedAttrBlock(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_scene_Model_setInstancedAttrBlock : Invalid Native Object"); @@ -123,9 +123,9 @@ static bool js_scene_Model_setInstancedAttrBlock(se::State& s) // NOLINT(readabi SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_scene_Model_setInstancedAttrBlock) // NOLINT(readability-identifier-naming, google-runtime-references) +SE_BIND_FUNC(js_scene_Model_setInstancedAttrBlock) // NOLINT(readability-identifier-naming) -static bool js_scene_Node_initWithData(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_scene_Node_initWithData(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = static_cast(s.nativeThisObject()); CC_UNUSED bool ok = true; @@ -145,9 +145,9 @@ static bool js_scene_Node_initWithData(se::State& s) // NOLINT(readability-ident SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_scene_Node_initWithData) // NOLINT(readability-identifier-naming, google-runtime-references) +SE_BIND_FUNC(js_scene_Node_initWithData) // NOLINT(readability-identifier-naming) -static bool js_scene_Pass_initWithData(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_scene_Pass_initWithData(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = static_cast(s.nativeThisObject()); CC_UNUSED bool ok = true; @@ -167,9 +167,9 @@ static bool js_scene_Pass_initWithData(se::State& s) // NOLINT(readability-ident SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_scene_Pass_initWithData) // NOLINT(readability-identifier-naming, google-runtime-references) +SE_BIND_FUNC(js_scene_Pass_initWithData) // NOLINT(readability-identifier-naming) -static bool js_scene_SubModel_setSubMeshBuffers(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_scene_SubModel_setSubMeshBuffers(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = static_cast(s.nativeThisObject()); SE_PRECONDITION2(cobj, false, "js_scene_SubModel_setSubMeshBuffers : Invalid Native Object"); @@ -220,9 +220,9 @@ static bool js_scene_SubModel_setSubMeshBuffers(se::State& s) // NOLINT(readabil SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_scene_SubModel_setSubMeshBuffers) // NOLINT(readability-identifier-naming, google-runtime-references) +SE_BIND_FUNC(js_scene_SubModel_setSubMeshBuffers) // NOLINT(readability-identifier-naming) -bool register_all_scene_manual(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool register_all_scene_manual(se::Object* obj) // NOLINT(readability-identifier-naming) { // Get the ns se::Value nsVal; diff --git a/native/cocos/bindings/manual/jsb_websocket.cpp b/native/cocos/bindings/manual/jsb_websocket.cpp index 58a874b2e7..38f1aa9207 100644 --- a/native/cocos/bindings/manual/jsb_websocket.cpp +++ b/native/cocos/bindings/manual/jsb_websocket.cpp @@ -254,7 +254,7 @@ static bool webSocketFinalize(const se::State &s) { } SE_BIND_FINALIZE_FUNC(webSocketFinalize) -static bool webSocketConstructor(se::State &s) { // NOLINT (google-runtime-references) +static bool webSocketConstructor(se::State &s) { const auto &args = s.args(); int argc = static_cast(args.size()); @@ -393,7 +393,7 @@ static bool webSocketSend(const se::State &s) { } SE_BIND_FUNC(webSocketSend) -static bool webSocketClose(se::State &s) { // NOLINT (google-runtime-references) +static bool webSocketClose(se::State &s) { const auto &args = s.args(); int argc = static_cast(args.size()); @@ -436,7 +436,7 @@ static bool webSocketClose(se::State &s) { // NOLINT (google-runtime-references) } SE_BIND_FUNC(webSocketClose) -static bool webSocketGetReadyState(se::State &s) { // NOLINT (google-runtime-references) +static bool webSocketGetReadyState(se::State &s) { const auto &args = s.args(); int argc = static_cast(args.size()); @@ -450,7 +450,7 @@ static bool webSocketGetReadyState(se::State &s) { // NOLINT (google-runtime-ref } SE_BIND_PROP_GET(webSocketGetReadyState) -static bool webSocketGetBufferedAmount(se::State &s) { // NOLINT (google-runtime-references) +static bool webSocketGetBufferedAmount(se::State &s) { const auto &args = s.args(); int argc = static_cast(args.size()); @@ -464,7 +464,7 @@ static bool webSocketGetBufferedAmount(se::State &s) { // NOLINT (google-runtime } SE_BIND_PROP_GET(webSocketGetBufferedAmount) -static bool webSocketGetExtensions(se::State &s) { // NOLINT (google-runtime-references) +static bool webSocketGetExtensions(se::State &s) { const auto &args = s.args(); int argc = static_cast(args.size()); diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index 289484f1bd..6ddbb184cd 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -26,18 +26,19 @@ ****************************************************************************/ #include "network/SocketIO.h" -#include "network/Uri.h" #include -#include #include -#include "base/UTF8.h" +#include +#include #include "base/Log.h" -#include "platform/Application.h" -#include "network/WebSocket.h" +#include "base/UTF8.h" #include "network/HttpClient.h" +#include "network/Uri.h" +#include "network/WebSocket.h" +#include "platform/Application.h" -#include "json/rapidjson.h" #include "json/document-wrapper.h" +#include "json/rapidjson.h" #include "json/stringbuffer.h" #include "json/writer.h" @@ -52,8 +53,8 @@ class SocketIOPacketV10x; class SocketIOPacket { public: enum class SocketIOVersion { - V09x, - V10x + V09X, + V10X }; SocketIOPacket(); @@ -61,56 +62,55 @@ public: void initWithType(const std::string &packetType); void initWithTypeIndex(int index); - std::string toString() const; - virtual int typeAsNumber() const; + std::string toString() const; + virtual int typeAsNumber() const; const std::string &typeForIndex(int index) const; - void setEndpoint(const std::string &endpoint) { _endpoint = endpoint; }; + void setEndpoint(const std::string &endpoint) { _endpoint = endpoint; }; const std::string &getEndpoint() const { return _endpoint; }; - void setEvent(const std::string &event) { _name = event; }; + void setEvent(const std::string &event) { _name = event; }; const std::string &getEvent() const { return _name; }; - void addData(const std::string &data); + void addData(const std::string &data); std::vector getData() const { return _args; }; - virtual std::string stringify() const; + virtual std::string stringify() const; static SocketIOPacket *createPacketWithType(const std::string &type, SocketIOVersion version); static SocketIOPacket *createPacketWithTypeIndex(int type, SocketIOVersion version); protected: - std::string _pId; //id message - std::string _ack; // - std::string _name; //event name - std::vector _args; //we will be using a vector of strings to store multiple data - std::string _endpoint; // - std::string _endpointseparator; //socket.io 1.x requires a ',' between endpoint and payload - std::string _type; //message type - std::string _separator; //for stringify the object - std::vector _types; //types of messages + std::string _pId; //id message + std::string _ack; // + std::string _name; //event name + std::vector _args; //we will be using a vector of strings to store multiple data + std::string _endpoint; // + std::string _endpointseparator; //socket.io 1.x requires a ',' between endpoint and payload + std::string _type; //message type + std::string _separator; //for stringify the object + std::vector _types; //types of messages }; class SocketIOPacketV10x : public SocketIOPacket { public: SocketIOPacketV10x(); - virtual ~SocketIOPacketV10x(); - int typeAsNumber() const override; + ~SocketIOPacketV10x() override; + int typeAsNumber() const override; std::string stringify() const override; private: std::vector _typesMessage; }; -SocketIOPacket::SocketIOPacket() : _endpointseparator(""), - _separator(":") { - _types.push_back("disconnect"); - _types.push_back("connect"); - _types.push_back("heartbeat"); - _types.push_back("message"); - _types.push_back("json"); - _types.push_back("event"); - _types.push_back("ack"); - _types.push_back("error"); - _types.push_back("noop"); +SocketIOPacket::SocketIOPacket() : _separator(":") { + _types.emplace_back("disconnect"); + _types.emplace_back("connect"); + _types.emplace_back("heartbeat"); + _types.emplace_back("message"); + _types.emplace_back("json"); + _types.emplace_back("event"); + _types.emplace_back("ack"); + _types.emplace_back("error"); + _types.emplace_back("noop"); } SocketIOPacket::~SocketIOPacket() { @@ -141,13 +141,13 @@ std::string SocketIOPacket::toString() const { encoded << this->_separator; // Add the endpoint for the namespace to be used if not the default namespace "" or "/", and as long as it is not an ACK, heartbeat, or disconnect packet - if (_endpoint != "/" && _endpoint != "" && _type != "ack" && _type != "heartbeat" && _type != "disconnect") { + if (_endpoint != "/" && !_endpoint.empty() && _type != "ack" && _type != "heartbeat" && _type != "disconnect") { encoded << _endpoint << _endpointseparator; } encoded << this->_separator; if (!_args.empty()) { - std::string ackpId = ""; + std::string ackpId; // This is an acknowledgement packet, so, prepend the ack pid to the data if (_type == "ack") { ackpId += pIdL + "+"; @@ -159,30 +159,27 @@ std::string SocketIOPacket::toString() const { return encoded.str(); } int SocketIOPacket::typeAsNumber() const { - std::string::size_type num = 0; - auto item = std::find(_types.begin(), _types.end(), _type); + std::string::size_type num = 0; + auto item = std::find(_types.begin(), _types.end(), _type); if (item != _types.end()) { num = item - _types.begin(); } - return (int)num; + return static_cast(num); } const std::string &SocketIOPacket::typeForIndex(int index) const { return _types.at(index); } void SocketIOPacket::addData(const std::string &data) { - this->_args.push_back(data); } std::string SocketIOPacket::stringify() const { - std::string outS; if (_type == "message") { outS = _args[0]; } else { - - rapidjson::StringBuffer s; + rapidjson::StringBuffer s; rapidjson::Writer writer(s); writer.StartObject(); @@ -193,7 +190,7 @@ std::string SocketIOPacket::stringify() const { writer.StartArray(); - for (auto &item : _args) { + for (const auto &item : _args) { writer.String(item.c_str()); } @@ -209,27 +206,27 @@ std::string SocketIOPacket::stringify() const { } SocketIOPacketV10x::SocketIOPacketV10x() { - _separator = ""; + _separator = ""; _endpointseparator = ","; - _types.push_back("disconnected"); - _types.push_back("connected"); - _types.push_back("heartbeat"); - _types.push_back("pong"); - _types.push_back("message"); - _types.push_back("upgrade"); - _types.push_back("noop"); - _typesMessage.push_back("connect"); - _typesMessage.push_back("disconnect"); - _typesMessage.push_back("event"); - _typesMessage.push_back("ack"); - _typesMessage.push_back("error"); - _typesMessage.push_back("binarevent"); - _typesMessage.push_back("binaryack"); + _types.emplace_back("disconnected"); + _types.emplace_back("connected"); + _types.emplace_back("heartbeat"); + _types.emplace_back("pong"); + _types.emplace_back("message"); + _types.emplace_back("upgrade"); + _types.emplace_back("noop"); + _typesMessage.emplace_back("connect"); + _typesMessage.emplace_back("disconnect"); + _typesMessage.emplace_back("event"); + _typesMessage.emplace_back("ack"); + _typesMessage.emplace_back("error"); + _typesMessage.emplace_back("binarevent"); + _typesMessage.emplace_back("binaryack"); } int SocketIOPacketV10x::typeAsNumber() const { - std::vector::size_type num = 0; - auto item = std::find(_typesMessage.begin(), _typesMessage.end(), _type); + std::vector::size_type num = 0; + auto item = std::find(_typesMessage.begin(), _typesMessage.end(), _type); if (item != _typesMessage.end()) { //it's a message num = item - _typesMessage.begin(); num += 40; @@ -237,20 +234,19 @@ int SocketIOPacketV10x::typeAsNumber() const { item = std::find(_types.begin(), _types.end(), _type); num += item - _types.begin(); } - return (int)num; + return static_cast(num); } std::string SocketIOPacketV10x::stringify() const { - std::string outS; - rapidjson::StringBuffer s; + rapidjson::StringBuffer s; rapidjson::Writer writer(s); writer.StartArray(); writer.String(_name.c_str()); - for (auto &item : _args) { + for (const auto &item : _args) { writer.String(item.c_str()); } @@ -266,20 +262,15 @@ std::string SocketIOPacketV10x::stringify() const { SocketIOPacketV10x::~SocketIOPacketV10x() { _types.clear(); _typesMessage.clear(); - _type = ""; - _pId = ""; - _name = ""; - _ack = ""; - _endpoint = ""; } SocketIOPacket *SocketIOPacket::createPacketWithType(const std::string &type, SocketIOPacket::SocketIOVersion version) { SocketIOPacket *ret; switch (version) { - case SocketIOPacket::SocketIOVersion::V09x: + case SocketIOPacket::SocketIOVersion::V09X: ret = new (std::nothrow) SocketIOPacket; break; - case SocketIOPacket::SocketIOVersion::V10x: + case SocketIOPacket::SocketIOVersion::V10X: ret = new (std::nothrow) SocketIOPacketV10x; break; } @@ -290,10 +281,10 @@ SocketIOPacket *SocketIOPacket::createPacketWithType(const std::string &type, So SocketIOPacket *SocketIOPacket::createPacketWithTypeIndex(int type, SocketIOPacket::SocketIOVersion version) { SocketIOPacket *ret; switch (version) { - case SocketIOPacket::SocketIOVersion::V09x: + case SocketIOPacket::SocketIOVersion::V09X: ret = new (std::nothrow) SocketIOPacket; break; - case SocketIOPacket::SocketIOVersion::V10x: + case SocketIOPacket::SocketIOVersion::V10X: return new (std::nothrow) SocketIOPacketV10x; break; } @@ -308,11 +299,11 @@ SocketIOPacket *SocketIOPacket::createPacketWithTypeIndex(int type, SocketIOPack class SIOClientImpl : public cc::Ref, public WebSocket::Delegate { private: - int _heartbeat, _timeout; - std::string _sid; - Uri _uri; - std::string _caFilePath; - bool _connected; + int _heartbeat, _timeout; + std::string _sid; + Uri _uri; + std::string _caFilePath; + bool _connected; SocketIOPacket::SocketIOVersion _version; WebSocket *_ws; @@ -320,26 +311,26 @@ private: Map _clients; public: - SIOClientImpl(const Uri &uri, const std::string &caFilePath); - virtual ~SIOClientImpl(); + SIOClientImpl(Uri uri, std::string caFilePath); + ~SIOClientImpl() override; static SIOClientImpl *create(const Uri &uri, const std::string &caFilePath); - virtual void onOpen(WebSocket *ws); - virtual void onMessage(WebSocket *ws, const WebSocket::Data &data); - virtual void onClose(WebSocket *ws); - virtual void onError(WebSocket *ws, const WebSocket::ErrorCode &error); + void onOpen(WebSocket *ws) override; + void onMessage(WebSocket *ws, const WebSocket::Data &data) override; + void onClose(WebSocket *ws) override; + void onError(WebSocket *ws, const WebSocket::ErrorCode &error) override; - void connect(); - void disconnect(); - bool init(); - void handshake(); - void handshakeResponse(HttpClient *sender, HttpResponse *response); - void openSocket(); - void heartbeat(float dt); + void connect(); + void disconnect(); + static bool init(); + void handshake(); + void handshakeResponse(HttpClient *sender, HttpResponse *response); + void openSocket(); + void heartbeat(float dt); SIOClient *getClient(const std::string &endpoint); - void addClient(const std::string &endpoint, SIOClient *client); + void addClient(const std::string &endpoint, SIOClient *client); void connectToEndpoint(const std::string &endpoint); void disconnectFromEndpoint(const std::string &endpoint); @@ -352,10 +343,10 @@ public: //method implementations //begin SIOClientImpl methods -SIOClientImpl::SIOClientImpl(const Uri &uri, const std::string &caFilePath) : _uri(uri), - _caFilePath(caFilePath), - _connected(false), - _ws(nullptr) { +SIOClientImpl::SIOClientImpl(Uri uri, std::string caFilePath) : _uri(std::move(uri)), + _caFilePath(std::move(caFilePath)), + _connected(false), + _ws(nullptr) { } SIOClientImpl::~SIOClientImpl() { @@ -369,18 +360,19 @@ void SIOClientImpl::handshake() { std::stringstream pre; - if (_uri.isSecure()) + if (_uri.isSecure()) { pre << "https://"; - else + } else { pre << "http://"; + } pre << _uri.getAuthority() << "/socket.io/1/?EIO=2&transport=polling&b64=true"; - HttpRequest *request = new (std::nothrow) HttpRequest(); + auto *request = new (std::nothrow) HttpRequest(); request->setUrl(pre.str()); request->setRequestType(HttpRequest::Type::GET); - request->setResponseCallback(CC_CALLBACK_2(SIOClientImpl::handshakeResponse, this)); + request->setResponseCallback([this](auto &&pH1, auto &&pH2) { handshakeResponse(std::forward(pH1), std::forward(pH2)); }); request->setTag("handshake"); CC_LOG_INFO("SIOClientImpl::handshake() waiting"); @@ -391,8 +383,6 @@ void SIOClientImpl::handshake() { HttpClient::getInstance()->send(request); request->release(); - - return; } void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *response) { @@ -402,7 +392,7 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res CC_LOG_INFO("%s completed", response->getHttpRequest()->getTag()); } - long statusCode = response->getResponseCode(); + int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); CC_LOG_INFO("response code: %ld", statusCode); @@ -422,7 +412,7 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res CC_LOG_INFO("SIOClientImpl::handshake() succeeded"); std::vector *buffer = response->getResponseData(); - std::stringstream s; + std::stringstream s; s.str(""); for (const auto &iter : *buffer) { @@ -432,79 +422,77 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res CC_LOG_INFO("SIOClientImpl::handshake() dump data: %s", s.str().c_str()); std::string res = s.str(); - std::string sid = ""; - int heartbeat = 0, timeout = 0; + std::string sid; + int heartbeat = 0; + int timeout = 0; if (res.find('}') != std::string::npos) { - CC_LOG_INFO("SIOClientImpl::handshake() Socket.IO 1.x detected"); - _version = SocketIOPacket::SocketIOVersion::V10x; + _version = SocketIOPacket::SocketIOVersion::V10X; // sample: 97:0{"sid":"GMkL6lzCmgMvMs9bAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000} // 96:0{"sid":"jzrjDlQusSUxLTd3AAAV","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 - std::string::size_type a, b; - a = res.find('{'); + std::string::size_type a; + std::string::size_type b; + a = res.find('{'); std::string temp = res.substr(a, res.size() - a); // find the sid - a = temp.find(":"); - b = temp.find(","); + a = temp.find(':'); + b = temp.find(','); sid = temp.substr(a + 2, b - (a + 3)); temp = temp.erase(0, b + 1); // chomp past the upgrades - b = temp.find(","); + b = temp.find(','); temp = temp.erase(0, b + 1); // get the pingInterval / heartbeat - a = temp.find(":"); - b = temp.find(","); + a = temp.find(':'); + b = temp.find(','); - std::string heartbeat_str = temp.substr(a + 1, b - a); - heartbeat = atoi(heartbeat_str.c_str()) / 1000; - temp = temp.erase(0, b + 1); + std::string heartbeatStr = temp.substr(a + 1, b - a); + heartbeat = atoi(heartbeatStr.c_str()) / 1000; + temp = temp.erase(0, b + 1); // get the timeout - a = temp.find(":"); - b = temp.find("}"); + a = temp.find(':'); + b = temp.find('}'); - std::string timeout_str = temp.substr(a + 1, b - a); - timeout = atoi(timeout_str.c_str()) / 1000; + std::string timeoutStr = temp.substr(a + 1, b - a); + timeout = atoi(timeoutStr.c_str()) / 1000; CC_LOG_INFO("done parsing 1.x"); } else { - CC_LOG_INFO("SIOClientImpl::handshake() Socket.IO 0.9.x detected"); - _version = SocketIOPacket::SocketIOVersion::V09x; + _version = SocketIOPacket::SocketIOVersion::V09X; // sample: 3GYzE9md2Ig-lm3cf8Rv:60:60:websocket,htmlfile,xhr-polling,jsonp-polling size_t pos = 0; - pos = res.find(":"); + pos = res.find(':'); if (pos != std::string::npos) { sid = res.substr(0, pos); res.erase(0, pos + 1); } - pos = res.find(":"); + pos = res.find(':'); if (pos != std::string::npos) { heartbeat = atoi(res.substr(pos + 1, res.size()).c_str()); } - pos = res.find(":"); + pos = res.find(':'); if (pos != std::string::npos) { timeout = atoi(res.substr(pos + 1, res.size()).c_str()); } } - _sid = sid; + _sid = sid; _heartbeat = heartbeat; - _timeout = timeout; + _timeout = timeout; openSocket(); - - return; } void SIOClientImpl::openSocket() { @@ -512,16 +500,17 @@ void SIOClientImpl::openSocket() { std::stringstream s; - if (_uri.isSecure()) + if (_uri.isSecure()) { s << "wss://"; - else + } else { s << "ws://"; + } switch (_version) { - case SocketIOPacket::SocketIOVersion::V09x: + case SocketIOPacket::SocketIOVersion::V09X: s << _uri.getAuthority() << "/socket.io/1/websocket/" << _sid; break; - case SocketIOPacket::SocketIOVersion::V10x: + case SocketIOPacket::SocketIOVersion::V10X: s << _uri.getAuthority() << "/socket.io/1/websocket/?EIO=2&transport=websocket&sid=" << _sid; break; } @@ -530,8 +519,6 @@ void SIOClientImpl::openSocket() { if (!_ws->init(*this, s.str(), nullptr, _caFilePath)) { CC_SAFE_RELEASE_NULL(_ws); } - - return; } bool SIOClientImpl::init() { @@ -545,14 +532,16 @@ void SIOClientImpl::connect() { void SIOClientImpl::disconnect() { if (_ws->getReadyState() == WebSocket::State::OPEN) { - std::string s, endpoint; - s = ""; + std::string s; + std::string endpoint; + s = ""; endpoint = ""; - if (_version == SocketIOPacket::SocketIOVersion::V09x) + if (_version == SocketIOPacket::SocketIOVersion::V09X) { s = "0::" + endpoint; - else + } else { s = "41" + endpoint; + } _ws->send(s); } @@ -567,7 +556,7 @@ void SIOClientImpl::disconnect() { } SIOClientImpl *SIOClientImpl::create(const Uri &uri, const std::string &caFilePath) { - SIOClientImpl *s = new (std::nothrow) SIOClientImpl(uri, caFilePath); + auto *s = new (std::nothrow) SIOClientImpl(uri, caFilePath); if (s && s->init()) { return s; @@ -597,8 +586,9 @@ void SIOClientImpl::disconnectFromEndpoint(const std::string &endpoint) { if (clientCount == 1 || endpoint == "/") { CC_LOG_INFO("SIOClientImpl::disconnectFromEndpoint out of endpoints, checking for disconnect"); - if (_connected) + if (_connected) { this->disconnect(); + } } else { std::string path = endpoint == "/" ? "" : endpoint; @@ -620,7 +610,7 @@ void SIOClientImpl::heartbeat(float /*dt*/) { void SIOClientImpl::send(const std::string &endpoint, const std::string &s) { switch (_version) { - case SocketIOPacket::SocketIOVersion::V09x: { + case SocketIOPacket::SocketIOVersion::V09X: { SocketIOPacket *packet = SocketIOPacket::createPacketWithType("message", _version); packet->setEndpoint(endpoint); packet->addData(s); @@ -628,7 +618,7 @@ void SIOClientImpl::send(const std::string &endpoint, const std::string &s) { delete packet; break; } - case SocketIOPacket::SocketIOVersion::V10x: { + case SocketIOPacket::SocketIOVersion::V10X: { this->emit(endpoint, "message", s); break; } @@ -639,7 +629,7 @@ void SIOClientImpl::send(SocketIOPacket *packet) { std::string req = packet->toString(); if (_connected) { CC_LOG_INFO("-->SEND:%s", req.data()); - _ws->send(req.data()); + _ws->send(req); } else CC_LOG_INFO("Cant send the message (%s) because disconnected", req.c_str()); } @@ -659,12 +649,12 @@ void SIOClientImpl::onOpen(WebSocket * /*ws*/) { SocketIO::getInstance()->addSocket(_uri.getAuthority(), this); - if (_version == SocketIOPacket::SocketIOVersion::V10x) { + if (_version == SocketIOPacket::SocketIOVersion::V10X) { std::string s = "5"; //That's a ping https://github.com/Automattic/engine.io-parser/blob/1b8e077b2218f4947a69f5ad18be2a512ed54e93/lib/index.js#L21 - _ws->send(s.data()); + _ws->send(s); } - Application::getInstance()->getScheduler()->schedule(CC_CALLBACK_1(SIOClientImpl::heartbeat, this), this, (_heartbeat * .9f), false, "heartbeat"); + Application::getInstance()->getScheduler()->schedule([this](auto &&pH1) { heartbeat(std::forward(pH1)); }, this, (static_cast(_heartbeat) * .9F), false, "heartbeat"); for (auto &client : _clients) { client.second->onOpen(); @@ -677,29 +667,33 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { CC_LOG_INFO("SIOClientImpl::onMessage received: %s", data.bytes); std::string payload = data.bytes; - int control = atoi(payload.substr(0, 1).c_str()); - payload = payload.substr(1, payload.size() - 1); + int control = atoi(payload.substr(0, 1).c_str()); + payload = payload.substr(1, payload.size() - 1); SIOClient *c = nullptr; switch (_version) { - case SocketIOPacket::SocketIOVersion::V09x: { - std::string msgid, endpoint, s_data, eventname; + case SocketIOPacket::SocketIOVersion::V09X: { + std::string msgid; + std::string endpoint; + std::string sData; + std::string eventname; - std::string::size_type pos, pos2; + std::string::size_type pos; + std::string::size_type pos2; - pos = payload.find(":"); + pos = payload.find(':'); if (pos != std::string::npos) { payload.erase(0, pos + 1); } - pos = payload.find(":"); + pos = payload.find(':'); if (pos != std::string::npos) { - msgid = atoi(payload.substr(0, pos + 1).c_str()); + msgid = std::to_string(atoi(payload.substr(0, pos + 1).c_str())); } payload.erase(0, pos + 1); - pos = payload.find(":"); + pos = payload.find(':'); if (pos != std::string::npos) { endpoint = payload.substr(0, pos); payload.erase(0, pos + 1); @@ -707,11 +701,11 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { endpoint = payload; } - if (endpoint == "") endpoint = "/"; + if (endpoint.empty()) endpoint = "/"; c = getClient(endpoint); - s_data = payload; + sData = payload; if (c == nullptr) CC_LOG_INFO("SIOClientImpl::onMessage client lookup returned nullptr"); @@ -734,28 +728,28 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { CC_LOG_INFO("Heartbeat received\n"); break; case 3: - CC_LOG_INFO("Message received: %s \n", s_data.c_str()); - if (c) c->getDelegate()->onMessage(c, s_data); - if (c) c->fireEvent("message", s_data); + CC_LOG_INFO("Message received: %s \n", sData.c_str()); + if (c) c->getDelegate()->onMessage(c, sData); + if (c) c->fireEvent("message", sData); break; case 4: - CC_LOG_INFO("JSON Message Received: %s \n", s_data.c_str()); - if (c) c->getDelegate()->onMessage(c, s_data); - if (c) c->fireEvent("json", s_data); + CC_LOG_INFO("JSON Message Received: %s \n", sData.c_str()); + if (c) c->getDelegate()->onMessage(c, sData); + if (c) c->fireEvent("json", sData); break; case 5: - CC_LOG_INFO("Event Received with data: %s \n", s_data.c_str()); + CC_LOG_INFO("Event Received with data: %s \n", sData.c_str()); if (c) { eventname = ""; - pos = s_data.find(":"); - pos2 = s_data.find(","); + pos = sData.find(':'); + pos2 = sData.find(','); if (pos2 > pos) { - eventname = s_data.substr(pos + 2, pos2 - (pos + 3)); - s_data = s_data.substr(pos2 + 9, s_data.size() - (pos2 + 11)); + eventname = sData.substr(pos + 2, pos2 - (pos + 3)); + sData = sData.substr(pos2 + 9, sData.size() - (pos2 + 11)); } - c->fireEvent(eventname, s_data); + c->fireEvent(eventname, sData); } break; @@ -765,14 +759,14 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { case 7: CC_LOG_ERROR("Error\n"); //if (c) c->getDelegate()->onError(c, s_data); - if (c) c->fireEvent("error", s_data); + if (c) c->fireEvent("error", sData); break; case 8: CC_LOG_INFO("Noop\n"); break; } } break; - case SocketIOPacket::SocketIOVersion::V10x: { + case SocketIOPacket::SocketIOVersion::V10X: { switch (control) { case 0: CC_LOG_INFO("Not supposed to receive control 0 for websocket"); @@ -797,10 +791,10 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { int control2 = payload.at(0) - '0'; CC_LOG_INFO("Message code: [%i]", control2); - std::string endpoint = ""; + std::string endpoint; - std::string::size_type a = payload.find("/"); - std::string::size_type b = payload.find("["); + std::string::size_type a = payload.find('/'); + std::string::size_type b = payload.find('['); if (b != std::string::npos) { if (a != std::string::npos && a < b) { @@ -813,14 +807,14 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { } // we didn't find and endpoint and we are in the default namespace - if (endpoint == "") endpoint = "/"; + if (endpoint.empty()) endpoint = "/"; c = getClient(endpoint); payload = payload.substr(1); if (endpoint != "/") payload = payload.substr(endpoint.size()); - if (endpoint != "/" && payload != "") payload = payload.substr(1); + if (endpoint != "/" && !payload.empty()) payload = payload.substr(1); switch (control2) { case 0: @@ -838,8 +832,8 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { case 2: { CC_LOG_INFO("Event Received (%s)", payload.c_str()); - std::string::size_type payloadFirstSlashPos = payload.find("\""); - std::string::size_type payloadSecondSlashPos = payload.substr(payloadFirstSlashPos + 1).find("\""); + std::string::size_type payloadFirstSlashPos = payload.find('\"'); + std::string::size_type payloadSecondSlashPos = payload.substr(payloadFirstSlashPos + 1).find('\"'); std::string eventname = payload.substr(payloadFirstSlashPos + 1, payloadSecondSlashPos - payloadFirstSlashPos + 1); @@ -878,8 +872,6 @@ void SIOClientImpl::onMessage(WebSocket * /*ws*/, const WebSocket::Data &data) { } } break; } - - return; } void SIOClientImpl::onClose(WebSocket * /*ws*/) { @@ -889,8 +881,9 @@ void SIOClientImpl::onClose(WebSocket * /*ws*/) { } // discard this client _connected = false; - if (Application::getInstance()) + if (Application::getInstance()) { Application::getInstance()->getScheduler()->unscheduleAllForTarget(this); + } SocketIO::getInstance()->removeSocket(_uri.getAuthority()); _clients.clear(); @@ -904,13 +897,13 @@ void SIOClientImpl::onError(WebSocket * /*ws*/, const WebSocket::ErrorCode &erro } //begin SIOClient methods -SIOClient::SIOClient(const std::string &path, SIOClientImpl *impl, SocketIO::SIODelegate &delegate) -: _path(path), +SIOClient::SIOClient(std::string path, SIOClientImpl *impl, SocketIO::SIODelegate &delegate) +: _path(std::move(path)), _connected(false), _socket(impl), _delegate(&delegate) { static uint32_t instanceIdCounter = 0; - _instanceId = instanceIdCounter++; + _instanceId = instanceIdCounter++; } SIOClient::~SIOClient() { @@ -959,7 +952,7 @@ void SIOClient::socketClosed() { } void SIOClient::on(const std::string &eventName, SIOEvent e) { - _eventRegistry[eventName] = e; + _eventRegistry[eventName] = std::move(e); } void SIOClient::fireEvent(const std::string &eventName, const std::string &data) { @@ -987,23 +980,22 @@ uint32_t SIOClient::getInstanceId() const { } //begin SocketIO methods -SocketIO *SocketIO::_inst = nullptr; +SocketIO *SocketIO::inst = nullptr; -SocketIO::SocketIO() { -} +SocketIO::SocketIO() = default; -SocketIO::~SocketIO() { -} +SocketIO::~SocketIO() = default; SocketIO *SocketIO::getInstance() { - if (nullptr == _inst) - _inst = new (std::nothrow) SocketIO(); + if (nullptr == inst) { + inst = new (std::nothrow) SocketIO(); + } - return _inst; + return inst; } void SocketIO::destroyInstance() { - CC_SAFE_DELETE(_inst); + CC_SAFE_DELETE(inst); } SIOClient *SocketIO::connect(SIODelegate &delegate, const std::string &uri) { @@ -1018,11 +1010,12 @@ SIOClient *SocketIO::connect(const std::string &uri, SIODelegate &delegate, cons Uri uriObj = Uri::parse(uri); SIOClientImpl *socket = SocketIO::getInstance()->getSocket(uriObj.getAuthority()); - SIOClient *c = nullptr; + SIOClient * c = nullptr; std::string path = uriObj.getPath(); - if (path == "") + if (path.empty()) { path = "/"; + } if (socket == nullptr) { //create a new socket, new client, connect @@ -1049,7 +1042,7 @@ SIOClient *SocketIO::connect(const std::string &uri, SIODelegate &delegate, cons CC_LOG_DEBUG("SocketIO: recreate a new socket, new client, connect"); SIOClientImpl *newSocket = SIOClientImpl::create(uriObj, caFilePath); - SIOClient *newC = new (std::nothrow) SIOClient(path, newSocket, delegate); + auto * newC = new (std::nothrow) SIOClient(path, newSocket, delegate); newSocket->addClient(path, newC); newSocket->connect(); diff --git a/native/cocos/network/SocketIO.h b/native/cocos/network/SocketIO.h index a920ee8bdc..7744085ede 100644 --- a/native/cocos/network/SocketIO.h +++ b/native/cocos/network/SocketIO.h @@ -27,9 +27,9 @@ #pragma once +#include #include #include -#include #include "base/Macros.h" #include "base/Map.h" @@ -59,7 +59,7 @@ public: * @return SocketIO* the instance of SocketIO. */ static SocketIO *getInstance(); - static void destroyInstance(); + static void destroyInstance(); /** * The delegate class to process socket.io events. @@ -68,7 +68,7 @@ public: class SIODelegate { public: /** Destructor of SIODelegate. */ - virtual ~SIODelegate() {} + virtual ~SIODelegate() = default; /** * This is kept for backwards compatibility, connect is now fired as a socket.io event "connect" * @@ -76,7 +76,7 @@ public: * * @param client the connected SIOClient object. */ - virtual void onConnect(SIOClient *client) { CC_LOG_DEBUG("SIODelegate onConnect fired"); }; + virtual void onConnect(SIOClient * /*client*/) { CC_LOG_DEBUG("SIODelegate onConnect fired"); }; /** * This is kept for backwards compatibility, message is now fired as a socket.io event "message" * @@ -85,7 +85,7 @@ public: * @param client the connected SIOClient object. * @param data the message,it could be json message */ - virtual void onMessage(SIOClient *client, const std::string &data) { CC_LOG_DEBUG("SIODelegate onMessage fired with data: %s", data.c_str()); }; + virtual void onMessage(SIOClient * /*client*/, const std::string &data) { CC_LOG_DEBUG("SIODelegate onMessage fired with data: %s", data.c_str()); }; /** * Pure virtual callback function, this function should be overridden by the subclass. * @@ -110,7 +110,7 @@ public: * @param eventName the event's name. * @param data the event's data information. */ - virtual void fireEventToScript(SIOClient *client, const std::string &eventName, const std::string &data) { CC_LOG_DEBUG("SIODelegate event '%s' fired with data: %s", eventName.c_str(), data.c_str()); }; + virtual void fireEventToScript(SIOClient * /*client*/, const std::string &eventName, const std::string &data) { CC_LOG_DEBUG("SIODelegate event '%s' fired with data: %s", eventName.c_str(), data.c_str()); }; }; /** @@ -142,24 +142,24 @@ private: SocketIO(); virtual ~SocketIO(); - static SocketIO *_inst; + static SocketIO *inst; cc::Map _sockets; SIOClientImpl *getSocket(const std::string &uri); - void addSocket(const std::string &uri, SIOClientImpl *socket); - void removeSocket(const std::string &uri); + void addSocket(const std::string &uri, SIOClientImpl *socket); + void removeSocket(const std::string &uri); friend class SIOClientImpl; -private: - CC_DISALLOW_COPY_AND_ASSIGN(SocketIO) + DISABLE_COPY_SEMANTICS(SocketIO) + DISABLE_MOVE_SEMANTICS(SocketIO) }; //c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind) -typedef std::function SIOEvent; +using SIOEvent = std::function; //c++11 map to callbacks -typedef std::unordered_map EventRegistry; +using EventRegistry = std::unordered_map; /** * A single connection to a socket.io endpoint. @@ -171,14 +171,14 @@ class CC_DLL SIOClient private: friend class SocketIO; // Only SocketIO class could contruct a SIOClient instance. - std::string _path, _tag; - bool _connected; + std::string _path, _tag; + bool _connected; SIOClientImpl *_socket; SocketIO::SIODelegate *_delegate; EventRegistry _eventRegistry; - uint32_t _instanceId; + uint32_t _instanceId; void fireEvent(const std::string &eventName, const std::string &data); @@ -197,11 +197,11 @@ private: * @param impl the SIOClientImpl object. * @param delegate the SIODelegate object. */ - SIOClient(const std::string &path, SIOClientImpl *impl, SocketIO::SIODelegate &delegate); + SIOClient(std::string path, SIOClientImpl *impl, SocketIO::SIODelegate &delegate); /** * Destructor of SIOClient class. */ - virtual ~SIOClient(); + ~SIOClient() override; public: /** diff --git a/native/cocos/platform/Device.h b/native/cocos/platform/Device.h index 354099c55b..e6289419c1 100644 --- a/native/cocos/platform/Device.h +++ b/native/cocos/platform/Device.h @@ -144,7 +144,8 @@ public: private: Device(); - CC_DISALLOW_COPY_AND_ASSIGN(Device); + DISABLE_COPY_SEMANTICS(Device) + DISABLE_MOVE_SEMANTICS(Device) }; // end group diff --git a/native/cocos/platform/FileUtils.h b/native/cocos/platform/FileUtils.h index d6797cb155..9d7348d696 100644 --- a/native/cocos/platform/FileUtils.h +++ b/native/cocos/platform/FileUtils.h @@ -343,9 +343,9 @@ public: /** * Gets the array of search paths. * - * @return The array of search paths which may contain the prefix of default resource root path. + * @return The array of search paths which may contain the prefix of default resource root path. * @note In best practise, getter function should return the value of setter function passes in. - * But since we should not break the compatibility, we keep using the old logic. + * But since we should not break the compatibility, we keep using the old logic. * Therefore, If you want to get the original search paths, please call 'getOriginalSearchPaths()' instead. * @see fullPathForFilename(const char*). * @lua NA @@ -640,8 +640,8 @@ protected: /** * Remove null value key (for iOS) */ - virtual void valueMapCompact(ValueMap &valueMap); // NOLINT(google-runtime-references) - virtual void valueVectorCompact(ValueVector &valueVector); // NOLINT(google-runtime-references) + virtual void valueMapCompact(ValueMap &valueMap); + virtual void valueVectorCompact(ValueVector &valueVector); }; // end of support group diff --git a/native/cocos/platform/android/jni/JniCocosActivity.cpp b/native/cocos/platform/android/jni/JniCocosActivity.cpp index 8a00bf6ddb..4ce6295bc9 100644 --- a/native/cocos/platform/android/jni/JniCocosActivity.cpp +++ b/native/cocos/platform/android/jni/JniCocosActivity.cpp @@ -63,7 +63,7 @@ void writeCommand(int8_t cmd) { write(pipeWrite, &cmd, sizeof(cmd)); } -int readCommand(int8_t &cmd) { //NOLINT(google-runtime-references) +int readCommand(int8_t &cmd) { return read(pipeRead, &cmd, sizeof(cmd)); } diff --git a/native/cocos/renderer/frame-graph/DevicePass.cpp b/native/cocos/renderer/frame-graph/DevicePass.cpp index aa617b7a1e..5daa8cbdb9 100644 --- a/native/cocos/renderer/frame-graph/DevicePass.cpp +++ b/native/cocos/renderer/frame-graph/DevicePass.cpp @@ -66,7 +66,8 @@ void DevicePass::execute() { begin(cmdBuff); - for (Subpass &subPass : _subpasses) { + for (size_t i = 0; i < _subpasses.size(); ++i) { + Subpass &subPass = _subpasses[i]; for (LogicPass &pass : subPass.logicPasses) { gfx::Viewport &viewport = pass.customViewport ? pass.viewport : _viewport; gfx::Rect & scissor = pass.customViewport ? pass.scissor : _scissor; @@ -83,7 +84,7 @@ void DevicePass::execute() { pass.pass->execute(_resourceTable); } - next(cmdBuff); + if (i < _subpasses.size() - 1) next(cmdBuff); } end(cmdBuff); @@ -188,6 +189,9 @@ void DevicePass::begin(gfx::CommandBuffer *cmdBuff) { } void DevicePass::next(gfx::CommandBuffer *cmdBuff) noexcept { + if (!_renderPass.get() || !_fbo.get()) return; + + cmdBuff->nextSubpass(); } void DevicePass::end(gfx::CommandBuffer *cmdBuff) { diff --git a/native/cocos/renderer/frame-graph/FrameGraph.cpp b/native/cocos/renderer/frame-graph/FrameGraph.cpp index 15c0ad5a92..e05ddb90c1 100644 --- a/native/cocos/renderer/frame-graph/FrameGraph.cpp +++ b/native/cocos/renderer/frame-graph/FrameGraph.cpp @@ -25,44 +25,63 @@ #include "FrameGraph.h" -#include "PassNodeBuilder.h" -#include "Resource.h" #include #include #include +#include "PassNodeBuilder.h" +#include "Resource.h" namespace cc { namespace framegraph { namespace { -StringPool stringPool; +// using function scoped static member +// to ensure correct initialization order +StringPool &getStringPool() { + static StringPool pool; + return pool; } +} // namespace FrameGraph::~FrameGraph() { gc(0); } StringHandle FrameGraph::stringToHandle(const char *const name) { - return stringPool.stringToHandle(name); + return getStringPool().stringToHandle(name); } const char *FrameGraph::handleToString(const StringHandle &handle) noexcept { - return stringPool.handleToString(handle); + return getStringPool().handleToString(handle); } -void FrameGraph::present(const Handle &input) { - struct PassDataPresent {}; +void FrameGraph::present(const TextureHandle &input) { static const StringHandle S_NAME_PRESENT = FrameGraph::stringToHandle("Present"); - const ResourceNode & resourceNode = getResourceNode(input); + const ResourceNode & resourceNode = getResourceNode(input); CC_ASSERT(resourceNode.writer); + struct PassDataPresent { + TextureHandle input; + }; + addPass( resourceNode.writer->_insertPoint, S_NAME_PRESENT, - [&](PassNodeBuilder &builder, PassDataPresent & /*data*/) { - builder.read(input); + [&](PassNodeBuilder &builder, PassDataPresent &data) { + data.input = builder.read(input); builder.sideEffect(); }, [](const PassDataPresent &data, const DevicePassResourceTable &table) { + auto *cmdBuff = gfx::Device::getInstance()->getCommandBuffer(); + + gfx::Texture *input = table.getRead(data.input); + if (input) { + gfx::TextureBlit region; + region.srcExtent.width = input->getWidth(); + region.srcExtent.height = input->getHeight(); + region.dstExtent.width = input->getWidth(); + region.dstExtent.height = input->getHeight(); + cmdBuff->blitTexture(input, nullptr, ®ion, 1, gfx::Filter::POINT); + } }); } @@ -72,11 +91,11 @@ void FrameGraph::presentLastVersion(const VirtualResource *const virtualResource }); CC_ASSERT(it != _resourceNodes.rend()); - present(Handle(static_cast(it.base() - _resourceNodes.begin() - 1))); + present(TextureHandle(static_cast(it.base() - _resourceNodes.begin() - 1))); } void FrameGraph::presentFromBlackboard(const StringHandle &inputName) { - present(Handle(_blackboard.get(inputName))); + present(TextureHandle(_blackboard.get(inputName))); } void FrameGraph::compile() { @@ -335,7 +354,6 @@ void FrameGraph::computeStoreActionAndMemoryless() { lastPassSubPassEnable = passNode->_subpass && !passNode->_subpassEnd; } - const PassNode * lastPassNode = nullptr; static std::set renderTargets; renderTargets.clear(); @@ -423,14 +441,11 @@ void FrameGraph::generateDevicePasses() { } CC_ASSERT(subPassNodes.size() == 1); - static const StringHandle S_NAME_PRESENT = FrameGraph::stringToHandle("Present"); - if (subPassNodes.back()->_name != S_NAME_PRESENT) { - _devicePasses.emplace_back(new DevicePass(*this, subPassNodes)); + _devicePasses.emplace_back(new DevicePass(*this, subPassNodes)); - for (PassNode *const p : subPassNodes) { - p->releaseTransientResources(); - } + for (PassNode *const p : subPassNodes) { + p->releaseTransientResources(); } } @@ -520,7 +535,8 @@ void FrameGraph::exportGraphViz(const std::string &path) { } out << "\", style=filled, fillcolor=" - << ((node.virtualResource->isImported()) ? (node.virtualResource->_refCount ? "palegreen" : "palegreen4") : node.version == 0 ? "pink" : (node.virtualResource->_refCount ? "skyblue" : "skyblue4")) + << ((node.virtualResource->isImported()) ? (node.virtualResource->_refCount ? "palegreen" : "palegreen4") : node.version == 0 ? "pink" + : (node.virtualResource->_refCount ? "skyblue" : "skyblue4")) << "]\n"; } diff --git a/native/cocos/renderer/frame-graph/FrameGraph.h b/native/cocos/renderer/frame-graph/FrameGraph.h index 5b08786513..614aad8493 100644 --- a/native/cocos/renderer/frame-graph/FrameGraph.h +++ b/native/cocos/renderer/frame-graph/FrameGraph.h @@ -53,7 +53,7 @@ public: static StringHandle stringToHandle(const char *name); static const char * handleToString(const StringHandle &handle) noexcept; - void present(const Handle &input); + void present(const TextureHandle &input); void presentLastVersion(const VirtualResource *virtualResource); void presentFromBlackboard(const StringHandle &inputName); void compile(); @@ -132,13 +132,13 @@ void FrameGraph::enableMerge(bool const enable) noexcept { ////////////////////////////////////////////////////////////////////////// template -void PassNodeBuilder::create(TypedHandle &handle, const StringHandle &name, const typename ResourceType::Descriptor &desc) const noexcept { - handle = _graph.create(name, desc); +TypedHandle PassNodeBuilder::create(const StringHandle &name, const typename ResourceType::Descriptor &desc) const noexcept { + return _graph.create(name, desc); } template -void PassNodeBuilder::importExternal(TypedHandle &handle, const StringHandle &name, ResourceType &resource) const noexcept { - handle = _graph.importExternal(name, resource); +TypedHandle PassNodeBuilder::importExternal(const StringHandle &name, ResourceType &resource) const noexcept { + return _graph.importExternal(name, resource); } } // namespace framegraph diff --git a/native/cocos/renderer/frame-graph/PassNode.h b/native/cocos/renderer/frame-graph/PassNode.h index 92c4ce540b..e184151e6c 100644 --- a/native/cocos/renderer/frame-graph/PassNode.h +++ b/native/cocos/renderer/frame-graph/PassNode.h @@ -100,7 +100,7 @@ void PassNode::sideEffect() noexcept { _sideEffect = true; } -void PassNode::subpass(bool clearActionIgnoreable, bool const end) noexcept { +void PassNode::subpass(bool clearActionIgnoreable, bool end) noexcept { _subpass = true; _clearActionIgnoreable = clearActionIgnoreable; _subpassEnd = end; diff --git a/native/cocos/renderer/frame-graph/PassNodeBuilder.h b/native/cocos/renderer/frame-graph/PassNodeBuilder.h index b6b12a7b38..c0e4e97333 100644 --- a/native/cocos/renderer/frame-graph/PassNodeBuilder.h +++ b/native/cocos/renderer/frame-graph/PassNodeBuilder.h @@ -41,25 +41,26 @@ public: PassNodeBuilder &operator=(PassNodeBuilder &&) = delete; template - void create(TypedHandle &handle, const StringHandle &name, const typename ResourceType::Descriptor &desc) const noexcept; + TypedHandle create(const StringHandle &name, const typename ResourceType::Descriptor &desc) const noexcept; template - void importExternal(TypedHandle &handle, const StringHandle &name, ResourceType &resource) const noexcept; + TypedHandle importExternal(const StringHandle &name, ResourceType &resource) const noexcept; template TypedHandle read(TypedHandle const &input) const noexcept; - Handle read(const Handle &input) const noexcept; template TypedHandle write(TypedHandle const &output) const noexcept; TextureHandle write(const TextureHandle &output, uint8_t mipmapLevel, uint8_t faceId, uint8_t arrayPosition, const RenderTargetAttachment::Descriptor &attachmentDesc) const noexcept; TextureHandle write(const TextureHandle &output, const RenderTargetAttachment::Descriptor &attachmentDesc) const noexcept; inline void sideEffect() const noexcept; - inline void subpass(bool clearActionIgnoreable, bool const end) const noexcept; + inline void subpass(bool clearActionIgnoreable, bool end) const noexcept; inline void setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept; void writeToBlackboard(const StringHandle &name, const Handle &handle) const noexcept; Handle readFromBlackboard(const StringHandle &name) const noexcept; private: + Handle read(const Handle &input) const noexcept; + FrameGraph &_graph; PassNode & _passNode; }; @@ -80,7 +81,7 @@ void PassNodeBuilder::sideEffect() const noexcept { _passNode.sideEffect(); } -void PassNodeBuilder::subpass(bool clearActionIgnoreable, bool const end) const noexcept { +void PassNodeBuilder::subpass(bool clearActionIgnoreable, bool end) const noexcept { _passNode.subpass(clearActionIgnoreable, end); } diff --git a/native/cocos/renderer/frame-graph/RenderTargetAttachment.h b/native/cocos/renderer/frame-graph/RenderTargetAttachment.h index 9cace61d51..0c9799140a 100644 --- a/native/cocos/renderer/frame-graph/RenderTargetAttachment.h +++ b/native/cocos/renderer/frame-graph/RenderTargetAttachment.h @@ -70,15 +70,10 @@ struct RenderTargetAttachment final { }; inline bool RenderTargetAttachment::Sorter::operator()(const RenderTargetAttachment &a1, const RenderTargetAttachment &a2) const noexcept { - bool res = false; - if (a1.desc.usage < a2.desc.usage) { - res = true; - } else if (a1.desc.usage == a2.desc.usage) { - res = a1.desc.slot < a2.desc.slot; - } else { - res = false; + if (a1.desc.usage == a2.desc.usage) { + return a1.desc.slot < a2.desc.slot; } - return res; + return a1.desc.usage < a2.desc.usage; } } // namespace framegraph diff --git a/native/cocos/renderer/gfx-agent/BufferAgent.cpp b/native/cocos/renderer/gfx-agent/BufferAgent.cpp index 570af9b910..21f9de31f3 100644 --- a/native/cocos/renderer/gfx-agent/BufferAgent.cpp +++ b/native/cocos/renderer/gfx-agent/BufferAgent.cpp @@ -24,8 +24,7 @@ ****************************************************************************/ #include "base/CoreStd.h" -#include "base/threading/ThreadSafeLinearAllocator.h" -#include "base/threading/MessageQueue.h" +#include "base/memory/Memory.h" #include "BufferAgent.h" #include "DeviceAgent.h" @@ -50,12 +49,12 @@ BufferAgent::~BufferAgent() { void BufferAgent::doInit(const BufferInfo &info) { uint size = getSize(); - if(size > MessageQueue::getChunckSize() / 2) { - for (auto &allocator : _allocator) { - allocator = CC_NEW(ThreadSafeLinearAllocator(size)); + if (size > STAGING_BUFFER_THRESHOLD && hasFlag(_memUsage, MemoryUsageBit::HOST)) { + for (size_t i = 0; i < DeviceAgent::MAX_FRAME_INDEX; ++i) { + _stagingBuffers.push_back(reinterpret_cast(malloc(size))); } } - + ENQUEUE_MESSAGE_2( DeviceAgent::getInstance()->getMessageQueue(), BufferInit, @@ -69,13 +68,8 @@ void BufferAgent::doInit(const BufferInfo &info) { void BufferAgent::doInit(const BufferViewInfo &info) { BufferViewInfo actorInfo = info; actorInfo.buffer = static_cast(info.buffer)->getActor(); - - uint size = getSize(); - if(size > MessageQueue::getChunckSize() / 2) { - for (auto &allocator : _allocator) { - allocator = CC_NEW(ThreadSafeLinearAllocator(size)); - } - } + + // buffer views don't need staging buffers ENQUEUE_MESSAGE_2( DeviceAgent::getInstance()->getMessageQueue(), @@ -88,20 +82,32 @@ void BufferAgent::doInit(const BufferViewInfo &info) { } void BufferAgent::doResize(uint size, uint /*count*/) { - uint originalSize = getSize(); - if(size > originalSize && size > MessageQueue::getChunckSize() / 2) { - for (auto &allocator : _allocator) { - CC_SAFE_DELETE(allocator); + auto *mq = DeviceAgent::getInstance()->getMessageQueue(); + + if (!_stagingBuffers.empty()) { + auto *oldStagingBuffers = mq->allocate(STAGING_BUFFER_THRESHOLD); + for (size_t i = 0; i < DeviceAgent::MAX_FRAME_INDEX; ++i) { + oldStagingBuffers[i] = _stagingBuffers[i]; } - - for (auto &allocator : _allocator) { - allocator = CC_NEW(ThreadSafeLinearAllocator(size)); + _stagingBuffers.clear(); + ENQUEUE_MESSAGE_1( + mq, BufferFreeStagingBuffer, + stagingBuffers, oldStagingBuffers, + { + for (size_t i = 0; i < DeviceAgent::MAX_FRAME_INDEX; ++i) { + free(stagingBuffers[i]); + } + }); + } + + if (size > STAGING_BUFFER_THRESHOLD && hasFlag(_memUsage, MemoryUsageBit::HOST)) { + for (size_t i = 0; i < DeviceAgent::MAX_FRAME_INDEX; ++i) { + _stagingBuffers.push_back(reinterpret_cast(malloc(size))); } } - + ENQUEUE_MESSAGE_2( - DeviceAgent::getInstance()->getMessageQueue(), - BufferResize, + mq, BufferResize, actor, getActor(), size, size, { @@ -110,66 +116,59 @@ void BufferAgent::doResize(uint size, uint /*count*/) { } void BufferAgent::doDestroy() { - ENQUEUE_MESSAGE_1( - DeviceAgent::getInstance()->getMessageQueue(), - BufferDestroy, + auto * mq = DeviceAgent::getInstance()->getMessageQueue(); + uint8_t **oldStagingBuffers{nullptr}; + if (!_stagingBuffers.empty()) { + oldStagingBuffers = mq->allocate(DeviceAgent::MAX_FRAME_INDEX); + for (size_t i = 0; i < DeviceAgent::MAX_FRAME_INDEX; ++i) { + oldStagingBuffers[i] = _stagingBuffers[i]; + } + _stagingBuffers.clear(); + } + + ENQUEUE_MESSAGE_2( + mq, BufferDestroy, actor, getActor(), + stagingBuffers, oldStagingBuffers, { actor->destroy(); + if (stagingBuffers) { + for (size_t i = 0; i < DeviceAgent::MAX_FRAME_INDEX; ++i) { + free(stagingBuffers[i]); + } + } }); - - for (auto &allocator : _allocator) { - if(allocator) { - ENQUEUE_MESSAGE_1( - DeviceAgent::getInstance()->getMessageQueue(), - BufferDestroy, - allocator, allocator, - { - CC_DELETE(allocator); - }); - } - } } void BufferAgent::update(const void *buffer, uint size) { update(buffer, size, DeviceAgent::getInstance()->getMessageQueue()); } -void BufferAgent::update(const void *buffer, uint size, MessageQueue* dstMsgQ) { - ThreadSafeLinearAllocator *allocator = nullptr; - uint8_t *actorBuffer = nullptr; - +void BufferAgent::update(const void *buffer, uint size, MessageQueue *mq) { + uint8_t *actorBuffer{nullptr}; + bool needToFreeActorBuffer{false}; + uint frameIndex = DeviceAgent::getInstance()->getCurrentIndex(); - - bool useMsgQ = size <= MessageQueue::getChunckSize() / 2; // reserve half for message itself - if (useMsgQ) { // buffer will be allocated by message queue if it could be put in, - auto *msgQ = DeviceAgent::getInstance()->getMessageQueue(); // memory fragment can be avoid by mem pool inside - actorBuffer = msgQ->allocate(size); - memcpy(actorBuffer, buffer, size); - } else { // otherwise using threadSafeAllocator. - if(hasFlag(getMemUsage(), MemoryUsageBit::HOST)) { // there's a staging buffer if frequently update - allocator = _allocator[frameIndex]; - allocator->recycle(); - } else { // new and delete buffer if barely udpate - allocator = CC_NEW(ThreadSafeLinearAllocator(size)); - } - actorBuffer = allocator->allocate(size); - memcpy(actorBuffer, buffer, size); + + if (!_stagingBuffers.empty()) { // for frequent updates on big buffers + actorBuffer = _stagingBuffers[frameIndex]; + } else if (size > STAGING_BUFFER_THRESHOLD) { // less frequent updates on big buffers + actorBuffer = reinterpret_cast(malloc(size)); + needToFreeActorBuffer = true; + } else { // for small enough buffers + actorBuffer = mq->allocate(size); } + memcpy(actorBuffer, buffer, size); ENQUEUE_MESSAGE_4( - dstMsgQ, - BufferUpdate, + mq, BufferUpdate, actor, getActor(), buffer, actorBuffer, size, size, - allocator, allocator, + needToFreeActorBuffer, needToFreeActorBuffer, { actor->update(buffer, size); - - if(!hasFlag(actor->getMemUsage(), MemoryUsageBit::HOST)) { - CC_SAFE_DELETE(allocator); - } + if (needToFreeActorBuffer) free(buffer); }); } diff --git a/native/cocos/renderer/gfx-agent/BufferAgent.h b/native/cocos/renderer/gfx-agent/BufferAgent.h index ede6e740c5..daf9c9695a 100644 --- a/native/cocos/renderer/gfx-agent/BufferAgent.h +++ b/native/cocos/renderer/gfx-agent/BufferAgent.h @@ -26,12 +26,12 @@ #pragma once #include "base/Agent.h" +#include "base/threading/MessageQueue.h" #include "gfx-base/GFXBuffer.h" namespace cc { class ThreadSafeLinearAllocator; -class MessageQueue; namespace gfx { @@ -41,17 +41,18 @@ public: ~BufferAgent() override; void update(const void *buffer, uint size) override; - - void update(const void *buffer, uint size, MessageQueue* msgQ); -protected: + void update(const void *buffer, uint size, MessageQueue *mq); + +private: void doInit(const BufferInfo &info) override; void doInit(const BufferViewInfo &info) override; void doResize(uint size, uint count) override; void doDestroy() override; - -private: - ThreadSafeLinearAllocator* _allocator[MAX_CPU_FRAME_AHEAD + 1] = {nullptr, nullptr}; + + static constexpr uint STAGING_BUFFER_THRESHOLD = MessageQueue::MEMORY_CHUNK_SIZE / 2; + + vector _stagingBuffers; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp b/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp index 911d32de63..438511a52c 100644 --- a/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp +++ b/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp @@ -23,12 +23,8 @@ THE SOFTWARE. ****************************************************************************/ -#include "base/CoreStd.h" -#include "base/job-system/JobSystem.h" -#include "base/threading/MessageQueue.h" -#include "base/threading/ThreadSafeLinearAllocator.h" -#include "BufferAgent.h" #include "CommandBufferAgent.h" +#include "BufferAgent.h" #include "DescriptorSetAgent.h" #include "DeviceAgent.h" #include "FramebufferAgent.h" @@ -37,6 +33,10 @@ #include "QueueAgent.h" #include "RenderPassAgent.h" #include "TextureAgent.h" +#include "base/CoreStd.h" +#include "base/job-system/JobSystem.h" +#include "base/threading/MessageQueue.h" +#include "base/threading/ThreadSafeLinearAllocator.h" namespace cc { namespace gfx { @@ -356,7 +356,7 @@ void CommandBufferAgent::copyBuffersToTexture(const uint8_t *const *buffers, Tex bufferCount += regions[i].texSubres.layerCount; } uint totalSize = sizeof(BufferTextureCopy) * count + sizeof(uint8_t *) * bufferCount; - for (uint i = 0U, n = 0U; i < count; i++) { + for (uint i = 0U; i < count; i++) { const BufferTextureCopy ®ion = regions[i]; uint size = formatSize(texture->getFormat(), region.texExtent.width, region.texExtent.height, 1); diff --git a/native/cocos/renderer/gfx-agent/DeviceAgent.cpp b/native/cocos/renderer/gfx-agent/DeviceAgent.cpp index 140b3716d2..ac26635786 100644 --- a/native/cocos/renderer/gfx-agent/DeviceAgent.cpp +++ b/native/cocos/renderer/gfx-agent/DeviceAgent.cpp @@ -87,8 +87,8 @@ bool DeviceAgent::doInit(const DeviceInfo &info) { void DeviceAgent::doDestroy() { ENQUEUE_MESSAGE_1( - getMessageQueue(), DeviceDestroy, - actor, getActor(), + _mainMessageQueue, DeviceDestroy, + actor, _actor, { actor->destroy(); }); @@ -107,13 +107,12 @@ void DeviceAgent::doDestroy() { _mainMessageQueue->terminateConsumerThread(); CC_SAFE_DELETE(_mainMessageQueue); - } void DeviceAgent::resize(uint width, uint height) { ENQUEUE_MESSAGE_3( - getMessageQueue(), DeviceResize, - actor, getActor(), + _mainMessageQueue, DeviceResize, + actor, _actor, width, width, height, height, { @@ -124,7 +123,7 @@ void DeviceAgent::resize(uint width, uint height) { void DeviceAgent::acquire() { ENQUEUE_MESSAGE_1( _mainMessageQueue, DeviceAcquire, - actor, getActor(), + actor, _actor, { actor->acquire(); }); @@ -133,7 +132,7 @@ void DeviceAgent::acquire() { void DeviceAgent::present() { ENQUEUE_MESSAGE_2( _mainMessageQueue, DevicePresent, - actor, getActor(), + actor, _actor, frameBoundarySemaphore, &_frameBoundarySemaphore, { actor->present(); @@ -142,7 +141,7 @@ void DeviceAgent::present() { MessageQueue::freeChunksInFreeQueue(_mainMessageQueue); _mainMessageQueue->finishWriting(); - _currentIndex = (_currentIndex + 1) % (MAX_CPU_FRAME_AHEAD + 1); + _currentIndex = (_currentIndex + 1) % MAX_FRAME_INDEX; _frameBoundarySemaphore.wait(); } @@ -307,7 +306,7 @@ void DeviceAgent::copyBuffersToTexture(const uint8_t *const *buffers, Texture *d ENQUEUE_MESSAGE_6( _mainMessageQueue, DeviceCopyBuffersToTexture, - actor, getActor(), + actor, _actor, buffers, actorBuffers, dst, static_cast(dst)->getActor(), regions, actorRegions, @@ -322,7 +321,7 @@ void DeviceAgent::copyBuffersToTexture(const uint8_t *const *buffers, Texture *d void DeviceAgent::flushCommands(CommandBuffer *const *cmdBuffs, uint count) { if (!_multithreaded) return; // all command buffers are immediately executed - auto **agentCmdBuffs = getMessageQueue()->allocate(count); + auto **agentCmdBuffs = _mainMessageQueue->allocate(count); for (uint i = 0; i < count; ++i) { agentCmdBuffs[i] = static_cast(cmdBuffs[i]); @@ -334,7 +333,7 @@ void DeviceAgent::flushCommands(CommandBuffer *const *cmdBuffs, uint count) { _mainMessageQueue, DeviceFlushCommands, count, count, cmdBuffs, agentCmdBuffs, - multiThreaded, getActor()->_multithreadedSubmission, + multiThreaded, _actor->_multithreadedSubmission, { CommandBufferAgent::flushCommands(count, cmdBuffs, multiThreaded); }); diff --git a/native/cocos/renderer/gfx-agent/DeviceAgent.h b/native/cocos/renderer/gfx-agent/DeviceAgent.h index bc1cc00862..972ac5532d 100644 --- a/native/cocos/renderer/gfx-agent/DeviceAgent.h +++ b/native/cocos/renderer/gfx-agent/DeviceAgent.h @@ -40,7 +40,9 @@ class CommandBufferAgent; class CC_DLL DeviceAgent final : public Agent { public: - static DeviceAgent *getInstance(); + static DeviceAgent * getInstance(); + static constexpr uint MAX_CPU_FRAME_AHEAD = 1; + static constexpr uint MAX_FRAME_INDEX = MAX_CPU_FRAME_AHEAD + 1; ~DeviceAgent() override; @@ -91,10 +93,10 @@ public: uint getNumInstances() const override { return _actor->getNumInstances(); } uint getNumTris() const override { return _actor->getNumTris(); } - uint getCurrentIndex() const { return _currentIndex; } + uint getCurrentIndex() const { return _currentIndex; } void setMultithreaded(bool multithreaded); - inline MessageQueue * getMessageQueue() const { return _mainMessageQueue; } + inline MessageQueue *getMessageQueue() const { return _mainMessageQueue; } protected: static DeviceAgent *instance; @@ -113,8 +115,8 @@ protected: bool _multithreaded{false}; MessageQueue *_mainMessageQueue{nullptr}; - uint _currentIndex = 0U; - Semaphore _frameBoundarySemaphore{MAX_CPU_FRAME_AHEAD}; + uint _currentIndex = 0U; + Semaphore _frameBoundarySemaphore{MAX_CPU_FRAME_AHEAD}; unordered_set _cmdBuffRefs; }; diff --git a/native/cocos/renderer/gfx-base/GFXDef-common.h b/native/cocos/renderer/gfx-base/GFXDef-common.h index e2f93ccc18..bda2ac3e77 100644 --- a/native/cocos/renderer/gfx-base/GFXDef-common.h +++ b/native/cocos/renderer/gfx-base/GFXDef-common.h @@ -102,12 +102,14 @@ enum class ObjectType { TEXTURE_BARRIER, BUFFER_BARRIER, }; +CC_ENUM_CONVERSION_OPERATOR(ObjectType); enum class Status { UNREADY, FAILED, SUCCESS, }; +CC_ENUM_CONVERSION_OPERATOR(Status); enum class API { UNKNOWN, @@ -119,6 +121,7 @@ enum class API { WEBGL2, WEBGPU, }; +CC_ENUM_CONVERSION_OPERATOR(API); enum class SurfaceTransform { IDENTITY, @@ -126,6 +129,7 @@ enum class SurfaceTransform { ROTATE_180, ROTATE_270, }; +CC_ENUM_CONVERSION_OPERATOR(SurfaceTransform); enum class Feature { COLOR_FLOAT, @@ -149,6 +153,7 @@ enum class Feature { COMPUTE_SHADER, COUNT, }; +CC_ENUM_CONVERSION_OPERATOR(Feature); enum class Format { @@ -307,6 +312,7 @@ enum class Format { // Total count COUNT, }; +CC_ENUM_CONVERSION_OPERATOR(Format); enum class FormatType { NONE, @@ -317,6 +323,7 @@ enum class FormatType { UFLOAT, FLOAT, }; +CC_ENUM_CONVERSION_OPERATOR(FormatType); enum class Type { UNKNOWN, @@ -372,6 +379,8 @@ enum class Type { SUBPASS_INPUT, COUNT, }; +CC_ENUM_CONVERSION_OPERATOR(Type); + bool isCombinedImageSampler(Type type); bool isSampledImage(Type type); bool isStorageImage(Type type); @@ -387,13 +396,13 @@ enum class BufferUsageBit : FlagBits { INDIRECT = 0x40, }; using BufferUsage = BufferUsageBit; -CC_ENUM_OPERATORS(BufferUsageBit); +CC_ENUM_BITWISE_OPERATORS(BufferUsageBit); enum class BufferFlagBit : FlagBits { NONE = 0, }; using BufferFlags = BufferFlagBit; -CC_ENUM_OPERATORS(BufferFlagBit); +CC_ENUM_BITWISE_OPERATORS(BufferFlagBit); enum class MemoryAccessBit : FlagBits { NONE = 0, @@ -402,6 +411,7 @@ enum class MemoryAccessBit : FlagBits { READ_WRITE = READ_ONLY | WRITE_ONLY, }; using MemoryAccess = MemoryAccessBit; +CC_ENUM_CONVERSION_OPERATOR(MemoryAccessBit); enum class MemoryUsageBit : FlagBits { NONE = 0, @@ -409,7 +419,7 @@ enum class MemoryUsageBit : FlagBits { HOST = 0x2, }; using MemoryUsage = MemoryUsageBit; -CC_ENUM_OPERATORS(MemoryUsageBit); +CC_ENUM_BITWISE_OPERATORS(MemoryUsageBit); enum class TextureType { TEX1D, @@ -419,6 +429,7 @@ enum class TextureType { TEX1D_ARRAY, TEX2D_ARRAY, }; +CC_ENUM_CONVERSION_OPERATOR(TextureType); enum class TextureUsageBit : FlagBits { NONE = 0, @@ -431,7 +442,7 @@ enum class TextureUsageBit : FlagBits { INPUT_ATTACHMENT = 0x40, }; using TextureUsage = TextureUsageBit; -CC_ENUM_OPERATORS(TextureUsageBit); +CC_ENUM_BITWISE_OPERATORS(TextureUsageBit); enum class TextureFlagBit : FlagBits { NONE = 0, @@ -440,7 +451,7 @@ enum class TextureFlagBit : FlagBits { GENERAL_LAYOUT = 0x4, }; using TextureFlags = TextureFlagBit; -CC_ENUM_OPERATORS(TextureFlagBit); +CC_ENUM_BITWISE_OPERATORS(TextureFlagBit); enum class SampleCount { X1 = 0x1, @@ -451,6 +462,7 @@ enum class SampleCount { X32 = 0x20, X64 = 0x40, }; +CC_ENUM_CONVERSION_OPERATOR(SampleCount); enum class Filter { NONE, @@ -458,6 +470,7 @@ enum class Filter { LINEAR, ANISOTROPIC, }; +CC_ENUM_CONVERSION_OPERATOR(Filter); enum class Address { WRAP, @@ -465,6 +478,7 @@ enum class Address { CLAMP, BORDER, }; +CC_ENUM_CONVERSION_OPERATOR(Address); enum class ComparisonFunc { NEVER, @@ -476,6 +490,7 @@ enum class ComparisonFunc { GREATER_EQUAL, ALWAYS, }; +CC_ENUM_CONVERSION_OPERATOR(ComparisonFunc); enum class StencilOp { ZERO, @@ -487,6 +502,7 @@ enum class StencilOp { INCR_WRAP, DECR_WRAP, }; +CC_ENUM_CONVERSION_OPERATOR(StencilOp); enum class BlendFactor { ZERO, @@ -505,6 +521,7 @@ enum class BlendFactor { CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA, }; +CC_ENUM_CONVERSION_OPERATOR(BlendFactor); enum class BlendOp { ADD, @@ -513,6 +530,7 @@ enum class BlendOp { MIN, MAX, }; +CC_ENUM_CONVERSION_OPERATOR(BlendOp); enum class ColorMask : FlagBits { NONE = 0x0, @@ -522,7 +540,7 @@ enum class ColorMask : FlagBits { A = 0x8, ALL = R | G | B | A, }; -CC_ENUM_OPERATORS(ColorMask); +CC_ENUM_BITWISE_OPERATORS(ColorMask); enum class ShaderStageFlagBit : FlagBits { NONE = 0x0, @@ -535,18 +553,20 @@ enum class ShaderStageFlagBit : FlagBits { ALL = 0x3f, }; using ShaderStageFlags = ShaderStageFlagBit; -CC_ENUM_OPERATORS(ShaderStageFlagBit); +CC_ENUM_BITWISE_OPERATORS(ShaderStageFlagBit); enum class LoadOp { LOAD, // Load the contents from the fbo from previous CLEAR, // Clear the fbo DISCARD, // Ignore writing to the fbo and keep old data }; +CC_ENUM_CONVERSION_OPERATOR(LoadOp); enum class StoreOp { STORE, // Write the source to the destination DISCARD, // Don't write the source to the destination }; +CC_ENUM_CONVERSION_OPERATOR(StoreOp); enum class AccessType { NONE, @@ -582,6 +602,7 @@ enum class AccessType { HOST_PREINITIALIZED, // Data pre-filled by host before device access starts HOST_WRITE, // Written on the host }; +CC_ENUM_CONVERSION_OPERATOR(AccessType); using AccessTypeList = std::vector; @@ -592,12 +613,14 @@ enum class ResolveMode { MIN, MAX, }; +CC_ENUM_CONVERSION_OPERATOR(ResolveMode); enum class PipelineBindPoint { GRAPHICS, COMPUTE, RAY_TRACING, }; +CC_ENUM_CONVERSION_OPERATOR(PipelineBindPoint); enum class PrimitiveMode { POINT_LIST, @@ -616,23 +639,27 @@ enum class PrimitiveMode { TRIANGLE_PATCH_ADJACENCY, QUAD_PATCH_LIST, }; +CC_ENUM_CONVERSION_OPERATOR(PrimitiveMode); enum class PolygonMode { FILL, POINT, LINE, }; +CC_ENUM_CONVERSION_OPERATOR(PolygonMode); enum class ShadeModel { GOURAND, FLAT, }; +CC_ENUM_CONVERSION_OPERATOR(ShadeModel); enum class CullMode { NONE, FRONT, BACK, }; +CC_ENUM_CONVERSION_OPERATOR(CullMode); enum class DynamicStateFlagBit : FlagBits { NONE = 0x0, @@ -646,7 +673,7 @@ enum class DynamicStateFlagBit : FlagBits { STENCIL_COMPARE_MASK = 0x80, }; using DynamicStateFlags = DynamicStateFlagBit; -CC_ENUM_OPERATORS(DynamicStateFlagBit); +CC_ENUM_BITWISE_OPERATORS(DynamicStateFlagBit); using DynamicStateList = vector; @@ -655,7 +682,7 @@ enum class StencilFace { BACK = 0x2, ALL = 0x3, }; -CC_ENUM_OPERATORS(StencilFace); +CC_ENUM_BITWISE_OPERATORS(StencilFace); enum class DescriptorType : FlagBits { UNKNOWN = 0, @@ -669,18 +696,20 @@ enum class DescriptorType : FlagBits { STORAGE_IMAGE = 0x80, INPUT_ATTACHMENT = 0x100, }; -CC_ENUM_OPERATORS(DescriptorType); +CC_ENUM_BITWISE_OPERATORS(DescriptorType); enum class QueueType { GRAPHICS, COMPUTE, TRANSFER, }; +CC_ENUM_CONVERSION_OPERATOR(QueueType); enum class CommandBufferType { PRIMARY, SECONDARY, }; +CC_ENUM_CONVERSION_OPERATOR(CommandBufferType); enum class ClearFlagBit : FlagBits { NONE = 0, @@ -691,7 +720,7 @@ enum class ClearFlagBit : FlagBits { ALL = COLOR | DEPTH | STENCIL, }; using ClearFlags = ClearFlagBit; -CC_ENUM_OPERATORS(ClearFlagBit); +CC_ENUM_BITWISE_OPERATORS(ClearFlagBit); struct Size { uint x = 0U; diff --git a/native/cocos/renderer/gfx-base/GFXTextureBarrier.h b/native/cocos/renderer/gfx-base/GFXTextureBarrier.h index 9e0242e880..d4bc7b4ba2 100644 --- a/native/cocos/renderer/gfx-base/GFXTextureBarrier.h +++ b/native/cocos/renderer/gfx-base/GFXTextureBarrier.h @@ -33,7 +33,7 @@ namespace gfx { class CC_DLL TextureBarrier : public GFXObject { public: TextureBarrier(); - virtual ~TextureBarrier(); + ~TextureBarrier() override; static uint computeHash(const TextureBarrierInfo &info); @@ -44,7 +44,10 @@ protected: virtual void doInit(const TextureBarrierInfo &info) {} - void initialize(const TextureBarrierInfo &info) { _info = info; doInit(info); } + void initialize(const TextureBarrierInfo &info) { + _info = info; + doInit(info); + } TextureBarrierInfo _info; }; diff --git a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp index 671efc454c..18ae8398c9 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp @@ -1375,7 +1375,7 @@ void cmdFuncGLES2CreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpu for (uint i = 0U; i < gpuFBO->gpuColorTextures.size(); ++i) { const auto *gpuTexture = gpuFBO->gpuColorTextures[i]; if (!gpuTexture || gpuTexture->memoryless) continue; - if (GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].hasDepth) continue; + if (GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].hasDepth) continue; gpuFBO->uberColorAttachmentIndices.push_back(i); } doCreateFramebufferInstance(device, gpuFBO, gpuFBO->uberColorAttachmentIndices, gpuFBO->gpuColorTextures.size(), &gpuFBO->uberInstance); @@ -2320,7 +2320,7 @@ void cmdFuncGLES2BindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli if ((cache->dss.stencilRefFront != front.reference) || (cache->dss.stencilReadMaskFront != front.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_FRONT, - GLES2_CMP_FUNCS[static_cast(cache->dss.stencilFuncFront)], + GLES2_CMP_FUNCS[toNumber(cache->dss.stencilFuncFront)], front.reference, front.compareMask)); cache->dss.stencilRefFront = front.reference; @@ -2329,7 +2329,7 @@ void cmdFuncGLES2BindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli if ((cache->dss.stencilRefBack != back.reference) || (cache->dss.stencilReadMaskBack != back.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_BACK, - GLES2_CMP_FUNCS[static_cast(cache->dss.stencilFuncBack)], + GLES2_CMP_FUNCS[toNumber(cache->dss.stencilFuncBack)], back.reference, back.compareMask)); cache->dss.stencilRefBack = back.reference; diff --git a/native/cocos/renderer/gfx-gles2/GLES2Device.cpp b/native/cocos/renderer/gfx-gles2/GLES2Device.cpp index a11fb6f905..724add8416 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Device.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Device.cpp @@ -101,46 +101,46 @@ bool GLES2Device::doInit(const DeviceInfo &info) { _multithreadedSubmission = false; if (checkExtension("EXT_sRGB")) { - _features[static_cast(Feature::FORMAT_SRGB)] = true; + _features[toNumber(Feature::FORMAT_SRGB)] = true; } if (checkExtension("GL_OES_texture_float")) { - _features[static_cast(Feature::TEXTURE_FLOAT)] = true; + _features[toNumber(Feature::TEXTURE_FLOAT)] = true; } if (checkExtension("GL_OES_texture_half_float")) { - _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; + _features[toNumber(Feature::TEXTURE_HALF_FLOAT)] = true; } - _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; + _features[toNumber(Feature::FORMAT_R11G11B10F)] = true; if (checkExtension("GL_OES_element_index_uint")) { - _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; + _features[toNumber(Feature::ELEMENT_INDEX_UINT)] = true; } if (checkExtension("color_buffer_float")) { - _features[static_cast(Feature::COLOR_FLOAT)] = true; + _features[toNumber(Feature::COLOR_FLOAT)] = true; } if (checkExtension("color_buffer_half_float")) { - _features[static_cast(Feature::COLOR_HALF_FLOAT)] = true; + _features[toNumber(Feature::COLOR_HALF_FLOAT)] = true; } if (checkExtension("texture_float_linear")) { - _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = true; + _features[toNumber(Feature::TEXTURE_FLOAT_LINEAR)] = true; } if (checkExtension("texture_half_float_linear")) { - _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; + _features[toNumber(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; } if (checkExtension("draw_buffers")) { - _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; + _features[toNumber(Feature::MULTIPLE_RENDER_TARGETS)] = true; glGetIntegerv(GL_MAX_DRAW_BUFFERS_EXT, reinterpret_cast(&_caps.maxColorRenderTargets)); } if (checkExtension("blend_minmax")) { - _features[static_cast(Feature::BLEND_MINMAX)] = true; + _features[toNumber(Feature::BLEND_MINMAX)] = true; } _gpuConstantRegistry->useVAO = checkExtension("vertex_array_object"); @@ -148,7 +148,7 @@ bool GLES2Device::doInit(const DeviceInfo &info) { _gpuConstantRegistry->useInstancedArrays = checkExtension("instanced_arrays"); _gpuConstantRegistry->useDiscardFramebuffer = checkExtension("discard_framebuffer"); - _features[static_cast(Feature::INSTANCED_ARRAYS)] = _gpuConstantRegistry->useInstancedArrays; + _features[toNumber(Feature::INSTANCED_ARRAYS)] = _gpuConstantRegistry->useInstancedArrays; #if CC_PLATFORM != CC_PLATFORM_WINDOWS && CC_PLATFORM != CC_PLATFORM_MAC_OSX || ALLOW_MULTISAMPLED_RENDER_TO_TEXTURE_ON_DESKTOP if (checkExtension("multisampled_render_to_texture")) { @@ -187,25 +187,25 @@ bool GLES2Device::doInit(const DeviceInfo &info) { String compressedFmts; if (checkExtension("compressed_ETC1")) { - _features[static_cast(Feature::FORMAT_ETC1)] = true; + _features[toNumber(Feature::FORMAT_ETC1)] = true; compressedFmts += "etc1 "; } if (checkForETC2()) { - _features[static_cast(Feature::FORMAT_ETC2)] = true; + _features[toNumber(Feature::FORMAT_ETC2)] = true; compressedFmts += "etc2 "; } if (checkExtension("texture_compression_pvrtc")) { - _features[static_cast(Feature::FORMAT_PVRTC)] = true; + _features[toNumber(Feature::FORMAT_PVRTC)] = true; compressedFmts += "pvrtc "; } if (checkExtension("texture_compression_astc")) { - _features[static_cast(Feature::FORMAT_ASTC)] = true; + _features[toNumber(Feature::FORMAT_ASTC)] = true; compressedFmts += "astc "; } - _features[static_cast(Feature::FORMAT_RGB8)] = true; + _features[toNumber(Feature::FORMAT_RGB8)] = true; _renderer = reinterpret_cast(glGetString(GL_RENDERER)); _vendor = reinterpret_cast(glGetString(GL_VENDOR)); diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp index c5de838309..b97c1f1684 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp @@ -892,7 +892,7 @@ void cmdFuncGLES3CreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) if (hasFlag(gpuTexture->flags, TextureFlagBit::IMMUTABLE)) { GL_CHECK(glTexStorage2D(GL_TEXTURE_2D, gpuTexture->mipLevel, gpuTexture->glInternalFmt, w, h)); } else { - if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { + if (!GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { GL_CHECK(glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternalFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); w = std::max(1U, w >> 1); @@ -924,7 +924,7 @@ void cmdFuncGLES3CreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) if (hasFlag(gpuTexture->flags, TextureFlagBit::IMMUTABLE)) { GL_CHECK(glTexStorage2D(GL_TEXTURE_CUBE_MAP, gpuTexture->mipLevel, gpuTexture->glInternalFmt, w, h)); } else { - if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { + if (!GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { for (uint f = 0; f < 6; ++f) { GL_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture->glInternalFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); @@ -1009,7 +1009,7 @@ void cmdFuncGLES3ResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } uint w = gpuTexture->width; uint h = gpuTexture->height; - if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { + if (!GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { GL_CHECK(glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternalFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); w = std::max(1U, w >> 1); @@ -1033,7 +1033,7 @@ void cmdFuncGLES3ResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) GL_CHECK(glBindTexture(GL_TEXTURE_CUBE_MAP, gpuTexture->glTexture)); glTexture = gpuTexture->glTexture; } - if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { + if (!GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].isCompressed) { for (uint f = 0; f < 6; ++f) { uint w = gpuTexture->width; uint h = gpuTexture->height; @@ -1108,9 +1108,9 @@ void cmdFuncGLES3CreateSampler(GLES3Device * /*device*/, GLES3GPUSampler *gpuSam gpuSampler->glMagFilter = GL_NEAREST; } - gpuSampler->glWrapS = GLES3_WRAPS[static_cast(gpuSampler->addressU)]; - gpuSampler->glWrapT = GLES3_WRAPS[static_cast(gpuSampler->addressV)]; - gpuSampler->glWrapR = GLES3_WRAPS[static_cast(gpuSampler->addressW)]; + gpuSampler->glWrapS = GLES3_WRAPS[toNumber(gpuSampler->addressU)]; + gpuSampler->glWrapT = GLES3_WRAPS[toNumber(gpuSampler->addressV)]; + gpuSampler->glWrapR = GLES3_WRAPS[toNumber(gpuSampler->addressW)]; GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_MIN_FILTER, gpuSampler->glMinFilter)); GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_MAG_FILTER, gpuSampler->glMagFilter)); GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_WRAP_S, gpuSampler->glWrapS)); @@ -1449,7 +1449,7 @@ void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { gpuImage.name = image.name; gpuImage.type = image.type; gpuImage.count = image.count; - gpuImage.glMemoryAccess = GL_MEMORY_ACCESS[static_cast(image.memoryAccess)]; + gpuImage.glMemoryAccess = GL_MEMORY_ACCESS[toNumber(image.memoryAccess)]; gpuImage.units.resize(gpuImage.count); gpuImage.glLoc = glLoc; // storage image units are immutable @@ -1657,7 +1657,7 @@ void cmdFuncGLES3CreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpu for (uint i = 0U; i < gpuFBO->gpuColorTextures.size(); ++i) { const auto *gpuTexture = gpuFBO->gpuColorTextures[i]; if (!gpuTexture || gpuTexture->memoryless) continue; - if (GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].hasDepth) continue; + if (GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].hasDepth) continue; gpuFBO->uberColorAttachmentIndices.push_back(i); } doCreateFramebufferInstance(device, gpuFBO, gpuFBO->uberColorAttachmentIndices, gpuFBO->gpuColorTextures.size(), &gpuFBO->uberInstance); @@ -1920,7 +1920,7 @@ void cmdFuncGLES3EndRenderPass(GLES3Device *device) { auto performDepthStencilStoreOp = [&]() { if (gpuRenderPass->depthStencilAttachment.format == Format::UNKNOWN) return; - const auto &formatInfo = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)]; + const auto &formatInfo = GFX_FORMAT_INFOS[toNumber(gpuRenderPass->depthStencilAttachment.format)]; if (formatInfo.hasDepth) { switch (gpuRenderPass->depthStencilAttachment.depthStoreOp) { case StoreOp::STORE: break; @@ -2496,7 +2496,7 @@ void cmdFuncGLES3BindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli if ((cache->dss.stencilRefFront != front.reference) || (cache->dss.stencilReadMaskFront != front.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_FRONT, - GLES3_CMP_FUNCS[static_cast(cache->dss.stencilFuncFront)], + GLES3_CMP_FUNCS[toNumber(cache->dss.stencilFuncFront)], front.reference, front.compareMask)); cache->dss.stencilRefFront = front.reference; @@ -2505,7 +2505,7 @@ void cmdFuncGLES3BindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli if ((cache->dss.stencilRefBack != back.reference) || (cache->dss.stencilReadMaskBack != back.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_BACK, - GLES3_CMP_FUNCS[static_cast(cache->dss.stencilFuncBack)], + GLES3_CMP_FUNCS[toNumber(cache->dss.stencilFuncBack)], back.reference, back.compareMask)); cache->dss.stencilRefBack = back.reference; @@ -2584,8 +2584,8 @@ void cmdFuncGLES3Dispatch(GLES3Device *device, const GLES3GPUDispatchInfo &info) } void cmdFuncGLES3MemoryBarrier(GLES3Device * /*device*/, GLbitfield barriers, GLbitfield barriersByRegion) { - if (barriers) glMemoryBarrier(barriers); - if (barriersByRegion) glMemoryBarrierByRegion(barriersByRegion); + if (barriers) GL_CHECK(glMemoryBarrier(barriers)); + if (barriersByRegion) GL_CHECK(glMemoryBarrierByRegion(barriersByRegion)); } void cmdFuncGLES3UpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size) { @@ -2814,7 +2814,7 @@ void cmdFuncGLES3BlitTexture(GLES3Device *device, GLES3GPUTexture *gpuTextureSrc GLES3GPUStateCache *cache = device->stateCache(); GLbitfield mask = 0U; - const FormatInfo &info = GFX_FORMAT_INFOS[static_cast(gpuTextureSrc->format)]; + const FormatInfo &info = GFX_FORMAT_INFOS[toNumber(gpuTextureSrc->format)]; if (info.hasDepth || info.hasStencil) { if (info.hasDepth) mask |= GL_DEPTH_BUFFER_BIT; if (info.hasStencil) mask |= GL_STENCIL_BUFFER_BIT; diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp index da63b268ee..ac7276d19a 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp @@ -42,6 +42,7 @@ #include "GLES3Sampler.h" #include "GLES3Shader.h" #include "GLES3Texture.h" +#include "base/Utils.h" #include "gfx-gles-common/GLESCommandPool.h" // when capturing GLES commands (RENDERDOC_HOOK_EGL=1, default value) @@ -101,37 +102,37 @@ bool GLES3Device::doInit(const DeviceInfo &info) { _multithreadedSubmission = false; - _features[static_cast(Feature::TEXTURE_FLOAT)] = true; - _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; - _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; - _features[static_cast(Feature::INSTANCED_ARRAYS)] = true; - _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; - _features[static_cast(Feature::BLEND_MINMAX)] = true; - _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; + _features[toNumber(Feature::TEXTURE_FLOAT)] = true; + _features[toNumber(Feature::TEXTURE_HALF_FLOAT)] = true; + _features[toNumber(Feature::FORMAT_R11G11B10F)] = true; + _features[toNumber(Feature::INSTANCED_ARRAYS)] = true; + _features[toNumber(Feature::MULTIPLE_RENDER_TARGETS)] = true; + _features[toNumber(Feature::BLEND_MINMAX)] = true; + _features[toNumber(Feature::ELEMENT_INDEX_UINT)] = true; uint minorVersion = static_cast(_context)->minorVer(); if (minorVersion) { - _features[static_cast(Feature::COMPUTE_SHADER)] = true; + _features[toNumber(Feature::COMPUTE_SHADER)] = true; } if (checkExtension("EXT_sRGB")) { - _features[static_cast(Feature::FORMAT_SRGB)] = true; + _features[toNumber(Feature::FORMAT_SRGB)] = true; } if (checkExtension("color_buffer_float")) { - _features[static_cast(Feature::COLOR_FLOAT)] = true; + _features[toNumber(Feature::COLOR_FLOAT)] = true; } if (checkExtension("color_buffer_half_float")) { - _features[static_cast(Feature::COLOR_HALF_FLOAT)] = true; + _features[toNumber(Feature::COLOR_HALF_FLOAT)] = true; } if (checkExtension("texture_float_linear")) { - _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = true; + _features[toNumber(Feature::TEXTURE_FLOAT_LINEAR)] = true; } if (checkExtension("texture_half_float_linear")) { - _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; + _features[toNumber(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; } #if CC_PLATFORM != CC_PLATFORM_WINDOWS && CC_PLATFORM != CC_PLATFORM_MAC_OSX || ALLOW_MULTISAMPLED_RENDER_TO_TEXTURE_ON_DESKTOP @@ -186,23 +187,23 @@ bool GLES3Device::doInit(const DeviceInfo &info) { String compressedFmts; if (checkExtension("compressed_ETC1")) { - _features[static_cast(Feature::FORMAT_ETC1)] = true; + _features[toNumber(Feature::FORMAT_ETC1)] = true; compressedFmts += "etc1 "; } - _features[static_cast(Feature::FORMAT_ETC2)] = true; + _features[toNumber(Feature::FORMAT_ETC2)] = true; compressedFmts += "etc2 "; if (checkExtension("texture_compression_pvrtc")) { - _features[static_cast(Feature::FORMAT_PVRTC)] = true; + _features[toNumber(Feature::FORMAT_PVRTC)] = true; compressedFmts += "pvrtc "; } if (checkExtension("texture_compression_astc")) { - _features[static_cast(Feature::FORMAT_ASTC)] = true; + _features[toNumber(Feature::FORMAT_ASTC)] = true; compressedFmts += "astc "; } - _features[static_cast(Feature::FORMAT_RGB8)] = true; + _features[toNumber(Feature::FORMAT_RGB8)] = true; _renderer = reinterpret_cast(glGetString(GL_RENDERER)); _vendor = reinterpret_cast(glGetString(GL_VENDOR)); diff --git a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp index af926adda7..a3a8ecf5ec 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp @@ -148,7 +148,7 @@ void CCVKCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo for (size_t i = 0U; i < attachmentCount - 1; ++i) { clearValues[i].color = {{colors[i].x, colors[i].y, colors[i].z, colors[i].w}}; } - clearValues[attachmentCount - 1].depthStencil = {depth, static_cast(stencil)}; + clearValues[attachmentCount - 1].depthStencil = {depth, stencil}; } auto * device = CCVKDevice::getInstance(); VkRenderPassBeginInfo passBeginInfo{VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO}; @@ -203,7 +203,7 @@ void CCVKCommandBuffer::bindPipelineState(PipelineState *pso) { CCVKGPUPipelineState *gpuPipelineState = static_cast(pso)->gpuPipelineState(); if (_curGPUPipelineState != gpuPipelineState) { - vkCmdBindPipeline(_gpuCommandBuffer->vkCommandBuffer, VK_PIPELINE_BIND_POINTS[static_cast(gpuPipelineState->bindPoint)], gpuPipelineState->vkPipeline); + vkCmdBindPipeline(_gpuCommandBuffer->vkCommandBuffer, VK_PIPELINE_BIND_POINTS[toNumber(gpuPipelineState->bindPoint)], gpuPipelineState->vkPipeline); _curGPUPipelineState = gpuPipelineState; } } @@ -486,6 +486,19 @@ void CCVKCommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, co } else { dstAspectMask = VK_IMAGE_ASPECT_COLOR_BIT; dstImage = swapchain->swapchainImages[swapchain->curImageIndex]; + + VkImageMemoryBarrier barrier{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; + barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barrier.srcQueueFamilyIndex = barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + + barrier.image = dstImage; + barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barrier.subresourceRange.levelCount = barrier.subresourceRange.layerCount = 1; + + vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_DEPENDENCY_BY_REGION_BIT, + 0, nullptr, 0, nullptr, 1, &barrier); } _blitRegions.resize(count); @@ -517,7 +530,24 @@ void CCVKCommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, co vkCmdBlitImage(_gpuCommandBuffer->vkCommandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, - count, _blitRegions.data(), VK_FILTERS[static_cast(filter)]); + count, _blitRegions.data(), VK_FILTERS[toNumber(filter)]); + + if (!dstTexture) { + VkImageMemoryBarrier barrier{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; + barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barrier.dstAccessMask = 0; + barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barrier.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barrier.srcQueueFamilyIndex = barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + + barrier.image = dstImage; + barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barrier.subresourceRange.levelCount = barrier.subresourceRange.layerCount = 1; + + vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, + VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_DEPENDENCY_BY_REGION_BIT, + 0, nullptr, 0, nullptr, 1, &barrier); + } } void CCVKCommandBuffer::bindDescriptorSets(VkPipelineBindPoint bindPoint) { diff --git a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp index cb1dbf2a1a..36ea6b9dc0 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp @@ -113,7 +113,7 @@ void cmdFuncCCVKCreateTexture(CCVKDevice *device, CCVKGPUTexture *gpuTexture) { VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(device->gpuContext()->physicalDevice, format, &formatProperties); if (!(formatProperties.optimalTilingFeatures & features)) { - const char *formatName = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].name.c_str(); + const char *formatName = GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].name.c_str(); CC_LOG_ERROR("cmdFuncCCVKCreateTexture: The specified usage for %s is not supported on this platform", formatName); return; } @@ -163,7 +163,7 @@ void cmdFuncCCVKCreateTexture(CCVKDevice *device, CCVKGPUTexture *gpuTexture) { void cmdFuncCCVKCreateTextureView(CCVKDevice *device, CCVKGPUTextureView *gpuTextureView) { if (!gpuTextureView->gpuTexture || !gpuTextureView->gpuTexture->vkImage) return; - auto formatInfo = GFX_FORMAT_INFOS[static_cast(gpuTextureView->format)]; + auto formatInfo = GFX_FORMAT_INFOS[toNumber(gpuTextureView->format)]; VkImageAspectFlags aspect = VK_IMAGE_ASPECT_COLOR_BIT; if (formatInfo.hasDepth) aspect = VK_IMAGE_ASPECT_DEPTH_BIT; @@ -188,17 +188,17 @@ void cmdFuncCCVKCreateSampler(CCVKDevice *device, CCVKGPUSampler *gpuSampler) { CCVKGPUContext * context = device->gpuContext(); float maxAnisotropy = context->physicalDeviceProperties.limits.maxSamplerAnisotropy; - createInfo.magFilter = VK_FILTERS[static_cast(gpuSampler->magFilter)]; - createInfo.minFilter = VK_FILTERS[static_cast(gpuSampler->minFilter)]; - createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODES[static_cast(gpuSampler->mipFilter)]; - createInfo.addressModeU = VK_SAMPLER_ADDRESS_MODES[static_cast(gpuSampler->addressU)]; - createInfo.addressModeV = VK_SAMPLER_ADDRESS_MODES[static_cast(gpuSampler->addressV)]; - createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODES[static_cast(gpuSampler->addressW)]; + createInfo.magFilter = VK_FILTERS[toNumber(gpuSampler->magFilter)]; + createInfo.minFilter = VK_FILTERS[toNumber(gpuSampler->minFilter)]; + createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODES[toNumber(gpuSampler->mipFilter)]; + createInfo.addressModeU = VK_SAMPLER_ADDRESS_MODES[toNumber(gpuSampler->addressU)]; + createInfo.addressModeV = VK_SAMPLER_ADDRESS_MODES[toNumber(gpuSampler->addressV)]; + createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODES[toNumber(gpuSampler->addressW)]; createInfo.mipLodBias = gpuSampler->mipLODBias; createInfo.anisotropyEnable = gpuSampler->maxAnisotropy && context->physicalDeviceFeatures.samplerAnisotropy; createInfo.maxAnisotropy = std::min(maxAnisotropy, static_cast(gpuSampler->maxAnisotropy)); createInfo.compareEnable = gpuSampler->cmpFunc != ComparisonFunc::ALWAYS; - createInfo.compareOp = VK_CMP_FUNCS[static_cast(gpuSampler->cmpFunc)]; + createInfo.compareOp = VK_CMP_FUNCS[toNumber(gpuSampler->cmpFunc)]; createInfo.minLod = 0.0; // UNASSIGNED-BestPractices-vkCreateSampler-lod-clamping createInfo.maxLod = VK_LOD_CLAMP_NONE; // UNASSIGNED-BestPractices-vkCreateSampler-lod-clamping //createInfo.borderColor; @@ -275,10 +275,10 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende CCVKAccessInfo & endAccessInfo = endAccessInfos[i]; for (AccessType type : attachment.beginAccesses) { - beginAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + beginAccesses.push_back(THSVS_ACCESS_TYPES[toNumber(type)]); } for (AccessType type : attachment.endAccesses) { - endAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + endAccesses.push_back(THSVS_ACCESS_TYPES[toNumber(type)]); } thsvsGetAccessInfo(utils::toUint(beginAccesses.size()), beginAccesses.data(), &beginAccessInfo.stageMask, &beginAccessInfo.accessMask, &beginAccessInfo.imageLayout, &beginAccessInfo.hasWriteAccess); @@ -305,10 +305,10 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende CCVKAccessInfo & endAccessInfo = endAccessInfos[colorAttachmentCount]; for (AccessType type : depthStencilAttachment.beginAccesses) { - beginAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + beginAccesses.push_back(THSVS_ACCESS_TYPES[toNumber(type)]); } for (AccessType type : depthStencilAttachment.endAccesses) { - endAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + endAccesses.push_back(THSVS_ACCESS_TYPES[toNumber(type)]); } thsvsGetAccessInfo(utils::toUint(beginAccesses.size()), beginAccesses.data(), &beginAccessInfo.stageMask, &beginAccessInfo.accessMask, &beginAccessInfo.imageLayout, &beginAccessInfo.hasWriteAccess); @@ -367,7 +367,7 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende sampleCount = std::max(sampleCount, attachment.samples); } - VkImageAspectFlags aspect = GFX_FORMAT_INFOS[static_cast(dsFormat)].hasStencil + VkImageAspectFlags aspect = GFX_FORMAT_INFOS[toNumber(dsFormat)].hasStencil ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; VkImageLayout layout = isGeneralLayout ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; @@ -378,7 +378,7 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende if (subpassInfo.depthStencilResolve != INVALID_BINDING) { const ColorAttachment &desc = gpuRenderPass->colorAttachments[subpassInfo.depthStencilResolve]; - VkImageAspectFlags aspect = GFX_FORMAT_INFOS[static_cast(desc.format)].hasStencil + VkImageAspectFlags aspect = GFX_FORMAT_INFOS[toNumber(desc.format)].hasStencil ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; VkImageLayout layout = desc.isGeneralLayout ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; @@ -426,8 +426,8 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende if (subpassInfo.depthStencilResolve != INVALID_BINDING) { VkSubpassDescriptionDepthStencilResolve &resolveDesc{depthStencilResolves[i]}; - VkResolveModeFlagBits depthResolveMode = VK_RESOLVE_MODES[static_cast(subpassInfo.depthResolveMode)]; - VkResolveModeFlagBits stencilResolveMode = VK_RESOLVE_MODES[static_cast(subpassInfo.stencilResolveMode)]; + VkResolveModeFlagBits depthResolveMode = VK_RESOLVE_MODES[toNumber(subpassInfo.depthResolveMode)]; + VkResolveModeFlagBits stencilResolveMode = VK_RESOLVE_MODES[toNumber(subpassInfo.stencilResolveMode)]; if ((depthResolveMode & prop.supportedDepthResolveModes) == 0) depthResolveMode = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT; if ((stencilResolveMode & prop.supportedStencilResolveModes) == 0) stencilResolveMode = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT; @@ -453,10 +453,10 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende if (dependencyCount) { for (const auto &dependency : gpuRenderPass->dependencies) { for (AccessType type : dependency.srcAccesses) { - accessTypeCaches.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + accessTypeCaches.push_back(THSVS_ACCESS_TYPES[toNumber(type)]); } for (AccessType type : dependency.dstAccesses) { - accessTypeCaches.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + accessTypeCaches.push_back(THSVS_ACCESS_TYPES[toNumber(type)]); } } @@ -641,7 +641,7 @@ void cmdFuncCCVKCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFra for (size_t i = 0U; i < swapchainImageCount; ++i) { for (size_t j = 0U; j < colorViewCount; ++j) { if (swapchainImageIndices & (1 << j)) { - attachments[j] = GFX_FORMAT_INFOS[static_cast(gpuFramebuffer->gpuRenderPass->colorAttachments[j].format)].hasDepth + attachments[j] = GFX_FORMAT_INFOS[toNumber(gpuFramebuffer->gpuRenderPass->colorAttachments[j].format)].hasDepth ? gpuFramebuffer->swapchain->depthStencilImageViews[i] : gpuFramebuffer->swapchain->vkSwapchainImageViews[i]; } @@ -796,7 +796,7 @@ void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineS } for (size_t i = 0U; i < attributeCount; ++i) { const Attribute &attr = attributes[i]; - bindingDescriptions[attr.stream].stride += GFX_FORMAT_INFOS[static_cast(attr.format)].size; + bindingDescriptions[attr.stream].stride += GFX_FORMAT_INFOS[toNumber(attr.format)].size; if (attr.isInstanced) { bindingDescriptions[attr.stream].inputRate = VK_VERTEX_INPUT_RATE_INSTANCE; } @@ -818,7 +818,7 @@ void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineS attributeFound = true; break; } - offsets[attr.stream] += GFX_FORMAT_INFOS[static_cast(attr.format)].size; + offsets[attr.stream] += GFX_FORMAT_INFOS[toNumber(attr.format)].size; } if (!attributeFound) { // handle absent attribute attributeDescriptions[i].location = shaderAttrs[i].location; @@ -838,7 +838,7 @@ void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineS ///////////////////// Input Asembly State ///////////////////// VkPipelineInputAssemblyStateCreateInfo inputAssembly{VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO}; - inputAssembly.topology = VK_PRIMITIVE_MODES[static_cast(gpuPipelineState->primitive)]; + inputAssembly.topology = VK_PRIMITIVE_MODES[toNumber(gpuPipelineState->primitive)]; createInfo.pInputAssemblyState = &inputAssembly; ///////////////////// Dynamic State ///////////////////// @@ -864,8 +864,8 @@ void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineS //rasterizationState.depthClampEnable; rasterizationState.rasterizerDiscardEnable = gpuPipelineState->rs.isDiscard; - rasterizationState.polygonMode = VK_POLYGON_MODES[static_cast(gpuPipelineState->rs.polygonMode)]; - rasterizationState.cullMode = VK_CULL_MODES[static_cast(gpuPipelineState->rs.cullMode)]; + rasterizationState.polygonMode = VK_POLYGON_MODES[toNumber(gpuPipelineState->rs.polygonMode)]; + rasterizationState.cullMode = VK_CULL_MODES[toNumber(gpuPipelineState->rs.cullMode)]; rasterizationState.frontFace = gpuPipelineState->rs.isFrontFaceCCW ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE; rasterizationState.depthBiasEnable = gpuPipelineState->rs.depthBiasEnabled; rasterizationState.depthBiasConstantFactor = gpuPipelineState->rs.depthBias; @@ -890,23 +890,23 @@ void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineS VkPipelineDepthStencilStateCreateInfo depthStencilState = {VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO}; depthStencilState.depthTestEnable = gpuPipelineState->dss.depthTest; depthStencilState.depthWriteEnable = gpuPipelineState->dss.depthWrite; - depthStencilState.depthCompareOp = VK_CMP_FUNCS[static_cast(gpuPipelineState->dss.depthFunc)]; + depthStencilState.depthCompareOp = VK_CMP_FUNCS[toNumber(gpuPipelineState->dss.depthFunc)]; depthStencilState.stencilTestEnable = gpuPipelineState->dss.stencilTestFront; depthStencilState.front = { - VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilFailOpFront)], - VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilPassOpFront)], - VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilZFailOpFront)], - VK_CMP_FUNCS[static_cast(gpuPipelineState->dss.stencilFuncFront)], + VK_STENCIL_OPS[toNumber(gpuPipelineState->dss.stencilFailOpFront)], + VK_STENCIL_OPS[toNumber(gpuPipelineState->dss.stencilPassOpFront)], + VK_STENCIL_OPS[toNumber(gpuPipelineState->dss.stencilZFailOpFront)], + VK_CMP_FUNCS[toNumber(gpuPipelineState->dss.stencilFuncFront)], gpuPipelineState->dss.stencilReadMaskFront, gpuPipelineState->dss.stencilWriteMaskFront, gpuPipelineState->dss.stencilRefFront, }; depthStencilState.back = { - VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilFailOpBack)], - VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilPassOpBack)], - VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilZFailOpBack)], - VK_CMP_FUNCS[static_cast(gpuPipelineState->dss.stencilFuncBack)], + VK_STENCIL_OPS[toNumber(gpuPipelineState->dss.stencilFailOpBack)], + VK_STENCIL_OPS[toNumber(gpuPipelineState->dss.stencilPassOpBack)], + VK_STENCIL_OPS[toNumber(gpuPipelineState->dss.stencilZFailOpBack)], + VK_CMP_FUNCS[toNumber(gpuPipelineState->dss.stencilFuncBack)], gpuPipelineState->dss.stencilReadMaskBack, gpuPipelineState->dss.stencilWriteMaskBack, gpuPipelineState->dss.stencilRefBack, @@ -927,12 +927,12 @@ void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineS : gpuPipelineState->bs.targets[i]; blendTargets[i].blendEnable = target.blend; - blendTargets[i].srcColorBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendSrc)]; - blendTargets[i].dstColorBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendDst)]; - blendTargets[i].colorBlendOp = VK_BLEND_OPS[static_cast(target.blendEq)]; - blendTargets[i].srcAlphaBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendSrcAlpha)]; - blendTargets[i].dstAlphaBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendDstAlpha)]; - blendTargets[i].alphaBlendOp = VK_BLEND_OPS[static_cast(target.blendAlphaEq)]; + blendTargets[i].srcColorBlendFactor = VK_BLEND_FACTORS[toNumber(target.blendSrc)]; + blendTargets[i].dstColorBlendFactor = VK_BLEND_FACTORS[toNumber(target.blendDst)]; + blendTargets[i].colorBlendOp = VK_BLEND_OPS[toNumber(target.blendEq)]; + blendTargets[i].srcAlphaBlendFactor = VK_BLEND_FACTORS[toNumber(target.blendSrcAlpha)]; + blendTargets[i].dstAlphaBlendFactor = VK_BLEND_FACTORS[toNumber(target.blendDstAlpha)]; + blendTargets[i].alphaBlendOp = VK_BLEND_OPS[toNumber(target.blendAlphaEq)]; blendTargets[i].colorWriteMask = mapVkColorComponentFlags(target.blendColorMask); } Color &blendColor = gpuPipelineState->bs.blendColor; @@ -1062,7 +1062,7 @@ void cmdFuncCCVKCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *b barrier.prevAccessCount = utils::toUint(curTypes.size()); barrier.pPrevAccesses = curTypes.data(); barrier.nextAccessCount = 1; - barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_WRITE)]; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::TRANSFER_WRITE)]; if (gpuTexture->transferAccess != THSVS_ACCESS_TRANSFER_WRITE) { cmdFuncCCVKImageMemoryBarrier(gpuCommandBuffer, barrier); @@ -1088,7 +1088,7 @@ void cmdFuncCCVKCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *b CCVKGPUBuffer stagingBuffer; stagingBuffer.size = totalSize; - uint texelSize = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].size; + uint texelSize = GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].size; device->gpuStagingBufferPool()->alloc(&stagingBuffer, texelSize); vector stagingRegions(count); @@ -1128,8 +1128,8 @@ void cmdFuncCCVKCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *b blitInfo.dstOffsets[1] = {std::max(width >> 1, 1), std::max(height >> 1, 1), 1}; barrier.subresourceRange.levelCount = 1; barrier.prevAccessCount = 1; - barrier.pPrevAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_WRITE)]; - barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_READ)]; + barrier.pPrevAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::TRANSFER_WRITE)]; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::TRANSFER_READ)]; for (uint i = 1U; i < gpuTexture->mipLevels; ++i) { barrier.subresourceRange.baseMipLevel = i - 1; @@ -1148,12 +1148,12 @@ void cmdFuncCCVKCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *b barrier.subresourceRange.baseMipLevel = 0; barrier.subresourceRange.levelCount = gpuTexture->mipLevels - 1; - barrier.pPrevAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_READ)]; - barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_WRITE)]; + barrier.pPrevAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::TRANSFER_READ)]; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::TRANSFER_WRITE)]; cmdFuncCCVKImageMemoryBarrier(gpuCommandBuffer, barrier); } else { - const char *formatName = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].name.c_str(); + const char *formatName = GFX_FORMAT_INFOS[toNumber(gpuTexture->format)].name.c_str(); CC_LOG_WARNING("cmdFuncCCVKCopyBuffersToTexture: generate mipmap for %s is not supported on this platform", formatName); } } @@ -1335,7 +1335,7 @@ VkSampleCountFlagBits CCVKGPUContext::getSampleCountForAttachments(Format format static unordered_map cacheMap; if (!cacheMap.count(format)) { - bool hasDepth = GFX_FORMAT_INFOS[static_cast(format)].hasDepth; + bool hasDepth = GFX_FORMAT_INFOS[toNumber(format)].hasDepth; VkImageUsageFlags usages = hasDepth ? VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT : VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; VkImageFormatProperties properties; @@ -1346,7 +1346,7 @@ VkSampleCountFlagBits CCVKGPUContext::getSampleCountForAttachments(Format format VkSampleCountFlags availableSampleCounts = cacheMap[format]; - auto requestedSampleCount = static_cast(sampleCount); + auto requestedSampleCount = toNumber(sampleCount); if (requestedSampleCount >= 64 && (availableSampleCounts & VK_SAMPLE_COUNT_64_BIT)) return VK_SAMPLE_COUNT_64_BIT; if (requestedSampleCount >= 32 && (availableSampleCounts & VK_SAMPLE_COUNT_32_BIT)) return VK_SAMPLE_COUNT_32_BIT; if (requestedSampleCount >= 16 && (availableSampleCounts & VK_SAMPLE_COUNT_16_BIT)) return VK_SAMPLE_COUNT_16_BIT; diff --git a/native/cocos/renderer/gfx-vulkan/VKDevice.cpp b/native/cocos/renderer/gfx-vulkan/VKDevice.cpp index f6bb8e0151..2be8649a70 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDevice.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKDevice.cpp @@ -212,19 +212,19 @@ bool CCVKDevice::doInit(const DeviceInfo &info) { ///////////////////// Gather Device Properties ///////////////////// - _features[static_cast(Feature::COLOR_FLOAT)] = true; - _features[static_cast(Feature::COLOR_HALF_FLOAT)] = true; - _features[static_cast(Feature::TEXTURE_FLOAT)] = true; - _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; - _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = true; - _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; - _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; - _features[static_cast(Feature::FORMAT_SRGB)] = true; - _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; - _features[static_cast(Feature::INSTANCED_ARRAYS)] = true; - _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; - _features[static_cast(Feature::BLEND_MINMAX)] = true; - _features[static_cast(Feature::COMPUTE_SHADER)] = true; + _features[toNumber(Feature::COLOR_FLOAT)] = true; + _features[toNumber(Feature::COLOR_HALF_FLOAT)] = true; + _features[toNumber(Feature::TEXTURE_FLOAT)] = true; + _features[toNumber(Feature::TEXTURE_HALF_FLOAT)] = true; + _features[toNumber(Feature::TEXTURE_FLOAT_LINEAR)] = true; + _features[toNumber(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; + _features[toNumber(Feature::FORMAT_R11G11B10F)] = true; + _features[toNumber(Feature::FORMAT_SRGB)] = true; + _features[toNumber(Feature::ELEMENT_INDEX_UINT)] = true; + _features[toNumber(Feature::INSTANCED_ARRAYS)] = true; + _features[toNumber(Feature::MULTIPLE_RENDER_TARGETS)] = true; + _features[toNumber(Feature::BLEND_MINMAX)] = true; + _features[toNumber(Feature::COMPUTE_SHADER)] = true; _gpuDevice->useMultiDrawIndirect = deviceFeatures.multiDrawIndirect; _gpuDevice->useDescriptorUpdateTemplate = _gpuDevice->minorVersion > 0 || checkExtension(VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); @@ -241,16 +241,16 @@ bool CCVKDevice::doInit(const DeviceInfo &info) { VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_R8G8B8_UNORM, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[static_cast(Feature::FORMAT_RGB8)] = true; + _features[toNumber(Feature::FORMAT_RGB8)] = true; } String compressedFmts; if (deviceFeatures.textureCompressionETC2) { - _features[static_cast(Feature::FORMAT_ETC2)] = true; + _features[toNumber(Feature::FORMAT_ETC2)] = true; compressedFmts += "etc2 "; } if (deviceFeatures.textureCompressionASTC_LDR) { - _features[static_cast(Feature::FORMAT_ASTC)] = true; + _features[toNumber(Feature::FORMAT_ASTC)] = true; compressedFmts += "astc "; } @@ -372,7 +372,7 @@ bool CCVKDevice::doInit(const DeviceInfo &info) { ThsvsImageBarrier barrier{}; barrier.nextAccessCount = 1; - barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::VERTEX_SHADER_READ_TEXTURE)]; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::VERTEX_SHADER_READ_TEXTURE)]; barrier.image = _gpuDevice->defaultTexture.vkImage; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; @@ -557,8 +557,9 @@ void CCVKDevice::acquire() { acquireSemaphore, VK_NULL_HANDLE, &_gpuSwapchain->curImageIndex)); #if !defined(VK_USE_PLATFORM_METAL_EXT) - assert(_gpuDevice->curBackBufferIndex == _gpuSwapchain->curImageIndex); // MoltenVK seems to be not consistent -#endif // defined(VK_USE_PLATFORM_METAL_EXT) + // MoltenVK seems to be not consistent on this index + CCASSERT(_gpuDevice->curBackBufferIndex == _gpuSwapchain->curImageIndex, "wrong image index?"); +#endif // defined(VK_USE_PLATFORM_METAL_EXT) queue->gpuQueue()->nextWaitSemaphore = acquireSemaphore; queue->gpuQueue()->nextSignalSemaphore = _gpuSemaphorePool->alloc(); @@ -603,12 +604,12 @@ CCVKGPUStagingBufferPool *CCVKDevice::gpuStagingBufferPool() { return _gpuStagin void CCVKDevice::waitAllFences() { vector fences; - for(auto* fencePool : _gpuFencePools) { + for (auto *fencePool : _gpuFencePools) { fences.insert(fences.end(), fencePool->data(), fencePool->data() + fencePool->size()); } - if(!fences.empty()) { + if (!fences.empty()) { VK_CHECK(vkWaitForFences(_gpuDevice->vkDevice, fences.size(), fences.data(), VK_TRUE, DEFAULT_TIMEOUT)); - for(auto* fencePool : _gpuFencePools) { + for (auto *fencePool : _gpuFencePools) { fencePool->reset(); } } @@ -730,8 +731,6 @@ bool CCVKDevice::checkSwapchainStatus() { VkSwapchainKHR vkSwapchain = VK_NULL_HANDLE; VK_CHECK(vkCreateSwapchainKHR(_gpuDevice->vkDevice, &context->swapchainCreateInfo, nullptr, &vkSwapchain)); - - destroySwapchain(); _gpuDevice->curBackBufferIndex = 0U; @@ -742,7 +741,8 @@ bool CCVKDevice::checkSwapchainStatus() { VK_CHECK(vkGetSwapchainImagesKHR(_gpuDevice->vkDevice, _gpuSwapchain->vkSwapchain, &imageCount, nullptr)); _gpuSwapchain->swapchainImages.resize(imageCount); VK_CHECK(vkGetSwapchainImagesKHR(_gpuDevice->vkDevice, _gpuSwapchain->vkSwapchain, &imageCount, _gpuSwapchain->swapchainImages.data())); - assert(imageCount == context->swapchainCreateInfo.minImageCount); // assert if swapchain image count assumption is broken + + CCASSERT(imageCount == context->swapchainCreateInfo.minImageCount, "swapchain image count assumption is broken"); _gpuSwapchain->vkSwapchainImageViews.resize(imageCount); for (uint i = 0U; i < imageCount; i++) { @@ -761,7 +761,7 @@ bool CCVKDevice::checkSwapchainStatus() { VK_CHECK(vkCreateImageView(_gpuDevice->vkDevice, &imageViewCreateInfo, nullptr, &_gpuSwapchain->vkSwapchainImageViews[i])); } - bool hasStencil = GFX_FORMAT_INFOS[static_cast(_context->getDepthStencilFormat())].hasStencil; + bool hasStencil = GFX_FORMAT_INFOS[toNumber(_context->getDepthStencilFormat())].hasStencil; vector barriers(imageCount * 2, VkImageMemoryBarrier{}); VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; @@ -774,7 +774,7 @@ bool CCVKDevice::checkSwapchainStatus() { VkPipelineStageFlags tempDstStageMask = 0; for (uint i = 0U; i < imageCount; i++) { tempBarrier.nextAccessCount = 1; - tempBarrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::COLOR_ATTACHMENT_WRITE)]; + tempBarrier.pNextAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::COLOR_ATTACHMENT_WRITE)]; tempBarrier.image = _gpuSwapchain->swapchainImages[i]; tempBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; thsvsGetVulkanImageMemoryBarrier(tempBarrier, &tempSrcStageMask, &tempDstStageMask, &barriers[i]); @@ -782,7 +782,7 @@ bool CCVKDevice::checkSwapchainStatus() { dstStageMask |= tempDstStageMask; tempBarrier.nextAccessCount = 1; - tempBarrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE)]; + tempBarrier.pNextAccesses = &THSVS_ACCESS_TYPES[toNumber(AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE)]; tempBarrier.image = _gpuSwapchain->depthStencilImages[i]; tempBarrier.subresourceRange.aspectMask = hasStencil ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; thsvsGetVulkanImageMemoryBarrier(tempBarrier, &tempSrcStageMask, &tempDstStageMask, &barriers[imageCount + i]); @@ -807,7 +807,6 @@ bool CCVKDevice::checkSwapchainStatus() { void CCVKDevice::destroySwapchain() { if (_gpuSwapchain->vkSwapchain != VK_NULL_HANDLE) { - _gpuSwapchain->swapchainImageAccessTypes.clear(); _gpuSwapchain->depthStencilImageAccessTypes.clear(); diff --git a/native/cocos/renderer/gfx-vulkan/VKUtils.cpp b/native/cocos/renderer/gfx-vulkan/VKUtils.cpp index 951fcd4511..eb386faf0e 100644 --- a/native/cocos/renderer/gfx-vulkan/VKUtils.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKUtils.cpp @@ -235,7 +235,7 @@ VkImageUsageFlagBits mapVkImageUsageFlagBits(TextureUsage usage) { VkImageAspectFlags mapVkImageAspectFlags(Format format) { VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - const FormatInfo & info = GFX_FORMAT_INFOS[static_cast(format)]; + const FormatInfo & info = GFX_FORMAT_INFOS[toNumber(format)]; if (info.hasDepth) aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; if (info.hasStencil) aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; return aspectMask; diff --git a/native/cocos/storage/local-storage/LocalStorage-android.cpp b/native/cocos/storage/local-storage/LocalStorage-android.cpp index cf60050931..298fabda39 100644 --- a/native/cocos/storage/local-storage/LocalStorage-android.cpp +++ b/native/cocos/storage/local-storage/LocalStorage-android.cpp @@ -50,7 +50,7 @@ using namespace cc; //NOLINT static int gInitialized = 0; -static void splitFilename(std::string &str) { //NOLINT(google-runtime-references) +static void splitFilename(std::string &str) { size_t found = 0; found = str.find_last_of("/\\"); if (found != std::string::npos) { @@ -92,7 +92,7 @@ bool localStorageGetItem(const std::string &key, std::string *outItem) { if (JniHelper::getStaticMethodInfo(t, JCLS_LOCALSTORAGE, "getItem", "(Ljava/lang/String;)Ljava/lang/String;")) { jstring jkey = t.env->NewStringUTF(key.c_str()); - auto jret = static_cast(t.env->CallStaticObjectMethod(t.classID, t.methodID, jkey)); + auto * jret = static_cast(t.env->CallStaticObjectMethod(t.classID, t.methodID, jkey)); if (jret == nullptr) { ccDeleteLocalRef(t.env, jret); ccDeleteLocalRef(t.env, jkey); diff --git a/native/docs/LINTER_AUTOFIX_GUIDE.md b/native/docs/LINTER_AUTOFIX_GUIDE.md index e651d502da..3e3b5ae3be 100644 --- a/native/docs/LINTER_AUTOFIX_GUIDE.md +++ b/native/docs/LINTER_AUTOFIX_GUIDE.md @@ -89,11 +89,11 @@ This is where the `Command Runner` extension comes in and saves the day: we can Also note that by invoking `clang-tidy`, this is an unavoidably time-consuming process. -* For `clang-format` issues, there will be no in-place editor suggestions, but all issues are strictly auto-fixable, and if the environment set up above goes smoothly, it is as simple as executing the `Format Document` command. (By default `Shift + Alt + F` on Windows) +* For `clang-format` issues, there are no in-place editor suggestions, but all issues are strictly auto-fixable, and if the environment set up above goes smoothly, it is as simple as executing the `Format Document` command. (By default `Shift + Alt + F` on Windows) ![](imgs/format.png) - This functionality is provided by the `cland` extension too. + This functionality is provided by the `clangd` extension too. ![](imgs/auto-format.gif) diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/constructor.c b/native/tools/bindings-generator/targets/spidermonkey/templates/constructor.c index 86658207b9..de032a319d 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/constructor.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/constructor.c @@ -3,13 +3,13 @@ SE_DECLARE_FINALIZE_FUNC(js_${underlined_class_name}_finalize) #if $is_skip_constructor -static bool ${signature_name}(se::State& /*s*/) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool ${signature_name}(se::State& /*s*/) // NOLINT(readability-identifier-naming) constructor.c { //#3 ${namespaced_class_name}: is_skip_construtor ${is_skip_constructor} se::ScriptEngine::getInstance()->evalString("throw new Error(\"${namespaced_class_name} constructor is skipped\")"); return false; #else -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor.c +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) constructor.c { #if len($arguments) >= $min_args #set arg_count = len($arguments) diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/constructor_overloaded.c b/native/tools/bindings-generator/targets/spidermonkey/templates/constructor_overloaded.c index 23ccf1e056..d833dbcbf5 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/constructor_overloaded.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/constructor_overloaded.c @@ -2,7 +2,7 @@ SE_DECLARE_FINALIZE_FUNC(js_${underlined_class_name}_finalize) -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) constructor_overloaded.c +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) constructor_overloaded.c { #if $is_skip_constructor //#1 ${namespaced_class_name}: is_skip_construtor ${is_skip_constructor} diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/ctor.c b/native/tools/bindings-generator/targets/spidermonkey/templates/ctor.c index 084ad84618..40f44a2f97 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/ctor.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/ctor.c @@ -1,6 +1,6 @@ ## ===== ctor function implementation template -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) { #if $is_skip_constructor //#2 ${namespaced_class_name}: is_skip_construtor ${is_skip_constructor} diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/ctor_overloaded.c b/native/tools/bindings-generator/targets/spidermonkey/templates/ctor_overloaded.c index 5548110d86..379b499448 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/ctor_overloaded.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/ctor_overloaded.c @@ -2,7 +2,7 @@ SE_DECLARE_FINALIZE_FUNC(js_${underlined_class_name}_finalize) -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) { //ctor_overloaded.c CC_UNUSED bool ok = true; diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/enum.c b/native/tools/bindings-generator/targets/spidermonkey/templates/enum.c index f84a82b535..18f9224238 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/enum.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/enum.c @@ -2,7 +2,7 @@ #set fields = $current_class.fields template<> -bool sevalue_to_native(const se::Value &from, ${current_class.namespaced_class_name} *to, se::Object *ctx) // NOLINT(readability-identifier-naming, google-runtime-references) +bool sevalue_to_native(const se::Value &from, ${current_class.namespaced_class_name} *to, se::Object *ctx) // NOLINT(readability-identifier-naming) { typedef typename std::underlying_type_t<${current_class.namespaced_class_name}> under_type; under_type tmp; @@ -10,7 +10,7 @@ bool sevalue_to_native(const se::Value &from, ${current_class.namespaced_class_n return false; } -int js_register_${generator.prefix}_${current_class.class_name}(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +int js_register_${generator.prefix}_${current_class.class_name}(se::Object* obj) // NOLINT(readability-identifier-naming) { auto enum_kls = se::Object::createPlainObject(); #for m in fields diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction.c b/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction.c index 0d02104545..b4b2aea307 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction.c @@ -1,6 +1,6 @@ ## ===== instance function implementation template -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT<${namespaced_class_name}>(s); SE_PRECONDITION2(cobj, false, "${signature_name} : Invalid Native Object"); diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction_overloaded.c b/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction_overloaded.c index f0c7014bb3..fff73142e1 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction_overloaded.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/ifunction_overloaded.c @@ -1,6 +1,6 @@ ## ===== instance function implementation template - for overloaded functions -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; auto* cobj = SE_THIS_OBJECT<${namespaced_class_name}>(s); diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/public_field.c b/native/tools/bindings-generator/targets/spidermonkey/templates/public_field.c index a1506e837f..85b7c620fc 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/public_field.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/public_field.c @@ -1,6 +1,6 @@ ## ===== member implementation template -static bool ${signature_name}_get_${name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}_get_${name}(se::State& s) // NOLINT(readability-identifier-naming) { auto* cobj = SE_THIS_OBJECT<${namespaced_class_name}>(s); SE_PRECONDITION2(cobj, false, "${signature_name}_get_${name} : Invalid Native Object"); @@ -33,7 +33,7 @@ static bool ${signature_name}_get_${name}(se::State& s) // NOLINT(readability-id } SE_BIND_PROP_GET(${signature_name}_get_${name}) -static bool ${signature_name}_set_${name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}_set_${name}(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); auto* cobj = SE_THIS_OBJECT<${namespaced_class_name}>(s); diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/register.c b/native/tools/bindings-generator/targets/spidermonkey/templates/register.c index 8209d529f9..860e6a4a61 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/register.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/register.c @@ -21,7 +21,7 @@ ${current_class.methods.constructor.generate_code($current_class)} #end if #if not $current_class.is_abstract -static bool js_${current_class.underlined_class_name}_finalize(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_${current_class.underlined_class_name}_finalize(se::State& s) // NOLINT(readability-identifier-naming) { #if $current_class.rename_destructor is None #if $current_class.is_ref_class @@ -47,7 +47,7 @@ SE_BIND_FINALIZE_FUNC(js_${current_class.underlined_class_name}_finalize) #end if #if $current_class.rename_destructor is not None -static bool js_${current_class.underlined_class_name}_${current_class.rename_destructor}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool js_${current_class.underlined_class_name}_${current_class.rename_destructor}(se::State& s) // NOLINT(readability-identifier-naming) { #if $current_class.is_ref_class auto* cobj = SE_THIS_OBJECT<${current_class.namespaced_class_name}>(s); @@ -73,7 +73,7 @@ static bool js_${current_class.underlined_class_name}_${current_class.rename_des SE_BIND_FUNC(js_${current_class.underlined_class_name}_${current_class.rename_destructor}) #end if -bool js_register_${generator.prefix}_${current_class.class_name}(se::Object* obj) // NOLINT(readability-identifier-naming, google-runtime-references) +bool js_register_${generator.prefix}_${current_class.class_name}(se::Object* obj) // NOLINT(readability-identifier-naming) { #if has_constructor #if len($current_class.parents) > 0 diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction.c b/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction.c index a3203494df..e4e2d59d79 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction.c @@ -1,6 +1,6 @@ ## ===== static function implementation template -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) { const auto& args = s.args(); size_t argc = args.size(); diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction_overloaded.c b/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction_overloaded.c index e4528d2013..1e149c8de0 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction_overloaded.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/sfunction_overloaded.c @@ -1,6 +1,6 @@ ## ===== static function implementation template - for overloaded functions -static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${signature_name}(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args(); diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/struct_constructor.c b/native/tools/bindings-generator/targets/spidermonkey/templates/struct_constructor.c index be0a19ab05..fabbc6ca55 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/struct_constructor.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/struct_constructor.c @@ -27,7 +27,7 @@ bool sevalue_to_native(const se::Value &from, ${namespaced_class_name} * to, se: SE_DECLARE_FINALIZE_FUNC(js_${underlined_class_name}_finalize) -static bool ${struct_constructor_name}(se::State& s) // NOLINT(readability-identifier-naming, google-runtime-references) +static bool ${struct_constructor_name}(se::State& s) // NOLINT(readability-identifier-naming) { CC_UNUSED bool ok = true; const auto& args = s.args();