Commit da437f26 by Charlie Lao Committed by Commit Bot

Vulkan: Defer color image layout changes at endRenderPass time

Right now color render target's image's layout change are done at beginRenderPass time. The problem is that the layout also depends on whether texture is also being used as a sampler or not. That information is not known when renderpass starts. We did some special treatment for depth stencil attachment so that its layout determination is deferred until endRenderPass time. This CL expands that same mechanism to color attachment as well. Right now the color attachment will still pick the same ImageLayout::ColorAttachment layout since the logic to detect it is also used for texture sampling is not there yet. Bug: b/175584609 Change-Id: Id7486174d475f894461578b31d0d40fdd90e808a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2744121Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
parent 0a80f2e1
...@@ -2673,12 +2673,7 @@ void ContextVk::optimizeRenderPassForPresent(VkFramebuffer framebufferHandle) ...@@ -2673,12 +2673,7 @@ void ContextVk::optimizeRenderPassForPresent(VkFramebuffer framebufferHandle)
// Use finalLayout instead of extra barrier for layout change to present // Use finalLayout instead of extra barrier for layout change to present
vk::ImageHelper &image = color0RenderTarget->getImageForWrite(); vk::ImageHelper &image = color0RenderTarget->getImageForWrite();
image.setCurrentImageLayout(vk::ImageLayout::Present); mRenderPassCommands->setImageOptimizeForPresent(&image);
// TODO(syoussefi): We currently don't store the layout of the resolve attachments, so once
// multisampled backbuffers are optimized to use resolve attachments, this information needs to
// be stored somewhere. http://anglebug.com/4836
mRenderPassCommands->updateRenderPassAttachmentFinalLayout(vk::kAttachmentIndexZero,
image.getCurrentImageLayout());
} }
gl::GraphicsResetStatus ContextVk::getResetStatus() gl::GraphicsResetStatus ContextVk::getResetStatus()
...@@ -5029,6 +5024,7 @@ angle::Result ContextVk::beginNewRenderPass( ...@@ -5029,6 +5024,7 @@ angle::Result ContextVk::beginNewRenderPass(
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
const vk::RenderPassDesc &renderPassDesc, const vk::RenderPassDesc &renderPassDesc,
const vk::AttachmentOpsArray &renderPassAttachmentOps, const vk::AttachmentOpsArray &renderPassAttachmentOps,
const vk::PackedAttachmentCount colorAttachmentCount,
const vk::PackedAttachmentIndex depthStencilAttachmentIndex, const vk::PackedAttachmentIndex depthStencilAttachmentIndex,
const vk::PackedClearValuesArray &clearValues, const vk::PackedClearValuesArray &clearValues,
vk::CommandBuffer **commandBufferOut) vk::CommandBuffer **commandBufferOut)
...@@ -5036,9 +5032,9 @@ angle::Result ContextVk::beginNewRenderPass( ...@@ -5036,9 +5032,9 @@ angle::Result ContextVk::beginNewRenderPass(
// Next end any currently outstanding renderPass // Next end any currently outstanding renderPass
ANGLE_TRY(flushCommandsAndEndRenderPass()); ANGLE_TRY(flushCommandsAndEndRenderPass());
mRenderPassCommands->beginRenderPass(framebuffer, renderArea, renderPassDesc, mRenderPassCommands->beginRenderPass(
renderPassAttachmentOps, depthStencilAttachmentIndex, framebuffer, renderArea, renderPassDesc, renderPassAttachmentOps, colorAttachmentCount,
clearValues, commandBufferOut); depthStencilAttachmentIndex, clearValues, commandBufferOut);
mPerfCounters.renderPasses++; mPerfCounters.renderPasses++;
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -462,6 +462,14 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText ...@@ -462,6 +462,14 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
imageLayout, vk::AliasingMode::Allowed, image); imageLayout, vk::AliasingMode::Allowed, image);
} }
void onColorDraw(vk::ImageHelper *image,
vk::ImageHelper *resolveImage,
vk::PackedAttachmentIndex packedAttachmentIndex)
{
ASSERT(mRenderPassCommands->started());
mRenderPassCommands->colorImagesDraw(&mResourceUseList, image, resolveImage,
packedAttachmentIndex);
}
void onDepthStencilDraw(gl::LevelIndex level, void onDepthStencilDraw(gl::LevelIndex level,
uint32_t layerStart, uint32_t layerStart,
uint32_t layerCount, uint32_t layerCount,
...@@ -494,6 +502,7 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText ...@@ -494,6 +502,7 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
const vk::RenderPassDesc &renderPassDesc, const vk::RenderPassDesc &renderPassDesc,
const vk::AttachmentOpsArray &renderPassAttachmentOps, const vk::AttachmentOpsArray &renderPassAttachmentOps,
const vk::PackedAttachmentCount colorAttachmentCount,
const vk::PackedAttachmentIndex depthStencilAttachmentIndex, const vk::PackedAttachmentIndex depthStencilAttachmentIndex,
const vk::PackedClearValuesArray &clearValues, const vk::PackedClearValuesArray &clearValues,
vk::CommandBuffer **commandBufferOut); vk::CommandBuffer **commandBufferOut);
......
...@@ -1386,11 +1386,11 @@ angle::Result FramebufferVk::resolveColorWithSubpass(ContextVk *contextVk, ...@@ -1386,11 +1386,11 @@ angle::Result FramebufferVk::resolveColorWithSubpass(ContextVk *contextVk,
ANGLE_TRY(srcFramebufferVk->getFramebuffer(contextVk, &newSrcFramebuffer, resolveImageView)); ANGLE_TRY(srcFramebufferVk->getFramebuffer(contextVk, &newSrcFramebuffer, resolveImageView));
// 2. Update the CommandBufferHelper with the new framebuffer and render pass // 2. Update the CommandBufferHelper with the new framebuffer and render pass
vk::CommandBufferHelper &commandBufferHelper = contextVk->getStartedRenderPassCommands(); vk::CommandBufferHelper &commandBufferHelper = contextVk->getStartedRenderPassCommands();
commandBufferHelper.updateRenderPassForResolve(newSrcFramebuffer, commandBufferHelper.updateRenderPassForResolve(contextVk, newSrcFramebuffer,
srcFramebufferVk->getRenderPassDesc()); srcFramebufferVk->getRenderPassDesc());
// End the render pass now since we don't (yet) support subpass dependencies. // End the render pass now since we don't (yet) support subpass dependencies.
drawRenderTarget->onColorDraw(contextVk, mCurrentFramebufferDesc.getLayerCount()); drawRenderTarget->onColorResolve(contextVk, mCurrentFramebufferDesc.getLayerCount());
ANGLE_TRY(contextVk->flushCommandsAndEndRenderPass()); ANGLE_TRY(contextVk->flushCommandsAndEndRenderPass());
// Remove the resolve attachment from the source framebuffer. // Remove the resolve attachment from the source framebuffer.
...@@ -2382,10 +2382,6 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk, ...@@ -2382,10 +2382,6 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk,
// Color render targets are never entirely transient. Only depth/stencil // Color render targets are never entirely transient. Only depth/stencil
// multisampled-render-to-texture textures can be so. // multisampled-render-to-texture textures can be so.
ASSERT(!colorRenderTarget->isEntirelyTransient()); ASSERT(!colorRenderTarget->isEntirelyTransient());
renderPassAttachmentOps.setLayouts(colorIndexVk, vk::ImageLayout::ColorAttachment,
vk::ImageLayout::ColorAttachment);
const vk::RenderPassStoreOp storeOp = colorRenderTarget->isImageTransient() const vk::RenderPassStoreOp storeOp = colorRenderTarget->isImageTransient()
? vk::RenderPassStoreOp::DontCare ? vk::RenderPassStoreOp::DontCare
: vk::RenderPassStoreOp::Store; : vk::RenderPassStoreOp::Store;
...@@ -2611,15 +2607,18 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk, ...@@ -2611,15 +2607,18 @@ angle::Result FramebufferVk::startNewRenderPass(ContextVk *contextVk,
renderArea = getRotatedCompleteRenderArea(contextVk); renderArea = getRotatedCompleteRenderArea(contextVk);
} }
ANGLE_TRY(contextVk->beginNewRenderPass(*framebuffer, renderArea, mRenderPassDesc, ANGLE_TRY(contextVk->beginNewRenderPass(
renderPassAttachmentOps, depthStencilAttachmentIndex, *framebuffer, renderArea, mRenderPassDesc, renderPassAttachmentOps, colorIndexVk,
packedClearValues, commandBufferOut)); depthStencilAttachmentIndex, packedClearValues, commandBufferOut));
// Transition the images to the correct layout (through onColorDraw). // Add the images to the renderpass tracking list (through onColorDraw).
vk::PackedAttachmentIndex colorAttachmentIndex(0);
for (size_t colorIndexGL : mState.getColorAttachmentsMask()) for (size_t colorIndexGL : mState.getColorAttachmentsMask())
{ {
RenderTargetVk *colorRenderTarget = colorRenderTargets[colorIndexGL]; RenderTargetVk *colorRenderTarget = colorRenderTargets[colorIndexGL];
colorRenderTarget->onColorDraw(contextVk, mCurrentFramebufferDesc.getLayerCount()); colorRenderTarget->onColorDraw(contextVk, mCurrentFramebufferDesc.getLayerCount(),
colorAttachmentIndex);
++colorAttachmentIndex;
} }
if (depthStencilRenderTarget) if (depthStencilRenderTarget)
......
...@@ -95,26 +95,38 @@ vk::ImageOrBufferViewSubresourceSerial RenderTargetVk::getResolveSubresourceSeri ...@@ -95,26 +95,38 @@ vk::ImageOrBufferViewSubresourceSerial RenderTargetVk::getResolveSubresourceSeri
return getSubresourceSerialImpl(mResolveImageViews); return getSubresourceSerialImpl(mResolveImageViews);
} }
void RenderTargetVk::onColorDraw(ContextVk *contextVk, uint32_t framebufferLayerCount) void RenderTargetVk::onColorDraw(ContextVk *contextVk,
uint32_t framebufferLayerCount,
vk::PackedAttachmentIndex packedAttachmentIndex)
{ {
ASSERT(!mImage->getFormat().actualImageFormat().hasDepthOrStencilBits()); ASSERT(!mImage->getFormat().actualImageFormat().hasDepthOrStencilBits());
ASSERT(framebufferLayerCount <= mLayerCount); ASSERT(framebufferLayerCount <= mLayerCount);
contextVk->onImageRenderPassWrite(mLevelIndexGL, mLayerIndex, framebufferLayerCount, contextVk->onColorDraw(mImage, mResolveImage, packedAttachmentIndex);
VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::ColorAttachment, mImage->onWrite(mLevelIndexGL, 1, mLayerIndex, framebufferLayerCount,
mImage); VK_IMAGE_ASPECT_COLOR_BIT);
if (mResolveImage) if (mResolveImage)
{ {
// Multisampled render to texture framebuffers cannot be layered. // Multisampled render to texture framebuffers cannot be layered.
ASSERT(framebufferLayerCount == 1); ASSERT(framebufferLayerCount == 1);
mResolveImage->onWrite(mLevelIndexGL, 1, mLayerIndex, framebufferLayerCount,
contextVk->onImageRenderPassWrite(mLevelIndexGL, mLayerIndex, framebufferLayerCount, VK_IMAGE_ASPECT_COLOR_BIT);
VK_IMAGE_ASPECT_COLOR_BIT,
vk::ImageLayout::ColorAttachment, mResolveImage);
} }
retainImageViews(contextVk); retainImageViews(contextVk);
} }
void RenderTargetVk::onColorResolve(ContextVk *contextVk, uint32_t framebufferLayerCount)
{
ASSERT(!mImage->getFormat().actualImageFormat().hasDepthOrStencilBits());
ASSERT(framebufferLayerCount <= mLayerCount);
ASSERT(mResolveImage == nullptr);
contextVk->onImageRenderPassWrite(mLevelIndexGL, mLayerIndex, framebufferLayerCount,
VK_IMAGE_ASPECT_COLOR_BIT, vk::ImageLayout::ColorAttachment,
mImage);
retainImageViews(contextVk);
}
void RenderTargetVk::onDepthStencilDraw(ContextVk *contextVk, uint32_t framebufferLayerCount) void RenderTargetVk::onDepthStencilDraw(ContextVk *contextVk, uint32_t framebufferLayerCount)
{ {
const angle::Format &format = mImage->getFormat().actualImageFormat(); const angle::Format &format = mImage->getFormat().actualImageFormat();
......
...@@ -67,7 +67,10 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget ...@@ -67,7 +67,10 @@ class RenderTargetVk final : public FramebufferAttachmentRenderTarget
vk::ImageOrBufferViewSubresourceSerial getResolveSubresourceSerial() const; vk::ImageOrBufferViewSubresourceSerial getResolveSubresourceSerial() const;
// Note: RenderTargets should be called in order, with the depth/stencil onRender last. // Note: RenderTargets should be called in order, with the depth/stencil onRender last.
void onColorDraw(ContextVk *contextVk, uint32_t framebufferLayerCount); void onColorDraw(ContextVk *contextVk,
uint32_t framebufferLayerCount,
vk::PackedAttachmentIndex index);
void onColorResolve(ContextVk *contextVk, uint32_t framebufferLayerCount);
void onDepthStencilDraw(ContextVk *contextVk, uint32_t framebufferLayerCount); void onDepthStencilDraw(ContextVk *contextVk, uint32_t framebufferLayerCount);
vk::ImageHelper &getImageForRenderPass(); vk::ImageHelper &getImageForRenderPass();
......
...@@ -1326,6 +1326,11 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk, ...@@ -1326,6 +1326,11 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk,
contextVk->optimizeRenderPassForPresent(currentFramebuffer.getHandle()); contextVk->optimizeRenderPassForPresent(currentFramebuffer.getHandle());
} }
// Because the color attachment defers layout changes until endRenderPass time, we must call
// finalize the layout transition in the renderpass before we insert layout change to
// ImageLayout::Present bellow.
contextVk->onImageHelperRelease(&image.image);
vk::CommandBuffer *commandBuffer; vk::CommandBuffer *commandBuffer;
ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer({}, &commandBuffer)); ANGLE_TRY(contextVk->getOutsideRenderPassCommandBuffer({}, &commandBuffer));
......
...@@ -2410,7 +2410,7 @@ angle::Result TextureVk::syncState(const gl::Context *context, ...@@ -2410,7 +2410,7 @@ angle::Result TextureVk::syncState(const gl::Context *context,
// the levels have already been discarded through the |removeStagedUpdates| call above. // the levels have already been discarded through the |removeStagedUpdates| call above.
ANGLE_TRY(flushImageStagedUpdates(contextVk)); ANGLE_TRY(flushImageStagedUpdates(contextVk));
mImage->stageSelfForBaseLevel(); mImage->stageSelfForBaseLevel(contextVk);
// Release views and render targets created for the old image. // Release views and render targets created for the old image.
releaseImage(contextVk); releaseImage(contextVk);
......
...@@ -1935,9 +1935,9 @@ angle::Result UtilsVk::startRenderPass(ContextVk *contextVk, ...@@ -1935,9 +1935,9 @@ angle::Result UtilsVk::startRenderPass(ContextVk *contextVk,
vk::ImageLayout::ColorAttachment, vk::ImageLayout::ColorAttachment,
vk::ImageLayout::ColorAttachment); vk::ImageLayout::ColorAttachment);
ANGLE_TRY(contextVk->beginNewRenderPass(framebuffer, renderArea, renderPassDesc, ANGLE_TRY(contextVk->beginNewRenderPass(
renderPassAttachmentOps, vk::kAttachmentIndexInvalid, framebuffer, renderArea, renderPassDesc, renderPassAttachmentOps,
clearValues, commandBufferOut)); vk::PackedAttachmentCount(1), vk::kAttachmentIndexInvalid, clearValues, commandBufferOut));
contextVk->addGarbage(&framebuffer); contextVk->addGarbage(&framebuffer);
......
...@@ -979,6 +979,19 @@ class PackedClearValuesArray final ...@@ -979,6 +979,19 @@ class PackedClearValuesArray final
gl::AttachmentArray<VkClearValue> mValues; gl::AttachmentArray<VkClearValue> mValues;
}; };
// Stores ImageHelpers In packed attachment index
class PackedImageAttachmentArray final
{
public:
PackedImageAttachmentArray() : mImages{} {}
~PackedImageAttachmentArray() = default;
ImageHelper *&operator[](PackedAttachmentIndex index) { return mImages[index.get()]; }
void reset() { mImages.fill(nullptr); }
private:
gl::AttachmentArray<ImageHelper *> mImages;
};
// The following are used to help track the state of an invalidated attachment. // The following are used to help track the state of an invalidated attachment.
// This value indicates an "infinite" CmdSize that is not valid for comparing // This value indicates an "infinite" CmdSize that is not valid for comparing
...@@ -1024,6 +1037,10 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1024,6 +1037,10 @@ class CommandBufferHelper : angle::NonCopyable
AliasingMode aliasingMode, AliasingMode aliasingMode,
ImageHelper *image); ImageHelper *image);
void colorImagesDraw(ResourceUseList *resourceUseList,
ImageHelper *image,
ImageHelper *resolveImage,
PackedAttachmentIndex packedAttachmentIndex);
void depthStencilImagesDraw(ResourceUseList *resourceUseList, void depthStencilImagesDraw(ResourceUseList *resourceUseList,
gl::LevelIndex level, gl::LevelIndex level,
uint32_t layerStart, uint32_t layerStart,
...@@ -1075,6 +1092,7 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1075,6 +1092,7 @@ class CommandBufferHelper : angle::NonCopyable
const gl::Rectangle &renderArea, const gl::Rectangle &renderArea,
const RenderPassDesc &renderPassDesc, const RenderPassDesc &renderPassDesc,
const AttachmentOpsArray &renderPassAttachmentOps, const AttachmentOpsArray &renderPassAttachmentOps,
const vk::PackedAttachmentCount colorAttachmentCount,
const PackedAttachmentIndex depthStencilAttachmentIndex, const PackedAttachmentIndex depthStencilAttachmentIndex,
const PackedClearValuesArray &clearValues, const PackedClearValuesArray &clearValues,
CommandBuffer **commandBufferOut); CommandBuffer **commandBufferOut);
...@@ -1114,13 +1132,6 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1114,13 +1132,6 @@ class CommandBufferHelper : angle::NonCopyable
std::min(cmdCountDisabled, mCommandBuffer.getCommandSize()) == cmdCountInvalidated; std::min(cmdCountDisabled, mCommandBuffer.getCommandSize()) == cmdCountInvalidated;
} }
void updateRenderPassAttachmentFinalLayout(PackedAttachmentIndex attachmentIndex,
ImageLayout finalLayout)
{
ASSERT(mIsRenderPassCommandBuffer);
SetBitField(mAttachmentOps[attachmentIndex].finalLayout, finalLayout);
}
void updateRenderPassColorClear(PackedAttachmentIndex colorIndex, void updateRenderPassColorClear(PackedAttachmentIndex colorIndex,
const VkClearValue &colorClearValue); const VkClearValue &colorClearValue);
void updateRenderPassDepthStencilClear(VkImageAspectFlags aspectFlags, void updateRenderPassDepthStencilClear(VkImageAspectFlags aspectFlags,
...@@ -1158,6 +1169,7 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1158,6 +1169,7 @@ class CommandBufferHelper : angle::NonCopyable
bool usesBuffer(const BufferHelper &buffer) const; bool usesBuffer(const BufferHelper &buffer) const;
bool usesBufferForWrite(const BufferHelper &buffer) const; bool usesBufferForWrite(const BufferHelper &buffer) const;
bool usesImageInRenderPass(const ImageHelper &image) const; bool usesImageInRenderPass(const ImageHelper &image) const;
bool usesImageInAttachments(const ImageHelper &image);
size_t getUsedBuffersCount() const { return mUsedBuffers.size(); } size_t getUsedBuffersCount() const { return mUsedBuffers.size(); }
// Dumping the command stream is disabled by default. // Dumping the command stream is disabled by default.
...@@ -1166,7 +1178,8 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1166,7 +1178,8 @@ class CommandBufferHelper : angle::NonCopyable
void onDepthAccess(ResourceAccess access); void onDepthAccess(ResourceAccess access);
void onStencilAccess(ResourceAccess access); void onStencilAccess(ResourceAccess access);
void updateRenderPassForResolve(Framebuffer *newFramebuffer, void updateRenderPassForResolve(ContextVk *contextVk,
Framebuffer *newFramebuffer,
const RenderPassDesc &renderPassDesc); const RenderPassDesc &renderPassDesc);
bool hasDepthStencilWriteOrClear() const bool hasDepthStencilWriteOrClear() const
...@@ -1197,6 +1210,7 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1197,6 +1210,7 @@ class CommandBufferHelper : angle::NonCopyable
} }
} }
bool hasGLMemoryBarrierIssued() const { return mHasGLMemoryBarrierIssued; } bool hasGLMemoryBarrierIssued() const { return mHasGLMemoryBarrierIssued; }
void setImageOptimizeForPresent(ImageHelper *image) { mImageOptimizeForPresent = image; }
private: private:
bool onDepthStencilAccess(ResourceAccess access, bool onDepthStencilAccess(ResourceAccess access,
...@@ -1205,9 +1219,21 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1205,9 +1219,21 @@ class CommandBufferHelper : angle::NonCopyable
void restoreDepthContent(); void restoreDepthContent();
void restoreStencilContent(); void restoreStencilContent();
// We can't determine the image layout at the renderpass start time since their full usage
// aren't known until later time. We finalize the layout when either ImageHelper object is
// released or when renderpass ends.
void finalizeColorImageLayout(Context *context,
ImageHelper *image,
PackedAttachmentIndex packedAttachmentIndex,
bool isResolveImage);
void finalizeDepthStencilImageLayout(Context *context); void finalizeDepthStencilImageLayout(Context *context);
void finalizeDepthStencilResolveImageLayout(Context *context); void finalizeDepthStencilResolveImageLayout(Context *context);
void updateImageLayoutAndBarrier(Context *context,
ImageHelper *image,
VkImageAspectFlags aspectFlags,
ImageLayout imageLayout);
// Allocator used by this class. Using a pool allocator per CBH to avoid threading issues // Allocator used by this class. Using a pool allocator per CBH to avoid threading issues
// that occur w/ shared allocator between multiple CBHs. // that occur w/ shared allocator between multiple CBHs.
angle::PoolAllocator mAllocator; angle::PoolAllocator mAllocator;
...@@ -1275,6 +1301,15 @@ class CommandBufferHelper : angle::NonCopyable ...@@ -1275,6 +1301,15 @@ class CommandBufferHelper : angle::NonCopyable
gl::LevelIndex mDepthStencilLevelIndex; gl::LevelIndex mDepthStencilLevelIndex;
uint32_t mDepthStencilLayerIndex; uint32_t mDepthStencilLayerIndex;
uint32_t mDepthStencilLayerCount; uint32_t mDepthStencilLayerCount;
// Array size of mColorImages
PackedAttachmentCount mColorImagesCount;
// Attached render target images. Color and depth resolve images are always come last.
PackedImageAttachmentArray mColorImages;
PackedImageAttachmentArray mColorResolveImages;
// This is last renderpass before present and this is the image will be presented. We can use
// final layout of the renderpass to transit it to the presentable layout
ImageHelper *mImageOptimizeForPresent;
}; };
// Imagine an image going through a few layout transitions: // Imagine an image going through a few layout transitions:
...@@ -1647,7 +1682,7 @@ class ImageHelper final : public Resource, public angle::Subject ...@@ -1647,7 +1682,7 @@ class ImageHelper final : public Resource, public angle::Subject
// Stage the currently allocated image as an update to base level, making this !valid(). This // Stage the currently allocated image as an update to base level, making this !valid(). This
// is used for mipmap generation. // is used for mipmap generation.
void stageSelfForBaseLevel(); void stageSelfForBaseLevel(ContextVk *contextVk);
// Flush staged updates for a single subresource. Can optionally take a parameter to defer // Flush staged updates for a single subresource. Can optionally take a parameter to defer
// clears to a subsequent RenderPass load op. // clears to a subsequent RenderPass load op.
......
...@@ -136,10 +136,15 @@ class PackedAttachmentIndex final ...@@ -136,10 +136,15 @@ class PackedAttachmentIndex final
{ {
return mAttachmentIndex != other.mAttachmentIndex; return mAttachmentIndex != other.mAttachmentIndex;
} }
constexpr bool operator<(const PackedAttachmentIndex &other) const
{
return mAttachmentIndex < other.mAttachmentIndex;
}
private: private:
uint32_t mAttachmentIndex; uint32_t mAttachmentIndex;
}; };
using PackedAttachmentCount = PackedAttachmentIndex;
static constexpr PackedAttachmentIndex kAttachmentIndexInvalid = PackedAttachmentIndex(-1); static constexpr PackedAttachmentIndex kAttachmentIndexInvalid = PackedAttachmentIndex(-1);
static constexpr PackedAttachmentIndex kAttachmentIndexZero = PackedAttachmentIndex(0); static constexpr PackedAttachmentIndex kAttachmentIndexZero = PackedAttachmentIndex(0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment