Vulkan: Rename vk::Shared* to vk::RefCounted*
To be specific regarding what being "shared" entails. Also, avoids
confusion w.r.t to an upcoming vk::Shared class.
Bug: angleproject:2464
Change-Id: Ib9c112bbb822ae30dab39c75a8cde25dd79b2258
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1499693
Reviewed-by: Jamie Madill <jmadill@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h
index 05a8df6..09d651f 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.h
+++ b/src/libANGLE/renderer/vulkan/ContextVk.h
@@ -344,7 +344,7 @@
vk::DynamicBuffer mDriverUniformsBuffer;
VkDescriptorSet mDriverUniformsDescriptorSet;
vk::BindingPointer<vk::DescriptorSetLayout> mDriverUniformsSetLayout;
- vk::SharedDescriptorPoolBinding mDriverUniformsDescriptorPoolBinding;
+ vk::RefCountedDescriptorPoolBinding mDriverUniformsDescriptorPoolBinding;
// This cache should also probably include the texture index (shader location) and array
// index (also in the shader). This info is used in the descriptor update step.
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index e5aece9..3d45a4f 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -215,7 +215,7 @@
mDescriptorSets.clear();
mUsedDescriptorSetRange.invalidate();
- for (vk::SharedDescriptorPoolBinding &binding : mDescriptorPoolBindings)
+ for (vk::RefCountedDescriptorPoolBinding &binding : mDescriptorPoolBindings)
{
binding.reset();
}
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.h b/src/libANGLE/renderer/vulkan/ProgramVk.h
index 70b6ad0..fbeb9d1 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.h
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.h
@@ -224,7 +224,7 @@
// Keep bindings to the descriptor pools. This ensures the pools stay valid while the Program
// is in use.
- vk::DescriptorSetLayoutArray<vk::SharedDescriptorPoolBinding> mDescriptorPoolBindings;
+ vk::DescriptorSetLayoutArray<vk::RefCountedDescriptorPoolBinding> mDescriptorPoolBindings;
class ShaderInfo final : angle::NonCopyable
{
diff --git a/src/libANGLE/renderer/vulkan/UtilsVk.cpp b/src/libANGLE/renderer/vulkan/UtilsVk.cpp
index 7d7ff3a..a290eb1 100644
--- a/src/libANGLE/renderer/vulkan/UtilsVk.cpp
+++ b/src/libANGLE/renderer/vulkan/UtilsVk.cpp
@@ -389,7 +389,7 @@
shaderParams.clearValue = params.clearValue;
VkDescriptorSet descriptorSet;
- vk::SharedDescriptorPoolBinding descriptorPoolBinding;
+ vk::RefCountedDescriptorPoolBinding descriptorPoolBinding;
ANGLE_TRY(mDescriptorPools[Function::BufferClear].allocateSets(
context, mDescriptorSetLayouts[Function::BufferClear][kSetIndex].get().ptr(), 1,
&descriptorPoolBinding, &descriptorSet));
@@ -451,7 +451,7 @@
shaderParams.srcOffset = params.srcOffset;
VkDescriptorSet descriptorSet;
- vk::SharedDescriptorPoolBinding descriptorPoolBinding;
+ vk::RefCountedDescriptorPoolBinding descriptorPoolBinding;
ANGLE_TRY(mDescriptorPools[Function::BufferCopy].allocateSets(
context, mDescriptorSetLayouts[Function::BufferCopy][kSetIndex].get().ptr(), 1,
&descriptorPoolBinding, &descriptorSet));
@@ -534,7 +534,7 @@
flags |= isAligned ? ConvertVertex_comp::kIsAligned : 0;
VkDescriptorSet descriptorSet;
- vk::SharedDescriptorPoolBinding descriptorPoolBinding;
+ vk::RefCountedDescriptorPoolBinding descriptorPoolBinding;
ANGLE_TRY(mDescriptorPools[Function::ConvertVertexBuffer].allocateSets(
context, mDescriptorSetLayouts[Function::ConvertVertexBuffer][kSetIndex].get().ptr(), 1,
&descriptorPoolBinding, &descriptorSet));
@@ -710,7 +710,7 @@
flags |= src->getLayerCount() > 1 ? ImageCopy_frag::kSrcIsArray : 0;
VkDescriptorSet descriptorSet;
- vk::SharedDescriptorPoolBinding descriptorPoolBinding;
+ vk::RefCountedDescriptorPoolBinding descriptorPoolBinding;
ANGLE_TRY(mDescriptorPools[Function::ImageCopy].allocateSets(
contextVk, mDescriptorSetLayouts[Function::ImageCopy][kSetIndex].get().ptr(), 1,
&descriptorPoolBinding, &descriptorSet));
diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
index 644939d..cc3055a 100644
--- a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
@@ -1391,7 +1391,7 @@
{
for (auto &item : mPayload)
{
- vk::SharedDescriptorSetLayout &layout = item.second;
+ vk::RefCountedDescriptorSetLayout &layout = item.second;
ASSERT(!layout.isReferenced());
layout.get().destroy(device);
}
@@ -1407,7 +1407,7 @@
auto iter = mPayload.find(desc);
if (iter != mPayload.end())
{
- vk::SharedDescriptorSetLayout &layout = iter->second;
+ vk::RefCountedDescriptorSetLayout &layout = iter->second;
descriptorSetLayoutOut->set(&layout);
return angle::Result::Continue;
}
@@ -1425,8 +1425,9 @@
vk::DescriptorSetLayout newLayout;
ANGLE_VK_TRY(context, newLayout.init(context->getDevice(), createInfo));
- auto insertedItem = mPayload.emplace(desc, vk::SharedDescriptorSetLayout(std::move(newLayout)));
- vk::SharedDescriptorSetLayout &insertedLayout = insertedItem.first->second;
+ auto insertedItem =
+ mPayload.emplace(desc, vk::RefCountedDescriptorSetLayout(std::move(newLayout)));
+ vk::RefCountedDescriptorSetLayout &insertedLayout = insertedItem.first->second;
descriptorSetLayoutOut->set(&insertedLayout);
return angle::Result::Continue;
@@ -1444,7 +1445,7 @@
{
for (auto &item : mPayload)
{
- vk::SharedPipelineLayout &layout = item.second;
+ vk::RefCountedPipelineLayout &layout = item.second;
layout.get().destroy(device);
}
@@ -1460,7 +1461,7 @@
auto iter = mPayload.find(desc);
if (iter != mPayload.end())
{
- vk::SharedPipelineLayout &layout = iter->second;
+ vk::RefCountedPipelineLayout &layout = iter->second;
pipelineLayoutOut->set(&layout);
return angle::Result::Continue;
}
@@ -1518,8 +1519,8 @@
vk::PipelineLayout newLayout;
ANGLE_VK_TRY(context, newLayout.init(context->getDevice(), createInfo));
- auto insertedItem = mPayload.emplace(desc, vk::SharedPipelineLayout(std::move(newLayout)));
- vk::SharedPipelineLayout &insertedLayout = insertedItem.first->second;
+ auto insertedItem = mPayload.emplace(desc, vk::RefCountedPipelineLayout(std::move(newLayout)));
+ vk::RefCountedPipelineLayout &insertedLayout = insertedItem.first->second;
pipelineLayoutOut->set(&insertedLayout);
return angle::Result::Continue;
diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.h b/src/libANGLE/renderer/vulkan/vk_cache_utils.h
index feb96e1..86f1cc8 100644
--- a/src/libANGLE/renderer/vulkan/vk_cache_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.h
@@ -25,8 +25,8 @@
using RenderPassAndSerial = ObjectAndSerial<RenderPass>;
using PipelineAndSerial = ObjectAndSerial<Pipeline>;
-using SharedDescriptorSetLayout = RefCounted<DescriptorSetLayout>;
-using SharedPipelineLayout = RefCounted<PipelineLayout>;
+using RefCountedDescriptorSetLayout = RefCounted<DescriptorSetLayout>;
+using RefCountedPipelineLayout = RefCounted<PipelineLayout>;
// Packed Vk resource descriptions.
// Most Vk types use many more bits than required to represent the underlying data.
@@ -772,7 +772,7 @@
vk::BindingPointer<vk::DescriptorSetLayout> *descriptorSetLayoutOut);
private:
- std::unordered_map<vk::DescriptorSetLayoutDesc, vk::SharedDescriptorSetLayout> mPayload;
+ std::unordered_map<vk::DescriptorSetLayoutDesc, vk::RefCountedDescriptorSetLayout> mPayload;
};
class PipelineLayoutCache final : angle::NonCopyable
@@ -789,7 +789,7 @@
vk::BindingPointer<vk::PipelineLayout> *pipelineLayoutOut);
private:
- std::unordered_map<vk::PipelineLayoutDesc, vk::SharedPipelineLayout> mPayload;
+ std::unordered_map<vk::PipelineLayoutDesc, vk::RefCountedPipelineLayout> mPayload;
};
// Some descriptor set and pipeline layout constants.
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
index 997fd63..8ba4f80 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
@@ -516,13 +516,13 @@
mPoolSizes[i].descriptorCount *= mMaxSetsPerPool;
}
- mDescriptorPools.push_back(new SharedDescriptorPoolHelper());
+ mDescriptorPools.push_back(new RefCountedDescriptorPoolHelper());
return mDescriptorPools[0]->get().init(context, mPoolSizes, mMaxSetsPerPool);
}
void DynamicDescriptorPool::destroy(VkDevice device)
{
- for (SharedDescriptorPoolHelper *pool : mDescriptorPools)
+ for (RefCountedDescriptorPoolHelper *pool : mDescriptorPools)
{
ASSERT(!pool->isReferenced());
pool->get().destroy(device);
@@ -535,7 +535,7 @@
angle::Result DynamicDescriptorPool::allocateSets(Context *context,
const VkDescriptorSetLayout *descriptorSetLayout,
uint32_t descriptorSetCount,
- SharedDescriptorPoolBinding *bindingOut,
+ RefCountedDescriptorPoolBinding *bindingOut,
VkDescriptorSet *descriptorSetsOut)
{
if (!bindingOut->valid() || !bindingOut->get().hasCapacity(descriptorSetCount))
@@ -580,7 +580,7 @@
if (!found)
{
- mDescriptorPools.push_back(new SharedDescriptorPoolHelper());
+ mDescriptorPools.push_back(new RefCountedDescriptorPoolHelper());
mCurrentPoolIndex = mDescriptorPools.size() - 1;
static constexpr size_t kMaxPools = 99999;
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.h b/src/libANGLE/renderer/vulkan/vk_helpers.h
index 40a8338..b0853a8 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.h
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.h
@@ -126,8 +126,8 @@
Serial mMostRecentSerial;
};
-using SharedDescriptorPoolHelper = RefCounted<DescriptorPoolHelper>;
-using SharedDescriptorPoolBinding = BindingPointer<DescriptorPoolHelper>;
+using RefCountedDescriptorPoolHelper = RefCounted<DescriptorPoolHelper>;
+using RefCountedDescriptorPoolBinding = BindingPointer<DescriptorPoolHelper>;
class DynamicDescriptorPool final : angle::NonCopyable
{
@@ -148,7 +148,7 @@
angle::Result allocateSets(Context *context,
const VkDescriptorSetLayout *descriptorSetLayout,
uint32_t descriptorSetCount,
- SharedDescriptorPoolBinding *bindingOut,
+ RefCountedDescriptorPoolBinding *bindingOut,
VkDescriptorSet *descriptorSetsOut);
// For testing only!
@@ -159,7 +159,7 @@
uint32_t mMaxSetsPerPool;
size_t mCurrentPoolIndex;
- std::vector<SharedDescriptorPoolHelper *> mDescriptorPools;
+ std::vector<RefCountedDescriptorPoolHelper *> mDescriptorPools;
std::vector<VkDescriptorPoolSize> mPoolSizes;
};