diff --git a/native/cocos/base/Macros.h b/native/cocos/base/Macros.h index 1d30efea7d..ccca53fe98 100644 --- a/native/cocos/base/Macros.h +++ b/native/cocos/base/Macros.h @@ -575,43 +575,43 @@ It should work same as apples CFSwapInt32LittleToHost(..) #endif // Engine Memory Management -#if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #if (CC_MODE == CC_MODE_DEBUG) - #define CC_MEMORY_TRACKER - #endif -#elif (CC_PLATFORM == CC_PLATFORM_ANDROID) -//# define CC_MEMORY_TRACKER -#else -#endif +// #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) +// #if (CC_MODE == CC_MODE_DEBUG) +// #define CC_MEMORY_TRACKER +// #endif +// #elif (CC_PLATFORM == CC_PLATFORM_ANDROID) +// //# define CC_MEMORY_TRACKER +// #else +// #endif // use simd //#define CC_USE_SIMD // Memory Allocator -#if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD - #undef CC_MEMORY_TRACKER -//#if defined(CC_MEMORY_TRACKER) -//# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC -//#else -//# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD -//#endif -#elif (CC_PLATFORM == CC_PLATFORM_ANDROID) - #if defined(CC_MEMORY_TRACKER) - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC - #else - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD - #endif -#else - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD -#endif +// #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) +// #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD +// #undef CC_MEMORY_TRACKER +// //#if defined(CC_MEMORY_TRACKER) +// //# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC +// //#else +// //# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD +// //#endif +// #elif (CC_PLATFORM == CC_PLATFORM_ANDROID) +// #if defined(CC_MEMORY_TRACKER) +// #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC +// #else +// #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD +// #endif +// #else +// #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD +// #endif -// STL memory allocator -#if (CC_MEMORY_ALLOCATOR == CC_MEMORY_ALLOCATOR_STD) - #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_STANDARD -#else - #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_CUSTOM -#endif +// // STL memory allocator +// #if (CC_MEMORY_ALLOCATOR == CC_MEMORY_ALLOCATOR_STD) +// #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_STANDARD +// #else +// #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_CUSTOM +// #endif #define CC_TOSTR(s) #s diff --git a/native/cocos/bindings/manual/jsb_gfx_manual.cpp b/native/cocos/bindings/manual/jsb_gfx_manual.cpp index 695d9c6c21..065d897872 100644 --- a/native/cocos/bindings/manual/jsb_gfx_manual.cpp +++ b/native/cocos/bindings/manual/jsb_gfx_manual.cpp @@ -38,84 +38,6 @@ #define GFX_INVALID_BINDING ((uint8_t)-1) #define GFX_INVALID_HANDLE ((uint)-1) -se::Object *__jsb_cc_gfx_BindingMappingInfo_proto = nullptr; -se::Class *__jsb_cc_gfx_BindingMappingInfo_class = nullptr; - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_BindingMappingInfo_finalize) - -static bool js_gfx_BindingMappingInfo_constructor(se::State &s) { - CC_UNUSED bool ok = true; - const auto &args = s.args(); - size_t argc = args.size(); - - if (argc == 0) { - cc::gfx::BindingMappingInfo *cobj = JSB_ALLOC(cc::gfx::BindingMappingInfo); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } else if (argc == 1 && args[0].isObject()) { - - se::Object *json = args[0].toObject(); - se::Value field; - - cc::gfx::BindingMappingInfo *cobj = JSB_ALLOC(cc::gfx::BindingMappingInfo); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - - json->getProperty("bufferOffsets", &field); - if (!field.isUndefined()) { - ok &= seval_to_std_vector(field, &cobj->bufferOffsets); - } - - json->getProperty("samplerOffsets", &field); - if (!field.isUndefined()) { - ok &= seval_to_std_vector(field, &cobj->samplerOffsets); - } - - json->getProperty("flexibleSet", &field); - if (!field.isUndefined()) { - ok &= seval_to_uint32(field, &cobj->flexibleSet); - } - - if (!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("Argument convertion error"); - return false; - } - - return true; - } - - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; -} -SE_BIND_CTOR(js_gfx_BindingMappingInfo_constructor, __jsb_cc_gfx_BindingMappingInfo_class, js_cc_gfx_BindingMappingInfo_finalize) - -static bool js_cc_gfx_BindingMappingInfo_finalize(se::State &s) { - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::BindingMappingInfo *cobj = (cc::gfx::BindingMappingInfo *)s.nativeThisObject(); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_BindingMappingInfo_finalize) - -bool js_register_gfx_BindingMappingInfo(se::Object *obj) { - auto cls = se::Class::create("BindingMappingInfo", obj, nullptr, _SE(js_gfx_BindingMappingInfo_constructor)); - - cls->defineFinalizeFunction(_SE(js_cc_gfx_BindingMappingInfo_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_BindingMappingInfo_proto = cls->getProto(); - __jsb_cc_gfx_BindingMappingInfo_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - bool js_gfx_Device_copyBuffersToTexture(se::State &s) { cc::gfx::Device *cobj = (cc::gfx::Device *)s.nativeThisObject(); SE_PRECONDITION2(cobj, false, "js_gfx_Device_copyBuffersToTexture : Invalid Native Object"); @@ -915,7 +837,6 @@ bool register_all_gfx_manual(se::Object *obj) { } se::Object *ns = nsVal.toObject(); - js_register_gfx_BindingMappingInfo(ns); js_register_gfx_SubPass(ns); #ifdef CC_USE_VULKAN diff --git a/native/cocos/renderer/core/gfx/GFXDef.h b/native/cocos/renderer/core/gfx/GFXDef.h index 2b60be029e..dcce437f5a 100755 --- a/native/cocos/renderer/core/gfx/GFXDef.h +++ b/native/cocos/renderer/core/gfx/GFXDef.h @@ -508,7 +508,7 @@ enum class DynamicStateFlagBit : uint8_t { }; typedef DynamicStateFlagBit DynamicStateFlags; -typedef vector DynamicStateList; +typedef cc::vector DynamicStateList; enum class StencilFace : uint8_t { FRONT, @@ -614,8 +614,8 @@ struct BufferTextureCopy { Extent texExtent = {0, 0, 1}; TextureSubres texSubres; }; -typedef vector BufferTextureCopyList; -typedef vector BufferDataList; +typedef cc::vector BufferTextureCopyList; +typedef cc::vector BufferDataList; struct Viewport { int left = 0; @@ -650,7 +650,7 @@ struct Color { float w = 0.0f; }; #pragma pack(pop) -typedef vector ColorList; +typedef cc::vector ColorList; /** * For non-vulkan backends, to maintain compatibility and maximize @@ -664,8 +664,8 @@ typedef vector ColorList; * offsets for each descriptor type in each set. */ struct BindingMappingInfo { - vector bufferOffsets; - vector samplerOffsets; + cc::vector bufferOffsets; + cc::vector samplerOffsets; uint flexibleSet = 0u; }; @@ -703,8 +703,8 @@ struct ContextInfo { struct BufferInfo { BufferUsage usage = BufferUsage::NONE; MemoryUsage memUsage = MemoryUsage::NONE; - uint stride = 1; uint size = 0; + uint stride = 1; BufferFlags flags = BufferFlagBit::NONE; }; @@ -726,7 +726,7 @@ struct DrawInfo { }; #pragma pack(pop) -typedef vector DrawInfoList; +typedef cc::vector DrawInfoList; struct IndirectBuffer { DrawInfoList drawInfos; @@ -776,7 +776,7 @@ struct ShaderMacro { String value; }; -typedef vector ShaderMacroList; +typedef cc::vector ShaderMacroList; struct Uniform { String name; @@ -784,7 +784,7 @@ struct Uniform { uint count = 0; }; -typedef vector UniformList; +typedef cc::vector UniformList; struct UniformBlock { uint set = 0; @@ -794,7 +794,7 @@ struct UniformBlock { uint count = 0u; }; -typedef vector UniformBlockList; +typedef cc::vector UniformBlockList; struct UniformSampler { uint set = 0; @@ -804,14 +804,14 @@ struct UniformSampler { uint count = 0; }; -typedef vector UniformSamplerList; +typedef cc::vector UniformSamplerList; struct ShaderStage { ShaderStageFlagBit stage; String source; }; -typedef vector ShaderStageList; +typedef cc::vector ShaderStageList; struct Attribute { String name; @@ -822,8 +822,8 @@ struct Attribute { uint location = 0; }; -typedef vector AttributeList; -typedef vector BufferList; +typedef cc::vector AttributeList; +typedef cc::vector BufferList; struct ShaderInfo { String name; @@ -849,7 +849,7 @@ struct ColorAttachment { TextureLayout endLayout = TextureLayout::PRESENT_SRC; }; -typedef vector ColorAttachmentList; +typedef cc::vector ColorAttachmentList; struct DepthStencilAttachment { Format format = Format::UNKNOWN; @@ -878,7 +878,7 @@ struct SubPass { } }; -typedef vector SubPassList; +typedef cc::vector SubPassList; struct RenderPassInfo { ColorAttachmentList colorAttachments; @@ -886,14 +886,14 @@ struct RenderPassInfo { SubPassList subPasses; }; -typedef vector BufferList; -typedef vector TextureList; -typedef vector SamplerList; +typedef cc::vector BufferList; +typedef cc::vector TextureList; +typedef cc::vector SamplerList; struct FramebufferInfo { RenderPass *renderPass = nullptr; TextureList colorTextures; - vector colorMipmapLevels; + cc::vector colorMipmapLevels; Texture *depthStencilTexture = nullptr; uint depthStencilMipmapLevel = 0; }; @@ -904,7 +904,7 @@ struct DescriptorSetLayoutBinding { ShaderStageFlagBit stageFlags; SamplerList immutableSamplers; }; -typedef vector DescriptorSetLayoutBindingList; +typedef cc::vector DescriptorSetLayoutBindingList; struct DescriptorSetLayoutInfo { // array index is used as the binding numbers, @@ -916,7 +916,7 @@ struct DescriptorSetInfo { DescriptorSetLayout *layout = nullptr; }; -typedef vector DescriptorSetLayoutList; +typedef cc::vector DescriptorSetLayoutList; struct PipelineLayoutInfo { DescriptorSetLayoutList setLayouts; @@ -974,7 +974,7 @@ struct BlendTarget { ColorMask blendColorMask = ColorMask::ALL; }; -typedef vector BlendTargetList; +typedef cc::vector BlendTargetList; struct BlendState { bool isA2C = false; @@ -1004,7 +1004,7 @@ struct CommandBufferInfo { Queue *queue = nullptr; CommandBufferType type = CommandBufferType::PRIMARY; }; -typedef vector CommandBufferList; +typedef cc::vector CommandBufferList; struct QueueInfo { QueueType type = QueueType::GRAPHICS; diff --git a/native/tools/tojs/gfx.ini b/native/tools/tojs/gfx.ini index a103167cb7..7848196b4f 100644 --- a/native/tools/tojs/gfx.ini +++ b/native/tools/tojs/gfx.ini @@ -33,7 +33,7 @@ replace_headers = # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu.*$". -classes = GFXObject Device Buffer CommandBuffer Framebuffer InputAssembler DescriptorSet DescriptorSetLayout PipelineLayout PipelineState Fence Queue RenderPass Sampler Shader Texture API Feature Format FormatType Type BufferUsageBit BufferFlagBit BufferAccessBit TextureUsageBit TextureFlagBit ShaderType TextureLayout QueueType CommandBufferType Offset Rect Extent TextureSubres TextureCopy BufferTextureCopy Viewport Color DeviceInfo ContextInfo BufferInfo BufferViewInfo DrawInfo IndirectBuffer TextureInfo TextureViewInfo SamplerInfo ShaderMacro Uniform UniformBlock UniformSampler ShaderStage ShaderInfo Attribute InputAssemblerInfo ColorAttachment DepthStencilAttachment RenderPassInfo FramebufferInfo DescriptorSetLayoutBinding DescriptorSetInfo DescriptorSetLayoutInfo PipelineLayoutInfo PushConstantRange InputState RasterizerState DepthStencilState BlendTarget BlendState PipelineStateInfo CommandBufferInfo QueueInfo FormatInfo MemoryStatus +classes = GFXObject Device Buffer CommandBuffer Framebuffer InputAssembler DescriptorSet DescriptorSetLayout PipelineLayout PipelineState Fence Queue RenderPass Sampler Shader Texture API Feature Format FormatType Type BufferUsageBit BufferFlagBit BufferAccessBit TextureUsageBit TextureFlagBit ShaderType TextureLayout QueueType CommandBufferType Offset Rect Extent TextureSubres TextureCopy BufferTextureCopy Viewport Color DeviceInfo ContextInfo BufferInfo BufferViewInfo DrawInfo IndirectBuffer TextureInfo TextureViewInfo SamplerInfo ShaderMacro Uniform UniformBlock UniformSampler ShaderStage ShaderInfo Attribute InputAssemblerInfo ColorAttachment DepthStencilAttachment RenderPassInfo FramebufferInfo DescriptorSetLayoutBinding DescriptorSetInfo DescriptorSetLayoutInfo PipelineLayoutInfo PushConstantRange InputState RasterizerState DepthStencilState BlendTarget BlendState PipelineStateInfo CommandBufferInfo QueueInfo FormatInfo MemoryStatus BindingMappingInfo classes_need_extend =