mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Remove some format rule (#10919)
* remove some rules * format all codes with new format rule
This commit is contained in:
@@ -76,7 +76,7 @@ void FrameGraph::present(const TextureHandle &input, gfx::Texture *target, bool
|
||||
auto name = FrameGraph::stringToHandle(StringUtil::format("Present Target %d", target->getTypedID()).c_str());
|
||||
presentTargets.emplace(std::piecewise_construct, std::forward_as_tuple(target->getTypedID()), std::forward_as_tuple(name, Texture{target}));
|
||||
}
|
||||
auto & resourceInfo{presentTargets[target->getTypedID()]};
|
||||
auto &resourceInfo{presentTargets[target->getTypedID()]};
|
||||
TextureHandle output{getBlackboard().get(resourceInfo.first)};
|
||||
if (!output.isValid()) {
|
||||
output = importExternal(resourceInfo.first, resourceInfo.second);
|
||||
@@ -92,9 +92,9 @@ void FrameGraph::present(const TextureHandle &input, gfx::Texture *target, bool
|
||||
gfx::Texture *input = table.getRead(data.input);
|
||||
if (input && input != target) {
|
||||
gfx::TextureBlit region;
|
||||
region.srcExtent.width = input->getWidth();
|
||||
region.srcExtent.width = input->getWidth();
|
||||
region.srcExtent.height = input->getHeight();
|
||||
region.dstExtent.width = target->getWidth();
|
||||
region.dstExtent.width = target->getWidth();
|
||||
region.dstExtent.height = target->getHeight();
|
||||
cmdBuff->blitTexture(input, target, ®ion, 1, gfx::Filter::POINT);
|
||||
}
|
||||
@@ -152,16 +152,16 @@ void FrameGraph::gc(uint32_t const unusedFrameCount) noexcept {
|
||||
|
||||
void FrameGraph::move(const TextureHandle from, const TextureHandle to, uint8_t mipmapLevel, uint8_t faceId, uint8_t arrayPosition) noexcept {
|
||||
const ResourceNode &fromResourceNode = getResourceNode(from);
|
||||
const ResourceNode &toResourceNode = getResourceNode(to);
|
||||
const ResourceNode &toResourceNode = getResourceNode(to);
|
||||
|
||||
CC_ASSERT(!fromResourceNode.virtualResource->isImported());
|
||||
CC_ASSERT(fromResourceNode.writer);
|
||||
CC_ASSERT(!toResourceNode.writer);
|
||||
|
||||
const gfx::TextureInfo &toTextureDesc = static_cast<ResourceEntry<Texture> *>(toResourceNode.virtualResource)->get().getDesc();
|
||||
uint32_t const toTextureWidth = toTextureDesc.width >> mipmapLevel;
|
||||
uint32_t const toTextureHeight = toTextureDesc.height >> mipmapLevel;
|
||||
uint32_t const toTextureDepth = toTextureDesc.depth >> mipmapLevel;
|
||||
const gfx::TextureInfo &toTextureDesc = static_cast<ResourceEntry<Texture> *>(toResourceNode.virtualResource)->get().getDesc();
|
||||
uint32_t const toTextureWidth = toTextureDesc.width >> mipmapLevel;
|
||||
uint32_t const toTextureHeight = toTextureDesc.height >> mipmapLevel;
|
||||
uint32_t const toTextureDepth = toTextureDesc.depth >> mipmapLevel;
|
||||
|
||||
CC_ASSERT(toTextureWidth && toTextureHeight && toTextureDepth);
|
||||
CC_ASSERT(toTextureDesc.levelCount > mipmapLevel && toTextureDesc.layerCount > arrayPosition);
|
||||
@@ -208,7 +208,7 @@ Handle FrameGraph::createResourceNode(VirtualResource *const virtualResource) {
|
||||
const size_t index = _resourceNodes.size();
|
||||
ResourceNode resourceNode;
|
||||
resourceNode.virtualResource = virtualResource;
|
||||
resourceNode.version = virtualResource->_version;
|
||||
resourceNode.version = virtualResource->_version;
|
||||
_resourceNodes.emplace_back(resourceNode);
|
||||
|
||||
return Handle{static_cast<Handle::IndexType>(index)};
|
||||
@@ -301,9 +301,9 @@ void FrameGraph::computeResourceLifetime() {
|
||||
}
|
||||
|
||||
void FrameGraph::mergePassNodes() noexcept {
|
||||
const size_t count = _passNodes.size();
|
||||
size_t currentPassId = 0;
|
||||
size_t lastPassId = 0;
|
||||
const size_t count = _passNodes.size();
|
||||
size_t currentPassId = 0;
|
||||
size_t lastPassId = 0;
|
||||
|
||||
while (currentPassId < count) {
|
||||
const auto ¤tPassNode = _passNodes[currentPassId];
|
||||
@@ -336,19 +336,19 @@ void FrameGraph::mergePassNodes() noexcept {
|
||||
++distance;
|
||||
}
|
||||
|
||||
prevPassNode->_next = currentPassNode.get();
|
||||
currentPassNode->_head = lastPassNode.get();
|
||||
prevPassNode->_next = currentPassNode.get();
|
||||
currentPassNode->_head = lastPassNode.get();
|
||||
currentPassNode->_distanceToHead = distance;
|
||||
currentPassNode->_refCount = 0;
|
||||
currentPassNode->_refCount = 0;
|
||||
|
||||
const size_t attachmentCount = lastPassNode->_attachments.size();
|
||||
|
||||
for (size_t i = 0; i < attachmentCount; ++i) {
|
||||
const RenderTargetAttachment &attachmentInLastPassNode = lastPassNode->_attachments[i];
|
||||
const RenderTargetAttachment &attachmentInLastPassNode = lastPassNode->_attachments[i];
|
||||
const RenderTargetAttachment &attachmentInCurrentPassNode = currentPassNode->_attachments[i];
|
||||
|
||||
ResourceNode &resourceNode = _resourceNodes[attachmentInLastPassNode.textureHandle];
|
||||
uint16_t & writeCount = resourceNode.virtualResource->_writerCount;
|
||||
uint16_t &writeCount = resourceNode.virtualResource->_writerCount;
|
||||
CC_ASSERT(writeCount > 1);
|
||||
--writeCount;
|
||||
|
||||
@@ -362,7 +362,7 @@ void FrameGraph::mergePassNodes() noexcept {
|
||||
}
|
||||
|
||||
void FrameGraph::computeStoreActionAndMemoryless() {
|
||||
ID passId = 0;
|
||||
ID passId = 0;
|
||||
bool lastPassSubpassEnable = false;
|
||||
|
||||
for (const auto &passNode : _passNodes) {
|
||||
@@ -406,7 +406,7 @@ void FrameGraph::computeStoreActionAndMemoryless() {
|
||||
CC_ASSERT(resourceNodePrevVersion);
|
||||
|
||||
if (resourceNodePrevVersion->writer->_devicePassId == passNode->_devicePassId) {
|
||||
attachment.desc.loadOp = gfx::LoadOp::DISCARD;
|
||||
attachment.desc.loadOp = gfx::LoadOp::DISCARD;
|
||||
resourceNodePrevVersion->writer->getRenderTargetAttachment(*this, resourceNodePrevVersion->virtualResource)->storeOp = gfx::StoreOp::DISCARD;
|
||||
}
|
||||
}
|
||||
@@ -426,7 +426,7 @@ void FrameGraph::computeStoreActionAndMemoryless() {
|
||||
for (VirtualResource *const renderTarget : renderTargets) {
|
||||
const gfx::TextureInfo &textureDesc = static_cast<ResourceEntry<Texture> *>(renderTarget)->get().getDesc();
|
||||
|
||||
renderTarget->_memoryless = renderTarget->_neverLoaded && renderTarget->_neverStored;
|
||||
renderTarget->_memoryless = renderTarget->_neverLoaded && renderTarget->_neverStored;
|
||||
renderTarget->_memorylessMSAA = textureDesc.samples != gfx::SampleCount::ONE && renderTarget->_writerCount < 2;
|
||||
}
|
||||
}
|
||||
@@ -626,7 +626,7 @@ void FrameGraph::exportGraphViz(const ccstd::string &path) {
|
||||
|
||||
for (const RenderTargetAttachment &attachment : passNode->_attachments) {
|
||||
const ResourceNode *readResourceNode = &_resourceNodes[attachment.textureHandle];
|
||||
uint16_t const distanceToHead = readResourceNode->writer->_distanceToHead;
|
||||
uint16_t const distanceToHead = readResourceNode->writer->_distanceToHead;
|
||||
|
||||
if (readResourceNode->writer && readResourceNode->writer->_head) {
|
||||
const Handle resourceNodeHandleHead = readResourceNode->writer->_head->getWriteResourceNodeHandle(*this, readResourceNode->virtualResource);
|
||||
|
||||
Reference in New Issue
Block a user