summaryrefslogtreecommitdiff
path: root/drivers/vulkan
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-07-29 12:59:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 11:53:29 +0100
commitc613ead5fa2361296cf8d9a80d4648492ff4e16f (patch)
tree974356b6840ecf764415d43277ef78ad3c6b6373 /drivers/vulkan
parent4fe3ee1730167b90ec8ae70c871c1dad032981d5 (diff)
Added a spinlock template as well as a thread work pool class.
Also, optimized shader compilation to happen on threads.
Diffstat (limited to 'drivers/vulkan')
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp4
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h26
2 files changed, 15 insertions, 15 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index f6154a3cbd..a14d45067a 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -3448,8 +3448,6 @@ bool RenderingDeviceVulkan::_uniform_add_binding(Vector<Vector<VkDescriptorSetLa
RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages) {
- _THREAD_SAFE_METHOD_
-
//descriptor layouts
Vector<Vector<VkDescriptorSetLayoutBinding> > set_bindings;
Vector<Vector<UniformInfo> > uniform_info;
@@ -3694,6 +3692,8 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
//all good, let's create modules
+ _THREAD_SAFE_METHOD_
+
Shader shader;
shader.vertex_input_locations = vertex_input_locations;
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index 5b3b7a5f47..87971ba2b8 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -114,7 +114,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
RID owner;
};
- RID_Owner<Texture> texture_owner;
+ RID_Owner<Texture, true> texture_owner;
uint32_t texture_upload_region_size_px;
PoolVector<uint8_t> _texture_get_data_from_image(Texture *tex, VkImage p_image, VmaAllocation p_allocation, uint32_t p_layer);
@@ -264,7 +264,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
Size2 size;
};
- RID_Owner<Framebuffer> framebuffer_owner;
+ RID_Owner<Framebuffer, true> framebuffer_owner;
/***********************/
/**** VERTEX BUFFER ****/
@@ -279,7 +279,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
// This mapping is done here internally, and it's not
// exposed.
- RID_Owner<Buffer> vertex_buffer_owner;
+ RID_Owner<Buffer, true> vertex_buffer_owner;
struct VertexDescriptionKey {
Vector<VertexDescription> vertex_formats;
@@ -359,7 +359,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
Vector<VkDeviceSize> offsets;
};
- RID_Owner<VertexArray> vertex_array_owner;
+ RID_Owner<VertexArray, true> vertex_array_owner;
struct IndexBuffer : public Buffer {
uint32_t max_index; //used for validation
@@ -368,7 +368,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
bool supports_restart_indices;
};
- RID_Owner<IndexBuffer> index_buffer_owner;
+ RID_Owner<IndexBuffer, true> index_buffer_owner;
struct IndexArray {
uint32_t max_index; //remember the maximum index here too, for validation
@@ -379,7 +379,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
bool supports_restart_indices;
};
- RID_Owner<IndexArray> index_array_owner;
+ RID_Owner<IndexArray, true> index_array_owner;
/****************/
/**** SHADER ****/
@@ -495,7 +495,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
String _shader_uniform_debug(RID p_shader, int p_set = -1);
- RID_Owner<Shader> shader_owner;
+ RID_Owner<Shader, true> shader_owner;
/******************/
/**** UNIFORMS ****/
@@ -559,8 +559,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
DescriptorPool *_descriptor_pool_allocate(const DescriptorPoolKey &p_key);
void _descriptor_pool_free(const DescriptorPoolKey &p_key, DescriptorPool *p_pool);
- RID_Owner<Buffer> uniform_buffer_owner;
- RID_Owner<Buffer> storage_buffer_owner;
+ RID_Owner<Buffer, true> uniform_buffer_owner;
+ RID_Owner<Buffer, true> storage_buffer_owner;
//texture buffer needs a view
struct TextureBuffer {
@@ -568,7 +568,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkBufferView view;
};
- RID_Owner<TextureBuffer> texture_buffer_owner;
+ RID_Owner<TextureBuffer, true> texture_buffer_owner;
// This structure contains the descriptor set. They _need_ to be allocated
// for a shader (and will be erased when this shader is erased), but should
@@ -589,7 +589,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
Vector<RID> attachable_textures; //used for validation
};
- RID_Owner<UniformSet> uniform_set_owner;
+ RID_Owner<UniformSet, true> uniform_set_owner;
/*******************/
/**** PIPELINES ****/
@@ -607,7 +607,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
// was not supplied as intended.
struct RenderPipeline {
- //Cached values for validation
+ //Cached values for validation
#ifdef DEBUG_ENABLED
struct Validation {
FramebufferFormatID framebuffer_format;
@@ -627,7 +627,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t push_constant_stages;
};
- RID_Owner<RenderPipeline> pipeline_owner;
+ RID_Owner<RenderPipeline, true> pipeline_owner;
/*******************/
/**** DRAW LIST ****/