diff --git a/cocos/rendering/custom/types.ts b/cocos/rendering/custom/types.ts index d09e3b8a9fe..7e88c420aff 100644 --- a/cocos/rendering/custom/types.ts +++ b/cocos/rendering/custom/types.ts @@ -432,6 +432,9 @@ export class CopyPair { targetMostDetailedMip: number; targetFirstSlice: number; targetPlaneSlice: number; + sourceOffset = 0; + targetOffset = 0; + bufferSize = 0; } export class UploadPair { @@ -649,6 +652,9 @@ export function saveCopyPair (ar: OutputArchive, v: CopyPair): void { ar.writeNumber(v.targetMostDetailedMip); ar.writeNumber(v.targetFirstSlice); ar.writeNumber(v.targetPlaneSlice); + ar.writeNumber(v.sourceOffset); + ar.writeNumber(v.targetOffset); + ar.writeNumber(v.bufferSize); } export function loadCopyPair (ar: InputArchive, v: CopyPair): void { @@ -662,6 +668,9 @@ export function loadCopyPair (ar: InputArchive, v: CopyPair): void { v.targetMostDetailedMip = ar.readNumber(); v.targetFirstSlice = ar.readNumber(); v.targetPlaneSlice = ar.readNumber(); + v.sourceOffset = ar.readNumber(); + v.targetOffset = ar.readNumber(); + v.bufferSize = ar.readNumber(); } export function saveMovePair (ar: OutputArchive, v: MovePair): void { diff --git a/native/cocos/renderer/pipeline/custom/NativePipelineTypes.cpp b/native/cocos/renderer/pipeline/custom/NativePipelineTypes.cpp index cbab58746e1..dca32301121 100644 --- a/native/cocos/renderer/pipeline/custom/NativePipelineTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/NativePipelineTypes.cpp @@ -50,13 +50,13 @@ RenderInstancingQueue::RenderInstancingQueue(RenderInstancingQueue const& rhs, c instanceBuffers(rhs.instanceBuffers, alloc) {} RenderBatchingQueue::RenderBatchingQueue(const allocator_type& alloc) noexcept -{} +: batches(alloc) {} RenderBatchingQueue::RenderBatchingQueue(RenderBatchingQueue&& rhs, const allocator_type& alloc) -{} +: batches(std::move(rhs.batches), alloc) {} RenderBatchingQueue::RenderBatchingQueue(RenderBatchingQueue const& rhs, const allocator_type& alloc) -{} +: batches(rhs.batches, alloc) {} RenderDrawQueue::RenderDrawQueue(const allocator_type& alloc) noexcept : instances(alloc) {} diff --git a/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h b/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h index 48648561c6a..87d1282869d 100644 --- a/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h +++ b/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h @@ -798,6 +798,9 @@ struct RenderInstancingQueue { struct RenderBatchingQueue { using allocator_type = boost::container::pmr::polymorphic_allocator; + allocator_type get_allocator() const noexcept { // NOLINT + return {batches.get_allocator().resource()}; + } RenderBatchingQueue(const allocator_type& alloc) noexcept; // NOLINT RenderBatchingQueue(RenderBatchingQueue&& rhs, const allocator_type& alloc); @@ -810,6 +813,8 @@ struct RenderBatchingQueue { static void recordCommandBuffer(gfx::Device *device, const scene::Camera *camera, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer, SceneFlags sceneFlags); + + ccstd::pmr::vector batches; }; struct DrawInstance { diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp b/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp index 9bb23563b0b..b60875af911 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp +++ b/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp @@ -165,6 +165,15 @@ bool nativevalue_to_se(const cc::render::CopyPair &from, se::Value &to, se::Obje nativevalue_to_se(from.targetPlaneSlice, tmp, ctx); obj->setProperty("targetPlaneSlice", tmp); + nativevalue_to_se(from.sourceOffset, tmp, ctx); + obj->setProperty("sourceOffset", tmp); + + nativevalue_to_se(from.targetOffset, tmp, ctx); + obj->setProperty("targetOffset", tmp); + + nativevalue_to_se(from.bufferSize, tmp, ctx); + obj->setProperty("bufferSize", tmp); + to.setObject(obj); return true; } @@ -400,6 +409,18 @@ bool sevalue_to_native(const se::Value &from, cc::render:: if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->targetPlaneSlice), ctx); } + obj->getProperty("sourceOffset", &field, true); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->sourceOffset), ctx); + } + obj->getProperty("targetOffset", &field, true); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->targetOffset), ctx); + } + obj->getProperty("bufferSize", &field, true); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->bufferSize), ctx); + } return ok; } diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h b/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h index 49fa456c4cd..070eef8a9f8 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h @@ -130,6 +130,9 @@ inline void save(OutputArchive& ar, const CopyPair& v) { save(ar, v.targetMostDetailedMip); save(ar, v.targetFirstSlice); save(ar, v.targetPlaneSlice); + save(ar, v.sourceOffset); + save(ar, v.targetOffset); + save(ar, v.bufferSize); } inline void load(InputArchive& ar, CopyPair& v) { @@ -143,6 +146,9 @@ inline void load(InputArchive& ar, CopyPair& v) { load(ar, v.targetMostDetailedMip); load(ar, v.targetFirstSlice); load(ar, v.targetPlaneSlice); + load(ar, v.sourceOffset); + load(ar, v.targetOffset); + load(ar, v.bufferSize); } inline void save(OutputArchive& ar, const MovePair& v) { diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp index 1f556cf1058..ad6ef4ed792 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp @@ -75,6 +75,13 @@ CopyPair::CopyPair(ccstd::pmr::string sourceIn, ccstd::pmr::string targetIn, uin targetFirstSlice(targetFirstSliceIn), targetPlaneSlice(targetPlaneSliceIn) {} +CopyPair::CopyPair(ccstd::pmr::string sourceIn, ccstd::pmr::string targetIn, uint32_t sourceOffsetIn, uint32_t targetOffsetIn, uint32_t bufferSizeIn, const allocator_type& alloc) noexcept // NOLINT +: source(std::move(sourceIn), alloc), + target(std::move(targetIn), alloc), + sourceOffset(sourceOffsetIn), + targetOffset(targetOffsetIn), + bufferSize(bufferSizeIn) {} + CopyPair::CopyPair(CopyPair&& rhs, const allocator_type& alloc) : source(std::move(rhs.source), alloc), target(std::move(rhs.target), alloc), @@ -85,7 +92,10 @@ CopyPair::CopyPair(CopyPair&& rhs, const allocator_type& alloc) sourcePlaneSlice(rhs.sourcePlaneSlice), targetMostDetailedMip(rhs.targetMostDetailedMip), targetFirstSlice(rhs.targetFirstSlice), - targetPlaneSlice(rhs.targetPlaneSlice) {} + targetPlaneSlice(rhs.targetPlaneSlice), + sourceOffset(rhs.sourceOffset), + targetOffset(rhs.targetOffset), + bufferSize(rhs.bufferSize) {} CopyPair::CopyPair(CopyPair const& rhs, const allocator_type& alloc) : source(rhs.source, alloc), @@ -97,7 +107,10 @@ CopyPair::CopyPair(CopyPair const& rhs, const allocator_type& alloc) sourcePlaneSlice(rhs.sourcePlaneSlice), targetMostDetailedMip(rhs.targetMostDetailedMip), targetFirstSlice(rhs.targetFirstSlice), - targetPlaneSlice(rhs.targetPlaneSlice) {} + targetPlaneSlice(rhs.targetPlaneSlice), + sourceOffset(rhs.sourceOffset), + targetOffset(rhs.targetOffset), + bufferSize(rhs.bufferSize) {} UploadPair::UploadPair(const allocator_type& alloc) noexcept : target(alloc) {} diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h index 448cd05039c..c17fe2c50c7 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h @@ -346,6 +346,7 @@ struct CopyPair { CopyPair(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT CopyPair(ccstd::pmr::string sourceIn, ccstd::pmr::string targetIn, uint32_t mipLevelsIn, uint32_t numSlicesIn, uint32_t sourceMostDetailedMipIn, uint32_t sourceFirstSliceIn, uint32_t sourcePlaneSliceIn, uint32_t targetMostDetailedMipIn, uint32_t targetFirstSliceIn, uint32_t targetPlaneSliceIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; + CopyPair(ccstd::pmr::string sourceIn, ccstd::pmr::string targetIn, uint32_t sourceOffsetIn, uint32_t targetOffsetIn, uint32_t bufferSizeIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; CopyPair(CopyPair&& rhs, const allocator_type& alloc); CopyPair(CopyPair const& rhs, const allocator_type& alloc);