Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subresource move #157

Merged
merged 14 commits into from
Aug 9, 2023
8 changes: 4 additions & 4 deletions native/cocos/renderer/frame-graph/ImmutableState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ std::pair<gfx::GFXObject*, gfx::GFXObject*> getBarrier(const ResourceBarrier& ba
info.type = barrierInfo.barrierType;
info.prevAccesses = getAccessFlags(usage, barrierInfo.beginStatus);
info.nextAccesses = getAccessFlags(usage, barrierInfo.endStatus);
info.baseMipLevel = static_cast<uint32_t>(barrierInfo.mipRange.base);
info.levelCount = static_cast<uint32_t>(barrierInfo.mipRange.len);
info.baseSlice = static_cast<uint32_t>(barrierInfo.layerRange.base);
info.sliceCount = static_cast<uint32_t>(barrierInfo.layerRange.len);
info.range.mipLevel = static_cast<uint32_t>(barrierInfo.mipRange.base);
info.range.levelCount = static_cast<uint32_t>(barrierInfo.mipRange.len);
info.range.firstSlice = static_cast<uint32_t>(barrierInfo.layerRange.base);
info.range.numSlices = static_cast<uint32_t>(barrierInfo.layerRange.len);

res.first = gfx::Device::getInstance()->getTextureBarrier(info);
res.second = gfxTexture;
Expand Down
18 changes: 13 additions & 5 deletions native/cocos/renderer/gfx-base/GFXDef-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,18 @@ struct RenderPassInfo {
EXPOSE_COPY_FN(RenderPassInfo)
};

struct ResourceRange {
uint32_t width{0};
uint32_t height{0};
uint32_t depthOrArraySize{0};
uint32_t firstSlice{0};
uint32_t numSlices{0};
uint32_t mipLevel{0};
uint32_t levelCount{0};
uint32_t basePlane{0};
uint32_t planeCount{0};
};

struct ALIGNAS(8) GeneralBarrierInfo {
AccessFlags prevAccesses{AccessFlagBit::NONE};
AccessFlags nextAccesses{AccessFlagBit::NONE};
Expand All @@ -1360,11 +1372,7 @@ struct ALIGNAS(8) TextureBarrierInfo {

BarrierType type{BarrierType::FULL};

uint32_t baseMipLevel{0};
uint32_t levelCount{1};
uint32_t baseSlice{0};
uint32_t sliceCount{1};

ResourceRange range{};
uint64_t discardContents{0}; // @ts-boolean

Queue *srcQueue{nullptr}; // @ts-nullable
Expand Down
8 changes: 4 additions & 4 deletions native/cocos/renderer/gfx-vulkan/states/VKTextureBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ CCVKTextureBarrier::CCVKTextureBarrier(const TextureBarrierInfo &info) : Texture
_gpuBarrier->barrier.prevLayout = getAccessLayout(info.prevAccesses);
_gpuBarrier->barrier.nextLayout = getAccessLayout(info.nextAccesses);
_gpuBarrier->barrier.discardContents = !!info.discardContents;
_gpuBarrier->barrier.subresourceRange.baseMipLevel = 0U;
_gpuBarrier->barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
_gpuBarrier->barrier.subresourceRange.baseArrayLayer = 0U;
_gpuBarrier->barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
_gpuBarrier->barrier.subresourceRange.baseMipLevel = info.range.mipLevel;
_gpuBarrier->barrier.subresourceRange.levelCount = info.range.levelCount;
_gpuBarrier->barrier.subresourceRange.baseArrayLayer = info.range.firstSlice;
_gpuBarrier->barrier.subresourceRange.layerCount = info.range.numSlices;
_gpuBarrier->barrier.srcQueueFamilyIndex = info.srcQueue
? static_cast<CCVKQueue *>(info.srcQueue)->gpuQueue()->queueFamilyIndex
: VK_QUEUE_FAMILY_IGNORED;
Expand Down
Loading
Loading