mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 15:42:39 +08:00
gfx: swapchain refactor (#3751)
* gfx: swapchain * acquire/release/surface on swapchain * fix swapchain texture creation * acquire/present back on device * formats are swapchain-specific * swapchain: vk works * enable device agent * format fix * update gfxdef * fix enum decl * pipeline adapt * minor * vk: compress attr locations directly in SPIR-V * gles3 adjust * InputAssembler owns an DrawInfo * gles2 adapt * texture keep track of its hash * device cached states * format * glslang finalize * buffer view adapt * fg: subpass support * minor * 3.4 adapt * profiler adapt * buffer update frequency detection * minor * base commit * swapchain works on metal * spirv * mtltexture issue * remote test code * depthtexture * revert ifdef USE_METAL * ios swapchain header * fix some triple buffer issues * resize accept surface transform Co-authored-by: Zeqiang Li <Zeqiang-li@outlook.com>
This commit is contained in:
+51
-75
@@ -384,7 +384,7 @@ elseif(USE_JOB_SYSTEM_TBB)
|
||||
cocos/base/job-system/job-system-tbb/TBBJobSystem.h
|
||||
cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp
|
||||
)
|
||||
else()
|
||||
else()
|
||||
cocos_source_files(
|
||||
cocos/base/job-system/job-system-dummy/DummyJobGraph.h
|
||||
cocos/base/job-system/job-system-dummy/DummyJobGraph.cpp
|
||||
@@ -576,7 +576,7 @@ elseif(ANDROID)
|
||||
${CWD}/cocos/platform/java/jni/JniImp.cpp
|
||||
${CWD}/cocos/platform/java/jni/JniImp.h
|
||||
)
|
||||
|
||||
|
||||
cocos_source_files(MODULE ccfilesystem
|
||||
cocos/platform/android/FileUtils-android.cpp
|
||||
cocos/platform/android/FileUtils-android.h
|
||||
@@ -616,7 +616,7 @@ elseif(APPLE)
|
||||
cocos/platform/ios/Reachability.h
|
||||
cocos/platform/ios/Reachability.cpp
|
||||
)
|
||||
|
||||
|
||||
cocos_source_files(MODULE ccfilesystem
|
||||
cocos/platform/apple/FileUtils-apple.h
|
||||
cocos/platform/apple/FileUtils-apple.mm
|
||||
@@ -644,6 +644,8 @@ endif()
|
||||
cocos_source_files(
|
||||
cocos/renderer/GFXDeviceManager.h
|
||||
|
||||
cocos/renderer/gfx-base/SPIRVUtils.h
|
||||
cocos/renderer/gfx-base/SPIRVUtils.cpp
|
||||
cocos/renderer/gfx-base/GFXObject.h
|
||||
cocos/renderer/gfx-base/GFXObject.cpp
|
||||
cocos/renderer/gfx-base/GFXBase.h
|
||||
@@ -651,8 +653,6 @@ cocos_source_files(
|
||||
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
|
||||
@@ -660,8 +660,6 @@ cocos_source_files(
|
||||
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
|
||||
@@ -676,14 +674,18 @@ cocos_source_files(
|
||||
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/GFXSwapchain.cpp
|
||||
cocos/renderer/gfx-base/GFXSwapchain.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-base/states/GFXGlobalBarrier.cpp
|
||||
cocos/renderer/gfx-base/states/GFXGlobalBarrier.h
|
||||
cocos/renderer/gfx-base/states/GFXSampler.cpp
|
||||
cocos/renderer/gfx-base/states/GFXSampler.h
|
||||
cocos/renderer/gfx-base/states/GFXTextureBarrier.cpp
|
||||
cocos/renderer/gfx-base/states/GFXTextureBarrier.h
|
||||
|
||||
cocos/renderer/gfx-agent/BufferAgent.h
|
||||
cocos/renderer/gfx-agent/BufferAgent.cpp
|
||||
@@ -707,8 +709,8 @@ cocos_source_files(
|
||||
cocos/renderer/gfx-agent/QueueAgent.cpp
|
||||
cocos/renderer/gfx-agent/RenderPassAgent.h
|
||||
cocos/renderer/gfx-agent/RenderPassAgent.cpp
|
||||
cocos/renderer/gfx-agent/SamplerAgent.h
|
||||
cocos/renderer/gfx-agent/SamplerAgent.cpp
|
||||
cocos/renderer/gfx-agent/SwapchainAgent.h
|
||||
cocos/renderer/gfx-agent/SwapchainAgent.cpp
|
||||
cocos/renderer/gfx-agent/ShaderAgent.h
|
||||
cocos/renderer/gfx-agent/ShaderAgent.cpp
|
||||
cocos/renderer/gfx-agent/TextureAgent.h
|
||||
@@ -736,10 +738,10 @@ cocos_source_files(
|
||||
cocos/renderer/gfx-validator/QueueValidator.cpp
|
||||
cocos/renderer/gfx-validator/RenderPassValidator.h
|
||||
cocos/renderer/gfx-validator/RenderPassValidator.cpp
|
||||
cocos/renderer/gfx-validator/SamplerValidator.h
|
||||
cocos/renderer/gfx-validator/SamplerValidator.cpp
|
||||
cocos/renderer/gfx-validator/ShaderValidator.h
|
||||
cocos/renderer/gfx-validator/ShaderValidator.cpp
|
||||
cocos/renderer/gfx-validator/SwapchainValidator.h
|
||||
cocos/renderer/gfx-validator/SwapchainValidator.cpp
|
||||
cocos/renderer/gfx-validator/TextureValidator.h
|
||||
cocos/renderer/gfx-validator/TextureValidator.cpp
|
||||
cocos/renderer/gfx-validator/ValidationUtils.h
|
||||
@@ -749,8 +751,6 @@ cocos_source_files(
|
||||
cocos/renderer/gfx-empty/EmptyBuffer.cpp
|
||||
cocos/renderer/gfx-empty/EmptyCommandBuffer.h
|
||||
cocos/renderer/gfx-empty/EmptyCommandBuffer.cpp
|
||||
cocos/renderer/gfx-empty/EmptyContext.h
|
||||
cocos/renderer/gfx-empty/EmptyContext.cpp
|
||||
cocos/renderer/gfx-empty/EmptyDescriptorSet.h
|
||||
cocos/renderer/gfx-empty/EmptyDescriptorSet.cpp
|
||||
cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.h
|
||||
@@ -769,10 +769,10 @@ cocos_source_files(
|
||||
cocos/renderer/gfx-empty/EmptyQueue.cpp
|
||||
cocos/renderer/gfx-empty/EmptyRenderPass.h
|
||||
cocos/renderer/gfx-empty/EmptyRenderPass.cpp
|
||||
cocos/renderer/gfx-empty/EmptySampler.h
|
||||
cocos/renderer/gfx-empty/EmptySampler.cpp
|
||||
cocos/renderer/gfx-empty/EmptyShader.h
|
||||
cocos/renderer/gfx-empty/EmptyShader.cpp
|
||||
cocos/renderer/gfx-empty/EmptySwapchain.h
|
||||
cocos/renderer/gfx-empty/EmptySwapchain.cpp
|
||||
cocos/renderer/gfx-empty/EmptyTexture.h
|
||||
cocos/renderer/gfx-empty/EmptyTexture.cpp
|
||||
|
||||
@@ -902,12 +902,11 @@ if(CC_USE_GLES2)
|
||||
cocos/renderer/gfx-gles2/GLES2CommandBuffer.h
|
||||
cocos/renderer/gfx-gles2/GLES2Commands.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Commands.h
|
||||
cocos/renderer/gfx-gles2/GLES2Context.h
|
||||
cocos/renderer/gfx-gles2/GLES2Context.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Device.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Device.h
|
||||
cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Framebuffer.h
|
||||
cocos/renderer/gfx-gles2/GLES2GPUContext.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2GPUObjects.h
|
||||
cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2InputAssembler.h
|
||||
@@ -925,31 +924,19 @@ if(CC_USE_GLES2)
|
||||
cocos/renderer/gfx-gles2/GLES2Queue.h
|
||||
cocos/renderer/gfx-gles2/GLES2RenderPass.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2RenderPass.h
|
||||
cocos/renderer/gfx-gles2/GLES2Sampler.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Sampler.h
|
||||
cocos/renderer/gfx-gles2/GLES2Shader.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Shader.h
|
||||
cocos/renderer/gfx-gles2/GLES2Swapchain.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Swapchain.h
|
||||
cocos/renderer/gfx-gles2/GLES2Std.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Std.h
|
||||
cocos/renderer/gfx-gles2/GLES2Texture.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Texture.h
|
||||
cocos/renderer/gfx-gles2/GLES2Wrangler.cpp
|
||||
cocos/renderer/gfx-gles2/GLES2Wrangler.h
|
||||
cocos/renderer/gfx-gles2/states/GLES2Sampler.cpp
|
||||
cocos/renderer/gfx-gles2/states/GLES2Sampler.h
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
cocos_source_files(
|
||||
NO_WERROR cocos/renderer/gfx-gles2/GLES2Wrangler.mm
|
||||
)
|
||||
else()
|
||||
cocos_source_files(
|
||||
cocos/renderer/gfx-gles2/GLES2Wrangler.cpp
|
||||
)
|
||||
endif()
|
||||
if(IOS)
|
||||
cocos_source_files(
|
||||
NO_WERROR cocos/renderer/gfx-gles2/GLES2Context.mm
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CC_USE_GLES3)
|
||||
@@ -961,14 +948,11 @@ if(CC_USE_GLES3)
|
||||
cocos/renderer/gfx-gles3/GLES3CommandBuffer.h
|
||||
cocos/renderer/gfx-gles3/GLES3Commands.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Commands.h
|
||||
cocos/renderer/gfx-gles3/GLES3Context.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Context.h
|
||||
cocos/renderer/gfx-gles3/GLES3Device.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Device.h
|
||||
cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Framebuffer.h
|
||||
cocos/renderer/gfx-gles3/GLES3GlobalBarrier.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h
|
||||
cocos/renderer/gfx-gles3/GLES3GPUContext.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3GPUObjects.h
|
||||
cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3InputAssembler.h
|
||||
@@ -986,30 +970,21 @@ if(CC_USE_GLES3)
|
||||
cocos/renderer/gfx-gles3/GLES3Queue.h
|
||||
cocos/renderer/gfx-gles3/GLES3RenderPass.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3RenderPass.h
|
||||
cocos/renderer/gfx-gles3/GLES3Sampler.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Sampler.h
|
||||
cocos/renderer/gfx-gles3/GLES3Shader.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Shader.h
|
||||
cocos/renderer/gfx-gles3/GLES3Swapchain.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Swapchain.h
|
||||
cocos/renderer/gfx-gles3/GLES3Std.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Std.h
|
||||
cocos/renderer/gfx-gles3/GLES3Texture.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Texture.h
|
||||
cocos/renderer/gfx-gles3/GLES3Wrangler.cpp
|
||||
cocos/renderer/gfx-gles3/GLES3Wrangler.h
|
||||
cocos/renderer/gfx-gles3/states/GLES3GlobalBarrier.cpp
|
||||
cocos/renderer/gfx-gles3/states/GLES3GlobalBarrier.h
|
||||
cocos/renderer/gfx-gles3/states/GLES3Sampler.cpp
|
||||
cocos/renderer/gfx-gles3/states/GLES3Sampler.h
|
||||
)
|
||||
if(APPLE)
|
||||
cocos_source_files(
|
||||
NO_WERROR cocos/renderer/gfx-gles3/GLES3Wrangler.mm
|
||||
)
|
||||
else()
|
||||
cocos_source_files(
|
||||
cocos/renderer/gfx-gles3/GLES3Wrangler.cpp
|
||||
)
|
||||
endif()
|
||||
if(IOS)
|
||||
cocos_source_files(
|
||||
NO_WERROR cocos/renderer/gfx-gles3/GLES3Context.mm
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CC_USE_METAL)
|
||||
@@ -1019,8 +994,6 @@ if(CC_USE_METAL)
|
||||
cocos/renderer/gfx-metal/MTLBuffer.mm
|
||||
cocos/renderer/gfx-metal/MTLCommandBuffer.h
|
||||
cocos/renderer/gfx-metal/MTLCommandBuffer.mm
|
||||
cocos/renderer/gfx-metal/MTLContext.h
|
||||
NO_WERROR cocos/renderer/gfx-metal/MTLContext.mm # CAMetalLayer bug for apple
|
||||
cocos/renderer/gfx-metal/MTLDevice.h
|
||||
NO_WERROR cocos/renderer/gfx-metal/MTLDevice.mm # CAMetalLayer bug for apple
|
||||
cocos/renderer/gfx-metal/MTLFramebuffer.mm
|
||||
@@ -1055,6 +1028,8 @@ if(CC_USE_METAL)
|
||||
cocos/renderer/gfx-metal/MTLCommandEncoder.h
|
||||
cocos/renderer/gfx-metal/MTLConfig.h
|
||||
cocos/renderer/gfx-metal/MTLSemaphore.h
|
||||
cocos/renderer/gfx-metal/MTLSwapchain.h
|
||||
cocos/renderer/gfx-metal/MTLSwapchain.mm
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1069,14 +1044,11 @@ if(CC_USE_VULKAN)
|
||||
cocos/renderer/gfx-vulkan/VKCommandBuffer.h
|
||||
cocos/renderer/gfx-vulkan/VKCommands.cpp
|
||||
cocos/renderer/gfx-vulkan/VKCommands.h
|
||||
cocos/renderer/gfx-vulkan/VKContext.cpp
|
||||
cocos/renderer/gfx-vulkan/VKContext.h
|
||||
cocos/renderer/gfx-vulkan/VKDevice.cpp
|
||||
cocos/renderer/gfx-vulkan/VKDevice.h
|
||||
cocos/renderer/gfx-vulkan/VKFramebuffer.cpp
|
||||
cocos/renderer/gfx-vulkan/VKFramebuffer.h
|
||||
cocos/renderer/gfx-vulkan/VKGlobalBarrier.cpp
|
||||
cocos/renderer/gfx-vulkan/VKGlobalBarrier.h
|
||||
cocos/renderer/gfx-vulkan/VKGPUContext.cpp
|
||||
cocos/renderer/gfx-vulkan/VKGPUObjects.h
|
||||
cocos/renderer/gfx-vulkan/VKInputAssembler.cpp
|
||||
cocos/renderer/gfx-vulkan/VKInputAssembler.h
|
||||
@@ -1092,21 +1064,24 @@ if(CC_USE_VULKAN)
|
||||
cocos/renderer/gfx-vulkan/VKQueue.h
|
||||
cocos/renderer/gfx-vulkan/VKRenderPass.cpp
|
||||
cocos/renderer/gfx-vulkan/VKRenderPass.h
|
||||
cocos/renderer/gfx-vulkan/VKSampler.cpp
|
||||
cocos/renderer/gfx-vulkan/VKSampler.h
|
||||
cocos/renderer/gfx-vulkan/VKShader.cpp
|
||||
cocos/renderer/gfx-vulkan/VKShader.h
|
||||
cocos/renderer/gfx-vulkan/VKSPIRV.h
|
||||
cocos/renderer/gfx-vulkan/VKStd.cpp
|
||||
cocos/renderer/gfx-vulkan/VKStd.h
|
||||
cocos/renderer/gfx-vulkan/VKSwapchain.cpp
|
||||
cocos/renderer/gfx-vulkan/VKSwapchain.h
|
||||
cocos/renderer/gfx-vulkan/VKTexture.cpp
|
||||
cocos/renderer/gfx-vulkan/VKTexture.h
|
||||
cocos/renderer/gfx-vulkan/VKTextureBarrier.cpp
|
||||
cocos/renderer/gfx-vulkan/VKTextureBarrier.h
|
||||
cocos/renderer/gfx-vulkan/VKUtils.cpp
|
||||
cocos/renderer/gfx-vulkan/VKUtils.h
|
||||
cocos/renderer/gfx-vulkan/volk.c
|
||||
cocos/renderer/gfx-vulkan/volk.h
|
||||
cocos/renderer/gfx-vulkan/states/VKGlobalBarrier.cpp
|
||||
cocos/renderer/gfx-vulkan/states/VKGlobalBarrier.h
|
||||
cocos/renderer/gfx-vulkan/states/VKSampler.cpp
|
||||
cocos/renderer/gfx-vulkan/states/VKSampler.h
|
||||
cocos/renderer/gfx-vulkan/states/VKTextureBarrier.cpp
|
||||
cocos/renderer/gfx-vulkan/states/VKTextureBarrier.h
|
||||
)
|
||||
|
||||
if(ANDROID)
|
||||
@@ -1611,7 +1586,7 @@ elseif(WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
############# module bindings
|
||||
############# module bindings
|
||||
if(USE_SE_V8)
|
||||
cocos_source_files(MODULE ccbindings
|
||||
cocos/bindings/jswrapper/v8/Base.h
|
||||
@@ -1695,7 +1670,7 @@ cocos_source_files(MODULE ccbindings
|
||||
cocos/bindings/jswrapper/State.cpp
|
||||
cocos/bindings/jswrapper/State.h
|
||||
cocos/bindings/jswrapper/Value.cpp
|
||||
cocos/bindings/jswrapper/Value.h
|
||||
cocos/bindings/jswrapper/Value.h
|
||||
NO_WERROR cocos/bindings/manual/jsb_global_init.cpp
|
||||
cocos/bindings/manual/jsb_global_init.h
|
||||
)
|
||||
@@ -1860,12 +1835,12 @@ if(USE_MODULES)
|
||||
target_link_libraries(ccunzip PUBLIC
|
||||
${ZLIB}
|
||||
)
|
||||
target_link_libraries(ccfilesystem PUBLIC
|
||||
ccunzip
|
||||
target_link_libraries(ccfilesystem PUBLIC
|
||||
ccunzip
|
||||
ccutils
|
||||
cclog
|
||||
)
|
||||
target_link_libraries(ccbindings PUBLIC
|
||||
target_link_libraries(ccbindings PUBLIC
|
||||
ccfilesystem
|
||||
cclog
|
||||
${se_libs_name}
|
||||
@@ -2020,7 +1995,7 @@ target_compile_definitions(cocos2d
|
||||
${CC_EXTERNAL_PRIVATE_DEFINITIONS}
|
||||
)
|
||||
if(NOT OHOS)
|
||||
target_include_directories(cocos2d PUBLIC
|
||||
target_include_directories(cocos2d PUBLIC
|
||||
${CWD}/external/sources/EGL
|
||||
${CWD}/external/sources/khronos
|
||||
)
|
||||
@@ -2127,6 +2102,7 @@ if(APPLE)
|
||||
"-framework UIKit"
|
||||
"-framework AVKit"
|
||||
"-framework WebKit"
|
||||
"-framework CoreVideo"
|
||||
"-framework CoreMotion"
|
||||
"-framework CFNetwork"
|
||||
"-framework CoreMedia"
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
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;
|
||||
inline operator IndexType() const noexcept; // NOLINT(google-explicit-constructor) we need this implicity
|
||||
|
||||
static IndexType constexpr UNINITIALIZED{std::numeric_limits<IndexType>::max()};
|
||||
|
||||
|
||||
@@ -408,13 +408,13 @@ It should work same as apples CFSwapInt32LittleToHost(..)
|
||||
cls(const cls &) = delete; \
|
||||
cls &operator=(const cls &) = delete;
|
||||
|
||||
#define ENABLE_MOVE_SEMANTICS(cls) \
|
||||
cls(cls &&) = default; \
|
||||
cls &operator=(cls &&) = default;
|
||||
#define ENABLE_MOVE_SEMANTICS(cls) \
|
||||
cls(cls &&) noexcept = default; \
|
||||
cls &operator=(cls &&) noexcept = default;
|
||||
|
||||
#define DISABLE_MOVE_SEMANTICS(cls) \
|
||||
cls(cls &&) = delete; \
|
||||
cls &operator=(cls &&) = delete;
|
||||
cls(cls &&) noexcept = delete; \
|
||||
cls &operator=(cls &&) noexcept = delete;
|
||||
|
||||
#if (CC_COMPILER == CC_COMPILER_MSVC)
|
||||
#define CC_ALIGN(N) __declspec(align(N))
|
||||
@@ -604,9 +604,9 @@ It should work same as apples CFSwapInt32LittleToHost(..)
|
||||
#define ENABLE_IF_T3_RET(t1, t2, t3) std::enable_if_t<std::is_same<t1, T>::value || std::is_same<t2, T>::value || std::is_same<t3, T>::value, void>
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define CC_PREDICT_TRUE(x) __builtin_expect(!!(x), 1)
|
||||
#define CC_PREDICT_TRUE(x) __builtin_expect(!!(x), 1)
|
||||
#define CC_PREDICT_FALSE(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
#define CC_PREDICT_TRUE(x) (x)
|
||||
#define CC_PREDICT_TRUE(x) (x)
|
||||
#define CC_PREDICT_FALSE(x) (x)
|
||||
#endif
|
||||
@@ -86,21 +86,18 @@ public:
|
||||
Map<K, V>()
|
||||
: _data() {
|
||||
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
|
||||
CC_LOG_INFO("In the default constructor of Map!");
|
||||
}
|
||||
|
||||
/** Constructor with capacity. */
|
||||
explicit Map<K, V>(ssize_t capacity)
|
||||
: _data() {
|
||||
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
|
||||
CC_LOG_INFO("In the constructor with capacity of Map!");
|
||||
_data.reserve(capacity);
|
||||
}
|
||||
|
||||
/** Copy constructor. */
|
||||
Map<K, V>(const Map<K, V> &other) {
|
||||
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
|
||||
CC_LOG_INFO("In the copy constructor of Map!");
|
||||
_data = other._data;
|
||||
addRefForAllObjects();
|
||||
}
|
||||
@@ -108,7 +105,6 @@ public:
|
||||
/** Move constructor. */
|
||||
Map<K, V>(Map<K, V> &&other) noexcept {
|
||||
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
|
||||
CC_LOG_INFO("In the move constructor of Map!");
|
||||
_data = std::move(other._data);
|
||||
}
|
||||
|
||||
@@ -117,7 +113,6 @@ public:
|
||||
* It will release all objects in map.
|
||||
*/
|
||||
~Map<K, V>() {
|
||||
CC_LOG_INFO("In the destructor of Map!");
|
||||
clear();
|
||||
}
|
||||
|
||||
@@ -317,7 +312,6 @@ public:
|
||||
/** Copy assignment operator. */
|
||||
Map<K, V> &operator=(const Map<K, V> &other) {
|
||||
if (this != &other) {
|
||||
CC_LOG_INFO("In the copy assignment operator of Map!");
|
||||
clear();
|
||||
_data = other._data;
|
||||
addRefForAllObjects();
|
||||
@@ -328,7 +322,6 @@ public:
|
||||
/** Move assignment operator. */
|
||||
Map<K, V> &operator=(Map<K, V> &&other) noexcept {
|
||||
if (this != &other) {
|
||||
CC_LOG_INFO("In the move assignment operator of Map!");
|
||||
clear();
|
||||
_data = std::move(other._data);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "StringHandle.h"
|
||||
#include "base/Macros.h"
|
||||
#include "threading/ReadWriteLock.h"
|
||||
|
||||
namespace cc {
|
||||
@@ -120,8 +120,8 @@ inline StringHandle StringPool<ThreadSafe>::doStringToHandle(const char *str) no
|
||||
}
|
||||
|
||||
template <bool ThreadSafe>
|
||||
inline char const *StringPool<ThreadSafe>::doHandleToString(const StringHandle &handle) const noexcept {
|
||||
assert(handle < _handleToStrings.size());
|
||||
inline const char *StringPool<ThreadSafe>::doHandleToString(const StringHandle &handle) const noexcept {
|
||||
CC_ASSERT(handle < _handleToStrings.size());
|
||||
return _handleToStrings[handle];
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,12 @@ using FlagBits = uint32_t;
|
||||
using ValueType = std::underlying_type<T>::type; \
|
||||
return (static_cast<ValueType>(flags) & static_cast<ValueType>(flagsToTest)) == static_cast<ValueType>(flagsToTest); \
|
||||
} \
|
||||
inline T addFlags(const T flags, const T flagsToAdd) { return (flags | flagsToAdd); } \
|
||||
inline T removeFlags(const T flags, const T flagsToRemove) { return (flags & ~flagsToRemove); } \
|
||||
inline T addFlags(T &flags, const T flagsToAdd) { \
|
||||
flags |= flagsToAdd; \
|
||||
return flags; \
|
||||
} \
|
||||
inline T removeFlags(T &flags, const T flagsToRemove) { \
|
||||
flags &= ~flagsToRemove; \
|
||||
return flags; \
|
||||
} \
|
||||
CC_ENUM_CONVERSION_OPERATOR(T)
|
||||
|
||||
@@ -64,11 +64,6 @@ CC_DLL double atof(const char *str);
|
||||
|
||||
CC_DLL uint alignTo(uint size, uint alignment);
|
||||
|
||||
template <typename T, size_t Size>
|
||||
char (*countOfHelper(T (&array)[Size]))[Size];
|
||||
|
||||
#define COUNTOF(array) (sizeof(*countOfHelper(array)) + 0)
|
||||
|
||||
template <class T>
|
||||
uint toUint(T value) {
|
||||
static_assert(std::is_arithmetic<T>::value, "T must be numeric");
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
|
||||
#include "ThreadSafeLinearAllocator.h"
|
||||
#include "acl/core/memory_utils.h"
|
||||
#include "base/Macros.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
ThreadSafeLinearAllocator::ThreadSafeLinearAllocator(uint32_t size) noexcept
|
||||
: _capacity(size) {
|
||||
_buffer = malloc(size);
|
||||
CCASSERT(_buffer, "Out of memory");
|
||||
}
|
||||
|
||||
ThreadSafeLinearAllocator::~ThreadSafeLinearAllocator() {
|
||||
|
||||
@@ -158,108 +158,6 @@ static bool js_audio_AudioEngine_lazyInit(se::State& s) // NOLINT(readability-id
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_lazyInit)
|
||||
|
||||
static bool js_audio_AudioEngine_setCurrentTime(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
HolderType<float, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setCurrentTime : Error processing arguments");
|
||||
bool result = cc::AudioEngine::setCurrentTime(arg0.value(), arg1.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setCurrentTime : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setCurrentTime)
|
||||
|
||||
static bool js_audio_AudioEngine_getVolume(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getVolume : Error processing arguments");
|
||||
float result = cc::AudioEngine::getVolume(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getVolume : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getVolume)
|
||||
|
||||
static bool js_audio_AudioEngine_uncache(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_uncache : Error processing arguments");
|
||||
cc::AudioEngine::uncache(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_uncache)
|
||||
|
||||
static bool js_audio_AudioEngine_resumeAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::resumeAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_resumeAll)
|
||||
|
||||
static bool js_audio_AudioEngine_stopAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::stopAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_stopAll)
|
||||
|
||||
static bool js_audio_AudioEngine_pause(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_pause : Error processing arguments");
|
||||
cc::AudioEngine::pause(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_pause)
|
||||
|
||||
static bool js_audio_AudioEngine_end(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -273,241 +171,22 @@ static bool js_audio_AudioEngine_end(se::State& s) // NOLINT(readability-identif
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_end)
|
||||
|
||||
static bool js_audio_AudioEngine_getMaxAudioInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
static bool js_audio_AudioEngine_getDefaultProfile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
int result = cc::AudioEngine::getMaxAudioInstance();
|
||||
cc::AudioProfile* result = cc::AudioEngine::getDefaultProfile();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getMaxAudioInstance : Error processing arguments");
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getDefaultProfile : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getMaxAudioInstance)
|
||||
|
||||
static bool js_audio_AudioEngine_isEnabled(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
bool result = cc::AudioEngine::isEnabled();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_isEnabled : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_isEnabled)
|
||||
|
||||
static bool js_audio_AudioEngine_getDurationFromFile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getDurationFromFile : Error processing arguments");
|
||||
float result = cc::AudioEngine::getDurationFromFile(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getDurationFromFile : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getDurationFromFile)
|
||||
|
||||
static bool js_audio_AudioEngine_getCurrentTime(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getCurrentTime : Error processing arguments");
|
||||
float result = cc::AudioEngine::getCurrentTime(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getCurrentTime : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getCurrentTime)
|
||||
|
||||
static bool js_audio_AudioEngine_setMaxAudioInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setMaxAudioInstance : Error processing arguments");
|
||||
bool result = cc::AudioEngine::setMaxAudioInstance(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setMaxAudioInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setMaxAudioInstance)
|
||||
|
||||
static bool js_audio_AudioEngine_isLoop(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_isLoop : Error processing arguments");
|
||||
bool result = cc::AudioEngine::isLoop(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_isLoop : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_isLoop)
|
||||
|
||||
static bool js_audio_AudioEngine_pauseAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::pauseAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_pauseAll)
|
||||
|
||||
static bool js_audio_AudioEngine_uncacheAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::uncacheAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_uncacheAll)
|
||||
|
||||
static bool js_audio_AudioEngine_setVolume(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
HolderType<float, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setVolume : Error processing arguments");
|
||||
cc::AudioEngine::setVolume(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setVolume)
|
||||
|
||||
static bool js_audio_AudioEngine_preload(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
do {
|
||||
if (argc == 2) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
HolderType<std::function<void (bool)>, true> arg1 = {};
|
||||
do {
|
||||
if (args[1].isObject() && args[1].toObject()->isFunction())
|
||||
{
|
||||
se::Value jsThis(s.thisObject());
|
||||
se::Value jsFunc(args[1]);
|
||||
jsFunc.toObject()->root();
|
||||
auto lambda = [=](bool larg0) -> void {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::ValueArray args;
|
||||
args.resize(1);
|
||||
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
|
||||
se::Value rval;
|
||||
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
|
||||
se::Object* funcObj = jsFunc.toObject();
|
||||
bool succeed = funcObj->call(args, thisObj, &rval);
|
||||
if (!succeed) {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
}
|
||||
};
|
||||
arg1.data = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1.data = nullptr;
|
||||
}
|
||||
} while(false)
|
||||
;
|
||||
if (!ok) { ok = true; break; }
|
||||
cc::AudioEngine::preload(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
} while (false);
|
||||
do {
|
||||
if (argc == 1) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
cc::AudioEngine::preload(arg0.value());
|
||||
return true;
|
||||
}
|
||||
} while (false);
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_preload)
|
||||
|
||||
static bool js_audio_AudioEngine_setEnabled(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<bool, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setEnabled : Error processing arguments");
|
||||
cc::AudioEngine::setEnabled(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setEnabled)
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getDefaultProfile)
|
||||
|
||||
static bool js_audio_AudioEngine_play2d(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -571,7 +250,26 @@ static bool js_audio_AudioEngine_play2d(se::State& s) // NOLINT(readability-iden
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_play2d)
|
||||
|
||||
static bool js_audio_AudioEngine_getState(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
static bool js_audio_AudioEngine_setLoop(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
HolderType<bool, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setLoop : Error processing arguments");
|
||||
cc::AudioEngine::setLoop(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setLoop)
|
||||
|
||||
static bool js_audio_AudioEngine_isLoop(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
@@ -579,17 +277,86 @@ static bool js_audio_AudioEngine_getState(se::State& s) // NOLINT(readability-id
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getState : Error processing arguments");
|
||||
auto result = static_cast<int>(cc::AudioEngine::getState(arg0.value()));
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_isLoop : Error processing arguments");
|
||||
bool result = cc::AudioEngine::isLoop(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getState : Error processing arguments");
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_isLoop : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getState)
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_isLoop)
|
||||
|
||||
static bool js_audio_AudioEngine_setVolume(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
HolderType<float, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setVolume : Error processing arguments");
|
||||
cc::AudioEngine::setVolume(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setVolume)
|
||||
|
||||
static bool js_audio_AudioEngine_getVolume(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getVolume : Error processing arguments");
|
||||
float result = cc::AudioEngine::getVolume(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getVolume : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getVolume)
|
||||
|
||||
static bool js_audio_AudioEngine_pause(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_pause : Error processing arguments");
|
||||
cc::AudioEngine::pause(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_pause)
|
||||
|
||||
static bool js_audio_AudioEngine_pauseAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::pauseAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_pauseAll)
|
||||
|
||||
static bool js_audio_AudioEngine_resume(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -608,6 +375,19 @@ static bool js_audio_AudioEngine_resume(se::State& s) // NOLINT(readability-iden
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_resume)
|
||||
|
||||
static bool js_audio_AudioEngine_resumeAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::resumeAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_resumeAll)
|
||||
|
||||
static bool js_audio_AudioEngine_stop(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -625,6 +405,61 @@ static bool js_audio_AudioEngine_stop(se::State& s) // NOLINT(readability-identi
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_stop)
|
||||
|
||||
static bool js_audio_AudioEngine_stopAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::stopAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_stopAll)
|
||||
|
||||
static bool js_audio_AudioEngine_setCurrentTime(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
HolderType<float, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setCurrentTime : Error processing arguments");
|
||||
bool result = cc::AudioEngine::setCurrentTime(arg0.value(), arg1.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setCurrentTime : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setCurrentTime)
|
||||
|
||||
static bool js_audio_AudioEngine_getCurrentTime(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getCurrentTime : Error processing arguments");
|
||||
float result = cc::AudioEngine::getCurrentTime(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getCurrentTime : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getCurrentTime)
|
||||
|
||||
static bool js_audio_AudioEngine_getDuration(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -645,41 +480,45 @@ static bool js_audio_AudioEngine_getDuration(se::State& s) // NOLINT(readability
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getDuration)
|
||||
|
||||
static bool js_audio_AudioEngine_setLoop(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
static bool js_audio_AudioEngine_getDurationFromFile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
HolderType<bool, false> arg1 = {};
|
||||
if (argc == 1) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setLoop : Error processing arguments");
|
||||
cc::AudioEngine::setLoop(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setLoop)
|
||||
|
||||
static bool js_audio_AudioEngine_getDefaultProfile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::AudioProfile* result = cc::AudioEngine::getDefaultProfile();
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getDurationFromFile : Error processing arguments");
|
||||
float result = cc::AudioEngine::getDurationFromFile(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getDefaultProfile : Error processing arguments");
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getDurationFromFile : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getDefaultProfile)
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getDurationFromFile)
|
||||
|
||||
static bool js_audio_AudioEngine_getState(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getState : Error processing arguments");
|
||||
auto result = static_cast<int>(cc::AudioEngine::getState(arg0.value()));
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getState : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getState)
|
||||
|
||||
static bool js_audio_AudioEngine_setFinishCallback(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -730,6 +569,73 @@ static bool js_audio_AudioEngine_setFinishCallback(se::State& s) // NOLINT(reada
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setFinishCallback)
|
||||
|
||||
static bool js_audio_AudioEngine_getMaxAudioInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
int result = cc::AudioEngine::getMaxAudioInstance();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_getMaxAudioInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getMaxAudioInstance)
|
||||
|
||||
static bool js_audio_AudioEngine_setMaxAudioInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<int, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setMaxAudioInstance : Error processing arguments");
|
||||
bool result = cc::AudioEngine::setMaxAudioInstance(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setMaxAudioInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setMaxAudioInstance)
|
||||
|
||||
static bool js_audio_AudioEngine_uncache(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_uncache : Error processing arguments");
|
||||
cc::AudioEngine::uncache(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_uncache)
|
||||
|
||||
static bool js_audio_AudioEngine_uncacheAll(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::AudioEngine::uncacheAll();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_uncacheAll)
|
||||
|
||||
static bool js_audio_AudioEngine_getProfile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
@@ -764,6 +670,66 @@ static bool js_audio_AudioEngine_getProfile(se::State& s) // NOLINT(readability-
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getProfile)
|
||||
|
||||
static bool js_audio_AudioEngine_preload(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
do {
|
||||
if (argc == 2) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
HolderType<std::function<void (bool)>, true> arg1 = {};
|
||||
do {
|
||||
if (args[1].isObject() && args[1].toObject()->isFunction())
|
||||
{
|
||||
se::Value jsThis(s.thisObject());
|
||||
se::Value jsFunc(args[1]);
|
||||
jsFunc.toObject()->root();
|
||||
auto lambda = [=](bool larg0) -> void {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::ValueArray args;
|
||||
args.resize(1);
|
||||
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
|
||||
se::Value rval;
|
||||
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
|
||||
se::Object* funcObj = jsFunc.toObject();
|
||||
bool succeed = funcObj->call(args, thisObj, &rval);
|
||||
if (!succeed) {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
}
|
||||
};
|
||||
arg1.data = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1.data = nullptr;
|
||||
}
|
||||
} while(false)
|
||||
;
|
||||
if (!ok) { ok = true; break; }
|
||||
cc::AudioEngine::preload(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
} while (false);
|
||||
do {
|
||||
if (argc == 1) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
cc::AudioEngine::preload(arg0.value());
|
||||
return true;
|
||||
}
|
||||
} while (false);
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_preload)
|
||||
|
||||
static bool js_audio_AudioEngine_getPlayingAudioCount(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -781,6 +747,40 @@ static bool js_audio_AudioEngine_getPlayingAudioCount(se::State& s) // NOLINT(re
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_getPlayingAudioCount)
|
||||
|
||||
static bool js_audio_AudioEngine_setEnabled(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<bool, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_setEnabled : Error processing arguments");
|
||||
cc::AudioEngine::setEnabled(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_setEnabled)
|
||||
|
||||
static bool js_audio_AudioEngine_isEnabled(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
bool result = cc::AudioEngine::isEnabled();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_audio_AudioEngine_isEnabled : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_audio_AudioEngine_isEnabled)
|
||||
|
||||
|
||||
|
||||
bool js_register_audio_AudioEngine(se::Object* obj) // NOLINT(readability-identifier-naming)
|
||||
@@ -788,34 +788,34 @@ bool js_register_audio_AudioEngine(se::Object* obj) // NOLINT(readability-identi
|
||||
auto* cls = se::Class::create("AudioEngine", obj, nullptr, nullptr);
|
||||
|
||||
cls->defineStaticFunction("lazyInit", _SE(js_audio_AudioEngine_lazyInit));
|
||||
cls->defineStaticFunction("setCurrentTime", _SE(js_audio_AudioEngine_setCurrentTime));
|
||||
cls->defineStaticFunction("getVolume", _SE(js_audio_AudioEngine_getVolume));
|
||||
cls->defineStaticFunction("uncache", _SE(js_audio_AudioEngine_uncache));
|
||||
cls->defineStaticFunction("resumeAll", _SE(js_audio_AudioEngine_resumeAll));
|
||||
cls->defineStaticFunction("stopAll", _SE(js_audio_AudioEngine_stopAll));
|
||||
cls->defineStaticFunction("pause", _SE(js_audio_AudioEngine_pause));
|
||||
cls->defineStaticFunction("end", _SE(js_audio_AudioEngine_end));
|
||||
cls->defineStaticFunction("getMaxAudioInstance", _SE(js_audio_AudioEngine_getMaxAudioInstance));
|
||||
cls->defineStaticFunction("isEnabled", _SE(js_audio_AudioEngine_isEnabled));
|
||||
cls->defineStaticFunction("getDurationFromFile", _SE(js_audio_AudioEngine_getDurationFromFile));
|
||||
cls->defineStaticFunction("getCurrentTime", _SE(js_audio_AudioEngine_getCurrentTime));
|
||||
cls->defineStaticFunction("setMaxAudioInstance", _SE(js_audio_AudioEngine_setMaxAudioInstance));
|
||||
cls->defineStaticFunction("isLoop", _SE(js_audio_AudioEngine_isLoop));
|
||||
cls->defineStaticFunction("pauseAll", _SE(js_audio_AudioEngine_pauseAll));
|
||||
cls->defineStaticFunction("uncacheAll", _SE(js_audio_AudioEngine_uncacheAll));
|
||||
cls->defineStaticFunction("setVolume", _SE(js_audio_AudioEngine_setVolume));
|
||||
cls->defineStaticFunction("preload", _SE(js_audio_AudioEngine_preload));
|
||||
cls->defineStaticFunction("setEnabled", _SE(js_audio_AudioEngine_setEnabled));
|
||||
cls->defineStaticFunction("play2d", _SE(js_audio_AudioEngine_play2d));
|
||||
cls->defineStaticFunction("getState", _SE(js_audio_AudioEngine_getState));
|
||||
cls->defineStaticFunction("resume", _SE(js_audio_AudioEngine_resume));
|
||||
cls->defineStaticFunction("stop", _SE(js_audio_AudioEngine_stop));
|
||||
cls->defineStaticFunction("getDuration", _SE(js_audio_AudioEngine_getDuration));
|
||||
cls->defineStaticFunction("setLoop", _SE(js_audio_AudioEngine_setLoop));
|
||||
cls->defineStaticFunction("getDefaultProfile", _SE(js_audio_AudioEngine_getDefaultProfile));
|
||||
cls->defineStaticFunction("play2d", _SE(js_audio_AudioEngine_play2d));
|
||||
cls->defineStaticFunction("setLoop", _SE(js_audio_AudioEngine_setLoop));
|
||||
cls->defineStaticFunction("isLoop", _SE(js_audio_AudioEngine_isLoop));
|
||||
cls->defineStaticFunction("setVolume", _SE(js_audio_AudioEngine_setVolume));
|
||||
cls->defineStaticFunction("getVolume", _SE(js_audio_AudioEngine_getVolume));
|
||||
cls->defineStaticFunction("pause", _SE(js_audio_AudioEngine_pause));
|
||||
cls->defineStaticFunction("pauseAll", _SE(js_audio_AudioEngine_pauseAll));
|
||||
cls->defineStaticFunction("resume", _SE(js_audio_AudioEngine_resume));
|
||||
cls->defineStaticFunction("resumeAll", _SE(js_audio_AudioEngine_resumeAll));
|
||||
cls->defineStaticFunction("stop", _SE(js_audio_AudioEngine_stop));
|
||||
cls->defineStaticFunction("stopAll", _SE(js_audio_AudioEngine_stopAll));
|
||||
cls->defineStaticFunction("setCurrentTime", _SE(js_audio_AudioEngine_setCurrentTime));
|
||||
cls->defineStaticFunction("getCurrentTime", _SE(js_audio_AudioEngine_getCurrentTime));
|
||||
cls->defineStaticFunction("getDuration", _SE(js_audio_AudioEngine_getDuration));
|
||||
cls->defineStaticFunction("getDurationFromFile", _SE(js_audio_AudioEngine_getDurationFromFile));
|
||||
cls->defineStaticFunction("getState", _SE(js_audio_AudioEngine_getState));
|
||||
cls->defineStaticFunction("setFinishCallback", _SE(js_audio_AudioEngine_setFinishCallback));
|
||||
cls->defineStaticFunction("getMaxAudioInstance", _SE(js_audio_AudioEngine_getMaxAudioInstance));
|
||||
cls->defineStaticFunction("setMaxAudioInstance", _SE(js_audio_AudioEngine_setMaxAudioInstance));
|
||||
cls->defineStaticFunction("uncache", _SE(js_audio_AudioEngine_uncache));
|
||||
cls->defineStaticFunction("uncacheAll", _SE(js_audio_AudioEngine_uncacheAll));
|
||||
cls->defineStaticFunction("getProfile", _SE(js_audio_AudioEngine_getProfile));
|
||||
cls->defineStaticFunction("preload", _SE(js_audio_AudioEngine_preload));
|
||||
cls->defineStaticFunction("getPlayingAudioCount", _SE(js_audio_AudioEngine_getPlayingAudioCount));
|
||||
cls->defineStaticFunction("setEnabled", _SE(js_audio_AudioEngine_setEnabled));
|
||||
cls->defineStaticFunction("isEnabled", _SE(js_audio_AudioEngine_isEnabled));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::AudioEngine>(cls);
|
||||
|
||||
|
||||
@@ -23,33 +23,33 @@ bool register_all_audio(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::AudioEngine);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_lazyInit);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setCurrentTime);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getVolume);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_uncache);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_resumeAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_stopAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_pause);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_end);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getMaxAudioInstance);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_isEnabled);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getDurationFromFile);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getCurrentTime);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setMaxAudioInstance);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_isLoop);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_pauseAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_uncacheAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setVolume);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_preload);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setEnabled);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_play2d);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getState);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_resume);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_stop);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getDuration);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setLoop);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getDefaultProfile);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_play2d);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setLoop);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_isLoop);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setVolume);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getVolume);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_pause);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_pauseAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_resume);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_resumeAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_stop);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_stopAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setCurrentTime);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getCurrentTime);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getDuration);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getDurationFromFile);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getState);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setFinishCallback);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getMaxAudioInstance);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setMaxAudioInstance);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_uncache);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_uncacheAll);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getProfile);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_preload);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_getPlayingAudioCount);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_setEnabled);
|
||||
SE_DECLARE_FUNC(js_audio_AudioEngine_isEnabled);
|
||||
|
||||
#endif //#if (USE_AUDIO > 0)
|
||||
|
||||
@@ -739,6 +739,40 @@ static bool js_engine_FileUtils_writeValueVectorToFile(se::State& s) // NOLINT(r
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_FileUtils_writeValueVectorToFile)
|
||||
|
||||
static bool js_engine_FileUtils_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::FileUtils* result = cc::FileUtils::getInstance();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_FileUtils_getInstance)
|
||||
|
||||
static bool js_engine_FileUtils_setDelegate(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<cc::FileUtils*, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_FileUtils_setDelegate : Error processing arguments");
|
||||
cc::FileUtils::setDelegate(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_FileUtils_setDelegate)
|
||||
|
||||
static bool js_engine_FileUtils_normalizePath(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -759,40 +793,6 @@ static bool js_engine_FileUtils_normalizePath(se::State& s) // NOLINT(readabilit
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_FileUtils_normalizePath)
|
||||
|
||||
static bool js_engine_FileUtils_setDelegate(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<cc::FileUtils*, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_FileUtils_setDelegate : Error processing arguments");
|
||||
cc::FileUtils::setDelegate(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_FileUtils_setDelegate)
|
||||
|
||||
static bool js_engine_FileUtils_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::FileUtils* result = cc::FileUtils::getInstance();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_FileUtils_getInstance)
|
||||
|
||||
static bool js_engine_FileUtils_getFileDir(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -863,9 +863,9 @@ bool js_register_engine_FileUtils(se::Object* obj) // NOLINT(readability-identif
|
||||
cls->defineFunction("writeToFile", _SE(js_engine_FileUtils_writeToFile));
|
||||
cls->defineFunction("writeValueMapToFile", _SE(js_engine_FileUtils_writeValueMapToFile));
|
||||
cls->defineFunction("writeValueVectorToFile", _SE(js_engine_FileUtils_writeValueVectorToFile));
|
||||
cls->defineStaticFunction("normalizePath", _SE(js_engine_FileUtils_normalizePath));
|
||||
cls->defineStaticFunction("setDelegate", _SE(js_engine_FileUtils_setDelegate));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_engine_FileUtils_getInstance));
|
||||
cls->defineStaticFunction("setDelegate", _SE(js_engine_FileUtils_setDelegate));
|
||||
cls->defineStaticFunction("normalizePath", _SE(js_engine_FileUtils_normalizePath));
|
||||
cls->defineStaticFunction("getFileDir", _SE(js_engine_FileUtils_getFileDir));
|
||||
cls->defineFinalizeFunction(_SE(js_cc_FileUtils_finalize));
|
||||
cls->install();
|
||||
@@ -1547,17 +1547,17 @@ bool js_register_engine_CanvasRenderingContext2D(se::Object* obj) // NOLINT(read
|
||||
{
|
||||
auto* cls = se::Class::create("CanvasRenderingContext2D", obj, nullptr, _SE(js_engine_CanvasRenderingContext2D_constructor));
|
||||
|
||||
cls->defineProperty("strokeStyle", nullptr, _SE(js_engine_CanvasRenderingContext2D_setStrokeStyle));
|
||||
cls->defineProperty("lineWidth", nullptr, _SE(js_engine_CanvasRenderingContext2D_setLineWidth));
|
||||
cls->defineProperty("lineCap", nullptr, _SE(js_engine_CanvasRenderingContext2D_setLineCap));
|
||||
cls->defineProperty("globalCompositeOperation", nullptr, _SE(js_engine_CanvasRenderingContext2D_setGlobalCompositeOperation));
|
||||
cls->defineProperty("fillStyle", nullptr, _SE(js_engine_CanvasRenderingContext2D_setFillStyle));
|
||||
cls->defineProperty("height", nullptr, _SE(js_engine_CanvasRenderingContext2D_setHeight));
|
||||
cls->defineProperty("width", nullptr, _SE(js_engine_CanvasRenderingContext2D_setWidth));
|
||||
cls->defineProperty("textBaseline", nullptr, _SE(js_engine_CanvasRenderingContext2D_setTextBaseline));
|
||||
cls->defineProperty("lineJoin", nullptr, _SE(js_engine_CanvasRenderingContext2D_setLineJoin));
|
||||
cls->defineProperty("height", nullptr, _SE(js_engine_CanvasRenderingContext2D_setHeight));
|
||||
cls->defineProperty("fillStyle", nullptr, _SE(js_engine_CanvasRenderingContext2D_setFillStyle));
|
||||
cls->defineProperty("font", nullptr, _SE(js_engine_CanvasRenderingContext2D_setFont));
|
||||
cls->defineProperty("globalCompositeOperation", nullptr, _SE(js_engine_CanvasRenderingContext2D_setGlobalCompositeOperation));
|
||||
cls->defineProperty("lineCap", nullptr, _SE(js_engine_CanvasRenderingContext2D_setLineCap));
|
||||
cls->defineProperty("lineJoin", nullptr, _SE(js_engine_CanvasRenderingContext2D_setLineJoin));
|
||||
cls->defineProperty("lineWidth", nullptr, _SE(js_engine_CanvasRenderingContext2D_setLineWidth));
|
||||
cls->defineProperty("strokeStyle", nullptr, _SE(js_engine_CanvasRenderingContext2D_setStrokeStyle));
|
||||
cls->defineProperty("textAlign", nullptr, _SE(js_engine_CanvasRenderingContext2D_setTextAlign));
|
||||
cls->defineProperty("textBaseline", nullptr, _SE(js_engine_CanvasRenderingContext2D_setTextBaseline));
|
||||
cls->defineFunction("beginPath", _SE(js_engine_CanvasRenderingContext2D_beginPath));
|
||||
cls->defineFunction("clearRect", _SE(js_engine_CanvasRenderingContext2D_clearRect));
|
||||
cls->defineFunction("closePath", _SE(js_engine_CanvasRenderingContext2D_closePath));
|
||||
@@ -1588,6 +1588,23 @@ bool js_register_engine_CanvasRenderingContext2D(se::Object* obj) // NOLINT(read
|
||||
se::Object* __jsb_cc_Device_proto = nullptr;
|
||||
se::Class* __jsb_cc_Device_class = nullptr;
|
||||
|
||||
static bool js_engine_Device_getDPI(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
int result = cc::Device::getDPI();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getDPI : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getDPI)
|
||||
|
||||
static bool js_engine_Device_getDevicePixelRatio(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -1639,74 +1656,6 @@ static bool js_engine_Device_setAccelerometerInterval(se::State& s) // NOLINT(re
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_setAccelerometerInterval)
|
||||
|
||||
static bool js_engine_Device_vibrate(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<float, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_vibrate : Error processing arguments");
|
||||
cc::Device::vibrate(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_vibrate)
|
||||
|
||||
static bool js_engine_Device_setKeepScreenOn(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<bool, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_setKeepScreenOn : Error processing arguments");
|
||||
cc::Device::setKeepScreenOn(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_setKeepScreenOn)
|
||||
|
||||
static bool js_engine_Device_getNetworkType(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
auto result = static_cast<int>(cc::Device::getNetworkType());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getNetworkType : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getNetworkType)
|
||||
|
||||
static bool js_engine_Device_getBatteryLevel(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
float result = cc::Device::getBatteryLevel();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getBatteryLevel : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getBatteryLevel)
|
||||
|
||||
static bool js_engine_Device_getDeviceOrientation(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -1724,40 +1673,6 @@ static bool js_engine_Device_getDeviceOrientation(se::State& s) // NOLINT(readab
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getDeviceOrientation)
|
||||
|
||||
static bool js_engine_Device_getDPI(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
int result = cc::Device::getDPI();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getDPI : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getDPI)
|
||||
|
||||
static bool js_engine_Device_getSafeAreaEdge(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::Vec4 result = cc::Device::getSafeAreaEdge();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getSafeAreaEdge : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getSafeAreaEdge)
|
||||
|
||||
static bool js_engine_Device_getDeviceModel(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -1775,23 +1690,108 @@ static bool js_engine_Device_getDeviceModel(se::State& s) // NOLINT(readability-
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getDeviceModel)
|
||||
|
||||
static bool js_engine_Device_setKeepScreenOn(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<bool, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_setKeepScreenOn : Error processing arguments");
|
||||
cc::Device::setKeepScreenOn(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_setKeepScreenOn)
|
||||
|
||||
static bool js_engine_Device_vibrate(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<float, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_vibrate : Error processing arguments");
|
||||
cc::Device::vibrate(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_vibrate)
|
||||
|
||||
static bool js_engine_Device_getBatteryLevel(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
float result = cc::Device::getBatteryLevel();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getBatteryLevel : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getBatteryLevel)
|
||||
|
||||
static bool js_engine_Device_getNetworkType(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
auto result = static_cast<int>(cc::Device::getNetworkType());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getNetworkType : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getNetworkType)
|
||||
|
||||
static bool js_engine_Device_getSafeAreaEdge(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::Vec4 result = cc::Device::getSafeAreaEdge();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_engine_Device_getSafeAreaEdge : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_engine_Device_getSafeAreaEdge)
|
||||
|
||||
|
||||
|
||||
bool js_register_engine_Device(se::Object* obj) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cls = se::Class::create("Device", obj, nullptr, nullptr);
|
||||
|
||||
cls->defineStaticFunction("getDPI", _SE(js_engine_Device_getDPI));
|
||||
cls->defineStaticFunction("getDevicePixelRatio", _SE(js_engine_Device_getDevicePixelRatio));
|
||||
cls->defineStaticFunction("setAccelerometerEnabled", _SE(js_engine_Device_setAccelerometerEnabled));
|
||||
cls->defineStaticFunction("setAccelerometerInterval", _SE(js_engine_Device_setAccelerometerInterval));
|
||||
cls->defineStaticFunction("vibrate", _SE(js_engine_Device_vibrate));
|
||||
cls->defineStaticFunction("setKeepScreenOn", _SE(js_engine_Device_setKeepScreenOn));
|
||||
cls->defineStaticFunction("getNetworkType", _SE(js_engine_Device_getNetworkType));
|
||||
cls->defineStaticFunction("getBatteryLevel", _SE(js_engine_Device_getBatteryLevel));
|
||||
cls->defineStaticFunction("getDeviceOrientation", _SE(js_engine_Device_getDeviceOrientation));
|
||||
cls->defineStaticFunction("getDPI", _SE(js_engine_Device_getDPI));
|
||||
cls->defineStaticFunction("getSafeAreaEdge", _SE(js_engine_Device_getSafeAreaEdge));
|
||||
cls->defineStaticFunction("getDeviceModel", _SE(js_engine_Device_getDeviceModel));
|
||||
cls->defineStaticFunction("setKeepScreenOn", _SE(js_engine_Device_setKeepScreenOn));
|
||||
cls->defineStaticFunction("vibrate", _SE(js_engine_Device_vibrate));
|
||||
cls->defineStaticFunction("getBatteryLevel", _SE(js_engine_Device_getBatteryLevel));
|
||||
cls->defineStaticFunction("getNetworkType", _SE(js_engine_Device_getNetworkType));
|
||||
cls->defineStaticFunction("getSafeAreaEdge", _SE(js_engine_Device_getSafeAreaEdge));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::Device>(cls);
|
||||
|
||||
@@ -1855,9 +1855,9 @@ bool register_all_engine(se::Object* obj)
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_engine_FileUtils(ns);
|
||||
js_register_engine_Device(ns);
|
||||
js_register_engine_CanvasGradient(ns);
|
||||
js_register_engine_CanvasRenderingContext2D(ns);
|
||||
js_register_engine_Device(ns);
|
||||
js_register_engine_SAXParser(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ SE_DECLARE_FUNC(js_engine_FileUtils_writeStringToFile);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_writeToFile);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_writeValueMapToFile);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_writeValueVectorToFile);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_normalizePath);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_setDelegate);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_getInstance);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_setDelegate);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_normalizePath);
|
||||
SE_DECLARE_FUNC(js_engine_FileUtils_getFileDir);
|
||||
|
||||
extern se::Object* __jsb_cc_CanvasGradient_proto;
|
||||
@@ -95,17 +95,17 @@ bool js_register_cc_Device(se::Object* obj);
|
||||
bool register_all_engine(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::Device);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getDPI);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getDevicePixelRatio);
|
||||
SE_DECLARE_FUNC(js_engine_Device_setAccelerometerEnabled);
|
||||
SE_DECLARE_FUNC(js_engine_Device_setAccelerometerInterval);
|
||||
SE_DECLARE_FUNC(js_engine_Device_vibrate);
|
||||
SE_DECLARE_FUNC(js_engine_Device_setKeepScreenOn);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getNetworkType);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getBatteryLevel);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getDeviceOrientation);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getDPI);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getSafeAreaEdge);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getDeviceModel);
|
||||
SE_DECLARE_FUNC(js_engine_Device_setKeepScreenOn);
|
||||
SE_DECLARE_FUNC(js_engine_Device_vibrate);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getBatteryLevel);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getNetworkType);
|
||||
SE_DECLARE_FUNC(js_engine_Device_getSafeAreaEdge);
|
||||
|
||||
extern se::Object* __jsb_cc_SAXParser_proto;
|
||||
extern se::Class* __jsb_cc_SAXParser_class;
|
||||
|
||||
@@ -29,6 +29,25 @@ static bool js_dragonbones_BaseObject_returnToPool(se::State& s) // NOLINT(reada
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_BaseObject_returnToPool)
|
||||
|
||||
static bool js_dragonbones_BaseObject_setMaxCount(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<size_t, false> arg0 = {};
|
||||
HolderType<unsigned int, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_dragonbones_BaseObject_setMaxCount : Error processing arguments");
|
||||
dragonBones::BaseObject::setMaxCount(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_BaseObject_setMaxCount)
|
||||
|
||||
static bool js_dragonbones_BaseObject_clearPool(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -50,25 +69,6 @@ static bool js_dragonbones_BaseObject_clearPool(se::State& s) // NOLINT(readabil
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_BaseObject_clearPool)
|
||||
|
||||
static bool js_dragonbones_BaseObject_setMaxCount(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<size_t, false> arg0 = {};
|
||||
HolderType<unsigned int, false> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_dragonbones_BaseObject_setMaxCount : Error processing arguments");
|
||||
dragonBones::BaseObject::setMaxCount(arg0.value(), arg1.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_BaseObject_setMaxCount)
|
||||
|
||||
|
||||
|
||||
bool js_register_dragonbones_BaseObject(se::Object* obj) // NOLINT(readability-identifier-naming)
|
||||
@@ -76,8 +76,8 @@ bool js_register_dragonbones_BaseObject(se::Object* obj) // NOLINT(readability-i
|
||||
auto* cls = se::Class::create("BaseObject", obj, nullptr, nullptr);
|
||||
|
||||
cls->defineFunction("returnToPool", _SE(js_dragonbones_BaseObject_returnToPool));
|
||||
cls->defineStaticFunction("clearPool", _SE(js_dragonbones_BaseObject_clearPool));
|
||||
cls->defineStaticFunction("setMaxCount", _SE(js_dragonbones_BaseObject_setMaxCount));
|
||||
cls->defineStaticFunction("clearPool", _SE(js_dragonbones_BaseObject_clearPool));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<dragonBones::BaseObject>(cls);
|
||||
|
||||
@@ -6049,19 +6049,6 @@ static bool js_dragonbones_ArmatureCacheMgr_removeArmatureCache(se::State& s) //
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_ArmatureCacheMgr_removeArmatureCache)
|
||||
|
||||
static bool js_dragonbones_ArmatureCacheMgr_destroyInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
dragonBones::ArmatureCacheMgr::destroyInstance();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_ArmatureCacheMgr_destroyInstance)
|
||||
|
||||
static bool js_dragonbones_ArmatureCacheMgr_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -6079,6 +6066,19 @@ static bool js_dragonbones_ArmatureCacheMgr_getInstance(se::State& s) // NOLINT(
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_ArmatureCacheMgr_getInstance)
|
||||
|
||||
static bool js_dragonbones_ArmatureCacheMgr_destroyInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
dragonBones::ArmatureCacheMgr::destroyInstance();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_ArmatureCacheMgr_destroyInstance)
|
||||
|
||||
|
||||
static bool js_dragonBones_ArmatureCacheMgr_finalize(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -6099,8 +6099,8 @@ bool js_register_dragonbones_ArmatureCacheMgr(se::Object* obj) // NOLINT(readabi
|
||||
|
||||
cls->defineFunction("buildArmatureCache", _SE(js_dragonbones_ArmatureCacheMgr_buildArmatureCache));
|
||||
cls->defineFunction("removeArmatureCache", _SE(js_dragonbones_ArmatureCacheMgr_removeArmatureCache));
|
||||
cls->defineStaticFunction("destroyInstance", _SE(js_dragonbones_ArmatureCacheMgr_destroyInstance));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_dragonbones_ArmatureCacheMgr_getInstance));
|
||||
cls->defineStaticFunction("destroyInstance", _SE(js_dragonbones_ArmatureCacheMgr_destroyInstance));
|
||||
cls->defineFinalizeFunction(_SE(js_dragonBones_ArmatureCacheMgr_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<dragonBones::ArmatureCacheMgr>(cls);
|
||||
@@ -7026,19 +7026,6 @@ static bool js_dragonbones_CCFactory_isInit(se::State& s) // NOLINT(readability-
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_CCFactory_isInit)
|
||||
|
||||
static bool js_dragonbones_CCFactory_destroyFactory(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
dragonBones::CCFactory::destroyFactory();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_CCFactory_destroyFactory)
|
||||
|
||||
static bool js_dragonbones_CCFactory_getFactory(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -7056,6 +7043,19 @@ static bool js_dragonbones_CCFactory_getFactory(se::State& s) // NOLINT(readabil
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_CCFactory_getFactory)
|
||||
|
||||
static bool js_dragonbones_CCFactory_destroyFactory(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
dragonBones::CCFactory::destroyFactory();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_dragonbones_CCFactory_destroyFactory)
|
||||
|
||||
static bool js_dragonbones_CCFactory_getClock(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -7118,8 +7118,8 @@ bool js_register_dragonbones_CCFactory(se::Object* obj) // NOLINT(readability-id
|
||||
cls->defineFunction("stopSchedule", _SE(js_dragonbones_CCFactory_stopSchedule));
|
||||
cls->defineFunction("update", _SE(js_dragonbones_CCFactory_update));
|
||||
cls->defineStaticFunction("isInit", _SE(js_dragonbones_CCFactory_isInit));
|
||||
cls->defineStaticFunction("destroyFactory", _SE(js_dragonbones_CCFactory_destroyFactory));
|
||||
cls->defineStaticFunction("getFactory", _SE(js_dragonbones_CCFactory_getFactory));
|
||||
cls->defineStaticFunction("destroyFactory", _SE(js_dragonbones_CCFactory_destroyFactory));
|
||||
cls->defineStaticFunction("getClock", _SE(js_dragonbones_CCFactory_getClock));
|
||||
cls->defineFinalizeFunction(_SE(js_dragonBones_CCFactory_finalize));
|
||||
cls->install();
|
||||
@@ -7180,33 +7180,33 @@ bool register_all_dragonbones(se::Object* obj)
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_dragonbones_BaseObject(ns);
|
||||
js_register_dragonbones_TransformObject(ns);
|
||||
js_register_dragonbones_Slot(ns);
|
||||
js_register_dragonbones_Rectangle(ns);
|
||||
js_register_dragonbones_Matrix(ns);
|
||||
js_register_dragonbones_Transform(ns);
|
||||
js_register_dragonbones_Animation(ns);
|
||||
js_register_dragonbones_TextureData(ns);
|
||||
js_register_dragonbones_CCTextureData(ns);
|
||||
js_register_dragonbones_BaseFactory(ns);
|
||||
js_register_dragonbones_CCFactory(ns);
|
||||
js_register_dragonbones_WorldClock(ns);
|
||||
js_register_dragonbones_Rectangle(ns);
|
||||
js_register_dragonbones_TextureAtlasData(ns);
|
||||
js_register_dragonbones_CCArmatureDisplay(ns);
|
||||
js_register_dragonbones_AnimationState(ns);
|
||||
js_register_dragonbones_BoneData(ns);
|
||||
js_register_dragonbones_TextureData(ns);
|
||||
js_register_dragonbones_ArmatureData(ns);
|
||||
js_register_dragonbones_CCTextureAtlasData(ns);
|
||||
js_register_dragonbones_CCSlot(ns);
|
||||
js_register_dragonbones_Armature(ns);
|
||||
js_register_dragonbones_Bone(ns);
|
||||
js_register_dragonbones_ArmatureCacheMgr(ns);
|
||||
js_register_dragonbones_SkinData(ns);
|
||||
js_register_dragonbones_EventObject(ns);
|
||||
js_register_dragonbones_BoneData(ns);
|
||||
js_register_dragonbones_SlotData(ns);
|
||||
js_register_dragonbones_DragonBonesData(ns);
|
||||
js_register_dragonbones_SkinData(ns);
|
||||
js_register_dragonbones_AnimationData(ns);
|
||||
js_register_dragonbones_Armature(ns);
|
||||
js_register_dragonbones_TransformObject(ns);
|
||||
js_register_dragonbones_AnimationState(ns);
|
||||
js_register_dragonbones_Bone(ns);
|
||||
js_register_dragonbones_Slot(ns);
|
||||
js_register_dragonbones_WorldClock(ns);
|
||||
js_register_dragonbones_Animation(ns);
|
||||
js_register_dragonbones_EventObject(ns);
|
||||
js_register_dragonbones_BaseFactory(ns);
|
||||
js_register_dragonbones_CCSlot(ns);
|
||||
js_register_dragonbones_CCArmatureDisplay(ns);
|
||||
js_register_dragonbones_ArmatureCacheMgr(ns);
|
||||
js_register_dragonbones_CCArmatureCacheDisplay(ns);
|
||||
js_register_dragonbones_CCFactory(ns);
|
||||
js_register_dragonbones_CCTextureAtlasData(ns);
|
||||
js_register_dragonbones_CCTextureData(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ bool register_all_dragonbones(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(dragonBones::BaseObject);
|
||||
SE_DECLARE_FUNC(js_dragonbones_BaseObject_returnToPool);
|
||||
SE_DECLARE_FUNC(js_dragonbones_BaseObject_clearPool);
|
||||
SE_DECLARE_FUNC(js_dragonbones_BaseObject_setMaxCount);
|
||||
SE_DECLARE_FUNC(js_dragonbones_BaseObject_clearPool);
|
||||
|
||||
extern se::Object* __jsb_dragonBones_Rectangle_proto;
|
||||
extern se::Class* __jsb_dragonBones_Rectangle_class;
|
||||
@@ -389,8 +389,8 @@ bool register_all_dragonbones(se::Object* obj);
|
||||
JSB_REGISTER_OBJECT_TYPE(dragonBones::ArmatureCacheMgr);
|
||||
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_buildArmatureCache);
|
||||
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_removeArmatureCache);
|
||||
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_destroyInstance);
|
||||
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_getInstance);
|
||||
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_destroyInstance);
|
||||
|
||||
extern se::Object* __jsb_dragonBones_CCArmatureCacheDisplay_proto;
|
||||
extern se::Class* __jsb_dragonBones_CCArmatureCacheDisplay_class;
|
||||
@@ -447,8 +447,8 @@ SE_DECLARE_FUNC(js_dragonbones_CCFactory_setTimeScale);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_stopSchedule);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_update);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_isInit);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_destroyFactory);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_getFactory);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_destroyFactory);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_getClock);
|
||||
SE_DECLARE_FUNC(js_dragonbones_CCFactory_CCFactory);
|
||||
|
||||
|
||||
@@ -532,6 +532,23 @@ static bool js_editor_support_MiddlewareManager_update(se::State& s) // NOLINT(r
|
||||
}
|
||||
SE_BIND_FUNC(js_editor_support_MiddlewareManager_update)
|
||||
|
||||
static bool js_editor_support_MiddlewareManager_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::middleware::MiddlewareManager* result = cc::middleware::MiddlewareManager::getInstance();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_editor_support_MiddlewareManager_getInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_editor_support_MiddlewareManager_getInstance)
|
||||
|
||||
static bool js_editor_support_MiddlewareManager_destroyInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -562,23 +579,6 @@ static bool js_editor_support_MiddlewareManager_generateModuleID(se::State& s) /
|
||||
}
|
||||
SE_BIND_FUNC(js_editor_support_MiddlewareManager_generateModuleID)
|
||||
|
||||
static bool js_editor_support_MiddlewareManager_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::middleware::MiddlewareManager* result = cc::middleware::MiddlewareManager::getInstance();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_editor_support_MiddlewareManager_getInstance : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_editor_support_MiddlewareManager_getInstance)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cc_middleware_MiddlewareManager_finalize)
|
||||
|
||||
static bool js_editor_support_MiddlewareManager_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
|
||||
@@ -618,9 +618,9 @@ bool js_register_editor_support_MiddlewareManager(se::Object* obj) // NOLINT(rea
|
||||
cls->defineFunction("getVBTypedArrayLength", _SE(js_editor_support_MiddlewareManager_getVBTypedArrayLength));
|
||||
cls->defineFunction("render", _SE(js_editor_support_MiddlewareManager_render));
|
||||
cls->defineFunction("update", _SE(js_editor_support_MiddlewareManager_update));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_editor_support_MiddlewareManager_getInstance));
|
||||
cls->defineStaticFunction("destroyInstance", _SE(js_editor_support_MiddlewareManager_destroyInstance));
|
||||
cls->defineStaticFunction("generateModuleID", _SE(js_editor_support_MiddlewareManager_generateModuleID));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_editor_support_MiddlewareManager_getInstance));
|
||||
cls->defineFinalizeFunction(_SE(js_cc_middleware_MiddlewareManager_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::middleware::MiddlewareManager>(cls);
|
||||
@@ -643,9 +643,9 @@ bool register_all_editor_support(se::Object* obj)
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_editor_support_MiddlewareManager(ns);
|
||||
js_register_editor_support_SharedBufferManager(ns);
|
||||
js_register_editor_support_Texture2D(ns);
|
||||
js_register_editor_support_SharedBufferManager(ns);
|
||||
js_register_editor_support_MiddlewareManager(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getVBTypedArray);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getVBTypedArrayLength);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_render);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_update);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getInstance);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_destroyInstance);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_generateModuleID);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getInstance);
|
||||
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_MiddlewareManager);
|
||||
|
||||
|
||||
@@ -1273,9 +1273,9 @@ bool register_all_extension(se::Object* obj)
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_extension_AssetsManagerEx(ns);
|
||||
js_register_extension_EventAssetsManagerEx(ns);
|
||||
js_register_extension_Manifest(ns);
|
||||
js_register_extension_AssetsManagerEx(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1323
-1910
File diff suppressed because it is too large
Load Diff
@@ -136,6 +136,26 @@ template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::gfx::BindingMappingInfo *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::BindingMappingInfo);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_SwapchainInfo_proto;
|
||||
extern se::Class* __jsb_cc_gfx_SwapchainInfo_class;
|
||||
|
||||
bool js_register_cc_gfx_SwapchainInfo(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::gfx::SwapchainInfo *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::SwapchainInfo);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_DeviceInfo_proto;
|
||||
extern se::Class* __jsb_cc_gfx_DeviceInfo_class;
|
||||
|
||||
bool js_register_cc_gfx_DeviceInfo(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::gfx::DeviceInfo *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceInfo);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_BufferInfo_proto;
|
||||
extern se::Class* __jsb_cc_gfx_BufferInfo_class;
|
||||
|
||||
@@ -546,26 +566,6 @@ template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::gfx::MemoryStatus *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::MemoryStatus);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_DeviceInfo_proto;
|
||||
extern se::Class* __jsb_cc_gfx_DeviceInfo_class;
|
||||
|
||||
bool js_register_cc_gfx_DeviceInfo(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::gfx::DeviceInfo *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceInfo);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_ContextInfo_proto;
|
||||
extern se::Class* __jsb_cc_gfx_ContextInfo_class;
|
||||
|
||||
bool js_register_cc_gfx_ContextInfo(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::gfx::ContextInfo *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::ContextInfo);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_GFXObject_proto;
|
||||
extern se::Class* __jsb_cc_gfx_GFXObject_class;
|
||||
|
||||
@@ -573,7 +573,6 @@ bool js_register_cc_gfx_GFXObject(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::GFXObject);
|
||||
SE_DECLARE_FUNC(js_gfx_GFXObject_resizeObjectID);
|
||||
SE_DECLARE_FUNC(js_gfx_GFXObject_GFXObject);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_Buffer_proto;
|
||||
@@ -608,8 +607,8 @@ bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::CommandBuffer);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_begin);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_beginRenderPassForJS);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindDescriptorSetForJS);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_beginRenderPass);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindDescriptorSet);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindInputAssembler);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindPipelineState);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_blitTexture);
|
||||
@@ -636,18 +635,6 @@ SE_DECLARE_FUNC(js_gfx_CommandBuffer_setStencilWriteMask);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_setViewport);
|
||||
SE_DECLARE_FUNC(js_gfx_CommandBuffer_CommandBuffer);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_Context_proto;
|
||||
extern se::Class* __jsb_cc_gfx_Context_class;
|
||||
|
||||
bool js_register_cc_gfx_Context(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::Context);
|
||||
SE_DECLARE_FUNC(js_gfx_Context_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_Context_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_Context_present);
|
||||
SE_DECLARE_FUNC(js_gfx_Context_Context);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_DescriptorSet_proto;
|
||||
extern se::Class* __jsb_cc_gfx_DescriptorSet_class;
|
||||
|
||||
@@ -696,17 +683,6 @@ SE_DECLARE_FUNC(js_gfx_Framebuffer_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_Framebuffer_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_Framebuffer_Framebuffer);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_GlobalBarrier_proto;
|
||||
extern se::Class* __jsb_cc_gfx_GlobalBarrier_class;
|
||||
|
||||
bool js_register_cc_gfx_GlobalBarrier(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::GlobalBarrier);
|
||||
SE_DECLARE_FUNC(js_gfx_GlobalBarrier_info);
|
||||
SE_DECLARE_FUNC(js_gfx_GlobalBarrier_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_GlobalBarrier_GlobalBarrier);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_PipelineLayout_proto;
|
||||
extern se::Class* __jsb_cc_gfx_PipelineLayout_class;
|
||||
|
||||
@@ -741,7 +717,7 @@ bool register_all_gfx(se::Object* obj);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::Queue);
|
||||
SE_DECLARE_FUNC(js_gfx_Queue_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_Queue_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_Queue_submitForJS);
|
||||
SE_DECLARE_FUNC(js_gfx_Queue_submit);
|
||||
SE_DECLARE_FUNC(js_gfx_Queue_Queue);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_RenderPass_proto;
|
||||
@@ -759,17 +735,6 @@ SE_DECLARE_FUNC(js_gfx_RenderPass_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_RenderPass_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_RenderPass_RenderPass);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_Sampler_proto;
|
||||
extern se::Class* __jsb_cc_gfx_Sampler_class;
|
||||
|
||||
bool js_register_cc_gfx_Sampler(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::Sampler);
|
||||
SE_DECLARE_FUNC(js_gfx_Sampler_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_Sampler_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_Sampler_Sampler);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_Shader_proto;
|
||||
extern se::Class* __jsb_cc_gfx_Shader_class;
|
||||
|
||||
@@ -799,6 +764,43 @@ SE_DECLARE_FUNC(js_gfx_Texture_resize);
|
||||
SE_DECLARE_FUNC(js_gfx_Texture_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_Texture_Texture);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_Swapchain_proto;
|
||||
extern se::Class* __jsb_cc_gfx_Swapchain_class;
|
||||
|
||||
bool js_register_cc_gfx_Swapchain(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::Swapchain);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_createSurface);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_destroySurface);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_getVSyncMode);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_getWindowHandle);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_resize);
|
||||
SE_DECLARE_FUNC(js_gfx_Swapchain_Swapchain);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_GlobalBarrier_proto;
|
||||
extern se::Class* __jsb_cc_gfx_GlobalBarrier_class;
|
||||
|
||||
bool js_register_cc_gfx_GlobalBarrier(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::GlobalBarrier);
|
||||
SE_DECLARE_FUNC(js_gfx_GlobalBarrier_getInfo);
|
||||
SE_DECLARE_FUNC(js_gfx_GlobalBarrier_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_GlobalBarrier_GlobalBarrier);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_Sampler_proto;
|
||||
extern se::Class* __jsb_cc_gfx_Sampler_class;
|
||||
|
||||
bool js_register_cc_gfx_Sampler(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::Sampler);
|
||||
SE_DECLARE_FUNC(js_gfx_Sampler_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_Sampler_Sampler);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_TextureBarrier_proto;
|
||||
extern se::Class* __jsb_cc_gfx_TextureBarrier_class;
|
||||
|
||||
@@ -806,7 +808,7 @@ bool js_register_cc_gfx_TextureBarrier(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureBarrier);
|
||||
SE_DECLARE_FUNC(js_gfx_TextureBarrier_info);
|
||||
SE_DECLARE_FUNC(js_gfx_TextureBarrier_getInfo);
|
||||
SE_DECLARE_FUNC(js_gfx_TextureBarrier_computeHash);
|
||||
SE_DECLARE_FUNC(js_gfx_TextureBarrier_TextureBarrier);
|
||||
|
||||
@@ -823,21 +825,21 @@ SE_DECLARE_FUNC(js_gfx_Device_createCommandBuffer);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createDescriptorSet);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createDescriptorSetLayout);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createFramebuffer);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createGlobalBarrier);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createInputAssembler);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createPipelineLayout);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createPipelineState);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createQueue);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createRenderPass);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createSampler);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createShader);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_createSwapchain);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_devicePixelRatio);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_flushCommandsForJS);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_flushCommands);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_getGlobalBarrier);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_getSampler);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_getTextureBarrier);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_hasFeature);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_initialize);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_present);
|
||||
SE_DECLARE_FUNC(js_gfx_Device_resize);
|
||||
|
||||
extern se::Object* __jsb_cc_gfx_DeviceManager_proto;
|
||||
extern se::Class* __jsb_cc_gfx_DeviceManager_class;
|
||||
@@ -846,7 +848,7 @@ bool js_register_cc_gfx_DeviceManager(se::Object* obj);
|
||||
bool register_all_gfx(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceManager);
|
||||
SE_DECLARE_FUNC(js_gfx_DeviceManager_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_DeviceManager_create);
|
||||
SE_DECLARE_FUNC(js_gfx_DeviceManager_addCustomEvent);
|
||||
SE_DECLARE_FUNC(js_gfx_DeviceManager_destroy);
|
||||
SE_DECLARE_FUNC(js_gfx_DeviceManager_addSurfaceEventListener);
|
||||
|
||||
|
||||
@@ -4826,18 +4826,18 @@ bool register_all_physics(se::Object* obj)
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_physics_World(ns);
|
||||
js_register_physics_RigidBody(ns);
|
||||
js_register_physics_SphereShape(ns);
|
||||
js_register_physics_CylinderShape(ns);
|
||||
js_register_physics_TrimeshShape(ns);
|
||||
js_register_physics_PlaneShape(ns);
|
||||
js_register_physics_DistanceJoint(ns);
|
||||
js_register_physics_RevoluteJoint(ns);
|
||||
js_register_physics_CapsuleShape(ns);
|
||||
js_register_physics_BoxShape(ns);
|
||||
js_register_physics_World(ns);
|
||||
js_register_physics_CapsuleShape(ns);
|
||||
js_register_physics_PlaneShape(ns);
|
||||
js_register_physics_TrimeshShape(ns);
|
||||
js_register_physics_CylinderShape(ns);
|
||||
js_register_physics_ConeShape(ns);
|
||||
js_register_physics_TerrainShape(ns);
|
||||
js_register_physics_RevoluteJoint(ns);
|
||||
js_register_physics_DistanceJoint(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -651,14 +651,17 @@ static bool js_pipeline_RenderPipeline_activate(se::State& s) // NOLINT(readabil
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
bool result = cobj->activate();
|
||||
if (argc == 1) {
|
||||
HolderType<cc::gfx::Swapchain*, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_activate : Error processing arguments");
|
||||
bool result = cobj->activate(arg0.value());
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_activate : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_RenderPipeline_activate)
|
||||
@@ -773,6 +776,25 @@ static bool js_pipeline_RenderPipeline_getGlobalDSManager(se::State& s) // NOLIN
|
||||
}
|
||||
SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getGlobalDSManager)
|
||||
|
||||
static bool js_pipeline_RenderPipeline_getProfiler(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::RenderPipeline>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getProfiler : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::scene::Model* result = cobj->getProfiler();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_getProfiler : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_RenderPipeline_getProfiler)
|
||||
|
||||
static bool js_pipeline_RenderPipeline_getRenderstageByName(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::RenderPipeline>(s);
|
||||
@@ -876,6 +898,25 @@ static bool js_pipeline_RenderPipeline_setPipelineSharedSceneData(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_RenderPipeline_setPipelineSharedSceneData)
|
||||
|
||||
static bool js_pipeline_RenderPipeline_setProfiler(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::RenderPipeline>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_setProfiler : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
HolderType<cc::scene::Model*, false> arg0 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_setProfiler : Error processing arguments");
|
||||
cobj->setProfiler(arg0.value());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_RenderPipeline_setProfiler)
|
||||
|
||||
static bool js_pipeline_RenderPipeline_setValue(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::RenderPipeline>(s);
|
||||
@@ -927,11 +968,13 @@ bool js_register_pipeline_RenderPipeline(se::Object* obj) // NOLINT(readability-
|
||||
cls->defineFunction("activate", _SE(js_pipeline_RenderPipeline_activate));
|
||||
cls->defineFunction("destroy", _SE(js_pipeline_RenderPipeline_destroy));
|
||||
cls->defineFunction("getDevice", _SE(js_pipeline_RenderPipeline_getDevice));
|
||||
cls->defineFunction("getProfiler", _SE(js_pipeline_RenderPipeline_getProfiler));
|
||||
cls->defineFunction("getRenderstageByName", _SE(js_pipeline_RenderPipeline_getRenderstageByName));
|
||||
cls->defineFunction("initialize", _SE(js_pipeline_RenderPipeline_initialize));
|
||||
cls->defineFunction("render", _SE(js_pipeline_RenderPipeline_render));
|
||||
cls->defineFunction("resize", _SE(js_pipeline_RenderPipeline_resize));
|
||||
cls->defineFunction("setPipelineSharedSceneData", _SE(js_pipeline_RenderPipeline_setPipelineSharedSceneData));
|
||||
cls->defineFunction("setProfiler", _SE(js_pipeline_RenderPipeline_setProfiler));
|
||||
cls->defineFunction("setValue", _SE(js_pipeline_RenderPipeline_setValue));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_pipeline_RenderPipeline_getInstance));
|
||||
cls->install();
|
||||
@@ -1990,19 +2033,6 @@ static bool js_pipeline_InstancedBuffer_setDynamicOffset(se::State& s) // NOLINT
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_InstancedBuffer_setDynamicOffset)
|
||||
|
||||
static bool js_pipeline_InstancedBuffer_destroyInstancedBuffer(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::pipeline::InstancedBuffer::destroyInstancedBuffer();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_InstancedBuffer_destroyInstancedBuffer)
|
||||
|
||||
static bool js_pipeline_InstancedBuffer_get(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
@@ -2040,6 +2070,19 @@ static bool js_pipeline_InstancedBuffer_get(se::State& s) // NOLINT(readability-
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_InstancedBuffer_get)
|
||||
|
||||
static bool js_pipeline_InstancedBuffer_destroyInstancedBuffer(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cc::pipeline::InstancedBuffer::destroyInstancedBuffer();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_InstancedBuffer_destroyInstancedBuffer)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_InstancedBuffer_finalize)
|
||||
|
||||
static bool js_pipeline_InstancedBuffer_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
|
||||
@@ -2077,8 +2120,8 @@ bool js_register_pipeline_InstancedBuffer(se::Object* obj) // NOLINT(readability
|
||||
|
||||
cls->defineFunction("destroy", _SE(js_pipeline_InstancedBuffer_destroy));
|
||||
cls->defineFunction("setDynamicOffset", _SE(js_pipeline_InstancedBuffer_setDynamicOffset));
|
||||
cls->defineStaticFunction("destroyInstancedBuffer", _SE(js_pipeline_InstancedBuffer_destroyInstancedBuffer));
|
||||
cls->defineStaticFunction("get", _SE(js_pipeline_InstancedBuffer_get));
|
||||
cls->defineStaticFunction("destroyInstancedBuffer", _SE(js_pipeline_InstancedBuffer_destroyInstancedBuffer));
|
||||
cls->defineFinalizeFunction(_SE(js_cc_pipeline_InstancedBuffer_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::pipeline::InstancedBuffer>(cls);
|
||||
@@ -2092,21 +2135,6 @@ bool js_register_pipeline_InstancedBuffer(se::Object* obj) // NOLINT(readability
|
||||
se::Object* __jsb_cc_pipeline_DeferredPipeline_proto = nullptr;
|
||||
se::Class* __jsb_cc_pipeline_DeferredPipeline_class = nullptr;
|
||||
|
||||
static bool js_pipeline_DeferredPipeline_destroyFrameGraphExternalTexture(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::DeferredPipeline>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_DeferredPipeline_destroyFrameGraphExternalTexture : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->destroyFrameGraphExternalTexture();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_DeferredPipeline_destroyFrameGraphExternalTexture)
|
||||
|
||||
static bool js_pipeline_DeferredPipeline_getClearcolor(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::DeferredPipeline>(s);
|
||||
@@ -2205,36 +2233,6 @@ static bool js_pipeline_DeferredPipeline_getWidth(se::State& s) // NOLINT(readab
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_DeferredPipeline_getWidth)
|
||||
|
||||
static bool js_pipeline_DeferredPipeline_initFrameGraphExternalTexture(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::DeferredPipeline>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_DeferredPipeline_initFrameGraphExternalTexture : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->initFrameGraphExternalTexture();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_DeferredPipeline_initFrameGraphExternalTexture)
|
||||
|
||||
static bool js_pipeline_DeferredPipeline_prepareFrameGraph(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::DeferredPipeline>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_DeferredPipeline_prepareFrameGraph : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->prepareFrameGraph();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_DeferredPipeline_prepareFrameGraph)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_DeferredPipeline_finalize)
|
||||
|
||||
static bool js_pipeline_DeferredPipeline_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
|
||||
@@ -2265,14 +2263,11 @@ bool js_register_pipeline_DeferredPipeline(se::Object* obj) // NOLINT(readabilit
|
||||
{
|
||||
auto* cls = se::Class::create("DeferredPipeline", obj, __jsb_cc_pipeline_RenderPipeline_proto, _SE(js_pipeline_DeferredPipeline_constructor));
|
||||
|
||||
cls->defineFunction("destroyFrameGraphExternalTexture", _SE(js_pipeline_DeferredPipeline_destroyFrameGraphExternalTexture));
|
||||
cls->defineFunction("getClearcolor", _SE(js_pipeline_DeferredPipeline_getClearcolor));
|
||||
cls->defineFunction("getFrameGraph", _SE(js_pipeline_DeferredPipeline_getFrameGraph));
|
||||
cls->defineFunction("getFrameGraphCamera", _SE(js_pipeline_DeferredPipeline_getFrameGraphCamera));
|
||||
cls->defineFunction("getHeight", _SE(js_pipeline_DeferredPipeline_getHeight));
|
||||
cls->defineFunction("getWidth", _SE(js_pipeline_DeferredPipeline_getWidth));
|
||||
cls->defineFunction("initFrameGraphExternalTexture", _SE(js_pipeline_DeferredPipeline_initFrameGraphExternalTexture));
|
||||
cls->defineFunction("prepareFrameGraph", _SE(js_pipeline_DeferredPipeline_prepareFrameGraph));
|
||||
cls->defineFinalizeFunction(_SE(js_cc_pipeline_DeferredPipeline_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::pipeline::DeferredPipeline>(cls);
|
||||
@@ -2507,25 +2502,6 @@ bool js_register_pipeline_LightingStage(se::Object* obj) // NOLINT(readability-i
|
||||
se::Object* __jsb_cc_pipeline_PostprocessStage_proto = nullptr;
|
||||
se::Class* __jsb_cc_pipeline_PostprocessStage_class = nullptr;
|
||||
|
||||
static bool js_pipeline_PostprocessStage_getGlobalSet(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::pipeline::PostprocessStage>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_PostprocessStage_getGlobalSet : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cc::gfx::DescriptorSet* result = cobj->getGlobalSet();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_PostprocessStage_getGlobalSet : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_PostprocessStage_getGlobalSet)
|
||||
|
||||
static bool js_pipeline_PostprocessStage_getInitializeInfo(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -2573,7 +2549,6 @@ bool js_register_pipeline_PostprocessStage(se::Object* obj) // NOLINT(readabilit
|
||||
{
|
||||
auto* cls = se::Class::create("PostprocessStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_PostprocessStage_constructor));
|
||||
|
||||
cls->defineFunction("getGlobalSet", _SE(js_pipeline_PostprocessStage_getGlobalSet));
|
||||
cls->defineStaticFunction("getInitializeInfo", _SE(js_pipeline_PostprocessStage_getInitializeInfo));
|
||||
cls->defineFinalizeFunction(_SE(js_cc_pipeline_PostprocessStage_finalize));
|
||||
cls->install();
|
||||
@@ -2598,24 +2573,24 @@ bool register_all_pipeline(se::Object* obj)
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_pipeline_RenderQueueDesc(ns);
|
||||
js_register_pipeline_RenderFlow(ns);
|
||||
js_register_pipeline_RenderStage(ns);
|
||||
js_register_pipeline_LightingStage(ns);
|
||||
js_register_pipeline_RenderPipeline(ns);
|
||||
js_register_pipeline_RenderStageInfo(ns);
|
||||
js_register_pipeline_ForwardPipeline(ns);
|
||||
js_register_pipeline_GbufferStage(ns);
|
||||
js_register_pipeline_RenderPipelineInfo(ns);
|
||||
js_register_pipeline_ForwardStage(ns);
|
||||
js_register_pipeline_ShadowStage(ns);
|
||||
js_register_pipeline_GlobalDSManager(ns);
|
||||
js_register_pipeline_RenderPipelineInfo(ns);
|
||||
js_register_pipeline_RenderPipeline(ns);
|
||||
js_register_pipeline_ForwardPipeline(ns);
|
||||
js_register_pipeline_RenderFlowInfo(ns);
|
||||
js_register_pipeline_PostprocessStage(ns);
|
||||
js_register_pipeline_RenderFlow(ns);
|
||||
js_register_pipeline_ForwardFlow(ns);
|
||||
js_register_pipeline_RenderStageInfo(ns);
|
||||
js_register_pipeline_RenderStage(ns);
|
||||
js_register_pipeline_ForwardStage(ns);
|
||||
js_register_pipeline_ShadowFlow(ns);
|
||||
js_register_pipeline_ShadowStage(ns);
|
||||
js_register_pipeline_InstancedBuffer(ns);
|
||||
js_register_pipeline_DeferredPipeline(ns);
|
||||
js_register_pipeline_MainFlow(ns);
|
||||
js_register_pipeline_ShadowFlow(ns);
|
||||
js_register_pipeline_GbufferStage(ns);
|
||||
js_register_pipeline_LightingStage(ns);
|
||||
js_register_pipeline_PostprocessStage(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,11 +71,13 @@ JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderPipeline);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_activate);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_destroy);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getDevice);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getProfiler);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getRenderstageByName);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_initialize);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_render);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_resize);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setPipelineSharedSceneData);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setProfiler);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setValue);
|
||||
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getInstance);
|
||||
|
||||
@@ -183,8 +185,8 @@ bool register_all_pipeline(se::Object* obj);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::InstancedBuffer);
|
||||
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_destroy);
|
||||
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_setDynamicOffset);
|
||||
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_destroyInstancedBuffer);
|
||||
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_get);
|
||||
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_destroyInstancedBuffer);
|
||||
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_InstancedBuffer);
|
||||
|
||||
extern se::Object* __jsb_cc_pipeline_DeferredPipeline_proto;
|
||||
@@ -194,14 +196,11 @@ bool js_register_cc_pipeline_DeferredPipeline(se::Object* obj);
|
||||
bool register_all_pipeline(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::DeferredPipeline);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_destroyFrameGraphExternalTexture);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_getClearcolor);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_getFrameGraph);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_getFrameGraphCamera);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_getHeight);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_getWidth);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_initFrameGraphExternalTexture);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_prepareFrameGraph);
|
||||
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_DeferredPipeline);
|
||||
|
||||
extern se::Object* __jsb_cc_pipeline_MainFlow_proto;
|
||||
@@ -243,7 +242,6 @@ bool js_register_cc_pipeline_PostprocessStage(se::Object* obj);
|
||||
bool register_all_pipeline(se::Object* obj);
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::PostprocessStage);
|
||||
SE_DECLARE_FUNC(js_pipeline_PostprocessStage_getGlobalSet);
|
||||
SE_DECLARE_FUNC(js_pipeline_PostprocessStage_getInitializeInfo);
|
||||
SE_DECLARE_FUNC(js_pipeline_PostprocessStage_PostprocessStage);
|
||||
|
||||
|
||||
@@ -6381,59 +6381,70 @@ bool js_register_scene_RenderScene(se::Object* obj) // NOLINT(readability-identi
|
||||
se::Object* __jsb_cc_scene_RenderWindow_proto = nullptr;
|
||||
se::Class* __jsb_cc_scene_RenderWindow_class = nullptr;
|
||||
|
||||
static bool js_scene_RenderWindow_get_hasOnScreenAttachments(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
static bool js_scene_RenderWindow_getHeight(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::scene::RenderWindow>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_get_hasOnScreenAttachments : Invalid Native Object");
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_getHeight : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
unsigned int result = cobj->getHeight();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_scene_RenderWindow_getHeight : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_scene_RenderWindow_getHeight)
|
||||
|
||||
static bool js_scene_RenderWindow_getWidth(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::scene::RenderWindow>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_getWidth : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
unsigned int result = cobj->getWidth();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_scene_RenderWindow_getWidth : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_scene_RenderWindow_getWidth)
|
||||
|
||||
static bool js_scene_RenderWindow_get_swapchain(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::scene::RenderWindow>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_get_swapchain : Invalid Native Object");
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::Value jsret;
|
||||
ok &= nativevalue_to_se(cobj->hasOnScreenAttachments, jsret, s.thisObject() /*ctx*/);
|
||||
ok &= nativevalue_to_se(cobj->swapchain, jsret, s.thisObject() /*ctx*/);
|
||||
s.rval() = jsret;
|
||||
SE_HOLD_RETURN_VALUE(cobj->hasOnScreenAttachments, s.thisObject(), s.rval());
|
||||
SE_HOLD_RETURN_VALUE(cobj->swapchain, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_BIND_PROP_GET(js_scene_RenderWindow_get_hasOnScreenAttachments)
|
||||
SE_BIND_PROP_GET(js_scene_RenderWindow_get_swapchain)
|
||||
|
||||
static bool js_scene_RenderWindow_set_hasOnScreenAttachments(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
static bool js_scene_RenderWindow_set_swapchain(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
auto* cobj = SE_THIS_OBJECT<cc::scene::RenderWindow>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_set_hasOnScreenAttachments : Invalid Native Object");
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_set_swapchain : Invalid Native Object");
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
ok &= sevalue_to_native(args[0], &cobj->hasOnScreenAttachments, s.thisObject());
|
||||
SE_PRECONDITION2(ok, false, "js_scene_RenderWindow_set_hasOnScreenAttachments : Error processing new value");
|
||||
ok &= sevalue_to_native(args[0], &cobj->swapchain, s.thisObject());
|
||||
SE_PRECONDITION2(ok, false, "js_scene_RenderWindow_set_swapchain : Error processing new value");
|
||||
return true;
|
||||
}
|
||||
SE_BIND_PROP_SET(js_scene_RenderWindow_set_hasOnScreenAttachments)
|
||||
|
||||
static bool js_scene_RenderWindow_get_hasOffScreenAttachments(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
auto* cobj = SE_THIS_OBJECT<cc::scene::RenderWindow>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_get_hasOffScreenAttachments : Invalid Native Object");
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::Value jsret;
|
||||
ok &= nativevalue_to_se(cobj->hasOffScreenAttachments, jsret, s.thisObject() /*ctx*/);
|
||||
s.rval() = jsret;
|
||||
SE_HOLD_RETURN_VALUE(cobj->hasOffScreenAttachments, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_BIND_PROP_GET(js_scene_RenderWindow_get_hasOffScreenAttachments)
|
||||
|
||||
static bool js_scene_RenderWindow_set_hasOffScreenAttachments(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
auto* cobj = SE_THIS_OBJECT<cc::scene::RenderWindow>(s);
|
||||
SE_PRECONDITION2(cobj, false, "js_scene_RenderWindow_set_hasOffScreenAttachments : Invalid Native Object");
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
ok &= sevalue_to_native(args[0], &cobj->hasOffScreenAttachments, s.thisObject());
|
||||
SE_PRECONDITION2(ok, false, "js_scene_RenderWindow_set_hasOffScreenAttachments : Error processing new value");
|
||||
return true;
|
||||
}
|
||||
SE_BIND_PROP_SET(js_scene_RenderWindow_set_hasOffScreenAttachments)
|
||||
SE_BIND_PROP_SET(js_scene_RenderWindow_set_swapchain)
|
||||
|
||||
static bool js_scene_RenderWindow_get_frameBuffer(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -6475,13 +6486,9 @@ bool sevalue_to_native(const se::Value &from, cc::scene::RenderWindow * to, se::
|
||||
}
|
||||
se::Value field;
|
||||
bool ok = true;
|
||||
json->getProperty("hasOnScreenAttachments", &field);
|
||||
json->getProperty("swapchain", &field);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->hasOnScreenAttachments), ctx);
|
||||
}
|
||||
json->getProperty("hasOffScreenAttachments", &field);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->hasOffScreenAttachments), ctx);
|
||||
ok &= sevalue_to_native(field, &(to->swapchain), ctx);
|
||||
}
|
||||
json->getProperty("frameBuffer", &field);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
@@ -6526,13 +6533,10 @@ static bool js_scene_RenderWindow_constructor(se::State& s) // NOLINT(readabilit
|
||||
|
||||
cc::scene::RenderWindow* cobj = JSB_ALLOC(cc::scene::RenderWindow);
|
||||
if (argc > 0 && !args[0].isUndefined()) {
|
||||
ok &= sevalue_to_native(args[0], &(cobj->hasOnScreenAttachments), nullptr);
|
||||
ok &= sevalue_to_native(args[0], &(cobj->swapchain), nullptr);
|
||||
}
|
||||
if (argc > 1 && !args[1].isUndefined()) {
|
||||
ok &= sevalue_to_native(args[1], &(cobj->hasOffScreenAttachments), nullptr);
|
||||
}
|
||||
if (argc > 2 && !args[2].isUndefined()) {
|
||||
ok &= sevalue_to_native(args[2], &(cobj->frameBuffer), nullptr);
|
||||
ok &= sevalue_to_native(args[1], &(cobj->frameBuffer), nullptr);
|
||||
}
|
||||
|
||||
if(!ok) {
|
||||
@@ -6566,9 +6570,10 @@ bool js_register_scene_RenderWindow(se::Object* obj) // NOLINT(readability-ident
|
||||
{
|
||||
auto* cls = se::Class::create("RenderWindow", obj, nullptr, _SE(js_scene_RenderWindow_constructor));
|
||||
|
||||
cls->defineProperty("hasOnScreenAttachments", _SE(js_scene_RenderWindow_get_hasOnScreenAttachments), _SE(js_scene_RenderWindow_set_hasOnScreenAttachments));
|
||||
cls->defineProperty("hasOffScreenAttachments", _SE(js_scene_RenderWindow_get_hasOffScreenAttachments), _SE(js_scene_RenderWindow_set_hasOffScreenAttachments));
|
||||
cls->defineProperty("swapchain", _SE(js_scene_RenderWindow_get_swapchain), _SE(js_scene_RenderWindow_set_swapchain));
|
||||
cls->defineProperty("frameBuffer", _SE(js_scene_RenderWindow_get_frameBuffer), _SE(js_scene_RenderWindow_set_frameBuffer));
|
||||
cls->defineFunction("getHeight", _SE(js_scene_RenderWindow_getHeight));
|
||||
cls->defineFunction("getWidth", _SE(js_scene_RenderWindow_getWidth));
|
||||
cls->defineFinalizeFunction(_SE(js_cc_scene_RenderWindow_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::scene::RenderWindow>(cls);
|
||||
@@ -7527,35 +7532,35 @@ bool register_all_scene(se::Object* obj)
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_scene_RenderScene(ns);
|
||||
js_register_scene_Camera(ns);
|
||||
js_register_scene_Fog(ns);
|
||||
js_register_scene_BaseNode(ns);
|
||||
js_register_scene_Scene(ns);
|
||||
js_register_scene_Node(ns);
|
||||
js_register_scene_Frustum(ns);
|
||||
js_register_scene_DrawBatch2D(ns);
|
||||
js_register_scene_Light(ns);
|
||||
js_register_scene_DirectionalLight(ns);
|
||||
js_register_scene_Plane(ns);
|
||||
js_register_scene_Frustum(ns);
|
||||
js_register_scene_AABB(ns);
|
||||
js_register_scene_SpotLight(ns);
|
||||
js_register_scene_SphereLight(ns);
|
||||
js_register_scene_Model(ns);
|
||||
js_register_scene_BakedSkinningModel(ns);
|
||||
js_register_scene_Plane(ns);
|
||||
js_register_scene_JointTransform(ns);
|
||||
js_register_scene_RenderWindow(ns);
|
||||
js_register_scene_Fog(ns);
|
||||
js_register_scene_Shadow(ns);
|
||||
js_register_scene_SubModel(ns);
|
||||
js_register_scene_BakedJointInfo(ns);
|
||||
js_register_scene_AABB(ns);
|
||||
js_register_scene_Ambient(ns);
|
||||
js_register_scene_SkinningModel(ns);
|
||||
js_register_scene_DirectionalLight(ns);
|
||||
js_register_scene_JointInfo(ns);
|
||||
js_register_scene_Root(ns);
|
||||
js_register_scene_Scene(ns);
|
||||
js_register_scene_BakedAnimInfo(ns);
|
||||
js_register_scene_Pass(ns);
|
||||
js_register_scene_Skybox(ns);
|
||||
js_register_scene_Ambient(ns);
|
||||
js_register_scene_PipelineSharedSceneData(ns);
|
||||
js_register_scene_SpotLight(ns);
|
||||
js_register_scene_Root(ns);
|
||||
js_register_scene_SubModel(ns);
|
||||
js_register_scene_Pass(ns);
|
||||
js_register_scene_BakedAnimInfo(ns);
|
||||
js_register_scene_BakedJointInfo(ns);
|
||||
js_register_scene_BakedSkinningModel(ns);
|
||||
js_register_scene_DrawBatch2D(ns);
|
||||
js_register_scene_JointTransform(ns);
|
||||
js_register_scene_JointInfo(ns);
|
||||
js_register_scene_SkinningModel(ns);
|
||||
js_register_scene_RenderScene(ns);
|
||||
js_register_scene_RenderWindow(ns);
|
||||
js_register_scene_Camera(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +410,8 @@ bool register_all_scene(se::Object* obj);
|
||||
template<>
|
||||
bool sevalue_to_native(const se::Value &, cc::scene::RenderWindow *, se::Object *ctx);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::scene::RenderWindow);
|
||||
SE_DECLARE_FUNC(js_scene_RenderWindow_getHeight);
|
||||
SE_DECLARE_FUNC(js_scene_RenderWindow_getWidth);
|
||||
|
||||
extern se::Object* __jsb_cc_scene_Camera_proto;
|
||||
extern se::Class* __jsb_cc_scene_Camera_class;
|
||||
|
||||
@@ -2921,23 +2921,6 @@ static bool js_spine_Bone_updateWorldTransform(se::State& s) // NOLINT(readabili
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_Bone_updateWorldTransform)
|
||||
|
||||
static bool js_spine_Bone_isYDown(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
bool result = spine::Bone::isYDown();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_spine_Bone_isYDown : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_Bone_isYDown)
|
||||
|
||||
static bool js_spine_Bone_setYDown(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -2955,6 +2938,23 @@ static bool js_spine_Bone_setYDown(se::State& s) // NOLINT(readability-identifie
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_Bone_setYDown)
|
||||
|
||||
static bool js_spine_Bone_isYDown(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
bool result = spine::Bone::isYDown();
|
||||
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
|
||||
SE_PRECONDITION2(ok, false, "js_spine_Bone_isYDown : Error processing arguments");
|
||||
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_Bone_isYDown)
|
||||
|
||||
|
||||
|
||||
bool js_register_spine_Bone(se::Object* obj) // NOLINT(readability-identifier-naming)
|
||||
@@ -3019,8 +3019,8 @@ bool js_register_spine_Bone(se::Object* obj) // NOLINT(readability-identifier-na
|
||||
cls->defineFunction("setY", _SE(js_spine_Bone_setY));
|
||||
cls->defineFunction("update", _SE(js_spine_Bone_update));
|
||||
cls->defineFunction("updateWorldTransform", _SE(js_spine_Bone_updateWorldTransform));
|
||||
cls->defineStaticFunction("isYDown", _SE(js_spine_Bone_isYDown));
|
||||
cls->defineStaticFunction("setYDown", _SE(js_spine_Bone_setYDown));
|
||||
cls->defineStaticFunction("isYDown", _SE(js_spine_Bone_isYDown));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<spine::Bone>(cls);
|
||||
|
||||
@@ -13458,7 +13458,7 @@ static bool js_spine_SkeletonRenderer_setAttachment(se::State& s) // NOLINT(read
|
||||
do {
|
||||
if (argc == 2) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
HolderType<const char*, false> arg1 = {};
|
||||
HolderType<char*, false> arg1 = {};
|
||||
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
@@ -13638,7 +13638,7 @@ static bool js_spine_SkeletonRenderer_setSkin(se::State& s) // NOLINT(readabilit
|
||||
size_t argc = args.size();
|
||||
do {
|
||||
if (argc == 1) {
|
||||
HolderType<const char*, false> arg0 = {};
|
||||
HolderType<char*, false> arg0 = {};
|
||||
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
@@ -14902,44 +14902,6 @@ static bool js_spine_SkeletonAnimation_setTrackStartListener(se::State& s) // NO
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonAnimation_setTrackStartListener)
|
||||
|
||||
static bool js_spine_SkeletonAnimation_createWithBinaryFile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
HolderType<std::string, true> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments");
|
||||
auto result = spine::SkeletonAnimation::createWithBinaryFile(arg0.value(), arg1.value());
|
||||
result->retain();
|
||||
auto obj = se::Object::createObjectWithClass(__jsb_spine_SkeletonAnimation_class);
|
||||
obj->setPrivateData(result);
|
||||
s.rval().setObject(obj);
|
||||
return true;
|
||||
}
|
||||
if (argc == 3) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
HolderType<std::string, true> arg1 = {};
|
||||
HolderType<float, false> arg2 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
ok &= sevalue_to_native(args[2], &arg2, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments");
|
||||
auto result = spine::SkeletonAnimation::createWithBinaryFile(arg0.value(), arg1.value(), arg2.value());
|
||||
result->retain();
|
||||
auto obj = se::Object::createObjectWithClass(__jsb_spine_SkeletonAnimation_class);
|
||||
obj->setPrivateData(result);
|
||||
s.rval().setObject(obj);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonAnimation_createWithBinaryFile)
|
||||
|
||||
static bool js_spine_SkeletonAnimation_create(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -14996,6 +14958,44 @@ static bool js_spine_SkeletonAnimation_createWithJsonFile(se::State& s) // NOLIN
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonAnimation_createWithJsonFile)
|
||||
|
||||
static bool js_spine_SkeletonAnimation_createWithBinaryFile(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
HolderType<std::string, true> arg1 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments");
|
||||
auto result = spine::SkeletonAnimation::createWithBinaryFile(arg0.value(), arg1.value());
|
||||
result->retain();
|
||||
auto obj = se::Object::createObjectWithClass(__jsb_spine_SkeletonAnimation_class);
|
||||
obj->setPrivateData(result);
|
||||
s.rval().setObject(obj);
|
||||
return true;
|
||||
}
|
||||
if (argc == 3) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
HolderType<std::string, true> arg1 = {};
|
||||
HolderType<float, false> arg2 = {};
|
||||
ok &= sevalue_to_native(args[0], &arg0, nullptr);
|
||||
ok &= sevalue_to_native(args[1], &arg1, nullptr);
|
||||
ok &= sevalue_to_native(args[2], &arg2, nullptr);
|
||||
SE_PRECONDITION2(ok, false, "js_spine_SkeletonAnimation_createWithBinaryFile : Error processing arguments");
|
||||
auto result = spine::SkeletonAnimation::createWithBinaryFile(arg0.value(), arg1.value(), arg2.value());
|
||||
result->retain();
|
||||
auto obj = se::Object::createObjectWithClass(__jsb_spine_SkeletonAnimation_class);
|
||||
obj->setPrivateData(result);
|
||||
s.rval().setObject(obj);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonAnimation_createWithBinaryFile)
|
||||
|
||||
static bool js_spine_SkeletonAnimation_setGlobalTimeScale(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -15071,9 +15071,9 @@ bool js_register_spine_SkeletonAnimation(se::Object* obj) // NOLINT(readability-
|
||||
cls->defineFunction("setTrackInterruptListener", _SE(js_spine_SkeletonAnimation_setTrackInterruptListener));
|
||||
cls->defineFunction("setTrackStartListener", _SE(js_spine_SkeletonAnimation_setTrackStartListener));
|
||||
cls->defineFunction("ctor", _SE(js_spine_SkeletonAnimation_ctor));
|
||||
cls->defineStaticFunction("createWithBinaryFile", _SE(js_spine_SkeletonAnimation_createWithBinaryFile));
|
||||
cls->defineStaticFunction("create", _SE(js_spine_SkeletonAnimation_create));
|
||||
cls->defineStaticFunction("createWithJsonFile", _SE(js_spine_SkeletonAnimation_createWithJsonFile));
|
||||
cls->defineStaticFunction("createWithBinaryFile", _SE(js_spine_SkeletonAnimation_createWithBinaryFile));
|
||||
cls->defineStaticFunction("setGlobalTimeScale", _SE(js_spine_SkeletonAnimation_setGlobalTimeScale));
|
||||
cls->defineFinalizeFunction(_SE(js_spine_SkeletonAnimation_finalize));
|
||||
cls->install();
|
||||
@@ -15420,7 +15420,7 @@ static bool js_spine_SkeletonCacheAnimation_setAttachment(se::State& s) // NOLIN
|
||||
do {
|
||||
if (argc == 2) {
|
||||
HolderType<std::string, true> arg0 = {};
|
||||
HolderType<const char*, false> arg1 = {};
|
||||
HolderType<char*, false> arg1 = {};
|
||||
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
@@ -15639,7 +15639,7 @@ static bool js_spine_SkeletonCacheAnimation_setSkin(se::State& s) // NOLINT(read
|
||||
size_t argc = args.size();
|
||||
do {
|
||||
if (argc == 1) {
|
||||
HolderType<const char*, false> arg0 = {};
|
||||
HolderType<char*, false> arg0 = {};
|
||||
|
||||
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
|
||||
if (!ok) { ok = true; break; }
|
||||
@@ -15966,19 +15966,6 @@ static bool js_spine_SkeletonCacheMgr_removeSkeletonCache(se::State& s) // NOLIN
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonCacheMgr_removeSkeletonCache)
|
||||
|
||||
static bool js_spine_SkeletonCacheMgr_destroyInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
spine::SkeletonCacheMgr::destroyInstance();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonCacheMgr_destroyInstance)
|
||||
|
||||
static bool js_spine_SkeletonCacheMgr_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -15996,6 +15983,19 @@ static bool js_spine_SkeletonCacheMgr_getInstance(se::State& s) // NOLINT(readab
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonCacheMgr_getInstance)
|
||||
|
||||
static bool js_spine_SkeletonCacheMgr_destroyInstance(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
spine::SkeletonCacheMgr::destroyInstance();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_spine_SkeletonCacheMgr_destroyInstance)
|
||||
|
||||
|
||||
static bool js_spine_SkeletonCacheMgr_finalize(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -16016,8 +16016,8 @@ bool js_register_spine_SkeletonCacheMgr(se::Object* obj) // NOLINT(readability-i
|
||||
|
||||
cls->defineFunction("buildSkeletonCache", _SE(js_spine_SkeletonCacheMgr_buildSkeletonCache));
|
||||
cls->defineFunction("removeSkeletonCache", _SE(js_spine_SkeletonCacheMgr_removeSkeletonCache));
|
||||
cls->defineStaticFunction("destroyInstance", _SE(js_spine_SkeletonCacheMgr_destroyInstance));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_spine_SkeletonCacheMgr_getInstance));
|
||||
cls->defineStaticFunction("destroyInstance", _SE(js_spine_SkeletonCacheMgr_destroyInstance));
|
||||
cls->defineFinalizeFunction(_SE(js_spine_SkeletonCacheMgr_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<spine::SkeletonCacheMgr>(cls);
|
||||
@@ -16150,63 +16150,63 @@ bool register_all_spine(se::Object* obj)
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_spine_Slot(ns);
|
||||
js_register_spine_ConstraintData(ns);
|
||||
js_register_spine_Polygon(ns);
|
||||
js_register_spine_SkeletonCacheAnimation(ns);
|
||||
js_register_spine_Attachment(ns);
|
||||
js_register_spine_VertexAttachment(ns);
|
||||
js_register_spine_SkeletonDataMgr(ns);
|
||||
js_register_spine_VertexEffect(ns);
|
||||
js_register_spine_JitterVertexEffect(ns);
|
||||
js_register_spine_SkeletonCacheMgr(ns);
|
||||
js_register_spine_Timeline(ns);
|
||||
js_register_spine_CurveTimeline(ns);
|
||||
js_register_spine_IkConstraintTimeline(ns);
|
||||
js_register_spine_SkeletonRenderer(ns);
|
||||
js_register_spine_Animation(ns);
|
||||
js_register_spine_MeshAttachment(ns);
|
||||
js_register_spine_TranslateTimeline(ns);
|
||||
js_register_spine_ShearTimeline(ns);
|
||||
js_register_spine_TrackEntry(ns);
|
||||
js_register_spine_AnimationState(ns);
|
||||
js_register_spine_AnimationStateData(ns);
|
||||
js_register_spine_Attachment(ns);
|
||||
js_register_spine_Timeline(ns);
|
||||
js_register_spine_AttachmentTimeline(ns);
|
||||
js_register_spine_Bone(ns);
|
||||
js_register_spine_BoneData(ns);
|
||||
js_register_spine_VertexAttachment(ns);
|
||||
js_register_spine_BoundingBoxAttachment(ns);
|
||||
js_register_spine_ClippingAttachment(ns);
|
||||
js_register_spine_Color(ns);
|
||||
js_register_spine_CurveTimeline(ns);
|
||||
js_register_spine_ColorTimeline(ns);
|
||||
js_register_spine_ConstraintData(ns);
|
||||
js_register_spine_DeformTimeline(ns);
|
||||
js_register_spine_DrawOrderTimeline(ns);
|
||||
js_register_spine_Event(ns);
|
||||
js_register_spine_EventData(ns);
|
||||
js_register_spine_EventTimeline(ns);
|
||||
js_register_spine_IkConstraint(ns);
|
||||
js_register_spine_IkConstraintData(ns);
|
||||
js_register_spine_IkConstraintTimeline(ns);
|
||||
js_register_spine_MeshAttachment(ns);
|
||||
js_register_spine_PathAttachment(ns);
|
||||
js_register_spine_PathConstraint(ns);
|
||||
js_register_spine_PathConstraintData(ns);
|
||||
js_register_spine_PathConstraintMixTimeline(ns);
|
||||
js_register_spine_PathConstraintPositionTimeline(ns);
|
||||
js_register_spine_PathConstraintSpacingTimeline(ns);
|
||||
js_register_spine_SkeletonAnimation(ns);
|
||||
js_register_spine_IkConstraintData(ns);
|
||||
js_register_spine_SwirlVertexEffect(ns);
|
||||
js_register_spine_AnimationStateData(ns);
|
||||
js_register_spine_PointAttachment(ns);
|
||||
js_register_spine_AnimationState(ns);
|
||||
js_register_spine_TrackEntry(ns);
|
||||
js_register_spine_BoneData(ns);
|
||||
js_register_spine_ScaleTimeline(ns);
|
||||
js_register_spine_SkeletonData(ns);
|
||||
js_register_spine_PathAttachment(ns);
|
||||
js_register_spine_TransformConstraint(ns);
|
||||
js_register_spine_BoundingBoxAttachment(ns);
|
||||
js_register_spine_ClippingAttachment(ns);
|
||||
js_register_spine_DeformTimeline(ns);
|
||||
js_register_spine_SkeletonBounds(ns);
|
||||
js_register_spine_TransformConstraintData(ns);
|
||||
js_register_spine_ColorTimeline(ns);
|
||||
js_register_spine_PathConstraint(ns);
|
||||
js_register_spine_TransformConstraintTimeline(ns);
|
||||
js_register_spine_Bone(ns);
|
||||
js_register_spine_EventTimeline(ns);
|
||||
js_register_spine_Skeleton(ns);
|
||||
js_register_spine_TwoColorTimeline(ns);
|
||||
js_register_spine_Color(ns);
|
||||
js_register_spine_DrawOrderTimeline(ns);
|
||||
js_register_spine_RegionAttachment(ns);
|
||||
js_register_spine_IkConstraint(ns);
|
||||
js_register_spine_RotateTimeline(ns);
|
||||
js_register_spine_SlotData(ns);
|
||||
js_register_spine_TranslateTimeline(ns);
|
||||
js_register_spine_ScaleTimeline(ns);
|
||||
js_register_spine_ShearTimeline(ns);
|
||||
js_register_spine_Skeleton(ns);
|
||||
js_register_spine_SkeletonBounds(ns);
|
||||
js_register_spine_Polygon(ns);
|
||||
js_register_spine_SkeletonData(ns);
|
||||
js_register_spine_Skin(ns);
|
||||
js_register_spine_Slot(ns);
|
||||
js_register_spine_SlotData(ns);
|
||||
js_register_spine_TransformConstraint(ns);
|
||||
js_register_spine_TransformConstraintData(ns);
|
||||
js_register_spine_TransformConstraintTimeline(ns);
|
||||
js_register_spine_TwoColorTimeline(ns);
|
||||
js_register_spine_VertexEffect(ns);
|
||||
js_register_spine_JitterVertexEffect(ns);
|
||||
js_register_spine_SwirlVertexEffect(ns);
|
||||
js_register_spine_VertexEffectDelegate(ns);
|
||||
js_register_spine_EventData(ns);
|
||||
js_register_spine_Event(ns);
|
||||
js_register_spine_PathConstraintData(ns);
|
||||
js_register_spine_SkeletonRenderer(ns);
|
||||
js_register_spine_SkeletonAnimation(ns);
|
||||
js_register_spine_SkeletonCacheAnimation(ns);
|
||||
js_register_spine_SkeletonCacheMgr(ns);
|
||||
js_register_spine_SkeletonDataMgr(ns);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,8 +204,8 @@ SE_DECLARE_FUNC(js_spine_Bone_setX);
|
||||
SE_DECLARE_FUNC(js_spine_Bone_setY);
|
||||
SE_DECLARE_FUNC(js_spine_Bone_update);
|
||||
SE_DECLARE_FUNC(js_spine_Bone_updateWorldTransform);
|
||||
SE_DECLARE_FUNC(js_spine_Bone_isYDown);
|
||||
SE_DECLARE_FUNC(js_spine_Bone_setYDown);
|
||||
SE_DECLARE_FUNC(js_spine_Bone_isYDown);
|
||||
|
||||
extern se::Object* __jsb_spine_BoneData_proto;
|
||||
extern se::Class* __jsb_spine_BoneData_class;
|
||||
@@ -1080,9 +1080,9 @@ SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackEndListener);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackEventListener);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackInterruptListener);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackStartListener);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_createWithBinaryFile);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_create);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_createWithJsonFile);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_createWithBinaryFile);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setGlobalTimeScale);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_SkeletonAnimation);
|
||||
|
||||
@@ -1137,8 +1137,8 @@ bool register_all_spine(se::Object* obj);
|
||||
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonCacheMgr);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_buildSkeletonCache);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_removeSkeletonCache);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_destroyInstance);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_getInstance);
|
||||
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_destroyInstance);
|
||||
|
||||
extern se::Object* __jsb_spine_SkeletonDataMgr_proto;
|
||||
extern se::Class* __jsb_spine_SkeletonDataMgr_class;
|
||||
|
||||
@@ -942,7 +942,7 @@ inline bool sevalue_to_native(const se::Value &from, float *to, se::Object * /*c
|
||||
*to = from.toFloat();
|
||||
return true;
|
||||
}
|
||||
inline bool sevalue_to_native(const se::Value &from, double *to, se::Object * /*unused*/) {
|
||||
inline bool sevalue_to_native(const se::Value &from, double *to, se::Object * /*unused*/) { // NOLINT(readability-identifier-naming)
|
||||
*to = from.toDouble();
|
||||
return true;
|
||||
}
|
||||
@@ -1115,9 +1115,18 @@ bool sevalue_to_native(const se::Value &from, std::vector<T, allocator> *to, se:
|
||||
|
||||
template <>
|
||||
inline bool sevalue_to_native(const se::Value &from, void **to, se::Object * /*ctx*/) {
|
||||
SE_LOGE("[warn] don't know how to convert to void *\n");
|
||||
*to = from.toObject()->getPrivateData();
|
||||
return true;
|
||||
assert(to != nullptr);
|
||||
if (from.isNumber()) {
|
||||
// NOLINTNEXTLINE(performance-no-int-to-ptr)
|
||||
*to = reinterpret_cast<void *>(from.toUint64());
|
||||
return true;
|
||||
}
|
||||
if (from.isObject()) {
|
||||
*to = from.toObject()->getPrivateData();
|
||||
return true;
|
||||
}
|
||||
SE_LOGE("[warn] failed to convert to void *\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -470,44 +470,6 @@ static bool js_gfx_CommandBuffer_copyBuffersToTexture(se::State &s) { // NOLINT(
|
||||
}
|
||||
SE_BIND_FUNC(js_gfx_CommandBuffer_copyBuffersToTexture)
|
||||
|
||||
static bool js_gfx_InputAssembler_extractDrawInfo(se::State &s) { // NOLINT(readability-identifier-naming)
|
||||
auto *cobj = static_cast<cc::gfx::InputAssembler *>(s.nativeThisObject());
|
||||
SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_extractDrawInfo : Invalid Native Object");
|
||||
const auto &args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 1) {
|
||||
cc::gfx::DrawInfo nativeDrawInfo;
|
||||
cobj->extractDrawInfo(nativeDrawInfo);
|
||||
|
||||
se::Object *drawInfo = args[0].toObject();
|
||||
se::Value attrValue(nativeDrawInfo.vertexCount);
|
||||
drawInfo->setProperty("vertexCount", attrValue);
|
||||
|
||||
attrValue.setUint32(nativeDrawInfo.firstVertex);
|
||||
drawInfo->setProperty("firstVertex", attrValue);
|
||||
|
||||
attrValue.setUint32(nativeDrawInfo.indexCount);
|
||||
drawInfo->setProperty("indexCount", attrValue);
|
||||
|
||||
attrValue.setUint32(nativeDrawInfo.firstIndex);
|
||||
drawInfo->setProperty("firstIndex", attrValue);
|
||||
|
||||
attrValue.setUint32(nativeDrawInfo.vertexOffset);
|
||||
drawInfo->setProperty("vertexOffset", attrValue);
|
||||
|
||||
attrValue.setUint32(nativeDrawInfo.instanceCount);
|
||||
drawInfo->setProperty("instanceCount", attrValue);
|
||||
|
||||
attrValue.setUint32(nativeDrawInfo.firstInstance);
|
||||
drawInfo->setProperty("firstInstance", attrValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_gfx_InputAssembler_extractDrawInfo)
|
||||
|
||||
bool js_gfx_get_deviceInstance(se::State &s) { // NOLINT(readability-identifier-naming)
|
||||
nativevalue_to_se(cc::gfx::Device::getInstance(), s.rval(), nullptr);
|
||||
return true;
|
||||
@@ -528,8 +490,6 @@ bool register_all_gfx_manual(se::Object *obj) {
|
||||
__jsb_cc_gfx_CommandBuffer_proto->defineFunction("updateBuffer", _SE(js_gfx_CommandBuffer_updateBuffer));
|
||||
__jsb_cc_gfx_CommandBuffer_proto->defineFunction("copyBuffersToTexture", _SE(js_gfx_CommandBuffer_copyBuffersToTexture));
|
||||
|
||||
__jsb_cc_gfx_InputAssembler_proto->defineFunction("extractDrawInfo", _SE(js_gfx_InputAssembler_extractDrawInfo));
|
||||
|
||||
__jsb_cc_gfx_Buffer_proto->defineFunction("initialize", _SE(js_gfx_Buffer_initialize));
|
||||
__jsb_cc_gfx_Texture_proto->defineFunction("initialize", _SE(js_gfx_Texture_initialize));
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ void Application::restartVM() {
|
||||
|
||||
cc::EventDispatcher::init();
|
||||
init();
|
||||
cc::gfx::DeviceManager::addCustomEvent();
|
||||
cc::gfx::DeviceManager::addSurfaceEventListener();
|
||||
}
|
||||
|
||||
void Application::close() { // NOLINT
|
||||
|
||||
@@ -27,16 +27,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/Ref.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "base/Ref.h"
|
||||
#include "gfx-base/GFXDef.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace gfx {
|
||||
enum class Format;
|
||||
} // namespace gfx
|
||||
|
||||
class Image : public Ref {
|
||||
public:
|
||||
Image();
|
||||
@@ -72,17 +69,17 @@ public:
|
||||
// data will be free ouside.
|
||||
inline void takeData(unsigned char **outData) {
|
||||
*outData = _data;
|
||||
_data = nullptr;
|
||||
_data = nullptr;
|
||||
}
|
||||
|
||||
// Getters
|
||||
inline unsigned char *getData() const { return _data; }
|
||||
inline ssize_t getDataLen() const { return _dataLen; }
|
||||
inline Format getFileType() const { return _fileType; }
|
||||
inline gfx::Format getRenderFormat() const { return _renderFormat; }
|
||||
inline int getWidth() const { return _width; }
|
||||
inline int getHeight() const { return _height; }
|
||||
inline std::string getFilePath() const { return _filePath; }
|
||||
inline ssize_t getDataLen() const { return _dataLen; }
|
||||
inline Format getFileType() const { return _fileType; }
|
||||
inline gfx::Format getRenderFormat() const { return _renderFormat; }
|
||||
inline int getWidth() const { return _width; }
|
||||
inline int getHeight() const { return _height; }
|
||||
inline std::string getFilePath() const { return _filePath; }
|
||||
|
||||
inline bool isCompressed() const { return _isCompressed; }
|
||||
|
||||
@@ -97,25 +94,25 @@ protected:
|
||||
bool initWithETC2Data(const unsigned char *data, ssize_t dataLen);
|
||||
bool initWithASTCData(const unsigned char *data, ssize_t dataLen);
|
||||
|
||||
unsigned char *_data = nullptr;
|
||||
ssize_t _dataLen = 0;
|
||||
int _width = 0;
|
||||
int _height = 0;
|
||||
Format _fileType = Format::UNKNOWN;
|
||||
gfx::Format _renderFormat;
|
||||
std::string _filePath;
|
||||
bool _isCompressed = false;
|
||||
unsigned char *_data = nullptr;
|
||||
ssize_t _dataLen = 0;
|
||||
int _width = 0;
|
||||
int _height = 0;
|
||||
Format _fileType = Format::UNKNOWN;
|
||||
gfx::Format _renderFormat;
|
||||
std::string _filePath;
|
||||
bool _isCompressed = false;
|
||||
|
||||
~Image() override;
|
||||
|
||||
static Format detectFormat(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isPng(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isJpg(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isWebp(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isPvr(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isEtc(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isEtc2(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isASTC(const unsigned char *data, ssize_t detaLen);
|
||||
static bool isPng(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isJpg(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isWebp(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isPvr(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isEtc(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isEtc2(const unsigned char *data, ssize_t dataLen);
|
||||
static bool isASTC(const unsigned char *data, ssize_t detaLen);
|
||||
|
||||
static gfx::Format getASTCFormat(const unsigned char *pHeader);
|
||||
};
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#import <AppKit/NSView.h>
|
||||
#ifdef CC_USE_METAL
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#endif
|
||||
#import <MetalKit/MetalKit.h>
|
||||
|
||||
@interface View : NSView <CALayerDelegate>
|
||||
|
||||
|
||||
@@ -27,14 +27,17 @@
|
||||
|
||||
#include "bindings/event/CustomEventTypes.h"
|
||||
#include "bindings/event/EventDispatcher.h"
|
||||
|
||||
#include "gfx-agent/DeviceAgent.h"
|
||||
#include "gfx-empty/EmptyDevice.h"
|
||||
#include "gfx-validator/DeviceValidator.h"
|
||||
|
||||
//#undef CC_USE_VULKAN
|
||||
//#undef CC_USE_METAL
|
||||
//#undef CC_USE_GLES3
|
||||
//#undef CC_USE_GLES2
|
||||
|
||||
|
||||
#ifdef CC_USE_VULKAN
|
||||
#include "gfx-vulkan/GFXVulkan.h"
|
||||
#endif
|
||||
@@ -89,14 +92,15 @@ public:
|
||||
static void destroy() {
|
||||
CC_SAFE_DESTROY(Device::instance);
|
||||
}
|
||||
static void addCustomEvent() {
|
||||
|
||||
static void addSurfaceEventListener() {
|
||||
Device *device = Device::instance;
|
||||
EventDispatcher::addCustomEventListener(EVENT_DESTROY_WINDOW, [device](const CustomEvent &e) -> void {
|
||||
device->releaseSurface(reinterpret_cast<uintptr_t>(e.args->ptrVal));
|
||||
device->destroySurface(e.args->ptrVal);
|
||||
});
|
||||
|
||||
EventDispatcher::addCustomEventListener(EVENT_RECREATE_WINDOW, [device](const CustomEvent &e) -> void {
|
||||
device->acquireSurface(reinterpret_cast<uintptr_t>(e.args->ptrVal));
|
||||
device->createSurface(e.args->ptrVal);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -118,7 +122,7 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
addCustomEvent();
|
||||
addSurfaceEventListener();
|
||||
*pDevice = device;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
Blackboard &operator=(Blackboard &&) = delete;
|
||||
|
||||
inline ValueType &operator[](const KeyType &name) noexcept;
|
||||
inline void put(const KeyType &name, ValueType const handle) noexcept;
|
||||
inline void put(const KeyType &name, ValueType handle) noexcept;
|
||||
inline ValueType get(const KeyType &name) const noexcept;
|
||||
inline void clear() noexcept;
|
||||
inline bool has(const KeyType &name) const noexcept;
|
||||
|
||||
@@ -26,19 +26,19 @@
|
||||
#include "DevicePass.h"
|
||||
#include <algorithm>
|
||||
#include "CallbackPass.h"
|
||||
#include "DevicePassResourceTable.h"
|
||||
#include "FrameGraph.h"
|
||||
#include "PassNode.h"
|
||||
#include "ResourceNode.h"
|
||||
#include "gfx-base/GFXCommandBuffer.h"
|
||||
#include "DevicePassResourceTable.h"
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
|
||||
DevicePass::DevicePass(const FrameGraph &graph, std::vector<PassNode *> const &subPassNodes) {
|
||||
DevicePass::DevicePass(const FrameGraph &graph, std::vector<PassNode *> const &subpassNodes) {
|
||||
std::vector<RenderTargetAttachment> attachments;
|
||||
|
||||
for (const PassNode *const passNode : subPassNodes) {
|
||||
for (const PassNode *passNode : subpassNodes) {
|
||||
append(graph, passNode, &attachments);
|
||||
}
|
||||
|
||||
@@ -48,19 +48,19 @@ DevicePass::DevicePass(const FrameGraph &graph, std::vector<PassNode *> const &s
|
||||
for (auto &attachment : attachments) {
|
||||
const ResourceNode &resourceNode = graph.getResourceNode(attachment.textureHandle);
|
||||
CC_ASSERT(resourceNode.virtualResource);
|
||||
|
||||
gfx::Texture *resource = static_cast<ResourceEntry<Texture> *>(resourceNode.virtualResource)->getDeviceResource();
|
||||
CC_ASSERT(resource);
|
||||
|
||||
_attachments.emplace_back();
|
||||
_attachments.back().attachment = std::move(attachment);
|
||||
_attachments.back().renderTarget = static_cast<ResourceEntry<Texture> *>(resourceNode.virtualResource)->getDeviceResource();
|
||||
//CC_ASSERT(_attachments.back().renderTarget); // back buffer doesn't have a device resource instance, for now
|
||||
renderTargets.emplace_back(_attachments.back().renderTarget);
|
||||
_attachments.back().renderTarget = resource;
|
||||
renderTargets.emplace_back(resource);
|
||||
}
|
||||
|
||||
bool const multiSubPass = subPassNodes.size() > 1;
|
||||
|
||||
for (PassNode *const passNode : subPassNodes) {
|
||||
_resourceTable.extract(graph, passNode, multiSubPass, renderTargets);
|
||||
for (PassNode *const passNode : subpassNodes) {
|
||||
_resourceTable.extract(graph, passNode, renderTargets);
|
||||
}
|
||||
_resourceTable._devicePass = this;
|
||||
}
|
||||
|
||||
void DevicePass::execute() {
|
||||
@@ -69,8 +69,8 @@ void DevicePass::execute() {
|
||||
begin(cmdBuff);
|
||||
|
||||
for (size_t i = 0; i < _subpasses.size(); ++i) {
|
||||
Subpass &subPass = _subpasses[i];
|
||||
for (LogicPass &pass : subPass.logicPasses) {
|
||||
Subpass &subpass = _subpasses[i];
|
||||
for (LogicPass &pass : subpass.logicPasses) {
|
||||
gfx::Viewport &viewport = pass.customViewport ? pass.viewport : _viewport;
|
||||
gfx::Rect & scissor = pass.customViewport ? pass.scissor : _scissor;
|
||||
|
||||
@@ -93,42 +93,63 @@ void DevicePass::execute() {
|
||||
}
|
||||
|
||||
void DevicePass::append(const FrameGraph &graph, const PassNode *passNode, std::vector<RenderTargetAttachment> *attachments) {
|
||||
_subpasses.emplace_back();
|
||||
Subpass &subPass = _subpasses.back();
|
||||
Subpass &subpass = _subpasses.emplace_back();
|
||||
|
||||
do {
|
||||
subPass.logicPasses.emplace_back();
|
||||
LogicPass &logicPass = subPass.logicPasses.back();
|
||||
subpass.logicPasses.emplace_back();
|
||||
LogicPass &logicPass = subpass.logicPasses.back();
|
||||
logicPass.pass = passNode->_pass.get();
|
||||
logicPass.customViewport = passNode->_customViewport;
|
||||
logicPass.viewport = passNode->_viewport;
|
||||
logicPass.scissor = passNode->_scissor;
|
||||
|
||||
std::for_each(passNode->_attachments.begin(), passNode->_attachments.end(), [&, this](const RenderTargetAttachment &attachment) {
|
||||
append(graph, attachment, attachments);
|
||||
});
|
||||
for (const auto &attachment : passNode->_attachments) {
|
||||
append(graph, attachment, attachments, &subpass.desc, passNode->_reads);
|
||||
}
|
||||
|
||||
for (const auto &handle : passNode->_reads) {
|
||||
const auto it = std::find_if(attachments->begin(), attachments->end(), [&handle](const RenderTargetAttachment &attachment) {
|
||||
return attachment.textureHandle == handle;
|
||||
});
|
||||
if (it != attachments->end()) {
|
||||
uint input = utils::toUint(it - attachments->begin());
|
||||
if (std::find(subpass.desc.inputs.begin(), subpass.desc.inputs.end(), input) == subpass.desc.inputs.end()) {
|
||||
subpass.desc.inputs.push_back(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
passNode = passNode->_next;
|
||||
} while (passNode);
|
||||
}
|
||||
|
||||
void DevicePass::append(const FrameGraph &graph, const RenderTargetAttachment &attachment, std::vector<RenderTargetAttachment> *attachments) {
|
||||
void DevicePass::append(const FrameGraph &graph, const RenderTargetAttachment &attachment,
|
||||
std::vector<RenderTargetAttachment> *attachments, gfx::SubpassInfo *subpass, const std::vector<Handle> &reads) {
|
||||
auto it = std::find_if(attachments->begin(), attachments->end(), [&attachment](const RenderTargetAttachment &x) {
|
||||
return attachment.desc.usage == x.desc.usage && attachment.desc.slot == x.desc.slot;
|
||||
});
|
||||
|
||||
RenderTargetAttachment *output{nullptr};
|
||||
|
||||
if (it == attachments->end()) {
|
||||
attachments->emplace_back(attachment);
|
||||
output = &attachments->emplace_back(attachment);
|
||||
_usedRenderTargetSlotMask |= 1 << attachment.desc.slot;
|
||||
} else {
|
||||
const ResourceNode &resourceNodeA = graph.getResourceNode(it->textureHandle);
|
||||
const ResourceNode &resourceNodeB = graph.getResourceNode(attachment.textureHandle);
|
||||
|
||||
if (resourceNodeA.virtualResource == resourceNodeB.virtualResource) {
|
||||
if (attachment.storeOp != gfx::StoreOp::DISCARD) it->storeOp = attachment.storeOp;
|
||||
output = &*it;
|
||||
if (attachment.storeOp != gfx::StoreOp::DISCARD) {
|
||||
output->storeOp = attachment.storeOp;
|
||||
output->desc.endAccesses = attachment.desc.endAccesses;
|
||||
}
|
||||
if (std::find(reads.begin(), reads.end(), output->textureHandle) != reads.end()) {
|
||||
output->isGeneralLayout = true; // it's an 'inout' attachment
|
||||
}
|
||||
} else {
|
||||
CC_ASSERT(attachment.desc.usage == RenderTargetAttachment::Usage::COLOR);
|
||||
attachments->emplace_back(attachment);
|
||||
output = &attachments->emplace_back(attachment);
|
||||
|
||||
for (uint8_t i = 0; i < RenderTargetAttachment::DEPTH_STENCIL_SLOT_START; ++i) {
|
||||
if ((_usedRenderTargetSlotMask & (1 << i)) == 0) {
|
||||
@@ -138,10 +159,14 @@ void DevicePass::append(const FrameGraph &graph, const RenderTargetAttachment &a
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const RenderPass &DevicePassResourceTable::getRenderPass() const {
|
||||
return _devicePass->getRenderPass();
|
||||
if (attachment.desc.usage == RenderTargetAttachment::Usage::COLOR) {
|
||||
if (std::find(subpass->colors.begin(), subpass->colors.end(), output->desc.slot) == subpass->colors.end()) {
|
||||
subpass->colors.push_back(output->desc.slot);
|
||||
}
|
||||
} else {
|
||||
subpass->depthStencil = output->desc.slot;
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePass::begin(gfx::CommandBuffer *cmdBuff) {
|
||||
@@ -155,35 +180,46 @@ void DevicePass::begin(gfx::CommandBuffer *cmdBuff) {
|
||||
clearColors.clear();
|
||||
_viewport = gfx::Viewport();
|
||||
_scissor = gfx::Rect();
|
||||
|
||||
for (const auto &attachElem : _attachments) {
|
||||
gfx::Texture *attachment = attachElem.renderTarget;
|
||||
if (attachElem.attachment.desc.usage == RenderTargetAttachment::Usage::COLOR) {
|
||||
rpInfo.colorAttachments.emplace_back();
|
||||
rpInfo.colorAttachments.back().format = attachment ? attachment->getFormat() : gfx::Device::getInstance()->getColorFormat();
|
||||
rpInfo.colorAttachments.back().loadOp = attachElem.attachment.desc.loadOp;
|
||||
rpInfo.colorAttachments.back().storeOp = attachElem.attachment.storeOp;
|
||||
rpInfo.colorAttachments.back().beginAccesses = attachElem.attachment.desc.beginAccesses;
|
||||
rpInfo.colorAttachments.back().endAccesses = attachElem.attachment.desc.endAccesses;
|
||||
auto &attachmentInfo = rpInfo.colorAttachments.emplace_back();
|
||||
attachmentInfo.format = attachment->getFormat();
|
||||
attachmentInfo.loadOp = attachElem.attachment.desc.loadOp;
|
||||
attachmentInfo.storeOp = attachElem.attachment.storeOp;
|
||||
attachmentInfo.beginAccesses = attachElem.attachment.desc.beginAccesses;
|
||||
attachmentInfo.endAccesses = attachElem.attachment.desc.endAccesses;
|
||||
attachmentInfo.isGeneralLayout = attachElem.attachment.isGeneralLayout;
|
||||
fboInfo.colorTextures.push_back(attachElem.renderTarget);
|
||||
_viewport.width = _scissor.width = attachment->getWidth();
|
||||
_viewport.height = _scissor.height = attachment->getHeight();
|
||||
clearColors.emplace_back(attachElem.attachment.desc.clearColor);
|
||||
_viewport.width = _scissor.width = attachment ? attachment->getWidth() : gfx::Device::getInstance()->getWidth();
|
||||
_viewport.height = _scissor.height = attachment ? attachment->getHeight() : gfx::Device::getInstance()->getHeight();
|
||||
} else {
|
||||
rpInfo.depthStencilAttachment.format = attachment ? attachment->getFormat() : gfx::Device::getInstance()->getDepthStencilFormat();
|
||||
rpInfo.depthStencilAttachment.depthLoadOp = attachElem.attachment.desc.loadOp;
|
||||
rpInfo.depthStencilAttachment.depthStoreOp = attachElem.attachment.storeOp;
|
||||
rpInfo.depthStencilAttachment.stencilLoadOp = attachElem.attachment.desc.loadOp;
|
||||
rpInfo.depthStencilAttachment.stencilStoreOp = attachElem.attachment.storeOp;
|
||||
rpInfo.depthStencilAttachment.beginAccesses = attachElem.attachment.desc.beginAccesses;
|
||||
rpInfo.depthStencilAttachment.endAccesses = attachElem.attachment.desc.endAccesses;
|
||||
fboInfo.depthStencilTexture = attachElem.renderTarget;
|
||||
clearDepth = attachElem.attachment.desc.clearDepth;
|
||||
clearStencil = attachElem.attachment.desc.clearStencil;
|
||||
auto &attachmentInfo = rpInfo.depthStencilAttachment;
|
||||
attachmentInfo.format = attachment->getFormat();
|
||||
attachmentInfo.depthLoadOp = attachElem.attachment.desc.loadOp;
|
||||
attachmentInfo.stencilLoadOp = attachElem.attachment.desc.loadOp;
|
||||
attachmentInfo.depthStoreOp = attachElem.attachment.storeOp;
|
||||
attachmentInfo.stencilStoreOp = attachElem.attachment.storeOp;
|
||||
attachmentInfo.beginAccesses = attachElem.attachment.desc.beginAccesses;
|
||||
attachmentInfo.endAccesses = attachElem.attachment.desc.endAccesses;
|
||||
attachmentInfo.isGeneralLayout = attachElem.attachment.isGeneralLayout;
|
||||
fboInfo.depthStencilTexture = attachElem.renderTarget;
|
||||
_viewport.width = _scissor.width = attachment->getWidth();
|
||||
_viewport.height = _scissor.height = attachment->getHeight();
|
||||
clearDepth = attachElem.attachment.desc.clearDepth;
|
||||
clearStencil = attachElem.attachment.desc.clearStencil;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &subpass : _subpasses) {
|
||||
rpInfo.subpasses.emplace_back(subpass.desc);
|
||||
}
|
||||
|
||||
_renderPass = RenderPass(rpInfo);
|
||||
_renderPass.createTransient();
|
||||
_resourceTable._renderPass = _renderPass.get();
|
||||
|
||||
fboInfo.renderPass = _renderPass.get();
|
||||
_fbo = Framebuffer(fboInfo);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace framegraph {
|
||||
class DevicePass final {
|
||||
public:
|
||||
DevicePass() = delete;
|
||||
DevicePass(const FrameGraph &graph, std::vector<PassNode *> const &subPassNodes);
|
||||
DevicePass(const FrameGraph &graph, std::vector<PassNode *> const &subpassNodes);
|
||||
DevicePass(const DevicePass &) = delete;
|
||||
DevicePass(DevicePass &&) = delete;
|
||||
~DevicePass() = default;
|
||||
@@ -45,7 +45,6 @@ public:
|
||||
DevicePass &operator=(DevicePass &&) = delete;
|
||||
|
||||
void execute();
|
||||
const RenderPass &getRenderPass() const { return _renderPass; }
|
||||
|
||||
private:
|
||||
struct LogicPass final {
|
||||
@@ -57,6 +56,7 @@ private:
|
||||
|
||||
struct Subpass final {
|
||||
std::vector<LogicPass> logicPasses{};
|
||||
gfx::SubpassInfo desc;
|
||||
};
|
||||
|
||||
struct Attachment final {
|
||||
@@ -65,7 +65,8 @@ private:
|
||||
};
|
||||
|
||||
void append(const FrameGraph &graph, const PassNode *passNode, std::vector<RenderTargetAttachment> *attachments);
|
||||
void append(const FrameGraph &graph, const RenderTargetAttachment &attachment, std::vector<RenderTargetAttachment> *attachments);
|
||||
void append(const FrameGraph &graph, const RenderTargetAttachment &attachment,
|
||||
std::vector<RenderTargetAttachment> *attachments, gfx::SubpassInfo *subpass, const std::vector<Handle> &reads);
|
||||
void begin(gfx::CommandBuffer *cmdBuff);
|
||||
void next(gfx::CommandBuffer *cmdBuff) noexcept;
|
||||
void end(gfx::CommandBuffer *cmdBuff);
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
|
||||
#include "DevicePassResourceTable.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "FrameGraph.h"
|
||||
#include "PassNode.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
@@ -38,15 +38,14 @@ gfx::GFXObject *DevicePassResourceTable::get(const ResourceDictionary &from, Han
|
||||
}
|
||||
|
||||
void DevicePassResourceTable::extract(const FrameGraph & graph,
|
||||
const PassNode *const passNode,
|
||||
bool multiSubPass,
|
||||
const PassNode * passNode,
|
||||
std::vector<const gfx::Texture *> const &renderTargets) noexcept {
|
||||
extract(graph, passNode->_reads, _reads, multiSubPass, renderTargets);
|
||||
extract(graph, passNode->_writes, _writes, true, renderTargets);
|
||||
do {
|
||||
extract(graph, passNode->_reads, _reads, false, renderTargets);
|
||||
extract(graph, passNode->_writes, _writes, true, renderTargets);
|
||||
|
||||
if (passNode->_next) {
|
||||
extract(graph, passNode->_next, multiSubPass, renderTargets);
|
||||
}
|
||||
passNode = passNode->_next;
|
||||
} while (passNode);
|
||||
}
|
||||
|
||||
void DevicePassResourceTable::extract(const FrameGraph & graph,
|
||||
@@ -81,9 +80,7 @@ void DevicePassResourceTable::extract(const FrameGraph & g
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceResource) {
|
||||
to.emplace(handle, deviceResource);
|
||||
}
|
||||
to[handle] = deviceResource;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include "Handle.h"
|
||||
#include "RenderTargetAttachment.h"
|
||||
#include "Resource.h"
|
||||
#include <unordered_map>
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
@@ -54,19 +54,20 @@ public:
|
||||
std::enable_if_t<std::is_base_of<gfx::GFXObject, typename Type::DeviceResource>::value, typename Type::DeviceResource *>
|
||||
getWrite(TypedHandle<Type> handle) const noexcept;
|
||||
|
||||
const RenderPass &getRenderPass() const;
|
||||
gfx::RenderPass *getRenderPass() const { return _renderPass; }
|
||||
|
||||
private:
|
||||
using ResourceDictionary = std::unordered_map<Handle, gfx::GFXObject *, Handle::Hasher>;
|
||||
|
||||
static gfx::GFXObject *get(const ResourceDictionary &from, Handle handle) noexcept;
|
||||
void extract(const FrameGraph &graph, const PassNode *const passNode, bool multiSubPass, std::vector<const gfx::Texture *> const &renderTargets) noexcept;
|
||||
void extract(const FrameGraph &graph, std::vector<Handle> const &from, ResourceDictionary &to, bool ignoreRenderTarget, std::vector<const gfx::Texture *> const &renderTargets) noexcept;
|
||||
void extract(const FrameGraph &graph, const PassNode *passNode, std::vector<const gfx::Texture *> const &renderTargets) noexcept;
|
||||
static void extract(const FrameGraph &graph, std::vector<Handle> const &from, ResourceDictionary &to, bool ignoreRenderTarget, std::vector<const gfx::Texture *> const &renderTargets) noexcept;
|
||||
|
||||
ResourceDictionary _reads{};
|
||||
ResourceDictionary _writes{};
|
||||
|
||||
DevicePass *_devicePass = nullptr;
|
||||
gfx::RenderPass *_renderPass{nullptr};
|
||||
|
||||
friend class DevicePass;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace cc {
|
||||
namespace framegraph {
|
||||
|
||||
namespace {
|
||||
// using function scoped static member
|
||||
// use function scoped static member
|
||||
// to ensure correct initialization order
|
||||
StringPool &getStringPool() {
|
||||
static StringPool pool;
|
||||
@@ -55,7 +55,7 @@ const char *FrameGraph::handleToString(const StringHandle &handle) noexcept {
|
||||
return getStringPool().handleToString(handle);
|
||||
}
|
||||
|
||||
void FrameGraph::present(const TextureHandle &input) {
|
||||
void FrameGraph::present(const TextureHandle &input, gfx::Texture *target) {
|
||||
static const StringHandle S_NAME_PRESENT = FrameGraph::stringToHandle("Present");
|
||||
const ResourceNode & resourceNode = getResourceNode(input);
|
||||
CC_ASSERT(resourceNode.writer);
|
||||
@@ -70,32 +70,32 @@ void FrameGraph::present(const TextureHandle &input) {
|
||||
data.input = builder.read(input);
|
||||
builder.sideEffect();
|
||||
},
|
||||
[](const PassDataPresent &data, const DevicePassResourceTable &table) {
|
||||
[target](const PassDataPresent &data, const DevicePassResourceTable &table) {
|
||||
auto *cmdBuff = gfx::Device::getInstance()->getCommandBuffer();
|
||||
|
||||
gfx::Texture *input = table.getRead(data.input);
|
||||
if (input) {
|
||||
if (input && input != target) {
|
||||
gfx::TextureBlit region;
|
||||
region.srcExtent.width = input->getWidth();
|
||||
region.srcExtent.height = input->getHeight();
|
||||
region.dstExtent.width = input->getWidth();
|
||||
region.dstExtent.height = input->getHeight();
|
||||
cmdBuff->blitTexture(input, nullptr, ®ion, 1, gfx::Filter::POINT);
|
||||
cmdBuff->blitTexture(input, target, ®ion, 1, gfx::Filter::POINT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void FrameGraph::presentLastVersion(const VirtualResource *const virtualResource) {
|
||||
void FrameGraph::presentLastVersion(const VirtualResource *const virtualResource, gfx::Texture *target) {
|
||||
const auto it = std::find_if(_resourceNodes.rbegin(), _resourceNodes.rend(), [&virtualResource](const ResourceNode &node) {
|
||||
return node.virtualResource == virtualResource;
|
||||
});
|
||||
|
||||
CC_ASSERT(it != _resourceNodes.rend());
|
||||
present(TextureHandle(static_cast<Handle::IndexType>(it.base() - _resourceNodes.begin() - 1)));
|
||||
present(TextureHandle(static_cast<Handle::IndexType>(it.base() - _resourceNodes.begin() - 1)), target);
|
||||
}
|
||||
|
||||
void FrameGraph::presentFromBlackboard(const StringHandle &inputName) {
|
||||
present(TextureHandle(_blackboard.get(inputName)));
|
||||
void FrameGraph::presentFromBlackboard(const StringHandle &inputName, gfx::Texture *target) {
|
||||
present(TextureHandle(_blackboard.get(inputName)), target);
|
||||
}
|
||||
|
||||
void FrameGraph::compile() {
|
||||
@@ -416,8 +416,7 @@ void FrameGraph::computeStoreActionAndMemoryless() {
|
||||
const gfx::TextureInfo &textureDesc = static_cast<ResourceEntry<Texture> *>(renderTarget)->get().getDesc();
|
||||
|
||||
renderTarget->_memoryless = renderTarget->_neverLoaded && renderTarget->_neverStored;
|
||||
renderTarget->_memorylessMSAA = textureDesc.samples != gfx::SampleCount::X1 && renderTarget->_writerCount < 2;
|
||||
// TODO(minggo): memoryless gfx::Texture
|
||||
renderTarget->_memorylessMSAA = textureDesc.samples != gfx::SampleCount::ONE && renderTarget->_writerCount < 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,8 +428,8 @@ void FrameGraph::generateDevicePasses() {
|
||||
|
||||
ID passId = 1;
|
||||
|
||||
static std::vector<PassNode *> subPassNodes;
|
||||
subPassNodes.clear();
|
||||
static std::vector<PassNode *> subpassNodes;
|
||||
subpassNodes.clear();
|
||||
|
||||
for (const auto &passNode : _passNodes) {
|
||||
if (passNode->_refCount == 0) {
|
||||
@@ -438,25 +437,25 @@ void FrameGraph::generateDevicePasses() {
|
||||
}
|
||||
|
||||
if (passId != passNode->_devicePassId) {
|
||||
_devicePasses.emplace_back(new DevicePass(*this, subPassNodes));
|
||||
_devicePasses.emplace_back(new DevicePass(*this, subpassNodes));
|
||||
|
||||
for (PassNode *const p : subPassNodes) {
|
||||
for (PassNode *const p : subpassNodes) {
|
||||
p->releaseTransientResources();
|
||||
}
|
||||
|
||||
subPassNodes.clear();
|
||||
subpassNodes.clear();
|
||||
passId = passNode->_devicePassId;
|
||||
}
|
||||
|
||||
passNode->requestTransientResources();
|
||||
subPassNodes.emplace_back(passNode.get());
|
||||
subpassNodes.emplace_back(passNode.get());
|
||||
}
|
||||
|
||||
CC_ASSERT(subPassNodes.size() == 1);
|
||||
CC_ASSERT(subpassNodes.size() == 1);
|
||||
|
||||
_devicePasses.emplace_back(new DevicePass(*this, subPassNodes));
|
||||
_devicePasses.emplace_back(new DevicePass(*this, subpassNodes));
|
||||
|
||||
for (PassNode *const p : subPassNodes) {
|
||||
for (PassNode *const p : subpassNodes) {
|
||||
p->releaseTransientResources();
|
||||
}
|
||||
}
|
||||
@@ -529,7 +528,7 @@ void FrameGraph::exportGraphViz(const std::string &path) {
|
||||
if (attachment) {
|
||||
switch (attachment->desc.loadOp) {
|
||||
case gfx::LoadOp::DISCARD:
|
||||
out << "Discard";
|
||||
out << "DontCare";
|
||||
break;
|
||||
case gfx::LoadOp::CLEAR:
|
||||
out << "Clear";
|
||||
@@ -547,8 +546,9 @@ void FrameGraph::exportGraphViz(const std::string &path) {
|
||||
}
|
||||
|
||||
out << "\", style=filled, fillcolor="
|
||||
<< ((node.virtualResource->isImported()) ? (node.virtualResource->_refCount ? "palegreen" : "palegreen4") : node.version == 0 ? "pink"
|
||||
: (node.virtualResource->_refCount ? "skyblue" : "skyblue4"))
|
||||
<< ((node.virtualResource->isImported())
|
||||
? (node.virtualResource->_refCount ? "palegreen" : "palegreen4")
|
||||
: (node.version == 0 ? "pink" : (node.virtualResource->_refCount ? "skyblue" : "skyblue4")))
|
||||
<< "]\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -53,9 +53,9 @@ public:
|
||||
static StringHandle stringToHandle(const char *name);
|
||||
static const char * handleToString(const StringHandle &handle) noexcept;
|
||||
|
||||
void present(const TextureHandle &input);
|
||||
void presentLastVersion(const VirtualResource *virtualResource);
|
||||
void presentFromBlackboard(const StringHandle &inputName);
|
||||
void present(const TextureHandle &input, gfx::Texture *target);
|
||||
void presentLastVersion(const VirtualResource *virtualResource, gfx::Texture *target);
|
||||
void presentFromBlackboard(const StringHandle &inputName, gfx::Texture *target);
|
||||
void compile();
|
||||
void execute() noexcept;
|
||||
void reset() noexcept;
|
||||
@@ -121,7 +121,7 @@ TypedHandle<ResourceType> FrameGraph::create(const StringHandle &name, const typ
|
||||
|
||||
template <typename ResourceType>
|
||||
TypedHandle<ResourceType> FrameGraph::importExternal(const StringHandle &name, ResourceType &resource) noexcept {
|
||||
//CC_ASSERT(resource.Get()); // back buffer doesn't have a device resource instance, for now
|
||||
CC_ASSERT(resource.get());
|
||||
auto *const virtualResource = new ResourceEntry<ResourceType>(name, static_cast<ID>(_virtualResources.size()), resource);
|
||||
return TypedHandle<ResourceType>(create(virtualResource));
|
||||
}
|
||||
|
||||
@@ -29,26 +29,26 @@
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
|
||||
PassInsertPointManager &PassInsertPointManager::getInstance() noexcept {
|
||||
PassInsertPointManager &PassInsertPointManager::getInstance() {
|
||||
static PassInsertPointManager instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
PassInsertPoint PassInsertPointManager::record(const char *const name, const PassInsertPoint point) noexcept {
|
||||
PassInsertPoint PassInsertPointManager::record(const char *const name, const PassInsertPoint point) {
|
||||
StringHandle nameHandle = _stringPool.find(name);
|
||||
|
||||
if (nameHandle.isValid()) {
|
||||
CC_ASSERT(point == get(nameHandle));
|
||||
return get(nameHandle);
|
||||
} else {
|
||||
nameHandle = _stringPool.stringToHandle(name);
|
||||
CC_ASSERT(nameHandle == _insertPoints.size());
|
||||
_insertPoints.emplace_back(point);
|
||||
return point;
|
||||
}
|
||||
|
||||
nameHandle = _stringPool.stringToHandle(name);
|
||||
CC_ASSERT(nameHandle == _insertPoints.size());
|
||||
_insertPoints.emplace_back(point);
|
||||
return point;
|
||||
}
|
||||
|
||||
PassInsertPoint PassInsertPointManager::get(const char *const name) const noexcept {
|
||||
PassInsertPoint PassInsertPointManager::get(const char *const name) const {
|
||||
const StringHandle nameHandle = _stringPool.find(name);
|
||||
CC_ASSERT(nameHandle.isValid());
|
||||
return get(nameHandle);
|
||||
|
||||
@@ -36,21 +36,21 @@ using PassInsertPoint = uint16_t;
|
||||
|
||||
class PassInsertPointManager final {
|
||||
public:
|
||||
PassInsertPointManager(const PassInsertPointManager &) = delete;
|
||||
PassInsertPointManager(PassInsertPointManager &&) = delete;
|
||||
PassInsertPointManager(const PassInsertPointManager &) = delete;
|
||||
PassInsertPointManager(PassInsertPointManager &&) noexcept = delete;
|
||||
PassInsertPointManager &operator=(const PassInsertPointManager &) = delete;
|
||||
PassInsertPointManager &operator=(PassInsertPointManager &&) = delete;
|
||||
PassInsertPointManager &operator=(PassInsertPointManager &&) noexcept = delete;
|
||||
|
||||
static PassInsertPointManager &getInstance() noexcept;
|
||||
static PassInsertPointManager &getInstance();
|
||||
|
||||
PassInsertPoint record(const char *name, PassInsertPoint point) noexcept;
|
||||
PassInsertPoint get(const char *name) const noexcept;
|
||||
PassInsertPoint record(const char *name, PassInsertPoint point);
|
||||
PassInsertPoint get(const char *name) const;
|
||||
|
||||
private:
|
||||
PassInsertPointManager() = default;
|
||||
~PassInsertPointManager() = default;
|
||||
|
||||
inline PassInsertPoint get(StringHandle name) const noexcept;
|
||||
inline PassInsertPoint get(StringHandle name) const;
|
||||
|
||||
StringPool _stringPool;
|
||||
std::vector<PassInsertPoint> _insertPoints{};
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PassInsertPoint PassInsertPointManager::get(const StringHandle name) const noexcept {
|
||||
PassInsertPoint PassInsertPointManager::get(const StringHandle name) const {
|
||||
return _insertPoints[name];
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "PassNode.h"
|
||||
#include <algorithm>
|
||||
#include "FrameGraph.h"
|
||||
#include "ResourceNode.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
|
||||
PassNode::PassNode(const PassInsertPoint inserPoint, const StringHandle name, const ID &id, Executable *pass) noexcept
|
||||
PassNode::PassNode(const PassInsertPoint inserPoint, const StringHandle name, const ID &id, Executable *pass)
|
||||
: _pass(pass),
|
||||
_name(name),
|
||||
_id(id),
|
||||
@@ -39,8 +39,7 @@ PassNode::PassNode(const PassInsertPoint inserPoint, const StringHandle name, co
|
||||
CC_ASSERT(_name.isValid());
|
||||
}
|
||||
|
||||
Handle PassNode::read(FrameGraph &graph, const Handle &input) noexcept {
|
||||
CC_ASSERT(check(graph, input, _writes));
|
||||
Handle PassNode::read(FrameGraph & /*graph*/, const Handle &input) {
|
||||
const auto it = std::find_if(_reads.begin(), _reads.end(), [input](const Handle handle) {
|
||||
return input == handle;
|
||||
});
|
||||
@@ -52,8 +51,7 @@ Handle PassNode::read(FrameGraph &graph, const Handle &input) noexcept {
|
||||
return input;
|
||||
}
|
||||
|
||||
Handle PassNode::write(FrameGraph &graph, const Handle &output) noexcept {
|
||||
CC_ASSERT(check(graph, output, _reads));
|
||||
Handle PassNode::write(FrameGraph &graph, const Handle &output) {
|
||||
CC_ASSERT(std::find_if(_writes.begin(), _writes.end(), [output](const Handle handle) {
|
||||
return output == handle;
|
||||
}) == _writes.end());
|
||||
@@ -68,7 +66,7 @@ Handle PassNode::write(FrameGraph &graph, const Handle &output) noexcept {
|
||||
return handle;
|
||||
}
|
||||
|
||||
void PassNode::createRenderTargetAttachment(RenderTargetAttachment &&attachment) noexcept {
|
||||
void PassNode::createRenderTargetAttachment(RenderTargetAttachment &&attachment) {
|
||||
if (attachment.desc.usage == RenderTargetAttachment::Usage::COLOR) {
|
||||
if (attachment.desc.slot == 0xff) {
|
||||
for (uint8_t i = 0; i < RenderTargetAttachment::DEPTH_STENCIL_SLOT_START; ++i) {
|
||||
@@ -98,7 +96,7 @@ void PassNode::createRenderTargetAttachment(RenderTargetAttachment &&attachment)
|
||||
_hasClearedAttachment = _hasClearedAttachment || (attachment.desc.loadOp == gfx::LoadOp::CLEAR);
|
||||
}
|
||||
|
||||
bool PassNode::canMerge(const FrameGraph &graph, const PassNode &passNode) const noexcept {
|
||||
bool PassNode::canMerge(const FrameGraph &graph, const PassNode &passNode) const {
|
||||
const size_t attachmentCount = _attachments.size();
|
||||
|
||||
if (passNode._hasClearedAttachment || attachmentCount != passNode._attachments.size()) {
|
||||
@@ -123,7 +121,7 @@ bool PassNode::canMerge(const FrameGraph &graph, const PassNode &passNode) const
|
||||
return true;
|
||||
}
|
||||
|
||||
RenderTargetAttachment *PassNode::getRenderTargetAttachment(const Handle &handle) noexcept {
|
||||
RenderTargetAttachment *PassNode::getRenderTargetAttachment(const Handle &handle) {
|
||||
const auto it = std::find_if(_attachments.begin(), _attachments.end(), [&handle](const RenderTargetAttachment &attachment) {
|
||||
return attachment.textureHandle == handle;
|
||||
});
|
||||
@@ -131,7 +129,7 @@ RenderTargetAttachment *PassNode::getRenderTargetAttachment(const Handle &handle
|
||||
return it == _attachments.end() ? nullptr : &(*it);
|
||||
}
|
||||
|
||||
RenderTargetAttachment *PassNode::getRenderTargetAttachment(const FrameGraph &graph, const VirtualResource *const resource) noexcept {
|
||||
RenderTargetAttachment *PassNode::getRenderTargetAttachment(const FrameGraph &graph, const VirtualResource *const resource) {
|
||||
const auto it = std::find_if(_attachments.begin(), _attachments.end(), [&](const RenderTargetAttachment &attachment) {
|
||||
return graph.getResourceNode(attachment.textureHandle).virtualResource == resource;
|
||||
});
|
||||
@@ -139,56 +137,46 @@ RenderTargetAttachment *PassNode::getRenderTargetAttachment(const FrameGraph &gr
|
||||
return it == _attachments.end() ? nullptr : &(*it);
|
||||
}
|
||||
|
||||
void PassNode::requestTransientResources() noexcept {
|
||||
std::for_each(_resourceRequestArray.begin(), _resourceRequestArray.end(), [](VirtualResource *const resource) {
|
||||
if (!resource->isImported()) {
|
||||
resource->request();
|
||||
}
|
||||
});
|
||||
void PassNode::requestTransientResources() {
|
||||
PassNode *it = this;
|
||||
|
||||
if (_next) {
|
||||
_next->requestTransientResources();
|
||||
}
|
||||
do {
|
||||
std::for_each(it->_resourceRequestArray.begin(), it->_resourceRequestArray.end(), [](VirtualResource *const resource) {
|
||||
if (!resource->isImported()) {
|
||||
resource->request();
|
||||
}
|
||||
});
|
||||
|
||||
it = it->_next;
|
||||
} while (it);
|
||||
}
|
||||
|
||||
void PassNode::releaseTransientResources() noexcept {
|
||||
std::for_each(_resourceReleaseArray.begin(), _resourceReleaseArray.end(), [](VirtualResource *const resource) {
|
||||
if (!resource->isImported()) {
|
||||
resource->release();
|
||||
}
|
||||
});
|
||||
void PassNode::releaseTransientResources() {
|
||||
PassNode *it = this;
|
||||
|
||||
if (_next) {
|
||||
_next->releaseTransientResources();
|
||||
}
|
||||
do {
|
||||
// resources should be release in the reverse order to stabilize usages between frames
|
||||
std::for_each(it->_resourceReleaseArray.rbegin(), it->_resourceReleaseArray.rend(), [](VirtualResource *const resource) {
|
||||
if (!resource->isImported()) {
|
||||
resource->release();
|
||||
}
|
||||
});
|
||||
|
||||
it = it->_next;
|
||||
} while (it);
|
||||
}
|
||||
|
||||
bool PassNode::check(FrameGraph &graph, const Handle &checkingHandle, std::vector<Handle> const &handles) const noexcept {
|
||||
// render target can not do both read & write
|
||||
const VirtualResource *const inputResource = graph.getResourceNode(checkingHandle).virtualResource;
|
||||
const auto it = std::find_if(handles.begin(), handles.end(), [&](Handle handle) {
|
||||
return inputResource == graph.getResourceNode(handle).virtualResource;
|
||||
});
|
||||
void PassNode::setDevicePassId(ID const id) {
|
||||
PassNode *it = this;
|
||||
|
||||
if (it == handles.end()) {
|
||||
return true;
|
||||
}
|
||||
do {
|
||||
it->_devicePassId = id;
|
||||
|
||||
const Handle output = *it;
|
||||
return std::find_if(_attachments.cbegin(), _attachments.cend(), [&output](const RenderTargetAttachment &attachment) {
|
||||
return attachment.textureHandle == output;
|
||||
}) == _attachments.end();
|
||||
it = it->_next;
|
||||
} while (it);
|
||||
}
|
||||
|
||||
void PassNode::setDevicePassId(ID const id) noexcept {
|
||||
_devicePassId = id;
|
||||
|
||||
if (_next) {
|
||||
_next->setDevicePassId(id);
|
||||
}
|
||||
}
|
||||
|
||||
Handle PassNode::getWriteResourceNodeHandle(const FrameGraph &graph, const VirtualResource *const resource) const noexcept {
|
||||
Handle PassNode::getWriteResourceNodeHandle(const FrameGraph &graph, const VirtualResource *const resource) const {
|
||||
const auto it = std::find_if(_writes.begin(), _writes.end(), [&](const Handle handle) {
|
||||
return graph.getResourceNode(handle).virtualResource == resource;
|
||||
});
|
||||
|
||||
@@ -40,29 +40,28 @@ class FrameGraph;
|
||||
|
||||
class PassNode final {
|
||||
public:
|
||||
PassNode(PassInsertPoint inserPoint, StringHandle name, const ID &id, Executable *pass) noexcept;
|
||||
PassNode(PassInsertPoint inserPoint, StringHandle name, const ID &id, Executable *pass);
|
||||
~PassNode() = default;
|
||||
PassNode(PassNode &&) noexcept = default;
|
||||
PassNode(const PassNode &) = delete;
|
||||
PassNode &operator=(const PassNode &) = delete;
|
||||
PassNode &operator=(PassNode &&) = delete;
|
||||
PassNode &operator=(PassNode &&) noexcept = delete;
|
||||
|
||||
Handle read(FrameGraph &graph, const Handle &input) noexcept;
|
||||
Handle write(FrameGraph &graph, const Handle &output) noexcept;
|
||||
void createRenderTargetAttachment(RenderTargetAttachment &&attachment) noexcept;
|
||||
inline void sideEffect() noexcept;
|
||||
inline void subpass(bool clearActionIgnoreable, bool end) noexcept;
|
||||
inline void setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept;
|
||||
Handle read(FrameGraph &graph, const Handle &input);
|
||||
Handle write(FrameGraph &graph, const Handle &output);
|
||||
void createRenderTargetAttachment(RenderTargetAttachment &&attachment);
|
||||
inline void sideEffect();
|
||||
inline void subpass(bool clearActionIgnoreable, bool end);
|
||||
inline void setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor);
|
||||
|
||||
private:
|
||||
bool canMerge(const FrameGraph &graph, const PassNode &passNode) const noexcept;
|
||||
RenderTargetAttachment *getRenderTargetAttachment(const Handle &handle) noexcept;
|
||||
RenderTargetAttachment *getRenderTargetAttachment(const FrameGraph &graph, const VirtualResource *resource) noexcept;
|
||||
void requestTransientResources() noexcept;
|
||||
void releaseTransientResources() noexcept;
|
||||
bool check(FrameGraph &graph, const Handle &checkingHandle, std::vector<Handle> const &handles) const noexcept;
|
||||
void setDevicePassId(ID id) noexcept;
|
||||
Handle getWriteResourceNodeHandle(const FrameGraph &graph, const VirtualResource *resource) const noexcept;
|
||||
bool canMerge(const FrameGraph &graph, const PassNode &passNode) const;
|
||||
RenderTargetAttachment *getRenderTargetAttachment(const Handle &handle);
|
||||
RenderTargetAttachment *getRenderTargetAttachment(const FrameGraph &graph, const VirtualResource *resource);
|
||||
void requestTransientResources();
|
||||
void releaseTransientResources();
|
||||
void setDevicePassId(ID id);
|
||||
Handle getWriteResourceNodeHandle(const FrameGraph &graph, const VirtualResource *resource) const;
|
||||
|
||||
std::unique_ptr<Executable> _pass{nullptr};
|
||||
std::vector<Handle> _reads{};
|
||||
@@ -96,17 +95,17 @@ private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void PassNode::sideEffect() noexcept {
|
||||
void PassNode::sideEffect() {
|
||||
_sideEffect = true;
|
||||
}
|
||||
|
||||
void PassNode::subpass(bool clearActionIgnoreable, bool end) noexcept {
|
||||
void PassNode::subpass(bool clearActionIgnoreable, bool end) {
|
||||
_subpass = true;
|
||||
_clearActionIgnoreable = clearActionIgnoreable;
|
||||
_subpassEnd = end;
|
||||
}
|
||||
|
||||
void PassNode::setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept {
|
||||
void PassNode::setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) {
|
||||
_customViewport = true;
|
||||
_viewport = viewport;
|
||||
_scissor = scissor;
|
||||
|
||||
@@ -67,6 +67,7 @@ struct RenderTargetAttachment final {
|
||||
uint8_t layer{0};
|
||||
uint8_t index{0};
|
||||
StoreOp storeOp{StoreOp::DISCARD};
|
||||
bool isGeneralLayout{false};
|
||||
};
|
||||
|
||||
inline bool RenderTargetAttachment::Sorter::operator()(const RenderTargetAttachment &a1, const RenderTargetAttachment &a2) const noexcept {
|
||||
|
||||
@@ -31,10 +31,8 @@
|
||||
#include "renderer/gfx-base/GFXBuffer.h"
|
||||
#include "renderer/gfx-base/GFXDevice.h"
|
||||
#include "renderer/gfx-base/GFXFramebuffer.h"
|
||||
#include "renderer/gfx-base/GFXGlobalBarrier.h"
|
||||
#include "renderer/gfx-base/GFXRenderPass.h"
|
||||
#include "renderer/gfx-base/GFXTexture.h"
|
||||
#include "renderer/gfx-base/GFXTextureBarrier.h"
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
@@ -72,16 +70,13 @@ public:
|
||||
Resource &operator=(const Resource &) = default;
|
||||
Resource &operator=(Resource &&) noexcept = default;
|
||||
|
||||
void createTransient() noexcept;
|
||||
void createPersistent() noexcept;
|
||||
void createTransient() noexcept;
|
||||
void createPersistent() noexcept;
|
||||
|
||||
// temporary api. framegraph donot create _deviceObject, it come from window
|
||||
void createPersistent(DeviceResourceType *external) noexcept;
|
||||
void destroyTransient() noexcept;
|
||||
void destroyPersistent() noexcept;
|
||||
inline DeviceResourceType *get() const noexcept;
|
||||
inline const Descriptor & getDesc() const noexcept;
|
||||
DeviceResourceType *getDeviceObject() const { return _deviceObject; }
|
||||
|
||||
private:
|
||||
void computeHash() noexcept;
|
||||
@@ -89,9 +84,6 @@ private:
|
||||
Descriptor _desc;
|
||||
DescriptorHash _hash{0};
|
||||
DeviceResourceType *_deviceObject{nullptr};
|
||||
|
||||
// true : _deviceObject come form window, framegraph donot need to release it
|
||||
bool _devcieObjectFromWindow = false;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -107,16 +99,6 @@ void Resource<DeviceResourceType, DescriptorType, DeviceResourceCreatorType, Des
|
||||
_deviceObject = Allocator::getInstance().alloc(_desc, _hash);
|
||||
}
|
||||
|
||||
template <typename DeviceResourceType, typename DescriptorType, typename DeviceResourceCreatorType, typename DescriptorHasherType>
|
||||
void Resource<DeviceResourceType, DescriptorType, DeviceResourceCreatorType, DescriptorHasherType>::createPersistent(DeviceResourceType *external) noexcept {
|
||||
computeHash();
|
||||
|
||||
if (!_deviceObject) {
|
||||
_devcieObjectFromWindow = true;
|
||||
_deviceObject = external;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename DeviceResourceType, typename DescriptorType, typename DeviceResourceCreatorType, typename DescriptorHasherType>
|
||||
void Resource<DeviceResourceType, DescriptorType, DeviceResourceCreatorType, DescriptorHasherType>::createPersistent() noexcept {
|
||||
computeHash();
|
||||
@@ -136,7 +118,7 @@ void Resource<DeviceResourceType, DescriptorType, DeviceResourceCreatorType, Des
|
||||
|
||||
template <typename DeviceResourceType, typename DescriptorType, typename DeviceResourceCreatorType, typename DescriptorHasherType>
|
||||
void Resource<DeviceResourceType, DescriptorType, DeviceResourceCreatorType, DescriptorHasherType>::destroyPersistent() noexcept {
|
||||
if (_deviceObject && !_devcieObjectFromWindow) {
|
||||
if (_deviceObject) {
|
||||
delete _deviceObject;
|
||||
_deviceObject = nullptr;
|
||||
}
|
||||
@@ -162,30 +144,27 @@ void Resource<DeviceResourceType, DescriptorType, DeviceResourceCreatorType, Des
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define DEFINE_GFX_RESOURCE(Type) \
|
||||
template <> \
|
||||
struct ResourceDescriptorHasher<gfx::Type##Info> final { \
|
||||
inline uint32_t operator()(const gfx::Type##Info &desc) const { \
|
||||
return gfx::Type::computeHash(desc); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> \
|
||||
struct DeviceResourceCreator<gfx::Type, gfx::Type##Info> final { \
|
||||
inline gfx::Type *operator()(const gfx::Type##Info &desc) const { \
|
||||
return gfx::Device::getInstance()->create##Type(desc); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
using Type = Resource<gfx::Type, gfx::Type##Info>; /* NOLINT(bugprone-macro-parentheses) N/A */ \
|
||||
#define DEFINE_GFX_RESOURCE(Type) \
|
||||
template <> \
|
||||
struct ResourceDescriptorHasher<gfx::Type##Info> final { \
|
||||
inline uint32_t operator()(const gfx::Type##Info &desc) const { \
|
||||
return gfx::Type::computeHash(desc); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> \
|
||||
struct DeviceResourceCreator<gfx::Type, gfx::Type##Info> final { \
|
||||
inline gfx::Type *operator()(const gfx::Type##Info &desc) const { \
|
||||
return gfx::Device::getInstance()->create##Type(desc); \
|
||||
} \
|
||||
}; \
|
||||
using Type = Resource<gfx::Type, gfx::Type##Info>; \
|
||||
using Type##Handle = TypedHandle<Type>;
|
||||
|
||||
DEFINE_GFX_RESOURCE(Buffer)
|
||||
DEFINE_GFX_RESOURCE(Framebuffer)
|
||||
DEFINE_GFX_RESOURCE(GlobalBarrier)
|
||||
DEFINE_GFX_RESOURCE(RenderPass)
|
||||
DEFINE_GFX_RESOURCE(Texture)
|
||||
DEFINE_GFX_RESOURCE(TextureBarrier)
|
||||
|
||||
} // namespace framegraph
|
||||
} // namespace cc
|
||||
|
||||
@@ -153,13 +153,13 @@ void ResourceAllocator<DeviceResourceType, DescriptorType, DeviceResourceCreator
|
||||
if (_age - bucket.ages[j] < unusedFrameCount) {
|
||||
std::swap(bucket.ages[i], bucket.ages[j]);
|
||||
std::swap(bucket.pool[i], bucket.pool[j]);
|
||||
destroyBegin = j - 1;
|
||||
destroyBegin = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= j) {
|
||||
destroyBegin = i - 1;
|
||||
destroyBegin = i;
|
||||
}
|
||||
|
||||
if (i >= destroyBegin) {
|
||||
@@ -167,7 +167,7 @@ void ResourceAllocator<DeviceResourceType, DescriptorType, DeviceResourceCreator
|
||||
}
|
||||
}
|
||||
|
||||
while (++destroyBegin < count) {
|
||||
while (++destroyBegin <= count) {
|
||||
CC_SAFE_DESTROY(bucket.pool.back());
|
||||
bucket.pool.pop_back();
|
||||
bucket.ages.pop_back();
|
||||
|
||||
@@ -33,14 +33,14 @@ namespace framegraph {
|
||||
template <typename ResourceType, typename Enable = std::enable_if_t<std::is_base_of<gfx::GFXObject, typename ResourceType::DeviceResource>::value>>
|
||||
class ResourceEntry final : public VirtualResource {
|
||||
public:
|
||||
explicit ResourceEntry(const StringHandle name, ID const id, const typename ResourceType::Descriptor &desc) noexcept;
|
||||
ResourceEntry(const StringHandle name, ID const id, const ResourceType &resource) noexcept;
|
||||
ResourceEntry() = delete;
|
||||
~ResourceEntry() = default;
|
||||
ResourceEntry(const ResourceEntry &) = delete;
|
||||
ResourceEntry(ResourceEntry &&) = delete;
|
||||
explicit ResourceEntry(StringHandle name, ID id, const typename ResourceType::Descriptor &desc) noexcept;
|
||||
ResourceEntry(StringHandle name, ID id, const ResourceType &resource) noexcept;
|
||||
ResourceEntry() = delete;
|
||||
~ResourceEntry() override = default;
|
||||
ResourceEntry(const ResourceEntry &) = delete;
|
||||
ResourceEntry(ResourceEntry &&) noexcept = delete;
|
||||
ResourceEntry &operator=(const ResourceEntry &) = delete;
|
||||
ResourceEntry &operator=(ResourceEntry &&) = delete;
|
||||
ResourceEntry &operator=(ResourceEntry &&) noexcept = delete;
|
||||
|
||||
void request() noexcept override;
|
||||
void release() noexcept override;
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "VirtualResource.h"
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "renderer/gfx-base/GFXObject.h"
|
||||
#include "Handle.h"
|
||||
#include "renderer/gfx-base/GFXObject.h"
|
||||
|
||||
namespace cc {
|
||||
namespace framegraph {
|
||||
@@ -37,18 +37,18 @@ using ID = uint16_t;
|
||||
|
||||
class VirtualResource {
|
||||
public:
|
||||
VirtualResource(const StringHandle name, ID const id, bool const imported) noexcept;
|
||||
VirtualResource() noexcept = delete;
|
||||
virtual ~VirtualResource() = default;
|
||||
VirtualResource(const VirtualResource &) = delete;
|
||||
VirtualResource(VirtualResource &&) = delete;
|
||||
VirtualResource(StringHandle name, ID id, bool imported) noexcept;
|
||||
VirtualResource() noexcept = delete;
|
||||
virtual ~VirtualResource() = default;
|
||||
VirtualResource(const VirtualResource &) = delete;
|
||||
VirtualResource(VirtualResource &&) noexcept = delete;
|
||||
VirtualResource &operator=(const VirtualResource &) = delete;
|
||||
VirtualResource &operator=(VirtualResource &&) = delete;
|
||||
VirtualResource &operator=(VirtualResource &&) noexcept = delete;
|
||||
|
||||
virtual void request() noexcept = 0;
|
||||
virtual void release() noexcept = 0;
|
||||
bool isImported() const noexcept { return _imported; }
|
||||
void updateLifetime(PassNode *const passNode) noexcept;
|
||||
void updateLifetime(PassNode *passNode) noexcept;
|
||||
void newVersion() noexcept { ++_version; }
|
||||
|
||||
virtual gfx::GFXObject *getDeviceResource() const noexcept = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace gfx {
|
||||
|
||||
BufferAgent::BufferAgent(Buffer *actor)
|
||||
: Agent<Buffer>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
BufferAgent::~BufferAgent() {
|
||||
@@ -161,10 +161,9 @@ void BufferAgent::update(const void *buffer, uint size) {
|
||||
}
|
||||
|
||||
void BufferAgent::getActorBuffer(const BufferAgent *buffer, MessageQueue *mq, uint size, uint8_t **pActorBuffer, bool *pNeedFreeing) {
|
||||
uint frameIndex = DeviceAgent::getInstance()->getCurrentIndex();
|
||||
|
||||
if (!buffer->_stagingBuffers.empty()) { // for frequent updates on big buffers
|
||||
*pActorBuffer = buffer->_stagingBuffers[frameIndex];
|
||||
uint frameIndex = DeviceAgent::getInstance()->getCurrentIndex();
|
||||
*pActorBuffer = buffer->_stagingBuffers[frameIndex];
|
||||
} else if (size > STAGING_BUFFER_THRESHOLD) { // less frequent updates on big buffers
|
||||
*pActorBuffer = reinterpret_cast<uint8_t *>(malloc(size));
|
||||
*pNeedFreeing = true;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace gfx {
|
||||
|
||||
CommandBufferAgent::CommandBufferAgent(CommandBuffer *actor)
|
||||
: Agent<CommandBuffer>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
void CommandBufferAgent::flushCommands(uint count, CommandBufferAgent *const *cmdBuffs, bool multiThreaded) {
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "DescriptorSetAgent.h"
|
||||
#include "DescriptorSetLayoutAgent.h"
|
||||
#include "DeviceAgent.h"
|
||||
#include "SamplerAgent.h"
|
||||
#include "TextureAgent.h"
|
||||
|
||||
namespace cc {
|
||||
@@ -38,7 +37,7 @@ namespace gfx {
|
||||
|
||||
DescriptorSetAgent::DescriptorSetAgent(DescriptorSet *actor)
|
||||
: Agent<DescriptorSet>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
DescriptorSetAgent::~DescriptorSetAgent() {
|
||||
@@ -128,7 +127,7 @@ void DescriptorSetAgent::bindSampler(uint binding, Sampler *sampler, uint index)
|
||||
DescriptorSetBindSampler,
|
||||
actor, getActor(),
|
||||
binding, binding,
|
||||
sampler, static_cast<SamplerAgent *>(sampler)->getActor(),
|
||||
sampler, sampler,
|
||||
index, index,
|
||||
{
|
||||
actor->bindSampler(binding, sampler, index);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace gfx {
|
||||
|
||||
DescriptorSetLayoutAgent::DescriptorSetLayoutAgent(DescriptorSetLayout *actor)
|
||||
: Agent<DescriptorSetLayout>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
DescriptorSetLayoutAgent::~DescriptorSetLayoutAgent() {
|
||||
|
||||
@@ -37,10 +37,12 @@
|
||||
#include "PipelineStateAgent.h"
|
||||
#include "QueueAgent.h"
|
||||
#include "RenderPassAgent.h"
|
||||
#include "SamplerAgent.h"
|
||||
#include "ShaderAgent.h"
|
||||
#include "SwapchainAgent.h"
|
||||
#include "TextureAgent.h"
|
||||
#include "base/threading/ThreadSafeLinearAllocator.h"
|
||||
#include "gfx-base/GFXDef-common.h"
|
||||
#include "gfx-base/GFXSwapchain.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
@@ -65,19 +67,18 @@ bool DeviceAgent::doInit(const DeviceInfo &info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_context = _actor->getContext();
|
||||
_api = _actor->getGfxAPI();
|
||||
_deviceName = _actor->getDeviceName();
|
||||
_queue = CC_NEW(QueueAgent(_actor->getQueue()));
|
||||
_cmdBuff = CC_NEW(CommandBufferAgent(_actor->getCommandBuffer()));
|
||||
static_cast<CommandBufferAgent *>(_cmdBuff)->_queue = _queue;
|
||||
_renderer = _actor->getRenderer();
|
||||
_vendor = _actor->getVendor();
|
||||
_caps = _actor->_caps;
|
||||
_api = _actor->getGfxAPI();
|
||||
_deviceName = _actor->getDeviceName();
|
||||
_queue = CC_NEW(QueueAgent(_actor->getQueue()));
|
||||
_cmdBuff = CC_NEW(CommandBufferAgent(_actor->getCommandBuffer()));
|
||||
_renderer = _actor->getRenderer();
|
||||
_vendor = _actor->getVendor();
|
||||
_caps = _actor->_caps;
|
||||
memcpy(_features.data(), _actor->_features.data(), static_cast<uint>(Feature::COUNT) * sizeof(bool));
|
||||
|
||||
_mainMessageQueue = CC_NEW(MessageQueue);
|
||||
|
||||
static_cast<CommandBufferAgent *>(_cmdBuff)->_queue = _queue;
|
||||
static_cast<CommandBufferAgent *>(_cmdBuff)->initMessageQueue();
|
||||
|
||||
setMultithreaded(true);
|
||||
@@ -109,23 +110,19 @@ void DeviceAgent::doDestroy() {
|
||||
CC_SAFE_DELETE(_mainMessageQueue);
|
||||
}
|
||||
|
||||
void DeviceAgent::resize(uint width, uint height) {
|
||||
ENQUEUE_MESSAGE_3(
|
||||
_mainMessageQueue, DeviceResize,
|
||||
actor, _actor,
|
||||
width, width,
|
||||
height, height,
|
||||
{
|
||||
actor->resize(width, height);
|
||||
});
|
||||
}
|
||||
void DeviceAgent::acquire(Swapchain *const *swapchains, uint32_t count) {
|
||||
auto *actorSwapchains = _mainMessageQueue->allocate<Swapchain *>(count);
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
actorSwapchains[i] = static_cast<SwapchainAgent *>(swapchains[i])->getActor();
|
||||
}
|
||||
|
||||
void DeviceAgent::acquire() {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
_mainMessageQueue, DeviceAcquire,
|
||||
ENQUEUE_MESSAGE_3(
|
||||
_mainMessageQueue, DevicePresent,
|
||||
actor, _actor,
|
||||
swapchains, actorSwapchains,
|
||||
count, count,
|
||||
{
|
||||
actor->acquire();
|
||||
actor->acquire(swapchains, count);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -151,13 +148,13 @@ void DeviceAgent::setMultithreaded(bool multithreaded) {
|
||||
|
||||
if (multithreaded) {
|
||||
_mainMessageQueue->setImmediateMode(false);
|
||||
_actor->bindRenderContext(false);
|
||||
_actor->bindContext(false);
|
||||
_mainMessageQueue->runConsumerThread();
|
||||
ENQUEUE_MESSAGE_1(
|
||||
_mainMessageQueue, DeviceMakeCurrentTrue,
|
||||
actor, _actor,
|
||||
{
|
||||
actor->bindDeviceContext(true);
|
||||
actor->bindContext(true);
|
||||
CC_LOG_INFO("Device thread detached.");
|
||||
});
|
||||
for (CommandBufferAgent *cmdBuff : _cmdBuffRefs) {
|
||||
@@ -168,11 +165,11 @@ void DeviceAgent::setMultithreaded(bool multithreaded) {
|
||||
_mainMessageQueue, DeviceMakeCurrentFalse,
|
||||
actor, _actor,
|
||||
{
|
||||
actor->bindDeviceContext(false);
|
||||
actor->bindContext(false);
|
||||
});
|
||||
_mainMessageQueue->terminateConsumerThread();
|
||||
_mainMessageQueue->setImmediateMode(true);
|
||||
_actor->bindRenderContext(true);
|
||||
_actor->bindContext(true);
|
||||
for (CommandBufferAgent *cmdBuff : _cmdBuffRefs) {
|
||||
cmdBuff->_messageQueue->setImmediateMode(true);
|
||||
}
|
||||
@@ -180,27 +177,6 @@ void DeviceAgent::setMultithreaded(bool multithreaded) {
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAgent::releaseSurface(uintptr_t windowHandle) {
|
||||
ENQUEUE_MESSAGE_2(
|
||||
_mainMessageQueue, DeviceReleaseSurface,
|
||||
actor, _actor,
|
||||
windowHandle, windowHandle,
|
||||
{
|
||||
actor->releaseSurface(windowHandle);
|
||||
});
|
||||
_mainMessageQueue->kickAndWait();
|
||||
}
|
||||
|
||||
void DeviceAgent::acquireSurface(uintptr_t windowHandle) {
|
||||
ENQUEUE_MESSAGE_2(
|
||||
_mainMessageQueue, DeviceAcquireSurface,
|
||||
actor, _actor,
|
||||
windowHandle, windowHandle,
|
||||
{
|
||||
actor->acquireSurface(windowHandle);
|
||||
});
|
||||
}
|
||||
|
||||
CommandBuffer *DeviceAgent::createCommandBuffer(const CommandBufferInfo &info, bool /*hasAgent*/) {
|
||||
CommandBuffer *actor = _actor->createCommandBuffer(info, true);
|
||||
return CC_NEW(CommandBufferAgent(actor));
|
||||
@@ -211,6 +187,11 @@ Queue *DeviceAgent::createQueue() {
|
||||
return CC_NEW(QueueAgent(actor));
|
||||
}
|
||||
|
||||
Swapchain *DeviceAgent::createSwapchain() {
|
||||
Swapchain *actor = _actor->createSwapchain();
|
||||
return CC_NEW(SwapchainAgent(actor));
|
||||
}
|
||||
|
||||
Buffer *DeviceAgent::createBuffer() {
|
||||
Buffer *actor = _actor->createBuffer();
|
||||
return CC_NEW(BufferAgent(actor));
|
||||
@@ -221,11 +202,6 @@ Texture *DeviceAgent::createTexture() {
|
||||
return CC_NEW(TextureAgent(actor));
|
||||
}
|
||||
|
||||
Sampler *DeviceAgent::createSampler() {
|
||||
Sampler *actor = _actor->createSampler();
|
||||
return CC_NEW(SamplerAgent(actor));
|
||||
}
|
||||
|
||||
Shader *DeviceAgent::createShader() {
|
||||
Shader *actor = _actor->createShader();
|
||||
return CC_NEW(ShaderAgent(actor));
|
||||
@@ -266,12 +242,16 @@ PipelineState *DeviceAgent::createPipelineState() {
|
||||
return CC_NEW(PipelineStateAgent(actor));
|
||||
}
|
||||
|
||||
GlobalBarrier *DeviceAgent::createGlobalBarrier() {
|
||||
return _actor->createGlobalBarrier();
|
||||
Sampler *DeviceAgent::createSampler(const SamplerInfo &info) {
|
||||
return _actor->createSampler(info);
|
||||
}
|
||||
|
||||
TextureBarrier *DeviceAgent::createTextureBarrier() {
|
||||
return _actor->createTextureBarrier();
|
||||
GlobalBarrier *DeviceAgent::createGlobalBarrier(const GlobalBarrierInfo &info) {
|
||||
return _actor->createGlobalBarrier(info);
|
||||
}
|
||||
|
||||
TextureBarrier *DeviceAgent::createTextureBarrier(const TextureBarrierInfo &info) {
|
||||
return _actor->createTextureBarrier(info);
|
||||
}
|
||||
|
||||
void DeviceAgent::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) {
|
||||
@@ -280,7 +260,7 @@ void DeviceAgent::copyBuffersToTexture(const uint8_t *const *buffers, Texture *d
|
||||
bufferCount += regions[i].texSubres.layerCount;
|
||||
}
|
||||
uint totalSize = sizeof(BufferTextureCopy) * count + sizeof(uint8_t *) * bufferCount;
|
||||
for (uint i = 0U, n = 0U; i < count; i++) {
|
||||
for (uint i = 0U; i < count; i++) {
|
||||
const BufferTextureCopy ®ion = regions[i];
|
||||
|
||||
uint size = formatSize(dst->getFormat(), region.texExtent.width, region.texExtent.height, 1);
|
||||
@@ -330,6 +310,7 @@ void DeviceAgent::copyTextureToBuffers(Texture *srcTexture, uint8_t *const *buff
|
||||
{
|
||||
actor->copyTextureToBuffers(src, buffers, regions, count);
|
||||
});
|
||||
|
||||
_mainMessageQueue->kickAndWait();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,15 +63,14 @@ public:
|
||||
using Device::createTexture;
|
||||
using Device::createTextureBarrier;
|
||||
|
||||
void resize(uint width, uint height) override;
|
||||
void acquire() override;
|
||||
void acquire(Swapchain *const *swapchains, uint32_t count) override;
|
||||
void present() override;
|
||||
|
||||
CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override;
|
||||
Queue * createQueue() override;
|
||||
Swapchain * createSwapchain() override;
|
||||
Buffer * createBuffer() override;
|
||||
Texture * createTexture() override;
|
||||
Sampler * createSampler() override;
|
||||
Shader * createShader() override;
|
||||
InputAssembler * createInputAssembler() override;
|
||||
RenderPass * createRenderPass() override;
|
||||
@@ -80,18 +79,18 @@ public:
|
||||
DescriptorSetLayout *createDescriptorSetLayout() override;
|
||||
PipelineLayout * createPipelineLayout() override;
|
||||
PipelineState * createPipelineState() override;
|
||||
GlobalBarrier * createGlobalBarrier() override;
|
||||
TextureBarrier * createTextureBarrier() override;
|
||||
void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override;
|
||||
void copyTextureToBuffers(Texture *src, uint8_t *const *buffers, const BufferTextureCopy *region, uint count) override;
|
||||
void flushCommands(CommandBuffer *const *cmdBuffs, uint count) override;
|
||||
SurfaceTransform getSurfaceTransform() const override { return _actor->getSurfaceTransform(); }
|
||||
uint getWidth() const override { return _actor->getWidth(); }
|
||||
uint getHeight() const override { return _actor->getHeight(); }
|
||||
MemoryStatus & getMemoryStatus() override { return _actor->getMemoryStatus(); }
|
||||
uint getNumDrawCalls() const override { return _actor->getNumDrawCalls(); }
|
||||
uint getNumInstances() const override { return _actor->getNumInstances(); }
|
||||
uint getNumTris() const override { return _actor->getNumTris(); }
|
||||
|
||||
Sampler * createSampler(const SamplerInfo &info) override;
|
||||
GlobalBarrier * createGlobalBarrier(const GlobalBarrierInfo &info) override;
|
||||
TextureBarrier *createTextureBarrier(const TextureBarrierInfo &info) override;
|
||||
|
||||
void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override;
|
||||
void copyTextureToBuffers(Texture *src, uint8_t *const *buffers, const BufferTextureCopy *region, uint count) override;
|
||||
void flushCommands(CommandBuffer *const *cmdBuffs, uint count) override;
|
||||
MemoryStatus &getMemoryStatus() override { return _actor->getMemoryStatus(); }
|
||||
uint getNumDrawCalls() const override { return _actor->getNumDrawCalls(); }
|
||||
uint getNumInstances() const override { return _actor->getNumInstances(); }
|
||||
uint getNumTris() const override { return _actor->getNumTris(); }
|
||||
|
||||
uint getCurrentIndex() const { return _currentIndex; }
|
||||
void setMultithreaded(bool multithreaded);
|
||||
@@ -109,9 +108,6 @@ protected:
|
||||
bool doInit(const DeviceInfo &info) override;
|
||||
void doDestroy() override;
|
||||
|
||||
void releaseSurface(uintptr_t windowHandle) override;
|
||||
void acquireSurface(uintptr_t windowHandle) override;
|
||||
|
||||
bool _multithreaded{false};
|
||||
MessageQueue *_mainMessageQueue{nullptr};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace gfx {
|
||||
|
||||
FramebufferAgent::FramebufferAgent(Framebuffer *actor)
|
||||
: Agent<Framebuffer>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
FramebufferAgent::~FramebufferAgent() {
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace gfx {
|
||||
|
||||
InputAssemblerAgent::InputAssemblerAgent(InputAssembler *actor)
|
||||
: Agent<InputAssembler>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
InputAssemblerAgent::~InputAssemblerAgent() {
|
||||
@@ -80,8 +80,8 @@ void InputAssemblerAgent::doDestroy() {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setVertexCount(uint count) {
|
||||
_vertexCount = count;
|
||||
void InputAssemblerAgent::setVertexCount(uint32_t count) {
|
||||
_drawInfo.vertexCount = count;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
@@ -91,8 +91,8 @@ void InputAssemblerAgent::setVertexCount(uint count) {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setFirstVertex(uint first) {
|
||||
_firstVertex = first;
|
||||
void InputAssemblerAgent::setFirstVertex(uint32_t first) {
|
||||
_drawInfo.firstVertex = first;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
@@ -102,8 +102,8 @@ void InputAssemblerAgent::setFirstVertex(uint first) {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setIndexCount(uint count) {
|
||||
_indexCount = count;
|
||||
void InputAssemblerAgent::setIndexCount(uint32_t count) {
|
||||
_drawInfo.indexCount = count;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
@@ -113,8 +113,8 @@ void InputAssemblerAgent::setIndexCount(uint count) {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setFirstIndex(uint first) {
|
||||
_firstIndex = first;
|
||||
void InputAssemblerAgent::setFirstIndex(uint32_t first) {
|
||||
_drawInfo.firstIndex = first;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
@@ -124,8 +124,8 @@ void InputAssemblerAgent::setFirstIndex(uint first) {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setVertexOffset(uint offset) {
|
||||
_vertexOffset = offset;
|
||||
void InputAssemblerAgent::setVertexOffset(int32_t offset) {
|
||||
_drawInfo.vertexOffset = offset;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
@@ -135,8 +135,8 @@ void InputAssemblerAgent::setVertexOffset(uint offset) {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setInstanceCount(uint count) {
|
||||
_instanceCount = count;
|
||||
void InputAssemblerAgent::setInstanceCount(uint32_t count) {
|
||||
_drawInfo.instanceCount = count;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
@@ -146,8 +146,8 @@ void InputAssemblerAgent::setInstanceCount(uint count) {
|
||||
});
|
||||
}
|
||||
|
||||
void InputAssemblerAgent::setFirstInstance(uint first) {
|
||||
_firstInstance = first;
|
||||
void InputAssemblerAgent::setFirstInstance(uint32_t first) {
|
||||
_drawInfo.firstInstance = first;
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy,
|
||||
actor, getActor(),
|
||||
|
||||
@@ -36,13 +36,13 @@ public:
|
||||
explicit InputAssemblerAgent(InputAssembler *actor);
|
||||
~InputAssemblerAgent() override;
|
||||
|
||||
void setVertexCount(uint count) override;
|
||||
void setFirstVertex(uint first) override;
|
||||
void setIndexCount(uint count) override;
|
||||
void setFirstIndex(uint first) override;
|
||||
void setVertexOffset(uint offset) override;
|
||||
void setInstanceCount(uint count) override;
|
||||
void setFirstInstance(uint first) override;
|
||||
void setVertexCount(uint32_t count) override;
|
||||
void setFirstVertex(uint32_t first) override;
|
||||
void setIndexCount(uint32_t count) override;
|
||||
void setFirstIndex(uint32_t first) override;
|
||||
void setVertexOffset(int32_t offset) override;
|
||||
void setInstanceCount(uint32_t count) override;
|
||||
void setFirstInstance(uint32_t first) override;
|
||||
|
||||
protected:
|
||||
void doInit(const InputAssemblerInfo &info) override;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace gfx {
|
||||
|
||||
PipelineLayoutAgent::PipelineLayoutAgent(PipelineLayout *actor)
|
||||
: Agent<PipelineLayout>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
PipelineLayoutAgent::~PipelineLayoutAgent() {
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace gfx {
|
||||
|
||||
PipelineStateAgent::PipelineStateAgent(PipelineState *actor)
|
||||
: Agent<PipelineState>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
PipelineStateAgent::~PipelineStateAgent() {
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace gfx {
|
||||
|
||||
QueueAgent::QueueAgent(Queue *actor)
|
||||
: Agent<Queue>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
QueueAgent::~QueueAgent() {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace gfx {
|
||||
|
||||
RenderPassAgent::RenderPassAgent(RenderPass *actor)
|
||||
: Agent<RenderPass>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
RenderPassAgent::~RenderPassAgent() {
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/****************************************************************************
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include "base/CoreStd.h"
|
||||
#include "base/threading/MessageQueue.h"
|
||||
|
||||
#include "DescriptorSetLayoutAgent.h"
|
||||
#include "DeviceAgent.h"
|
||||
#include "SamplerAgent.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
SamplerAgent::SamplerAgent(Sampler *actor)
|
||||
: Agent<Sampler>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
}
|
||||
|
||||
SamplerAgent::~SamplerAgent() {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(),
|
||||
SamplerDestruct,
|
||||
actor, _actor,
|
||||
{
|
||||
CC_SAFE_DELETE(actor);
|
||||
});
|
||||
}
|
||||
|
||||
void SamplerAgent::doInit(const SamplerInfo &info) {
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(),
|
||||
SamplerInit,
|
||||
actor, getActor(),
|
||||
info, info,
|
||||
{
|
||||
actor->initialize(info);
|
||||
});
|
||||
}
|
||||
|
||||
void SamplerAgent::doDestroy() {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(),
|
||||
SamplerDestroy,
|
||||
actor, getActor(),
|
||||
{
|
||||
actor->destroy();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
@@ -34,7 +34,7 @@ namespace gfx {
|
||||
|
||||
ShaderAgent::ShaderAgent(Shader *actor)
|
||||
: Agent<Shader>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
ShaderAgent::~ShaderAgent() {
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include "base/CoreStd.h"
|
||||
#include "base/threading/MessageQueue.h"
|
||||
|
||||
#include "DeviceAgent.h"
|
||||
#include "SwapchainAgent.h"
|
||||
#include "gfx-agent/TextureAgent.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
SwapchainAgent::SwapchainAgent(Swapchain *actor)
|
||||
: Agent<Swapchain>(actor) {
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
SwapchainAgent::~SwapchainAgent() {
|
||||
CC_SAFE_DELETE(_depthStencilTexture);
|
||||
CC_SAFE_DELETE(_colorTexture);
|
||||
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), SwapchainDestruct,
|
||||
actor, _actor,
|
||||
{
|
||||
CC_SAFE_DELETE(actor);
|
||||
});
|
||||
}
|
||||
|
||||
void SwapchainAgent::doInit(const SwapchainInfo &info) {
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), SwapchainInit,
|
||||
actor, getActor(),
|
||||
info, info,
|
||||
{
|
||||
actor->initialize(info);
|
||||
});
|
||||
|
||||
DeviceAgent::getInstance()->getMessageQueue()->kickAndWait();
|
||||
|
||||
auto *colorTexture = CC_NEW(TextureAgent(_actor->getColorTexture()));
|
||||
colorTexture->renounceOwnership();
|
||||
_colorTexture = colorTexture;
|
||||
|
||||
auto *depthStencilTexture = CC_NEW(TextureAgent(_actor->getDepthStencilTexture()));
|
||||
depthStencilTexture->renounceOwnership();
|
||||
_depthStencilTexture = depthStencilTexture;
|
||||
|
||||
SwapchainTextureInfo textureInfo;
|
||||
textureInfo.swapchain = this;
|
||||
textureInfo.format = _actor->getColorTexture()->getFormat();
|
||||
textureInfo.width = info.width;
|
||||
textureInfo.height = info.height;
|
||||
initTexture(textureInfo, _colorTexture);
|
||||
|
||||
textureInfo.format = _actor->getDepthStencilTexture()->getFormat();
|
||||
initTexture(textureInfo, _depthStencilTexture);
|
||||
}
|
||||
|
||||
void SwapchainAgent::doDestroy() {
|
||||
CC_SAFE_DELETE(_depthStencilTexture);
|
||||
CC_SAFE_DELETE(_colorTexture);
|
||||
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), SwapchainDestroy,
|
||||
actor, getActor(),
|
||||
{
|
||||
actor->destroy();
|
||||
});
|
||||
}
|
||||
|
||||
void SwapchainAgent::doResize(uint32_t width, uint32_t height, SurfaceTransform transform) {
|
||||
ENQUEUE_MESSAGE_4(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), SwapchainResize,
|
||||
actor, getActor(),
|
||||
width, width,
|
||||
height, height,
|
||||
transform, transform,
|
||||
{
|
||||
actor->resize(width, height, transform);
|
||||
});
|
||||
}
|
||||
|
||||
void SwapchainAgent::doDestroySurface() {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), SwapchaindestroySurface,
|
||||
actor, getActor(),
|
||||
{
|
||||
actor->destroySurface();
|
||||
});
|
||||
}
|
||||
|
||||
void SwapchainAgent::doCreateSurface(void *windowHandle) {
|
||||
ENQUEUE_MESSAGE_2(
|
||||
DeviceAgent::getInstance()->getMessageQueue(), SwapchaincreateSurface,
|
||||
actor, getActor(),
|
||||
windowHandle, windowHandle,
|
||||
{
|
||||
actor->createSurface(windowHandle);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
+10
-5
@@ -26,19 +26,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/Agent.h"
|
||||
#include "gfx-base/GFXSampler.h"
|
||||
#include "gfx-base/GFXSwapchain.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL SamplerValidator final : public Agent<Sampler> {
|
||||
class CC_DLL SwapchainAgent final : public Agent<Swapchain> {
|
||||
public:
|
||||
explicit SamplerValidator(Sampler *actor);
|
||||
~SamplerValidator() override;
|
||||
explicit SwapchainAgent(Swapchain *actor);
|
||||
~SwapchainAgent() override;
|
||||
|
||||
bool isPreRotationEnabled() override { return _actor->isPreRotationEnabled(); }
|
||||
|
||||
protected:
|
||||
void doInit(const SamplerInfo &info) override;
|
||||
void doInit(const SwapchainInfo &info) override;
|
||||
void doDestroy() override;
|
||||
void doResize(uint32_t width, uint32_t height, SurfaceTransform transform) override;
|
||||
void doDestroySurface() override;
|
||||
void doCreateSurface(void *windowHandle) override;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
@@ -28,23 +28,27 @@
|
||||
|
||||
#include "DeviceAgent.h"
|
||||
#include "TextureAgent.h"
|
||||
#include "gfx-agent/SwapchainAgent.h"
|
||||
#include "gfx-base/GFXDef.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
TextureAgent::TextureAgent(Texture *actor)
|
||||
: Agent<Texture>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_typedID = actor->getTypedID();
|
||||
}
|
||||
|
||||
TextureAgent::~TextureAgent() {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(),
|
||||
TextureDestruct,
|
||||
actor, _actor,
|
||||
{
|
||||
CC_SAFE_DELETE(actor);
|
||||
});
|
||||
if (_ownTheActor) {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(),
|
||||
TextureDestruct,
|
||||
actor, _actor,
|
||||
{
|
||||
CC_SAFE_DELETE(actor);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void TextureAgent::doInit(const TextureInfo &info) {
|
||||
@@ -72,6 +76,10 @@ void TextureAgent::doInit(const TextureViewInfo &info) {
|
||||
});
|
||||
}
|
||||
|
||||
void TextureAgent::doInit(const SwapchainTextureInfo &info) {
|
||||
// the actor is already initialized
|
||||
}
|
||||
|
||||
void TextureAgent::doDestroy() {
|
||||
ENQUEUE_MESSAGE_1(
|
||||
DeviceAgent::getInstance()->getMessageQueue(),
|
||||
|
||||
@@ -31,16 +31,21 @@
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL TextureAgent final : public Agent<Texture> {
|
||||
class CC_DLL TextureAgent : public Agent<Texture> {
|
||||
public:
|
||||
explicit TextureAgent(Texture *actor);
|
||||
~TextureAgent() override;
|
||||
|
||||
inline void renounceOwnership() { _ownTheActor = false; }
|
||||
|
||||
protected:
|
||||
void doInit(const TextureInfo &info) override;
|
||||
void doInit(const TextureViewInfo &info) override;
|
||||
void doInit(const SwapchainTextureInfo &info) override;
|
||||
void doDestroy() override;
|
||||
void doResize(uint width, uint height, uint size) override;
|
||||
|
||||
bool _ownTheActor = true;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -27,18 +27,18 @@
|
||||
|
||||
#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 "GFXSwapchain.h"
|
||||
#include "GFXTexture.h"
|
||||
#include "GFXTextureBarrier.h"
|
||||
#include "states/GFXGlobalBarrier.h"
|
||||
#include "states/GFXSampler.h"
|
||||
#include "states/GFXTextureBarrier.h"
|
||||
|
||||
@@ -88,11 +88,6 @@ public:
|
||||
inline void pipelineBarrier(const GlobalBarrier *barrier);
|
||||
inline void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrierList &textureBarriers, const TextureList &textures);
|
||||
|
||||
inline void bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet);
|
||||
inline void bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet, const vector<uint> &dynamicOffsets);
|
||||
inline void beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, uint stencil, const CommandBufferList &secondaryCBs);
|
||||
inline void beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, uint stencil);
|
||||
|
||||
inline Queue * getQueue() const { return _queue; }
|
||||
inline CommandBufferType getType() const { return _type; }
|
||||
|
||||
@@ -155,9 +150,7 @@ void CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, co
|
||||
}
|
||||
|
||||
void CommandBuffer::draw(InputAssembler *ia) {
|
||||
DrawInfo info;
|
||||
ia->extractDrawInfo(info);
|
||||
draw(info);
|
||||
draw(ia->getDrawInfo());
|
||||
}
|
||||
|
||||
void CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) {
|
||||
@@ -176,21 +169,5 @@ void CommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureB
|
||||
pipelineBarrier(barrier, textureBarriers.data(), textures.data(), utils::toUint(textureBarriers.size()));
|
||||
}
|
||||
|
||||
void CommandBuffer::bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet) {
|
||||
bindDescriptorSet(set, descriptorSet, 0, nullptr);
|
||||
}
|
||||
|
||||
void CommandBuffer::bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet, const vector<uint> &dynamicOffsets) {
|
||||
bindDescriptorSet(set, descriptorSet, utils::toUint(dynamicOffsets.size()), dynamicOffsets.data());
|
||||
}
|
||||
|
||||
void CommandBuffer::beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, uint stencil, const CommandBufferList &secondaryCBs) {
|
||||
beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil, secondaryCBs.data(), utils::toUint(secondaryCBs.size()));
|
||||
}
|
||||
|
||||
void CommandBuffer::beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, uint stencil) {
|
||||
beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil, nullptr, 0);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2019-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 "GFXObject.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL Context : public Object {
|
||||
public:
|
||||
Context();
|
||||
~Context() override;
|
||||
|
||||
bool initialize(const ContextInfo &info);
|
||||
void destroy();
|
||||
|
||||
virtual void present() = 0;
|
||||
|
||||
inline Context * getSharedContext() const { return _sharedContext; }
|
||||
inline VsyncMode getVsyncMode() const { return _vsyncMode; }
|
||||
inline Format getColorFormat() const { return _colorFmt; }
|
||||
inline Format getDepthStencilFormat() const { return _depthStencilFmt; }
|
||||
|
||||
protected:
|
||||
virtual bool doInit(const ContextInfo &info) = 0;
|
||||
virtual void doDestroy() = 0;
|
||||
|
||||
uintptr_t _windowHandle = 0;
|
||||
Context * _sharedContext = nullptr;
|
||||
VsyncMode _vsyncMode = VsyncMode::OFF;
|
||||
Format _colorFmt = Format::UNKNOWN;
|
||||
Format _depthStencilFmt = Format::UNKNOWN;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
File diff suppressed because it is too large
Load Diff
@@ -91,12 +91,8 @@ const FormatInfo GFX_FORMAT_INFOS[] = {
|
||||
{"RGB10A2UI", 2, 4, FormatType::UINT, true, false, false, false},
|
||||
{"RGB9E5", 2, 4, FormatType::FLOAT, true, false, false, false},
|
||||
|
||||
{"D16", 2, 1, FormatType::UINT, false, true, false, false},
|
||||
{"D16S8", 3, 1, FormatType::UINT, false, true, true, false},
|
||||
{"D24", 3, 1, FormatType::UINT, false, true, false, false},
|
||||
{"D24S8", 2, 1, FormatType::UINT, false, true, true, false},
|
||||
{"D32F", 4, 1, FormatType::FLOAT, false, true, false, false},
|
||||
{"D32FS8", 5, 2, FormatType::FLOAT, false, true, true, false},
|
||||
{"DEPTH", 4, 1, FormatType::FLOAT, false, true, false, false},
|
||||
{"DEPTH_STENCIL", 5, 2, FormatType::FLOAT, false, true, true, false},
|
||||
|
||||
{"BC1", 1, 3, FormatType::UNORM, false, false, false, true},
|
||||
{"BC1_ALPHA", 1, 4, FormatType::UNORM, true, false, false, true},
|
||||
|
||||
@@ -30,51 +30,11 @@
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
enum class VsyncMode {
|
||||
// The application does not synchronizes with the vertical sync.
|
||||
// If application renders faster than the display refreshes, frames are wasted and tearing may be observed.
|
||||
// FPS is uncapped. Maximum power consumption. If unsupported, "ON" value will be used instead. Minimum latency.
|
||||
OFF,
|
||||
// The application is always synchronized with the vertical sync. Tearing does not happen.
|
||||
// FPS is capped to the display's refresh rate. For fast applications, battery life is improved. Always supported.
|
||||
ON,
|
||||
// The application synchronizes with the vertical sync, but only if the application rendering speed is greater than refresh rate.
|
||||
// Compared to OFF, there is no tearing. Compared to ON, the FPS will be improved for "slower" applications.
|
||||
// If unsupported, "ON" value will be used instead. Recommended for most applications. Default if supported.
|
||||
RELAXED,
|
||||
// The presentation engine will always use the latest fully rendered image.
|
||||
// Compared to OFF, no tearing will be observed.
|
||||
// Compared to ON, battery power will be worse, especially for faster applications.
|
||||
// If unsupported, "OFF" will be attempted next.
|
||||
MAILBOX,
|
||||
// The application is capped to using half the vertical sync time.
|
||||
// FPS artificially capped to Half the display speed (usually 30fps) to maintain battery.
|
||||
// Best possible battery savings. Worst possible performance.
|
||||
// Recommended for specific applications where battery saving is critical.
|
||||
HALF,
|
||||
};
|
||||
|
||||
struct DeviceInfo {
|
||||
bool isAntiAlias = false;
|
||||
uintptr_t windowHandle = 0U;
|
||||
uint width = 0U;
|
||||
uint height = 0U;
|
||||
float pixelRatio = 1.0F;
|
||||
BindingMappingInfo bindingMappingInfo;
|
||||
};
|
||||
|
||||
enum class Performance {
|
||||
HIGH_QUALITY,
|
||||
LOW_POWER,
|
||||
//BALANCE,
|
||||
};
|
||||
|
||||
struct ContextInfo {
|
||||
bool msaaEnabled = false;
|
||||
Performance performance = Performance::LOW_POWER;
|
||||
VsyncMode vsyncMode = VsyncMode::RELAXED;
|
||||
uintptr_t windowHandle = 0;
|
||||
Context* sharedCtx = nullptr;
|
||||
struct SwapchainTextureInfo {
|
||||
Swapchain* swapchain{nullptr};
|
||||
Format format{Format::UNKNOWN};
|
||||
uint32_t width{0};
|
||||
uint32_t height{0};
|
||||
};
|
||||
|
||||
constexpr TextureUsage TEXTURE_USAGE_TRANSIENT = static_cast<TextureUsage>(
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "base/CoreStd.h"
|
||||
|
||||
#include "GFXContext.h"
|
||||
#include "GFXDevice.h"
|
||||
#include "GFXObject.h"
|
||||
|
||||
@@ -47,20 +46,7 @@ Device::~Device() {
|
||||
Device::instance = nullptr;
|
||||
}
|
||||
|
||||
Format Device::getColorFormat() const {
|
||||
return _context->getColorFormat();
|
||||
}
|
||||
|
||||
Format Device::getDepthStencilFormat() const {
|
||||
return _context->getDepthStencilFormat();
|
||||
}
|
||||
|
||||
bool Device::initialize(const DeviceInfo &info) {
|
||||
_width = info.width;
|
||||
_height = info.height;
|
||||
_pixelRatio = info.pixelRatio;
|
||||
_windowHandle = info.windowHandle;
|
||||
|
||||
_bindingMappingInfo = info.bindingMappingInfo;
|
||||
if (_bindingMappingInfo.bufferOffsets.empty()) {
|
||||
_bindingMappingInfo.bufferOffsets.push_back(0);
|
||||
@@ -73,12 +59,40 @@ bool Device::initialize(const DeviceInfo &info) {
|
||||
}
|
||||
|
||||
void Device::destroy() {
|
||||
doDestroy();
|
||||
for (auto pair : _samplers) {
|
||||
CC_SAFE_DELETE(pair.second);
|
||||
}
|
||||
|
||||
for (auto pair : _globalBarriers) {
|
||||
CC_SAFE_DELETE(pair.second);
|
||||
}
|
||||
|
||||
for (auto pair : _textureBarriers) {
|
||||
CC_SAFE_DELETE(pair.second);
|
||||
}
|
||||
|
||||
_bindingMappingInfo.bufferOffsets.clear();
|
||||
_bindingMappingInfo.samplerOffsets.clear();
|
||||
_width = _height = _windowHandle = 0U;
|
||||
_pixelRatio = 1.0F;
|
||||
|
||||
doDestroy();
|
||||
}
|
||||
|
||||
void Device::destroySurface(void *windowHandle) {
|
||||
for (auto *swapchain :_swapchains) {
|
||||
if (swapchain->getWindowHandle() == windowHandle) {
|
||||
swapchain->destroySurface();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Device::createSurface(void *windowHandle) {
|
||||
for (auto *swapchain :_swapchains) {
|
||||
if (!swapchain->getWindowHandle()) {
|
||||
swapchain->createSurface(windowHandle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -31,17 +31,18 @@
|
||||
#include "GFXDescriptorSet.h"
|
||||
#include "GFXDescriptorSetLayout.h"
|
||||
#include "GFXFramebuffer.h"
|
||||
#include "GFXGlobalBarrier.h"
|
||||
#include "GFXInputAssembler.h"
|
||||
#include "GFXObject.h"
|
||||
#include "GFXPipelineLayout.h"
|
||||
#include "GFXPipelineState.h"
|
||||
#include "GFXQueue.h"
|
||||
#include "GFXRenderPass.h"
|
||||
#include "GFXSampler.h"
|
||||
#include "GFXShader.h"
|
||||
#include "GFXSwapchain.h"
|
||||
#include "GFXTexture.h"
|
||||
#include "GFXTextureBarrier.h"
|
||||
#include "states/GFXGlobalBarrier.h"
|
||||
#include "states/GFXSampler.h"
|
||||
#include "states/GFXTextureBarrier.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
@@ -55,28 +56,23 @@ public:
|
||||
bool initialize(const DeviceInfo &info);
|
||||
void destroy();
|
||||
|
||||
virtual void resize(uint width, uint height) = 0;
|
||||
virtual void acquire() = 0;
|
||||
virtual void present() = 0;
|
||||
virtual void acquire(Swapchain *const *swapchains, uint32_t count) = 0;
|
||||
virtual void present() = 0;
|
||||
|
||||
virtual void flushCommands(CommandBuffer *const *cmdBuffs, uint count) {}
|
||||
|
||||
virtual SurfaceTransform getSurfaceTransform() const { return _transform; }
|
||||
virtual uint getWidth() const { return _width; }
|
||||
virtual uint getHeight() const { return _height; }
|
||||
virtual float devicePixelRatio() const { return _pixelRatio; }
|
||||
virtual MemoryStatus & getMemoryStatus() { return _memoryStatus; }
|
||||
virtual uint getNumDrawCalls() const { return _numDrawCalls; }
|
||||
virtual uint getNumInstances() const { return _numInstances; }
|
||||
virtual uint getNumTris() const { return _numTriangles; }
|
||||
virtual MemoryStatus &getMemoryStatus() { return _memoryStatus; }
|
||||
virtual uint getNumDrawCalls() const { return _numDrawCalls; }
|
||||
virtual uint getNumInstances() const { return _numInstances; }
|
||||
virtual uint getNumTris() const { return _numTriangles; }
|
||||
|
||||
inline CommandBuffer * createCommandBuffer(const CommandBufferInfo &info);
|
||||
inline Queue * createQueue(const QueueInfo &info);
|
||||
inline Swapchain * createSwapchain(const SwapchainInfo &info);
|
||||
inline Buffer * createBuffer(const BufferInfo &info);
|
||||
inline Buffer * createBuffer(const BufferViewInfo &info);
|
||||
inline Texture * createTexture(const TextureInfo &info);
|
||||
inline Texture * createTexture(const TextureViewInfo &info);
|
||||
inline Sampler * createSampler(const SamplerInfo &info);
|
||||
inline Shader * createShader(const ShaderInfo &info);
|
||||
inline InputAssembler * createInputAssembler(const InputAssemblerInfo &info);
|
||||
inline RenderPass * createRenderPass(const RenderPassInfo &info);
|
||||
@@ -85,15 +81,17 @@ public:
|
||||
inline DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info);
|
||||
inline PipelineLayout * createPipelineLayout(const PipelineLayoutInfo &info);
|
||||
inline PipelineState * createPipelineState(const PipelineStateInfo &info);
|
||||
inline GlobalBarrier * createGlobalBarrier(const GlobalBarrierInfo &info);
|
||||
inline TextureBarrier * createTextureBarrier(const TextureBarrierInfo &info);
|
||||
|
||||
inline Sampler * getSampler(const SamplerInfo &info);
|
||||
inline GlobalBarrier * getGlobalBarrier(const GlobalBarrierInfo &info);
|
||||
inline TextureBarrier *getTextureBarrier(const TextureBarrierInfo &info);
|
||||
|
||||
virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) = 0;
|
||||
virtual void copyTextureToBuffers(Texture *src, uint8_t *const *buffers, const BufferTextureCopy *region, uint count) = 0;
|
||||
virtual void copyTextureToBuffers(Texture *src, uint8_t *const *buffers, const BufferTextureCopy *region, uint count) = 0;
|
||||
|
||||
inline void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions);
|
||||
inline void flushCommands(const vector<CommandBuffer *> &cmdBuffs);
|
||||
inline void flushCommandsForJS(const vector<CommandBuffer *> &cmdBuffs);
|
||||
inline void acquire(const vector<Swapchain *> &swapchains);
|
||||
|
||||
inline Queue * getQueue() const { return _queue; }
|
||||
inline CommandBuffer * getCommandBuffer() const { return _cmdBuff; }
|
||||
@@ -106,9 +104,6 @@ public:
|
||||
|
||||
inline const BindingMappingInfo &bindingMappingInfo() const { return _bindingMappingInfo; }
|
||||
|
||||
Format getColorFormat() const;
|
||||
Format getDepthStencilFormat() const;
|
||||
|
||||
protected:
|
||||
static Device *instance;
|
||||
|
||||
@@ -118,14 +113,17 @@ protected:
|
||||
|
||||
Device();
|
||||
|
||||
void destroySurface(void *windowHandle);
|
||||
void createSurface(void *windowHandle);
|
||||
|
||||
virtual bool doInit(const DeviceInfo &info) = 0;
|
||||
virtual void doDestroy() = 0;
|
||||
|
||||
virtual CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) = 0;
|
||||
virtual Queue * createQueue() = 0;
|
||||
virtual Swapchain * createSwapchain() = 0;
|
||||
virtual Buffer * createBuffer() = 0;
|
||||
virtual Texture * createTexture() = 0;
|
||||
virtual Sampler * createSampler() = 0;
|
||||
virtual Shader * createShader() = 0;
|
||||
virtual InputAssembler * createInputAssembler() = 0;
|
||||
virtual RenderPass * createRenderPass() = 0;
|
||||
@@ -134,41 +132,39 @@ protected:
|
||||
virtual DescriptorSetLayout *createDescriptorSetLayout() = 0;
|
||||
virtual PipelineLayout * createPipelineLayout() = 0;
|
||||
virtual PipelineState * createPipelineState() = 0;
|
||||
virtual GlobalBarrier * createGlobalBarrier() = 0;
|
||||
virtual TextureBarrier * createTextureBarrier() = 0;
|
||||
|
||||
// On minimize
|
||||
virtual void releaseSurface(uintptr_t windowHandle) {}
|
||||
// On restore
|
||||
virtual void acquireSurface(uintptr_t windowHandle) {}
|
||||
virtual Sampler * createSampler(const SamplerInfo &info) = 0;
|
||||
virtual GlobalBarrier * createGlobalBarrier(const GlobalBarrierInfo &info) = 0;
|
||||
virtual TextureBarrier *createTextureBarrier(const TextureBarrierInfo &info) = 0;
|
||||
|
||||
virtual void bindRenderContext(bool bound) {}
|
||||
virtual void bindDeviceContext(bool bound) {}
|
||||
// For context switching between threads
|
||||
virtual void bindContext(bool bound) {}
|
||||
|
||||
inline Context *getContext() const { return _context; }
|
||||
|
||||
API _api = API::UNKNOWN;
|
||||
SurfaceTransform _transform = SurfaceTransform::IDENTITY;
|
||||
String _deviceName;
|
||||
String _renderer;
|
||||
String _vendor;
|
||||
String _version;
|
||||
API _api{API::UNKNOWN};
|
||||
bool _multithreadedSubmission{true};
|
||||
uint _width{0};
|
||||
uint _height{0};
|
||||
float _pixelRatio{1.0F};
|
||||
MemoryStatus _memoryStatus;
|
||||
uintptr_t _windowHandle{0};
|
||||
Context * _context{nullptr};
|
||||
Queue * _queue{nullptr};
|
||||
CommandBuffer * _cmdBuff{nullptr};
|
||||
uint _numDrawCalls{0U};
|
||||
uint _numInstances{0U};
|
||||
uint _numTriangles{0U};
|
||||
BindingMappingInfo _bindingMappingInfo;
|
||||
DeviceCaps _caps;
|
||||
BindingMappingInfo _bindingMappingInfo;
|
||||
|
||||
std::array<bool, static_cast<size_t>(Feature::COUNT)> _features;
|
||||
|
||||
Queue * _queue{nullptr};
|
||||
CommandBuffer *_cmdBuff{nullptr};
|
||||
|
||||
uint _numDrawCalls{0U};
|
||||
uint _numInstances{0U};
|
||||
uint _numTriangles{0U};
|
||||
MemoryStatus _memoryStatus;
|
||||
|
||||
unordered_map<uint, Sampler *> _samplers;
|
||||
unordered_map<uint, GlobalBarrier *> _globalBarriers;
|
||||
unordered_map<uint, TextureBarrier *> _textureBarriers;
|
||||
|
||||
private:
|
||||
vector<Swapchain *> _swapchains;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -185,6 +181,13 @@ Queue *Device::createQueue(const QueueInfo &info) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Swapchain *Device::createSwapchain(const SwapchainInfo &info) {
|
||||
Swapchain *res = createSwapchain();
|
||||
res->initialize(info);
|
||||
_swapchains.push_back(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
Buffer *Device::createBuffer(const BufferInfo &info) {
|
||||
Buffer *res = createBuffer();
|
||||
res->initialize(info);
|
||||
@@ -209,12 +212,6 @@ Texture *Device::createTexture(const TextureViewInfo &info) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Sampler *Device::createSampler(const SamplerInfo &info) {
|
||||
Sampler *res = createSampler();
|
||||
res->initialize(info);
|
||||
return res;
|
||||
}
|
||||
|
||||
Shader *Device::createShader(const ShaderInfo &info) {
|
||||
Shader *res = createShader();
|
||||
res->initialize(info);
|
||||
@@ -263,16 +260,28 @@ PipelineState *Device::createPipelineState(const PipelineStateInfo &info) {
|
||||
return res;
|
||||
}
|
||||
|
||||
GlobalBarrier *Device::createGlobalBarrier(const GlobalBarrierInfo &info) {
|
||||
GlobalBarrier *res = createGlobalBarrier();
|
||||
res->initialize(info);
|
||||
return res;
|
||||
Sampler *Device::getSampler(const SamplerInfo &info) {
|
||||
uint hash = gfx::Sampler::computeHash(info);
|
||||
if (!_samplers.count(hash)) {
|
||||
_samplers[hash] = createSampler(info);
|
||||
}
|
||||
return _samplers[hash];
|
||||
}
|
||||
|
||||
TextureBarrier *Device::createTextureBarrier(const TextureBarrierInfo &info) {
|
||||
TextureBarrier *res = createTextureBarrier();
|
||||
res->initialize(info);
|
||||
return res;
|
||||
GlobalBarrier *Device::getGlobalBarrier(const GlobalBarrierInfo &info) {
|
||||
uint hash = gfx::GlobalBarrier::computeHash(info);
|
||||
if (!_globalBarriers.count(hash)) {
|
||||
_globalBarriers[hash] = createGlobalBarrier(info);
|
||||
}
|
||||
return _globalBarriers[hash];
|
||||
}
|
||||
|
||||
TextureBarrier *Device::getTextureBarrier(const TextureBarrierInfo &info) {
|
||||
uint hash = gfx::TextureBarrier::computeHash(info);
|
||||
if (!_textureBarriers.count(hash)) {
|
||||
_textureBarriers[hash] = createTextureBarrier(info);
|
||||
}
|
||||
return _textureBarriers[hash];
|
||||
}
|
||||
|
||||
void Device::copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) {
|
||||
@@ -283,8 +292,8 @@ void Device::flushCommands(const vector<CommandBuffer *> &cmdBuffs) {
|
||||
flushCommands(cmdBuffs.data(), utils::toUint(cmdBuffs.size()));
|
||||
}
|
||||
|
||||
void Device::flushCommandsForJS(const vector<CommandBuffer *> &cmdBuffs) {
|
||||
flushCommands(cmdBuffs.data(), utils::toUint(cmdBuffs.size()));
|
||||
void Device::acquire(const vector<Swapchain *> &swapchains) {
|
||||
acquire(swapchains.data(), utils::toUint(swapchains.size()));
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -38,13 +38,15 @@ Framebuffer::Framebuffer()
|
||||
Framebuffer::~Framebuffer() = default;
|
||||
|
||||
uint Framebuffer::computeHash(const FramebufferInfo &info) {
|
||||
uint seed = static_cast<uint>(info.colorTextures.size() + 2);
|
||||
uint seed = static_cast<uint>(info.colorTextures.size() * 2 + (info.depthStencilTexture ? 2 : 0));
|
||||
for (const Texture *attachment : info.colorTextures) {
|
||||
uint id = attachment ? attachment->getObjectID() : 0;
|
||||
seed ^= id + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= attachment->getHash() + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= attachment->getTypedID() + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
if (info.depthStencilTexture) {
|
||||
seed ^= info.depthStencilTexture->getHash() + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= info.depthStencilTexture->getTypedID() + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
uint depthID = info.depthStencilTexture ? info.depthStencilTexture->getObjectID() : 0;
|
||||
seed ^= depthID + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,16 +38,6 @@ InputAssembler::InputAssembler()
|
||||
|
||||
InputAssembler::~InputAssembler() = default;
|
||||
|
||||
void InputAssembler::extractDrawInfo(DrawInfo &drawInfo) const {
|
||||
drawInfo.vertexCount = _vertexCount;
|
||||
drawInfo.firstVertex = _firstVertex;
|
||||
drawInfo.indexCount = _indexCount;
|
||||
drawInfo.firstIndex = _firstIndex;
|
||||
drawInfo.vertexOffset = _vertexOffset;
|
||||
drawInfo.instanceCount = _instanceCount;
|
||||
drawInfo.firstInstance = _firstInstance;
|
||||
}
|
||||
|
||||
uint InputAssembler::computeAttributesHash() const {
|
||||
// https://stackoverflow.com/questions/20511347/a-good-hash-function-for-a-vector
|
||||
// 6: Attribute has 6 elements.
|
||||
@@ -68,16 +58,16 @@ void InputAssembler::initialize(const InputAssemblerInfo &info) {
|
||||
_vertexBuffers = info.vertexBuffers;
|
||||
_indexBuffer = info.indexBuffer;
|
||||
_indirectBuffer = info.indirectBuffer;
|
||||
_attributesHash = computeAttributesHash();
|
||||
|
||||
if (_indexBuffer) {
|
||||
_indexCount = _indexBuffer->getCount();
|
||||
_firstIndex = 0;
|
||||
_drawInfo.indexCount = _indexBuffer->getCount();
|
||||
_drawInfo.firstIndex = 0;
|
||||
} else if (!_vertexBuffers.empty()) {
|
||||
_vertexCount = _vertexBuffers[0]->getCount();
|
||||
_firstVertex = 0;
|
||||
_vertexOffset = 0;
|
||||
_drawInfo.vertexCount = _vertexBuffers[0]->getCount();
|
||||
_drawInfo.firstVertex = 0;
|
||||
_drawInfo.vertexOffset = 0;
|
||||
}
|
||||
_attributesHash = computeAttributesHash();
|
||||
|
||||
doInit(info);
|
||||
}
|
||||
@@ -86,12 +76,13 @@ void InputAssembler::destroy() {
|
||||
doDestroy();
|
||||
|
||||
_attributes.clear();
|
||||
_attributesHash = 0U;
|
||||
|
||||
_vertexBuffers.clear();
|
||||
_indexBuffer = nullptr;
|
||||
_indirectBuffer = nullptr;
|
||||
_indexCount = _firstIndex = _vertexCount = _firstVertex = _vertexOffset = _attributesHash = 0U;
|
||||
|
||||
doDestroy();
|
||||
_drawInfo = DrawInfo();
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -38,28 +38,21 @@ public:
|
||||
void initialize(const InputAssemblerInfo &info);
|
||||
void destroy();
|
||||
|
||||
void extractDrawInfo(DrawInfo &drawInfo) const;
|
||||
|
||||
inline const AttributeList &getAttributes() const { return _attributes; }
|
||||
inline const BufferList & getVertexBuffers() const { return _vertexBuffers; }
|
||||
inline Buffer * getIndexBuffer() const { return _indexBuffer; }
|
||||
inline Buffer * getIndirectBuffer() const { return _indirectBuffer; }
|
||||
inline uint getVertexCount() const { return _vertexCount; }
|
||||
inline uint getFirstVertex() const { return _firstVertex; }
|
||||
inline uint getIndexCount() const { return _indexCount; }
|
||||
inline uint getFirstIndex() const { return _firstIndex; }
|
||||
inline uint getVertexOffset() const { return _vertexOffset; }
|
||||
inline uint getInstanceCount() const { return _instanceCount; }
|
||||
inline uint getFirstInstance() const { return _firstInstance; }
|
||||
inline uint getAttributesHash() const { return _attributesHash; }
|
||||
|
||||
virtual void setVertexCount(uint count) { _vertexCount = count; }
|
||||
virtual void setFirstVertex(uint first) { _firstVertex = first; }
|
||||
virtual void setIndexCount(uint count) { _indexCount = count; }
|
||||
virtual void setFirstIndex(uint first) { _firstIndex = first; }
|
||||
virtual void setVertexOffset(uint offset) { _vertexOffset = offset; }
|
||||
virtual void setInstanceCount(uint count) { _instanceCount = count; }
|
||||
virtual void setFirstInstance(uint first) { _firstInstance = first; }
|
||||
inline const DrawInfo &getDrawInfo() const { return _drawInfo; }
|
||||
|
||||
virtual void setVertexCount(uint32_t count) { _drawInfo.vertexCount = count; }
|
||||
virtual void setFirstVertex(uint32_t first) { _drawInfo.firstVertex = first; }
|
||||
virtual void setIndexCount(uint32_t count) { _drawInfo.indexCount = count; }
|
||||
virtual void setFirstIndex(uint32_t first) { _drawInfo.firstIndex = first; }
|
||||
virtual void setVertexOffset(int32_t offset) { _drawInfo.vertexOffset = offset; }
|
||||
virtual void setInstanceCount(uint32_t count) { _drawInfo.instanceCount = count; }
|
||||
virtual void setFirstInstance(uint32_t first) { _drawInfo.firstInstance = first; }
|
||||
|
||||
protected:
|
||||
virtual void doInit(const InputAssemblerInfo &info) = 0;
|
||||
@@ -68,17 +61,13 @@ protected:
|
||||
uint computeAttributesHash() const;
|
||||
|
||||
AttributeList _attributes;
|
||||
BufferList _vertexBuffers;
|
||||
Buffer * _indexBuffer = nullptr;
|
||||
Buffer * _indirectBuffer = nullptr;
|
||||
uint _vertexCount = 0;
|
||||
uint _firstVertex = 0;
|
||||
uint _indexCount = 0;
|
||||
uint _firstIndex = 0;
|
||||
uint _vertexOffset = 0;
|
||||
uint _instanceCount = 0;
|
||||
uint _firstInstance = 0;
|
||||
uint _attributesHash = 0;
|
||||
uint32_t _attributesHash = 0;
|
||||
|
||||
BufferList _vertexBuffers;
|
||||
Buffer * _indexBuffer{nullptr};
|
||||
Buffer * _indirectBuffer{nullptr};
|
||||
|
||||
DrawInfo _drawInfo;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
inline ObjectType getObjectType() const { return _objectType; }
|
||||
inline uint getObjectID() const { return _objectID; }
|
||||
inline uint getTypedID() const { return _typedID; }
|
||||
inline void resizeObjectID() { _objectID += 10000; } // tempory api
|
||||
|
||||
protected:
|
||||
template <typename T>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace gfx {
|
||||
class CC_DLL PipelineLayout : public GFXObject {
|
||||
public:
|
||||
PipelineLayout();
|
||||
virtual ~PipelineLayout();
|
||||
~PipelineLayout() override;
|
||||
|
||||
void initialize(const PipelineLayoutInfo &info);
|
||||
void destroy();
|
||||
|
||||
@@ -43,8 +43,6 @@ public:
|
||||
|
||||
inline void submit(const CommandBufferList &cmdBuffs) { submit(cmdBuffs.data(), utils::toUint(cmdBuffs.size())); }
|
||||
|
||||
inline void submitForJS(const CommandBufferList &cmdBuffs) { submit(cmdBuffs.data(), utils::toUint(cmdBuffs.size())); }
|
||||
|
||||
inline QueueType getType() const { return _type; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -59,39 +59,45 @@ uint RenderPass::computeHash() {
|
||||
if (paIndex >= _colorAttachments.size()) break;
|
||||
seed += 2;
|
||||
}
|
||||
if (subPass.depthStencil < _colorAttachments.size()) {
|
||||
if (subPass.depthStencil != INVALID_BINDING) {
|
||||
seed += 2;
|
||||
}
|
||||
}
|
||||
for (const SubpassInfo &subPass : _subpasses) {
|
||||
for (const uint iaIndex : subPass.inputs) {
|
||||
for (const SubpassInfo &subpass : _subpasses) {
|
||||
for (const uint iaIndex : subpass.inputs) {
|
||||
if (iaIndex >= _colorAttachments.size()) break;
|
||||
const ColorAttachment &ia = _colorAttachments[iaIndex];
|
||||
seed ^= static_cast<uint>(ia.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ia.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
for (const uint caIndex : subPass.colors) {
|
||||
for (const uint caIndex : subpass.colors) {
|
||||
if (caIndex >= _colorAttachments.size()) break;
|
||||
const ColorAttachment &ca = _colorAttachments[caIndex];
|
||||
seed ^= static_cast<uint>(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ca.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
for (const uint raIndex : subPass.resolves) {
|
||||
for (const uint raIndex : subpass.resolves) {
|
||||
if (raIndex >= _colorAttachments.size()) break;
|
||||
const ColorAttachment &ca = _colorAttachments[raIndex];
|
||||
seed ^= static_cast<uint>(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ca.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
for (const uint paIndex : subPass.preserves) {
|
||||
for (const uint paIndex : subpass.preserves) {
|
||||
if (paIndex >= _colorAttachments.size()) break;
|
||||
const ColorAttachment &ca = _colorAttachments[paIndex];
|
||||
seed ^= static_cast<uint>(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ca.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
if (subPass.depthStencil < _colorAttachments.size()) {
|
||||
const ColorAttachment &ds = _colorAttachments[subPass.depthStencil];
|
||||
seed ^= static_cast<uint>(ds.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ds.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
if (subpass.depthStencil != INVALID_BINDING) {
|
||||
if (subpass.depthStencil < _colorAttachments.size()) {
|
||||
const auto &ds = _colorAttachments[subpass.depthStencil];
|
||||
seed ^= static_cast<uint>(ds.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ds.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
} else {
|
||||
const auto &ds = _depthStencilAttachment;
|
||||
seed ^= static_cast<uint>(ds.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(ds.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -120,32 +126,51 @@ uint RenderPass::computeHash(const RenderPassInfo &info) {
|
||||
seed ^= static_cast<uint>(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
};
|
||||
static auto computeDSAttachmentHash = [](const DepthStencilAttachment &attachment, uint &seed) {
|
||||
seed ^= static_cast<uint>(attachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(attachment.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(attachment.depthLoadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(attachment.depthStoreOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(attachment.stencilLoadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(attachment.stencilStoreOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
for (AccessType type : attachment.beginAccesses) {
|
||||
seed ^= static_cast<uint>(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
for (AccessType type : attachment.endAccesses) {
|
||||
seed ^= static_cast<uint>(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
};
|
||||
uint seed = 0;
|
||||
if (!info.subpasses.empty()) {
|
||||
for (const SubpassInfo &subPass : info.subpasses) {
|
||||
for (const uint iaIndex : subPass.inputs) {
|
||||
for (const SubpassInfo &subpass : info.subpasses) {
|
||||
for (const uint iaIndex : subpass.inputs) {
|
||||
if (iaIndex >= info.colorAttachments.size()) break;
|
||||
const ColorAttachment &ia = info.colorAttachments[iaIndex];
|
||||
seed += 4 + ia.beginAccesses.size() + ia.endAccesses.size();
|
||||
}
|
||||
for (const uint caIndex : subPass.colors) {
|
||||
for (const uint caIndex : subpass.colors) {
|
||||
if (caIndex >= info.colorAttachments.size()) break;
|
||||
const ColorAttachment &ca = info.colorAttachments[caIndex];
|
||||
seed += 4 + ca.beginAccesses.size() + ca.endAccesses.size();
|
||||
}
|
||||
for (const uint raIndex : subPass.resolves) {
|
||||
for (const uint raIndex : subpass.resolves) {
|
||||
if (raIndex >= info.colorAttachments.size()) break;
|
||||
const ColorAttachment &ra = info.colorAttachments[raIndex];
|
||||
seed += 4 + ra.beginAccesses.size() + ra.endAccesses.size();
|
||||
}
|
||||
for (const uint paIndex : subPass.preserves) {
|
||||
for (const uint paIndex : subpass.preserves) {
|
||||
if (paIndex >= info.colorAttachments.size()) break;
|
||||
const ColorAttachment &pa = info.colorAttachments[paIndex];
|
||||
seed += 4 + pa.beginAccesses.size() + pa.endAccesses.size();
|
||||
}
|
||||
if (subPass.depthStencil < info.colorAttachments.size()) {
|
||||
const ColorAttachment &ds = info.colorAttachments[subPass.depthStencil];
|
||||
seed += 4 + ds.beginAccesses.size() + ds.endAccesses.size();
|
||||
if (subpass.depthStencil != INVALID_BINDING) {
|
||||
if (subpass.depthStencil < info.colorAttachments.size()) {
|
||||
const auto &ds = info.colorAttachments[subpass.depthStencil];
|
||||
seed += 4 + ds.beginAccesses.size() + ds.endAccesses.size();
|
||||
} else {
|
||||
const auto &ds = info.depthStencilAttachment;
|
||||
seed += 6 + ds.beginAccesses.size() + ds.endAccesses.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const SubpassInfo &subpass : info.subpasses) {
|
||||
@@ -165,8 +190,12 @@ uint RenderPass::computeHash(const RenderPassInfo &info) {
|
||||
if (paIndex >= info.colorAttachments.size()) break;
|
||||
computeAttachmentHash(info.colorAttachments[paIndex], seed);
|
||||
}
|
||||
if (subpass.depthStencil < info.colorAttachments.size()) {
|
||||
computeAttachmentHash(info.colorAttachments[subpass.depthStencil], seed);
|
||||
if (subpass.depthStencil != INVALID_BINDING) {
|
||||
if (subpass.depthStencil < info.colorAttachments.size()) {
|
||||
computeAttachmentHash(info.colorAttachments[subpass.depthStencil], seed);
|
||||
} else {
|
||||
computeDSAttachmentHash(info.depthStencilAttachment, seed);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -178,18 +207,7 @@ uint RenderPass::computeHash(const RenderPassInfo &info) {
|
||||
for (const ColorAttachment &ca : info.colorAttachments) {
|
||||
computeAttachmentHash(ca, seed);
|
||||
}
|
||||
seed ^= static_cast<uint>(info.depthStencilAttachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.depthStencilAttachment.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.depthStencilAttachment.depthLoadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.depthStencilAttachment.depthStoreOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.depthStencilAttachment.stencilLoadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.depthStencilAttachment.stencilStoreOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
for (AccessType type : info.depthStencilAttachment.beginAccesses) {
|
||||
seed ^= static_cast<uint>(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
for (AccessType type : info.depthStencilAttachment.endAccesses) {
|
||||
seed ^= static_cast<uint>(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
computeDSAttachmentHash(info.depthStencilAttachment, seed);
|
||||
}
|
||||
|
||||
return seed;
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2019-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 "GFXObject.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL Sampler : public GFXObject {
|
||||
public:
|
||||
Sampler();
|
||||
~Sampler() override;
|
||||
|
||||
void initialize(const SamplerInfo &info);
|
||||
void destroy();
|
||||
|
||||
inline Filter getMinFilter() const { return _minFilter; }
|
||||
inline Filter getMagFilter() const { return _magFilter; }
|
||||
inline Filter getMipFilter() const { return _mipFilter; }
|
||||
inline Address getAddressU() const { return _addressU; }
|
||||
inline Address getAddressV() const { return _addressV; }
|
||||
inline Address getAddressW() const { return _addressW; }
|
||||
inline uint getMaxAnisotropy() const { return _maxAnisotropy; }
|
||||
inline ComparisonFunc getCmpFunc() const { return _cmpFunc; }
|
||||
inline const Color & getBorderColor() const { return _borderColor; }
|
||||
inline float getMipLODBias() const { return _mipLODBias; }
|
||||
|
||||
protected:
|
||||
virtual void doInit(const SamplerInfo &info) = 0;
|
||||
virtual void doDestroy() = 0;
|
||||
|
||||
Filter _minFilter = Filter::NONE;
|
||||
Filter _magFilter = Filter::NONE;
|
||||
Filter _mipFilter = Filter::NONE;
|
||||
Address _addressU = Address::WRAP;
|
||||
Address _addressV = Address::WRAP;
|
||||
Address _addressW = Address::WRAP;
|
||||
uint _maxAnisotropy = 0;
|
||||
ComparisonFunc _cmpFunc = ComparisonFunc::ALWAYS;
|
||||
Color _borderColor;
|
||||
float _mipLODBias = 0.0F;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
+22
-21
@@ -25,39 +25,40 @@
|
||||
|
||||
#include "base/CoreStd.h"
|
||||
|
||||
#include "GFXObject.h"
|
||||
#include "GFXSampler.h"
|
||||
#include "GFXSwapchain.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
Sampler::Sampler()
|
||||
: GFXObject(ObjectType::SAMPLER) {
|
||||
_borderColor.x = 0.0F;
|
||||
_borderColor.y = 0.0F;
|
||||
_borderColor.z = 0.0F;
|
||||
_borderColor.w = 0.0F;
|
||||
Swapchain::Swapchain()
|
||||
: GFXObject(ObjectType::SWAPCHAIN) {
|
||||
}
|
||||
|
||||
Sampler::~Sampler() = default;
|
||||
Swapchain::~Swapchain() = default;
|
||||
|
||||
void Sampler::initialize(const SamplerInfo &info) {
|
||||
_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;
|
||||
void Swapchain::initialize(const SwapchainInfo &info) {
|
||||
CCASSERT(info.windowHandle, "Invalid window handle");
|
||||
|
||||
_windowHandle = info.windowHandle;
|
||||
_vsyncMode = info.vsyncMode;
|
||||
|
||||
doInit(info);
|
||||
}
|
||||
|
||||
void Sampler::destroy() {
|
||||
void Swapchain::destroy() {
|
||||
doDestroy();
|
||||
|
||||
_windowHandle = nullptr;
|
||||
}
|
||||
|
||||
void Swapchain::resize(uint32_t width, uint32_t height, SurfaceTransform transform) {
|
||||
if (width != _colorTexture->getWidth() || height != _colorTexture->getHeight()) {
|
||||
doResize(width, height, transform);
|
||||
|
||||
_colorTexture->_info.width = _depthStencilTexture->_info.width = width;
|
||||
_colorTexture->_info.height = _depthStencilTexture->_info.height = height;
|
||||
if (isPreRotationEnabled()) _transform = transform;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2019-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 "GFXTexture.h"
|
||||
#include "gfx-base/GFXDef-common.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL Swapchain : public GFXObject {
|
||||
public:
|
||||
Swapchain();
|
||||
~Swapchain() override;
|
||||
|
||||
void initialize(const SwapchainInfo &info);
|
||||
void resize(uint32_t width, uint32_t height, SurfaceTransform transform);
|
||||
void destroy();
|
||||
|
||||
// TO BE REMOVED
|
||||
inline void resize(uint32_t width, uint32_t height) { resize(width, height, SurfaceTransform::IDENTITY); }
|
||||
|
||||
inline void destroySurface();
|
||||
inline void createSurface(void *windowHandle);
|
||||
|
||||
inline void * getWindowHandle() const { return _windowHandle; }
|
||||
inline VsyncMode getVSyncMode() const { return _vsyncMode; }
|
||||
|
||||
inline Texture *getColorTexture() const { return _colorTexture; }
|
||||
inline Texture *getDepthStencilTexture() const { return _depthStencilTexture; }
|
||||
|
||||
inline uint32_t getWidth() const { return _colorTexture->getWidth(); }
|
||||
inline uint32_t getHeight() const { return _colorTexture->getHeight(); }
|
||||
inline SurfaceTransform getSurfaceTransform() const { return _transform; }
|
||||
|
||||
virtual bool isPreRotationEnabled() { return _preRotationEnabled; }
|
||||
|
||||
protected:
|
||||
virtual void doInit(const SwapchainInfo &info) = 0;
|
||||
virtual void doDestroy() = 0;
|
||||
virtual void doResize(uint32_t width, uint32_t height, SurfaceTransform transform) = 0;
|
||||
virtual void doDestroySurface() = 0;
|
||||
virtual void doCreateSurface(void *windowHandle) = 0;
|
||||
|
||||
static inline void initTexture(const SwapchainTextureInfo &info, Texture *texture);
|
||||
|
||||
void * _windowHandle{nullptr};
|
||||
VsyncMode _vsyncMode{VsyncMode::RELAXED};
|
||||
SurfaceTransform _transform{SurfaceTransform::IDENTITY};
|
||||
bool _preRotationEnabled{false};
|
||||
|
||||
Texture *_colorTexture{nullptr};
|
||||
Texture *_depthStencilTexture{nullptr};
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void Swapchain::destroySurface() {
|
||||
doDestroySurface();
|
||||
_windowHandle = nullptr;
|
||||
}
|
||||
|
||||
void Swapchain::createSurface(void *windowHandle) {
|
||||
_windowHandle = windowHandle;
|
||||
doCreateSurface(windowHandle);
|
||||
}
|
||||
|
||||
void Swapchain::initTexture(const SwapchainTextureInfo &info, Texture *texture) {
|
||||
Texture::initialize(info, texture);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include "base/CoreStd.h"
|
||||
|
||||
#include "GFXDevice.h"
|
||||
#include "GFXObject.h"
|
||||
#include "GFXSwapchain.h"
|
||||
#include "GFXTexture.h"
|
||||
|
||||
namespace cc {
|
||||
@@ -43,71 +42,112 @@ uint Texture::computeHash(const TextureInfo &info) {
|
||||
seed ^= static_cast<uint>(info.type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.usage) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.flags) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.samples) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.width) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.height) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.flags) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.depth) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.layerCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.levelCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.samples) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.depth) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
|
||||
uint Texture::computeHash(const TextureViewInfo &info) {
|
||||
uint seed = 7;
|
||||
seed ^= static_cast<uint>(info.texture->getHash()) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.type) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= static_cast<uint>(info.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.baseLevel) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.levelCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.baseLayer) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
seed ^= (info.layerCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
return seed;
|
||||
}
|
||||
|
||||
uint Texture::computeHash(const Texture *texture) {
|
||||
uint hash = texture->isTextureView() ? computeHash(texture->getViewInfo()) : computeHash(texture->getInfo());
|
||||
if (texture->_swapchain) hash ^= (texture->_swapchain->getObjectID()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
|
||||
return hash;
|
||||
}
|
||||
|
||||
void Texture::initialize(const TextureInfo &info) {
|
||||
_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);
|
||||
_info = info;
|
||||
_size = formatSize(_info.format, _info.width, _info.height, _info.depth);
|
||||
_hash = computeHash(info);
|
||||
|
||||
_viewInfo.texture = this;
|
||||
_viewInfo.format = _info.format;
|
||||
_viewInfo.type = _info.type;
|
||||
_viewInfo.baseLayer = 0;
|
||||
_viewInfo.layerCount = _info.layerCount;
|
||||
_viewInfo.baseLevel = 0;
|
||||
_viewInfo.levelCount = _info.levelCount;
|
||||
|
||||
doInit(info);
|
||||
}
|
||||
|
||||
void Texture::initialize(const TextureViewInfo &info) {
|
||||
_isTextureView = true;
|
||||
_info = info.texture->getInfo();
|
||||
_viewInfo = info;
|
||||
|
||||
_type = info.texture->getType();
|
||||
_format = info.format;
|
||||
_baseLayer = info.baseLayer;
|
||||
_layerCount = info.layerCount;
|
||||
_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);
|
||||
_isTextureView = true;
|
||||
_size = formatSize(_info.format, _info.width, _info.height, _info.depth);
|
||||
_hash = computeHash(info);
|
||||
|
||||
doInit(info);
|
||||
}
|
||||
|
||||
void Texture::resize(uint width, uint height) {
|
||||
if (_info.width != width || _info.height != height) {
|
||||
uint size = formatSize(_info.format, width, height, _info.depth);
|
||||
doResize(width, height, size);
|
||||
|
||||
_info.width = width;
|
||||
_info.height = height;
|
||||
_size = size;
|
||||
_hash = computeHash(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Texture::destroy() {
|
||||
doDestroy();
|
||||
|
||||
_format = Format::UNKNOWN;
|
||||
_width = _height = _depth = _size = 0;
|
||||
_info = TextureInfo();
|
||||
_viewInfo = TextureViewInfo();
|
||||
|
||||
_isTextureView = false;
|
||||
_size = _hash = 0;
|
||||
}
|
||||
|
||||
void Texture::resize(uint width, uint height) {
|
||||
if (_width != width || _height != height) {
|
||||
uint size = formatSize(_format, width, height, _depth);
|
||||
doResize(width, height, size);
|
||||
///////////////////////////// Swapchian Specific /////////////////////////////
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
_size = size;
|
||||
void Texture::initialize(const SwapchainTextureInfo &info, Texture *out) {
|
||||
out->_info.type = TextureType::TEX2D;
|
||||
out->_info.format = info.format;
|
||||
out->_info.width = info.width;
|
||||
out->_info.height = info.height;
|
||||
out->_info.layerCount = 1;
|
||||
out->_info.levelCount = 1;
|
||||
out->_info.depth = 1;
|
||||
out->_info.samples = SampleCount::ONE;
|
||||
out->_info.flags = TextureFlagBit::NONE;
|
||||
out->_info.usage = GFX_FORMAT_INFOS[toNumber(info.format)].hasDepth
|
||||
? TextureUsageBit::DEPTH_STENCIL_ATTACHMENT
|
||||
: TextureUsageBit::COLOR_ATTACHMENT;
|
||||
|
||||
resizeObjectID();
|
||||
}
|
||||
out->_swapchain = info.swapchain;
|
||||
out->_size = formatSize(info.format, info.width, info.height, 1);
|
||||
out->_hash = computeHash(out);
|
||||
|
||||
out->_viewInfo.texture = out;
|
||||
out->_viewInfo.format = out->_info.format;
|
||||
out->_viewInfo.type = out->_info.type;
|
||||
out->_viewInfo.baseLayer = 0;
|
||||
out->_viewInfo.layerCount = out->_info.layerCount;
|
||||
out->_viewInfo.baseLevel = 0;
|
||||
out->_viewInfo.levelCount = out->_info.levelCount;
|
||||
|
||||
out->doInit(info);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -35,46 +35,45 @@ public:
|
||||
Texture();
|
||||
~Texture() override;
|
||||
|
||||
static uint computeHash(const TextureInfo &info);
|
||||
static uint32_t computeHash(const TextureInfo &info);
|
||||
static uint32_t computeHash(const TextureViewInfo &info);
|
||||
|
||||
void initialize(const TextureInfo &info);
|
||||
void initialize(const TextureViewInfo &info);
|
||||
void resize(uint32_t width, uint32_t height);
|
||||
void destroy();
|
||||
void resize(uint width, uint height);
|
||||
|
||||
inline TextureType getType() const { return _type; }
|
||||
inline TextureUsage getUsage() const { return _usage; }
|
||||
inline Format getFormat() const { return _format; }
|
||||
inline uint getWidth() const { return _width; }
|
||||
inline uint getHeight() const { return _height; }
|
||||
inline uint getDepth() const { return _depth; }
|
||||
inline uint getLayerCount() const { return _layerCount; }
|
||||
inline uint getLevelCount() const { return _levelCount; }
|
||||
inline uint getSize() const { return _size; }
|
||||
inline SampleCount getSamples() const { return _samples; }
|
||||
inline TextureFlags getFlags() const { return _flags; }
|
||||
inline bool isTextureView() const { return _isTextureView; }
|
||||
inline const TextureInfo & getInfo() const { return _info; }
|
||||
inline const TextureViewInfo &getViewInfo() const { return _viewInfo; }
|
||||
|
||||
inline bool isTextureView() const { return _isTextureView; }
|
||||
inline uint32_t getSize() const { return _size; }
|
||||
inline uint32_t getHash() const { return _hash; }
|
||||
|
||||
// convenient getter for common usages
|
||||
inline Format getFormat() const { return _info.format; }
|
||||
inline uint32_t getWidth() const { return _info.width; }
|
||||
inline uint32_t getHeight() const { return _info.height; }
|
||||
|
||||
protected:
|
||||
virtual void doInit(const TextureInfo &info) = 0;
|
||||
virtual void doInit(const TextureViewInfo &info) = 0;
|
||||
virtual void doDestroy() = 0;
|
||||
virtual void doResize(uint width, uint height, uint size) = 0;
|
||||
friend class Swapchain;
|
||||
|
||||
TextureType _type = TextureType::TEX2D;
|
||||
TextureUsage _usage = TextureUsageBit::NONE;
|
||||
Format _format = Format::UNKNOWN;
|
||||
uint _width = 0U;
|
||||
uint _height = 0U;
|
||||
uint _depth = 1U;
|
||||
uint _baseLevel = 0U;
|
||||
uint _levelCount = 1U;
|
||||
uint _baseLayer = 0U;
|
||||
uint _layerCount = 1U;
|
||||
uint _size = 0U;
|
||||
SampleCount _samples = SampleCount::X1;
|
||||
TextureFlags _flags = TextureFlagBit::NONE;
|
||||
bool _isTextureView = false;
|
||||
virtual void doInit(const TextureInfo &info) = 0;
|
||||
virtual void doInit(const TextureViewInfo &info) = 0;
|
||||
virtual void doDestroy() = 0;
|
||||
virtual void doResize(uint32_t width, uint32_t height, uint32_t size) = 0;
|
||||
|
||||
static uint32_t computeHash(const Texture *texture);
|
||||
static void initialize(const SwapchainTextureInfo &info, Texture *out);
|
||||
virtual void doInit(const SwapchainTextureInfo &info) = 0;
|
||||
|
||||
TextureInfo _info;
|
||||
TextureViewInfo _viewInfo;
|
||||
|
||||
Swapchain *_swapchain{nullptr};
|
||||
bool _isTextureView{false};
|
||||
uint32_t _size{0U};
|
||||
uint32_t _hash{0U};
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
/****************************************************************************
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include "SPIRVUtils.h"
|
||||
|
||||
#include "base/Log.h"
|
||||
#include "base/Utils.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
#include "glslang/SPIRV/GlslangToSpv.h"
|
||||
#include "glslang/StandAlone/ResourceLimits.h"
|
||||
#include "spirv/spirv.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
namespace {
|
||||
EShLanguage getShaderStage(ShaderStageFlagBit type) {
|
||||
switch (type) {
|
||||
case ShaderStageFlagBit::VERTEX: return EShLangVertex;
|
||||
case ShaderStageFlagBit::CONTROL: return EShLangTessControl;
|
||||
case ShaderStageFlagBit::EVALUATION: return EShLangTessEvaluation;
|
||||
case ShaderStageFlagBit::GEOMETRY: return EShLangGeometry;
|
||||
case ShaderStageFlagBit::FRAGMENT: return EShLangFragment;
|
||||
case ShaderStageFlagBit::COMPUTE: return EShLangCompute;
|
||||
default: {
|
||||
CCASSERT(false, "Unsupported ShaderStageFlagBit, convert to EShLanguage failed.");
|
||||
return EShLangVertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glslang::EShTargetClientVersion getClientVersion(int vulkanMinorVersion) {
|
||||
switch (vulkanMinorVersion) {
|
||||
case 0: return glslang::EShTargetVulkan_1_0;
|
||||
case 1: return glslang::EShTargetVulkan_1_1;
|
||||
case 2: return glslang::EShTargetVulkan_1_2;
|
||||
default: {
|
||||
CCASSERT(false, "Unsupported vulkan version, convert to EShTargetClientVersion failed.");
|
||||
return glslang::EShTargetVulkan_1_0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glslang::EShTargetLanguageVersion getTargetVersion(int vulkanMinorVersion) {
|
||||
switch (vulkanMinorVersion) {
|
||||
case 0: return glslang::EShTargetSpv_1_0;
|
||||
case 1: return glslang::EShTargetSpv_1_3;
|
||||
case 2: return glslang::EShTargetSpv_1_5;
|
||||
default: {
|
||||
CCASSERT(false, "Unsupported vulkan version, convert to EShTargetLanguageVersion failed.");
|
||||
return glslang::EShTargetSpv_1_0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.pdf
|
||||
struct Id {
|
||||
uint32_t opcode{0};
|
||||
uint32_t typeId{0};
|
||||
uint32_t storageClass{0};
|
||||
uint32_t* pLocation{nullptr};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
SPIRVUtils SPIRVUtils::instance;
|
||||
|
||||
void SPIRVUtils::initialize(int vulkanMinorVersion) {
|
||||
glslang::InitializeProcess();
|
||||
|
||||
_clientInputSemanticsVersion = 100 + vulkanMinorVersion * 10;
|
||||
_clientVersion = getClientVersion(vulkanMinorVersion);
|
||||
_targetVersion = getTargetVersion(vulkanMinorVersion);
|
||||
}
|
||||
|
||||
void SPIRVUtils::destroy() {
|
||||
glslang::FinalizeProcess();
|
||||
_output.clear();
|
||||
}
|
||||
|
||||
void SPIRVUtils::compileGLSL(ShaderStageFlagBit type, const String& source) {
|
||||
EShLanguage stage = getShaderStage(type);
|
||||
const char* string = source.c_str();
|
||||
|
||||
_shader = std::make_unique<glslang::TShader>(stage);
|
||||
_shader->setStrings(&string, 1);
|
||||
|
||||
_shader->setEnvInput(glslang::EShSourceGlsl, stage, glslang::EShClientVulkan, _clientInputSemanticsVersion);
|
||||
_shader->setEnvClient(glslang::EShClientVulkan, _clientVersion);
|
||||
_shader->setEnvTarget(glslang::EShTargetSpv, _targetVersion);
|
||||
|
||||
auto messages = static_cast<EShMessages>(EShMsgSpvRules | EShMsgVulkanRules);
|
||||
|
||||
if (!_shader->parse(&glslang::DefaultTBuiltInResource, _clientInputSemanticsVersion, false, messages)) {
|
||||
CC_LOG_ERROR("GLSL Parsing Failed:\n%s\n%s", _shader->getInfoLog(), _shader->getInfoDebugLog());
|
||||
}
|
||||
|
||||
_program = std::make_unique<glslang::TProgram>();
|
||||
_program->addShader(_shader.get());
|
||||
|
||||
if (!_program->link(messages)) {
|
||||
CC_LOG_ERROR("GLSL Linking Failed:\n%s\n%s", _program->getInfoLog(), _program->getInfoDebugLog());
|
||||
}
|
||||
|
||||
_output.clear();
|
||||
spv::SpvBuildLogger logger;
|
||||
glslang::SpvOptions spvOptions;
|
||||
spvOptions.disableOptimizer = false;
|
||||
#if CC_DEBUG > 0
|
||||
//spvOptions.validate = true;
|
||||
#else
|
||||
spvOptions.optimizeSize = true;
|
||||
spvOptions.stripDebugInfo = true;
|
||||
#endif
|
||||
glslang::GlslangToSpv(*_program->getIntermediate(stage), _output, &logger, &spvOptions);
|
||||
}
|
||||
|
||||
void SPIRVUtils::compressInputLocations(gfx::AttributeList& attributes) {
|
||||
static std::vector<Id> ids;
|
||||
static vector<uint32_t> activeLocations;
|
||||
static vector<uint32_t> newLocations;
|
||||
|
||||
uint32_t* code = _output.data();
|
||||
uint32_t codeSize = utils::toUint(_output.size());
|
||||
|
||||
CC_ASSERT(code[0] == SpvMagicNumber);
|
||||
|
||||
uint32_t idBound = code[3];
|
||||
ids.assign(idBound, {});
|
||||
|
||||
uint32_t* insn = code + 5;
|
||||
while (insn != code + codeSize) {
|
||||
auto opcode = static_cast<uint16_t>(insn[0]);
|
||||
auto wordCount = static_cast<uint16_t>(insn[0] >> 16);
|
||||
|
||||
switch (opcode) {
|
||||
case SpvOpDecorate: {
|
||||
CC_ASSERT(wordCount >= 3);
|
||||
|
||||
uint32_t id = insn[1];
|
||||
CC_ASSERT(id < idBound);
|
||||
|
||||
switch (insn[2]) {
|
||||
case SpvDecorationLocation:
|
||||
CC_ASSERT(wordCount == 4);
|
||||
ids[id].pLocation = &insn[3];
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case SpvOpVariable: {
|
||||
CC_ASSERT(wordCount >= 4);
|
||||
|
||||
uint32_t id = insn[2];
|
||||
CC_ASSERT(id < idBound);
|
||||
|
||||
CC_ASSERT(ids[id].opcode == 0);
|
||||
ids[id].opcode = opcode;
|
||||
ids[id].typeId = insn[1];
|
||||
ids[id].storageClass = insn[3];
|
||||
} break;
|
||||
}
|
||||
|
||||
CC_ASSERT(insn + wordCount <= code + codeSize);
|
||||
insn += wordCount;
|
||||
}
|
||||
|
||||
_program->buildReflection();
|
||||
activeLocations.clear();
|
||||
int activeCount = _program->getNumPipeInputs();
|
||||
for (int i = 0; i < activeCount; ++i) {
|
||||
activeLocations.push_back(_program->getPipeInput(i).getType()->getQualifier().layoutLocation);
|
||||
}
|
||||
|
||||
uint32_t location = 0;
|
||||
uint32_t unusedLocation = activeCount;
|
||||
newLocations.assign(attributes.size(), UINT_MAX);
|
||||
|
||||
for (auto& id : ids) {
|
||||
if (id.opcode == SpvOpVariable && id.storageClass == SpvStorageClassInput) {
|
||||
uint32_t oldLocation = *id.pLocation;
|
||||
|
||||
// update locations in SPIRV
|
||||
if (std::find(activeLocations.begin(), activeLocations.end(), *id.pLocation) != activeLocations.end()) {
|
||||
*id.pLocation = location++;
|
||||
} else {
|
||||
*id.pLocation = unusedLocation++;
|
||||
}
|
||||
|
||||
// save record
|
||||
bool found{false};
|
||||
for (size_t i = 0; i < attributes.size(); ++i) {
|
||||
if (attributes[i].location == oldLocation) {
|
||||
newLocations[i] = *id.pLocation;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CCASSERT(found, "missing attribute declarations?");
|
||||
}
|
||||
}
|
||||
|
||||
// update gfx references
|
||||
for (size_t i = 0; i < attributes.size(); ++i) {
|
||||
attributes[i].location = newLocations[i];
|
||||
}
|
||||
|
||||
attributes.erase(std::remove_if(attributes.begin(), attributes.end(), [](const auto& attr) {
|
||||
return attr.location == UINT_MAX;
|
||||
}),
|
||||
attributes.end());
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
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 <memory>
|
||||
#include "gfx-base/GFXDef.h"
|
||||
#include "glslang/Public/ShaderLang.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class SPIRVUtils {
|
||||
public:
|
||||
static SPIRVUtils* getInstance() { return &instance; }
|
||||
|
||||
void initialize(int vulkanMinorVersion);
|
||||
void destroy();
|
||||
|
||||
void compileGLSL(ShaderStageFlagBit type, const String& source);
|
||||
void compressInputLocations(gfx::AttributeList& attributes);
|
||||
|
||||
inline uint32_t* getOutputData() {
|
||||
_shader.reset();
|
||||
_program.reset();
|
||||
return _output.data();
|
||||
}
|
||||
|
||||
inline size_t getOutputSize() {
|
||||
return _output.size() * sizeof(uint32_t);
|
||||
}
|
||||
|
||||
private:
|
||||
int _clientInputSemanticsVersion{0};
|
||||
glslang::EShTargetClientVersion _clientVersion{glslang::EShTargetClientVersion::EShTargetVulkan_1_0};
|
||||
glslang::EShTargetLanguageVersion _targetVersion{glslang::EShTargetLanguageVersion::EShTargetSpv_1_0};
|
||||
|
||||
std::unique_ptr<glslang::TShader> _shader{nullptr};
|
||||
std::unique_ptr<glslang::TProgram> _program{nullptr};
|
||||
vector<uint32_t> _output;
|
||||
|
||||
static SPIRVUtils instance;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
+2
-5
@@ -26,18 +26,15 @@
|
||||
#include "base/CoreStd.h"
|
||||
|
||||
#include "GFXGlobalBarrier.h"
|
||||
#include "GFXObject.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
GlobalBarrier::GlobalBarrier()
|
||||
GlobalBarrier::GlobalBarrier(const GlobalBarrierInfo &info)
|
||||
: GFXObject(ObjectType::GLOBAL_BARRIER) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_info = info;
|
||||
}
|
||||
|
||||
GlobalBarrier::~GlobalBarrier() = default;
|
||||
|
||||
uint GlobalBarrier::computeHash(const GlobalBarrierInfo &info) {
|
||||
uint seed = static_cast<uint>(info.prevAccesses.size() + info.nextAccesses.size());
|
||||
|
||||
+3
-12
@@ -25,29 +25,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GFXObject.h"
|
||||
#include "../GFXObject.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL GlobalBarrier : public GFXObject {
|
||||
public:
|
||||
GlobalBarrier();
|
||||
~GlobalBarrier() override;
|
||||
explicit GlobalBarrier(const GlobalBarrierInfo &info);
|
||||
|
||||
static uint computeHash(const GlobalBarrierInfo &info);
|
||||
|
||||
inline const GlobalBarrierInfo &info() const { return _info; }
|
||||
inline const GlobalBarrierInfo &getInfo() const { return _info; }
|
||||
|
||||
protected:
|
||||
friend class Device;
|
||||
|
||||
virtual void doInit(const GlobalBarrierInfo &info) {}
|
||||
|
||||
void initialize(const GlobalBarrierInfo &info) {
|
||||
_info = info; doInit(info);
|
||||
}
|
||||
|
||||
GlobalBarrierInfo _info;
|
||||
};
|
||||
|
||||
+17
-16
@@ -23,28 +23,29 @@
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "base/CoreStd.h"
|
||||
|
||||
#include "gfx-base/GFXContext.h"
|
||||
#include "GFXSampler.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CCMTLContext final : public Context {
|
||||
public:
|
||||
explicit CCMTLContext();
|
||||
~CCMTLContext() override = default;
|
||||
CCMTLContext(const CCMTLContext &)=delete;
|
||||
CCMTLContext(CCMTLContext &&)=delete;
|
||||
CCMTLContext &operator=(const CCMTLContext &)=delete;
|
||||
CCMTLContext &operator=(CCMTLContext &&)=delete;
|
||||
Sampler::Sampler(const SamplerInfo &info)
|
||||
: GFXObject(ObjectType::SAMPLER) {
|
||||
_info = info;
|
||||
}
|
||||
|
||||
void present() override {}
|
||||
|
||||
protected:
|
||||
bool doInit(const ContextInfo &info) override;
|
||||
void doDestroy() override {}
|
||||
};
|
||||
uint32_t Sampler::computeHash(const SamplerInfo &info) {
|
||||
uint32_t hash = toNumber(info.minFilter);
|
||||
hash |= (toNumber(info.magFilter) << 2);
|
||||
hash |= (toNumber(info.mipFilter) << 4);
|
||||
hash |= (toNumber(info.addressU) << 6);
|
||||
hash |= (toNumber(info.addressV) << 8);
|
||||
hash |= (toNumber(info.addressW) << 10);
|
||||
hash |= (info.maxAnisotropy << 12);
|
||||
hash |= (toNumber(info.cmpFunc) << 16);
|
||||
return hash;
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
+9
-5
@@ -25,18 +25,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gfx-base/GFXContext.h"
|
||||
#include "../GFXObject.h"
|
||||
#include "gfx-base/GFXDef-common.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL EmptyContext final : public Context {
|
||||
class CC_DLL Sampler : public GFXObject {
|
||||
public:
|
||||
void present() override;
|
||||
explicit Sampler(const SamplerInfo &info);
|
||||
|
||||
static uint32_t computeHash(const SamplerInfo &info);
|
||||
|
||||
inline const SamplerInfo &getInfo() const { return _info; }
|
||||
|
||||
protected:
|
||||
bool doInit(const ContextInfo &info) override;
|
||||
void doDestroy() override;
|
||||
SamplerInfo _info;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
+3
-6
@@ -25,20 +25,17 @@
|
||||
|
||||
#include "base/CoreStd.h"
|
||||
|
||||
#include "GFXObject.h"
|
||||
#include "GFXQueue.h"
|
||||
#include "../GFXQueue.h"
|
||||
#include "GFXTextureBarrier.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
TextureBarrier::TextureBarrier()
|
||||
TextureBarrier::TextureBarrier(const TextureBarrierInfo &info)
|
||||
: GFXObject(ObjectType::TEXTURE_BARRIER) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
_info = info;
|
||||
}
|
||||
|
||||
TextureBarrier::~TextureBarrier() = default;
|
||||
|
||||
uint TextureBarrier::computeHash(const TextureBarrierInfo &info) {
|
||||
uint seed = static_cast<uint>(info.prevAccesses.size() + info.nextAccesses.size() + 3);
|
||||
|
||||
+3
-13
@@ -25,30 +25,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GFXObject.h"
|
||||
#include "../GFXObject.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
class CC_DLL TextureBarrier : public GFXObject {
|
||||
public:
|
||||
TextureBarrier();
|
||||
~TextureBarrier() override;
|
||||
explicit TextureBarrier(const TextureBarrierInfo &info);
|
||||
|
||||
static uint computeHash(const TextureBarrierInfo &info);
|
||||
|
||||
inline const TextureBarrierInfo &info() const { return _info; }
|
||||
inline const TextureBarrierInfo &getInfo() const { return _info; }
|
||||
|
||||
protected:
|
||||
friend class Device;
|
||||
|
||||
virtual void doInit(const TextureBarrierInfo &info) {}
|
||||
|
||||
void initialize(const TextureBarrierInfo &info) {
|
||||
_info = info;
|
||||
doInit(info);
|
||||
}
|
||||
|
||||
TextureBarrierInfo _info;
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "EmptyBuffer.h"
|
||||
#include "EmptyCommandBuffer.h"
|
||||
#include "EmptyContext.h"
|
||||
#include "EmptyDescriptorSet.h"
|
||||
#include "EmptyDescriptorSetLayout.h"
|
||||
#include "EmptyDevice.h"
|
||||
@@ -37,8 +36,8 @@
|
||||
#include "EmptyPipelineState.h"
|
||||
#include "EmptyQueue.h"
|
||||
#include "EmptyRenderPass.h"
|
||||
#include "EmptySampler.h"
|
||||
#include "EmptyShader.h"
|
||||
#include "EmptySwapchain.h"
|
||||
#include "EmptyTexture.h"
|
||||
|
||||
namespace cc {
|
||||
@@ -59,15 +58,6 @@ EmptyDevice::~EmptyDevice() {
|
||||
}
|
||||
|
||||
bool EmptyDevice::doInit(const DeviceInfo & /*info*/) {
|
||||
ContextInfo ctxInfo;
|
||||
ctxInfo.windowHandle = _windowHandle;
|
||||
|
||||
_context = CC_NEW(EmptyContext);
|
||||
if (!_context->initialize(ctxInfo)) {
|
||||
destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
QueueInfo queueInfo;
|
||||
queueInfo.type = QueueType::GRAPHICS;
|
||||
_queue = createQueue(queueInfo);
|
||||
@@ -78,7 +68,6 @@ bool EmptyDevice::doInit(const DeviceInfo & /*info*/) {
|
||||
_cmdBuff = createCommandBuffer(cmdBuffInfo);
|
||||
|
||||
CC_LOG_INFO("Empty device initialized.");
|
||||
CC_LOG_INFO("SCREEN_SIZE: %d x %d", _width, _height);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -86,15 +75,9 @@ bool EmptyDevice::doInit(const DeviceInfo & /*info*/) {
|
||||
void EmptyDevice::doDestroy() {
|
||||
CC_SAFE_DESTROY(_cmdBuff);
|
||||
CC_SAFE_DESTROY(_queue);
|
||||
CC_SAFE_DESTROY(_context);
|
||||
}
|
||||
|
||||
void EmptyDevice::resize(uint width, uint height) {
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
|
||||
void EmptyDevice::acquire() {
|
||||
void EmptyDevice::acquire(Swapchain *const *swapchains, uint32_t count) {
|
||||
}
|
||||
|
||||
void EmptyDevice::present() {
|
||||
@@ -109,6 +92,10 @@ Queue *EmptyDevice::createQueue() {
|
||||
return CC_NEW(EmptyQueue());
|
||||
}
|
||||
|
||||
Swapchain *EmptyDevice::createSwapchain() {
|
||||
return CC_NEW(EmptySwapchain());
|
||||
}
|
||||
|
||||
Buffer *EmptyDevice::createBuffer() {
|
||||
return CC_NEW(EmptyBuffer());
|
||||
}
|
||||
@@ -117,10 +104,6 @@ Texture *EmptyDevice::createTexture() {
|
||||
return CC_NEW(EmptyTexture());
|
||||
}
|
||||
|
||||
Sampler *EmptyDevice::createSampler() {
|
||||
return CC_NEW(EmptySampler());
|
||||
}
|
||||
|
||||
Shader *EmptyDevice::createShader() {
|
||||
return CC_NEW(EmptyShader());
|
||||
}
|
||||
@@ -153,12 +136,16 @@ PipelineState *EmptyDevice::createPipelineState() {
|
||||
return CC_NEW(EmptyPipelineState());
|
||||
}
|
||||
|
||||
GlobalBarrier *EmptyDevice::createGlobalBarrier() {
|
||||
return CC_NEW(GlobalBarrier());
|
||||
Sampler *EmptyDevice::createSampler(const SamplerInfo &info) {
|
||||
return CC_NEW(Sampler(info));
|
||||
}
|
||||
|
||||
TextureBarrier *EmptyDevice::createTextureBarrier() {
|
||||
return CC_NEW(TextureBarrier());
|
||||
GlobalBarrier *EmptyDevice::createGlobalBarrier(const GlobalBarrierInfo &info) {
|
||||
return CC_NEW(GlobalBarrier(info));
|
||||
}
|
||||
|
||||
TextureBarrier *EmptyDevice::createTextureBarrier(const TextureBarrierInfo &info) {
|
||||
return CC_NEW(TextureBarrier(info));
|
||||
}
|
||||
|
||||
void EmptyDevice::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "gfx-base/GFXDevice.h"
|
||||
#include "gfx-base/GFXSwapchain.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
@@ -50,18 +51,18 @@ public:
|
||||
using Device::createRenderPass;
|
||||
using Device::createSampler;
|
||||
using Device::createShader;
|
||||
using Device::createSwapchain;
|
||||
using Device::createTexture;
|
||||
using Device::createTextureBarrier;
|
||||
|
||||
void resize(uint width, uint height) override;
|
||||
void acquire() override;
|
||||
void acquire(Swapchain *const *swapchains, uint32_t count) override;
|
||||
void present() override;
|
||||
|
||||
CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool emptyhas) override;
|
||||
Queue * createQueue() override;
|
||||
Swapchain * createSwapchain() override;
|
||||
Buffer * createBuffer() override;
|
||||
Texture * createTexture() override;
|
||||
Sampler * createSampler() override;
|
||||
Shader * createShader() override;
|
||||
InputAssembler * createInputAssembler() override;
|
||||
RenderPass * createRenderPass() override;
|
||||
@@ -70,10 +71,13 @@ public:
|
||||
DescriptorSetLayout *createDescriptorSetLayout() override;
|
||||
PipelineLayout * createPipelineLayout() override;
|
||||
PipelineState * createPipelineState() override;
|
||||
GlobalBarrier * createGlobalBarrier() override;
|
||||
TextureBarrier * createTextureBarrier() override;
|
||||
void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override;
|
||||
void copyTextureToBuffers(Texture *src, uint8_t *const *buffers, const BufferTextureCopy *region, uint count) override;
|
||||
|
||||
Sampler * createSampler(const SamplerInfo &info) override;
|
||||
GlobalBarrier * createGlobalBarrier(const GlobalBarrierInfo &info) override;
|
||||
TextureBarrier *createTextureBarrier(const TextureBarrierInfo &info) override;
|
||||
|
||||
void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override;
|
||||
void copyTextureToBuffers(Texture *src, uint8_t *const *buffers, const BufferTextureCopy *region, uint count) override;
|
||||
|
||||
protected:
|
||||
static EmptyDevice *instance;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/****************************************************************************
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include "EmptySampler.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
void EmptySampler::doInit(const SamplerInfo &info) {
|
||||
}
|
||||
|
||||
void EmptySampler::doDestroy() {
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace cc
|
||||
+24
-17
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
@@ -23,33 +23,40 @@
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "EmptySwapchain.h"
|
||||
#include "EmptyTexture.h"
|
||||
#include "base/CoreStd.h"
|
||||
#include "base/threading/MessageQueue.h"
|
||||
|
||||
#include "DescriptorSetLayoutValidator.h"
|
||||
#include "DeviceValidator.h"
|
||||
#include "SamplerValidator.h"
|
||||
#include "ValidationUtils.h"
|
||||
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
SamplerValidator::SamplerValidator(Sampler *actor)
|
||||
: Agent<Sampler>(actor) {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
void EmptySwapchain::doInit(const SwapchainInfo &info) {
|
||||
_colorTexture = CC_NEW(EmptyTexture);
|
||||
_depthStencilTexture = CC_NEW(EmptyTexture);
|
||||
|
||||
SwapchainTextureInfo textureInfo;
|
||||
textureInfo.swapchain = this;
|
||||
textureInfo.format = Format::RGBA8;
|
||||
textureInfo.width = info.width;
|
||||
textureInfo.height = info.height;
|
||||
initTexture(textureInfo, _colorTexture);
|
||||
|
||||
textureInfo.format = Format::DEPTH_STENCIL;
|
||||
initTexture(textureInfo, _depthStencilTexture);
|
||||
}
|
||||
|
||||
SamplerValidator::~SamplerValidator() {
|
||||
DeviceResourceTracker<Sampler>::erase(this);
|
||||
CC_SAFE_DELETE(_actor);
|
||||
void EmptySwapchain::doDestroy() {
|
||||
CC_SAFE_DESTROY(_depthStencilTexture);
|
||||
CC_SAFE_DESTROY(_colorTexture);
|
||||
}
|
||||
|
||||
void SamplerValidator::doInit(const SamplerInfo &info) {
|
||||
_actor->initialize(info);
|
||||
void EmptySwapchain::doResize(uint width, uint height, SurfaceTransform transform) {
|
||||
}
|
||||
|
||||
void SamplerValidator::doDestroy() {
|
||||
_actor->destroy();
|
||||
void EmptySwapchain::doDestroySurface() {
|
||||
}
|
||||
|
||||
void EmptySwapchain::doCreateSurface(void *windowHandle) {
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user