From ea88ba33c6495da7a9c5496fbc98ba5eab9bf587 Mon Sep 17 00:00:00 2001 From: Yun Hsiao Wu Date: Mon, 1 Mar 2021 12:00:10 +0800 Subject: [PATCH] codebase structure update (#3289) * structure * fix jsb auto binding license issue --- native/CMakeLists.txt | 200 ++++----- .../audio/android/AudioPlayerProvider.cpp | 2 +- .../cocos/audio/android/AudioPlayerProvider.h | 4 +- native/cocos/base/CMakeLists.txt | 3 - .../cocos/{renderer/core => base}/CoreStd.h | 6 +- native/cocos/base/IndexHandle.h | 90 ++++ .../CoreStd.cpp => base/StringHandle.cpp} | 13 +- native/cocos/base/StringHandle.h | 42 ++ native/cocos/base/StringPool.h | 131 ++++++ native/cocos/base/StringUtil.cpp | 9 +- native/cocos/base/StringUtil.h | 6 +- native/cocos/base/ThreadPool.cpp | 54 +-- native/cocos/base/ThreadPool.h | 22 +- native/cocos/base/TypeDef.h | 5 +- native/cocos/base/job-system/CMakeLists.txt | 3 - .../job-system-taskflow/CMakeLists.txt | 71 ---- .../job-system-taskflow/TFJobGraph.cpp | 2 +- .../job-system-taskflow/TFJobGraph.h | 2 +- .../job-system-taskflow/TFJobSystem.cpp | 2 +- .../job-system-taskflow/TFJobSystem.h | 2 +- .../job-system/job-system-tbb/CMakeLists.txt | 76 ---- .../job-system/job-system-tbb/TBBJobGraph.cpp | 2 +- .../job-system/job-system-tbb/TBBJobGraph.h | 2 +- .../job-system-tbb/TBBJobSystem.cpp | 2 +- .../job-system/job-system-tbb/TBBJobSystem.h | 2 +- native/cocos/base/memory/JeAlloc.cpp | 2 +- native/cocos/base/memory/MemTracker.cpp | 2 +- native/cocos/base/memory/Memory.cpp | 2 +- native/cocos/base/memory/NedPooling.cpp | 2 +- native/cocos/base/threading/CMakeLists.txt | 61 --- native/cocos/base/threading/ReadWriteLock.h | 56 +++ native/cocos/bindings/auto/jsb_audio_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_audio_auto.h | 2 +- native/cocos/bindings/auto/jsb_cocos_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_cocos_auto.h | 2 +- .../bindings/auto/jsb_dragonbones_auto.cpp | 2 +- .../bindings/auto/jsb_dragonbones_auto.h | 2 +- .../bindings/auto/jsb_editor_support_auto.cpp | 2 +- .../bindings/auto/jsb_editor_support_auto.h | 2 +- .../bindings/auto/jsb_extension_auto.cpp | 2 +- .../cocos/bindings/auto/jsb_extension_auto.h | 2 +- native/cocos/bindings/auto/jsb_gfx_auto.cpp | 4 +- native/cocos/bindings/auto/jsb_gfx_auto.h | 4 +- native/cocos/bindings/auto/jsb_gles2_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_gles2_auto.h | 2 +- native/cocos/bindings/auto/jsb_gles3_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_gles3_auto.h | 2 +- native/cocos/bindings/auto/jsb_mtl_auto.cpp | 12 +- native/cocos/bindings/auto/jsb_mtl_auto.h | 4 +- .../cocos/bindings/auto/jsb_network_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_network_auto.h | 2 +- .../cocos/bindings/auto/jsb_pipeline_auto.cpp | 12 +- .../cocos/bindings/auto/jsb_pipeline_auto.h | 2 +- native/cocos/bindings/auto/jsb_spine_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_spine_auto.h | 2 +- native/cocos/bindings/auto/jsb_video_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_video_auto.h | 2 +- native/cocos/bindings/auto/jsb_vk_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_vk_auto.h | 2 +- .../cocos/bindings/auto/jsb_webview_auto.cpp | 2 +- native/cocos/bindings/auto/jsb_webview_auto.h | 2 +- native/cocos/bindings/dop/BufferAllocator.cpp | 2 +- native/cocos/bindings/dop/BufferAllocator.h | 2 +- native/cocos/bindings/dop/PoolType.h | 2 +- .../cocos/bindings/manual/jsb_conversions.cpp | 2 +- .../cocos/bindings/manual/jsb_gfx_agent.cpp | 3 +- native/cocos/bindings/manual/jsb_gfx_agent.h | 18 +- .../cocos/bindings/manual/jsb_gfx_manual.cpp | 8 +- native/cocos/bindings/manual/jsb_global.cpp | 169 ++++---- native/cocos/bindings/manual/jsb_global.h | 2 +- .../bindings/manual/jsb_pipeline_manual.cpp | 2 +- .../CCArmatureCacheDisplay.cpp | 2 +- .../CCArmatureDisplay.cpp | 2 +- .../SkeletonCacheAnimation.cpp | 2 +- .../SkeletonRenderer.cpp | 2 +- native/cocos/platform/Image.cpp | 3 +- native/cocos/renderer/CMakeLists.txt | 25 -- native/cocos/renderer/core/CMakeLists.txt | 177 -------- .../renderer/{core => }/gfx-agent/GFXAgent.h | 67 +-- .../{core => }/gfx-agent/GFXBufferAgent.cpp | 4 +- .../{core => }/gfx-agent/GFXBufferAgent.h | 2 +- .../gfx-agent/GFXCommandBufferAgent.cpp | 6 +- .../gfx-agent/GFXCommandBufferAgent.h | 2 +- .../gfx-agent/GFXDescriptorSetAgent.cpp | 4 +- .../gfx-agent/GFXDescriptorSetAgent.h | 2 +- .../gfx-agent/GFXDescriptorSetLayoutAgent.cpp | 4 +- .../gfx-agent/GFXDescriptorSetLayoutAgent.h | 2 +- .../{core => }/gfx-agent/GFXDeviceAgent.cpp | 4 +- .../{core => }/gfx-agent/GFXDeviceAgent.h | 2 +- .../gfx-agent/GFXFramebufferAgent.cpp | 4 +- .../gfx-agent/GFXFramebufferAgent.h | 2 +- .../gfx-agent/GFXInputAssemblerAgent.cpp | 4 +- .../gfx-agent/GFXInputAssemblerAgent.h | 2 +- .../gfx-agent/GFXLinearAllocatorPool.h | 0 .../gfx-agent/GFXPipelineLayoutAgent.cpp | 4 +- .../gfx-agent/GFXPipelineLayoutAgent.h | 2 +- .../gfx-agent/GFXPipelineStateAgent.cpp | 4 +- .../gfx-agent/GFXPipelineStateAgent.h | 2 +- .../{core => }/gfx-agent/GFXQueueAgent.cpp | 10 +- .../{core => }/gfx-agent/GFXQueueAgent.h | 2 +- .../gfx-agent/GFXRenderPassAgent.cpp | 4 +- .../{core => }/gfx-agent/GFXRenderPassAgent.h | 2 +- .../{core => }/gfx-agent/GFXSamplerAgent.cpp | 22 +- .../{core => }/gfx-agent/GFXSamplerAgent.h | 2 +- .../{core => }/gfx-agent/GFXShaderAgent.cpp | 22 +- .../{core => }/gfx-agent/GFXShaderAgent.h | 2 +- .../{core => }/gfx-agent/GFXTextureAgent.cpp | 52 +-- .../{core => }/gfx-agent/GFXTextureAgent.h | 2 +- .../{core/Core.h => gfx-base/GFXBase.h} | 39 +- .../{core/gfx => gfx-base}/GFXBuffer.cpp | 6 +- .../{core/gfx => gfx-base}/GFXBuffer.h | 2 +- .../gfx => gfx-base}/GFXCommandBuffer.cpp | 6 +- .../{core/gfx => gfx-base}/GFXCommandBuffer.h | 2 +- .../{core/gfx => gfx-base}/GFXContext.cpp | 2 +- .../{core/gfx => gfx-base}/GFXContext.h | 2 +- .../{core/gfx => gfx-base}/GFXDef-common.h | 40 +- .../{core/gfx => gfx-base}/GFXDef.cpp | 2 +- .../renderer/{core/gfx => gfx-base}/GFXDef.h | 0 .../gfx => gfx-base}/GFXDescriptorSet.cpp | 24 +- .../{core/gfx => gfx-base}/GFXDescriptorSet.h | 2 +- .../GFXDescriptorSetLayout.cpp | 3 +- .../gfx => gfx-base}/GFXDescriptorSetLayout.h | 2 +- .../{core/gfx => gfx-base}/GFXDevice.cpp | 3 +- .../{core/gfx => gfx-base}/GFXDevice.h | 2 +- .../{core/gfx => gfx-base}/GFXFramebuffer.cpp | 6 +- .../{core/gfx => gfx-base}/GFXFramebuffer.h | 2 +- .../gfx => gfx-base}/GFXGlobalBarrier.cpp | 8 +- .../{core/gfx => gfx-base}/GFXGlobalBarrier.h | 2 +- .../gfx => gfx-base}/GFXInputAssembler.cpp | 3 +- .../gfx => gfx-base}/GFXInputAssembler.h | 2 +- .../{core/gfx => gfx-base}/GFXObject.cpp | 2 +- .../{core/gfx => gfx-base}/GFXObject.h | 1 + .../gfx => gfx-base}/GFXPipelineLayout.cpp | 6 +- .../gfx => gfx-base}/GFXPipelineLayout.h | 2 +- .../gfx => gfx-base}/GFXPipelineState.cpp | 3 +- .../{core/gfx => gfx-base}/GFXPipelineState.h | 2 +- .../{core/gfx => gfx-base}/GFXQueue.cpp | 6 +- .../{core/gfx => gfx-base}/GFXQueue.h | 2 +- .../{core/gfx => gfx-base}/GFXRenderPass.cpp | 3 +- .../{core/gfx => gfx-base}/GFXRenderPass.h | 2 +- .../{core/gfx => gfx-base}/GFXSampler.cpp | 3 +- .../{core/gfx => gfx-base}/GFXSampler.h | 2 +- .../{core/gfx => gfx-base}/GFXShader.cpp | 6 +- .../{core/gfx => gfx-base}/GFXShader.h | 2 +- .../{core/gfx => gfx-base}/GFXTexture.cpp | 6 +- .../{core/gfx => gfx-base}/GFXTexture.h | 2 +- .../gfx => gfx-base}/GFXTextureBarrier.cpp | 6 +- .../gfx => gfx-base}/GFXTextureBarrier.h | 2 +- .../renderer/gfx-gles-common/CMakeLists.txt | 42 -- .../gfx-gles-common/GLESCommandPool.h | 2 + .../cocos/renderer/gfx-gles2/CMakeLists.txt | 77 ---- .../cocos/renderer/gfx-gles2/GLES2Buffer.cpp | 1 + native/cocos/renderer/gfx-gles2/GLES2Buffer.h | 17 +- .../renderer/gfx-gles2/GLES2CommandBuffer.h | 1 + .../cocos/renderer/gfx-gles2/GLES2Context.h | 1 + .../renderer/gfx-gles2/GLES2DescriptorSet.h | 2 + .../gfx-gles2/GLES2DescriptorSetLayout.h | 2 + native/cocos/renderer/gfx-gles2/GLES2Device.h | 2 + .../renderer/gfx-gles2/GLES2Framebuffer.h | 2 + .../renderer/gfx-gles2/GLES2GPUObjects.h | 1 + .../renderer/gfx-gles2/GLES2InputAssembler.h | 2 + .../renderer/gfx-gles2/GLES2PipelineLayout.h | 2 + .../renderer/gfx-gles2/GLES2PipelineState.h | 2 + native/cocos/renderer/gfx-gles2/GLES2Queue.h | 2 + .../renderer/gfx-gles2/GLES2RenderPass.h | 2 + .../cocos/renderer/gfx-gles2/GLES2Sampler.h | 2 + native/cocos/renderer/gfx-gles2/GLES2Shader.h | 2 + native/cocos/renderer/gfx-gles2/GLES2Std.h | 2 +- .../cocos/renderer/gfx-gles2/GLES2Texture.cpp | 1 + .../cocos/renderer/gfx-gles2/GLES2Texture.h | 2 + .../cocos/renderer/gfx-gles3/CMakeLists.txt | 77 ---- .../cocos/renderer/gfx-gles3/GLES3Buffer.cpp | 1 + native/cocos/renderer/gfx-gles3/GLES3Buffer.h | 2 + .../renderer/gfx-gles3/GLES3CommandBuffer.h | 2 + .../cocos/renderer/gfx-gles3/GLES3Context.h | 2 + .../renderer/gfx-gles3/GLES3DescriptorSet.h | 2 + .../gfx-gles3/GLES3DescriptorSetLayout.h | 2 + native/cocos/renderer/gfx-gles3/GLES3Device.h | 2 + .../renderer/gfx-gles3/GLES3Framebuffer.h | 2 + .../renderer/gfx-gles3/GLES3GPUObjects.h | 1 + .../renderer/gfx-gles3/GLES3GlobalBarrier.h | 2 + .../renderer/gfx-gles3/GLES3InputAssembler.h | 2 + .../renderer/gfx-gles3/GLES3PipelineLayout.h | 2 + .../renderer/gfx-gles3/GLES3PipelineState.h | 2 + native/cocos/renderer/gfx-gles3/GLES3Queue.h | 2 + .../renderer/gfx-gles3/GLES3RenderPass.h | 2 + .../cocos/renderer/gfx-gles3/GLES3Sampler.h | 2 + native/cocos/renderer/gfx-gles3/GLES3Shader.h | 2 + native/cocos/renderer/gfx-gles3/GLES3Std.h | 2 +- .../cocos/renderer/gfx-gles3/GLES3Texture.cpp | 1 + .../cocos/renderer/gfx-gles3/GLES3Texture.h | 2 + .../cocos/renderer/gfx-metal/CMakeLists.txt | 58 --- native/cocos/renderer/gfx-metal/MTLBuffer.h | 2 + .../renderer/gfx-metal/MTLCommandBuffer.h | 2 + native/cocos/renderer/gfx-metal/MTLContext.h | 2 + .../renderer/gfx-metal/MTLDescriptorSet.h | 4 + .../gfx-metal/MTLDescriptorSetLayout.h | 4 + native/cocos/renderer/gfx-metal/MTLDevice.h | 1 + .../cocos/renderer/gfx-metal/MTLFramebuffer.h | 2 + .../renderer/gfx-metal/MTLInputAssembler.h | 2 + .../renderer/gfx-metal/MTLPipelineLayout.h | 4 + .../renderer/gfx-metal/MTLPipelineState.h | 2 + native/cocos/renderer/gfx-metal/MTLQueue.h | 3 + .../cocos/renderer/gfx-metal/MTLRenderPass.h | 2 + native/cocos/renderer/gfx-metal/MTLSampler.h | 2 + native/cocos/renderer/gfx-metal/MTLShader.h | 2 + native/cocos/renderer/gfx-metal/MTLStd.h | 2 +- native/cocos/renderer/gfx-metal/MTLTexture.h | 2 + native/cocos/renderer/gfx-metal/MTLUtils.h | 1 + .../cocos/renderer/gfx-vulkan/CMakeLists.txt | 84 ---- native/cocos/renderer/gfx-vulkan/VKBuffer.h | 2 + .../renderer/gfx-vulkan/VKCommandBuffer.h | 2 + .../cocos/renderer/gfx-vulkan/VKCommands.cpp | 2 +- .../cocos/renderer/gfx-vulkan/VKContext.cpp | 4 +- native/cocos/renderer/gfx-vulkan/VKContext.h | 2 + .../renderer/gfx-vulkan/VKDescriptorSet.h | 2 + .../gfx-vulkan/VKDescriptorSetLayout.h | 2 + native/cocos/renderer/gfx-vulkan/VKDevice.h | 2 + .../cocos/renderer/gfx-vulkan/VKFramebuffer.h | 2 + .../renderer/gfx-vulkan/VKGlobalBarrier.h | 2 + .../renderer/gfx-vulkan/VKInputAssembler.h | 2 + .../renderer/gfx-vulkan/VKPipelineLayout.h | 2 + .../renderer/gfx-vulkan/VKPipelineState.h | 2 + native/cocos/renderer/gfx-vulkan/VKQueue.h | 2 + .../cocos/renderer/gfx-vulkan/VKRenderPass.h | 2 + native/cocos/renderer/gfx-vulkan/VKSampler.h | 2 + native/cocos/renderer/gfx-vulkan/VKShader.h | 2 + native/cocos/renderer/gfx-vulkan/VKStd.h | 2 +- native/cocos/renderer/gfx-vulkan/VKTexture.h | 2 + .../renderer/gfx-vulkan/VKTextureBarrier.h | 2 + native/cocos/renderer/gfx-vulkan/VKUtils.h | 2 + .../cocos/renderer/pipeline/BatchedBuffer.cpp | 78 ++-- .../cocos/renderer/pipeline/BatchedBuffer.h | 1 + native/cocos/renderer/pipeline/Define.cpp | 86 ++-- native/cocos/renderer/pipeline/Define.h | 383 +++++++++--------- .../renderer/pipeline/InstancedBuffer.cpp | 38 +- .../renderer/pipeline/PipelineSceneData.cpp | 6 +- .../pipeline/PipelineStateManager.cpp | 34 +- .../renderer/pipeline/PipelineStateManager.h | 9 +- .../cocos/renderer/pipeline/PipelineUBO.cpp | 2 +- .../renderer/pipeline/PlanarShadowQueue.cpp | 8 +- .../renderer/pipeline/PlanarShadowQueue.h | 2 +- .../pipeline/RenderAdditiveLightQueue.cpp | 127 +++--- .../pipeline/RenderAdditiveLightQueue.h | 2 +- .../renderer/pipeline/RenderBatchedQueue.cpp | 3 +- .../renderer/pipeline/RenderBatchedQueue.h | 3 +- .../pipeline/RenderInstancedQueue.cpp | 2 +- .../renderer/pipeline/RenderInstancedQueue.h | 2 +- .../renderer/pipeline/RenderPipeline.cpp | 10 +- .../cocos/renderer/pipeline/RenderPipeline.h | 30 +- .../cocos/renderer/pipeline/RenderQueue.cpp | 4 +- .../cocos/renderer/pipeline/RenderStage.cpp | 2 +- .../cocos/renderer/pipeline/SceneCulling.cpp | 4 +- .../pipeline/ShadowMapBatchedQueue.cpp | 6 +- .../renderer/pipeline/ShadowMapBatchedQueue.h | 2 +- .../pipeline/deferred/DeferredPipeline.cpp | 18 +- .../pipeline/deferred/DeferredPipeline.h | 8 +- .../pipeline/deferred/GbufferFlow.cpp | 10 +- .../pipeline/deferred/GbufferStage.cpp | 8 +- .../renderer/pipeline/deferred/GbufferStage.h | 4 +- .../pipeline/deferred/LightingFlow.cpp | 8 +- .../pipeline/deferred/LightingStage.cpp | 10 +- .../pipeline/deferred/PostprocessStage.cpp | 6 +- .../pipeline/forward/ForwardPipeline.cpp | 18 +- .../pipeline/forward/ForwardStage.cpp | 8 +- .../renderer/pipeline/forward/UIPhase.cpp | 2 +- .../renderer/pipeline/helper/DefineMap.h | 2 +- .../renderer/pipeline/helper/SharedMemory.cpp | 68 ++-- .../renderer/pipeline/helper/SharedMemory.h | 2 +- .../renderer/pipeline/shadow/ShadowFlow.cpp | 10 +- .../renderer/pipeline/shadow/ShadowStage.cpp | 8 +- native/tools/bindings-generator/generator.py | 15 +- native/tools/license-upgrader/generate.js | 217 +++++----- native/tools/tojs/gfx.ini | 2 +- native/tools/tojs/pipeline.ini | 7 +- 275 files changed, 1693 insertions(+), 1938 deletions(-) delete mode 100644 native/cocos/base/CMakeLists.txt rename native/cocos/{renderer/core => base}/CoreStd.h (97%) create mode 100644 native/cocos/base/IndexHandle.h rename native/cocos/{renderer/core/CoreStd.cpp => base/StringHandle.cpp} (84%) create mode 100644 native/cocos/base/StringHandle.h create mode 100644 native/cocos/base/StringPool.h delete mode 100644 native/cocos/base/job-system/CMakeLists.txt delete mode 100644 native/cocos/base/job-system/job-system-taskflow/CMakeLists.txt delete mode 100644 native/cocos/base/job-system/job-system-tbb/CMakeLists.txt delete mode 100644 native/cocos/base/threading/CMakeLists.txt create mode 100644 native/cocos/base/threading/ReadWriteLock.h delete mode 100644 native/cocos/renderer/CMakeLists.txt delete mode 100644 native/cocos/renderer/core/CMakeLists.txt rename native/cocos/renderer/{core => }/gfx-agent/GFXAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXBufferAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXBufferAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXCommandBufferAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXCommandBufferAgent.h (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXDescriptorSetAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXDescriptorSetAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXDescriptorSetLayoutAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXDescriptorSetLayoutAgent.h (97%) rename native/cocos/renderer/{core => }/gfx-agent/GFXDeviceAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXDeviceAgent.h (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXFramebufferAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXFramebufferAgent.h (97%) rename native/cocos/renderer/{core => }/gfx-agent/GFXInputAssemblerAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXInputAssemblerAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXLinearAllocatorPool.h (100%) rename native/cocos/renderer/{core => }/gfx-agent/GFXPipelineLayoutAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXPipelineLayoutAgent.h (97%) rename native/cocos/renderer/{core => }/gfx-agent/GFXPipelineStateAgent.cpp (99%) rename native/cocos/renderer/{core => }/gfx-agent/GFXPipelineStateAgent.h (97%) rename native/cocos/renderer/{core => }/gfx-agent/GFXQueueAgent.cpp (94%) rename native/cocos/renderer/{core => }/gfx-agent/GFXQueueAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXRenderPassAgent.cpp (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXRenderPassAgent.h (97%) rename native/cocos/renderer/{core => }/gfx-agent/GFXSamplerAgent.cpp (86%) rename native/cocos/renderer/{core => }/gfx-agent/GFXSamplerAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXShaderAgent.cpp (86%) rename native/cocos/renderer/{core => }/gfx-agent/GFXShaderAgent.h (98%) rename native/cocos/renderer/{core => }/gfx-agent/GFXTextureAgent.cpp (75%) rename native/cocos/renderer/{core => }/gfx-agent/GFXTextureAgent.h (98%) rename native/cocos/renderer/{core/Core.h => gfx-base/GFXBase.h} (69%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXBuffer.cpp (93%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXBuffer.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXCommandBuffer.cpp (93%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXCommandBuffer.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXContext.cpp (98%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXContext.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDef-common.h (96%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDef.cpp (99%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDef.h (100%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDescriptorSet.cpp (86%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDescriptorSet.h (99%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDescriptorSetLayout.cpp (97%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDescriptorSetLayout.h (99%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDevice.cpp (98%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXDevice.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXFramebuffer.cpp (93%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXFramebuffer.h (98%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXGlobalBarrier.cpp (91%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXGlobalBarrier.h (98%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXInputAssembler.cpp (98%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXInputAssembler.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXObject.cpp (98%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXObject.h (98%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXPipelineLayout.cpp (93%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXPipelineLayout.h (98%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXPipelineState.cpp (97%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXPipelineState.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXQueue.cpp (93%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXQueue.h (98%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXRenderPass.cpp (98%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXRenderPass.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXSampler.cpp (97%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXSampler.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXShader.cpp (93%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXShader.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXTexture.cpp (93%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXTexture.h (99%) mode change 100755 => 100644 rename native/cocos/renderer/{core/gfx => gfx-base}/GFXTextureBarrier.cpp (95%) rename native/cocos/renderer/{core/gfx => gfx-base}/GFXTextureBarrier.h (98%) delete mode 100644 native/cocos/renderer/gfx-gles-common/CMakeLists.txt delete mode 100644 native/cocos/renderer/gfx-gles2/CMakeLists.txt delete mode 100644 native/cocos/renderer/gfx-gles3/CMakeLists.txt delete mode 100644 native/cocos/renderer/gfx-metal/CMakeLists.txt delete mode 100644 native/cocos/renderer/gfx-vulkan/CMakeLists.txt diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index 597099b5ba..aafc0f69ce 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -283,43 +283,61 @@ endif() ##### base cocos_source_files( + cocos/base/Array.cpp + cocos/base/Array.h cocos/base/astc.cpp cocos/base/astc.h + cocos/base/AutoreleasePool.cpp + cocos/base/AutoreleasePool.h cocos/base/base64.cpp cocos/base/base64.h cocos/base/CachedArray.h - cocos/base/AutoreleasePool.cpp - cocos/base/AutoreleasePool.h - cocos/base/Array.cpp - cocos/base/Array.h cocos/base/Config.h + cocos/base/CoreStd.h + cocos/base/csscolorparser.cpp + cocos/base/csscolorparser.h cocos/base/Data.cpp cocos/base/Data.h + cocos/base/etc1.cpp + cocos/base/etc1.h + cocos/base/etc2.cpp + cocos/base/etc2.h + cocos/base/IndexHandle.h + cocos/base/Log.cpp + cocos/base/Log.h cocos/base/Macros.h cocos/base/Map.h + cocos/base/Object.h cocos/base/Random.cpp cocos/base/Random.h cocos/base/Ref.cpp cocos/base/Ref.h cocos/base/Scheduler.cpp cocos/base/Scheduler.h + cocos/base/StringHandle.cpp + cocos/base/StringHandle.h + cocos/base/StringPool.h + cocos/base/StringUtil.cpp + cocos/base/StringUtil.h cocos/base/ThreadPool.cpp cocos/base/ThreadPool.h + cocos/base/TypeDef.h cocos/base/UTF8.cpp cocos/base/UTF8.h + cocos/base/UTFString.cpp + cocos/base/UTFString.h + cocos/base/uthash.h cocos/base/Utils.cpp cocos/base/Utils.h cocos/base/Value.cpp cocos/base/Value.h cocos/base/Vector.h - cocos/base/csscolorparser.cpp - cocos/base/csscolorparser.h - cocos/base/etc1.cpp - cocos/base/etc1.h - cocos/base/etc2.cpp - cocos/base/etc2.h - cocos/base/Log.cpp - cocos/base/Log.h + cocos/base/ZipUtils.cpp + cocos/base/ZipUtils.h +) + +##### memory +cocos_source_files( cocos/base/memory/AllocatedObj.cpp cocos/base/memory/AllocatedObj.h cocos/base/memory/JeAlloc.cpp @@ -333,6 +351,10 @@ cocos_source_files( cocos/base/memory/NedPooling.h cocos/base/memory/StdAlloc.h cocos/base/memory/StlAlloc.h +) + +##### threading +cocos_source_files( cocos/base/threading/ConditionVariable.h cocos/base/threading/ConditionVariable.cpp cocos/base/threading/Event.h @@ -345,15 +367,6 @@ cocos_source_files( cocos/base/threading/ThreadSafeCounter.h cocos/base/threading/ThreadSafeLinearAllocator.h cocos/base/threading/ThreadSafeLinearAllocator.cpp - cocos/base/Object.h - cocos/base/TypeDef.h - cocos/base/uthash.h - cocos/base/StringUtil.cpp - cocos/base/StringUtil.h - cocos/base/UTFString.cpp - cocos/base/UTFString.h - cocos/base/ZipUtils.cpp - cocos/base/ZipUtils.h ) ##### job system @@ -540,7 +553,7 @@ elseif(APPLE) cocos/platform/apple/CanvasRenderingContext2D-apple.mm cocos/platform/apple/Device-apple.h ) - #bad struct + # bad structure cocos_source_files( cocos/platform/ios/Reachability.h cocos/platform/ios/Reachability.cpp @@ -566,78 +579,76 @@ endif() ##### renderer cocos_source_files( - cocos/renderer/core/Core.h - cocos/renderer/core/CoreStd.cpp - cocos/renderer/core/CoreStd.h - cocos/renderer/core/gfx/GFXObject.h - cocos/renderer/core/gfx/GFXObject.cpp - cocos/renderer/core/gfx/GFXBuffer.cpp - cocos/renderer/core/gfx/GFXBuffer.h - cocos/renderer/core/gfx/GFXCommandBuffer.cpp - cocos/renderer/core/gfx/GFXCommandBuffer.h - cocos/renderer/core/gfx/GFXContext.cpp - cocos/renderer/core/gfx/GFXContext.h - cocos/renderer/core/gfx/GFXDef.cpp - cocos/renderer/core/gfx/GFXDef.h - cocos/renderer/core/gfx/GFXDef-common.h - cocos/renderer/core/gfx/GFXDevice.cpp - cocos/renderer/core/gfx/GFXDevice.h - cocos/renderer/core/gfx/GFXFramebuffer.cpp - cocos/renderer/core/gfx/GFXFramebuffer.h - cocos/renderer/core/gfx/GFXGlobalBarrier.cpp - cocos/renderer/core/gfx/GFXGlobalBarrier.h - cocos/renderer/core/gfx/GFXInputAssembler.cpp - cocos/renderer/core/gfx/GFXInputAssembler.h - cocos/renderer/core/gfx/GFXDescriptorSet.cpp - cocos/renderer/core/gfx/GFXDescriptorSet.h - cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp - cocos/renderer/core/gfx/GFXDescriptorSetLayout.h - cocos/renderer/core/gfx/GFXPipelineLayout.cpp - cocos/renderer/core/gfx/GFXPipelineLayout.h - cocos/renderer/core/gfx/GFXPipelineState.cpp - cocos/renderer/core/gfx/GFXPipelineState.h - cocos/renderer/core/gfx/GFXQueue.cpp - cocos/renderer/core/gfx/GFXQueue.h - cocos/renderer/core/gfx/GFXRenderPass.cpp - cocos/renderer/core/gfx/GFXRenderPass.h - cocos/renderer/core/gfx/GFXSampler.cpp - cocos/renderer/core/gfx/GFXSampler.h - cocos/renderer/core/gfx/GFXShader.cpp - cocos/renderer/core/gfx/GFXShader.h - cocos/renderer/core/gfx/GFXTexture.cpp - cocos/renderer/core/gfx/GFXTexture.h - cocos/renderer/core/gfx/GFXTextureBarrier.cpp - cocos/renderer/core/gfx/GFXTextureBarrier.h - cocos/renderer/core/gfx-agent/GFXAgent.h - cocos/renderer/core/gfx-agent/GFXBufferAgent.h - cocos/renderer/core/gfx-agent/GFXBufferAgent.cpp - cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.h - cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.cpp - cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.h - cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.cpp - cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.h - cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.cpp - cocos/renderer/core/gfx-agent/GFXDeviceAgent.h - cocos/renderer/core/gfx-agent/GFXDeviceAgent.cpp - cocos/renderer/core/gfx-agent/GFXFramebufferAgent.h - cocos/renderer/core/gfx-agent/GFXFramebufferAgent.cpp - cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.h - cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.cpp - cocos/renderer/core/gfx-agent/GFXLinearAllocatorPool.h - cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.h - cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.cpp - cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.h - cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.cpp - cocos/renderer/core/gfx-agent/GFXQueueAgent.h - cocos/renderer/core/gfx-agent/GFXQueueAgent.cpp - cocos/renderer/core/gfx-agent/GFXRenderPassAgent.h - cocos/renderer/core/gfx-agent/GFXRenderPassAgent.cpp - cocos/renderer/core/gfx-agent/GFXSamplerAgent.h - cocos/renderer/core/gfx-agent/GFXSamplerAgent.cpp - cocos/renderer/core/gfx-agent/GFXShaderAgent.h - cocos/renderer/core/gfx-agent/GFXShaderAgent.cpp - cocos/renderer/core/gfx-agent/GFXTextureAgent.h - cocos/renderer/core/gfx-agent/GFXTextureAgent.cpp + cocos/renderer/gfx-base/GFXObject.h + cocos/renderer/gfx-base/GFXObject.cpp + cocos/renderer/gfx-base/GFXBase.h + cocos/renderer/gfx-base/GFXBuffer.cpp + cocos/renderer/gfx-base/GFXBuffer.h + cocos/renderer/gfx-base/GFXCommandBuffer.cpp + cocos/renderer/gfx-base/GFXCommandBuffer.h + cocos/renderer/gfx-base/GFXContext.cpp + cocos/renderer/gfx-base/GFXContext.h + cocos/renderer/gfx-base/GFXDef.cpp + cocos/renderer/gfx-base/GFXDef.h + cocos/renderer/gfx-base/GFXDef-common.h + cocos/renderer/gfx-base/GFXDevice.cpp + cocos/renderer/gfx-base/GFXDevice.h + cocos/renderer/gfx-base/GFXFramebuffer.cpp + cocos/renderer/gfx-base/GFXFramebuffer.h + cocos/renderer/gfx-base/GFXGlobalBarrier.cpp + cocos/renderer/gfx-base/GFXGlobalBarrier.h + cocos/renderer/gfx-base/GFXInputAssembler.cpp + cocos/renderer/gfx-base/GFXInputAssembler.h + cocos/renderer/gfx-base/GFXDescriptorSet.cpp + cocos/renderer/gfx-base/GFXDescriptorSet.h + cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp + cocos/renderer/gfx-base/GFXDescriptorSetLayout.h + cocos/renderer/gfx-base/GFXPipelineLayout.cpp + cocos/renderer/gfx-base/GFXPipelineLayout.h + cocos/renderer/gfx-base/GFXPipelineState.cpp + cocos/renderer/gfx-base/GFXPipelineState.h + cocos/renderer/gfx-base/GFXQueue.cpp + cocos/renderer/gfx-base/GFXQueue.h + cocos/renderer/gfx-base/GFXRenderPass.cpp + cocos/renderer/gfx-base/GFXRenderPass.h + cocos/renderer/gfx-base/GFXSampler.cpp + cocos/renderer/gfx-base/GFXSampler.h + cocos/renderer/gfx-base/GFXShader.cpp + cocos/renderer/gfx-base/GFXShader.h + cocos/renderer/gfx-base/GFXTexture.cpp + cocos/renderer/gfx-base/GFXTexture.h + cocos/renderer/gfx-base/GFXTextureBarrier.cpp + cocos/renderer/gfx-base/GFXTextureBarrier.h + cocos/renderer/gfx-agent/GFXAgent.h + cocos/renderer/gfx-agent/GFXBufferAgent.h + cocos/renderer/gfx-agent/GFXBufferAgent.cpp + cocos/renderer/gfx-agent/GFXCommandBufferAgent.h + cocos/renderer/gfx-agent/GFXCommandBufferAgent.cpp + cocos/renderer/gfx-agent/GFXDescriptorSetAgent.h + cocos/renderer/gfx-agent/GFXDescriptorSetAgent.cpp + cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.h + cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.cpp + cocos/renderer/gfx-agent/GFXDeviceAgent.h + cocos/renderer/gfx-agent/GFXDeviceAgent.cpp + cocos/renderer/gfx-agent/GFXFramebufferAgent.h + cocos/renderer/gfx-agent/GFXFramebufferAgent.cpp + cocos/renderer/gfx-agent/GFXInputAssemblerAgent.h + cocos/renderer/gfx-agent/GFXInputAssemblerAgent.cpp + cocos/renderer/gfx-agent/GFXLinearAllocatorPool.h + cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.h + cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.cpp + cocos/renderer/gfx-agent/GFXPipelineStateAgent.h + cocos/renderer/gfx-agent/GFXPipelineStateAgent.cpp + cocos/renderer/gfx-agent/GFXQueueAgent.h + cocos/renderer/gfx-agent/GFXQueueAgent.cpp + cocos/renderer/gfx-agent/GFXRenderPassAgent.h + cocos/renderer/gfx-agent/GFXRenderPassAgent.cpp + cocos/renderer/gfx-agent/GFXSamplerAgent.h + cocos/renderer/gfx-agent/GFXSamplerAgent.cpp + cocos/renderer/gfx-agent/GFXShaderAgent.h + cocos/renderer/gfx-agent/GFXShaderAgent.cpp + cocos/renderer/gfx-agent/GFXTextureAgent.h + cocos/renderer/gfx-agent/GFXTextureAgent.cpp cocos/renderer/pipeline/BatchedBuffer.cpp cocos/renderer/pipeline/BatchedBuffer.h cocos/renderer/pipeline/Define.h @@ -1606,7 +1617,6 @@ target_include_directories(cocos2d ${CWD}/cocos ${CWD}/cocos/renderer ${CWD}/cocos/platform - ${CWD}/cocos/renderer/core ${CWD}/external/sources/khronos ${CWD}/cocos/editor-support $<$:${CWD}/cocos/bindings/jswrapper> diff --git a/native/cocos/audio/android/AudioPlayerProvider.cpp b/native/cocos/audio/android/AudioPlayerProvider.cpp index bbedabfa73..aa8190d44a 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.cpp +++ b/native/cocos/audio/android/AudioPlayerProvider.cpp @@ -73,7 +73,7 @@ AudioPlayerProvider::AudioPlayerProvider(SLEngineItf engineItf, SLObjectItf outp int deviceSampleRate, int bufferSizeInFrames, const FdGetterCallback &fdGetterCallback, ICallerThreadUtils *callerThreadUtils) -: _engineItf(engineItf), _outputMixObject(outputMixObject), _deviceSampleRate(deviceSampleRate), _bufferSizeInFrames(bufferSizeInFrames), _fdGetterCallback(fdGetterCallback), _callerThreadUtils(callerThreadUtils), _pcmAudioService(nullptr), _mixController(nullptr), _threadPool(ThreadPool::newCachedThreadPool(1, 8, 5, 2, 2)) { +: _engineItf(engineItf), _outputMixObject(outputMixObject), _deviceSampleRate(deviceSampleRate), _bufferSizeInFrames(bufferSizeInFrames), _fdGetterCallback(fdGetterCallback), _callerThreadUtils(callerThreadUtils), _pcmAudioService(nullptr), _mixController(nullptr), _threadPool(LegacyThreadPool::newCachedThreadPool(1, 8, 5, 2, 2)) { ALOGI("deviceSampleRate: %d, bufferSizeInFrames: %d", _deviceSampleRate, _bufferSizeInFrames); if (getSystemAPILevel() >= 17) { _mixController = new (std::nothrow) AudioMixerController(_bufferSizeInFrames, _deviceSampleRate, 2); diff --git a/native/cocos/audio/android/AudioPlayerProvider.h b/native/cocos/audio/android/AudioPlayerProvider.h index af223dcf02..e737d2d72e 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.h +++ b/native/cocos/audio/android/AudioPlayerProvider.h @@ -42,7 +42,7 @@ class UrlAudioPlayer; class AudioMixerController; class ICallerThreadUtils; class AssetFd; -class ThreadPool; +class LegacyThreadPool; class AudioPlayerProvider { public: @@ -116,7 +116,7 @@ private: PcmAudioService *_pcmAudioService; AudioMixerController *_mixController; - ThreadPool *_threadPool; + LegacyThreadPool *_threadPool; }; } // namespace cc diff --git a/native/cocos/base/CMakeLists.txt b/native/cocos/base/CMakeLists.txt deleted file mode 100644 index 2e632b35b2..0000000000 --- a/native/cocos/base/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ - -add_subdirectory(job-system) -add_subdirectory(threading) diff --git a/native/cocos/renderer/core/CoreStd.h b/native/cocos/base/CoreStd.h similarity index 97% rename from native/cocos/renderer/core/CoreStd.h rename to native/cocos/base/CoreStd.h index 018eaa3e05..a95e98641f 100644 --- a/native/cocos/renderer/core/CoreStd.h +++ b/native/cocos/base/CoreStd.h @@ -59,10 +59,12 @@ #include "base/TypeDef.h" #include "base/memory/Memory.h" -#include "math/Math.h" #include "base/Log.h" #include "base/Object.h" -#include "gfx/GFXObject.h" +#include "base/CachedArray.h" +#include "base/StringUtil.h" + +#include "math/Math.h" #define CC_JOB_SYSTEM_TASKFLOW 1 #define CC_JOB_SYSTEM_TBB 2 diff --git a/native/cocos/base/IndexHandle.h b/native/cocos/base/IndexHandle.h new file mode 100644 index 0000000000..e7bef23310 --- /dev/null +++ b/native/cocos/base/IndexHandle.h @@ -0,0 +1,90 @@ +/**************************************************************************** + Copyright (c) 2020-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 + to use Cocos Creator solely to develop games on your target platforms. You shall + 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 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +****************************************************************************/ + +#pragma once + +#include +#include +#include + +namespace cc { + +template >> +class IndexHandle { +public: + struct Hasher { + inline size_t operator()(IndexHandle const &s) const noexcept { return s._index; } + }; + + using IndexType = Index; + + IndexHandle() noexcept = default; + explicit IndexHandle(IndexType const index) noexcept : _index(index) {} + + inline bool isValid() const noexcept; + inline void clear() noexcept; + + inline bool operator<(IndexHandle const &rhs) const noexcept; + inline bool operator==(IndexHandle const &rhs) const noexcept; + inline bool operator!=(IndexHandle const &rhs) const noexcept; + inline operator IndexType() const noexcept; + + static IndexType constexpr UNINITIALIZED{std::numeric_limits::max()}; + +private: + IndexType _index{UNINITIALIZED}; +}; + +template +bool IndexHandle::isValid() const noexcept { + return _index != UNINITIALIZED; +} + +template +void IndexHandle::clear() noexcept { + _index = UNINITIALIZED; +} + +template +bool IndexHandle::operator<(IndexHandle const &rhs) const noexcept { + return _index < rhs._index; +} + +template +bool IndexHandle::operator==(IndexHandle const &rhs) const noexcept { + return (_index == rhs._index); +} + +template +bool IndexHandle::operator!=(IndexHandle const &rhs) const noexcept { + return !operator==(rhs); +} + +template +IndexHandle::operator IndexType() const noexcept { + return _index; +} + +} // namespace cc diff --git a/native/cocos/renderer/core/CoreStd.cpp b/native/cocos/base/StringHandle.cpp similarity index 84% rename from native/cocos/renderer/core/CoreStd.cpp rename to native/cocos/base/StringHandle.cpp index e70caa2718..b69adb29c7 100644 --- a/native/cocos/renderer/core/CoreStd.cpp +++ b/native/cocos/base/StringHandle.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -23,4 +23,13 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "StringHandle.h" + +namespace cc { + +StringHandle::StringHandle(IndexType const handle, char const *const str) noexcept +: IndexHandle(handle), + _str(str) { +} + +} // namespace cc diff --git a/native/cocos/base/StringHandle.h b/native/cocos/base/StringHandle.h new file mode 100644 index 0000000000..36c226b079 --- /dev/null +++ b/native/cocos/base/StringHandle.h @@ -0,0 +1,42 @@ +/**************************************************************************** + Copyright (c) 2020-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 + to use Cocos Creator solely to develop games on your target platforms. You shall + 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 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +****************************************************************************/ + +#pragma once + +#include "IndexHandle.h" + +namespace cc { + +class StringHandle final : public IndexHandle { +public: + StringHandle() noexcept = default; + explicit StringHandle(IndexType const handle, char const *const str) noexcept; + inline char const *str() const noexcept { return _str; } + +private: + char const *_str{nullptr}; +}; + +} // namespace cc diff --git a/native/cocos/base/StringPool.h b/native/cocos/base/StringPool.h new file mode 100644 index 0000000000..58c7169935 --- /dev/null +++ b/native/cocos/base/StringPool.h @@ -0,0 +1,131 @@ +/**************************************************************************** + Copyright (c) 2020-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 + to use Cocos Creator solely to develop games on your target platforms. You shall + 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 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +****************************************************************************/ + +#pragma once + +#include "StringHandle.h" +#include "threading/ReadWriteLock.h" +#include +#include +#include +#include + +namespace cc { + +struct StringCompare final { + inline bool operator()(char const *lhs, char const *rhs) const noexcept { + return strcmp(lhs, rhs) < 0; + } +}; + +template +class StringPool final { +public: + StringPool() noexcept = default; + ~StringPool() = default; + StringPool(StringPool const &) = delete; + StringPool(StringPool &&) = delete; + StringPool &operator=(StringPool const &) = delete; + StringPool &operator=(StringPool &&) = delete; + + StringHandle stringToHandle(char const *const str) noexcept; + char const * handleToString(StringHandle const handle) const noexcept; + StringHandle find(char const *const str) const noexcept; + +private: + StringHandle doStringToHandle(char const *const str) noexcept; + char const * doHandleToString(StringHandle const handle) const noexcept; + StringHandle doFind(char const *const str) const noexcept; + + std::map _stringToHandles{}; + std::vector _handleToStrings{}; + mutable ReadWriteLock _readWriteLock{}; +}; + +using ThreadSafeStringPool = StringPool; + +template +inline StringHandle StringPool::stringToHandle(char const *const str) noexcept { + if (ThreadSafe) { + return _readWriteLock.LockWrite([this, str]() { + return doStringToHandle(str); + }); + } else { + return doStringToHandle(str); + } +} + +template +inline char const *StringPool::handleToString(StringHandle const handle) const noexcept { + if (ThreadSafe) { + return _readWriteLock.LockRead([this, handle]() { + return doHandleToString(handle); + }); + } else { + return doHandleToString(handle); + } +} + +template +StringHandle StringPool::find(char const *const str) const noexcept { + if (ThreadSafe) { + return _readWriteLock.LockRead([this, str]() { + return doFind(str); + }); + } else { + return doFind(str); + } +} + +template +inline StringHandle StringPool::doStringToHandle(char const *const str) noexcept { + auto const it = _stringToHandles.find(str); + + if (it == _stringToHandles.end()) { + size_t const strLength = strlen(str) + 1; + char *const strCache = new char[strLength]; // never freed since we can't invalidate every existing usage + strcpy(strCache, str); + StringHandle name(static_cast(_handleToStrings.size()), strCache); + _handleToStrings.emplace_back(strCache); + _stringToHandles.emplace(strCache, name); + return name; + } else { + return it->second; + } +} + +template +inline char const *StringPool::doHandleToString(StringHandle const handle) const noexcept { + assert(handle < _handleToStrings.size()); + return _handleToStrings[handle]; +} + +template +StringHandle StringPool::doFind(char const *const str) const noexcept { + auto const it = _stringToHandles.find(str); + return it == _stringToHandles.end() ? StringHandle{} : it->second; +} + +} // namespace cc diff --git a/native/cocos/base/StringUtil.cpp b/native/cocos/base/StringUtil.cpp index 30fc2fa227..027afed204 100755 --- a/native/cocos/base/StringUtil.cpp +++ b/native/cocos/base/StringUtil.cpp @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" #include "StringUtil.h" +#include "memory/Memory.h" +#include #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #ifndef WIN32_LEAN_AND_MEAN @@ -40,7 +41,7 @@ int StringUtil::VPrintf(char *buf, char *last, const char *fmt, va_list args) { if (last <= buf) return 0; int count = (int)(last - buf); - int ret = _vsnprintf_s(buf, count, _TRUNCATE, fmt, args); + int ret = _vsnprintf_s(buf, count, _TRUNCATE, fmt, args); if (ret < 0) { if (errno == 0) { return count - 1; @@ -56,7 +57,7 @@ int StringUtil::VPrintf(char *buf, char *last, const char *fmt, va_list args) { if (last <= buf) return 0; int count = (int)(last - buf); - int ret = vsnprintf(buf, count, fmt, args); + int ret = vsnprintf(buf, count, fmt, args); if (ret >= count - 1) { return count - 1; } else if (ret < 0) { @@ -75,7 +76,7 @@ int StringUtil::Printf(char *buf, char *last, const char *fmt, ...) { } String StringUtil::Format(const char *fmt, ...) { - char sz[4096]; + char sz[4096]; va_list args; va_start(args, fmt); VPrintf(sz, sz + sizeof(sz) - 1, fmt, args); diff --git a/native/cocos/base/StringUtil.h b/native/cocos/base/StringUtil.h index 5181018424..c1d5963c1c 100755 --- a/native/cocos/base/StringUtil.h +++ b/native/cocos/base/StringUtil.h @@ -23,11 +23,11 @@ THE SOFTWARE. ****************************************************************************/ -#ifndef CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ -#define CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ +#pragma once #include "Macros.h" #include "TypeDef.h" +#include "memory/Memory.h" namespace cc { @@ -40,5 +40,3 @@ public: }; } // namespace cc - -#endif // CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ diff --git a/native/cocos/base/ThreadPool.cpp b/native/cocos/base/ThreadPool.cpp index f9e30ffcd2..b62ad6d68e 100644 --- a/native/cocos/base/ThreadPool.cpp +++ b/native/cocos/base/ThreadPool.cpp @@ -48,9 +48,9 @@ namespace cc { #define DEFAULT_SHRINK_STEP (2) #define DEFAULT_STRETCH_STEP (2) -static ThreadPool *__defaultThreadPool = nullptr; +static LegacyThreadPool *__defaultThreadPool = nullptr; -ThreadPool *ThreadPool::getDefaultThreadPool() { +LegacyThreadPool *LegacyThreadPool::getDefaultThreadPool() { if (__defaultThreadPool == nullptr) { __defaultThreadPool = newCachedThreadPool(DEFAULT_THREAD_POOL_MIN_NUM, DEFAULT_THREAD_POOL_MAX_NUM, @@ -61,14 +61,14 @@ ThreadPool *ThreadPool::getDefaultThreadPool() { return __defaultThreadPool; } -void ThreadPool::destroyDefaultThreadPool() { +void LegacyThreadPool::destroyDefaultThreadPool() { delete __defaultThreadPool; __defaultThreadPool = nullptr; } -ThreadPool *ThreadPool::newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, +LegacyThreadPool *LegacyThreadPool::newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, int shrinkStep, int stretchStep) { - ThreadPool *pool = new (std::nothrow) ThreadPool(minThreadNum, maxThreadNum); + LegacyThreadPool *pool = new (std::nothrow) LegacyThreadPool(minThreadNum, maxThreadNum); if (pool != nullptr) { pool->setFixedSize(false); pool->setShrinkInterval(shrinkInterval); @@ -78,40 +78,40 @@ ThreadPool *ThreadPool::newCachedThreadPool(int minThreadNum, int maxThreadNum, return pool; } -ThreadPool *ThreadPool::newFixedThreadPool(int threadNum) { - ThreadPool *pool = new (std::nothrow) ThreadPool(threadNum, threadNum); +LegacyThreadPool *LegacyThreadPool::newFixedThreadPool(int threadNum) { + LegacyThreadPool *pool = new (std::nothrow) LegacyThreadPool(threadNum, threadNum); if (pool != nullptr) { pool->setFixedSize(true); } return pool; } -ThreadPool *ThreadPool::newSingleThreadPool() { - ThreadPool *pool = new (std::nothrow) ThreadPool(1, 1); +LegacyThreadPool *LegacyThreadPool::newSingleThreadPool() { + LegacyThreadPool *pool = new (std::nothrow) LegacyThreadPool(1, 1); if (pool != nullptr) { pool->setFixedSize(true); } return pool; } -ThreadPool::ThreadPool(int minNum, int maxNum) +LegacyThreadPool::LegacyThreadPool(int minNum, int maxNum) : _isDone(false), _isStop(false), _idleThreadNum(0), _minThreadNum(minNum), _maxThreadNum(maxNum), _initedThreadNum(0), _shrinkInterval(DEFAULT_SHRINK_INTERVAL), _shrinkStep(DEFAULT_SHRINK_STEP), _stretchStep(DEFAULT_STRETCH_STEP), _isFixedSize(false) { init(); } // the destructor waits for all the functions in the queue to be finished -ThreadPool::~ThreadPool() { +LegacyThreadPool::~LegacyThreadPool() { stop(); } // number of idle threads -int ThreadPool::getIdleThreadNum() const { - ThreadPool *thiz = const_cast(this); +int LegacyThreadPool::getIdleThreadNum() const { + LegacyThreadPool *thiz = const_cast(this); std::lock_guard lk(thiz->_idleThreadNumMutex); return _idleThreadNum; } -void ThreadPool::init() { +void LegacyThreadPool::init() { _lastShrinkTime = std::chrono::high_resolution_clock::now(); _maxThreadNum = std::max(_minThreadNum, _maxThreadNum); @@ -135,7 +135,7 @@ void ThreadPool::init() { } } -bool ThreadPool::tryShrinkPool() { +bool LegacyThreadPool::tryShrinkPool() { LOGD("shrink pool, _idleThreadNum = %d \n", getIdleThreadNum()); auto before = std::chrono::high_resolution_clock::now(); @@ -182,7 +182,7 @@ bool ThreadPool::tryShrinkPool() { return false; } -void ThreadPool::stretchPool(int count) { +void LegacyThreadPool::stretchPool(int count) { auto before = std::chrono::high_resolution_clock::now(); int oldThreadCount = _initedThreadNum; @@ -210,7 +210,7 @@ void ThreadPool::stretchPool(int count) { } } -void ThreadPool::pushTask(const std::function &runnable, +void LegacyThreadPool::pushTask(const std::function &runnable, TaskType type /* = DEFAULT*/) { if (!_isFixedSize) { _idleThreadNumMutex.lock(); @@ -246,14 +246,14 @@ void ThreadPool::pushTask(const std::function &runnable, } } -void ThreadPool::stopAllTasks() { +void LegacyThreadPool::stopAllTasks() { Task task; while (_taskQueue.pop(task)) { delete task.callback; // empty the queue } } -void ThreadPool::stopTasksByType(TaskType type) { +void LegacyThreadPool::stopTasksByType(TaskType type) { Task task; std::vector notStopTasks; @@ -274,7 +274,7 @@ void ThreadPool::stopTasksByType(TaskType type) { } } -void ThreadPool::joinThread(int tid) { +void LegacyThreadPool::joinThread(int tid) { if (tid < 0 || tid >= (int)_threads.size()) { LOGD("Invalid thread id %d\n", tid); return; @@ -288,30 +288,30 @@ void ThreadPool::joinThread(int tid) { } } -int ThreadPool::getTaskNum() const { +int LegacyThreadPool::getTaskNum() const { return (int)_taskQueue.size(); } -void ThreadPool::setFixedSize(bool isFixedSize) { +void LegacyThreadPool::setFixedSize(bool isFixedSize) { _isFixedSize = isFixedSize; } -void ThreadPool::setShrinkInterval(int seconds) { +void LegacyThreadPool::setShrinkInterval(int seconds) { if (seconds >= 0) _shrinkInterval = (float)seconds; } -void ThreadPool::setShrinkStep(int step) { +void LegacyThreadPool::setShrinkStep(int step) { if (step > 0) _shrinkStep = step; } -void ThreadPool::setStretchStep(int step) { +void LegacyThreadPool::setStretchStep(int step) { if (step > 0) _stretchStep = step; } -void ThreadPool::stop() { +void LegacyThreadPool::stop() { if (_isDone || _isStop) return; _isDone = true; // give the waiting threads a command to finish @@ -331,7 +331,7 @@ void ThreadPool::stop() { _abortFlags.clear(); } -void ThreadPool::setThread(int tid) { +void LegacyThreadPool::setThread(int tid) { std::shared_ptr> abort_ptr( _abortFlags[tid]); // a copy of the shared ptr to the flag auto f = [this, tid, abort_ptr /* a copy of the shared ptr to the abort */]() { diff --git a/native/cocos/base/ThreadPool.h b/native/cocos/base/ThreadPool.h index b2f2cc51b5..ce0e20d4f5 100644 --- a/native/cocos/base/ThreadPool.h +++ b/native/cocos/base/ThreadPool.h @@ -45,7 +45,7 @@ namespace cc { * @{ */ -class CC_DLL ThreadPool { +class CC_DLL LegacyThreadPool { public: enum class TaskType { DEFAULT = 0, @@ -58,7 +58,7 @@ public: /* * Gets the default thread pool which is a cached thread pool with default parameters. */ - static ThreadPool *getDefaultThreadPool(); + static LegacyThreadPool *getDefaultThreadPool(); /* * Destroys the default thread pool @@ -69,23 +69,23 @@ public: * Creates a cached thread pool * @note The return value has to be delete while it doesn't needed */ - static ThreadPool *newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, + static LegacyThreadPool *newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, int shrinkStep, int stretchStep); /* * Creates a thread pool with fixed thread count * @note The return value has to be delete while it doesn't needed */ - static ThreadPool *newFixedThreadPool(int threadNum); + static LegacyThreadPool *newFixedThreadPool(int threadNum); /* * Creates a thread pool with only one thread in the pool, it could be used to execute multiply tasks serially in just one thread. * @note The return value has to be delete while it doesn't needed */ - static ThreadPool *newSingleThreadPool(); + static LegacyThreadPool *newSingleThreadPool(); // the destructor waits for all the functions in the queue to be finished - ~ThreadPool(); + ~LegacyThreadPool(); /* Pushs a task to thread pool * @param runnable The callback of the task executed in sub thread @@ -122,15 +122,15 @@ public: bool tryShrinkPool(); private: - ThreadPool(int minNum, int maxNum); + LegacyThreadPool(int minNum, int maxNum); - ThreadPool(const ThreadPool &); + LegacyThreadPool(const LegacyThreadPool &); - ThreadPool(ThreadPool &&); + LegacyThreadPool(LegacyThreadPool &&); - ThreadPool &operator=(const ThreadPool &); + LegacyThreadPool &operator=(const LegacyThreadPool &); - ThreadPool &operator=(ThreadPool &&); + LegacyThreadPool &operator=(LegacyThreadPool &&); void init(); diff --git a/native/cocos/base/TypeDef.h b/native/cocos/base/TypeDef.h index 4b07839dce..22e3967e65 100755 --- a/native/cocos/base/TypeDef.h +++ b/native/cocos/base/TypeDef.h @@ -23,8 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#ifndef CC_CORE_TYPE_DEF_H_ -#define CC_CORE_TYPE_DEF_H_ +#pragma once typedef unsigned int uint; typedef unsigned short ushort; @@ -39,5 +38,3 @@ typedef unsigned int FlagBits; CC_INLINE void operator&=(type_ &lhs, type_ rhs) { lhs = (type_)(static_cast::type /**/>(lhs) & static_cast::type /**/>(rhs)); } \ CC_INLINE bool operator||(type_ lhs, type_ rhs) { return (static_cast::type /**/>(lhs) || static_cast::type /**/>(rhs)); } \ CC_INLINE bool operator&&(type_ lhs, type_ rhs) { return (static_cast::type /**/>(lhs) && static_cast::type /**/>(rhs)); } - -#endif // CC_CORE_TYPE_DEF_H_ diff --git a/native/cocos/base/job-system/CMakeLists.txt b/native/cocos/base/job-system/CMakeLists.txt deleted file mode 100644 index 095a261c55..0000000000 --- a/native/cocos/base/job-system/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ - -add_subdirectory(job-system-taskflow) -add_subdirectory(job-system-tbb) diff --git a/native/cocos/base/job-system/job-system-taskflow/CMakeLists.txt b/native/cocos/base/job-system/job-system-taskflow/CMakeLists.txt deleted file mode 100644 index a5b4fe9f00..0000000000 --- a/native/cocos/base/job-system/job-system-taskflow/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -set(TARGET_NAME TFJobSystem) -set(CMAKE_CXX_STANDARD 17) -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/taskflow - ${COCOS_SRC_PATH} - ${COCOS_SRC_PATH}/base - ${COCOS_SRC_PATH}/renderer/core -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(CC_BASE_HEADERS - ${COCOS_SRC_PATH}/base/TypeDef.h - ${COCOS_SRC_PATH}/base/Log.h - ${COCOS_SRC_PATH}/base/Object.h - ${COCOS_SRC_PATH}/base/memory/Memory.h - ${COCOS_SRC_PATH}/math/Math.h -) - -set(CC_BASE_SOURCES - ${COCOS_SRC_PATH}/base/Log.cpp - ${COCOS_SRC_PATH}/base/memory/Memory.cpp - ${COCOS_SRC_PATH}/math/Math.cpp -) - -set(ALL_FILES - ${CC_BASE_HEADERS} - ${CC_BASE_SOURCES} - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} -) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME}) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCTFJobSystem) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCTFJobSystem_d) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp index 9abba5263b..01e933700f 100644 --- a/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "TFJobGraph.h" #include "TFJobSystem.h" diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h index 07d44418e8..0e6f6947ca 100644 --- a/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h @@ -34,7 +34,7 @@ using TFJobToken = void; class TFJobGraph final { public: - TFJobGraph(TFJobSystem *system) : _executor(&system->_executor) {} + explicit TFJobGraph(TFJobSystem *system) noexcept : _executor(&system->_executor) {} template uint createJob(Function &&func) noexcept; diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp index 7ea42193b0..90dad4c950 100644 --- a/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "TFJobGraph.h" #include "TFJobSystem.h" diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h index 792c820be8..31aae10931 100644 --- a/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h @@ -45,7 +45,7 @@ public: } TFJobSystem() noexcept : TFJobSystem(std::max(2u, std::thread::hardware_concurrency() - 2u)) {} - TFJobSystem(uint threadCount) noexcept; + explicit TFJobSystem(uint threadCount) noexcept; CC_INLINE uint threadCount() { return _executor.num_workers(); } diff --git a/native/cocos/base/job-system/job-system-tbb/CMakeLists.txt b/native/cocos/base/job-system/job-system-tbb/CMakeLists.txt deleted file mode 100644 index 557008d6da..0000000000 --- a/native/cocos/base/job-system/job-system-tbb/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -set(TARGET_NAME TBBJobSystem) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/tbb/include - ${COCOS_SRC_PATH} - ${COCOS_SRC_PATH}/base - ${COCOS_SRC_PATH}/renderer/core -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(CC_BASE_HEADERS - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/TypeDef.h - ${COCOS_SRC_PATH}/base/Log.h - ${COCOS_SRC_PATH}/base/Object.h - ${COCOS_SRC_PATH}/base/UTFString.h - ${COCOS_SRC_PATH}/base/memory/Memory.h - ${COCOS_SRC_PATH}/math/Math.h -) - -set(CC_BASE_SOURCES - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ${COCOS_SRC_PATH}/base/UTFString.cpp - ${COCOS_SRC_PATH}/base/Log.cpp - ${COCOS_SRC_PATH}/base/memory/Memory.cpp - ${COCOS_SRC_PATH}/math/Math.cpp -) - -set(ALL_FILES - ${CC_BASE_HEADERS} - ${CC_BASE_SOURCES} - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} -) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME} tbb tbbmalloc tbbmalloc_proxy) -target_compile_definitions(${TARGET_NAME} PRIVATE ${CC_EXTERNAL_PRIVATE_DEFINITIONS}) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCTBBJobSystem) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCTBBJobSystem_d) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp index ef95f22023..294b5aa0c7 100644 --- a/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "TBBJobGraph.h" diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h index 1fdcb49c89..638536e938 100644 --- a/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h @@ -35,7 +35,7 @@ class TBBJobSystem; class TBBJobGraph final { public: - TBBJobGraph(TBBJobSystem *system) { + explicit TBBJobGraph(TBBJobSystem *system) noexcept { _nodes.emplace_back(_graph, [](TBBJobToken t) {}); } diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp index a3658c63d6..ac2a2a0b19 100644 --- a/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "TBBJobGraph.h" #include "TBBJobSystem.h" diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h index cfc1770ab5..27da4aebd0 100644 --- a/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h @@ -47,7 +47,7 @@ public: } TBBJobSystem() noexcept : TBBJobSystem(std::max(2u, std::thread::hardware_concurrency() - 2u)) {} - TBBJobSystem(uint threadCount) noexcept; + explicit TBBJobSystem(uint threadCount) noexcept; CC_INLINE uint threadCount() { return _threadCount; } diff --git a/native/cocos/base/memory/JeAlloc.cpp b/native/cocos/base/memory/JeAlloc.cpp index aaaf84a986..84be0d9084 100755 --- a/native/cocos/base/memory/JeAlloc.cpp +++ b/native/cocos/base/memory/JeAlloc.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "JeAlloc.h" #include "MemTracker.h" diff --git a/native/cocos/base/memory/MemTracker.cpp b/native/cocos/base/memory/MemTracker.cpp index cab4a8533e..d36ba53f4e 100755 --- a/native/cocos/base/memory/MemTracker.cpp +++ b/native/cocos/base/memory/MemTracker.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "MemTracker.h" #include "../StringUtil.h" diff --git a/native/cocos/base/memory/Memory.cpp b/native/cocos/base/memory/Memory.cpp index 0af3eed54c..d5cafdbe3d 100755 --- a/native/cocos/base/memory/Memory.cpp +++ b/native/cocos/base/memory/Memory.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "Memory.h" #include "StlAlloc.h" diff --git a/native/cocos/base/memory/NedPooling.cpp b/native/cocos/base/memory/NedPooling.cpp index 6784c8b3c5..448d0be966 100755 --- a/native/cocos/base/memory/NedPooling.cpp +++ b/native/cocos/base/memory/NedPooling.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "NedPooling.h" #include "MemTracker.h" diff --git a/native/cocos/base/threading/CMakeLists.txt b/native/cocos/base/threading/CMakeLists.txt deleted file mode 100644 index 57725134bb..0000000000 --- a/native/cocos/base/threading/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -set(TARGET_NAME Threading) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${GFX_EXTERNAL_PATH}/acl/includes - ${GFX_EXTERNAL_PATH}/rtm/includes -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} -) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME}) - -if(MSVC) - target_compile_options(${TARGET_NAME} - PUBLIC /utf-8 # MSVC portability - PUBLIC /wd4324 # command encoder alignment - ) -endif() - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCThreading) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCThreading_d) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/base/threading/ReadWriteLock.h b/native/cocos/base/threading/ReadWriteLock.h new file mode 100644 index 0000000000..292250ad82 --- /dev/null +++ b/native/cocos/base/threading/ReadWriteLock.h @@ -0,0 +1,56 @@ +/**************************************************************************** + 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 + to use Cocos Creator solely to develop games on your target platforms. You shall + 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 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +****************************************************************************/ + +#pragma once + +#include + +namespace cc { + +class ReadWriteLock final { +public: + template + auto LockRead(Function &&func, Args &&... args) noexcept -> decltype(func(std::forward(args)...)); + + template + auto LockWrite(Function &&func, Args &&... args) noexcept -> decltype(func(std::forward(args)...)); + +private: + std::shared_mutex _mutex; +}; + +template +auto ReadWriteLock::LockRead(Function &&func, Args &&... args) noexcept -> decltype(func(std::forward(args)...)) { + std::shared_lock lock(_mutex); + return func(std::forward(args)...); +} + +template +auto ReadWriteLock::LockWrite(Function &&func, Args &&... args) noexcept -> decltype(func(std::forward(args)...)) { + std::lock_guard lock(_mutex); + return func(std::forward(args)...); +} + +} // namespace cc diff --git a/native/cocos/bindings/auto/jsb_audio_auto.cpp b/native/cocos/bindings/auto/jsb_audio_auto.cpp index 907785851f..6b0aae6b5a 100644 --- a/native/cocos/bindings/auto/jsb_audio_auto.cpp +++ b/native/cocos/bindings/auto/jsb_audio_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_audio_auto.h b/native/cocos/bindings/auto/jsb_audio_auto.h index e7d668143d..0464119f65 100644 --- a/native/cocos/bindings/auto/jsb_audio_auto.h +++ b/native/cocos/bindings/auto/jsb_audio_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_cocos_auto.cpp b/native/cocos/bindings/auto/jsb_cocos_auto.cpp index 688c360350..49355fcb86 100644 --- a/native/cocos/bindings/auto/jsb_cocos_auto.cpp +++ b/native/cocos/bindings/auto/jsb_cocos_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_cocos_auto.h b/native/cocos/bindings/auto/jsb_cocos_auto.h index e486f2e097..83c5375e6c 100644 --- a/native/cocos/bindings/auto/jsb_cocos_auto.h +++ b/native/cocos/bindings/auto/jsb_cocos_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp b/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp index 2bccc3210c..5a51b5a878 100644 --- a/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp +++ b/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_dragonbones_auto.h b/native/cocos/bindings/auto/jsb_dragonbones_auto.h index d07fe715c8..5d93da4d3c 100644 --- a/native/cocos/bindings/auto/jsb_dragonbones_auto.h +++ b/native/cocos/bindings/auto/jsb_dragonbones_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_editor_support_auto.cpp b/native/cocos/bindings/auto/jsb_editor_support_auto.cpp index 4cd0823ed7..ef970bbbf1 100644 --- a/native/cocos/bindings/auto/jsb_editor_support_auto.cpp +++ b/native/cocos/bindings/auto/jsb_editor_support_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_editor_support_auto.h b/native/cocos/bindings/auto/jsb_editor_support_auto.h index faa15afd09..a626254d58 100644 --- a/native/cocos/bindings/auto/jsb_editor_support_auto.h +++ b/native/cocos/bindings/auto/jsb_editor_support_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_extension_auto.cpp b/native/cocos/bindings/auto/jsb_extension_auto.cpp index bfe86b6258..90d8430b98 100644 --- a/native/cocos/bindings/auto/jsb_extension_auto.cpp +++ b/native/cocos/bindings/auto/jsb_extension_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_extension_auto.h b/native/cocos/bindings/auto/jsb_extension_auto.h index ab01628320..d15a95a10f 100644 --- a/native/cocos/bindings/auto/jsb_extension_auto.h +++ b/native/cocos/bindings/auto/jsb_extension_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_gfx_auto.cpp b/native/cocos/bindings/auto/jsb_gfx_auto.cpp index 716d36ecbb..08980e5a8c 100644 --- a/native/cocos/bindings/auto/jsb_gfx_auto.cpp +++ b/native/cocos/bindings/auto/jsb_gfx_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -26,7 +26,7 @@ #include "cocos/bindings/auto/jsb_gfx_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" -#include "renderer/core/Core.h" +#include "renderer/gfx-base/GFXBase.h" #ifndef JSB_ALLOC #define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) diff --git a/native/cocos/bindings/auto/jsb_gfx_auto.h b/native/cocos/bindings/auto/jsb_gfx_auto.h index c4de891a1b..a6660d034d 100644 --- a/native/cocos/bindings/auto/jsb_gfx_auto.h +++ b/native/cocos/bindings/auto/jsb_gfx_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -28,7 +28,7 @@ #include #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/renderer/core/Core.h" +#include "cocos/renderer/gfx-base/GFXBase.h" extern se::Object* __jsb_cc_gfx_Size_proto; extern se::Class* __jsb_cc_gfx_Size_class; diff --git a/native/cocos/bindings/auto/jsb_gles2_auto.cpp b/native/cocos/bindings/auto/jsb_gles2_auto.cpp index 17eee1cb1b..3f8b310fd1 100644 --- a/native/cocos/bindings/auto/jsb_gles2_auto.cpp +++ b/native/cocos/bindings/auto/jsb_gles2_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_gles2_auto.h b/native/cocos/bindings/auto/jsb_gles2_auto.h index 592905844f..4c309e74ca 100644 --- a/native/cocos/bindings/auto/jsb_gles2_auto.h +++ b/native/cocos/bindings/auto/jsb_gles2_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_gles3_auto.cpp b/native/cocos/bindings/auto/jsb_gles3_auto.cpp index 1e87257872..a8f0154cb4 100644 --- a/native/cocos/bindings/auto/jsb_gles3_auto.cpp +++ b/native/cocos/bindings/auto/jsb_gles3_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_gles3_auto.h b/native/cocos/bindings/auto/jsb_gles3_auto.h index edba2a5a9c..64f07379ba 100644 --- a/native/cocos/bindings/auto/jsb_gles3_auto.h +++ b/native/cocos/bindings/auto/jsb_gles3_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_mtl_auto.cpp b/native/cocos/bindings/auto/jsb_mtl_auto.cpp index 987fa41981..ce676c461e 100644 --- a/native/cocos/bindings/auto/jsb_mtl_auto.cpp +++ b/native/cocos/bindings/auto/jsb_mtl_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -110,20 +110,20 @@ static bool js_mtl_CCMTLDevice_getMTLLayer(se::State& s) } SE_BIND_FUNC(js_mtl_CCMTLDevice_getMTLLayer) -static bool js_mtl_CCMTLDevice_presentCompleted(se::State& s) +static bool js_mtl_CCMTLDevice_onPresentCompleted(se::State& s) { cc::gfx::CCMTLDevice* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_mtl_CCMTLDevice_presentCompleted : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_mtl_CCMTLDevice_onPresentCompleted : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); if (argc == 0) { - cobj->presentCompleted(); + cobj->onPresentCompleted(); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_FUNC(js_mtl_CCMTLDevice_presentCompleted) +SE_BIND_FUNC(js_mtl_CCMTLDevice_onPresentCompleted) SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_CCMTLDevice_finalize) @@ -161,7 +161,7 @@ bool js_register_mtl_CCMTLDevice(se::Object* obj) cls->defineFunction("getCurrentDrawable", _SE(js_mtl_CCMTLDevice_getCurrentDrawable)); cls->defineFunction("getDSSTexture", _SE(js_mtl_CCMTLDevice_getDSSTexture)); cls->defineFunction("getMTLLayer", _SE(js_mtl_CCMTLDevice_getMTLLayer)); - cls->defineFunction("presentCompleted", _SE(js_mtl_CCMTLDevice_presentCompleted)); + cls->defineFunction("onPresentCompleted", _SE(js_mtl_CCMTLDevice_onPresentCompleted)); cls->defineFinalizeFunction(_SE(js_cc_gfx_CCMTLDevice_finalize)); cls->install(); JSBClassType::registerClass(cls); diff --git a/native/cocos/bindings/auto/jsb_mtl_auto.h b/native/cocos/bindings/auto/jsb_mtl_auto.h index 3691287376..be0cecc60d 100644 --- a/native/cocos/bindings/auto/jsb_mtl_auto.h +++ b/native/cocos/bindings/auto/jsb_mtl_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -41,6 +41,6 @@ SE_DECLARE_FUNC(js_mtl_CCMTLDevice_disposeCurrentDrawable); SE_DECLARE_FUNC(js_mtl_CCMTLDevice_getCurrentDrawable); SE_DECLARE_FUNC(js_mtl_CCMTLDevice_getDSSTexture); SE_DECLARE_FUNC(js_mtl_CCMTLDevice_getMTLLayer); -SE_DECLARE_FUNC(js_mtl_CCMTLDevice_presentCompleted); +SE_DECLARE_FUNC(js_mtl_CCMTLDevice_onPresentCompleted); SE_DECLARE_FUNC(js_mtl_CCMTLDevice_CCMTLDevice); diff --git a/native/cocos/bindings/auto/jsb_network_auto.cpp b/native/cocos/bindings/auto/jsb_network_auto.cpp index c2b4684776..d2c909321c 100644 --- a/native/cocos/bindings/auto/jsb_network_auto.cpp +++ b/native/cocos/bindings/auto/jsb_network_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_network_auto.h b/native/cocos/bindings/auto/jsb_network_auto.h index 003704fbfb..50de010214 100644 --- a/native/cocos/bindings/auto/jsb_network_auto.h +++ b/native/cocos/bindings/auto/jsb_network_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_pipeline_auto.cpp b/native/cocos/bindings/auto/jsb_pipeline_auto.cpp index 84a0a34572..639988687b 100644 --- a/native/cocos/bindings/auto/jsb_pipeline_auto.cpp +++ b/native/cocos/bindings/auto/jsb_pipeline_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -43,8 +43,7 @@ #include "renderer/pipeline/deferred/LightingFlow.h" #include "renderer/pipeline/deferred/LightingStage.h" #include "renderer/pipeline/deferred/PostprocessStage.h" -#include "cocos/renderer/core/Core.h" -#include "cocos/renderer/core/gfx/GFXDescriptorSet.h" +#include "cocos/renderer/gfx-base/GFXBase.h" #ifndef JSB_ALLOC #define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) @@ -3206,10 +3205,9 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ShadowStage_finalize) static bool js_pipeline_ShadowStage_constructor(se::State& s) // constructor.c { - cc::pipeline::ShadowStage* cobj = JSB_ALLOC(cc::pipeline::ShadowStage); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; + //#3 cc::pipeline::ShadowStage: is_skip_construtor True + se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::pipeline::ShadowStage constructor is skipped\")"); + return false; } SE_BIND_CTOR(js_pipeline_ShadowStage_constructor, __jsb_cc_pipeline_ShadowStage_class, js_cc_pipeline_ShadowStage_finalize) diff --git a/native/cocos/bindings/auto/jsb_pipeline_auto.h b/native/cocos/bindings/auto/jsb_pipeline_auto.h index 76e5e46dcb..32ec6511a4 100644 --- a/native/cocos/bindings/auto/jsb_pipeline_auto.h +++ b/native/cocos/bindings/auto/jsb_pipeline_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_spine_auto.cpp b/native/cocos/bindings/auto/jsb_spine_auto.cpp index 758327c9c7..8e61f2b51b 100644 --- a/native/cocos/bindings/auto/jsb_spine_auto.cpp +++ b/native/cocos/bindings/auto/jsb_spine_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_spine_auto.h b/native/cocos/bindings/auto/jsb_spine_auto.h index 7fcabe7323..e757ada5b9 100644 --- a/native/cocos/bindings/auto/jsb_spine_auto.h +++ b/native/cocos/bindings/auto/jsb_spine_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_video_auto.cpp b/native/cocos/bindings/auto/jsb_video_auto.cpp index a4ee432322..ab87637de7 100644 --- a/native/cocos/bindings/auto/jsb_video_auto.cpp +++ b/native/cocos/bindings/auto/jsb_video_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_video_auto.h b/native/cocos/bindings/auto/jsb_video_auto.h index 1c71fa9b44..14f39b0034 100644 --- a/native/cocos/bindings/auto/jsb_video_auto.h +++ b/native/cocos/bindings/auto/jsb_video_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_vk_auto.cpp b/native/cocos/bindings/auto/jsb_vk_auto.cpp index 2eb3583820..cd7214bb37 100644 --- a/native/cocos/bindings/auto/jsb_vk_auto.cpp +++ b/native/cocos/bindings/auto/jsb_vk_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_vk_auto.h b/native/cocos/bindings/auto/jsb_vk_auto.h index c7f32df2c6..98fc6aa67b 100644 --- a/native/cocos/bindings/auto/jsb_vk_auto.h +++ b/native/cocos/bindings/auto/jsb_vk_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_webview_auto.cpp b/native/cocos/bindings/auto/jsb_webview_auto.cpp index 69c59b6039..c74dac9983 100644 --- a/native/cocos/bindings/auto/jsb_webview_auto.cpp +++ b/native/cocos/bindings/auto/jsb_webview_auto.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/auto/jsb_webview_auto.h b/native/cocos/bindings/auto/jsb_webview_auto.h index 580809f78d..586a70ad04 100644 --- a/native/cocos/bindings/auto/jsb_webview_auto.h +++ b/native/cocos/bindings/auto/jsb_webview_auto.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/dop/BufferAllocator.cpp b/native/cocos/bindings/dop/BufferAllocator.cpp index 9b827d8371..83b1953f89 100644 --- a/native/cocos/bindings/dop/BufferAllocator.cpp +++ b/native/cocos/bindings/dop/BufferAllocator.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/dop/BufferAllocator.h b/native/cocos/bindings/dop/BufferAllocator.h index 2710d9f0da..d6e1b9ea11 100644 --- a/native/cocos/bindings/dop/BufferAllocator.h +++ b/native/cocos/bindings/dop/BufferAllocator.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/dop/PoolType.h b/native/cocos/bindings/dop/PoolType.h index 97d7458a2a..d34a45e600 100644 --- a/native/cocos/bindings/dop/PoolType.h +++ b/native/cocos/bindings/dop/PoolType.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com diff --git a/native/cocos/bindings/manual/jsb_conversions.cpp b/native/cocos/bindings/manual/jsb_conversions.cpp index 13fe266dc9..e28e166f60 100644 --- a/native/cocos/bindings/manual/jsb_conversions.cpp +++ b/native/cocos/bindings/manual/jsb_conversions.cpp @@ -26,7 +26,7 @@ #include "jsb_conversions.h" #include "base/TypeDef.h" #include "math/Math.h" -#include "renderer/core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" #include #include diff --git a/native/cocos/bindings/manual/jsb_gfx_agent.cpp b/native/cocos/bindings/manual/jsb_gfx_agent.cpp index 714067ec5e..1b9436e9ec 100644 --- a/native/cocos/bindings/manual/jsb_gfx_agent.cpp +++ b/native/cocos/bindings/manual/jsb_gfx_agent.cpp @@ -26,7 +26,7 @@ #include "cocos/bindings/manual/jsb_gfx_agent.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" -#include "renderer/core/gfx-agent/GFXDeviceAgent.h" +#include "gfx-agent/GFXDeviceAgent.h" #ifndef JSB_ALLOC #define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) @@ -103,4 +103,3 @@ bool register_all_gfx_agent(se::Object* obj) js_register_gfx_agent_DeviceAgent(ns); return true; } - diff --git a/native/cocos/bindings/manual/jsb_gfx_agent.h b/native/cocos/bindings/manual/jsb_gfx_agent.h index 6e4c54016f..1bef9079e0 100644 --- a/native/cocos/bindings/manual/jsb_gfx_agent.h +++ b/native/cocos/bindings/manual/jsb_gfx_agent.h @@ -25,19 +25,19 @@ #pragma once #include "base/Config.h" -#include +#include "base/CoreStd.h" +#include "bindings/auto/jsb_gfx_auto.h" #include "bindings/jswrapper/SeApi.h" #include "bindings/manual/jsb_conversions.h" -#include "renderer/core/Core.h" -#include "bindings/auto/jsb_gfx_auto.h" -#include "renderer/core/gfx-agent/GFXDeviceAgent.h" +#include "gfx-agent/GFXDeviceAgent.h" +#include "gfx-base/GFXDef.h" +#include -extern se::Object* __jsb_cc_gfx_DeviceAgent_proto; -extern se::Class* __jsb_cc_gfx_DeviceAgent_class; +extern se::Object *__jsb_cc_gfx_DeviceAgent_proto; +extern se::Class * __jsb_cc_gfx_DeviceAgent_class; -bool js_register_cc_gfx_DeviceAgent(se::Object* obj); -bool register_all_gfx_agent(se::Object* obj); +bool js_register_cc_gfx_DeviceAgent(se::Object *obj); +bool register_all_gfx_agent(se::Object *obj); JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceAgent); SE_DECLARE_FUNC(js_gfx_agent_DeviceAgent_DeviceAgent); - diff --git a/native/cocos/bindings/manual/jsb_gfx_manual.cpp b/native/cocos/bindings/manual/jsb_gfx_manual.cpp index ab19d142b0..161ee45dce 100644 --- a/native/cocos/bindings/manual/jsb_gfx_manual.cpp +++ b/native/cocos/bindings/manual/jsb_gfx_manual.cpp @@ -35,22 +35,22 @@ #ifdef CC_USE_VULKAN #include "bindings/auto/jsb_vk_auto.h" - #include "renderer/gfx-vulkan/GFXVulkan.h" + #include "gfx-vulkan/GFXVulkan.h" #endif #ifdef CC_USE_METAL #include "bindings/auto/jsb_mtl_auto.h" - #include "renderer/gfx-metal/GFXMTL.h" + #include "gfx-metal/GFXMTL.h" #endif #ifdef CC_USE_GLES3 #include "bindings/auto/jsb_gles3_auto.h" - #include "renderer/gfx-gles3/GFXGLES3.h" + #include "gfx-gles3/GFXGLES3.h" #endif #ifdef CC_USE_GLES2 #include "bindings/auto/jsb_gles2_auto.h" - #include "renderer/gfx-gles2/GFXGLES2.h" + #include "gfx-gles2/GFXGLES2.h" #endif #include diff --git a/native/cocos/bindings/manual/jsb_global.cpp b/native/cocos/bindings/manual/jsb_global.cpp index f043f5a9a7..9f0ed19daf 100644 --- a/native/cocos/bindings/manual/jsb_global.cpp +++ b/native/cocos/bindings/manual/jsb_global.cpp @@ -24,45 +24,46 @@ ****************************************************************************/ #include "jsb_global.h" -#include "jsb_conversions.h" -#include "xxtea/xxtea.h" -#include "base/ZipUtils.h" +#include "base/CoreStd.h" #include "base/Scheduler.h" #include "base/ThreadPool.h" +#include "base/ZipUtils.h" #include "base/base64.h" +#include "gfx-base/GFXDef.h" +#include "jsb_conversions.h" #include "network/HttpClient.h" #include "platform/Application.h" #include "platform/Image.h" -#include "renderer/core/Core.h" #include "ui/edit-box/EditBox.h" +#include "xxtea/xxtea.h" #if CC_PLATFORM == CC_PLATFORM_ANDROID #include "platform/android/jni/JniImp.h" #endif -#include #include +#include #include using namespace cc; se::Object *__jsbObj = nullptr; -se::Object *__glObj = nullptr; +se::Object *__glObj = nullptr; -static ThreadPool *__threadPool = nullptr; +static LegacyThreadPool *__threadPool = nullptr; -static std::shared_ptr _localDownloader = nullptr; +static std::shared_ptr _localDownloader = nullptr; static std::map> _localDownloaderHandlers; -static uint64_t _localDownloaderTaskId = 1000000; -static std::string xxteaKey = ""; -void jsb_set_xxtea_key(const std::string &key) { +static uint64_t _localDownloaderTaskId = 1000000; +static std::string xxteaKey = ""; +void jsb_set_xxtea_key(const std::string &key) { xxteaKey = key; } static cc::network::Downloader *localDownloader() { if (!_localDownloader) { - _localDownloader = std::make_shared(); - _localDownloader->onDataTaskSuccess = [=](const cc::network::DownloadTask &task, + _localDownloader = std::make_shared(); + _localDownloader->onDataTaskSuccess = [=](const cc::network::DownloadTask & task, const std::vector &data) { if (data.empty()) { SE_REPORT_ERROR("Getting image from (%s) failed!", task.requestURL.c_str()); @@ -74,8 +75,8 @@ static cc::network::Downloader *localDownloader() { SE_REPORT_ERROR("Getting image from (%s), callback not found!!", task.requestURL.c_str()); return; } - size_t imageBytes = data.size(); - unsigned char *imageData = (unsigned char *)malloc(imageBytes); + size_t imageBytes = data.size(); + unsigned char *imageData = (unsigned char *)malloc(imageBytes); memcpy(imageData, data.data(), imageBytes); (callback->second)("", imageData, static_cast(imageBytes)); @@ -83,9 +84,9 @@ static cc::network::Downloader *localDownloader() { _localDownloaderHandlers.erase(callback); }; _localDownloader->onTaskError = [=](const cc::network::DownloadTask &task, - int errorCode, - int errorCodeInternal, - const std::string &errorStr) { + int errorCode, + int errorCodeInternal, + const std::string & errorStr) { SE_REPORT_ERROR("Getting image from (%s) failed!", task.requestURL.c_str()); _localDownloaderHandlers.erase(task.identifier); }; @@ -96,8 +97,8 @@ static cc::network::Downloader *localDownloader() { static void localDownloaderCreateTask(const std::string &url, std::function callback) { std::stringstream ss; ss << "jsb_loadimage_" << (_localDownloaderTaskId++); - std::string key = ss.str(); - auto task = localDownloader()->createDownloadDataTask(url, key); + std::string key = ss.str(); + auto task = localDownloader()->createDownloadDataTask(url, key); _localDownloaderHandlers.emplace(std::make_pair(task->identifier, callback)); } @@ -123,8 +124,8 @@ void jsb_init_file_operation_delegate() { if (FileUtils::getInstance()->isFileExist(byteCodePath)) { fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath); - size_t dataLen = 0; - uint8_t *data = xxtea_decrypt((unsigned char *)fileData.getBytes(), (uint32_t)fileData.getSize(), (unsigned char *)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), (uint32_t *)&dataLen); + size_t dataLen = 0; + uint8_t *data = xxtea_decrypt((unsigned char *)fileData.getBytes(), (uint32_t)fileData.getSize(), (unsigned char *)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), (uint32_t *)&dataLen); if (data == nullptr) { SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); @@ -133,7 +134,7 @@ void jsb_init_file_operation_delegate() { if (ZipUtils::isGZipBuffer(data, dataLen)) { uint8_t *unpackedData; - ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); + ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); if (unpackedData == nullptr) { SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); @@ -172,7 +173,7 @@ void jsb_init_file_operation_delegate() { if (ZipUtils::isGZipBuffer(data, dataLen)) { uint8_t *unpackedData; - ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); + ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); if (unpackedData == nullptr) { SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); return ""; @@ -239,7 +240,7 @@ bool jsb_enable_debugger(const std::string &debuggerServerAddr, uint32_t port, b bool jsb_set_extend_property(const char *ns, const char *clsName) { se::Object *globalObj = se::ScriptEngine::getInstance()->getGlobalObject(); - se::Value nsVal; + se::Value nsVal; if (globalObj->getProperty(ns, &nsVal) && nsVal.isObject()) { se::Value ccVal; if (globalObj->getProperty("cc", &ccVal) && ccVal.isObject()) { @@ -264,7 +265,7 @@ std::unordered_map __moduleCache; static bool require(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); assert(argc >= 1); assert(args[0].isString()); @@ -302,7 +303,7 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: secondPath += ".js"; } - fullPath = fileOperationDelegate.onGetFullPath(secondPath); + fullPath = fileOperationDelegate.onGetFullPath(secondPath); scriptBuffer = fileOperationDelegate.onGetStringFromFile(fullPath); } else { fullPath = fileOperationDelegate.onGetFullPath(pathWithSuffix); @@ -318,7 +319,7 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: std::string currentScriptFileDir = FileUtils::getInstance()->getFileDir(fullPath); // Add closure for evalutate the script - char prefix[] = "(function(currentScriptDir){ window.module = window.module || {}; var exports = window.module.exports = {}; "; + char prefix[] = "(function(currentScriptDir){ window.module = window.module || {}; var exports = window.module.exports = {}; "; char suffix[512] = {0}; snprintf(suffix, sizeof(suffix), "\nwindow.module.exports = window.module.exports || exports;\n})('%s'); ", currentScriptFileDir.c_str()); @@ -345,8 +346,8 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: // RENDERER_LOGD("Evaluate: %s", fullPath.c_str()); - auto se = se::ScriptEngine::getInstance(); - bool succeed = se->evalString(scriptBuffer.c_str(), scriptBuffer.length(), nullptr, reletivePath.c_str()); + auto se = se::ScriptEngine::getInstance(); + bool succeed = se->evalString(scriptBuffer.c_str(), scriptBuffer.length(), nullptr, reletivePath.c_str()); se::Value moduleVal; if (succeed && se->getGlobalObject()->getProperty("module", &moduleVal) && moduleVal.isObject()) { se::Value exportsVal; @@ -374,7 +375,7 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: static bool moduleRequire(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); assert(argc >= 2); assert(args[0].isString()); assert(args[1].isString()); @@ -404,7 +405,7 @@ static bool jsc_dumpNativePtrToSeObjectMap(se::State &s) { struct NamePtrStruct { const char *name; - void *ptr; + void * ptr; }; std::vector namePtrArray; @@ -414,12 +415,12 @@ static bool jsc_dumpNativePtrToSeObjectMap(se::State &s) { assert(jsobj->_getClass() != nullptr); NamePtrStruct tmp; tmp.name = jsobj->_getClass()->getName(); - tmp.ptr = e.first; + tmp.ptr = e.first; namePtrArray.push_back(tmp); } std::sort(namePtrArray.begin(), namePtrArray.end(), [](const NamePtrStruct &a, const NamePtrStruct &b) -> bool { - std::string left = a.name; + std::string left = a.name; std::string right = b.name; for (std::string::const_iterator lit = left.begin(), rit = right.begin(); lit != left.end() && rit != right.end(); ++lit, ++rit) if (::tolower(*lit) < ::tolower(*rit)) @@ -474,7 +475,7 @@ static bool JSBCore_os(se::State &s) { SE_BIND_FUNC(JSBCore_os) static bool JSBCore_getCurrentLanguage(se::State &s) { - std::string languageStr; + std::string languageStr; Application::LanguageType language = Application::getInstance()->getCurrentLanguage(); switch (language) { case Application::LanguageType::ENGLISH: @@ -566,7 +567,7 @@ SE_BIND_FUNC(JSB_core_restartVM) static bool JSB_isObjectValid(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); if (argc == 1) { void *nativePtr = nullptr; seval_to_native_ptr(args[0], &nativePtr); @@ -581,7 +582,7 @@ SE_BIND_FUNC(JSB_isObjectValid) static bool JSB_setCursorEnabled(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); SE_PRECONDITION2(argc == 1, false, "Invalid number of arguments"); bool ok = true, value = true; ok &= seval_to_boolean(args[0], &value); @@ -594,9 +595,9 @@ SE_BIND_FUNC(JSB_setCursorEnabled) static bool JSB_saveByteCode(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); SE_PRECONDITION2(argc == 2, false, "Invalid number of arguments"); - bool ok = true; + bool ok = true; std::string srcfile; std::string dstfile; ok &= seval_to_std_string(args[0], &srcfile); @@ -625,7 +626,7 @@ static bool getOrCreatePlainObject_r(const char *name, se::Object *parent, se::O } static bool js_performance_now(se::State &s) { - auto now = std::chrono::steady_clock::now(); + auto now = std::chrono::steady_clock::now(); auto micro = std::chrono::duration_cast(now - se::ScriptEngine::getInstance()->getStartTime()).count(); s.rval().setNumber((double)micro * 0.001); return true; @@ -634,19 +635,19 @@ SE_BIND_FUNC(js_performance_now) namespace { struct ImageInfo { - uint32_t length = 0; - uint32_t width = 0; - uint32_t height = 0; - uint8_t *data = nullptr; - cc::gfx::Format format = cc::gfx::Format::UNKNOWN; - bool hasAlpha = false; - bool compressed = false; + uint32_t length = 0; + uint32_t width = 0; + uint32_t height = 0; + uint8_t * data = nullptr; + cc::gfx::Format format = cc::gfx::Format::UNKNOWN; + bool hasAlpha = false; + bool compressed = false; }; uint8_t *convertRGB2RGBA(uint32_t length, uint8_t *src) { uint8_t *dst = reinterpret_cast(malloc(length)); for (uint32_t i = 0; i < length; i += 4) { - dst[i] = *src++; + dst[i] = *src++; dst[i + 1] = *src++; dst[i + 2] = *src++; dst[i + 3] = 255; @@ -657,7 +658,7 @@ uint8_t *convertRGB2RGBA(uint32_t length, uint8_t *src) { uint8_t *convertIA2RGBA(uint32_t length, uint8_t *src) { uint8_t *dst = reinterpret_cast(malloc(length)); for (uint32_t i = 0; i < length; i += 4) { - dst[i] = *src; + dst[i] = *src; dst[i + 1] = *src; dst[i + 2] = *src++; dst[i + 3] = *src++; @@ -668,7 +669,7 @@ uint8_t *convertIA2RGBA(uint32_t length, uint8_t *src) { uint8_t *convertI2RGBA(uint32_t length, uint8_t *src) { uint8_t *dst = reinterpret_cast(malloc(length)); for (uint32_t i = 0; i < length; i += 4) { - dst[i] = *src; + dst[i] = *src; dst[i + 1] = *src; dst[i + 2] = *src++; dst[i + 3] = 255; @@ -678,11 +679,11 @@ uint8_t *convertI2RGBA(uint32_t length, uint8_t *src) { struct ImageInfo *createImageInfo(Image *img) { struct ImageInfo *imgInfo = new struct ImageInfo(); - imgInfo->length = (uint32_t)img->getDataLen(); - imgInfo->width = img->getWidth(); - imgInfo->height = img->getHeight(); + imgInfo->length = (uint32_t)img->getDataLen(); + imgInfo->width = img->getWidth(); + imgInfo->height = img->getHeight(); img->takeData(&imgInfo->data); - imgInfo->format = img->getRenderFormat(); + imgInfo->format = img->getRenderFormat(); imgInfo->compressed = img->isCompressed(); // Convert to RGBA888 because standard web api will return only RGBA888. @@ -692,9 +693,9 @@ struct ImageInfo *createImageInfo(Image *img) { // format, or it will cause 0x502 error on OpenGL ES 2. if (!imgInfo->compressed && imgInfo->format != cc::gfx::Format::RGBA8) { imgInfo->length = img->getWidth() * img->getHeight() * 4; - uint8_t *dst = nullptr; + uint8_t *dst = nullptr; uint32_t length = imgInfo->length; - uint8_t *src = imgInfo->data; + uint8_t *src = imgInfo->data; switch (imgInfo->format) { case cc::gfx::Format::A8: case cc::gfx::Format::LA8: @@ -714,7 +715,7 @@ struct ImageInfo *createImageInfo(Image *img) { } if (dst != imgInfo->data) free(imgInfo->data); - imgInfo->data = dst; + imgInfo->data = dst; imgInfo->hasAlpha = true; } @@ -755,8 +756,8 @@ bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal Application::getInstance()->getScheduler()->performFunctionInCocosThread([=]() { se::AutoHandleScope hs; - se::ValueArray seArgs; - se::Value dataVal; + se::ValueArray seArgs; + se::Value dataVal; if (loadSucceed) { se::HandleObject retObj(se::Object::createPlainObject()); @@ -781,12 +782,12 @@ bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal localDownloaderCreateTask(path, initImageFunc); } else if (path.find("data:") == 0 && (pos = path.find("base64,")) != std::string::npos) { - int imageBytes = 0; - unsigned char *imageData = nullptr; - size_t dataStartPos = pos + strlen("base64,"); - const char *base64Data = path.data() + dataStartPos; - size_t dataLen = path.length() - dataStartPos; - imageBytes = base64Decode((const unsigned char *)base64Data, (unsigned int)dataLen, &imageData); + int imageBytes = 0; + unsigned char *imageData = nullptr; + size_t dataStartPos = pos + strlen("base64,"); + const char * base64Data = path.data() + dataStartPos; + size_t dataLen = path.length() - dataStartPos; + imageBytes = base64Decode((const unsigned char *)base64Data, (unsigned int)dataLen, &imageData); if (imageBytes <= 0 || imageData == nullptr) { SE_REPORT_ERROR("Decode base64 image data failed!"); return false; @@ -807,9 +808,9 @@ bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal } static bool js_loadImage(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc == 2) { std::string path; ok &= seval_to_std_string(args[0], &path); @@ -827,9 +828,9 @@ static bool js_loadImage(se::State &s) { SE_BIND_FUNC(js_loadImage) static bool js_destroyImage(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc == 1) { unsigned long data = 0; ok &= seval_to_ulong(args[0], &data); @@ -844,9 +845,9 @@ static bool js_destroyImage(se::State &s) { SE_BIND_FUNC(js_destroyImage) static bool JSB_openURL(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc > 0) { std::string url; ok = seval_to_std_string(args[0], &url); @@ -861,9 +862,9 @@ static bool JSB_openURL(se::State &s) { SE_BIND_FUNC(JSB_openURL) static bool JSB_copyTextToClipboard(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc > 0) { std::string text; ok = seval_to_std_string(args[0], &text); @@ -878,9 +879,9 @@ static bool JSB_copyTextToClipboard(se::State &s) { SE_BIND_FUNC(JSB_copyTextToClipboard) static bool JSB_setPreferredFramesPerSecond(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc > 0) { int32_t fps; ok = seval_to_int32(args[0], &fps); @@ -898,10 +899,10 @@ SE_BIND_FUNC(JSB_setPreferredFramesPerSecond) #if CC_USE_EDITBOX static bool JSB_showInputBox(se::State &s) { const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 1) { - bool ok; - se::Value tmp; + bool ok; + se::Value tmp; const auto &obj = args[0].toObject(); cc::EditBox::ShowInfo showInfo; @@ -979,7 +980,7 @@ SE_BIND_FUNC(JSB_hideInputBox) #endif bool jsb_register_global_variables(se::Object *global) { - __threadPool = ThreadPool::newFixedThreadPool(3); + __threadPool = LegacyThreadPool::newFixedThreadPool(3); global->defineFunction("require", _SE(require)); global->defineFunction("requireModule", _SE(moduleRequire)); diff --git a/native/cocos/bindings/manual/jsb_global.h b/native/cocos/bindings/manual/jsb_global.h index 2be2730994..c2e4596f37 100644 --- a/native/cocos/bindings/manual/jsb_global.h +++ b/native/cocos/bindings/manual/jsb_global.h @@ -26,7 +26,7 @@ #pragma once #include "base/memory/Memory.h" -#include "renderer/core/CoreStd.h" +#include "base/CoreStd.h" #include #include #include diff --git a/native/cocos/bindings/manual/jsb_pipeline_manual.cpp b/native/cocos/bindings/manual/jsb_pipeline_manual.cpp index f296baf5c4..2db7174dec 100644 --- a/native/cocos/bindings/manual/jsb_pipeline_manual.cpp +++ b/native/cocos/bindings/manual/jsb_pipeline_manual.cpp @@ -28,7 +28,7 @@ #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" -#include "renderer/core/gfx/GFXPipelineState.h" +#include "gfx-base/GFXPipelineState.h" #include "renderer/pipeline/Define.h" #include "renderer/pipeline/PipelineStateManager.h" #include "renderer/pipeline/RenderPipeline.h" diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp index 97933e7db8..452d3b1964 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp @@ -29,7 +29,7 @@ #include "base/TypeDef.h" #include "base/memory/Memory.h" #include "math/Math.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" using namespace cc; using namespace cc::gfx; diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp index 684f5d3568..6f756de34a 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp @@ -29,7 +29,7 @@ #include "dragonbones-creator-support/CCSlot.h" #include "math/Math.h" #include "math/Vec3.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" USING_NS_MW; using namespace cc; diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp index a0979c52b2..02aff79ab9 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp @@ -34,7 +34,7 @@ #include "base/TypeDef.h" #include "base/memory/Memory.h" #include "math/Math.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" USING_NS_MW; diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp index 7aa5a5ca59..4fa960efe7 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp @@ -35,7 +35,7 @@ #include "base/memory/Memory.h" #include "math/Math.h" #include "math/Vec3.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" #include "spine-creator-support/AttachmentVertices.h" #include "spine-creator-support/spine-cocos2dx.h" #include diff --git a/native/cocos/platform/Image.cpp b/native/cocos/platform/Image.cpp index 6f31e542a3..a486c98741 100644 --- a/native/cocos/platform/Image.cpp +++ b/native/cocos/platform/Image.cpp @@ -36,7 +36,8 @@ #include "base/Data.h" #include "base/Utils.h" -#include "renderer/core/Core.h" +#include "base/CoreStd.h" +#include "gfx-base/GFXDef.h" extern "C" { #if CC_USE_PNG diff --git a/native/cocos/renderer/CMakeLists.txt b/native/cocos/renderer/CMakeLists.txt deleted file mode 100644 index e44ec0af16..0000000000 --- a/native/cocos/renderer/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -add_subdirectory(core) - -if(COCOS_PLATFORM_WIN32) - add_subdirectory(gfx-gles-common) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-vulkan) -elseif(COCOS_PLATFORM_IOS) - add_subdirectory(gfx-gles-common) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-metal) - add_subdirectory(gfx-vulkan) -elseif(COCOS_PLATFORM_OSX) - add_subdirectory(gfx-gles-common) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-metal) - add_subdirectory(gfx-vulkan) -elseif(COCOS_PLATFORM_ANDROID) - add_subdirectory(gfx-gles-common) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-vulkan) -endif() diff --git a/native/cocos/renderer/core/CMakeLists.txt b/native/cocos/renderer/core/CMakeLists.txt deleted file mode 100644 index 5bfba1e729..0000000000 --- a/native/cocos/renderer/core/CMakeLists.txt +++ /dev/null @@ -1,177 +0,0 @@ -set(TARGET_NAME Core) - -message(STATUS "Target: ${TARGET_NAME}...") - -# --------------------------------------------- -# set cocos base files - -set(CC_BASE_HEADERS - ${COCOS_SRC_PATH}/base/TypeDef.h - ${COCOS_SRC_PATH}/base/Log.h - ${COCOS_SRC_PATH}/base/Object.h - ${COCOS_SRC_PATH}/base/memory/Memory.h - ${COCOS_SRC_PATH}/math/Math.h -) - -set(CC_BASE_SOURCES - ${COCOS_SRC_PATH}/base/Log.cpp - ${COCOS_SRC_PATH}/base/memory/Memory.cpp - ${COCOS_SRC_PATH}/math/Math.cpp -) - -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/nedmalloc - ${GFX_EXTERNAL_PATH}/tommyds - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${GFX_EXTERNAL_PATH}/taskflow - ${GFX_EXTERNAL_PATH}/tbb/include - ${COCOS_SRC_PATH}/base - ${COCOS_SRC_PATH}/renderer/core -) - -if(COCOS_PLATFORM_WIN32) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/jemalloc/include-win) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/jemalloc/include-win/msvc_compat) -else() - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/jemalloc/include-linux) -endif() - -include_directories( ${INCLUDE_FILES} ) - -if(COCOS_PLATFORM_WIN32) -link_libraries( - glu32.lib - opengl32.lib -) -endif() - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h *.hpp) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) -if(COCOS_PLATFORM_IOS) - file(GLOB_RECURSE SOURCE_MM_FILES *.mm) - file(GLOB_RECURSE SOURCE_M_FILES *.m) -endif() - -macro(GROUP_FILES src_files out_del_files) - set(del_files " ") - set(cur_dir ${CMAKE_CURRENT_SOURCE_DIR}) - foreach(src_file ${${src_files}}) - string(REGEX REPLACE ${cur_dir}/\(.*\) \\1 sgbd_fpath ${src_file}) - string(REGEX REPLACE "\(.*\)/.*" \\1 sgbd_group_name ${sgbd_fpath}) - string(COMPARE EQUAL ${sgbd_fpath} ${sgbd_group_name} sgbd_nogroup) - - string(REPLACE "\\" "/" sgbd_group_name ${sgbd_group_name}) - - if(sgbd_nogroup) - set(sgbd_group_name "/") - endif(sgbd_nogroup) - - set(SRC_OK TRUE) - if(src_file MATCHES ".*Win32/.*") - if(NOT COCOS_PLATFORM_WIN32) - set(SRC_OK FALSE) - endif() - elseif(src_file MATCHES ".*Android/.*") - if(NOT COCOS_PLATFORM_ANDROID) - set(SRC_OK FALSE) - endif() - elseif(src_file MATCHES ".*iOS/.*") - if(NOT COCOS_PLATFORM_IOS) - set(SRC_OK FALSE) - endif() - endif() - - if(SRC_OK) - #if(${COCOS_PLATFORM_WIN32}) - string(REPLACE "/" "\\" sgbd_group_name ${sgbd_group_name}) - #endif() - source_group(${sgbd_group_name} FILES ${src_file}) - else() - set(del_files ${del_files} ${src_file}) - endif() - - endforeach(src_file) - - set(${out_del_files} ${del_files}) -endmacro(GROUP_FILES) - -set(ALL_FILES - ${CC_BASE_HEADERS} - ${CC_BASE_SOURCES} - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} -) -if(COCOS_PLATFORM_IOS) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) - set(ALL_FILES ${ALL_FILES} ${SOURCE_M_FILES}) -endif() - -GROUP_FILES(ALL_FILES DEL_FILES) - -foreach(del_file ${DEL_FILES}) - list(REMOVE_ITEM ALL_FILES ${del_file}) - list(REMOVE_ITEM SOURCE_CPP_FILES ${del_file}) - list(REMOVE_ITEM SOURCE_C_FILES ${del_file}) - list(REMOVE_ITEM HEADER_FILES ${del_file}) -endforeach(del_file) - -# --------------------------------------------------------------------- - -add_definitions("-DCC_CORE_EXPORTS") -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${CC_BASE_HEADERS} ${CC_BASE_SOURCES} ${HEADER_FILES} ${SOURCE_CPP_FILES} ${SOURCE_C_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${CC_BASE_HEADERS} ${CC_BASE_SOURCES} ${HEADER_FILES} ${SOURCE_CPP_FILES} ${SOURCE_C_FILES}) -endif() - -if (COCOS_PLATFORM_WIN32) - target_link_libraries(${TARGET_NAME} ${COCOS_EXTERNAL_TARGETS} Winmm.lib) -else() - target_link_libraries(${TARGET_NAME} ${COCOS_EXTERNAL_TARGETS}) -endif() -target_link_libraries(${TARGET_NAME} TBBJobSystem TFJobSystem Threading) -target_compile_definitions(${TARGET_NAME} PRIVATE ${CC_EXTERNAL_PRIVATE_DEFINITIONS}) - -if(MSVC) - set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS") - target_compile_options(${TARGET_NAME} PUBLIC /MP) - target_link_directories(${TARGET_NAME} PUBLIC ${COCOS_EXTERNAL_PATH}/win32/libs) -endif() - -set(COCOS_EXTERNAL_INCLUDE_PATH) -if(COCOS_PLATFORM_WIN32) - set(COCOS_EXTERNAL_INCLUDE_PATH ${COCOS_EXTERNAL_INCLUDE_PATH} ${COCOS_EXTERNAL_PATH}/win32/include) -elseif(COCOS_PLATFORM_IOS) - # set(COCOS_EXTERNAL_INCLUDE_PATH ${COCOS_EXTERNAL_PATH}/ios/include) -endif() - - -target_include_directories(${TARGET_NAME} PUBLIC - ${COCOS_SRC_PATH}/renderer - ${COCOS_SRC_PATH} - ${COCOS_SRC_PATH}/.. - ${COCOS_SRC_PATH}/base - ${COCOS_EXTERNAL_INCLUDE_PATH} -) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCCore) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCCore_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/CoreStd.h" "${CMAKE_CURRENT_SOURCE_DIR}/CoreStd.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/core/gfx-agent/GFXAgent.h b/native/cocos/renderer/gfx-agent/GFXAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXAgent.h rename to native/cocos/renderer/gfx-agent/GFXAgent.h index c945896d7d..78578b9823 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXAgent.h @@ -23,36 +23,37 @@ THE SOFTWARE. ****************************************************************************/ -#pragma once - -#include - -namespace cc { -namespace gfx { - -template -class CC_DLL Agent : public Actor { -public: - Agent() noexcept = delete; - - Agent(Actor *const actor, Device *const device) noexcept - : Actor(device), _actor(actor) {} - - ~Agent() override {} - - Agent(Agent const &) = delete; - - Agent(Agent &&) = delete; - - Agent &operator=(Agent const &) = delete; - - Agent &operator=(Agent &&) = delete; - - inline Actor *getActor() const noexcept { return _actor; } - -protected: - Actor *_actor{nullptr}; -}; - -} // namespace gfx -} // namespace cc +#pragma once + +#include +#include "gfx-base/GFXDevice.h" + +namespace cc { +namespace gfx { + +template +class CC_DLL Agent : public Actor { +public: + Agent() noexcept = delete; + + Agent(Actor *const actor, Device *const device) noexcept + : Actor(device), _actor(actor) {} + + ~Agent() override {} + + Agent(Agent const &) = delete; + + Agent(Agent &&) = delete; + + Agent &operator=(Agent const &) = delete; + + Agent &operator=(Agent &&) = delete; + + inline Actor *getActor() const noexcept { return _actor; } + +protected: + Actor *_actor{nullptr}; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/core/gfx-agent/GFXBufferAgent.cpp b/native/cocos/renderer/gfx-agent/GFXBufferAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXBufferAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXBufferAgent.cpp index 51454efcc2..60c7a54f69 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXBufferAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXBufferAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXBufferAgent.h" #include "GFXDeviceAgent.h" #include "GFXLinearAllocatorPool.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXBufferAgent.h b/native/cocos/renderer/gfx-agent/GFXBufferAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXBufferAgent.h rename to native/cocos/renderer/gfx-agent/GFXBufferAgent.h index fc5d466718..d20071be72 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXBufferAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXBufferAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXBuffer.h" +#include "gfx-base/GFXBuffer.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.cpp b/native/cocos/renderer/gfx-agent/GFXCommandBufferAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXCommandBufferAgent.cpp index 6ccca93bac..bbb63e5e28 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXCommandBufferAgent.cpp @@ -23,7 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "base/threading/MessageQueue.h" +#include "base/job-system/JobSystem.h" #include "GFXBufferAgent.h" #include "GFXCommandBufferAgent.h" @@ -36,8 +38,6 @@ #include "GFXQueueAgent.h" #include "GFXRenderPassAgent.h" #include "GFXTextureAgent.h" -#include "base/job-system/JobSystem.h" -#include "base/threading/MessageQueue.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.h b/native/cocos/renderer/gfx-agent/GFXCommandBufferAgent.h similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.h rename to native/cocos/renderer/gfx-agent/GFXCommandBufferAgent.h index 14508ee995..2b993839fd 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXCommandBufferAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXCommandBufferAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.cpp b/native/cocos/renderer/gfx-agent/GFXDescriptorSetAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXDescriptorSetAgent.cpp index 4cdaf46583..7b9b6ad132 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXDescriptorSetAgent.cpp @@ -23,7 +23,8 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "base/threading/MessageQueue.h" #include "GFXBufferAgent.h" #include "GFXDescriptorSetAgent.h" @@ -31,7 +32,6 @@ #include "GFXDeviceAgent.h" #include "GFXSamplerAgent.h" #include "GFXTextureAgent.h" -#include "base/threading/MessageQueue.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.h b/native/cocos/renderer/gfx-agent/GFXDescriptorSetAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.h rename to native/cocos/renderer/gfx-agent/GFXDescriptorSetAgent.h index 440d94d6f6..3fd75cc7c2 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXDescriptorSetAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXDescriptorSet.h" +#include "gfx-base/GFXDescriptorSet.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.cpp b/native/cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.cpp index fccbd3aef8..d965919fd2 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXDeviceAgent.h" #include "GFXDescriptorSetLayoutAgent.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.h b/native/cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.h similarity index 97% rename from native/cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.h rename to native/cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.h index 575afd3924..bfc9cbdc0c 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXDescriptorSetLayoutAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXDescriptorSetLayoutAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXDescriptorSetLayout.h" +#include "gfx-base/GFXDescriptorSetLayout.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXDeviceAgent.cpp b/native/cocos/renderer/gfx-agent/GFXDeviceAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXDeviceAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXDeviceAgent.cpp index e4aa5c5896..e20a03b812 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXDeviceAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXDeviceAgent.cpp @@ -23,7 +23,8 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "base/threading/MessageQueue.h" #include "GFXBufferAgent.h" #include "GFXCommandBufferAgent.h" @@ -40,7 +41,6 @@ #include "GFXSamplerAgent.h" #include "GFXShaderAgent.h" #include "GFXTextureAgent.h" -#include "base/threading/MessageQueue.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXDeviceAgent.h b/native/cocos/renderer/gfx-agent/GFXDeviceAgent.h similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXDeviceAgent.h rename to native/cocos/renderer/gfx-agent/GFXDeviceAgent.h index f4b5fa5607..a8d0936651 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXDeviceAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXDeviceAgent.h @@ -25,7 +25,7 @@ #pragma once -#include "../gfx/GFXDevice.h" +#include "gfx-base/GFXDevice.h" #include "GFXAgent.h" #include "base/threading/Semaphore.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXFramebufferAgent.cpp b/native/cocos/renderer/gfx-agent/GFXFramebufferAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXFramebufferAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXFramebufferAgent.cpp index d244fadce9..fbb1ac454a 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXFramebufferAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXFramebufferAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXDeviceAgent.h" #include "GFXFramebufferAgent.h" #include "GFXRenderPassAgent.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXFramebufferAgent.h b/native/cocos/renderer/gfx-agent/GFXFramebufferAgent.h similarity index 97% rename from native/cocos/renderer/core/gfx-agent/GFXFramebufferAgent.h rename to native/cocos/renderer/gfx-agent/GFXFramebufferAgent.h index aeb3931a33..fba9bc69a7 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXFramebufferAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXFramebufferAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXFramebuffer.h" +#include "gfx-base/GFXFramebuffer.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.cpp b/native/cocos/renderer/gfx-agent/GFXInputAssemblerAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXInputAssemblerAgent.cpp index ca2a5d3474..3c86ec9a7c 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXInputAssemblerAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXBufferAgent.h" #include "GFXDeviceAgent.h" #include "GFXInputAssemblerAgent.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.h b/native/cocos/renderer/gfx-agent/GFXInputAssemblerAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.h rename to native/cocos/renderer/gfx-agent/GFXInputAssemblerAgent.h index 50ffb27f17..6443694e0b 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXInputAssemblerAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXInputAssemblerAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXInputAssembler.h" +#include "gfx-base/GFXInputAssembler.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXLinearAllocatorPool.h b/native/cocos/renderer/gfx-agent/GFXLinearAllocatorPool.h similarity index 100% rename from native/cocos/renderer/core/gfx-agent/GFXLinearAllocatorPool.h rename to native/cocos/renderer/gfx-agent/GFXLinearAllocatorPool.h diff --git a/native/cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.cpp b/native/cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.cpp index 27020b23f9..1b6d856c97 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXDescriptorSetLayoutAgent.h" #include "GFXDeviceAgent.h" #include "GFXPipelineLayoutAgent.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.h b/native/cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.h similarity index 97% rename from native/cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.h rename to native/cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.h index 67c5a47f5c..ad17b7cfe4 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXPipelineLayoutAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXPipelineLayoutAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXPipelineLayout.h" +#include "gfx-base/GFXPipelineLayout.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.cpp b/native/cocos/renderer/gfx-agent/GFXPipelineStateAgent.cpp similarity index 99% rename from native/cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXPipelineStateAgent.cpp index e98ce30c2e..7536ea8ef8 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXPipelineStateAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXDeviceAgent.h" #include "GFXPipelineLayoutAgent.h" #include "GFXPipelineStateAgent.h" diff --git a/native/cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.h b/native/cocos/renderer/gfx-agent/GFXPipelineStateAgent.h similarity index 97% rename from native/cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.h rename to native/cocos/renderer/gfx-agent/GFXPipelineStateAgent.h index 16bb32b0de..cab709f257 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXPipelineStateAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXPipelineStateAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXPipelineState.h" +#include "gfx-base/GFXPipelineState.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXQueueAgent.cpp b/native/cocos/renderer/gfx-agent/GFXQueueAgent.cpp similarity index 94% rename from native/cocos/renderer/core/gfx-agent/GFXQueueAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXQueueAgent.cpp index acd7453d03..5b295b932a 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXQueueAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXQueueAgent.cpp @@ -23,14 +23,14 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "base/job-system/JobSystem.h" +#include "base/threading/MessageQueue.h" #include "GFXCommandBufferAgent.h" #include "GFXDeviceAgent.h" #include "GFXLinearAllocatorPool.h" #include "GFXQueueAgent.h" -#include "base/job-system/JobSystem.h" -#include "base/threading/MessageQueue.h" namespace cc { namespace gfx { @@ -73,8 +73,8 @@ void QueueAgent::destroy() { void QueueAgent::submit(CommandBuffer *const *cmdBuffs, uint count) { if (!count) return; - LinearAllocatorPool *allocator = ((DeviceAgent *)_device)->getMainAllocator(); - CommandBuffer **actorCmdBuffs = allocator->allocate(count); + LinearAllocatorPool *allocator = ((DeviceAgent *)_device)->getMainAllocator(); + CommandBuffer ** actorCmdBuffs = allocator->allocate(count); for (uint i = 0u; i < count; ++i) { actorCmdBuffs[i] = ((CommandBufferAgent *)cmdBuffs[i])->getActor(); } diff --git a/native/cocos/renderer/core/gfx-agent/GFXQueueAgent.h b/native/cocos/renderer/gfx-agent/GFXQueueAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXQueueAgent.h rename to native/cocos/renderer/gfx-agent/GFXQueueAgent.h index 44048fa5d4..7290f1d9c8 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXQueueAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXQueueAgent.h @@ -25,7 +25,7 @@ #pragma once -#include "../gfx/GFXQueue.h" +#include "gfx-base/GFXQueue.h" #include "GFXAgent.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx-agent/GFXRenderPassAgent.cpp b/native/cocos/renderer/gfx-agent/GFXRenderPassAgent.cpp similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXRenderPassAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXRenderPassAgent.cpp index 295bb6674c..b49d7d0f1a 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXRenderPassAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXRenderPassAgent.cpp @@ -23,11 +23,11 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "base/threading/MessageQueue.h" #include "GFXDeviceAgent.h" #include "GFXRenderPassAgent.h" -#include "base/threading/MessageQueue.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXRenderPassAgent.h b/native/cocos/renderer/gfx-agent/GFXRenderPassAgent.h similarity index 97% rename from native/cocos/renderer/core/gfx-agent/GFXRenderPassAgent.h rename to native/cocos/renderer/gfx-agent/GFXRenderPassAgent.h index 2a182e9fb9..e306cefd5c 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXRenderPassAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXRenderPassAgent.h @@ -25,7 +25,7 @@ #pragma once -#include "../gfx/GFXRenderPass.h" +#include "gfx-base/GFXRenderPass.h" #include "GFXAgent.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx-agent/GFXSamplerAgent.cpp b/native/cocos/renderer/gfx-agent/GFXSamplerAgent.cpp similarity index 86% rename from native/cocos/renderer/core/gfx-agent/GFXSamplerAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXSamplerAgent.cpp index 98218767e4..6ca1d15a86 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXSamplerAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXSamplerAgent.cpp @@ -23,9 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" + #include "GFXDescriptorSetLayoutAgent.h" #include "GFXDeviceAgent.h" #include "GFXSamplerAgent.h" @@ -45,16 +45,16 @@ SamplerAgent::~SamplerAgent() { bool SamplerAgent::initialize(const SamplerInfo &info) { - _minFilter = info.minFilter; - _magFilter = info.magFilter; - _mipFilter = info.mipFilter; - _addressU = info.addressU; - _addressV = info.addressV; - _addressW = info.addressW; + _minFilter = info.minFilter; + _magFilter = info.magFilter; + _mipFilter = info.mipFilter; + _addressU = info.addressU; + _addressV = info.addressV; + _addressW = info.addressW; _maxAnisotropy = info.maxAnisotropy; - _cmpFunc = info.cmpFunc; - _borderColor = info.borderColor; - _mipLODBias = info.mipLODBias; + _cmpFunc = info.cmpFunc; + _borderColor = info.borderColor; + _mipLODBias = info.mipLODBias; ENQUEUE_MESSAGE_2( ((DeviceAgent *)_device)->getMessageQueue(), diff --git a/native/cocos/renderer/core/gfx-agent/GFXSamplerAgent.h b/native/cocos/renderer/gfx-agent/GFXSamplerAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXSamplerAgent.h rename to native/cocos/renderer/gfx-agent/GFXSamplerAgent.h index 997b614b80..e630a4c89f 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXSamplerAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXSamplerAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXSampler.h" +#include "gfx-base/GFXSampler.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXShaderAgent.cpp b/native/cocos/renderer/gfx-agent/GFXShaderAgent.cpp similarity index 86% rename from native/cocos/renderer/core/gfx-agent/GFXShaderAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXShaderAgent.cpp index 95d14e83d1..e5b1dad4d7 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXShaderAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXShaderAgent.cpp @@ -23,11 +23,11 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "base/threading/MessageQueue.h" #include "GFXDeviceAgent.h" #include "GFXShaderAgent.h" -#include "base/threading/MessageQueue.h" namespace cc { namespace gfx { @@ -43,16 +43,16 @@ ShaderAgent::~ShaderAgent() { } bool ShaderAgent::initialize(const ShaderInfo &info) { - _name = info.name; - _stages = info.stages; - _attributes = info.attributes; - _blocks = info.blocks; - _buffers = info.buffers; + _name = info.name; + _stages = info.stages; + _attributes = info.attributes; + _blocks = info.blocks; + _buffers = info.buffers; _samplerTextures = info.samplerTextures; - _samplers = info.samplers; - _textures = info.textures; - _images = info.images; - _subpassInputs = info.subpassInputs; + _samplers = info.samplers; + _textures = info.textures; + _images = info.images; + _subpassInputs = info.subpassInputs; ENQUEUE_MESSAGE_2( ((DeviceAgent *)_device)->getMessageQueue(), diff --git a/native/cocos/renderer/core/gfx-agent/GFXShaderAgent.h b/native/cocos/renderer/gfx-agent/GFXShaderAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXShaderAgent.h rename to native/cocos/renderer/gfx-agent/GFXShaderAgent.h index 6a2eb507ef..955bf48640 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXShaderAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXShaderAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXShader.h" +#include "gfx-base/GFXShader.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx-agent/GFXTextureAgent.cpp b/native/cocos/renderer/gfx-agent/GFXTextureAgent.cpp similarity index 75% rename from native/cocos/renderer/core/gfx-agent/GFXTextureAgent.cpp rename to native/cocos/renderer/gfx-agent/GFXTextureAgent.cpp index 57e044b53a..112be7f0d5 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXTextureAgent.cpp +++ b/native/cocos/renderer/gfx-agent/GFXTextureAgent.cpp @@ -23,11 +23,11 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" - +#include "base/CoreStd.h" #include "base/threading/MessageQueue.h" -#include "GFXTextureAgent.h" + #include "GFXDeviceAgent.h" +#include "GFXTextureAgent.h" namespace cc { namespace gfx { @@ -43,20 +43,20 @@ TextureAgent::~TextureAgent() { } bool TextureAgent::initialize(const TextureInfo &info) { - _type = info.type; - _usage = info.usage; - _format = info.format; - _width = info.width; - _height = info.height; - _depth = info.depth; + _type = info.type; + _usage = info.usage; + _format = info.format; + _width = info.width; + _height = info.height; + _depth = info.depth; _layerCount = info.layerCount; _levelCount = info.levelCount; - _samples = info.samples; - _flags = info.flags; - _size = FormatSize(_format, _width, _height, _depth); + _samples = info.samples; + _flags = info.flags; + _size = FormatSize(_format, _width, _height, _depth); ENQUEUE_MESSAGE_2( - ((DeviceAgent*)_device)->getMessageQueue(), + ((DeviceAgent *)_device)->getMessageQueue(), TextureInit, actor, getActor(), info, info, @@ -74,22 +74,22 @@ bool TextureAgent::initialize(const TextureViewInfo &info) { return false; } - _type = info.texture->getType(); - _format = info.format; - _baseLayer = info.baseLayer; + _type = info.texture->getType(); + _format = info.format; + _baseLayer = info.baseLayer; _layerCount = info.layerCount; - _baseLevel = info.baseLevel; + _baseLevel = info.baseLevel; _levelCount = info.levelCount; - _usage = info.texture->getUsage(); - _width = info.texture->getWidth(); - _height = info.texture->getHeight(); - _depth = info.texture->getDepth(); - _samples = info.texture->getSamples(); - _flags = info.texture->getFlags(); - _size = FormatSize(_format, _width, _height, _depth); + _usage = info.texture->getUsage(); + _width = info.texture->getWidth(); + _height = info.texture->getHeight(); + _depth = info.texture->getDepth(); + _samples = info.texture->getSamples(); + _flags = info.texture->getFlags(); + _size = FormatSize(_format, _width, _height, _depth); ENQUEUE_MESSAGE_2( - ((DeviceAgent*)_device)->getMessageQueue(), + ((DeviceAgent *)_device)->getMessageQueue(), TextureViewInit, actor, getActor(), info, info, @@ -112,7 +112,7 @@ void TextureAgent::destroy() { void TextureAgent::resize(uint width, uint height) { ENQUEUE_MESSAGE_3( - ((DeviceAgent*)_device)->getMessageQueue(), + ((DeviceAgent *)_device)->getMessageQueue(), TextureResize, actor, getActor(), width, width, diff --git a/native/cocos/renderer/core/gfx-agent/GFXTextureAgent.h b/native/cocos/renderer/gfx-agent/GFXTextureAgent.h similarity index 98% rename from native/cocos/renderer/core/gfx-agent/GFXTextureAgent.h rename to native/cocos/renderer/gfx-agent/GFXTextureAgent.h index b820f0ec0a..66aaf69157 100644 --- a/native/cocos/renderer/core/gfx-agent/GFXTextureAgent.h +++ b/native/cocos/renderer/gfx-agent/GFXTextureAgent.h @@ -26,7 +26,7 @@ #pragma once #include "GFXAgent.h" -#include "../gfx/GFXTexture.h" +#include "gfx-base/GFXTexture.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/Core.h b/native/cocos/renderer/gfx-base/GFXBase.h similarity index 69% rename from native/cocos/renderer/core/Core.h rename to native/cocos/renderer/gfx-base/GFXBase.h index 05e537e644..794be08aa9 100644 --- a/native/cocos/renderer/core/Core.h +++ b/native/cocos/renderer/gfx-base/GFXBase.h @@ -25,25 +25,20 @@ #pragma once -#include "CoreStd.h" - -#include "base/CachedArray.h" -#include "base/StringUtil.h" - -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXContext.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDescriptorSetLayout.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXGlobalBarrier.h" -#include "gfx/GFXTextureBarrier.h" -#include "gfx/GFXInputAssembler.h" -#include "gfx/GFXPipelineLayout.h" -#include "gfx/GFXPipelineState.h" -#include "gfx/GFXQueue.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXSampler.h" -#include "gfx/GFXShader.h" -#include "gfx/GFXTexture.h" +#include "GFXBuffer.h" +#include "GFXCommandBuffer.h" +#include "GFXContext.h" +#include "GFXDescriptorSet.h" +#include "GFXDescriptorSetLayout.h" +#include "GFXDevice.h" +#include "GFXFramebuffer.h" +#include "GFXGlobalBarrier.h" +#include "GFXInputAssembler.h" +#include "GFXPipelineLayout.h" +#include "GFXPipelineState.h" +#include "GFXQueue.h" +#include "GFXRenderPass.h" +#include "GFXSampler.h" +#include "GFXShader.h" +#include "GFXTexture.h" +#include "GFXTextureBarrier.h" diff --git a/native/cocos/renderer/core/gfx/GFXBuffer.cpp b/native/cocos/renderer/gfx-base/GFXBuffer.cpp old mode 100755 new mode 100644 similarity index 93% rename from native/cocos/renderer/core/gfx/GFXBuffer.cpp rename to native/cocos/renderer/gfx-base/GFXBuffer.cpp index e281bb6f26..373dcb9e38 --- a/native/cocos/renderer/core/gfx/GFXBuffer.cpp +++ b/native/cocos/renderer/gfx-base/GFXBuffer.cpp @@ -23,15 +23,17 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXBuffer.h" +#include "GFXObject.h" namespace cc { namespace gfx { Buffer::Buffer(Device *device) -: GFXObject(ObjectType::BUFFER), _device(device) { +: GFXObject(ObjectType::BUFFER), + _device(device) { } Buffer::~Buffer() { diff --git a/native/cocos/renderer/core/gfx/GFXBuffer.h b/native/cocos/renderer/gfx-base/GFXBuffer.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXBuffer.h rename to native/cocos/renderer/gfx-base/GFXBuffer.h index de0f08ddbc..fc5244f0db --- a/native/cocos/renderer/core/gfx/GFXBuffer.h +++ b/native/cocos/renderer/gfx-base/GFXBuffer.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_BUFFER_H_ #define CC_CORE_GFX_BUFFER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXCommandBuffer.cpp b/native/cocos/renderer/gfx-base/GFXCommandBuffer.cpp old mode 100755 new mode 100644 similarity index 93% rename from native/cocos/renderer/core/gfx/GFXCommandBuffer.cpp rename to native/cocos/renderer/gfx-base/GFXCommandBuffer.cpp index f712805159..fba6440ae1 --- a/native/cocos/renderer/core/gfx/GFXCommandBuffer.cpp +++ b/native/cocos/renderer/gfx-base/GFXCommandBuffer.cpp @@ -23,15 +23,17 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXCommandBuffer.h" +#include "GFXObject.h" namespace cc { namespace gfx { CommandBuffer::CommandBuffer(Device *device) -: GFXObject(ObjectType::COMMAND_BUFFER), _device(device) { +: GFXObject(ObjectType::COMMAND_BUFFER), + _device(device) { } CommandBuffer::~CommandBuffer() { diff --git a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h b/native/cocos/renderer/gfx-base/GFXCommandBuffer.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXCommandBuffer.h rename to native/cocos/renderer/gfx-base/GFXCommandBuffer.h index a5c10ee624..1b11946363 --- a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h +++ b/native/cocos/renderer/gfx-base/GFXCommandBuffer.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_COMMAND_BUFFER_H_ #define CC_CORE_GFX_COMMAND_BUFFER_H_ -#include "GFXDef.h" +#include "GFXObject.h" #include "GFXBuffer.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx/GFXContext.cpp b/native/cocos/renderer/gfx-base/GFXContext.cpp old mode 100755 new mode 100644 similarity index 98% rename from native/cocos/renderer/core/gfx/GFXContext.cpp rename to native/cocos/renderer/gfx-base/GFXContext.cpp index 868aca0a6f..fc2e307d3f --- a/native/cocos/renderer/core/gfx/GFXContext.cpp +++ b/native/cocos/renderer/gfx-base/GFXContext.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXContext.h" diff --git a/native/cocos/renderer/core/gfx/GFXContext.h b/native/cocos/renderer/gfx-base/GFXContext.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXContext.h rename to native/cocos/renderer/gfx-base/GFXContext.h index 23628b65a7..3755b2602b --- a/native/cocos/renderer/core/gfx/GFXContext.h +++ b/native/cocos/renderer/gfx-base/GFXContext.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_CONTEXT_H_ #define CC_CORE_GFX_CONTEXT_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXDef-common.h b/native/cocos/renderer/gfx-base/GFXDef-common.h similarity index 96% rename from native/cocos/renderer/core/gfx/GFXDef-common.h rename to native/cocos/renderer/gfx-base/GFXDef-common.h index 4c9a2c4195..cd7ed1b016 100644 --- a/native/cocos/renderer/core/gfx/GFXDef-common.h +++ b/native/cocos/renderer/gfx-base/GFXDef-common.h @@ -26,6 +26,10 @@ #ifndef CC_CORE_GFX_DEF_COMMON_H_ #define CC_CORE_GFX_DEF_COMMON_H_ +#include "base/TypeDef.h" +#include "base/memory/Memory.h" +#include "math/Math.h" + /** * This file should be synced with engine/cocos/core/gfx/base/define.ts * every time changes being made, by manually running: @@ -68,8 +72,8 @@ class Window; class Context; using TextureBarrierList = vector; -using BufferDataList = vector; -using CommandBufferList = vector; +using BufferDataList = vector; +using CommandBufferList = vector; #define GFX_MAX_ATTACHMENTS 4 #define GFX_INVALID_BINDING ((uint)-1) @@ -849,7 +853,7 @@ using ColorList = vector; struct BindingMappingInfo { std::vector bufferOffsets; std::vector samplerOffsets; - uint flexibleSet = 0u; + uint flexibleSet = 0u; }; struct BufferInfo { @@ -1045,10 +1049,10 @@ struct InputAssemblerInfo { }; struct ColorAttachment { - Format format = Format::UNKNOWN; - SampleCount sampleCount = SampleCount::X1; - LoadOp loadOp = LoadOp::CLEAR; - StoreOp storeOp = StoreOp::STORE; + Format format = Format::UNKNOWN; + SampleCount sampleCount = SampleCount::X1; + LoadOp loadOp = LoadOp::CLEAR; + StoreOp storeOp = StoreOp::STORE; std::vector beginAccesses; std::vector endAccesses{AccessType::PRESENT}; }; @@ -1056,12 +1060,12 @@ struct ColorAttachment { using ColorAttachmentList = vector; struct DepthStencilAttachment { - Format format = Format::UNKNOWN; - SampleCount sampleCount = SampleCount::X1; - LoadOp depthLoadOp = LoadOp::CLEAR; - StoreOp depthStoreOp = StoreOp::STORE; - LoadOp stencilLoadOp = LoadOp::CLEAR; - StoreOp stencilStoreOp = StoreOp::STORE; + Format format = Format::UNKNOWN; + SampleCount sampleCount = SampleCount::X1; + LoadOp depthLoadOp = LoadOp::CLEAR; + StoreOp depthStoreOp = StoreOp::STORE; + LoadOp stencilLoadOp = LoadOp::CLEAR; + StoreOp stencilStoreOp = StoreOp::STORE; std::vector beginAccesses; std::vector endAccesses{AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE}; }; @@ -1071,7 +1075,7 @@ struct SubpassInfo { std::vector colors; std::vector resolves; std::vector preserves; - uint depthStencil = GFX_INVALID_BINDING; + uint depthStencil = GFX_INVALID_BINDING; }; using SubpassInfoList = vector; @@ -1100,11 +1104,11 @@ struct TextureBarrierInfo { using TextureBarrierInfoList = vector; struct FramebufferInfo { - RenderPass * renderPass = nullptr; - TextureList colorTextures; // @ts-overrides { type: '(Texture | null)[]' } - Texture * depthStencilTexture = nullptr; // @ts-nullable + RenderPass * renderPass = nullptr; + TextureList colorTextures; // @ts-overrides { type: '(Texture | null)[]' } + Texture * depthStencilTexture = nullptr; // @ts-nullable std::vector colorMipmapLevels; - uint depthStencilMipmapLevel = 0; + uint depthStencilMipmapLevel = 0; }; struct DescriptorSetLayoutBinding { diff --git a/native/cocos/renderer/core/gfx/GFXDef.cpp b/native/cocos/renderer/gfx-base/GFXDef.cpp similarity index 99% rename from native/cocos/renderer/core/gfx/GFXDef.cpp rename to native/cocos/renderer/gfx-base/GFXDef.cpp index aea04101aa..674b171416 100644 --- a/native/cocos/renderer/core/gfx/GFXDef.cpp +++ b/native/cocos/renderer/gfx-base/GFXDef.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXDef.h" diff --git a/native/cocos/renderer/core/gfx/GFXDef.h b/native/cocos/renderer/gfx-base/GFXDef.h similarity index 100% rename from native/cocos/renderer/core/gfx/GFXDef.h rename to native/cocos/renderer/gfx-base/GFXDef.h diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSet.cpp b/native/cocos/renderer/gfx-base/GFXDescriptorSet.cpp similarity index 86% rename from native/cocos/renderer/core/gfx/GFXDescriptorSet.cpp rename to native/cocos/renderer/gfx-base/GFXDescriptorSet.cpp index e0910b246a..48f8f3d48b 100644 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSet.cpp +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSet.cpp @@ -23,24 +23,26 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXDescriptorSet.h" #include "GFXDescriptorSetLayout.h" +#include "GFXObject.h" namespace cc { namespace gfx { DescriptorSet::DescriptorSet(Device *device) -: GFXObject(ObjectType::DESCRIPTOR_SET), _device(device) { +: GFXObject(ObjectType::DESCRIPTOR_SET), + _device(device) { } DescriptorSet::~DescriptorSet() { } void DescriptorSet::bindBuffer(uint binding, Buffer *buffer, uint index) { - const vector &bindingIndices = _layout->getBindingIndices(); - const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); + const vector & bindingIndices = _layout->getBindingIndices(); + const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); if (binding >= bindingIndices.size() || bindingIndices[binding] >= bindings.size()) return; const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; @@ -48,7 +50,7 @@ void DescriptorSet::bindBuffer(uint binding, Buffer *buffer, uint index) { const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; if (_buffers[descriptorIndex + index] != buffer) { _buffers[descriptorIndex + index] = buffer; - _isDirty = true; + _isDirty = true; } } else { CCASSERT(false, "Setting binding is not DESCRIPTOR_BUFFER_TYPE."); @@ -56,8 +58,8 @@ void DescriptorSet::bindBuffer(uint binding, Buffer *buffer, uint index) { } void DescriptorSet::bindTexture(uint binding, Texture *texture, uint index) { - const vector &bindingIndices = _layout->getBindingIndices(); - const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); + const vector & bindingIndices = _layout->getBindingIndices(); + const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); if (binding >= bindingIndices.size() || bindingIndices[binding] >= bindings.size()) return; const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; @@ -65,7 +67,7 @@ void DescriptorSet::bindTexture(uint binding, Texture *texture, uint index) { const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; if (_textures[descriptorIndex + index] != texture) { _textures[descriptorIndex + index] = texture; - _isDirty = true; + _isDirty = true; } } else { CCASSERT(false, "Setting binding is not DESCRIPTOR_TEXTURE_TYPE."); @@ -73,8 +75,8 @@ void DescriptorSet::bindTexture(uint binding, Texture *texture, uint index) { } void DescriptorSet::bindSampler(uint binding, Sampler *sampler, uint index) { - const vector &bindingIndices = _layout->getBindingIndices(); - const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); + const vector & bindingIndices = _layout->getBindingIndices(); + const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); if (binding >= bindingIndices.size() || bindingIndices[binding] >= bindings.size()) return; const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; @@ -82,7 +84,7 @@ void DescriptorSet::bindSampler(uint binding, Sampler *sampler, uint index) { const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; if (_samplers[descriptorIndex + index] != sampler) { _samplers[descriptorIndex + index] = sampler; - _isDirty = true; + _isDirty = true; } } else { CCASSERT(false, "Setting binding is not DESCRIPTOR_TEXTURE_TYPE."); diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSet.h b/native/cocos/renderer/gfx-base/GFXDescriptorSet.h similarity index 99% rename from native/cocos/renderer/core/gfx/GFXDescriptorSet.h rename to native/cocos/renderer/gfx-base/GFXDescriptorSet.h index 9f95155276..aff044ebb5 100644 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSet.h +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSet.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_DESCRIPTOR_SET_H_ #define CC_CORE_GFX_DESCRIPTOR_SET_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp similarity index 97% rename from native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp rename to native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp index aa31afa593..8202345d37 100644 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp @@ -23,7 +23,8 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "GFXObject.h" +#include "base/CoreStd.h" #include "GFXDescriptorSetLayout.h" diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.h b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.h similarity index 99% rename from native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.h rename to native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.h index 4cea28462f..2aa3738e5f 100644 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_DESCRIPTOR_SET_LAYOUT_H_ #define CC_CORE_GFX_DESCRIPTOR_SET_LAYOUT_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXDevice.cpp b/native/cocos/renderer/gfx-base/GFXDevice.cpp old mode 100755 new mode 100644 similarity index 98% rename from native/cocos/renderer/core/gfx/GFXDevice.cpp rename to native/cocos/renderer/gfx-base/GFXDevice.cpp index aa64e587d5..e31825d2b4 --- a/native/cocos/renderer/core/gfx/GFXDevice.cpp +++ b/native/cocos/renderer/gfx-base/GFXDevice.cpp @@ -23,10 +23,11 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXContext.h" #include "GFXDevice.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXDevice.h b/native/cocos/renderer/gfx-base/GFXDevice.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXDevice.h rename to native/cocos/renderer/gfx-base/GFXDevice.h index ccbe912078..066d85a1f4 --- a/native/cocos/renderer/core/gfx/GFXDevice.h +++ b/native/cocos/renderer/gfx-base/GFXDevice.h @@ -28,7 +28,7 @@ #include "GFXBuffer.h" #include "GFXCommandBuffer.h" -#include "GFXDef.h" +#include "GFXObject.h" #include "GFXDescriptorSet.h" #include "GFXDescriptorSetLayout.h" #include "GFXFramebuffer.h" diff --git a/native/cocos/renderer/core/gfx/GFXFramebuffer.cpp b/native/cocos/renderer/gfx-base/GFXFramebuffer.cpp old mode 100755 new mode 100644 similarity index 93% rename from native/cocos/renderer/core/gfx/GFXFramebuffer.cpp rename to native/cocos/renderer/gfx-base/GFXFramebuffer.cpp index 6ebac8a42a..25f92d50d1 --- a/native/cocos/renderer/core/gfx/GFXFramebuffer.cpp +++ b/native/cocos/renderer/gfx-base/GFXFramebuffer.cpp @@ -23,15 +23,17 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXFramebuffer.h" +#include "GFXObject.h" namespace cc { namespace gfx { Framebuffer::Framebuffer(Device *device) -: GFXObject(ObjectType::FRAMEBUFFER), _device(device) { +: GFXObject(ObjectType::FRAMEBUFFER), + _device(device) { } Framebuffer::~Framebuffer() { diff --git a/native/cocos/renderer/core/gfx/GFXFramebuffer.h b/native/cocos/renderer/gfx-base/GFXFramebuffer.h old mode 100755 new mode 100644 similarity index 98% rename from native/cocos/renderer/core/gfx/GFXFramebuffer.h rename to native/cocos/renderer/gfx-base/GFXFramebuffer.h index 19f6a52e74..62ba7b5166 --- a/native/cocos/renderer/core/gfx/GFXFramebuffer.h +++ b/native/cocos/renderer/gfx-base/GFXFramebuffer.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_FRAME_BUFFER_H_ #define CC_CORE_GFX_FRAME_BUFFER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXGlobalBarrier.cpp b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.cpp similarity index 91% rename from native/cocos/renderer/core/gfx/GFXGlobalBarrier.cpp rename to native/cocos/renderer/gfx-base/GFXGlobalBarrier.cpp index 35d683fd24..986c21ed4b 100644 --- a/native/cocos/renderer/core/gfx/GFXGlobalBarrier.cpp +++ b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.cpp @@ -23,21 +23,23 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXGlobalBarrier.h" +#include "GFXObject.h" namespace cc { namespace gfx { GlobalBarrier::GlobalBarrier(Device *device) -: GFXObject(ObjectType::GLOBAL_BARRIER), _device(device) { +: GFXObject(ObjectType::GLOBAL_BARRIER), + _device(device) { } GlobalBarrier::~GlobalBarrier() { } -uint GlobalBarrier::computeHash(const GlobalBarrierInfo& info) { +uint GlobalBarrier::computeHash(const GlobalBarrierInfo &info) { uint seed = info.prevAccesses.size() + info.nextAccesses.size(); for (const AccessType type : info.prevAccesses) { diff --git a/native/cocos/renderer/core/gfx/GFXGlobalBarrier.h b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.h similarity index 98% rename from native/cocos/renderer/core/gfx/GFXGlobalBarrier.h rename to native/cocos/renderer/gfx-base/GFXGlobalBarrier.h index 3def23259d..aef7af4168 100644 --- a/native/cocos/renderer/core/gfx/GFXGlobalBarrier.h +++ b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_GLOBAL_BARRIER_H_ #define CC_CORE_GFX_GLOBAL_BARRIER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXInputAssembler.cpp b/native/cocos/renderer/gfx-base/GFXInputAssembler.cpp old mode 100755 new mode 100644 similarity index 98% rename from native/cocos/renderer/core/gfx/GFXInputAssembler.cpp rename to native/cocos/renderer/gfx-base/GFXInputAssembler.cpp index 30294fa15f..c83b27995d --- a/native/cocos/renderer/core/gfx/GFXInputAssembler.cpp +++ b/native/cocos/renderer/gfx-base/GFXInputAssembler.cpp @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXInputAssembler.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx/GFXInputAssembler.h b/native/cocos/renderer/gfx-base/GFXInputAssembler.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXInputAssembler.h rename to native/cocos/renderer/gfx-base/GFXInputAssembler.h index 09f58decee..bfba8e9146 --- a/native/cocos/renderer/core/gfx/GFXInputAssembler.h +++ b/native/cocos/renderer/gfx-base/GFXInputAssembler.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_INPUT_ASSEMBLER_H_ #define CC_CORE_GFX_INPUT_ASSEMBLER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXObject.cpp b/native/cocos/renderer/gfx-base/GFXObject.cpp similarity index 98% rename from native/cocos/renderer/core/gfx/GFXObject.cpp rename to native/cocos/renderer/gfx-base/GFXObject.cpp index dce7a7b3f7..05aaf6d17f 100644 --- a/native/cocos/renderer/core/gfx/GFXObject.cpp +++ b/native/cocos/renderer/gfx-base/GFXObject.cpp @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXObject.h" diff --git a/native/cocos/renderer/core/gfx/GFXObject.h b/native/cocos/renderer/gfx-base/GFXObject.h similarity index 98% rename from native/cocos/renderer/core/gfx/GFXObject.h rename to native/cocos/renderer/gfx-base/GFXObject.h index fb26581976..1fa16a845b 100644 --- a/native/cocos/renderer/core/gfx/GFXObject.h +++ b/native/cocos/renderer/gfx-base/GFXObject.h @@ -26,6 +26,7 @@ #pragma once #include "GFXDef.h" +#include "base/Object.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXPipelineLayout.cpp b/native/cocos/renderer/gfx-base/GFXPipelineLayout.cpp similarity index 93% rename from native/cocos/renderer/core/gfx/GFXPipelineLayout.cpp rename to native/cocos/renderer/gfx-base/GFXPipelineLayout.cpp index 5eb3d90948..7f2af5ddb9 100644 --- a/native/cocos/renderer/core/gfx/GFXPipelineLayout.cpp +++ b/native/cocos/renderer/gfx-base/GFXPipelineLayout.cpp @@ -23,15 +23,17 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXPipelineLayout.h" namespace cc { namespace gfx { PipelineLayout::PipelineLayout(Device *device) -: GFXObject(ObjectType::PIPELINE_LAYOUT), _device(device) { +: GFXObject(ObjectType::PIPELINE_LAYOUT), + _device(device) { } PipelineLayout::~PipelineLayout() { diff --git a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h b/native/cocos/renderer/gfx-base/GFXPipelineLayout.h similarity index 98% rename from native/cocos/renderer/core/gfx/GFXPipelineLayout.h rename to native/cocos/renderer/gfx-base/GFXPipelineLayout.h index 5ad17a7a7e..8a3f74b6d5 100644 --- a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h +++ b/native/cocos/renderer/gfx-base/GFXPipelineLayout.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_PIPELINE_LAYOUT_H_ #define CC_CORE_GFX_PIPELINE_LAYOUT_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXPipelineState.cpp b/native/cocos/renderer/gfx-base/GFXPipelineState.cpp old mode 100755 new mode 100644 similarity index 97% rename from native/cocos/renderer/core/gfx/GFXPipelineState.cpp rename to native/cocos/renderer/gfx-base/GFXPipelineState.cpp index 71ce53c4e2..7d58e89977 --- a/native/cocos/renderer/core/gfx/GFXPipelineState.cpp +++ b/native/cocos/renderer/gfx-base/GFXPipelineState.cpp @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXPipelineState.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx/GFXPipelineState.h b/native/cocos/renderer/gfx-base/GFXPipelineState.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXPipelineState.h rename to native/cocos/renderer/gfx-base/GFXPipelineState.h index 5fdfe9370f..b00d4d791e --- a/native/cocos/renderer/core/gfx/GFXPipelineState.h +++ b/native/cocos/renderer/gfx-base/GFXPipelineState.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_PIPELINE_STATE_H_ #define CC_CORE_GFX_PIPELINE_STATE_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXQueue.cpp b/native/cocos/renderer/gfx-base/GFXQueue.cpp old mode 100755 new mode 100644 similarity index 93% rename from native/cocos/renderer/core/gfx/GFXQueue.cpp rename to native/cocos/renderer/gfx-base/GFXQueue.cpp index 8a101bc156..f23e09c162 --- a/native/cocos/renderer/core/gfx/GFXQueue.cpp +++ b/native/cocos/renderer/gfx-base/GFXQueue.cpp @@ -23,15 +23,17 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXQueue.h" namespace cc { namespace gfx { Queue::Queue(Device *device) -: GFXObject(ObjectType::QUEUE), _device(device) { +: GFXObject(ObjectType::QUEUE), + _device(device) { } Queue::~Queue() { diff --git a/native/cocos/renderer/core/gfx/GFXQueue.h b/native/cocos/renderer/gfx-base/GFXQueue.h old mode 100755 new mode 100644 similarity index 98% rename from native/cocos/renderer/core/gfx/GFXQueue.h rename to native/cocos/renderer/gfx-base/GFXQueue.h index c07e2d8ed3..aec12a43b6 --- a/native/cocos/renderer/core/gfx/GFXQueue.h +++ b/native/cocos/renderer/gfx-base/GFXQueue.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_QUEUE_H_ #define CC_CORE_GFX_QUEUE_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXRenderPass.cpp b/native/cocos/renderer/gfx-base/GFXRenderPass.cpp old mode 100755 new mode 100644 similarity index 98% rename from native/cocos/renderer/core/gfx/GFXRenderPass.cpp rename to native/cocos/renderer/gfx-base/GFXRenderPass.cpp index bae7871317..a375e74066 --- a/native/cocos/renderer/core/gfx/GFXRenderPass.cpp +++ b/native/cocos/renderer/gfx-base/GFXRenderPass.cpp @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXRenderPass.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx/GFXRenderPass.h b/native/cocos/renderer/gfx-base/GFXRenderPass.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXRenderPass.h rename to native/cocos/renderer/gfx-base/GFXRenderPass.h index b4fe5789f2..e58fc86c53 --- a/native/cocos/renderer/core/gfx/GFXRenderPass.h +++ b/native/cocos/renderer/gfx-base/GFXRenderPass.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_RENDER_PASS_H_ #define CC_CORE_GFX_RENDER_PASS_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXSampler.cpp b/native/cocos/renderer/gfx-base/GFXSampler.cpp old mode 100755 new mode 100644 similarity index 97% rename from native/cocos/renderer/core/gfx/GFXSampler.cpp rename to native/cocos/renderer/gfx-base/GFXSampler.cpp index 12feeb377a..ca078ef5a5 --- a/native/cocos/renderer/core/gfx/GFXSampler.cpp +++ b/native/cocos/renderer/gfx-base/GFXSampler.cpp @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXSampler.h" namespace cc { diff --git a/native/cocos/renderer/core/gfx/GFXSampler.h b/native/cocos/renderer/gfx-base/GFXSampler.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXSampler.h rename to native/cocos/renderer/gfx-base/GFXSampler.h index be735ee546..2019ee5f31 --- a/native/cocos/renderer/core/gfx/GFXSampler.h +++ b/native/cocos/renderer/gfx-base/GFXSampler.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_SAMPLER_H_ #define CC_CORE_GFX_SAMPLER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXShader.cpp b/native/cocos/renderer/gfx-base/GFXShader.cpp old mode 100755 new mode 100644 similarity index 93% rename from native/cocos/renderer/core/gfx/GFXShader.cpp rename to native/cocos/renderer/gfx-base/GFXShader.cpp index 641c1dc9ac..d6d6fe31d5 --- a/native/cocos/renderer/core/gfx/GFXShader.cpp +++ b/native/cocos/renderer/gfx-base/GFXShader.cpp @@ -23,16 +23,18 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" #include "GFXDevice.h" +#include "GFXObject.h" #include "GFXShader.h" namespace cc { namespace gfx { Shader::Shader(Device *device) -: GFXObject(ObjectType::SHADER), _device(device) { +: GFXObject(ObjectType::SHADER), + _device(device) { _shaderID = device->genShaderId(); } diff --git a/native/cocos/renderer/core/gfx/GFXShader.h b/native/cocos/renderer/gfx-base/GFXShader.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXShader.h rename to native/cocos/renderer/gfx-base/GFXShader.h index 7ddce73100..ca108d6334 --- a/native/cocos/renderer/core/gfx/GFXShader.h +++ b/native/cocos/renderer/gfx-base/GFXShader.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_SHADER_H_ #define CC_CORE_GFX_SHADER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXTexture.cpp b/native/cocos/renderer/gfx-base/GFXTexture.cpp old mode 100755 new mode 100644 similarity index 93% rename from native/cocos/renderer/core/gfx/GFXTexture.cpp rename to native/cocos/renderer/gfx-base/GFXTexture.cpp index ba7fa8f804..7984fa2173 --- a/native/cocos/renderer/core/gfx/GFXTexture.cpp +++ b/native/cocos/renderer/gfx-base/GFXTexture.cpp @@ -23,15 +23,17 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXTexture.h" namespace cc { namespace gfx { Texture::Texture(Device *device) -: GFXObject(ObjectType::TEXTURE), _device(device) { +: GFXObject(ObjectType::TEXTURE), + _device(device) { } Texture::~Texture() { diff --git a/native/cocos/renderer/core/gfx/GFXTexture.h b/native/cocos/renderer/gfx-base/GFXTexture.h old mode 100755 new mode 100644 similarity index 99% rename from native/cocos/renderer/core/gfx/GFXTexture.h rename to native/cocos/renderer/gfx-base/GFXTexture.h index 1376a74052..b7edeff232 --- a/native/cocos/renderer/core/gfx/GFXTexture.h +++ b/native/cocos/renderer/gfx-base/GFXTexture.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_TEXTURE_H_ #define CC_CORE_GFX_TEXTURE_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/core/gfx/GFXTextureBarrier.cpp b/native/cocos/renderer/gfx-base/GFXTextureBarrier.cpp similarity index 95% rename from native/cocos/renderer/core/gfx/GFXTextureBarrier.cpp rename to native/cocos/renderer/gfx-base/GFXTextureBarrier.cpp index aa455b6225..0900587e03 100644 --- a/native/cocos/renderer/core/gfx/GFXTextureBarrier.cpp +++ b/native/cocos/renderer/gfx-base/GFXTextureBarrier.cpp @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#include "CoreStd.h" +#include "base/CoreStd.h" +#include "GFXObject.h" #include "GFXQueue.h" #include "GFXTextureBarrier.h" @@ -32,7 +33,8 @@ namespace cc { namespace gfx { TextureBarrier::TextureBarrier(Device *device) -: GFXObject(ObjectType::TEXTURE_BARRIER), _device(device) { +: GFXObject(ObjectType::TEXTURE_BARRIER), + _device(device) { } TextureBarrier::~TextureBarrier() { diff --git a/native/cocos/renderer/core/gfx/GFXTextureBarrier.h b/native/cocos/renderer/gfx-base/GFXTextureBarrier.h similarity index 98% rename from native/cocos/renderer/core/gfx/GFXTextureBarrier.h rename to native/cocos/renderer/gfx-base/GFXTextureBarrier.h index 73b8f2adce..bbeaea276d 100644 --- a/native/cocos/renderer/core/gfx/GFXTextureBarrier.h +++ b/native/cocos/renderer/gfx-base/GFXTextureBarrier.h @@ -26,7 +26,7 @@ #ifndef CC_CORE_GFX_TEXTURE_BARRIER_H_ #define CC_CORE_GFX_TEXTURE_BARRIER_H_ -#include "GFXDef.h" +#include "GFXObject.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles-common/CMakeLists.txt b/native/cocos/renderer/gfx-gles-common/CMakeLists.txt deleted file mode 100644 index db9bf651aa..0000000000 --- a/native/cocos/renderer/gfx-gles-common/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -set(TARGET_NAME GFXGLESCommon) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ) - -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXGLESCommon) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXGLESCommon_d) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-gles-common/GLESCommandPool.h b/native/cocos/renderer/gfx-gles-common/GLESCommandPool.h index e29e7145a8..af0a9e39d0 100644 --- a/native/cocos/renderer/gfx-gles-common/GLESCommandPool.h +++ b/native/cocos/renderer/gfx-gles-common/GLESCommandPool.h @@ -25,6 +25,8 @@ #pragma once +#include "base/CachedArray.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/CMakeLists.txt b/native/cocos/renderer/gfx-gles2/CMakeLists.txt deleted file mode 100644 index dcef66daf3..0000000000 --- a/native/cocos/renderer/gfx-gles2/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -set(TARGET_NAME GFXGLES2) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src/mesa - ${GFX_EXTERNAL_PATH}/taskflow - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-gles2 -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles2/GLES2Wrangler.cpp") -else() - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles2/GLES2Wrangler.mm") -endif() - -if(COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles2/GLES2Context.mm") -endif() - -add_definitions("-DCC_GLES2_EXPORTS") -if(WIN32) - add_definitions("-DGLEW_BUILD") -endif() -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME} Core GFXGLESCommon) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXGLES2) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXGLES2_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/GLES2Std.h" "${CMAKE_CURRENT_SOURCE_DIR}/GLES2Std.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp b/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp index 7c4ebae2c3..f85e2ccad1 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp @@ -25,6 +25,7 @@ #include "GLES2Std.h" +#include "GLES2Device.h" #include "GLES2Buffer.h" #include "GLES2Commands.h" diff --git a/native/cocos/renderer/gfx-gles2/GLES2Buffer.h b/native/cocos/renderer/gfx-gles2/GLES2Buffer.h index e1bd18bb7a..2c28fe204c 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Buffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Buffer.h @@ -23,8 +23,9 @@ THE SOFTWARE. ****************************************************************************/ -#ifndef CC_GFXGLES2_BUFFER_H_ -#define CC_GFXGLES2_BUFFER_H_ +#pragma once + +#include "gfx-base/GFXBuffer.h" namespace cc { namespace gfx { @@ -38,11 +39,11 @@ public: ~GLES2Buffer(); public: - virtual bool initialize(const BufferInfo &info) override; - virtual bool initialize(const BufferViewInfo &info) override; - virtual void destroy() override; - virtual void resize(uint size) override; - virtual void update(void *buffer, uint size) override; + bool initialize(const BufferInfo &info) override; + bool initialize(const BufferViewInfo &info) override; + void destroy() override; + void resize(uint size) override; + void update(void *buffer, uint size) override; CC_INLINE GLES2GPUBuffer *gpuBuffer() const { return _gpuBuffer; } CC_INLINE GLES2GPUBufferView *gpuBufferView() const { return _gpuBufferView; } @@ -54,5 +55,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h index b6a571a9cd..c3c9736032 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h @@ -26,6 +26,7 @@ #ifndef CC_GFXGLES2_COMMAND_BUFFER_H_ #define CC_GFXGLES2_COMMAND_BUFFER_H_ +#include "gfx-base/GFXCommandBuffer.h" #include "GLES2Commands.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Context.h b/native/cocos/renderer/gfx-gles2/GLES2Context.h index 07f95926d1..8ca5c8b092 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Context.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Context.h @@ -26,6 +26,7 @@ #ifndef CC_GFXGLES2_EGL_CONTEXT_H_ #define CC_GFXGLES2_EGL_CONTEXT_H_ +#include "gfx-base/GFXContext.h" #include "GLES2Wrangler.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h index c09340c4d0..abeaba8e37 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h +++ b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_DESCRIPTOR_SET_H_ #define CC_GFXGLES2_DESCRIPTOR_SET_H_ +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h index 7ecf9925e0..541f647ad7 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_DESCRIPTOR_SET_LAYOUT_H_ #define CC_GFXGLES2_DESCRIPTOR_SET_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Device.h b/native/cocos/renderer/gfx-gles2/GLES2Device.h index 065e596d9d..cc620e3dfa 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Device.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Device.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_DEVICE_H_ #define CC_GFXGLES2_DEVICE_H_ +#include "gfx-base/GFXDevice.h" + #ifndef GL_COMPRESSED_RGB8_ETC2 #define GL_COMPRESSED_RGB8_ETC2 0x9274 #endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h index 99fff1bc23..900b8cc4af 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_FRAMEBUFFER_H_ #define CC_GFXGLES2_FRAMEBUFFER_H_ +#include "gfx-base/GFXFramebuffer.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h index f7e23e1306..74e16e0416 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h +++ b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h @@ -26,6 +26,7 @@ #ifndef CC_GFXGLES2_GPU_OBJECTS_H_ #define CC_GFXGLES2_GPU_OBJECTS_H_ +#include "gfx-base/GFXDef.h" #include "GLES2Wrangler.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h index 4797c82e95..1d0c43cb02 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h +++ b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_INPUT_ASSEMBLER_H_ #define CC_GFXGLES2_INPUT_ASSEMBLER_H_ +#include "gfx-base/GFXInputAssembler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h b/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h index 9158f9c568..3a52d20eec 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h +++ b/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_PIPELINE_LAYOUT_H_ #define CC_GFXGLES2_PIPELINE_LAYOUT_H_ +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h b/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h index d8dcb54c07..2359e2aa85 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h +++ b/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_PIPELINE_STATE_H_ #define CC_GFXGLES2_PIPELINE_STATE_H_ +#include "gfx-base/GFXPipelineState.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Queue.h b/native/cocos/renderer/gfx-gles2/GLES2Queue.h index 0361274836..9adf1bbda4 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Queue.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Queue.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_QUEUE_H_ #define CC_GFXGLES2_QUEUE_H_ +#include "gfx-base/GFXQueue.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h b/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h index fc7121d4eb..b975f912c4 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h +++ b/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_RENDER_PASS_H_ #define CC_GFXGLES2_RENDER_PASS_H_ +#include "gfx-base/GFXRenderPass.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Sampler.h b/native/cocos/renderer/gfx-gles2/GLES2Sampler.h index 1e93186cdb..425588a6be 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Sampler.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Sampler.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_SAMPLER_H_ #define CC_GFXGLES2_SAMPLER_H_ +#include "gfx-base/GFXSampler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Shader.h b/native/cocos/renderer/gfx-gles2/GLES2Shader.h index 9e5f161ae9..0ee7131377 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Shader.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Shader.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_SHADER_H_ #define CC_GFXGLES2_SHADER_H_ +#include "gfx-base/GFXShader.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles2/GLES2Std.h b/native/cocos/renderer/gfx-gles2/GLES2Std.h index d87f550a7d..214779b3ef 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Std.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Std.h @@ -26,7 +26,7 @@ #ifndef __CC_GFXGLES2_STD_H__ #define __CC_GFXGLES2_STD_H__ -#include +#include "base/CoreStd.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #if defined(CC_STATIC) diff --git a/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp b/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp index 24f5fed204..c5365b7cc2 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp @@ -25,6 +25,7 @@ #include "GLES2Std.h" +#include "GLES2Device.h" #include "GLES2Texture.h" #include "GLES2Commands.h" diff --git a/native/cocos/renderer/gfx-gles2/GLES2Texture.h b/native/cocos/renderer/gfx-gles2/GLES2Texture.h index 2ec38d8804..3379b9f53a 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Texture.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Texture.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES2_TEXTURE_H_ #define CC_GFXGLES2_TEXTURE_H_ +#include "gfx-base/GFXTexture.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/CMakeLists.txt b/native/cocos/renderer/gfx-gles3/CMakeLists.txt deleted file mode 100644 index f2be4ecbdd..0000000000 --- a/native/cocos/renderer/gfx-gles3/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -set(TARGET_NAME GFXGLES3) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src/mesa - ${GFX_EXTERNAL_PATH}/taskflow - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-gles3 -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h ../gfx-gles-common/*.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc ../gfx-gles-common/*.cpp) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles3/GLES3Wrangler.cpp") -else() - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles3/GLES3Wrangler.mm") -endif() - -if(COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles3/GLES3Context.mm") -endif() - -add_definitions("-DCC_GLES3_EXPORTS") -if(WIN32) - add_definitions("-DGLEW_BUILD") -endif() -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME} Core GFXGLESCommon) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXGLES3) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXGLES3_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/GLES3Std.h" "${CMAKE_CURRENT_SOURCE_DIR}/GLES3Std.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp b/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp index 6e74287451..14c3f44b81 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp @@ -25,6 +25,7 @@ #include "GLES3Std.h" +#include "GLES3Device.h" #include "GLES3Buffer.h" #include "GLES3Commands.h" diff --git a/native/cocos/renderer/gfx-gles3/GLES3Buffer.h b/native/cocos/renderer/gfx-gles3/GLES3Buffer.h index e4ec602fcc..a9547e181d 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Buffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Buffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_BUFFER_H_ #define CC_GFXGLES3_BUFFER_H_ +#include "gfx-base/GFXBuffer.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h index b5c9c04e74..3ed4f1ebca 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_COMMAND_BUFFER_H_ #define CC_GFXGLES3_COMMAND_BUFFER_H_ +#include "gfx-base/GFXCommandBuffer.h" + #include "GLES3Commands.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Context.h b/native/cocos/renderer/gfx-gles3/GLES3Context.h index 7ba1200d05..00f87c6d80 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Context.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Context.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_EGL_CONTEXT_H_ #define CC_GFXGLES3_EGL_CONTEXT_H_ +#include "gfx-base/GFXContext.h" + #include "GLES3Wrangler.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h index d65477f1d6..0f8792be85 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h +++ b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_DESCRIPTOR_SET_H_ #define CC_GFXGLES3_DESCRIPTOR_SET_H_ +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h index 4837ed258f..0a39346561 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_DESCRIPTOR_SET_LAYOUT_H_ #define CC_GFXGLES3_DESCRIPTOR_SET_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.h b/native/cocos/renderer/gfx-gles3/GLES3Device.h index a87a700e6f..7ee25c88f1 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_DEVICE_H_ #define CC_GFXGLES3_DEVICE_H_ +#include "gfx-base/GFXDevice.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h index 9fed3ca03a..ede4a77926 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_FRAMEBUFFER_H_ #define CC_GFXGLES3_FRAMEBUFFER_H_ +#include "gfx-base/GFXFramebuffer.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h index 6990aaa2ac..8572c076ce 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h +++ b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h @@ -26,6 +26,7 @@ #ifndef CC_GFXGLES3_GPU_OBJECTS_H_ #define CC_GFXGLES3_GPU_OBJECTS_H_ +#include "gfx-base/GFXDef.h" #include "GLES3Wrangler.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h b/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h index 966b49674b..5312e5f7ac 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h +++ b/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_GLOBAL_BARRIER_H_ #define CC_GFXGLES3_GLOBAL_BARRIER_H_ +#include "gfx-base/GFXGlobalBarrier.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h index a02d750995..8300438956 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h +++ b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_INPUT_ASSEMBLER_H_ #define CC_GFXGLES3_INPUT_ASSEMBLER_H_ +#include "gfx-base/GFXInputAssembler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h b/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h index 1d095baac8..d158f92336 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h +++ b/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_PIPELINE_LAYOUT_H_ #define CC_GFXGLES3_PIPELINE_LAYOUT_H_ +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h b/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h index 8ae2026a18..dad66fc3bb 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h +++ b/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_PIPELINE_STATE_H_ #define CC_GFXGLES3_PIPELINE_STATE_H_ +#include "gfx-base/GFXPipelineState.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Queue.h b/native/cocos/renderer/gfx-gles3/GLES3Queue.h index f042649ba0..a6fbedb416 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Queue.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Queue.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_QUEUE_H_ #define CC_GFXGLES3_QUEUE_H_ +#include "gfx-base/GFXQueue.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h b/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h index cf65811869..79d502e61a 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h +++ b/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_RENDER_PASS_H_ #define CC_GFXGLES3_RENDER_PASS_H_ +#include "gfx-base/GFXRenderPass.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Sampler.h b/native/cocos/renderer/gfx-gles3/GLES3Sampler.h index 03a537e79c..83efc34a80 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Sampler.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Sampler.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_SAMPLER_H_ #define CC_GFXGLES3_SAMPLER_H_ +#include "gfx-base/GFXSampler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Shader.h b/native/cocos/renderer/gfx-gles3/GLES3Shader.h index f4197c1bbe..1fcdce63fc 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Shader.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Shader.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_SHADER_H_ #define CC_GFXGLES3_SHADER_H_ +#include "gfx-base/GFXShader.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Std.h b/native/cocos/renderer/gfx-gles3/GLES3Std.h index 77c7b9f0de..4b7e0d4002 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Std.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Std.h @@ -25,7 +25,7 @@ #pragma once -#include +#include "base/CoreStd.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #if defined(CC_STATIC) diff --git a/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp b/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp index 81174caa5b..ff444d2acf 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp @@ -26,6 +26,7 @@ #include "GLES3Std.h" #include "GLES3Commands.h" +#include "GLES3Device.h" #include "GLES3Texture.h" namespace cc { diff --git a/native/cocos/renderer/gfx-gles3/GLES3Texture.h b/native/cocos/renderer/gfx-gles3/GLES3Texture.h index b4276d5843..7c5ba1edc2 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Texture.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Texture.h @@ -26,6 +26,8 @@ #ifndef CC_GFXGLES3_TEXTURE_H_ #define CC_GFXGLES3_TEXTURE_H_ +#include "gfx-base/GFXTexture.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-metal/CMakeLists.txt b/native/cocos/renderer/gfx-metal/CMakeLists.txt deleted file mode 100644 index f2522ec35f..0000000000 --- a/native/cocos/renderer/gfx-metal/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -set(TARGET_NAME GFXMetal) - -message(STATUS "Target: ${TARGET_NAME}...") - -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/taskflow - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_SRC_PATH}/base - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-metal -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) -file(GLOB_RECURSE SOURCE_OBJC_FILES *.m *.mm) -set(ALL_FILES ${HEADER_FILES} ${SOURCE_CPP_FILES} ${SOURCE_C_FILES} ${SOURCE_OBJC_FILES}) - -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_compile_definitions(${TARGET_NAME} PRIVATE CC_USE_METAL) -find_library(COREFOUNDATION_FRAMEWORK CoreFoundation) -find_library(FOUNDATION_FRAMEWORK Foundation) -find_library(METAL_LIBRARY Metal) -find_library(METALKIT_LIBRARY MetalKit) -set(glslang_libs_name glslang OGLCompiler OSDependent SPIRV glslang-default-resource-limits) -set(spirv-cross_libs_name spirv-cross-core spirv-cross-glsl spirv-cross-msl) -target_link_libraries(${TARGET_NAME} Core ${COREFOUNDATION_FRAMEWORK} ${FOUNDATION_FRAMEWORK} ${METAL_LIBRARY} ${METALKIT_LIBRARY} ${glslang_libs_name} ${spirv-cross_libs_name}) - -target_include_directories(${TARGET_NAME} PUBLIC ${COCOS_EXTERNAL_PATH}/mac/include) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXMetal) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXMetal_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/MTLStd.h" "${CMAKE_CURRENT_SOURCE_DIR}/MTLStd.cpp" ${SOURCE_CPP_FILES} ${SOURCE_OBJC_FILES} ${SOURCE_C_FILES}) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-metal/MTLBuffer.h b/native/cocos/renderer/gfx-metal/MTLBuffer.h index 6ea9e11f38..36b4eacc19 100644 --- a/native/cocos/renderer/gfx-metal/MTLBuffer.h +++ b/native/cocos/renderer/gfx-metal/MTLBuffer.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXBuffer.h" + #import #import #import diff --git a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h index 35fdd986be..b2f0feeb6b 100644 --- a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h +++ b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXCommandBuffer.h" + #include "MTLGPUObjects.h" #include "MTLRenderCommandEncoder.h" #import diff --git a/native/cocos/renderer/gfx-metal/MTLContext.h b/native/cocos/renderer/gfx-metal/MTLContext.h index a56298a699..636e2864a2 100644 --- a/native/cocos/renderer/gfx-metal/MTLContext.h +++ b/native/cocos/renderer/gfx-metal/MTLContext.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXContext.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h b/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h index a56d34be41..123ecae489 100644 --- a/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h +++ b/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h @@ -24,8 +24,12 @@ ****************************************************************************/ #pragma once + +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { + class CCMTLGPUDescriptorSet; class CCMTLDescriptorSet final : public DescriptorSet { diff --git a/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h b/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h index e7dbef9539..175e4d707d 100644 --- a/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h @@ -24,8 +24,12 @@ ****************************************************************************/ #pragma once + +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { + class CCMTLGPUDescriptorSetLayout; class CCMTLDescriptorSetLayout final : public DescriptorSetLayout { public: diff --git a/native/cocos/renderer/gfx-metal/MTLDevice.h b/native/cocos/renderer/gfx-metal/MTLDevice.h index d443c9ba5c..f33b922ed4 100644 --- a/native/cocos/renderer/gfx-metal/MTLDevice.h +++ b/native/cocos/renderer/gfx-metal/MTLDevice.h @@ -25,6 +25,7 @@ #pragma once +#include "gfx-base/GFXDevice.h" #include "MTLConfig.h" namespace cc { diff --git a/native/cocos/renderer/gfx-metal/MTLFramebuffer.h b/native/cocos/renderer/gfx-metal/MTLFramebuffer.h index 297fd9e9eb..f0ebc99796 100644 --- a/native/cocos/renderer/gfx-metal/MTLFramebuffer.h +++ b/native/cocos/renderer/gfx-metal/MTLFramebuffer.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXFramebuffer.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-metal/MTLInputAssembler.h b/native/cocos/renderer/gfx-metal/MTLInputAssembler.h index 3d0be9440a..e67b3b50b0 100644 --- a/native/cocos/renderer/gfx-metal/MTLInputAssembler.h +++ b/native/cocos/renderer/gfx-metal/MTLInputAssembler.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXInputAssembler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h b/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h index e33e9dac01..105b5fbe15 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h +++ b/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h @@ -24,8 +24,12 @@ ****************************************************************************/ #pragma once + +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { + class CCMTLGPUPipelineLayout; class CCMTLPipelineLayout final : public PipelineLayout { diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineState.h b/native/cocos/renderer/gfx-metal/MTLPipelineState.h index d03a3a0563..142082bf72 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineState.h +++ b/native/cocos/renderer/gfx-metal/MTLPipelineState.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXPipelineState.h" + #include "MTLGPUObjects.h" #import diff --git a/native/cocos/renderer/gfx-metal/MTLQueue.h b/native/cocos/renderer/gfx-metal/MTLQueue.h index ab2fd5cff5..014314103a 100644 --- a/native/cocos/renderer/gfx-metal/MTLQueue.h +++ b/native/cocos/renderer/gfx-metal/MTLQueue.h @@ -25,8 +25,11 @@ #pragma once +#include "gfx-base/GFXQueue.h" + namespace cc { namespace gfx { + class CCMTLQueue final : public Queue { friend class CCMTLDevice; diff --git a/native/cocos/renderer/gfx-metal/MTLRenderPass.h b/native/cocos/renderer/gfx-metal/MTLRenderPass.h index 5d233159cd..b8f89181be 100644 --- a/native/cocos/renderer/gfx-metal/MTLRenderPass.h +++ b/native/cocos/renderer/gfx-metal/MTLRenderPass.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXRenderPass.h" + #import #import #import diff --git a/native/cocos/renderer/gfx-metal/MTLSampler.h b/native/cocos/renderer/gfx-metal/MTLSampler.h index d925c493c4..811b2f9f16 100644 --- a/native/cocos/renderer/gfx-metal/MTLSampler.h +++ b/native/cocos/renderer/gfx-metal/MTLSampler.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXSampler.h" + #import namespace cc { diff --git a/native/cocos/renderer/gfx-metal/MTLShader.h b/native/cocos/renderer/gfx-metal/MTLShader.h index e839b48c7f..6c088ecea8 100644 --- a/native/cocos/renderer/gfx-metal/MTLShader.h +++ b/native/cocos/renderer/gfx-metal/MTLShader.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXShader.h" + #import namespace cc { diff --git a/native/cocos/renderer/gfx-metal/MTLStd.h b/native/cocos/renderer/gfx-metal/MTLStd.h index 830355ae3d..4c4a92a5a1 100644 --- a/native/cocos/renderer/gfx-metal/MTLStd.h +++ b/native/cocos/renderer/gfx-metal/MTLStd.h @@ -25,4 +25,4 @@ #pragma once -#include +#include "base/CoreStd.h" diff --git a/native/cocos/renderer/gfx-metal/MTLTexture.h b/native/cocos/renderer/gfx-metal/MTLTexture.h index dc0d126ed6..7c21de3cb4 100644 --- a/native/cocos/renderer/gfx-metal/MTLTexture.h +++ b/native/cocos/renderer/gfx-metal/MTLTexture.h @@ -25,6 +25,8 @@ #pragma once +#include "gfx-base/GFXTexture.h" + #import namespace cc { diff --git a/native/cocos/renderer/gfx-metal/MTLUtils.h b/native/cocos/renderer/gfx-metal/MTLUtils.h index 3f88e96bc8..a847c9fa23 100644 --- a/native/cocos/renderer/gfx-metal/MTLUtils.h +++ b/native/cocos/renderer/gfx-metal/MTLUtils.h @@ -32,6 +32,7 @@ #import #import #include +#include "gfx-base/GFXDef.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/CMakeLists.txt b/native/cocos/renderer/gfx-vulkan/CMakeLists.txt deleted file mode 100644 index 01720969ae..0000000000 --- a/native/cocos/renderer/gfx-vulkan/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -set(TARGET_NAME GFXVulkan) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/taskflow - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/tbb/include - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_EXTERNAL_PATH}/win32/include/glslang - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-vulkan -) - -add_definitions("-DVK_NO_PROTOTYPES") - -if(WIN32) - add_definitions("-DVK_USE_PLATFORM_WIN32_KHR") - add_definitions("-DNOMINMAX") -elseif(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - add_definitions("-DVK_USE_PLATFORM_METAL_EXT") -elseif(COCOS_PLATFORM_ANDROID) - add_definitions("-DVK_USE_PLATFORM_ANDROID_KHR") -else() - add_definitions("-DVK_USE_PLATFORM_XLIB_KHR") -endif() - -add_definitions("-DBARRIER_DEDUCTION_LEVEL=0") -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ${CC_BASE_HEADERS} - ${CC_BASE_SOURCES} - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -add_definitions("-DCC_VK_EXPORTS") -if(WIN32) - add_definitions("-DGLEW_BUILD") -endif() -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME} Core glslang OGLCompiler OSDependent SPIRV glslang-default-resource-limits tbb tbbmalloc tbbmalloc_proxy) -target_compile_definitions(${TARGET_NAME} PRIVATE ${CC_EXTERNAL_PRIVATE_DEFINITIONS}) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXVulkan) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXVulkan_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/VKStd.h" "${CMAKE_CURRENT_SOURCE_DIR}/VKStd.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-vulkan/VKBuffer.h b/native/cocos/renderer/gfx-vulkan/VKBuffer.h index 706a3c8fb4..100504a240 100644 --- a/native/cocos/renderer/gfx-vulkan/VKBuffer.h +++ b/native/cocos/renderer/gfx-vulkan/VKBuffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_BUFFER_H_ #define CC_GFXVULKAN_BUFFER_H_ +#include "gfx-base/GFXBuffer.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h index f467f90ce9..8c7911eda3 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h +++ b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_COMMAND_BUFFER_H_ #define CC_GFXVULKAN_COMMAND_BUFFER_H_ +#include "gfx-base/GFXCommandBuffer.h" + #include "VKCommands.h" namespace cc { diff --git a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp index 8bb50b6e93..56f283fa16 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp @@ -384,7 +384,7 @@ void CCVKCmdFuncCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende } // make rendering result visible for the specified access types - VkSubpassDependency endDependency{subpassCount - 1, VK_SUBPASS_EXTERNAL, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}; + VkSubpassDependency endDependency{(uint)subpassCount - 1, VK_SUBPASS_EXTERNAL, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}; auto endDependencyCheck = [&endDependency, &endAccessInfos](const VkAttachmentReference &ref, VkPipelineStageFlags srcStage, VkAccessFlags srcAccess) { const VkAttachmentDescription &desc = attachmentDescriptions[ref.attachment]; if (desc.storeOp == VK_ATTACHMENT_STORE_OP_STORE) { diff --git a/native/cocos/renderer/gfx-vulkan/VKContext.cpp b/native/cocos/renderer/gfx-vulkan/VKContext.cpp index 3d5aa7917f..7cfa5ed6c2 100644 --- a/native/cocos/renderer/gfx-vulkan/VKContext.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKContext.cpp @@ -34,8 +34,8 @@ #include "VKUtils.h" -#include "cocos/bindings/event/CustomEventTypes.h" -#include "cocos/bindings/event/EventDispatcher.h" +#include "bindings/event/CustomEventTypes.h" +#include "bindings/event/EventDispatcher.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKContext.h b/native/cocos/renderer/gfx-vulkan/VKContext.h index 059549f452..f308c84510 100644 --- a/native/cocos/renderer/gfx-vulkan/VKContext.h +++ b/native/cocos/renderer/gfx-vulkan/VKContext.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_CONTEXT_H_ #define CC_GFXVULKAN_CONTEXT_H_ +#include "gfx-base/GFXContext.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h b/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h index 3df02ccecf..da4ae3c09a 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h +++ b/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_BINDING_LAYOUT_H_ #define CC_GFXVULKAN_BINDING_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h b/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h index 8a8e4f44b7..ee88a47ae2 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_DESCRIPTOR_SET_LAYOUT_H_ #define CC_GFXVULKAN_DESCRIPTOR_SET_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKDevice.h b/native/cocos/renderer/gfx-vulkan/VKDevice.h index 0ced0e73cf..ad6c2e0f0b 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDevice.h +++ b/native/cocos/renderer/gfx-vulkan/VKDevice.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_DEVICE_H_ #define CC_GFXVULKAN_DEVICE_H_ +#include "gfx-base/GFXDevice.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h b/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h index 33eac286bc..6bc1b92a17 100644 --- a/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h +++ b/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_FRAMEBUFFER_H_ #define CC_GFXVULKAN_FRAMEBUFFER_H_ +#include "gfx-base/GFXFramebuffer.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h b/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h index 54aea79e74..7c721a61b4 100644 --- a/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h +++ b/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_GLOBAL_BARRIER_H_ #define CC_GFXVULKAN_GLOBAL_BARRIER_H_ +#include "gfx-base/GFXGlobalBarrier.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h b/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h index 708f29e3e3..2b6230f331 100644 --- a/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h +++ b/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_INPUT_ASSEMBLER_H_ #define CC_GFXVULKAN_INPUT_ASSEMBLER_H_ +#include "gfx-base/GFXInputAssembler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h b/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h index 20a3a9dc5b..c9578f3a7c 100644 --- a/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h +++ b/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_PIPELINE_LAYOUT_H_ #define CC_GFXVULKAN_PIPELINE_LAYOUT_H_ +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKPipelineState.h b/native/cocos/renderer/gfx-vulkan/VKPipelineState.h index 2df64aba5f..bdc4acfdd1 100644 --- a/native/cocos/renderer/gfx-vulkan/VKPipelineState.h +++ b/native/cocos/renderer/gfx-vulkan/VKPipelineState.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_PIPELINE_STATE_H_ #define CC_GFXVULKAN_PIPELINE_STATE_H_ +#include "gfx-base/GFXPipelineState.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKQueue.h b/native/cocos/renderer/gfx-vulkan/VKQueue.h index ee4038af27..227af9e50f 100644 --- a/native/cocos/renderer/gfx-vulkan/VKQueue.h +++ b/native/cocos/renderer/gfx-vulkan/VKQueue.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_QUEUE_H_ #define CC_GFXVULKAN_QUEUE_H_ +#include "gfx-base/GFXQueue.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKRenderPass.h b/native/cocos/renderer/gfx-vulkan/VKRenderPass.h index 295e09ed7a..bc95cdfe7c 100644 --- a/native/cocos/renderer/gfx-vulkan/VKRenderPass.h +++ b/native/cocos/renderer/gfx-vulkan/VKRenderPass.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_RENDER_PASS_H_ #define CC_GFXVULKAN_RENDER_PASS_H_ +#include "gfx-base/GFXRenderPass.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKSampler.h b/native/cocos/renderer/gfx-vulkan/VKSampler.h index b14152c5a2..a9bb24f67f 100644 --- a/native/cocos/renderer/gfx-vulkan/VKSampler.h +++ b/native/cocos/renderer/gfx-vulkan/VKSampler.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_SAMPLER_H_ #define CC_GFXVULKAN_SAMPLER_H_ +#include "gfx-base/GFXSampler.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKShader.h b/native/cocos/renderer/gfx-vulkan/VKShader.h index 4bddda9442..08370fcf58 100644 --- a/native/cocos/renderer/gfx-vulkan/VKShader.h +++ b/native/cocos/renderer/gfx-vulkan/VKShader.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_SHADER_H_ #define CC_GFXVULKAN_SHADER_H_ +#include "gfx-base/GFXShader.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKStd.h b/native/cocos/renderer/gfx-vulkan/VKStd.h index 44cc394f9a..e43cc4a993 100644 --- a/native/cocos/renderer/gfx-vulkan/VKStd.h +++ b/native/cocos/renderer/gfx-vulkan/VKStd.h @@ -26,7 +26,7 @@ #ifndef __CC_GFXVULKAN_VK_STD_H__ #define __CC_GFXVULKAN_VK_STD_H__ -#include +#include "base/CoreStd.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #if defined(CC_STATIC) diff --git a/native/cocos/renderer/gfx-vulkan/VKTexture.h b/native/cocos/renderer/gfx-vulkan/VKTexture.h index 0c7b2dcf6e..cf55faa24e 100644 --- a/native/cocos/renderer/gfx-vulkan/VKTexture.h +++ b/native/cocos/renderer/gfx-vulkan/VKTexture.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_TEXTURE_H_ #define CC_GFXVULKAN_TEXTURE_H_ +#include "gfx-base/GFXTexture.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h b/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h index 3a00ead7ad..fee1a62a41 100644 --- a/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h +++ b/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h @@ -26,6 +26,8 @@ #ifndef CC_GFXVULKAN_TEXTURE_BARRIER_H_ #define CC_GFXVULKAN_TEXTURE_BARRIER_H_ +#include "gfx-base/GFXTextureBarrier.h" + namespace cc { namespace gfx { diff --git a/native/cocos/renderer/gfx-vulkan/VKUtils.h b/native/cocos/renderer/gfx-vulkan/VKUtils.h index 0688a77c65..6823982656 100644 --- a/native/cocos/renderer/gfx-vulkan/VKUtils.h +++ b/native/cocos/renderer/gfx-vulkan/VKUtils.h @@ -28,6 +28,8 @@ #define WIN32_LEAN_AND_MEAN +#include "gfx-base/GFXDef.h" + #include "vk_mem_alloc.h" #include "volk.h" diff --git a/native/cocos/renderer/pipeline/BatchedBuffer.cpp b/native/cocos/renderer/pipeline/BatchedBuffer.cpp index 0570f3f49d..a37bc70785 100644 --- a/native/cocos/renderer/pipeline/BatchedBuffer.cpp +++ b/native/cocos/renderer/pipeline/BatchedBuffer.cpp @@ -24,16 +24,16 @@ ****************************************************************************/ #include "BatchedBuffer.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXInputAssembler.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXInputAssembler.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { map> BatchedBuffer::_buffers; -BatchedBuffer *BatchedBuffer::get(uint pass) { +BatchedBuffer * BatchedBuffer::get(uint pass) { return BatchedBuffer::get(pass, 0); } BatchedBuffer *BatchedBuffer::get(uint pass, uint extraKey) { @@ -71,21 +71,21 @@ void BatchedBuffer::destroy() { } void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const ModelView *model) { - const auto subMesh = subModel->getSubMesh(); - const auto flatBuffersID = subMesh->getFlatBufferArrayID(); + const auto subMesh = subModel->getSubMesh(); + const auto flatBuffersID = subMesh->getFlatBufferArrayID(); const auto flatBuffersCount = flatBuffersID ? flatBuffersID[0] : 0; if (flatBuffersCount == 0) { return; } - const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[1]); - auto vbSize = 0; - auto indexSize = 0; - const auto vbCount = flatBuffer->count; - const auto pass = subModel->getPassView(passIdx); - const auto shader = subModel->getShader(passIdx); + const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[1]); + auto vbSize = 0; + auto indexSize = 0; + const auto vbCount = flatBuffer->count; + const auto pass = subModel->getPassView(passIdx); + const auto shader = subModel->getShader(passIdx); const auto descriptorSet = subModel->getDescriptorSet(); - bool isBatchExist = false; + bool isBatchExist = false; for (auto i = 0; i < _batches.size(); ++i) { auto &batch = _batches[i]; @@ -101,40 +101,40 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode if (isBatchExist) { for (auto j = 0; j < flatBuffersCount; ++j) { - const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[j + 1]); - auto batchVB = batch.vbs[j]; - auto vbData = batch.vbDatas[j]; + const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[j + 1]); + auto batchVB = batch.vbs[j]; + auto vbData = batch.vbDatas[j]; const auto vbBufSizeOld = batchVB->getSize(); - vbSize = (vbCount + batch.vbCount) * flatBuffer->stride; + vbSize = (vbCount + batch.vbCount) * flatBuffer->stride; if (vbSize > vbBufSizeOld) { uint8_t *vbDataNew = static_cast(CC_MALLOC(vbSize)); memcpy(vbDataNew, vbData, vbBufSizeOld); batchVB->resize(vbSize); CC_FREE(vbData); batch.vbDatas[j] = vbDataNew; - vbData = vbDataNew; + vbData = vbDataNew; } - auto size = 0u; - auto offset = batch.vbCount * flatBuffer->stride; - const auto data = flatBuffer->getBuffer(&size); + auto size = 0u; + auto offset = batch.vbCount * flatBuffer->stride; + const auto data = flatBuffer->getBuffer(&size); memcpy(vbData + offset, data, size); } auto indexData = batch.indexData; - indexSize = (vbCount + batch.vbCount) * sizeof(float); + indexSize = (vbCount + batch.vbCount) * sizeof(float); if (indexSize > batch.indexBuffer->getSize()) { auto newIndexData = static_cast(CC_MALLOC(indexSize)); memcpy(newIndexData, indexData, batch.indexBuffer->getSize()); CC_FREE(indexData); batch.indexData = newIndexData; - indexData = batch.indexData; + indexData = batch.indexData; batch.indexBuffer->resize(indexSize); } - const auto start = batch.vbCount; - const auto end = start + vbCount; + const auto start = batch.vbCount; + const auto end = start + vbCount; const auto mergeCount = batch.mergeCount; if (indexData[start] != mergeCount || indexData[end - 1] != mergeCount) { for (auto j = start; j < end; j++) { @@ -143,15 +143,15 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode } // update world matrix - const auto offset = UBOLocalBatched::MAT_WORLDS_OFFSET + batch.mergeCount * 16; + const auto offset = UBOLocalBatched::MAT_WORLDS_OFFSET + batch.mergeCount * 16; const auto &worldMatrix = model->getTransform()->worldMatrix; memcpy(batch.uboData.data() + offset, worldMatrix.m, sizeof(worldMatrix)); if (!batch.mergeCount) { descriptorSet->bindBuffer(UBOLocalBatched::BINDING, batch.ubo); descriptorSet->update(); - batch.pass = pass; - batch.shader = shader; + batch.pass = pass; + batch.shader = shader; batch.descriptorSet = descriptorSet; } @@ -166,41 +166,41 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode // Create a new batch vector vbs(flatBuffersCount, nullptr); - vector vbDatas(flatBuffersCount, 0); + vector vbDatas(flatBuffersCount, 0); vector totalVBs(flatBuffersCount + 1, nullptr); for (auto i = 0; i < flatBuffersCount; ++i) { const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[i + 1]); - auto newVB = _device->createBuffer({ + auto newVB = _device->createBuffer({ gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, flatBuffer->count * flatBuffer->stride, flatBuffer->stride, }); - auto size = 0u; - auto data = flatBuffer->getBuffer(&size); + auto size = 0u; + auto data = flatBuffer->getBuffer(&size); newVB->update(data, size); - vbs[i] = newVB; + vbs[i] = newVB; vbDatas[i] = static_cast(CC_MALLOC(newVB->getSize())); memset(vbDatas[i], 0, newVB->getSize()); totalVBs[i] = newVB; } const auto indexBufferSize = vbCount * sizeof(float); - auto indexBuffer = _device->createBuffer({ + auto indexBuffer = _device->createBuffer({ gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, static_cast(indexBufferSize), sizeof(float), }); - float *indexData = static_cast(CC_MALLOC(indexBufferSize)); + float * indexData = static_cast(CC_MALLOC(indexBufferSize)); memset(indexData, 0, indexBufferSize); indexBuffer->update(indexData, indexBufferSize); totalVBs[flatBuffersCount] = indexBuffer; vector attributes = subModel->getInputAssembler()->getAttributes(); - gfx::Attribute attrib = { + gfx::Attribute attrib = { "a_dyn_batch_id", gfx::Format::R32F, false, @@ -221,7 +221,7 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode descriptorSet->update(); std::array uboData; - const auto &worldMatrix = model->getTransform()->worldMatrix; + const auto & worldMatrix = model->getTransform()->worldMatrix; memcpy(uboData.data() + UBOLocalBatched::MAT_WORLDS_OFFSET, worldMatrix.m, sizeof(worldMatrix)); BatchedItem item = { std::move(vbs), //vbs @@ -242,7 +242,7 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode void BatchedBuffer::clear() { for (auto &batch : _batches) { - batch.vbCount = 0; + batch.vbCount = 0; batch.mergeCount = 0; batch.ia->setVertexCount(0); } diff --git a/native/cocos/renderer/pipeline/BatchedBuffer.h b/native/cocos/renderer/pipeline/BatchedBuffer.h index 9a6fe00010..2d46da2081 100644 --- a/native/cocos/renderer/pipeline/BatchedBuffer.h +++ b/native/cocos/renderer/pipeline/BatchedBuffer.h @@ -26,6 +26,7 @@ #pragma once #include "Define.h" +#include namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/Define.cpp b/native/cocos/renderer/pipeline/Define.cpp index 907a721601..022d4e5634 100644 --- a/native/cocos/renderer/pipeline/Define.cpp +++ b/native/cocos/renderer/pipeline/Define.cpp @@ -24,19 +24,19 @@ ****************************************************************************/ #include "Define.h" -#include "cocos/bindings/jswrapper/SeApi.h" -#include "gfx/GFXDevice.h" +#include "bindings/jswrapper/SeApi.h" +#include "gfx-base/GFXDevice.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { -uint GLOBAL_SET = static_cast(SetIndex::GLOBAL); +uint GLOBAL_SET = static_cast(SetIndex::GLOBAL); uint MATERIAL_SET = static_cast(SetIndex::MATERIAL); -uint LOCAL_SET = static_cast(SetIndex::LOCAL); +uint LOCAL_SET = static_cast(SetIndex::LOCAL); -DescriptorSetLayoutInfos globalDescriptorSetLayout; -DescriptorSetLayoutInfos localDescriptorSetLayout; -const String UBOGlobal::NAME = "CCGlobal"; +DescriptorSetLayoutInfos globalDescriptorSetLayout; +DescriptorSetLayoutInfos localDescriptorSetLayout; +const String UBOGlobal::NAME = "CCGlobal"; const gfx::DescriptorSetLayoutBinding UBOGlobal::DESCRIPTOR = { UBOGlobal::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -55,7 +55,7 @@ const gfx::UniformBlock UBOGlobal::LAYOUT = { 1, }; -const String UBOLocalBatched::NAME = "CCLocalBatched"; +const String UBOLocalBatched::NAME = "CCLocalBatched"; const gfx::DescriptorSetLayoutBinding UBOLocalBatched::DESCRIPTOR = { UBOLocalBatched::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -72,7 +72,7 @@ const gfx::UniformBlock UBOLocalBatched::LAYOUT = { 1, }; -const String UBOCamera::NAME = "CCCamera"; +const String UBOCamera::NAME = "CCCamera"; const gfx::DescriptorSetLayoutBinding UBOCamera::DESCRIPTOR = { UBOCamera::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -104,7 +104,7 @@ const gfx::UniformBlock UBOCamera::LAYOUT = { 1, }; -const String UBOShadow::NAME = "CCShadow"; +const String UBOShadow::NAME = "CCShadow"; const gfx::DescriptorSetLayoutBinding UBOShadow::DESCRIPTOR = { UBOShadow::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -124,7 +124,7 @@ const gfx::UniformBlock UBOShadow::LAYOUT = { 1, }; -const String UBOLocal::NAME = "CCLocal"; +const String UBOLocal::NAME = "CCLocal"; const gfx::DescriptorSetLayoutBinding UBOLocal::DESCRIPTOR = { UBOLocal::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -143,7 +143,7 @@ const gfx::UniformBlock UBOLocal::LAYOUT = { 1, }; -const String UBOForwardLight::NAME = "CCForwardLight"; +const String UBOForwardLight::NAME = "CCForwardLight"; const gfx::DescriptorSetLayoutBinding UBOForwardLight::DESCRIPTOR = { UBOForwardLight::BINDING, gfx::DescriptorType::DYNAMIC_UNIFORM_BUFFER, @@ -163,7 +163,7 @@ const gfx::UniformBlock UBOForwardLight::LAYOUT = { 1, }; -const String UBOSkinningTexture::NAME = "CCSkinningTexture"; +const String UBOSkinningTexture::NAME = "CCSkinningTexture"; const gfx::DescriptorSetLayoutBinding UBOSkinningTexture::DESCRIPTOR = { UBOSkinningTexture::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -180,7 +180,7 @@ const gfx::UniformBlock UBOSkinningTexture::LAYOUT = { 1, }; -const String UBOSkinningAnimation::NAME = "CCSkinningAnimation"; +const String UBOSkinningAnimation::NAME = "CCSkinningAnimation"; const gfx::DescriptorSetLayoutBinding UBOSkinningAnimation::DESCRIPTOR = { UBOSkinningAnimation::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -197,7 +197,7 @@ const gfx::UniformBlock UBOSkinningAnimation::LAYOUT = { 1, }; -const String UBOSkinning::NAME = "CCSkinning"; +const String UBOSkinning::NAME = "CCSkinning"; const gfx::DescriptorSetLayoutBinding UBOSkinning::DESCRIPTOR = { UBOSkinning::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, @@ -214,10 +214,10 @@ const gfx::UniformBlock UBOSkinning::LAYOUT = { 1, }; -const uint UBOMorph::COUNT_BASE_4_BYTES = 4 * std::ceil(UBOMorph::MAX_MORPH_TARGET_COUNT / 4) + 4; -const uint UBOMorph::SIZE = UBOMorph::COUNT_BASE_4_BYTES * 4; -const String UBOMorph::NAME = "CCMorph"; -const gfx::DescriptorSetLayoutBinding UBOMorph::DESCRIPTOR = { +const uint UBOMorph::COUNT_BASE_4_BYTES = 4 * std::ceil(UBOMorph::MAX_MORPH_TARGET_COUNT / 4) + 4; +const uint UBOMorph::SIZE = UBOMorph::COUNT_BASE_4_BYTES * 4; +const String UBOMorph::NAME = "CCMorph"; +const gfx::DescriptorSetLayoutBinding UBOMorph::DESCRIPTOR = { UBOMorph::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, @@ -234,7 +234,7 @@ const gfx::UniformBlock UBOMorph::LAYOUT = { 1, }; -const String SHADOWMAP::NAME = "cc_shadowMap"; +const String SHADOWMAP::NAME = "cc_shadowMap"; const gfx::DescriptorSetLayoutBinding SHADOWMAP::DESCRIPTOR = { SHADOWMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -249,7 +249,7 @@ const gfx::UniformSamplerTexture SHADOWMAP::LAYOUT = { 1, }; -const String SAMPLERGBUFFERALBEDOMAP::NAME = "cc_gbuffer_albedoMap"; +const String SAMPLERGBUFFERALBEDOMAP::NAME = "cc_gbuffer_albedoMap"; const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFERALBEDOMAP::DESCRIPTOR = { SAMPLERGBUFFERALBEDOMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -264,7 +264,7 @@ const gfx::UniformSamplerTexture SAMPLERGBUFFERALBEDOMAP::LAYOUT = { 1, }; -const String SAMPLERGBUFFERPOSITIONMAP::NAME = "cc_gbuffer_positionMap"; +const String SAMPLERGBUFFERPOSITIONMAP::NAME = "cc_gbuffer_positionMap"; const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFERPOSITIONMAP::DESCRIPTOR = { SAMPLERGBUFFERPOSITIONMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -279,7 +279,7 @@ const gfx::UniformSamplerTexture SAMPLERGBUFFERPOSITIONMAP::LAYOUT = { 1, }; -const String SAMPLERGBUFFERNORMALMAP::NAME = "cc_gbuffer_normalMap"; +const String SAMPLERGBUFFERNORMALMAP::NAME = "cc_gbuffer_normalMap"; const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFERNORMALMAP::DESCRIPTOR = { SAMPLERGBUFFERNORMALMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -294,7 +294,7 @@ const gfx::UniformSamplerTexture SAMPLERGBUFFERNORMALMAP::LAYOUT = { 1, }; -const String SAMPLERGBUFFEREMISSIVEMAP::NAME = "cc_gbuffer_emissiveMap"; +const String SAMPLERGBUFFEREMISSIVEMAP::NAME = "cc_gbuffer_emissiveMap"; const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFEREMISSIVEMAP::DESCRIPTOR = { SAMPLERGBUFFEREMISSIVEMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -309,7 +309,7 @@ const gfx::UniformSamplerTexture SAMPLERGBUFFEREMISSIVEMAP::LAYOUT = { 1, }; -const String SAMPLERLIGHTINGRESULTMAP::NAME = "cc_lighting_resultMap"; +const String SAMPLERLIGHTINGRESULTMAP::NAME = "cc_lighting_resultMap"; const gfx::DescriptorSetLayoutBinding SAMPLERLIGHTINGRESULTMAP::DESCRIPTOR = { SAMPLERLIGHTINGRESULTMAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -324,7 +324,7 @@ const gfx::UniformSamplerTexture SAMPLERLIGHTINGRESULTMAP::LAYOUT = { 1, }; -const String ENVIRONMENT::NAME = "cc_environment"; +const String ENVIRONMENT::NAME = "cc_environment"; const gfx::DescriptorSetLayoutBinding ENVIRONMENT::DESCRIPTOR = { ENVIRONMENT::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -339,7 +339,7 @@ const gfx::UniformSamplerTexture ENVIRONMENT::LAYOUT = { 1, }; -const String SPOT_LIGHTING_MAP::NAME = "cc_spotLightingMap"; +const String SPOT_LIGHTING_MAP::NAME = "cc_spotLightingMap"; const gfx::DescriptorSetLayoutBinding SPOT_LIGHTING_MAP::DESCRIPTOR = { SPOT_LIGHTING_MAP::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -354,7 +354,7 @@ const gfx::UniformSamplerTexture SPOT_LIGHTING_MAP::LAYOUT = { 1, }; -const String JOINT_TEXTURE::NAME = "cc_jointTexture"; +const String JOINT_TEXTURE::NAME = "cc_jointTexture"; const gfx::DescriptorSetLayoutBinding JOINT_TEXTURE::DESCRIPTOR = { JOINT_TEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -369,7 +369,7 @@ const gfx::UniformSamplerTexture JOINT_TEXTURE::LAYOUT = { 1, }; -const String POSITION_MORPH::NAME = "cc_PositionDisplacements"; +const String POSITION_MORPH::NAME = "cc_PositionDisplacements"; const gfx::DescriptorSetLayoutBinding POSITION_MORPH::DESCRIPTOR = { POSITION_MORPH::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -384,7 +384,7 @@ const gfx::UniformSamplerTexture POSITION_MORPH::LAYOUT = { 1, }; -const String NORMAL_MORPH::NAME = "cc_NormalDisplacements"; +const String NORMAL_MORPH::NAME = "cc_NormalDisplacements"; const gfx::DescriptorSetLayoutBinding NORMAL_MORPH::DESCRIPTOR = { NORMAL_MORPH::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -399,7 +399,7 @@ const gfx::UniformSamplerTexture NORMAL_MORPH::LAYOUT = { 1, }; -const String TANGENT_MORPH::NAME = "cc_TangentDisplacements"; +const String TANGENT_MORPH::NAME = "cc_TangentDisplacements"; const gfx::DescriptorSetLayoutBinding TANGENT_MORPH::DESCRIPTOR = { TANGENT_MORPH::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -414,7 +414,7 @@ const gfx::UniformSamplerTexture TANGENT_MORPH::LAYOUT = { 1, }; -const String LIGHTMAP_TEXTURE::NAME = "cc_lightingMap"; +const String LIGHTMAP_TEXTURE::NAME = "cc_lightingMap"; const gfx::DescriptorSetLayoutBinding LIGHTMAP_TEXTURE::DESCRIPTOR = { LIGHTMAP_TEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -429,7 +429,7 @@ const gfx::UniformSamplerTexture LIGHTMAP_TEXTURE::LAYOUT = { 1, }; -const String SPRITE_TEXTURE::NAME = "cc_spriteTexture"; +const String SPRITE_TEXTURE::NAME = "cc_spriteTexture"; const gfx::DescriptorSetLayoutBinding SPRITE_TEXTURE::DESCRIPTOR = { SPRITE_TEXTURE::BINDING, gfx::DescriptorType::SAMPLER_TEXTURE, @@ -461,7 +461,7 @@ uint genSamplerHash(const gfx::SamplerInfo &info) { static uint defaultSamplerHash = genSamplerHash(gfx::SamplerInfo()); map samplerCache; -gfx::Sampler *getSampler(uint hash) { +gfx::Sampler * getSampler(uint hash) { if (hash == 0) { hash = defaultSamplerHash; } @@ -472,15 +472,15 @@ gfx::Sampler *getSampler(uint hash) { } gfx::SamplerInfo info; - info.minFilter = static_cast(hash & 3); - info.magFilter = static_cast((hash >> 2) & 3); - info.mipFilter = static_cast((hash >> 4) & 3); - info.addressU = static_cast((hash >> 6) & 3); - info.addressV = static_cast((hash >> 8) & 3); - info.addressW = static_cast((hash >> 10) & 3); + info.minFilter = static_cast(hash & 3); + info.magFilter = static_cast((hash >> 2) & 3); + info.mipFilter = static_cast((hash >> 4) & 3); + info.addressU = static_cast((hash >> 6) & 3); + info.addressV = static_cast((hash >> 8) & 3); + info.addressW = static_cast((hash >> 10) & 3); info.maxAnisotropy = ((hash >> 12) & 15); - info.cmpFunc = static_cast((hash >> 16) & 15); - info.mipLODBias = ((hash >> 28) & 15); + info.cmpFunc = static_cast((hash >> 16) & 15); + info.mipLODBias = ((hash >> 28) & 15); sampler = gfx::Device::getInstance()->createSampler(std::move(info)); return sampler; @@ -508,7 +508,7 @@ uint getPhaseID(const String &phase) { return 0; } se::Object *nrObjct = nrValue.toObject(); - se::Value nrPhase; + se::Value nrPhase; if (!nrObjct->getProperty("getPhaseID", &nrPhase)) { CC_LOG_ERROR("getPhaseID: failed to get getPhaseID property."); return 0; diff --git a/native/cocos/renderer/pipeline/Define.h b/native/cocos/renderer/pipeline/Define.h index 5554bee4e6..018c3594c3 100644 --- a/native/cocos/renderer/pipeline/Define.h +++ b/native/cocos/renderer/pipeline/Define.h @@ -25,8 +25,11 @@ #pragma once -#include "../core/CoreStd.h" +#include + #include "base/Value.h" +#include "base/Object.h" +#include "gfx-base/GFXDef.h" namespace cc { namespace pipeline { @@ -47,52 +50,52 @@ struct Frustum; #define JOINT_UNIFORM_CAPACITY 30 struct CC_DLL RenderObject { - float depth = 0; + float depth = 0; const ModelView *model = nullptr; }; typedef vector RenderObjectList; struct CC_DLL RenderTargetInfo { - uint width = 0; + uint width = 0; uint height = 0; }; struct CC_DLL RenderPass { - uint hash = 0; - float depth = 0; - uint shaderID = 0; - uint passIndex = 0; - const SubModelView *subModel = nullptr; + uint hash = 0; + float depth = 0; + uint shaderID = 0; + uint passIndex = 0; + const SubModelView *subModel = nullptr; }; typedef vector RenderPassList; typedef gfx::ColorAttachment ColorDesc; -typedef vector ColorDescList; +typedef vector ColorDescList; typedef gfx::DepthStencilAttachment DepthStencilDesc; struct CC_DLL RenderPassDesc { - uint index = 0; - ColorDescList colorAttachments; + uint index = 0; + ColorDescList colorAttachments; DepthStencilDesc depthStencilAttachment; }; typedef vector RenderPassDescList; struct CC_DLL RenderTextureDesc { - String name; - gfx::TextureType type = gfx::TextureType::TEX2D; - gfx::TextureUsage usage = gfx::TextureUsage::COLOR_ATTACHMENT; - gfx::Format format = gfx::Format::UNKNOWN; - int width = -1; - int height = -1; + String name; + gfx::TextureType type = gfx::TextureType::TEX2D; + gfx::TextureUsage usage = gfx::TextureUsage::COLOR_ATTACHMENT; + gfx::Format format = gfx::Format::UNKNOWN; + int width = -1; + int height = -1; }; typedef vector RenderTextureDescList; struct CC_DLL FrameBufferDesc { - String name; - uint renderPass = 0; + String name; + uint renderPass = 0; vector colorTextures; - String depthStencilTexture; + String depthStencilTexture; }; typedef vector FrameBufferDescList; @@ -103,37 +106,37 @@ enum class RenderFlowType : uint8_t { }; typedef vector RenderStageList; -typedef vector RenderFlowList; -typedef vector LightList; -typedef vector UintList; +typedef vector RenderFlowList; +typedef vector LightList; +typedef vector UintList; enum class CC_DLL RenderPassStage { DEFAULT = 100, - UI = 200, + UI = 200, }; struct CC_DLL InternalBindingDesc { - gfx::DescriptorType type; - gfx::UniformBlock blockInfo; + gfx::DescriptorType type; + gfx::UniformBlock blockInfo; gfx::UniformSamplerTexture samplerInfo; - Value defaultValue; + Value defaultValue; }; struct CC_DLL InternalBindingInst : public InternalBindingDesc { - gfx::Buffer *buffer = nullptr; + gfx::Buffer * buffer = nullptr; gfx::Sampler *sampler = nullptr; gfx::Texture *texture = nullptr; }; struct CC_DLL RenderQueueCreateInfo { - bool isTransparent = false; - uint phases = 0; + bool isTransparent = false; + uint phases = 0; std::function sortFunc; }; enum class CC_DLL RenderPriority { - MIN = 0, - MAX = 0xff, + MIN = 0, + MAX = 0xff, DEFAULT = 0x80, }; @@ -143,9 +146,9 @@ enum class CC_DLL RenderQueueSortMode { }; struct CC_DLL RenderQueueDesc { - bool isTransparent = false; - RenderQueueSortMode sortMode = RenderQueueSortMode::FRONT_TO_BACK; - StringArray stages; + bool isTransparent = false; + RenderQueueSortMode sortMode = RenderQueueSortMode::FRONT_TO_BACK; + StringArray stages; }; typedef std::vector RenderQueueDescList; @@ -204,40 +207,40 @@ enum class CC_DLL ModelLocalBindings { }; struct CC_DLL UBOLocalBatched { - static constexpr uint BATCHING_COUNT = 10; - static constexpr uint MAT_WORLDS_OFFSET = 0; - static constexpr uint COUNT = 16 * UBOLocalBatched::BATCHING_COUNT; - static constexpr uint SIZE = UBOLocalBatched::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); + static constexpr uint BATCHING_COUNT = 10; + static constexpr uint MAT_WORLDS_OFFSET = 0; + static constexpr uint COUNT = 16 * UBOLocalBatched::BATCHING_COUNT; + static constexpr uint SIZE = UBOLocalBatched::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOLocal { - static constexpr uint MAT_WORLD_OFFSET = 0; - static constexpr uint MAT_WORLD_IT_OFFSET = UBOLocal::MAT_WORLD_OFFSET + 16; - static constexpr uint LIGHTINGMAP_UVPARAM = UBOLocal::MAT_WORLD_IT_OFFSET + 16; - static constexpr uint COUNT = UBOLocal::LIGHTINGMAP_UVPARAM + 4; - static constexpr uint SIZE = UBOLocal::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); + static constexpr uint MAT_WORLD_OFFSET = 0; + static constexpr uint MAT_WORLD_IT_OFFSET = UBOLocal::MAT_WORLD_OFFSET + 16; + static constexpr uint LIGHTINGMAP_UVPARAM = UBOLocal::MAT_WORLD_IT_OFFSET + 16; + static constexpr uint COUNT = UBOLocal::LIGHTINGMAP_UVPARAM + 4; + static constexpr uint SIZE = UBOLocal::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOForwardLight { - static constexpr uint LIGHTS_PER_PASS = 1; - static constexpr uint LIGHT_POS_OFFSET = 0; - static constexpr uint LIGHT_COLOR_OFFSET = UBOForwardLight::LIGHT_POS_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint LIGHT_SIZE_RANGE_ANGLE_OFFSET = UBOForwardLight::LIGHT_COLOR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint LIGHT_DIR_OFFSET = UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint COUNT = UBOForwardLight::LIGHT_DIR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint SIZE = UBOForwardLight::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_FORWARD_LIGHTS); + static constexpr uint LIGHTS_PER_PASS = 1; + static constexpr uint LIGHT_POS_OFFSET = 0; + static constexpr uint LIGHT_COLOR_OFFSET = UBOForwardLight::LIGHT_POS_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint LIGHT_SIZE_RANGE_ANGLE_OFFSET = UBOForwardLight::LIGHT_COLOR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint LIGHT_DIR_OFFSET = UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint COUNT = UBOForwardLight::LIGHT_DIR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint SIZE = UBOForwardLight::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_FORWARD_LIGHTS); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBODeferredLight { @@ -245,58 +248,58 @@ struct CC_DLL UBODeferredLight { }; struct CC_DLL UBOSkinningTexture { - static constexpr uint JOINTS_TEXTURE_INFO_OFFSET = 0; - static constexpr uint COUNT = UBOSkinningTexture::JOINTS_TEXTURE_INFO_OFFSET + 4; - static constexpr uint SIZE = UBOSkinningTexture::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); + static constexpr uint JOINTS_TEXTURE_INFO_OFFSET = 0; + static constexpr uint COUNT = UBOSkinningTexture::JOINTS_TEXTURE_INFO_OFFSET + 4; + static constexpr uint SIZE = UBOSkinningTexture::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOSkinningAnimation { - static constexpr uint JOINTS_ANIM_INFO_OFFSET = 0; - static constexpr uint COUNT = UBOSkinningAnimation::JOINTS_ANIM_INFO_OFFSET + 4; - static constexpr uint SIZE = UBOSkinningAnimation::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_ANIMATION); + static constexpr uint JOINTS_ANIM_INFO_OFFSET = 0; + static constexpr uint COUNT = UBOSkinningAnimation::JOINTS_ANIM_INFO_OFFSET + 4; + static constexpr uint SIZE = UBOSkinningAnimation::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_ANIMATION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOSkinning { - static constexpr uint JOINTS_OFFSET = 0; - static constexpr uint COUNT = UBOSkinning::JOINTS_OFFSET + JOINT_UNIFORM_CAPACITY * 12; - static constexpr uint SIZE = UBOSkinning::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); + static constexpr uint JOINTS_OFFSET = 0; + static constexpr uint COUNT = UBOSkinning::JOINTS_OFFSET + JOINT_UNIFORM_CAPACITY * 12; + static constexpr uint SIZE = UBOSkinning::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOMorph { - static constexpr uint MAX_MORPH_TARGET_COUNT = 60; - static constexpr uint OFFSET_OF_WEIGHTS = 0; - static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH = 4 * MAX_MORPH_TARGET_COUNT; - static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT = OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH + 4; - static constexpr uint OFFSET_OF_VERTICES_COUNT = OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT + 4; - static const uint COUNT_BASE_4_BYTES; - static const uint SIZE; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_MORPH); + static constexpr uint MAX_MORPH_TARGET_COUNT = 60; + static constexpr uint OFFSET_OF_WEIGHTS = 0; + static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH = 4 * MAX_MORPH_TARGET_COUNT; + static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT = OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH + 4; + static constexpr uint OFFSET_OF_VERTICES_COUNT = OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT + 4; + static const uint COUNT_BASE_4_BYTES; + static const uint SIZE; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_MORPH); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; enum class CC_DLL ForwardStagePriority { FORWARD = 10, - UI = 20 + UI = 20 }; enum class CC_DLL ForwardFlowPriority { - SHADOW = 0, + SHADOW = 0, FORWARD = 1, - UI = 10, + UI = 10, }; enum class CC_DLL RenderFlowTag { @@ -306,68 +309,68 @@ enum class CC_DLL RenderFlowTag { }; enum class CC_DLL DeferredStagePriority { - GBUFFER = 10, - LIGHTING = 15, + GBUFFER = 10, + LIGHTING = 15, TRANSPARANT = 18, POSTPROCESS = 19, - UI = 20 + UI = 20 }; enum class CC_DLL DeferredFlowPriority { - SHADOW = 0, - GBUFFER = 1, + SHADOW = 0, + GBUFFER = 1, LIGHTING = 5, - UI = 10 + UI = 10 }; struct CC_DLL UBOGlobal : public Object { - static constexpr uint TIME_OFFSET = 0; - static constexpr uint SCREEN_SIZE_OFFSET = UBOGlobal::TIME_OFFSET + 4; - static constexpr uint NATIVE_SIZE_OFFSET = UBOGlobal::SCREEN_SIZE_OFFSET + 4; - static constexpr uint COUNT = UBOGlobal::NATIVE_SIZE_OFFSET + 4; - static constexpr uint SIZE = UBOGlobal::COUNT * 4; - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_GLOBAL); + static constexpr uint TIME_OFFSET = 0; + static constexpr uint SCREEN_SIZE_OFFSET = UBOGlobal::TIME_OFFSET + 4; + static constexpr uint NATIVE_SIZE_OFFSET = UBOGlobal::SCREEN_SIZE_OFFSET + 4; + static constexpr uint COUNT = UBOGlobal::NATIVE_SIZE_OFFSET + 4; + static constexpr uint SIZE = UBOGlobal::COUNT * 4; + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_GLOBAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOCamera : public Object { - static constexpr uint MAT_VIEW_OFFSET = 0; - static constexpr uint MAT_VIEW_INV_OFFSET = UBOCamera::MAT_VIEW_OFFSET + 16; - static constexpr uint MAT_PROJ_OFFSET = UBOCamera::MAT_VIEW_INV_OFFSET + 16; - static constexpr uint MAT_PROJ_INV_OFFSET = UBOCamera::MAT_PROJ_OFFSET + 16; - static constexpr uint MAT_VIEW_PROJ_OFFSET = UBOCamera::MAT_PROJ_INV_OFFSET + 16; - static constexpr uint MAT_VIEW_PROJ_INV_OFFSET = UBOCamera::MAT_VIEW_PROJ_OFFSET + 16; - static constexpr uint CAMERA_POS_OFFSET = UBOCamera::MAT_VIEW_PROJ_INV_OFFSET + 16; - static constexpr uint SCREEN_SCALE_OFFSET = UBOCamera::CAMERA_POS_OFFSET + 4; - static constexpr uint EXPOSURE_OFFSET = UBOCamera::SCREEN_SCALE_OFFSET + 4; - static constexpr uint MAIN_LIT_DIR_OFFSET = UBOCamera::EXPOSURE_OFFSET + 4; - static constexpr uint MAIN_LIT_COLOR_OFFSET = UBOCamera::MAIN_LIT_DIR_OFFSET + 4; - static constexpr uint AMBIENT_SKY_OFFSET = UBOCamera::MAIN_LIT_COLOR_OFFSET + 4; - static constexpr uint AMBIENT_GROUND_OFFSET = UBOCamera::AMBIENT_SKY_OFFSET + 4; - static constexpr uint GLOBAL_FOG_COLOR_OFFSET = UBOCamera::AMBIENT_GROUND_OFFSET + 4; - static constexpr uint GLOBAL_FOG_BASE_OFFSET = UBOCamera::GLOBAL_FOG_COLOR_OFFSET + 4; - static constexpr uint GLOBAL_FOG_ADD_OFFSET = UBOCamera::GLOBAL_FOG_BASE_OFFSET + 4; - static constexpr uint COUNT = UBOCamera::GLOBAL_FOG_ADD_OFFSET + 4; - static constexpr uint SIZE = UBOCamera::COUNT * 4; - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_CAMERA); + static constexpr uint MAT_VIEW_OFFSET = 0; + static constexpr uint MAT_VIEW_INV_OFFSET = UBOCamera::MAT_VIEW_OFFSET + 16; + static constexpr uint MAT_PROJ_OFFSET = UBOCamera::MAT_VIEW_INV_OFFSET + 16; + static constexpr uint MAT_PROJ_INV_OFFSET = UBOCamera::MAT_PROJ_OFFSET + 16; + static constexpr uint MAT_VIEW_PROJ_OFFSET = UBOCamera::MAT_PROJ_INV_OFFSET + 16; + static constexpr uint MAT_VIEW_PROJ_INV_OFFSET = UBOCamera::MAT_VIEW_PROJ_OFFSET + 16; + static constexpr uint CAMERA_POS_OFFSET = UBOCamera::MAT_VIEW_PROJ_INV_OFFSET + 16; + static constexpr uint SCREEN_SCALE_OFFSET = UBOCamera::CAMERA_POS_OFFSET + 4; + static constexpr uint EXPOSURE_OFFSET = UBOCamera::SCREEN_SCALE_OFFSET + 4; + static constexpr uint MAIN_LIT_DIR_OFFSET = UBOCamera::EXPOSURE_OFFSET + 4; + static constexpr uint MAIN_LIT_COLOR_OFFSET = UBOCamera::MAIN_LIT_DIR_OFFSET + 4; + static constexpr uint AMBIENT_SKY_OFFSET = UBOCamera::MAIN_LIT_COLOR_OFFSET + 4; + static constexpr uint AMBIENT_GROUND_OFFSET = UBOCamera::AMBIENT_SKY_OFFSET + 4; + static constexpr uint GLOBAL_FOG_COLOR_OFFSET = UBOCamera::AMBIENT_GROUND_OFFSET + 4; + static constexpr uint GLOBAL_FOG_BASE_OFFSET = UBOCamera::GLOBAL_FOG_COLOR_OFFSET + 4; + static constexpr uint GLOBAL_FOG_ADD_OFFSET = UBOCamera::GLOBAL_FOG_BASE_OFFSET + 4; + static constexpr uint COUNT = UBOCamera::GLOBAL_FOG_ADD_OFFSET + 4; + static constexpr uint SIZE = UBOCamera::COUNT * 4; + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_CAMERA); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOShadow : public Object { - static constexpr uint MAT_LIGHT_PLANE_PROJ_OFFSET = 0; - static constexpr uint MAT_LIGHT_VIEW_PROJ_OFFSET = UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET + 16; - static constexpr uint SHADOW_COLOR_OFFSET = UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET + 16; - static constexpr uint SHADOW_INFO_OFFSET = UBOShadow::SHADOW_COLOR_OFFSET + 4; - static constexpr uint COUNT = UBOShadow::SHADOW_INFO_OFFSET + 4; - static constexpr uint SIZE = UBOShadow::COUNT * 4; - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_SHADOW); + static constexpr uint MAT_LIGHT_PLANE_PROJ_OFFSET = 0; + static constexpr uint MAT_LIGHT_VIEW_PROJ_OFFSET = UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET + 16; + static constexpr uint SHADOW_COLOR_OFFSET = UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET + 16; + static constexpr uint SHADOW_INFO_OFFSET = UBOShadow::SHADOW_COLOR_OFFSET + 4; + static constexpr uint COUNT = UBOShadow::SHADOW_INFO_OFFSET + 4; + static constexpr uint SIZE = UBOShadow::COUNT * 4; + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_SHADOW); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; class CC_DLL SamplerLib : public Object { @@ -376,28 +379,28 @@ public: }; struct CC_DLL DescriptorSetLayoutInfos { - gfx::DescriptorSetLayoutBindingList bindings; - unordered_map blocks; + gfx::DescriptorSetLayoutBindingList bindings; + unordered_map blocks; unordered_map samplers; }; extern CC_DLL DescriptorSetLayoutInfos globalDescriptorSetLayout; extern CC_DLL DescriptorSetLayoutInfos localDescriptorSetLayout; -uint genSamplerHash(const gfx::SamplerInfo &); +uint genSamplerHash(const gfx::SamplerInfo &); gfx::Sampler *getSampler(uint hash); enum class LayerList : uint { - NONE = 0, + NONE = 0, IGNORE_RAYCAST = (1 << 20), - GIZMOS = (1 << 21), - EDITOR = (1 << 22), - UI_3D = (1 << 23), - SCENE_GIZMO = (1 << 24), - UI_2D = (1 << 25), + GIZMOS = (1 << 21), + EDITOR = (1 << 22), + UI_3D = (1 << 23), + SCENE_GIZMO = (1 << 24), + UI_2D = (1 << 25), PROFILER = (1 << 28), - DEFAULT = (1 << 30), - ALL = 0xffffffff, + DEFAULT = (1 << 30), + ALL = 0xffffffff, }; //TODO @@ -405,7 +408,7 @@ const uint CAMERA_DEFAULT_MASK = ~static_cast(LayerList::UI_2D) & ~static_ //constexpr CAMERA_DEFAULT_MASK = Layers.makeMaskExclude([Layers.BitMask.UI_2D, Layers.BitMask.GIZMOS, Layers.BitMask.EDITOR, // Layers.BitMask.SCENE_GIZMO, Layers.BitMask.PROFILER]); -uint nextPow2(uint val); +uint nextPow2(uint val); enum class CC_DLL SetIndex { GLOBAL, MATERIAL, @@ -415,106 +418,106 @@ extern CC_DLL uint GLOBAL_SET; extern CC_DLL uint MATERIAL_SET; extern CC_DLL uint LOCAL_SET; -extern CC_DLL uint SKYBOX_FLAG; +extern CC_DLL uint SKYBOX_FLAG; extern CC_DLL DescriptorSetLayoutInfos globalDescriptorSetLayout; extern CC_DLL DescriptorSetLayoutInfos localDescriptorSetLayout; struct CC_DLL SHADOWMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SHADOWMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SHADOWMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SAMPLERGBUFFERALBEDOMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_ALBEDOMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_ALBEDOMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SAMPLERGBUFFERPOSITIONMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_POSITIONMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_POSITIONMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SAMPLERGBUFFERNORMALMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_NORMALMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_NORMALMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SAMPLERGBUFFEREMISSIVEMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_EMISSIVEMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_EMISSIVEMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SAMPLERLIGHTINGRESULTMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_LIGHTING_RESULTMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_LIGHTING_RESULTMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL ENVIRONMENT : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_ENVIRONMENT); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_ENVIRONMENT); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SPOT_LIGHTING_MAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SPOT_LIGHTING_MAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SPOT_LIGHTING_MAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL JOINT_TEXTURE : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_JOINTS); + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_JOINTS); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL POSITION_MORPH : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_POSITION); + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_POSITION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL NORMAL_MORPH : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_NORMAL); + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_NORMAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL TANGENT_MORPH : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_TANGENT); + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_TANGENT); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL LIGHTMAP_TEXTURE : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_LIGHTMAP); + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_LIGHTMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL SPRITE_TEXTURE : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_SPRITE); + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_SPRITE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSamplerTexture LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; } // namespace pipeline } // namespace cc diff --git a/native/cocos/renderer/pipeline/InstancedBuffer.cpp b/native/cocos/renderer/pipeline/InstancedBuffer.cpp index 35a87b78ed..7d5daf83bc 100644 --- a/native/cocos/renderer/pipeline/InstancedBuffer.cpp +++ b/native/cocos/renderer/pipeline/InstancedBuffer.cpp @@ -24,17 +24,17 @@ ****************************************************************************/ #include "InstancedBuffer.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXInputAssembler.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXInputAssembler.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { map> InstancedBuffer::_buffers; -InstancedBuffer *InstancedBuffer::get(uint pass) { +InstancedBuffer * InstancedBuffer::get(uint pass) { return InstancedBuffer::get(pass, 0); } InstancedBuffer *InstancedBuffer::get(uint pass, uint extraKey) { @@ -63,13 +63,13 @@ void InstancedBuffer::destroy() { } void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel, uint passIdx) { - uint stride = 0; + uint stride = 0; const auto instancedBuffer = model->getInstancedBuffer(&stride); if (!stride) return; // we assume per-instance attributes are always present - auto sourceIA = subModel->getInputAssembler(); - auto lightingMap = subModel->getDescriptorSet()->getTexture(LIGHTMAP_TEXTURE::BINDING); - auto shader = subModel->getShader(passIdx); + auto sourceIA = subModel->getInputAssembler(); + auto lightingMap = subModel->getDescriptorSet()->getTexture(LIGHTMAP_TEXTURE::BINDING); + auto shader = subModel->getShader(passIdx); auto descriptorSet = subModel->getDescriptorSet(); for (int i = 0; i < _instances.size(); i++) { auto &instance = _instances[i]; @@ -89,7 +89,7 @@ void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel instance.capacity <<= 1; const auto newSize = instance.stride * instance.capacity; const auto oldData = instance.data; - instance.data = (uint8_t *)CC_MALLOC(newSize); + instance.data = (uint8_t *)CC_MALLOC(newSize); memcpy(instance.data, oldData, instance.vb->getSize()); instance.vb->resize(newSize); CC_FREE(oldData); @@ -107,7 +107,7 @@ void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel // Create a new instance auto newSize = stride * INITIAL_CAPACITY; - auto vb = _device->createBuffer({ + auto vb = _device->createBuffer({ gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, static_cast(newSize), @@ -115,14 +115,14 @@ void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel }); auto vertexBuffers = sourceIA->getVertexBuffers(); - auto attributes = sourceIA->getAttributes(); - auto indexBuffer = sourceIA->getIndexBuffer(); + auto attributes = sourceIA->getAttributes(); + auto indexBuffer = sourceIA->getIndexBuffer(); const auto attributesID = model->getInstancedAttributeID(); - const auto lenght = attributesID[0]; + const auto lenght = attributesID[0]; for (auto i = 1; i <= lenght; i++) { - const auto attribute = model->getInstancedAttribute(attributesID[i]); - gfx::Attribute newAttr = {attribute->name, attribute->format, attribute->isNormalized, static_cast(vertexBuffers.size()), true, attribute->location}; + const auto attribute = model->getInstancedAttribute(attributesID[i]); + gfx::Attribute newAttr = {attribute->name, attribute->format, attribute->isNormalized, static_cast(vertexBuffers.size()), true, attribute->location}; attributes.emplace_back(std::move(newAttr)); } @@ -130,8 +130,8 @@ void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel memcpy(data, instancedBuffer, stride); vertexBuffers.emplace_back(vb); gfx::InputAssemblerInfo iaInfo = {attributes, vertexBuffers, indexBuffer}; - auto ia = _device->createInputAssembler(iaInfo); - InstancedItem item = {1, INITIAL_CAPACITY, vb, data, ia, stride, shader, descriptorSet, lightingMap}; + auto ia = _device->createInputAssembler(iaInfo); + InstancedItem item = {1, INITIAL_CAPACITY, vb, data, ia, stride, shader, descriptorSet, lightingMap}; _instances.emplace_back(std::move(item)); _hasPendingModels = true; } diff --git a/native/cocos/renderer/pipeline/PipelineSceneData.cpp b/native/cocos/renderer/pipeline/PipelineSceneData.cpp index 5321660d19..35ec53a65f 100644 --- a/native/cocos/renderer/pipeline/PipelineSceneData.cpp +++ b/native/cocos/renderer/pipeline/PipelineSceneData.cpp @@ -24,9 +24,9 @@ ****************************************************************************/ #include "PipelineSceneData.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/PipelineStateManager.cpp b/native/cocos/renderer/pipeline/PipelineStateManager.cpp index 6c3bc4cc55..4e564ff134 100644 --- a/native/cocos/renderer/pipeline/PipelineStateManager.cpp +++ b/native/cocos/renderer/pipeline/PipelineStateManager.cpp @@ -24,29 +24,29 @@ ****************************************************************************/ #include "PipelineStateManager.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXInputAssembler.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXShader.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXInputAssembler.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXShader.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { map PipelineStateManager::_PSOHashMap; -gfx::PipelineState *PipelineStateManager::getOrCreatePipelineState(const PassView *pass, - gfx::Shader *shader, +gfx::PipelineState * PipelineStateManager::getOrCreatePipelineState(const PassView * pass, + gfx::Shader * shader, gfx::InputAssembler *inputAssembler, - gfx::RenderPass *renderPass) { - const auto passHash = pass->hash; + gfx::RenderPass * renderPass) { + const auto passHash = pass->hash; const auto renderPassHash = renderPass->getHash(); - const auto iaHash = inputAssembler->getAttributesHash(); - const auto shaderID = shader->getID(); - const auto hash = passHash ^ renderPassHash ^ iaHash ^ shaderID; + const auto iaHash = inputAssembler->getAttributesHash(); + const auto shaderID = shader->getID(); + const auto hash = passHash ^ renderPassHash ^ iaHash ^ shaderID; auto pso = _PSOHashMap[hash]; if (!pso) { - auto pipelineLayout = pass->getPipelineLayout(); - gfx::PipelineStateInfo info = { + auto pipelineLayout = pass->getPipelineLayout(); + gfx::PipelineStateInfo info = { shader, pipelineLayout, renderPass, @@ -57,17 +57,17 @@ gfx::PipelineState *PipelineStateManager::getOrCreatePipelineState(const PassVie pass->getPrimitive(), pass->getDynamicState()}; - pso = gfx::Device::getInstance()->createPipelineState(std::move(info)); + pso = gfx::Device::getInstance()->createPipelineState(std::move(info)); _PSOHashMap[hash] = pso; } return pso; } -gfx::PipelineState *PipelineStateManager::getOrCreatePipelineStateByJS(uint32_t passHandle, - gfx::Shader *shader, +gfx::PipelineState *PipelineStateManager::getOrCreatePipelineStateByJS(uint32_t passHandle, + gfx::Shader * shader, gfx::InputAssembler *inputAssembler, - gfx::RenderPass *renderPass) { + gfx::RenderPass * renderPass) { const auto pass = GET_PASS(passHandle); CC_ASSERT(pass); return PipelineStateManager::getOrCreatePipelineState(pass, shader, inputAssembler, renderPass); diff --git a/native/cocos/renderer/pipeline/PipelineStateManager.h b/native/cocos/renderer/pipeline/PipelineStateManager.h index c38d7919b1..7439fc45f9 100644 --- a/native/cocos/renderer/pipeline/PipelineStateManager.h +++ b/native/cocos/renderer/pipeline/PipelineStateManager.h @@ -25,16 +25,11 @@ #pragma once -#include "core/CoreStd.h" +#include "gfx-base/GFXDef.h" namespace cc { -namespace gfx { -class InputAssembler; -class PipelineState; -class RenderPass; -}; // namespace gfx - namespace pipeline { + struct PassView; class CC_DLL PipelineStateManager { diff --git a/native/cocos/renderer/pipeline/PipelineUBO.cpp b/native/cocos/renderer/pipeline/PipelineUBO.cpp index 23a6e6f298..9ce7b11c06 100644 --- a/native/cocos/renderer/pipeline/PipelineUBO.cpp +++ b/native/cocos/renderer/pipeline/PipelineUBO.cpp @@ -26,7 +26,7 @@ #include "PipelineUBO.h" #include "platform/Application.h" #include "SceneCulling.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXDevice.h" #include "RenderPipeline.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp b/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp index 042bd1bfe8..96954291f5 100644 --- a/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp +++ b/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp @@ -33,11 +33,11 @@ #include "PipelineStateManager.h" #include "RenderBatchedQueue.h" #include "RenderInstancedQueue.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" #include "helper/SharedMemory.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXShader.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXShader.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/PlanarShadowQueue.h b/native/cocos/renderer/pipeline/PlanarShadowQueue.h index 9a2ac5cbb9..b02b19485f 100644 --- a/native/cocos/renderer/pipeline/PlanarShadowQueue.h +++ b/native/cocos/renderer/pipeline/PlanarShadowQueue.h @@ -24,7 +24,7 @@ ****************************************************************************/ #pragma once -#include "core/CoreStd.h" +#include "base/CoreStd.h" namespace cc { namespace gfx { diff --git a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp index a7134b3f37..d9fd48cebb 100644 --- a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp @@ -30,20 +30,19 @@ #include "PipelineStateManager.h" #include "RenderAdditiveLightQueue.h" -#include "Application.h" +#include "Define.h" #include "RenderBatchedQueue.h" #include "RenderInstancedQueue.h" -#include "forward/ForwardPipeline.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "helper/SharedMemory.h" -#include "gfx/GFXSampler.h" -#include "gfx/GFXTexture.h" -#include "Define.h" #include "SceneCulling.h" +#include "forward/ForwardPipeline.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXTexture.h" +#include "helper/SharedMemory.h" namespace cc { namespace pipeline { @@ -51,17 +50,17 @@ namespace pipeline { RenderAdditiveLightQueue::RenderAdditiveLightQueue(RenderPipeline *pipeline) : _pipeline(static_cast(pipeline)), _instancedQueue(CC_NEW(RenderInstancedQueue)), _batchedQueue(CC_NEW(RenderBatchedQueue)) { - auto *device = gfx::Device::getInstance(); - const auto alignment = device->getCapabilities().uboOffsetAlignment; - _lightBufferStride = ((UBOForwardLight::SIZE + alignment - 1) / alignment) * alignment; + auto * device = gfx::Device::getInstance(); + const auto alignment = device->getCapabilities().uboOffsetAlignment; + _lightBufferStride = ((UBOForwardLight::SIZE + alignment - 1) / alignment) * alignment; _lightBufferElementCount = _lightBufferStride / sizeof(float); - _lightBuffer = device->createBuffer({ + _lightBuffer = device->createBuffer({ gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, _lightBufferStride * _lightBufferCount, _lightBufferStride, }); - _firstLightBufferView = device->createBuffer({_lightBuffer, 0, UBOForwardLight::SIZE}); + _firstLightBufferView = device->createBuffer({_lightBuffer, 0, UBOForwardLight::SIZE}); _lightBufferData.resize(_lightBufferElementCount * _lightBufferCount); _dynamicOffsets.resize(1, 0); @@ -74,7 +73,7 @@ RenderAdditiveLightQueue::RenderAdditiveLightQueue(RenderPipeline *pipeline) : _ gfx::Address::CLAMP, }; const auto shadowMapSamplerHash = genSamplerHash(std::move(info)); - _sampler = getSampler(shadowMapSamplerHash); + _sampler = getSampler(shadowMapSamplerHash); _phaseID = getPhaseID("forward-add"); @@ -92,23 +91,23 @@ void RenderAdditiveLightQueue::recordCommandBuffer(gfx::Device *device, gfx::Ren _batchedQueue->recordCommandBuffer(device, renderPass, cmdBuffer); for (const auto &lightPass : _lightPasses) { - const auto subModel = lightPass.subModel; - const auto pass = lightPass.pass; + const auto subModel = lightPass.subModel; + const auto pass = lightPass.pass; const auto &dynamicOffsets = lightPass.dynamicOffsets; - auto *shader = lightPass.shader; - const auto lights = lightPass.lights; - auto *ia = subModel->getInputAssembler(); - auto *pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); - auto *descriptorSet = subModel->getDescriptorSet(); + auto * shader = lightPass.shader; + const auto lights = lightPass.lights; + auto * ia = subModel->getInputAssembler(); + auto * pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); + auto * descriptorSet = subModel->getDescriptorSet(); cmdBuffer->bindPipelineState(pso); cmdBuffer->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); cmdBuffer->bindInputAssembler(ia); for (size_t i = 0; i < dynamicOffsets.size(); ++i) { - const auto *light = lights[i]; - auto *globalDescriptorSet = getOrCreateDescriptorSet(light); - _dynamicOffsets[0] = dynamicOffsets[i]; + const auto *light = lights[i]; + auto * globalDescriptorSet = getOrCreateDescriptorSet(light); + _dynamicOffsets[0] = dynamicOffsets[i]; cmdBuffer->bindDescriptorSet(GLOBAL_SET, globalDescriptorSet); cmdBuffer->bindDescriptorSet(LOCAL_SET, descriptorSet, _dynamicOffsets); cmdBuffer->draw(ia); @@ -135,7 +134,7 @@ void RenderAdditiveLightQueue::gatherLightPasses(const Camera *camera, gfx::Comm _lightIndices.clear(); for (size_t i = 0; i < _validLights.size(); i++) { - const auto light = _validLights[i]; + const auto light = _validLights[i]; const bool isCulled = cullingLight(light, model); if (!isCulled) { _lightIndices.emplace_back(i); @@ -144,13 +143,13 @@ void RenderAdditiveLightQueue::gatherLightPasses(const Camera *camera, gfx::Comm if (_lightIndices.empty()) continue; const auto subModelArrayID = model->getSubModelID(); - const auto subModelCount = subModelArrayID[0]; + const auto subModelCount = subModelArrayID[0]; for (unsigned j = 1; j <= subModelCount; j++) { const auto lightPassIdx = lightPassIndices[j - 1]; if (lightPassIdx == UINT_MAX) continue; - const auto subModel = model->getSubModelView(subModelArrayID[j]); - const auto pass = subModel->getPassView(lightPassIdx); - auto descriptorSet = subModel->getDescriptorSet(); + const auto subModel = model->getSubModelView(subModelArrayID[j]); + const auto pass = subModel->getPassView(lightPassIdx); + auto descriptorSet = subModel->getDescriptorSet(); descriptorSet->bindBuffer(UBOForwardLight::BINDING, _firstLightBufferView); descriptorSet->update(); @@ -187,11 +186,11 @@ void RenderAdditiveLightQueue::clear() { _lightPasses.clear(); } -void RenderAdditiveLightQueue::gatherValidLights(const Camera* camera) { - const auto scene = camera->getScene(); +void RenderAdditiveLightQueue::gatherValidLights(const Camera *camera) { + const auto scene = camera->getScene(); const auto sphereLightArrayID = scene->getSphereLightArrayID(); - auto count = sphereLightArrayID ? sphereLightArrayID[0] : 0; - Sphere sphere; + auto count = sphereLightArrayID ? sphereLightArrayID[0] : 0; + Sphere sphere; for (unsigned i = 1; i <= count; i++) { const auto light = scene->getSphereLight(sphereLightArrayID[i]); sphere.setCenter(light->position); @@ -202,7 +201,7 @@ void RenderAdditiveLightQueue::gatherValidLights(const Camera* camera) { } } const auto spotLightArrayID = scene->getSpotLightArrayID(); - count = spotLightArrayID ? spotLightArrayID[0] : 0; + count = spotLightArrayID ? spotLightArrayID[0] : 0; for (unsigned i = 1; i <= count; i++) { const auto light = scene->getSpotLight(spotLightArrayID[i]); sphere.setCenter(light->position); @@ -241,11 +240,11 @@ void RenderAdditiveLightQueue::addRenderQueue(const PassView *pass, const SubMod _batchedQueue->add(buffer); } } else { // standard draw - const auto count = _lightIndices.size(); + const auto count = _lightIndices.size(); AdditiveLightPass lightPass; lightPass.subModel = subModel; - lightPass.pass = pass; - lightPass.shader = subModel->getShader(lightPassIdx); + lightPass.pass = pass; + lightPass.shader = subModel->getShader(lightPassIdx); lightPass.dynamicOffsets.resize(count); for (unsigned idx = 0; idx < count; idx++) { const auto lightIdx = _lightIndices[idx]; @@ -258,10 +257,10 @@ void RenderAdditiveLightQueue::addRenderQueue(const PassView *pass, const SubMod } void RenderAdditiveLightQueue::updateUBOs(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { - const auto exposure = camera->exposure; + const auto exposure = camera->exposure; const auto validLightCount = _validLights.size(); - const auto sceneData = _pipeline->getPipelineSceneData(); - const auto sharedData = sceneData->getSharedData(); + const auto sceneData = _pipeline->getPipelineSceneData(); + const auto sharedData = sceneData->getSharedData(); if (validLightCount > _lightBufferCount) { _firstLightBufferView->destroy(); @@ -274,19 +273,19 @@ void RenderAdditiveLightQueue::updateUBOs(const Camera *camera, gfx::CommandBuff for (unsigned l = 0, offset = 0; l < validLightCount; l++, offset += _lightBufferElementCount) { const auto light = _validLights[l]; - auto index = offset + UBOForwardLight::LIGHT_POS_OFFSET; + auto index = offset + UBOForwardLight::LIGHT_POS_OFFSET; _lightBufferData[index++] = light->position.x; _lightBufferData[index++] = light->position.y; - _lightBufferData[index] = light->position.z; + _lightBufferData[index] = light->position.z; - index = offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET; + index = offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET; _lightBufferData[index++] = light->size; - _lightBufferData[index] = light->range; + _lightBufferData[index] = light->range; - index = offset + UBOForwardLight::LIGHT_COLOR_OFFSET; + index = offset + UBOForwardLight::LIGHT_COLOR_OFFSET; const auto &color = light->color; if (light->useColorTemperature) { - const auto &tempRGB = light->colorTemperatureRGB; + const auto &tempRGB = light->colorTemperatureRGB; _lightBufferData[index++] = color.x * tempRGB.x; _lightBufferData[index++] = color.y * tempRGB.y; _lightBufferData[index++] = color.z * tempRGB.z; @@ -303,17 +302,17 @@ void RenderAdditiveLightQueue::updateUBOs(const Camera *camera, gfx::CommandBuff switch (light->getType()) { case LightType::SPHERE: - _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 0; + _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 0; _lightBufferData[offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = 0; break; case LightType::SPOT: - _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 1.0f; + _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 1.0f; _lightBufferData[offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = light->spotAngle; - index = offset + UBOForwardLight::LIGHT_DIR_OFFSET; + index = offset + UBOForwardLight::LIGHT_DIR_OFFSET; _lightBufferData[index++] = light->direction.x; _lightBufferData[index++] = light->direction.y; - _lightBufferData[index] = light->direction.z; + _lightBufferData[index] = light->direction.z; break; default: break; @@ -324,15 +323,17 @@ void RenderAdditiveLightQueue::updateUBOs(const Camera *camera, gfx::CommandBuff } void RenderAdditiveLightQueue::updateLightDescriptorSet(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { - const auto sceneData = _pipeline->getPipelineSceneData(); - auto *shadowInfo = sceneData->getSharedData()->getShadows(); - const auto scene = camera->getScene(); - const Light *mainLight = nullptr; + const auto sceneData = _pipeline->getPipelineSceneData(); + auto * shadowInfo = sceneData->getSharedData()->getShadows(); + const auto scene = camera->getScene(); + const Light *mainLight = nullptr; if (scene->mainLightID) mainLight = scene->getMainLight(); for (const auto *light : _validLights) { auto *descriptorSet = getOrCreateDescriptorSet(light); - if (!descriptorSet) { return; } + if (!descriptorSet) { + return; + } descriptorSet->bindSampler(SHADOWMAP::BINDING, _sampler); descriptorSet->bindSampler(SPOT_LIGHTING_MAP::BINDING, _sampler); @@ -398,14 +399,14 @@ bool RenderAdditiveLightQueue::getLightPassIndex(const ModelView *model, vector< bool hasValidLightPass = false; const auto subModelArrayID = model->getSubModelID(); - const auto count = subModelArrayID[0]; + const auto count = subModelArrayID[0]; for (unsigned i = 1; i <= count; i++) { - const auto subModel = model->getSubModelView(subModelArrayID[i]); - uint lightPassIndex = UINT_MAX; + const auto subModel = model->getSubModelView(subModelArrayID[i]); + uint lightPassIndex = UINT_MAX; for (unsigned passIdx = 0; passIdx < subModel->passCount; passIdx++) { const auto pass = subModel->getPassView(passIdx); if (pass->phase == _phaseID) { - lightPassIndex = passIdx; + lightPassIndex = passIdx; hasValidLightPass = true; break; } @@ -418,7 +419,7 @@ bool RenderAdditiveLightQueue::getLightPassIndex(const ModelView *model, vector< gfx::DescriptorSet *RenderAdditiveLightQueue::getOrCreateDescriptorSet(const Light *light) { if (!_descriptorSetMap.count(light)) { - auto *device = gfx::Device::getInstance(); + auto * device = gfx::Device::getInstance(); gfx::DescriptorSet *descriptorSet = device->createDescriptorSet({_pipeline->getDescriptorSetLayout()}); auto globalUBO = device->createBuffer({ diff --git a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h index ac14ad4dfd..da0100434e 100644 --- a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h +++ b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h @@ -25,7 +25,7 @@ #pragma once -#include "core/CoreStd.h" +#include "base/CoreStd.h" #include "helper/SharedMemory.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp b/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp index 0e23c064c6..d4d96d5620 100644 --- a/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp @@ -26,8 +26,7 @@ #include "RenderBatchedQueue.h" #include "BatchedBuffer.h" #include "PipelineStateManager.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXBase.h" #include "helper/SharedMemory.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/RenderBatchedQueue.h b/native/cocos/renderer/pipeline/RenderBatchedQueue.h index 3bbdebacce..a46128093c 100644 --- a/native/cocos/renderer/pipeline/RenderBatchedQueue.h +++ b/native/cocos/renderer/pipeline/RenderBatchedQueue.h @@ -25,7 +25,8 @@ #pragma once -#include "core/CoreStd.h" +#include "gfx-base/GFXDef.h" +#include "base/Object.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp b/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp index 3e7acad8b2..23a95d7985 100644 --- a/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp @@ -26,7 +26,7 @@ #include "RenderInstancedQueue.h" #include "InstancedBuffer.h" #include "PipelineStateManager.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" #include "helper/SharedMemory.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/RenderInstancedQueue.h b/native/cocos/renderer/pipeline/RenderInstancedQueue.h index f15f6b14ea..41016eb3bd 100644 --- a/native/cocos/renderer/pipeline/RenderInstancedQueue.h +++ b/native/cocos/renderer/pipeline/RenderInstancedQueue.h @@ -25,7 +25,7 @@ #pragma once -#include "core/CoreStd.h" +#include "gfx-base/GFXBase.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/RenderPipeline.cpp b/native/cocos/renderer/pipeline/RenderPipeline.cpp index 0156fa5125..3e66b99554 100644 --- a/native/cocos/renderer/pipeline/RenderPipeline.cpp +++ b/native/cocos/renderer/pipeline/RenderPipeline.cpp @@ -25,11 +25,11 @@ #include "RenderPipeline.h" #include "RenderFlow.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDescriptorSetLayout.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXTexture.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDescriptorSetLayout.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXTexture.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/RenderPipeline.h b/native/cocos/renderer/pipeline/RenderPipeline.h index 6655fa7136..c713f3ac6d 100644 --- a/native/cocos/renderer/pipeline/RenderPipeline.h +++ b/native/cocos/renderer/pipeline/RenderPipeline.h @@ -25,12 +25,12 @@ #pragma once -#include "../core/CoreStd.h" #include "Define.h" +#include "PipelineSceneData.h" +#include "PipelineUBO.h" +#include "base/CoreStd.h" #include "helper/DefineMap.h" #include "helper/SharedMemory.h" -#include "PipelineUBO.h" -#include "PipelineSceneData.h" namespace cc { namespace gfx { @@ -43,7 +43,7 @@ namespace pipeline { class DefineMap; struct CC_DLL RenderPipelineInfo { - uint tag = 0; + uint tag = 0; RenderFlowList flows; }; @@ -62,10 +62,10 @@ public: void setPipelineSharedSceneData(uint handle); CC_INLINE const RenderFlowList &getFlows() const { return _flows; } - CC_INLINE uint getTag() const { return _tag; } + CC_INLINE uint getTag() const { return _tag; } CC_INLINE const map &getGlobalBindings() const { return _globalBindings; } CC_INLINE const DefineMap &getMacros() const { return _macros; } - CC_INLINE void setValue(const String &name, bool value) { _macros.setValue(name, value); } + CC_INLINE void setValue(const String &name, bool value) { _macros.setValue(name, value); } CC_INLINE gfx::DescriptorSet *getDescriptorSet() const { return _descriptorSet; } CC_INLINE gfx::DescriptorSetLayout *getDescriptorSetLayout() const { return _descriptorSetLayout; } CC_INLINE gfx::Texture *getDefaultTexture() const { return _defaultTexture; } @@ -76,19 +76,19 @@ public: protected: static RenderPipeline *_instance; - void setDescriptorSetLayout(); + void setDescriptorSetLayout(); - gfx::CommandBufferList _commandBuffers; - RenderFlowList _flows; + gfx::CommandBufferList _commandBuffers; + RenderFlowList _flows; map _globalBindings; - DefineMap _macros; - uint _tag = 0; + DefineMap _macros; + uint _tag = 0; - gfx::Device *_device = nullptr; + gfx::Device * _device = nullptr; gfx::DescriptorSetLayout *_descriptorSetLayout = nullptr; - gfx::DescriptorSet *_descriptorSet = nullptr; - PipelineUBO *_pipelineUBO = nullptr; - PipelineSceneData *_pipelineSceneData = nullptr; + gfx::DescriptorSet * _descriptorSet = nullptr; + PipelineUBO * _pipelineUBO = nullptr; + PipelineSceneData * _pipelineSceneData = nullptr; // has not initBuiltinRes, // create temporary default Texture to binding sampler2d gfx::Texture *_defaultTexture = nullptr; diff --git a/native/cocos/renderer/pipeline/RenderQueue.cpp b/native/cocos/renderer/pipeline/RenderQueue.cpp index 9c52c6e33b..0dcb1fcd3f 100644 --- a/native/cocos/renderer/pipeline/RenderQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderQueue.cpp @@ -25,8 +25,8 @@ #include "RenderQueue.h" #include "PipelineStateManager.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXShader.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXShader.h" #include "helper/SharedMemory.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/RenderStage.cpp b/native/cocos/renderer/pipeline/RenderStage.cpp index 8169e90a16..c2cba49538 100644 --- a/native/cocos/renderer/pipeline/RenderStage.cpp +++ b/native/cocos/renderer/pipeline/RenderStage.cpp @@ -25,7 +25,7 @@ #include "RenderStage.h" #include "RenderQueue.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXDevice.h" namespace cc { namespace pipeline { RenderStage::RenderStage() diff --git a/native/cocos/renderer/pipeline/SceneCulling.cpp b/native/cocos/renderer/pipeline/SceneCulling.cpp index 69bcd0ed52..e9715530f2 100644 --- a/native/cocos/renderer/pipeline/SceneCulling.cpp +++ b/native/cocos/renderer/pipeline/SceneCulling.cpp @@ -30,8 +30,8 @@ #include "helper/SharedMemory.h" #include "RenderPipeline.h" #include "SceneCulling.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXDescriptorSet.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" #include "math/Quaternion.h" #include "platform/Application.h" diff --git a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp index 29fc30006c..15386149f4 100644 --- a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp +++ b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp @@ -34,9 +34,9 @@ #include "ShadowMapBatchedQueue.h" #include "forward/ForwardPipeline.h" #include "SceneCulling.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" #include "helper/SharedMemory.h" #include "PipelineSceneData.h" #include "PipelineUBO.h" diff --git a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h index 3418cdc891..b418b7f6a1 100644 --- a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h +++ b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h @@ -26,7 +26,7 @@ #pragma once #include -#include "core/CoreStd.h" +#include "base/CoreStd.h" #include "Define.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp index 3f98afde78..8303c6e77f 100644 --- a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp +++ b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp @@ -29,15 +29,15 @@ #include "LightingFlow.h" #include "../shadow/ShadowFlow.h" #include "../SceneCulling.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXQueue.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXTexture.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXSampler.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXQueue.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXTexture.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXSampler.h" #include "platform/Application.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h index 8ec8876102..1b145df7eb 100644 --- a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h +++ b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h @@ -27,10 +27,10 @@ #include -#include "../RenderPipeline.h" -#include "../helper/SharedMemory.h" -#include "../../core/gfx/GFXBuffer.h" -#include "../../core/gfx/GFXInputAssembler.h" +#include "pipeline/RenderPipeline.h" +#include "pipeline/helper/SharedMemory.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXInputAssembler.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp b/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp index 44558f0606..b8f56fe31b 100644 --- a/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp +++ b/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp @@ -26,11 +26,11 @@ #include "GbufferFlow.h" #include "DeferredPipeline.h" #include "GbufferStage.h" -#include "../SceneCulling.h" -#include "../../core/gfx/GFXDevice.h" -#include "../../core/gfx/GFXDescriptorSet.h" -#include "../../core/gfx/GFXSampler.h" -#include "gfx/GFXRenderPass.h" +#include "pipeline/SceneCulling.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXRenderPass.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp b/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp index baf5ff5fda..0acdca840b 100644 --- a/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp +++ b/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp @@ -33,10 +33,10 @@ #include "../RenderQueue.h" #include "../helper/SharedMemory.h" #include "DeferredPipeline.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXQueue.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/deferred/GbufferStage.h b/native/cocos/renderer/pipeline/deferred/GbufferStage.h index a4ed588771..b4ca668ef2 100644 --- a/native/cocos/renderer/pipeline/deferred/GbufferStage.h +++ b/native/cocos/renderer/pipeline/deferred/GbufferStage.h @@ -25,8 +25,8 @@ #pragma once -#include "../RenderStage.h" -#include "../../core/gfx/GFXFramebuffer.h" +#include "pipeline/RenderStage.h" +#include "gfx-base/GFXFramebuffer.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp b/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp index df3057c1fe..327bbaf65b 100644 --- a/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp +++ b/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp @@ -27,10 +27,10 @@ #include "DeferredPipeline.h" #include "LightingStage.h" #include "../SceneCulling.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXDevice.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/deferred/LightingStage.cpp b/native/cocos/renderer/pipeline/deferred/LightingStage.cpp index 4d3bb95aea..c53f249f84 100644 --- a/native/cocos/renderer/pipeline/deferred/LightingStage.cpp +++ b/native/cocos/renderer/pipeline/deferred/LightingStage.cpp @@ -33,11 +33,11 @@ #include "../RenderQueue.h" #include "../helper/SharedMemory.h" #include "DeferredPipeline.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXQueue.h" -#include "gfx/GFXDescriptorSet.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" +#include "gfx-base/GFXDescriptorSet.h" #include "../PipelineStateManager.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp b/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp index 9c8057d939..52df257ac3 100644 --- a/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp +++ b/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp @@ -25,11 +25,11 @@ #include "PostprocessStage.h" #include "DeferredPipeline.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXCommandBuffer.h" #include "../helper/SharedMemory.h" #include "../PipelineStateManager.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXDevice.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp b/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp index d8851994ae..7451f4ec88 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp +++ b/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp @@ -27,15 +27,15 @@ #include "../shadow/ShadowFlow.h" #include "ForwardFlow.h" #include "../SceneCulling.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXQueue.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXSampler.h" -#include "gfx/GFXTexture.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXTexture.h" #include "platform/Application.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/forward/ForwardStage.cpp b/native/cocos/renderer/pipeline/forward/ForwardStage.cpp index 6aa479ed26..7279780a0c 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardStage.cpp +++ b/native/cocos/renderer/pipeline/forward/ForwardStage.cpp @@ -33,10 +33,10 @@ #include "../RenderQueue.h" #include "../helper/SharedMemory.h" #include "ForwardPipeline.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXQueue.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" #include "UIPhase.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/forward/UIPhase.cpp b/native/cocos/renderer/pipeline/forward/UIPhase.cpp index 5264610c33..77f72edd23 100644 --- a/native/cocos/renderer/pipeline/forward/UIPhase.cpp +++ b/native/cocos/renderer/pipeline/forward/UIPhase.cpp @@ -26,7 +26,7 @@ #include "UIPhase.h" #include "ForwardPipeline.h" #include "pipeline/PipelineStateManager.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/helper/DefineMap.h b/native/cocos/renderer/pipeline/helper/DefineMap.h index b38fa93b73..a46eb4dc93 100644 --- a/native/cocos/renderer/pipeline/helper/DefineMap.h +++ b/native/cocos/renderer/pipeline/helper/DefineMap.h @@ -25,7 +25,7 @@ #pragma once -#include "../../core/CoreStd.h" +#include "base/CoreStd.h" #include "base/Macros.h" #include "cocos/bindings/jswrapper/Object.h" diff --git a/native/cocos/renderer/pipeline/helper/SharedMemory.cpp b/native/cocos/renderer/pipeline/helper/SharedMemory.cpp index 153d8eef90..372857b51e 100644 --- a/native/cocos/renderer/pipeline/helper/SharedMemory.cpp +++ b/native/cocos/renderer/pipeline/helper/SharedMemory.cpp @@ -24,32 +24,32 @@ ****************************************************************************/ #include "SharedMemory.h" -#include "../math/MathUtil.h" -#include "renderer/core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" +#include "math/MathUtil.h" namespace cc { namespace pipeline { -const se::PoolType ModelView::type = se::PoolType::MODEL; -const se::PoolType SubModelView::type = se::PoolType::SUB_MODEL; -const se::PoolType PassView::type = se::PoolType::PASS; -const se::PoolType Camera::type = se::PoolType::CAMERA; -const se::PoolType AABB::type = se::PoolType::AABB; -const se::PoolType Frustum::type = se::PoolType::FRUSTUM; -const se::PoolType Scene::type = se::PoolType::SCENE; -const se::PoolType Light::type = se::PoolType::LIGHT; -const se::PoolType Ambient::type = se::PoolType::AMBIENT; -const se::PoolType Fog::type = se::PoolType::FOG; -const se::PoolType Skybox::type = se::PoolType::SKYBOX; -const se::PoolType InstancedAttributeView::type = se::PoolType::INSTANCED_ATTRIBUTE; -const se::PoolType FlatBufferView::type = se::PoolType::FLAT_BUFFER; -const se::PoolType RenderingSubMesh::type = se::PoolType::SUB_MESH; -const se::PoolType Node::type = se::PoolType::NODE; -const se::PoolType Root::type = se::PoolType::ROOT; -const se::PoolType RenderWindow::type = se::PoolType::RENDER_WINDOW; -const se::PoolType Shadows::type = se::PoolType::SHADOW; -const se::PoolType Sphere::type = se::PoolType::SPHERE; -const se::PoolType UIBatch::type = se::PoolType::UI_BATCH; +const se::PoolType ModelView::type = se::PoolType::MODEL; +const se::PoolType SubModelView::type = se::PoolType::SUB_MODEL; +const se::PoolType PassView::type = se::PoolType::PASS; +const se::PoolType Camera::type = se::PoolType::CAMERA; +const se::PoolType AABB::type = se::PoolType::AABB; +const se::PoolType Frustum::type = se::PoolType::FRUSTUM; +const se::PoolType Scene::type = se::PoolType::SCENE; +const se::PoolType Light::type = se::PoolType::LIGHT; +const se::PoolType Ambient::type = se::PoolType::AMBIENT; +const se::PoolType Fog::type = se::PoolType::FOG; +const se::PoolType Skybox::type = se::PoolType::SKYBOX; +const se::PoolType InstancedAttributeView::type = se::PoolType::INSTANCED_ATTRIBUTE; +const se::PoolType FlatBufferView::type = se::PoolType::FLAT_BUFFER; +const se::PoolType RenderingSubMesh::type = se::PoolType::SUB_MESH; +const se::PoolType Node::type = se::PoolType::NODE; +const se::PoolType Root::type = se::PoolType::ROOT; +const se::PoolType RenderWindow::type = se::PoolType::RENDER_WINDOW; +const se::PoolType Shadows::type = se::PoolType::SHADOW; +const se::PoolType Sphere::type = se::PoolType::SPHERE; +const se::PoolType UIBatch::type = se::PoolType::UI_BATCH; const se::PoolType PipelineSharedSceneData::type = se::PoolType::PIPELINE_SHARED_SCENE_DATA; void AABB::getBoundary(cc::Vec3 &minPos, cc::Vec3 &maxPos) const { @@ -68,13 +68,13 @@ void AABB::merge(const AABB &aabb) { cc::Vec3 addP = maxP + minP; cc::Vec3 subP = maxP - minP; - center = addP * 0.5f; - halfExtents = subP * 0.5f; + center = addP * 0.5f; + halfExtents = subP * 0.5f; } int Sphere::interset(const Plane &plane) const { const float dot = plane.normal.dot(center); - const float r = radius * plane.normal.length(); + const float r = radius * plane.normal.length(); if (dot + r < plane.distance) { return -1; } @@ -103,7 +103,7 @@ void Sphere::mergePoint(const cc::Vec3 &point) { return; } - auto offset = point - center; + auto offset = point - center; auto distance = offset.length(); if (distance > radius) { @@ -124,7 +124,7 @@ void Sphere::define(const AABB &aabb) { // Calculate sphere const cc::Vec3 offset = maxPos - center; - const float dist = offset.length(); + const float dist = offset.length(); const float half = dist * 0.5f; radius += dist * 0.5f; @@ -140,7 +140,7 @@ void Sphere::mergeAABB(const AABB *aabb) { int sphere_plane(const Sphere *sphere, const Plane *plane) { const auto dot = cc::Vec3::dot(plane->normal, sphere->center); - const auto r = sphere->radius * plane->normal.length(); + const auto r = sphere->radius * plane->normal.length(); if (dot + r < plane->distance) { return -1; } else if (dot - r > plane->distance) { @@ -172,7 +172,7 @@ bool aabb_aabb(const AABB *aabb1, const AABB *aabb2) { int aabb_plane(const AABB *aabb, const Plane *plane) { const auto &halfExtents = aabb->halfExtents; - auto r = halfExtents.x * std::abs(plane->normal.x) + + auto r = halfExtents.x * std::abs(plane->normal.x) + halfExtents.y * std::abs(plane->normal.y) + halfExtents.z * std::abs(plane->normal.z); auto dot = Vec3::dot(plane->normal, aabb->center); @@ -196,13 +196,13 @@ bool aabb_frustum(const AABB *aabb, const Frustum *frustum) { gfx::BlendState *getBlendStateImpl(uint index) { static gfx::BlendState blendState; - auto buffer = SharedMemory::getBuffer(se::PoolType::BLEND_STATE, index); + auto buffer = SharedMemory::getBuffer(se::PoolType::BLEND_STATE, index); memcpy(&blendState, buffer, 24); - uint32_t targetArrayHandle = *(buffer + 6); - const auto targetsHandle = GET_BLEND_TARGET_ARRAY(targetArrayHandle); - uint32_t targetLen = targetsHandle[0]; - auto &targets = blendState.targets; + uint32_t targetArrayHandle = *(buffer + 6); + const auto targetsHandle = GET_BLEND_TARGET_ARRAY(targetArrayHandle); + uint32_t targetLen = targetsHandle[0]; + auto & targets = blendState.targets; targets.resize(targetLen); for (uint32_t i = 1; i <= targetLen; ++i) { memcpy(&targets[i - 1], GET_BLEND_TARGET(targetsHandle[i]), sizeof(gfx::BlendTarget)); diff --git a/native/cocos/renderer/pipeline/helper/SharedMemory.h b/native/cocos/renderer/pipeline/helper/SharedMemory.h index 7f29a6eaf7..035accf01f 100644 --- a/native/cocos/renderer/pipeline/helper/SharedMemory.h +++ b/native/cocos/renderer/pipeline/helper/SharedMemory.h @@ -24,7 +24,7 @@ ****************************************************************************/ #pragma once -#include "renderer/core/CoreStd.h" +#include "gfx-base/GFXDef.h" #include "bindings/dop/BufferAllocator.h" #include "bindings/dop/BufferPool.h" diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp index d4340db70f..3dc4c025d0 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp @@ -29,11 +29,11 @@ #include "../forward/ForwardPipeline.h" #include "../helper/SharedMemory.h" #include "ShadowStage.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXTexture.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXTexture.h" #include "../SceneCulling.h" namespace cc { diff --git a/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp b/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp index a9baef50d4..178405b083 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp @@ -28,10 +28,10 @@ #include "../ShadowMapBatchedQueue.h" #include "../forward/ForwardPipeline.h" #include "../helper/SharedMemory.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXTexture.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXTexture.h" #include "math/Vec2.h" namespace cc { diff --git a/native/tools/bindings-generator/generator.py b/native/tools/bindings-generator/generator.py index 50416bbe87..3f3dff2710 100755 --- a/native/tools/bindings-generator/generator.py +++ b/native/tools/bindings-generator/generator.py @@ -1662,6 +1662,17 @@ class Generator(object): implfilepath = os.path.join(self.outdir, self.out_file + ".cpp") headfilepath = os.path.join(self.outdir, self.out_file + ".h") + headLicense = '' + implLicense = '' + + licensePattern = re.compile('\/\*{5,}.*?\*{5,}\/\s*', re.S) + with open(implfilepath) as implReader: + implMatch = licensePattern.search(implReader.read()) + if implMatch: implLicense = implMatch.group() + with open(headfilepath) as headReader: + headMatch = licensePattern.search(headReader.read()) + if headMatch: headLicense = headMatch.group() + self.impl_file = open(implfilepath, "wb+") self.head_file = open(headfilepath, "wb+") @@ -1669,8 +1680,8 @@ class Generator(object): searchList=[self]) layout_c = Template(file=os.path.join(self.target, "templates", "layout_head.c"), searchList=[self]) - self.head_file.write(str(layout_h)) - self.impl_file.write(str(layout_c)) + self.head_file.write(headLicense + str(layout_h)) + self.impl_file.write(implLicense + str(layout_c)) self._parse_headers() diff --git a/native/tools/license-upgrader/generate.js b/native/tools/license-upgrader/generate.js index 27eaf5c473..a29c39cea3 100644 --- a/native/tools/license-upgrader/generate.js +++ b/native/tools/license-upgrader/generate.js @@ -1,109 +1,108 @@ -const fs = require('fs'); -const fsJetpack = require('fs-jetpack'); - -const ignoreList = [ - 'cocos/renderer/gfx-vulkan/volk.h', - 'cocos/renderer/gfx-vulkan/volk.c', - 'cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h', - 'cocos/renderer/gfx-vulkan/vk_mem_alloc.h', - 'cocos/network/Uri.h', - 'cocos/network/Uri.cpp', - 'cocos/platform/win32/inet_pton_mingw.h', - 'cocos/platform/win32/inet_pton_mingw.cpp', - // directories - 'cocos/editor-support/dragonbones', - 'cocos/editor-support/spine', - 'cocos/audio/android/', - 'cocos/math/', - 'cocos/renderer/pipeline/deferred/', - 'cocos/bindings/jswrapper/v8/debugger/', - 'cocos/bindings/auto/', -]; - -const genHeader = (history) => { - let output = `/****************************************************************************\n`; - - for (const info of history) { - const period = info.period[1] ? `${info.period[0]}-${info.period[1]}` : info.period[0]; - output += ` Copyright (c) ${period} ${info.owner}\n`; - } - - output += ` - 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 - to use Cocos Creator solely to develop games on your target platforms. You shall - 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 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -****************************************************************************/\n\n`; - - return output; -} - - -const headerRE = /\/\*{5,}.*?\*{5,}\/\s*/s; -const ownerRE = /^\s*Copyright\s*\(c\)\s*([0-9]+)(?:-([0-9]+))?\s*(.*)/gm; -const curYear = new Date().getFullYear(); -const companyName = 'Xiamen Yaji Software Co., Ltd.'; -const update = (path) => { - const cmpPath = path.replace(/\\/g, '/'); - if (ignoreList.some((p) => cmpPath.includes(p))) return; - - let content = fs.readFileSync(path, { encoding: 'utf8' }); - const history = []; - - let hasLicense = false; - const headerCap = content.match(headerRE); - if (headerCap) { - content = content.slice(headerCap.index + headerCap[0].length); - // extract - let ownerCap = ownerRE.exec(headerCap[0]); - while (ownerCap) { - history.push({ period: [ownerCap[1], ownerCap[2]], owner: ownerCap[3] }); - ownerCap = ownerRE.exec(headerCap[0]); - } - if (history.length) { - // update - hasLicense = true; - let ownerUpToDate = false; - for (const info of history) { - if (info.owner === companyName) { - if (Number.parseInt(info.period[0]) !== curYear) { - info.period[1] = curYear; - } - ownerUpToDate = true; - } - } - if (!ownerUpToDate) { - const lastValidYear = history[history.length - 1].period[1]; - history.push({ period: [lastValidYear, curYear], owner: companyName }); - } - } - } - - // caveat: we don't actually know when exactly these files are created - // so the beginning year may not be accurate - // can be overriden manually anytime - if (!hasLicense) { - history.push({ period: [curYear], owner: companyName }); - } - - fs.writeFileSync(path, genHeader(history) + content); -}; - -const files = fsJetpack.find(`${__dirname}/../../cocos`, { matching: ['**/*.h', '**/*.cpp', '**/*.mm'] }); -for (const path of files) update(path); +const fs = require('fs'); +const fsJetpack = require('fs-jetpack'); + +const ignoreList = [ + 'cocos/renderer/gfx-vulkan/volk.h', + 'cocos/renderer/gfx-vulkan/volk.c', + 'cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h', + 'cocos/renderer/gfx-vulkan/vk_mem_alloc.h', + 'cocos/network/Uri.h', + 'cocos/network/Uri.cpp', + 'cocos/platform/win32/inet_pton_mingw.h', + 'cocos/platform/win32/inet_pton_mingw.cpp', + // directories + 'cocos/editor-support/dragonbones', + 'cocos/editor-support/spine', + 'cocos/audio/android/', + 'cocos/math/', + 'cocos/renderer/pipeline/deferred/', + 'cocos/bindings/jswrapper/v8/debugger/', +]; + +const genHeader = (history) => { + let output = `/****************************************************************************\n`; + + for (const info of history) { + const period = info.period[1] ? `${info.period[0]}-${info.period[1]}` : info.period[0]; + output += ` Copyright (c) ${period} ${info.owner}\n`; + } + + output += ` + 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 + to use Cocos Creator solely to develop games on your target platforms. You shall + 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 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +****************************************************************************/\n\n`; + + return output; +} + + +const headerRE = /\/\*{5,}.*?\*{5,}\/\s*/s; +const ownerRE = /^\s*Copyright\s*\(c\)\s*([0-9]+)(?:-([0-9]+))?\s*(.*)/gm; +const curYear = new Date().getFullYear(); +const companyName = 'Xiamen Yaji Software Co., Ltd.'; +const update = (path) => { + const cmpPath = path.replace(/\\/g, '/'); + if (ignoreList.some((p) => cmpPath.includes(p))) return; + + let content = fs.readFileSync(path, { encoding: 'utf8' }); + const history = []; + + let hasLicense = false; + const headerCap = content.match(headerRE); + if (headerCap) { + content = content.slice(headerCap.index + headerCap[0].length); + // extract + let ownerCap = ownerRE.exec(headerCap[0]); + while (ownerCap) { + history.push({ period: [ownerCap[1], ownerCap[2]], owner: ownerCap[3] }); + ownerCap = ownerRE.exec(headerCap[0]); + } + if (history.length) { + // update + hasLicense = true; + let ownerUpToDate = false; + for (const info of history) { + if (info.owner === companyName) { + if (Number.parseInt(info.period[0]) !== curYear) { + info.period[1] = curYear; + } + ownerUpToDate = true; + } + } + if (!ownerUpToDate) { + const lastValidYear = history[history.length - 1].period[1]; + history.push({ period: [lastValidYear, curYear], owner: companyName }); + } + } + } + + // caveat: we don't actually know when exactly these files are created + // so the beginning year may not be accurate + // can be overriden manually anytime + if (!hasLicense) { + history.push({ period: [curYear], owner: companyName }); + } + + fs.writeFileSync(path, genHeader(history) + content.replace(/\r\n/g, '\n')); +}; + +const files = fsJetpack.find(`${__dirname}/../../cocos`, { matching: ['**/*.h', '**/*.cpp', '**/*.mm'] }); +for (const path of files) update(path); diff --git a/native/tools/tojs/gfx.ini b/native/tools/tojs/gfx.ini index 7adf57d523..59ec26503d 100644 --- a/native/tools/tojs/gfx.ini +++ b/native/tools/tojs/gfx.ini @@ -26,7 +26,7 @@ cxxgenerator_headers = extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s # what headers to parse -headers = %(cocosdir)s/cocos/renderer/core/Core.h +headers = %(cocosdir)s/cocos/renderer/gfx-base/GFXBase.h replace_headers = diff --git a/native/tools/tojs/pipeline.ini b/native/tools/tojs/pipeline.ini index 4f6d8bebe7..867ede3455 100644 --- a/native/tools/tojs/pipeline.ini +++ b/native/tools/tojs/pipeline.ini @@ -3,7 +3,7 @@ # templates prefix = pipeline -cpp_headers= cocos/renderer/core/Core.h cocos/renderer/core/gfx/GFXDescriptorSet.h +cpp_headers = cocos/renderer/gfx-base/GFXBase.h # create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) # all classes will be embedded in that namespace @@ -16,7 +16,7 @@ android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILIT clang_headers = clang_flags = -nostdinc -x c++ -std=c++14 -fsigned-char -U__SSE__ -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/external/ios/include/v8 +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/external/ios/include/v8 cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 @@ -54,7 +54,7 @@ skip = ForwardPipeline::[getOrCreateRenderPass getLightsUBO getValidLights getLi GbufferStage::[initialize activate destroy render], LightingFlow::[initialize activate destroy render createRenderPass createFrameBuffer getLightingFrameBuffer], LightingStage::[initialize activate destroy render initLightingBuffer gatherLights], - PostprocessStage::[initialize activate destroy render] + PostprocessStage::[initialize activate destroy render], InstancedBuffer::[merge uploadBuffers clear getInstances getPass hasPendingModels dynamicOffsets] rename_functions = @@ -74,4 +74,3 @@ base_classes_to_skip = Clonable Object # classes that create no constructor # Set is special and we will use a hand-written constructor abstract_classes = RenderStage RenderFlow RenderPipeline -