Skip to content

Commit

Permalink
Merge pull request #15774 from star-e/develop-pipeline
Browse files Browse the repository at this point in the history
fix merge error
  • Loading branch information
star-e authored Jul 19, 2023
2 parents ddf9356 + 5267727 commit 4d50490
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 5 deletions.
9 changes: 9 additions & 0 deletions cocos/rendering/custom/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ export class CopyPair {
targetMostDetailedMip: number;
targetFirstSlice: number;
targetPlaneSlice: number;
sourceOffset = 0;
targetOffset = 0;
bufferSize = 0;
}

export class UploadPair {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions native/cocos/renderer/pipeline/custom/NativePipelineTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
5 changes: 5 additions & 0 deletions native/cocos/renderer/pipeline/custom/NativePipelineTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,9 @@ struct RenderInstancingQueue {

struct RenderBatchingQueue {
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
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);
Expand All @@ -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<uint32_t> batches;
};

struct DrawInstance {
Expand Down
21 changes: 21 additions & 0 deletions native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -400,6 +409,18 @@ bool sevalue_to_native<cc::render::CopyPair>(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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
17 changes: 15 additions & 2 deletions native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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) {}
Expand Down
1 change: 1 addition & 0 deletions native/cocos/renderer/pipeline/custom/RenderCommonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4d50490

Please sign in to comment.