summaryrefslogtreecommitdiff
path: root/drivers/vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vulkan')
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp60
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h22
-rw-r--r--drivers/vulkan/vulkan_context.h4
3 files changed, 43 insertions, 43 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 5102eab979..23c2d764b8 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -132,13 +132,13 @@ static void update_external_dependency_for_store(VkSubpassDependency &dependency
void RenderingDeviceVulkan::_add_dependency(RID p_id, RID p_depends_on) {
if (!dependency_map.has(p_depends_on)) {
- dependency_map[p_depends_on] = Set<RID>();
+ dependency_map[p_depends_on] = RBSet<RID>();
}
dependency_map[p_depends_on].insert(p_id);
if (!reverse_dependency_map.has(p_id)) {
- reverse_dependency_map[p_id] = Set<RID>();
+ reverse_dependency_map[p_id] = RBSet<RID>();
}
reverse_dependency_map[p_id].insert(p_depends_on);
@@ -147,26 +147,26 @@ void RenderingDeviceVulkan::_add_dependency(RID p_id, RID p_depends_on) {
void RenderingDeviceVulkan::_free_dependencies(RID p_id) {
//direct dependencies must be freed
- Map<RID, Set<RID>>::Element *E = dependency_map.find(p_id);
+ HashMap<RID, RBSet<RID>>::Iterator E = dependency_map.find(p_id);
if (E) {
- while (E->get().size()) {
- free(E->get().front()->get());
+ while (E->value.size()) {
+ free(E->value.front()->get());
}
- dependency_map.erase(E);
+ dependency_map.remove(E);
}
//reverse dependencies must be unreferenced
E = reverse_dependency_map.find(p_id);
if (E) {
- for (Set<RID>::Element *F = E->get().front(); F; F = F->next()) {
- Map<RID, Set<RID>>::Element *G = dependency_map.find(F->get());
+ for (RBSet<RID>::Element *F = E->value.front(); F; F = F->next()) {
+ HashMap<RID, RBSet<RID>>::Iterator G = dependency_map.find(F->get());
ERR_CONTINUE(!G);
- ERR_CONTINUE(!G->get().has(p_id));
- G->get().erase(p_id);
+ ERR_CONTINUE(!G->value.has(p_id));
+ G->value.erase(p_id);
}
- reverse_dependency_map.erase(E);
+ reverse_dependency_map.remove(E);
}
}
@@ -3856,7 +3856,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
key.passes = p_passes;
key.view_count = p_view_count;
- const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
+ const RBMap<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
if (E) {
//exists, return
return E->get();
@@ -3884,7 +3884,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
FramebufferFormatKey key;
key.passes.push_back(FramebufferPass());
- const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
+ const RBMap<FramebufferFormatKey, FramebufferFormatID>::Element *E = framebuffer_format_cache.find(key);
if (E) {
//exists, return
return E->get();
@@ -3935,11 +3935,11 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_format_c
}
RenderingDevice::TextureSamples RenderingDeviceVulkan::framebuffer_format_get_texture_samples(FramebufferFormatID p_format, uint32_t p_pass) {
- Map<FramebufferFormatID, FramebufferFormat>::Element *E = framebuffer_formats.find(p_format);
+ HashMap<FramebufferFormatID, FramebufferFormat>::Iterator E = framebuffer_formats.find(p_format);
ERR_FAIL_COND_V(!E, TEXTURE_SAMPLES_1);
- ERR_FAIL_COND_V(p_pass >= uint32_t(E->get().pass_samples.size()), TEXTURE_SAMPLES_1);
+ ERR_FAIL_COND_V(p_pass >= uint32_t(E->value.pass_samples.size()), TEXTURE_SAMPLES_1);
- return E->get().pass_samples[p_pass];
+ return E->value.pass_samples[p_pass];
}
/***********************/
@@ -4138,7 +4138,7 @@ RenderingDevice::VertexFormatID RenderingDeviceVulkan::vertex_format_create(cons
vdcache.bindings = memnew_arr(VkVertexInputBindingDescription, p_vertex_formats.size());
vdcache.attributes = memnew_arr(VkVertexInputAttributeDescription, p_vertex_formats.size());
- Set<int> used_locations;
+ RBSet<int> used_locations;
for (int i = 0; i < p_vertex_formats.size(); i++) {
ERR_CONTINUE(p_vertex_formats[i].format >= DATA_FORMAT_MAX);
ERR_FAIL_COND_V(used_locations.has(p_vertex_formats[i].location), INVALID_ID);
@@ -5292,7 +5292,7 @@ RID RenderingDeviceVulkan::shader_create_from_bytecode(const Vector<uint8_t> &p_
//has data, needs an actual format;
UniformSetFormat usformat;
usformat.uniform_info = set.uniform_info;
- Map<UniformSetFormat, uint32_t>::Element *E = uniform_set_format_cache.find(usformat);
+ RBMap<UniformSetFormat, uint32_t>::Element *E = uniform_set_format_cache.find(usformat);
if (E) {
format = E->get();
} else {
@@ -5468,12 +5468,12 @@ RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataF
RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_allocate(const DescriptorPoolKey &p_key) {
if (!descriptor_pools.has(p_key)) {
- descriptor_pools[p_key] = Set<DescriptorPool *>();
+ descriptor_pools[p_key] = RBSet<DescriptorPool *>();
}
DescriptorPool *pool = nullptr;
- for (Set<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) {
+ for (RBSet<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) {
if (E->get()->usage < max_descriptors_per_pool) {
pool = E->get();
break;
@@ -8349,7 +8349,7 @@ void RenderingDeviceVulkan::compute_list_end(uint32_t p_post_barrier) {
uint32_t barrier_idx = 0;
- for (Set<Texture *>::Element *E = compute_list->state.textures_to_sampled_layout.front(); E; E = E->next()) {
+ for (RBSet<Texture *>::Element *E = compute_list->state.textures_to_sampled_layout.front(); E; E = E->next()) {
VkImageMemoryBarrier &image_memory_barrier = image_barriers[barrier_idx++];
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
image_memory_barrier.pNext = nullptr;
@@ -9477,21 +9477,21 @@ void RenderingDeviceVulkan::finalize() {
vmaDestroyBuffer(allocator, staging_buffer_blocks[i].buffer, staging_buffer_blocks[i].allocation);
}
while (small_allocs_pools.size()) {
- Map<uint32_t, VmaPool>::Element *E = small_allocs_pools.front();
- vmaDestroyPool(allocator, E->get());
- small_allocs_pools.erase(E);
+ HashMap<uint32_t, VmaPool>::Iterator E = small_allocs_pools.begin();
+ vmaDestroyPool(allocator, E->value);
+ small_allocs_pools.remove(E);
}
vmaDestroyAllocator(allocator);
while (vertex_formats.size()) {
- Map<VertexFormatID, VertexDescriptionCache>::Element *temp = vertex_formats.front();
- memdelete_arr(temp->get().bindings);
- memdelete_arr(temp->get().attributes);
- vertex_formats.erase(temp);
+ HashMap<VertexFormatID, VertexDescriptionCache>::Iterator temp = vertex_formats.begin();
+ memdelete_arr(temp->value.bindings);
+ memdelete_arr(temp->value.attributes);
+ vertex_formats.remove(temp);
}
- for (int i = 0; i < framebuffer_formats.size(); i++) {
- vkDestroyRenderPass(device, framebuffer_formats[i].render_pass, nullptr);
+ for (KeyValue<FramebufferFormatID, FramebufferFormat> &E : framebuffer_formats) {
+ vkDestroyRenderPass(device, E.value.render_pass, nullptr);
}
framebuffer_formats.clear();
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index 236742c15d..601c44c728 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -101,8 +101,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkDevice device = VK_NULL_HANDLE;
- Map<RID, Set<RID>> dependency_map; //IDs to IDs that depend on it
- Map<RID, Set<RID>> reverse_dependency_map; //same as above, but in reverse
+ HashMap<RID, RBSet<RID>> dependency_map; //IDs to IDs that depend on it
+ HashMap<RID, RBSet<RID>> reverse_dependency_map; //same as above, but in reverse
void _add_dependency(RID p_id, RID p_depends_on);
void _free_dependencies(RID p_id);
@@ -349,15 +349,15 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_attachments, const Vector<FramebufferPass> &p_passes, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, uint32_t p_view_count = 1, Vector<TextureSamples> *r_samples = nullptr);
// This is a cache and it's never freed, it ensures
// IDs for a given format are always unique.
- Map<FramebufferFormatKey, FramebufferFormatID> framebuffer_format_cache;
+ RBMap<FramebufferFormatKey, FramebufferFormatID> framebuffer_format_cache;
struct FramebufferFormat {
- const Map<FramebufferFormatKey, FramebufferFormatID>::Element *E;
+ const RBMap<FramebufferFormatKey, FramebufferFormatID>::Element *E;
VkRenderPass render_pass = VK_NULL_HANDLE; //here for constructing shaders, never used, see section (7.2. Render Pass Compatibility from Vulkan spec)
Vector<TextureSamples> pass_samples;
uint32_t view_count = 1; // number of views
};
- Map<FramebufferFormatID, FramebufferFormat> framebuffer_formats;
+ HashMap<FramebufferFormatID, FramebufferFormat> framebuffer_formats;
struct Framebuffer {
FramebufferFormatID format_id = 0;
@@ -398,7 +398,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t subpass_count = 1;
};
- Map<VersionKey, Version> framebuffers;
+ RBMap<VersionKey, Version> framebuffers;
Size2 size;
uint32_t view_count;
};
@@ -488,7 +488,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkPipelineVertexInputStateCreateInfo create_info;
};
- Map<VertexFormatID, VertexDescriptionCache> vertex_formats;
+ HashMap<VertexFormatID, VertexDescriptionCache> vertex_formats;
struct VertexArray {
RID buffer;
@@ -592,7 +592,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
// Always grows, never shrinks, ensuring unique IDs, but we assume
// the amount of formats will never be a problem, as the amount of shaders
// in a game is limited.
- Map<UniformSetFormat, uint32_t> uniform_set_format_cache;
+ RBMap<UniformSetFormat, uint32_t> uniform_set_format_cache;
// Shaders in Vulkan are just pretty much
// precompiled blocks of SPIR-V bytecode. They
@@ -702,7 +702,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t usage;
};
- Map<DescriptorPoolKey, Set<DescriptorPool *>> descriptor_pools;
+ RBMap<DescriptorPoolKey, RBSet<DescriptorPool *>> descriptor_pools;
uint32_t max_descriptors_per_pool = 0;
DescriptorPool *_descriptor_pool_allocate(const DescriptorPoolKey &p_key);
@@ -923,7 +923,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
};
struct State {
- Set<Texture *> textures_to_sampled_layout;
+ RBSet<Texture *> textures_to_sampled_layout;
SetState sets[MAX_UNIFORM_SETS];
uint32_t set_count = 0;
RID pipeline;
@@ -1016,7 +1016,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
void _free_pending_resources(int p_frame);
VmaAllocator allocator = nullptr;
- Map<uint32_t, VmaPool> small_allocs_pools;
+ HashMap<uint32_t, VmaPool> small_allocs_pools;
VmaPool _find_or_create_small_allocs_pool(uint32_t p_mem_type_index);
VulkanContext *context = nullptr;
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index 6858eb7524..236e3bf35f 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -34,7 +34,7 @@
#include "core/error/error_list.h"
#include "core/os/mutex.h"
#include "core/string/ustring.h"
-#include "core/templates/map.h"
+#include "core/templates/rb_map.h"
#include "core/templates/rid_owner.h"
#include "servers/display_server.h"
#include "servers/rendering/rendering_device.h"
@@ -161,7 +161,7 @@ private:
RID_Owner<LocalDevice, true> local_device_owner;
- Map<DisplayServer::WindowID, Window> windows;
+ HashMap<DisplayServer::WindowID, Window> windows;
uint32_t swapchainImageCount = 0;
// Commands.