From 03d9f9ea73a03e71967d56286946647b57f327b8 Mon Sep 17 00:00:00 2001 From: Yun Hsiao Wu Date: Mon, 24 Aug 2020 11:55:12 +0800 Subject: [PATCH] fix build --- CMakeLists.txt | 8 +- cocos/renderer/core/gfx/GFXCommandBuffer.h | 13 +++- cocos/renderer/core/gfx/GFXDevice.h | 6 +- .../renderer/gfx-gles2/GLES2CommandBuffer.cc | 19 ++--- cocos/renderer/gfx-gles2/GLES2CommandBuffer.h | 6 +- cocos/renderer/gfx-gles2/GLES2Commands.cc | 12 +-- cocos/renderer/gfx-gles2/GLES2Commands.h | 12 +-- cocos/renderer/gfx-gles2/GLES2Device.cc | 4 +- cocos/renderer/gfx-gles2/GLES2Device.h | 2 +- .../renderer/gfx-gles3/GLES3CommandBuffer.cc | 20 +++-- cocos/renderer/gfx-gles3/GLES3CommandBuffer.h | 6 +- cocos/renderer/gfx-gles3/GLES3Commands.cc | 12 +-- cocos/renderer/gfx-gles3/GLES3Commands.h | 12 +-- cocos/renderer/gfx-gles3/GLES3Device.cc | 4 +- cocos/renderer/gfx-gles3/GLES3Device.h | 2 +- cocos/renderer/gfx-metal/MTLCommandBuffer.h | 6 +- cocos/renderer/gfx-metal/MTLCommandBuffer.mm | 6 +- cocos/renderer/gfx-metal/MTLDevice.h | 2 +- cocos/renderer/gfx-metal/MTLDevice.mm | 4 +- cocos/renderer/gfx-metal/MTLTexture.h | 2 +- cocos/renderer/gfx-metal/MTLTexture.mm | 6 +- cocos/renderer/gfx-vulkan/VKCommandBuffer.cc | 6 +- cocos/renderer/gfx-vulkan/VKCommandBuffer.h | 6 +- cocos/renderer/gfx-vulkan/VKCommands.cc | 14 ++-- cocos/renderer/gfx-vulkan/VKCommands.h | 2 +- cocos/renderer/gfx-vulkan/VKDevice.cc | 4 +- cocos/renderer/gfx-vulkan/VKDevice.h | 2 +- .../js-bindings/auto/jsb_gfx_auto.cpp | 73 ++++++++++++++----- 28 files changed, 159 insertions(+), 112 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 890b5b4c99b..1859eb9c9b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,8 +671,6 @@ endif() if(CC_USE_METAL) cocos_source_files( cocos/renderer/gfx-metal/GFXMTL.h - cocos/renderer/gfx-metal/MTLBindingLayout.cpp - cocos/renderer/gfx-metal/MTLBindingLayout.h cocos/renderer/gfx-metal/MTLBuffer.h cocos/renderer/gfx-metal/MTLBuffer.mm cocos/renderer/gfx-metal/MTLCommandBuffer.h @@ -688,8 +686,14 @@ if(CC_USE_METAL) cocos/renderer/gfx-metal/MTLGPUObjects.h cocos/renderer/gfx-metal/MTLInputAssembler.h cocos/renderer/gfx-metal/MTLInputAssembler.mm + cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h + cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm + cocos/renderer/gfx-metal/MTLPipelineLayout.h + cocos/renderer/gfx-metal/MTLPipelineLayout.mm cocos/renderer/gfx-metal/MTLPipelineState.h cocos/renderer/gfx-metal/MTLPipelineState.mm + cocos/renderer/gfx-metal/MTLDescriptorSet.h + cocos/renderer/gfx-metal/MTLDescriptorSet.mm cocos/renderer/gfx-metal/MTLQueue.h cocos/renderer/gfx-metal/MTLQueue.mm cocos/renderer/gfx-metal/MTLRenderPass.h diff --git a/cocos/renderer/core/gfx/GFXCommandBuffer.h b/cocos/renderer/core/gfx/GFXCommandBuffer.h index acbcf6e75e1..bedd67f96b7 100755 --- a/cocos/renderer/core/gfx/GFXCommandBuffer.h +++ b/cocos/renderer/core/gfx/GFXCommandBuffer.h @@ -16,7 +16,7 @@ class CC_DLL CommandBuffer : public GFXObject { virtual void destroy() = 0; virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) = 0; virtual void end() = 0; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) = 0; + virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) = 0; virtual void endRenderPass() = 0; virtual void bindPipelineState(PipelineState *pso) = 0; virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) = 0; @@ -31,16 +31,23 @@ class CC_DLL CommandBuffer : public GFXObject { virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) = 0; virtual void draw(InputAssembler *ia) = 0; virtual void updateBuffer(Buffer *buff, void *data, uint size, uint offset = 0) = 0; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) = 0; - virtual void execute(const CommandBufferList &cmdBuffs, uint32_t count) = 0; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) = 0; + virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) = 0; CC_INLINE void begin() { begin(nullptr, 0, nullptr); } CC_INLINE void begin(RenderPass *renderPass) { begin(renderPass, 0, nullptr); } CC_INLINE void begin(RenderPass *renderPass, uint subpass) { begin(renderPass, subpass, nullptr); } + CC_INLINE void execute(const CommandBufferList &cmdBuffs, uint32_t count) { execute(cmdBuffs.data(), count); } CC_INLINE void bindDescriptorSet(uint set, DescriptorSet *descriptorSet) { bindDescriptorSet(set, descriptorSet, 0, nullptr); } CC_INLINE void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets) { bindDescriptorSet(set, descriptorSet, dynamicOffsets.size(), dynamicOffsets.data()); } + CC_INLINE void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) { + beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil); + } + CC_INLINE void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { + copyBuffersToTexture(buffers.data(), texture, regions.data(), regions.size()); + } CC_INLINE Device *getDevice() const { return _device; } CC_INLINE Queue *getQueue() const { return _queue; } diff --git a/cocos/renderer/core/gfx/GFXDevice.h b/cocos/renderer/core/gfx/GFXDevice.h index 68917df6aea..ecac8665033 100755 --- a/cocos/renderer/core/gfx/GFXDevice.h +++ b/cocos/renderer/core/gfx/GFXDevice.h @@ -35,7 +35,11 @@ class CC_DLL Device : public Object { virtual DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) = 0; virtual PipelineLayout *createPipelineLayout(const PipelineLayoutInfo &info) = 0; virtual PipelineState *createPipelineState(const PipelineStateInfo &info) = 0; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) = 0; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) = 0; + + CC_INLINE void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) { + copyBuffersToTexture(buffers.data(), dst, regions.data(), regions.size()); + } CC_INLINE API getGfxAPI() const { return _API; } CC_INLINE const String &getDeviceName() const { return _deviceName; } diff --git a/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc b/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc index 8678d6bfa85..8201d5f2071 100644 --- a/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc +++ b/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cc @@ -66,15 +66,15 @@ void GLES2CommandBuffer::end() { _isInRenderPass = false; } -void GLES2CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) { +void GLES2CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) { _isInRenderPass = true; GLES2CmdBeginRenderPass *cmd = _gles2Allocator->beginRenderPassCmdPool.alloc(); cmd->gpuRenderPass = ((GLES2RenderPass *)renderPass)->gpuRenderPass(); cmd->gpuFBO = ((GLES2Framebuffer *)fbo)->gpuFBO(); cmd->renderArea = renderArea; - cmd->numClearColors = (uint32_t)colors.size(); - for (uint i = 0; i < colors.size(); ++i) { + cmd->numClearColors = cmd->gpuRenderPass->colorAttachments.size(); + for (uint i = 0; i < cmd->numClearColors; ++i) { cmd->clearColors[i] = colors[i]; } cmd->clearDepth = depth; @@ -255,19 +255,16 @@ void GLES2CommandBuffer::updateBuffer(Buffer *buff, void *data, uint size, uint } } -void GLES2CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { +void GLES2CommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || (_type == CommandBufferType::SECONDARY)) { GLES2GPUTexture *gpuTexture = ((GLES2Texture *)texture)->gpuTexture(); if (gpuTexture) { GLES2CmdCopyBufferToTexture *cmd = _gles2Allocator->copyBufferToTextureCmdPool.alloc(); cmd->gpuTexture = gpuTexture; - cmd->buffers.resize(buffers.size()); - cmd->regions.resize(regions.size()); - for (uint i = 0; i < static_cast(regions.size()); ++i) { - cmd->buffers[i] = buffers[i]; - cmd->regions[i] = regions[i]; - } + cmd->buffers = buffers; + cmd->regions = regions; + cmd->count = count; _cmdPackage->copyBufferToTextureCmds.push(cmd); _cmdPackage->cmds.push(GFXCmdType::COPY_BUFFER_TO_TEXTURE); @@ -277,7 +274,7 @@ void GLES2CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Tex } } -void GLES2CommandBuffer::execute(const CommandBufferList &cmdBuffs, uint32_t count) { +void GLES2CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t count) { for (uint i = 0; i < count; ++i) { GLES2CommandBuffer *cmdBuff = (GLES2CommandBuffer *)cmdBuffs[i]; diff --git a/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h b/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h index de4e2f2e16c..4540435d811 100644 --- a/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h +++ b/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h @@ -21,7 +21,7 @@ class CC_GLES2_API GLES2CommandBuffer : public CommandBuffer { virtual void begin(RenderPass *renderPass = nullptr, uint subpass = 0, Framebuffer *frameBuffer = nullptr) override; virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) override; + virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) override; virtual void endRenderPass() override; virtual void bindPipelineState(PipelineState *pso) override; virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; @@ -36,8 +36,8 @@ class CC_GLES2_API GLES2CommandBuffer : public CommandBuffer { virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) override; virtual void draw(InputAssembler *ia) override; virtual void updateBuffer(Buffer *buff, void *data, uint size, uint offset) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) override; - virtual void execute(const CommandBufferList &cmdBuffs, uint32_t count) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; private: void BindStates(); diff --git a/cocos/renderer/gfx-gles2/GLES2Commands.cc b/cocos/renderer/gfx-gles2/GLES2Commands.cc index 6e7dfd379e4..5b6a16d9a4f 100644 --- a/cocos/renderer/gfx-gles2/GLES2Commands.cc +++ b/cocos/renderer/gfx-gles2/GLES2Commands.cc @@ -2142,7 +2142,7 @@ void GLES2CmdFuncExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmdPackage) { } case GFXCmdType::COPY_BUFFER_TO_TEXTURE: { GLES2CmdCopyBufferToTexture *cmd = cmdPackage->copyBufferToTextureCmds[cmdIdx]; - GLES2CmdFuncCopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions); + GLES2CmdFuncCopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions, cmd->count); break; } default: @@ -2152,7 +2152,7 @@ void GLES2CmdFuncExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmdPackage) { } } -void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const BufferDataList &buffers, GLES2GPUTexture *gpuTexture, const BufferTextureCopyList ®ions) { +void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const *buffers, GLES2GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count) { GLuint &glTexture = device->stateCache->glTextures[device->stateCache->texUint]; if (glTexture != gpuTexture->glTexture) { glBindTexture(gpuTexture->glTarget, gpuTexture->glTexture); @@ -2166,7 +2166,7 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const BufferDataList case GL_TEXTURE_2D: { uint w; uint h; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; w = region.texExtent.width; h = region.texExtent.height; @@ -2197,7 +2197,7 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const BufferDataList case GL_TEXTURE_2D_ARRAY: { uint w; uint h; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; uint d = region.texSubres.layerCount; uint layerCount = d + region.texSubres.baseArrayLayer; @@ -2235,7 +2235,7 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const BufferDataList uint w; uint h; uint d; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; w = region.texExtent.width; h = region.texExtent.height; @@ -2270,7 +2270,7 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const BufferDataList uint w; uint h; uint f; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; uint faceCount = region.texSubres.baseArrayLayer + region.texSubres.layerCount; for (f = region.texSubres.baseArrayLayer; f < faceCount; ++f) { diff --git a/cocos/renderer/gfx-gles2/GLES2Commands.h b/cocos/renderer/gfx-gles2/GLES2Commands.h index e3deae4d8e8..91138084b8e 100644 --- a/cocos/renderer/gfx-gles2/GLES2Commands.h +++ b/cocos/renderer/gfx-gles2/GLES2Commands.h @@ -130,15 +130,17 @@ class GLES2CmdUpdateBuffer : public GFXCmd { class GLES2CmdCopyBufferToTexture : public GFXCmd { public: GLES2GPUTexture *gpuTexture = nullptr; - BufferDataList buffers; - BufferTextureCopyList regions; + const uint8_t *const *buffers = nullptr; + const BufferTextureCopy *regions = nullptr; + uint count = 0u; GLES2CmdCopyBufferToTexture() : GFXCmd(GFXCmdType::COPY_BUFFER_TO_TEXTURE) {} virtual void clear() override { gpuTexture = nullptr; - buffers.clear(); - regions.clear(); + buffers = nullptr; + regions = nullptr; + count = 0u; } }; @@ -168,7 +170,7 @@ CC_GLES2_API void GLES2CmdFuncDestroyInputAssembler(GLES2Device *device, GLES2GP CC_GLES2_API void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO); CC_GLES2_API void GLES2CmdFuncDestroyFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO); CC_GLES2_API void GLES2CmdFuncExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmd_package); -CC_GLES2_API void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const BufferDataList &buffers, GLES2GPUTexture *gpuTexture, const BufferTextureCopyList ®ions); +CC_GLES2_API void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const *buffers, GLES2GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count); } // namespace gfx } // namespace cc diff --git a/cocos/renderer/gfx-gles2/GLES2Device.cc b/cocos/renderer/gfx-gles2/GLES2Device.cc index 7a5dfb2dac3..16709c45054 100644 --- a/cocos/renderer/gfx-gles2/GLES2Device.cc +++ b/cocos/renderer/gfx-gles2/GLES2Device.cc @@ -320,8 +320,8 @@ PipelineState *GLES2Device::createPipelineState(const PipelineStateInfo &info) { return nullptr; } -void GLES2Device::copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) { - GLES2CmdFuncCopyBuffersToTexture(this, buffers, ((GLES2Texture *)dst)->gpuTexture(), regions); +void GLES2Device::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { + GLES2CmdFuncCopyBuffersToTexture(this, buffers, ((GLES2Texture *)dst)->gpuTexture(), regions, count); } } // namespace gfx diff --git a/cocos/renderer/gfx-gles2/GLES2Device.h b/cocos/renderer/gfx-gles2/GLES2Device.h index f906c0393cd..f89648aa5a9 100644 --- a/cocos/renderer/gfx-gles2/GLES2Device.h +++ b/cocos/renderer/gfx-gles2/GLES2Device.h @@ -36,7 +36,7 @@ class CC_GLES2_API GLES2Device : public Device { virtual DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) override; virtual PipelineLayout *createPipelineLayout(const PipelineLayoutInfo &info) override; virtual PipelineState *createPipelineState(const PipelineStateInfo &info) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; CC_INLINE bool useVAO() const { return _useVAO; } CC_INLINE bool useDrawInstanced() const { return _useDrawInstanced; } diff --git a/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc b/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc index ed730b88817..fdcc22af6ef 100644 --- a/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc +++ b/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cc @@ -66,15 +66,15 @@ void GLES3CommandBuffer::end() { _isInRenderPass = false; } -void GLES3CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) { +void GLES3CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) { _isInRenderPass = true; GLES3CmdBeginRenderPass *cmd = _gles3Allocator->beginRenderPassCmdPool.alloc(); cmd->gpuRenderPass = ((GLES3RenderPass *)renderPass)->gpuRenderPass(); cmd->gpuFBO = ((GLES3Framebuffer *)fbo)->gpuFBO(); cmd->renderArea = renderArea; - cmd->numClearColors = (uint32_t)colors.size(); - for (uint i = 0; i < colors.size(); ++i) { + cmd->numClearColors = cmd->gpuRenderPass->colorAttachments.size(); + for (uint i = 0; i < cmd->numClearColors; ++i) { cmd->clearColors[i] = colors[i]; } cmd->clearDepth = depth; @@ -260,7 +260,7 @@ void GLES3CommandBuffer::updateBuffer(Buffer *buff, void *data, uint size, uint } } -void GLES3CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { +void GLES3CommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || (_type == CommandBufferType::SECONDARY)) { @@ -268,12 +268,10 @@ void GLES3CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Tex if (gpuTexture) { GLES3CmdCopyBufferToTexture *cmd = _gles3Allocator->copyBufferToTextureCmdPool.alloc(); cmd->gpuTexture = gpuTexture; - cmd->buffers.resize(buffers.size()); - cmd->regions.resize(regions.size()); - for (uint i = 0; i < static_cast(regions.size()); ++i) { - cmd->buffers[i] = buffers[i]; - cmd->regions[i] = regions[i]; - } + cmd->gpuTexture = gpuTexture; + cmd->buffers = buffers; + cmd->regions = regions; + cmd->count = count; _cmdPackage->copyBufferToTextureCmds.push(cmd); _cmdPackage->cmds.push(GFXCmdType::COPY_BUFFER_TO_TEXTURE); @@ -283,7 +281,7 @@ void GLES3CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Tex } } -void GLES3CommandBuffer::execute(const CommandBufferList &cmdBuffs, uint32_t count) { +void GLES3CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t count) { for (uint i = 0; i < count; ++i) { GLES3CommandBuffer *cmdBuff = (GLES3CommandBuffer *)cmdBuffs[i]; diff --git a/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h b/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h index 1c951d0cf2e..8386c76020a 100644 --- a/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h +++ b/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h @@ -21,7 +21,7 @@ class CC_GLES3_API GLES3CommandBuffer : public CommandBuffer { virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) override; + virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) override; virtual void endRenderPass() override; virtual void bindPipelineState(PipelineState *pso) override; virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; @@ -36,8 +36,8 @@ class CC_GLES3_API GLES3CommandBuffer : public CommandBuffer { virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) override; virtual void draw(InputAssembler *ia) override; virtual void updateBuffer(Buffer *buff, void *data, uint size, uint offset) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) override; - virtual void execute(const CommandBufferList &cmdBuffs, uint32_t count) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; private: void BindStates(); diff --git a/cocos/renderer/gfx-gles3/GLES3Commands.cc b/cocos/renderer/gfx-gles3/GLES3Commands.cc index b9a49a22cf8..ab73029c553 100644 --- a/cocos/renderer/gfx-gles3/GLES3Commands.cc +++ b/cocos/renderer/gfx-gles3/GLES3Commands.cc @@ -2101,7 +2101,7 @@ void GLES3CmdFuncExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmdPackage) { } case GFXCmdType::COPY_BUFFER_TO_TEXTURE: { GLES3CmdCopyBufferToTexture *cmd = cmdPackage->copyBufferToTextureCmds[cmdIdx]; - GLES3CmdFuncCopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions); + GLES3CmdFuncCopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions, cmd->count); break; } default: @@ -2111,7 +2111,7 @@ void GLES3CmdFuncExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmdPackage) { } } -void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const BufferDataList &buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopyList ®ions) { +void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const *buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count) { GLuint &glTexture = device->stateCache->glTextures[device->stateCache->texUint]; if (glTexture != gpuTexture->glTexture) { glBindTexture(gpuTexture->glTarget, gpuTexture->glTexture); @@ -2125,7 +2125,7 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const BufferDataList case GL_TEXTURE_2D: { uint w; uint h; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; w = region.texExtent.width; h = region.texExtent.height; @@ -2156,7 +2156,7 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const BufferDataList case GL_TEXTURE_2D_ARRAY: { uint w; uint h; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; uint d = region.texSubres.layerCount; uint layerCount = d + region.texSubres.baseArrayLayer; @@ -2195,7 +2195,7 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const BufferDataList uint w; uint h; uint d; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; w = region.texExtent.width; h = region.texExtent.height; @@ -2230,7 +2230,7 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const BufferDataList uint w; uint h; uint f; - for (size_t i = 0; i < regions.size(); ++i) { + for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; uint faceCount = region.texSubres.baseArrayLayer + region.texSubres.layerCount; for (f = region.texSubres.baseArrayLayer; f < faceCount; ++f) { diff --git a/cocos/renderer/gfx-gles3/GLES3Commands.h b/cocos/renderer/gfx-gles3/GLES3Commands.h index 389c29c75b8..8736e129f2b 100644 --- a/cocos/renderer/gfx-gles3/GLES3Commands.h +++ b/cocos/renderer/gfx-gles3/GLES3Commands.h @@ -130,15 +130,17 @@ class GLES3CmdUpdateBuffer : public GFXCmd { class GLES3CmdCopyBufferToTexture : public GFXCmd { public: GLES3GPUTexture *gpuTexture = nullptr; - BufferDataList buffers; - BufferTextureCopyList regions; + const uint8_t *const *buffers = nullptr; + const BufferTextureCopy *regions = nullptr; + uint count = 0u; GLES3CmdCopyBufferToTexture() : GFXCmd(GFXCmdType::COPY_BUFFER_TO_TEXTURE) {} virtual void clear() override { gpuTexture = nullptr; - buffers.clear(); - regions.clear(); + buffers = nullptr; + regions = nullptr; + count = 0u; } }; @@ -168,7 +170,7 @@ CC_GLES3_API void GLES3CmdFuncDestroyInputAssembler(GLES3Device *device, GLES3GP CC_GLES3_API void GLES3CmdFuncCreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO); CC_GLES3_API void GLES3CmdFuncDestroyFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO); CC_GLES3_API void GLES3CmdFuncExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmd_package); -CC_GLES3_API void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const BufferDataList &buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopyList ®ions); +CC_GLES3_API void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const *buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count); } // namespace gfx } // namespace cc diff --git a/cocos/renderer/gfx-gles3/GLES3Device.cc b/cocos/renderer/gfx-gles3/GLES3Device.cc index c38644a8abd..d3f4b3faa41 100644 --- a/cocos/renderer/gfx-gles3/GLES3Device.cc +++ b/cocos/renderer/gfx-gles3/GLES3Device.cc @@ -316,8 +316,8 @@ PipelineState *GLES3Device::createPipelineState(const PipelineStateInfo &info) { return nullptr; } -void GLES3Device::copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) { - GLES3CmdFuncCopyBuffersToTexture(this, buffers, ((GLES3Texture *)dst)->gpuTexture(), regions); +void GLES3Device::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { + GLES3CmdFuncCopyBuffersToTexture(this, buffers, ((GLES3Texture *)dst)->gpuTexture(), regions, count); } } // namespace gfx diff --git a/cocos/renderer/gfx-gles3/GLES3Device.h b/cocos/renderer/gfx-gles3/GLES3Device.h index 51e5a7fb1c9..fd23a2d3dc9 100644 --- a/cocos/renderer/gfx-gles3/GLES3Device.h +++ b/cocos/renderer/gfx-gles3/GLES3Device.h @@ -36,7 +36,7 @@ class CC_GLES3_API GLES3Device : public Device { virtual DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) override; virtual PipelineLayout *createPipelineLayout(const PipelineLayoutInfo &info) override; virtual PipelineState *createPipelineState(const PipelineStateInfo &info) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; CC_INLINE GLES3CommandAllocator *cmdAllocator() const { return _cmdAllocator; } CC_INLINE const BindingMappingInfo &bindingMappingInfo() const { return _bindingMappingInfo; } diff --git a/cocos/renderer/gfx-metal/MTLCommandBuffer.h b/cocos/renderer/gfx-metal/MTLCommandBuffer.h index 5d3322bb1be..ea981f34fbb 100644 --- a/cocos/renderer/gfx-metal/MTLCommandBuffer.h +++ b/cocos/renderer/gfx-metal/MTLCommandBuffer.h @@ -24,7 +24,7 @@ class CCMTLCommandBuffer : public CommandBuffer { virtual void destroy() override; virtual void begin(RenderPass *renderPass = nullptr, uint subpass = 0, Framebuffer *frameBuffer = nullptr) override; virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) override; + virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) override; virtual void endRenderPass() override; virtual void bindPipelineState(PipelineState *pso) override; virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; @@ -39,8 +39,8 @@ class CCMTLCommandBuffer : public CommandBuffer { virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) override; virtual void draw(InputAssembler *ia) override; virtual void updateBuffer(Buffer *buff, void *data, uint size, uint offset = 0) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) override; - virtual void execute(const CommandBufferList &cmdBuffs, uint32_t count) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; private: void bindStates(); diff --git a/cocos/renderer/gfx-metal/MTLCommandBuffer.mm b/cocos/renderer/gfx-metal/MTLCommandBuffer.mm index a2b39f33575..aaaa7322da6 100644 --- a/cocos/renderer/gfx-metal/MTLCommandBuffer.mm +++ b/cocos/renderer/gfx-metal/MTLCommandBuffer.mm @@ -324,11 +324,11 @@ } } -void CCMTLCommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { +void CCMTLCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { if ((_type == CommandBufferType::PRIMARY) || (_type == CommandBufferType::SECONDARY)) { if (texture) { - static_cast(texture)->update(buffers.data(), regions); + static_cast(texture)->update(buffers, regions, count); } else { CC_LOG_ERROR("CCMTLCommandBuffer::copyBufferToTexture: texture is nullptr"); } @@ -337,7 +337,7 @@ } } -void CCMTLCommandBuffer::execute(const CommandBufferList &commandBuffs, uint32_t count) { +void CCMTLCommandBuffer::execute(const CommandBuffer *const *commandBuffs, uint32_t count) { for (uint i = 0; i < count; ++i) { auto commandBuffer = static_cast(commandBuffs[i]); _numDrawCalls += commandBuffer->_numDrawCalls; diff --git a/cocos/renderer/gfx-metal/MTLDevice.h b/cocos/renderer/gfx-metal/MTLDevice.h index d0c3e636461..053e98b34f6 100644 --- a/cocos/renderer/gfx-metal/MTLDevice.h +++ b/cocos/renderer/gfx-metal/MTLDevice.h @@ -32,7 +32,7 @@ class CCMTLDevice : public Device { virtual DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) override; virtual PipelineLayout *createPipelineLayout(const PipelineLayoutInfo &info) override; virtual PipelineState *createPipelineState(const PipelineStateInfo &info) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; virtual void blitBuffer(void *srcBuffer, uint offset, uint size, void *dstBuffer); CC_INLINE CCMTLStateCache *getStateCache() const { return _stateCache; } diff --git a/cocos/renderer/gfx-metal/MTLDevice.mm b/cocos/renderer/gfx-metal/MTLDevice.mm index 828d4b006f1..c1a165f4bf1 100644 --- a/cocos/renderer/gfx-metal/MTLDevice.mm +++ b/cocos/renderer/gfx-metal/MTLDevice.mm @@ -286,8 +286,8 @@ return nullptr; } -void CCMTLDevice::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { - static_cast(texture)->update(buffers.data(), regions); +void CCMTLDevice::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { + static_cast(texture)->update(buffers, regions, count); } void CCMTLDevice::blitBuffer(void *srcData, uint offset, uint size, void *dstBuffer) { diff --git a/cocos/renderer/gfx-metal/MTLTexture.h b/cocos/renderer/gfx-metal/MTLTexture.h index a3229e5cb74..667c0bfbbb2 100644 --- a/cocos/renderer/gfx-metal/MTLTexture.h +++ b/cocos/renderer/gfx-metal/MTLTexture.h @@ -22,7 +22,7 @@ class CCMTLTexture : public Texture { CC_INLINE Format getConvertedFormat() const { return _convertedFormat; } private: - void update(const uint8_t *const *datas, const BufferTextureCopyList ®ions); + void update(const uint8_t *const *datas, const BufferTextureCopy *regions, uint count); bool createMTLTexture(); void generateMipmaps(); diff --git a/cocos/renderer/gfx-metal/MTLTexture.mm b/cocos/renderer/gfx-metal/MTLTexture.mm index f7c1feead73..952255b88c1 100644 --- a/cocos/renderer/gfx-metal/MTLTexture.mm +++ b/cocos/renderer/gfx-metal/MTLTexture.mm @@ -239,7 +239,7 @@ _status = Status::SUCCESS; } -void CCMTLTexture::update(const uint8_t *const *datas, const BufferTextureCopyList ®ions) { +void CCMTLTexture::update(const uint8_t *const *datas, const BufferTextureCopy *regions, uint count) { if (!_mtlTexture) return; @@ -249,7 +249,7 @@ auto mtlTextureType = mu::toMTLTextureType(_type); switch (mtlTextureType) { case MTLTextureType2D: - for (size_t i = 0; i < regions.size(); i++) { + for (size_t i = 0; i < count; i++) { const auto ®ion = regions[i]; w = region.texExtent.width; h = region.texExtent.height; @@ -269,7 +269,7 @@ break; case MTLTextureType2DArray: case MTLTextureTypeCube: - for (size_t i = 0; i < regions.size(); i++) { + for (size_t i = 0; i < count; i++) { const auto ®ion = regions[i]; auto layer = region.texSubres.baseArrayLayer; auto layerCount = layer + region.texSubres.layerCount; diff --git a/cocos/renderer/gfx-vulkan/VKCommandBuffer.cc b/cocos/renderer/gfx-vulkan/VKCommandBuffer.cc index 92e7678a9d0..92e266a9df8 100644 --- a/cocos/renderer/gfx-vulkan/VKCommandBuffer.cc +++ b/cocos/renderer/gfx-vulkan/VKCommandBuffer.cc @@ -85,7 +85,7 @@ void CCVKCommandBuffer::end() { } void CCVKCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, - const vector &colors, float depth, int stencil) { + const Color *colors, float depth, int stencil) { _curGPUFBO = ((CCVKFramebuffer *)fbo)->gpuFBO(); CCVKGPURenderPass *gpuRenderPass = ((CCVKRenderPass *)renderPass)->gpuRenderPass(); VkFramebuffer framebuffer = _curGPUFBO->vkFramebuffer; @@ -333,7 +333,7 @@ void CCVKCommandBuffer::draw(InputAssembler *ia) { } } -void CCVKCommandBuffer::execute(const CommandBufferList &cmdBuffs, uint count) { +void CCVKCommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint count) { if (!count) { return; } @@ -356,7 +356,7 @@ void CCVKCommandBuffer::updateBuffer(Buffer *buff, void *data, uint size, uint o CCVKCmdFuncUpdateBuffer((CCVKDevice *)_device, ((CCVKBuffer *)buff)->gpuBuffer(), data, offset, size); } -void CCVKCommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { +void CCVKCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { //const CCVKGPUBuffer* gpuBuffer = ((CCVKBuffer*)src)->gpuBuffer(); //const CCVKGPUTexture* gpuTexture = ((CCVKTexture*)dst)->gpuTexture(); //vkCmdCopyBufferToImage(_gpuCommandBuffer->vkCommandBuffer, gpuBuffer->vkBuffer, gpuTexture->vkImage, MapVkImageLayout(layout), diff --git a/cocos/renderer/gfx-vulkan/VKCommandBuffer.h b/cocos/renderer/gfx-vulkan/VKCommandBuffer.h index a3f9aa4052c..a61f48c3e6e 100644 --- a/cocos/renderer/gfx-vulkan/VKCommandBuffer.h +++ b/cocos/renderer/gfx-vulkan/VKCommandBuffer.h @@ -19,7 +19,7 @@ class CC_VULKAN_API CCVKCommandBuffer : public CommandBuffer { virtual void begin(RenderPass *renderPass = nullptr, uint subpass = 0, Framebuffer *frameBuffer = nullptr) override; virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const vector &colors, float depth, int stencil) override; + virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) override; virtual void endRenderPass() override; virtual void bindPipelineState(PipelineState *pso) override; virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; @@ -34,8 +34,8 @@ class CC_VULKAN_API CCVKCommandBuffer : public CommandBuffer { virtual void setStencilCompareMask(StencilFace face, int reference, uint mask) override; virtual void draw(InputAssembler *ia) override; virtual void updateBuffer(Buffer *buff, void *data, uint size, uint offset) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) override; - virtual void execute(const CommandBufferList &cmdBuffs, uint count) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + virtual void execute(const CommandBuffer *const *cmdBuffs, uint count) override; CCVKGPUCommandBuffer *gpuCommandBuffer() const { return _gpuCommandBuffer; } diff --git a/cocos/renderer/gfx-vulkan/VKCommands.cc b/cocos/renderer/gfx-vulkan/VKCommands.cc index 264c1e80545..990f4014fc6 100644 --- a/cocos/renderer/gfx-vulkan/VKCommands.cc +++ b/cocos/renderer/gfx-vulkan/VKCommands.cc @@ -459,7 +459,7 @@ void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gp break; } } - if (!attributeFound) { //handle absent attribute + if (!attributeFound) { // handle absent attribute attributeDescriptions[i].location = shaderAttrs[i].location; attributeDescriptions[i].format = MapVkFormat(shaderAttrs[i].format); attributeDescriptions[i].offset = 0; // reuse the first attribute as dummy data @@ -653,7 +653,7 @@ void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, void } } -void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const BufferDataList &buffers, CCVKGPUTexture *gpuTexture, const BufferTextureCopyList ®ions) { +void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *buffers, CCVKGPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count) { device->gpuTransportHub()->checkIn([&](VkCommandBuffer cmdBuff) { //bool isCompressed = GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed; @@ -672,9 +672,9 @@ void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const BufferDataList &b vkCmdPipelineBarrier(cmdBuff, gpuTexture->targetStage, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 1, barriers); - uint regionCount = regions.size(), totalSize = 0u; - vector regionSizes(regionCount); - for (size_t i = 0u; i < regionCount; ++i) { + uint totalSize = 0u; + vector regionSizes(count); + for (size_t i = 0u; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; uint w = region.buffStride > 0 ? region.buffStride : region.texExtent.width; uint h = region.buffTexHeight > 0 ? region.buffTexHeight : region.texExtent.height; @@ -686,9 +686,9 @@ void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const BufferDataList &b uint texelSize = GFX_FORMAT_INFOS[(uint)gpuTexture->format].size; device->gpuStagingBufferPool()->alloc(&stagingBuffer, texelSize); - vector stagingRegions(regionCount); + vector stagingRegions(count); VkDeviceSize offset = 0; - for (size_t i = 0u; i < regionCount; ++i) { + for (size_t i = 0u; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; VkBufferImageCopy &stagingRegion = stagingRegions[i]; stagingRegion.bufferOffset = stagingBuffer.startOffset + offset; diff --git a/cocos/renderer/gfx-vulkan/VKCommands.h b/cocos/renderer/gfx-vulkan/VKCommands.h index e9224e1a4b3..1a9c89adb1a 100644 --- a/cocos/renderer/gfx-vulkan/VKCommands.h +++ b/cocos/renderer/gfx-vulkan/VKCommands.h @@ -45,7 +45,7 @@ CC_VULKAN_API void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPip CC_VULKAN_API void CCVKCmdFuncCreateFence(CCVKDevice *device, CCVKGPUFence *gpuFence); CC_VULKAN_API void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, void *buffer, uint offset, uint size); -CC_VULKAN_API void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const BufferDataList &buffers, CCVKGPUTexture *gpuTexture, const BufferTextureCopyList ®ions); +CC_VULKAN_API void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *buffers, CCVKGPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count); CC_VULKAN_API void CCVKCmdFuncDestroyRenderPass(CCVKGPUDevice *device, CCVKGPURenderPass *gpuRenderPass); CC_VULKAN_API void CCVKCmdFuncDestroySampler(CCVKGPUDevice *device, CCVKGPUSampler *gpuSampler); diff --git a/cocos/renderer/gfx-vulkan/VKDevice.cc b/cocos/renderer/gfx-vulkan/VKDevice.cc index fcda24cc88d..1b3174ce3d3 100644 --- a/cocos/renderer/gfx-vulkan/VKDevice.cc +++ b/cocos/renderer/gfx-vulkan/VKDevice.cc @@ -721,8 +721,8 @@ PipelineState *CCVKDevice::createPipelineState(const PipelineStateInfo &info) { return nullptr; } -void CCVKDevice::copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) { - CCVKCmdFuncCopyBuffersToTexture(this, buffers, ((CCVKTexture *)dst)->gpuTexture(), regions); +void CCVKDevice::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { + CCVKCmdFuncCopyBuffersToTexture(this, buffers, ((CCVKTexture *)dst)->gpuTexture(), regions, count); } } // namespace gfx diff --git a/cocos/renderer/gfx-vulkan/VKDevice.h b/cocos/renderer/gfx-vulkan/VKDevice.h index 6058337ddb5..81fa46f96e6 100644 --- a/cocos/renderer/gfx-vulkan/VKDevice.h +++ b/cocos/renderer/gfx-vulkan/VKDevice.h @@ -48,7 +48,7 @@ class CC_VULKAN_API CCVKDevice : public Device { virtual DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) override; virtual PipelineLayout *createPipelineLayout(const PipelineLayoutInfo &info) override; virtual PipelineState *createPipelineState(const PipelineStateInfo &info) override; - virtual void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) override; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; CC_INLINE bool checkExtension(const String &extension) const { return std::find_if(_extensions.begin(), _extensions.end(), diff --git a/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp index bf4900464de..4c04f12e196 100644 --- a/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp @@ -16506,29 +16506,62 @@ SE_BIND_FUNC(js_gfx_CommandBuffer_setScissor) static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) { + CC_UNUSED bool ok = true; cc::gfx::CommandBuffer* cobj = (cc::gfx::CommandBuffer*)s.nativeThisObject(); - SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_beginRenderPass : Invalid Native Object"); + SE_PRECONDITION2( cobj, false, "js_gfx_CommandBuffer_beginRenderPass : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 6) { - cc::gfx::RenderPass* arg0 = nullptr; - cc::gfx::Framebuffer* arg1 = nullptr; - cc::gfx::Rect* arg2 = nullptr; - std::vector arg3; - float arg4 = 0; - int arg5 = 0; - ok &= seval_to_native_ptr(args[0], &arg0); - ok &= seval_to_native_ptr(args[1], &arg1); - ok &= seval_to_reference(args[2], &arg2); - ok &= seval_to_std_vector(args[3], &arg3); - ok &= seval_to_float(args[4], &arg4); - do { int32_t tmp = 0; ok &= seval_to_int32(args[5], &tmp); arg5 = (int)tmp; } while(false); - SE_PRECONDITION2(ok, false, "js_gfx_CommandBuffer_beginRenderPass : Error processing arguments"); - cobj->beginRenderPass(arg0, arg1, *arg2, arg3, arg4, arg5); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + do { + if (argc == 6) { + cc::gfx::RenderPass* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + cc::gfx::Framebuffer* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); + if (!ok) { ok = true; break; } + cc::gfx::Rect arg2; + ok &= seval_to_reference(args[2], &arg2); + if (!ok) { ok = true; break; } + std::vector arg3; + ok &= seval_to_std_vector(args[3], &arg3); + if (!ok) { ok = true; break; } + float arg4 = 0; + ok &= seval_to_float(args[4], &arg4); + if (!ok) { ok = true; break; } + int arg5 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[5], &tmp); arg5 = (int)tmp; } while(false); + if (!ok) { ok = true; break; } + cobj->beginRenderPass(arg0, arg1, arg2, arg3, arg4, arg5); + return true; + } + } while(false); + + do { + if (argc == 6) { + cc::gfx::RenderPass* arg0 = nullptr; + ok &= seval_to_native_ptr(args[0], &arg0); + if (!ok) { ok = true; break; } + cc::gfx::Framebuffer* arg1 = nullptr; + ok &= seval_to_native_ptr(args[1], &arg1); + if (!ok) { ok = true; break; } + cc::gfx::Rect arg2; + ok &= seval_to_reference(args[2], &arg2); + if (!ok) { ok = true; break; } + const cc::gfx::Color* arg3 = nullptr; + ok &= seval_to_native_ptr(args[3], &arg3); + if (!ok) { ok = true; break; } + float arg4 = 0; + ok &= seval_to_float(args[4], &arg4); + if (!ok) { ok = true; break; } + int arg5 = 0; + do { int32_t tmp = 0; ok &= seval_to_int32(args[5], &tmp); arg5 = (int)tmp; } while(false); + if (!ok) { ok = true; break; } + cobj->beginRenderPass(arg0, arg1, arg2, arg3, arg4, arg5); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } SE_BIND_FUNC(js_gfx_CommandBuffer_beginRenderPass)