Hash :
558981c1
Author :
Date :
2021-11-10T23:13:03
Vulkan: Make write-after-invalidate checks more precise Previously, the size of the command buffer was used as indication for whether the render pass attachments might have been modified after glInvalidateFramebuffer. In that case, the invalidate was undone. This is made more precise by making sure only vkCmdClearAttachments and vkCmdDraw* calls are counted for this purpose. For example, inserting event markers after glInvalidateFramebuffer now retains the invalidation. Note that this can be even further optimized by tracking real writes to attachments. For example, currently a draw call with depth test disabled still undoes the invalidation of the depth buffer, but it shouldn't. Bug: angleproject:5079 Change-Id: I6257b4116a73213884b919bc7f3c86ff39b6aeed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3274176 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// vk_command_buffer_utils:
// Helpers for secondary command buffer implementations.
//
#ifndef LIBANGLE_RENDERER_VULKAN_VK_COMMAND_BUFFER_UTILS_H_
#define LIBANGLE_RENDERER_VULKAN_VK_COMMAND_BUFFER_UTILS_H_
namespace rx
{
namespace vk
{
// A helper class to track commands recorded to a command buffer.
class CommandBufferCommandTracker
{
public:
void onDraw() { ++mRenderPassWriteCommandCount; }
void onClearAttachments() { ++mRenderPassWriteCommandCount; }
uint32_t getRenderPassWriteCommandCount() const { return mRenderPassWriteCommandCount; }
void reset() { *this = CommandBufferCommandTracker{}; }
private:
// The number of commands recorded that can modify a render pass attachment, i.e.
// vkCmdClearAttachment and vkCmdDraw*. Used to know if a command might have written to an
// attachment after it was invalidated.
uint32_t mRenderPassWriteCommandCount = 0;
};
} // namespace vk
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_VK_COMMAND_BUFFER_UTILS_H_