Hash :
8b9bd182
Author :
Date :
2023-02-08T16:17:10
Vulkan: Refactoring to use ProtectionType enum instead of bool
This is a second stage of refactoring that was started here:
Vulkan: Minor CommandQueue implementation refactoring.
0210b46d35b51ea04bddafb48ba406a87c39e58e
Enumeration renamed: CommandContent -> ProtectionType.
Currently interfaces of ContextVk/RendererVk/CommandQueue use
"hasProtectedContent" boolean. Internally CommandQueue uses
"vk::ProtectionType" enumeration to separate states related to
Unprotected/Protected commands. This CL replaces boolean with
enumeration for consistency.
Bug: angleproject:7995
Change-Id: Ibb98cce661358d464be7c6a8367a1297d7093b1c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4232114
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Charlie Lao <cclao@google.com>
Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//
// Copyright 2019 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.
//
// PersistentCommandPool.h:
// Defines the class interface for PersistentCommandBuffer
//
#ifndef LIBANGLE_RENDERER_VULKAN_PERSISTENTCOMMANDPOOL_H_
#define LIBANGLE_RENDERER_VULKAN_PERSISTENTCOMMANDPOOL_H_
#include <vector>
#include "libANGLE/renderer/vulkan/vk_utils.h"
#include "libANGLE/renderer/vulkan/vk_wrapper.h"
namespace rx
{
namespace vk
{
class PersistentCommandPool final
{
public:
PersistentCommandPool();
~PersistentCommandPool();
void destroy(VkDevice device);
angle::Result init(Context *context, ProtectionType protectionType, uint32_t queueFamilyIndex);
angle::Result allocate(Context *context, PrimaryCommandBuffer *commandBufferOut);
angle::Result collect(Context *context, PrimaryCommandBuffer &&buffer);
bool valid() const { return mCommandPool.valid(); }
private:
angle::Result allocateCommandBuffer(Context *context);
std::vector<PrimaryCommandBuffer> mFreeBuffers;
CommandPool mCommandPool;
static const int kInitBufferNum = 2;
};
} // namespace vk
} // namespace rx
#endif