summaryrefslogtreecommitdiffstats
path: root/drivers/vulkan/rendering_device_vulkan.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vulkan/rendering_device_vulkan.h')
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index 7c514c11f8..e8ad0e4f45 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -43,7 +43,7 @@
#define _DEBUG
#endif
#endif
-#include "vk_mem_alloc.h"
+#include "thirdparty/vulkan/vk_mem_alloc.h"
#ifdef USE_VOLK
#include <volk.h>
@@ -159,7 +159,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
RID owner;
};
- RID_Owner<Texture, true> texture_owner;
+ RID_Owner<Texture> texture_owner;
uint32_t texture_upload_region_size_px = 0;
Vector<uint8_t> _texture_get_data_from_image(Texture *tex, VkImage p_image, VmaAllocation p_allocation, uint32_t p_layer, bool p_2d = false);
@@ -409,7 +409,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t view_count;
};
- RID_Owner<Framebuffer, true> framebuffer_owner;
+ RID_Owner<Framebuffer> framebuffer_owner;
/***********************/
/**** VERTEX BUFFER ****/
@@ -424,7 +424,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
// This mapping is done here internally, and it's not
// exposed.
- RID_Owner<Buffer, true> vertex_buffer_owner;
+ RID_Owner<Buffer> vertex_buffer_owner;
struct VertexDescriptionKey {
Vector<VertexAttribute> vertex_formats;
@@ -506,7 +506,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
Vector<VkDeviceSize> offsets;
};
- RID_Owner<VertexArray, true> vertex_array_owner;
+ RID_Owner<VertexArray> vertex_array_owner;
struct IndexBuffer : public Buffer {
uint32_t max_index = 0; // Used for validation.
@@ -515,7 +515,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
bool supports_restart_indices = false;
};
- RID_Owner<IndexBuffer, true> index_buffer_owner;
+ RID_Owner<IndexBuffer> index_buffer_owner;
struct IndexArray {
uint32_t max_index = 0; // Remember the maximum index here too, for validation.
@@ -526,7 +526,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
bool supports_restart_indices = false;
};
- RID_Owner<IndexArray, true> index_array_owner;
+ RID_Owner<IndexArray> index_array_owner;
/****************/
/**** SHADER ****/
@@ -649,7 +649,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
String _shader_uniform_debug(RID p_shader, int p_set = -1);
- RID_Owner<Shader, true> shader_owner;
+ RID_Owner<Shader> shader_owner;
/******************/
/**** UNIFORMS ****/
@@ -713,8 +713,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, true> uniform_buffer_owner;
- RID_Owner<Buffer, true> storage_buffer_owner;
+ RID_Owner<Buffer> uniform_buffer_owner;
+ RID_Owner<Buffer> storage_buffer_owner;
// Texture buffer needs a view.
struct TextureBuffer {
@@ -722,7 +722,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkBufferView view = VK_NULL_HANDLE;
};
- RID_Owner<TextureBuffer, true> texture_buffer_owner;
+ RID_Owner<TextureBuffer> 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
@@ -752,7 +752,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
void *invalidated_callback_userdata = nullptr;
};
- RID_Owner<UniformSet, true> uniform_set_owner;
+ RID_Owner<UniformSet> uniform_set_owner;
/*******************/
/**** PIPELINES ****/
@@ -791,7 +791,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t push_constant_stages_mask = 0;
};
- RID_Owner<RenderPipeline, true> render_pipeline_owner;
+ RID_Owner<RenderPipeline> render_pipeline_owner;
struct PipelineCacheHeader {
uint32_t magic;
@@ -830,7 +830,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
uint32_t local_group_size[3] = { 0, 0, 0 };
};
- RID_Owner<ComputePipeline, true> compute_pipeline_owner;
+ RID_Owner<ComputePipeline> compute_pipeline_owner;
/*******************/
/**** DRAW LIST ****/
@@ -931,7 +931,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
void _draw_list_insert_clear_region(DrawList *p_draw_list, Framebuffer *p_framebuffer, Point2i p_viewport_offset, Point2i p_viewport_size, bool p_clear_color, const Vector<Color> &p_clear_colors, bool p_clear_depth, float p_depth, uint32_t p_stencil);
Error _draw_list_setup_framebuffer(Framebuffer *p_framebuffer, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, VkFramebuffer *r_framebuffer, VkRenderPass *r_render_pass, uint32_t *r_subpass_count);
- Error _draw_list_render_pass_begin(Framebuffer *framebuffer, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, const Vector<Color> &p_clear_colors, float p_clear_depth, uint32_t p_clear_stencil, Point2i viewport_offset, Point2i viewport_size, VkFramebuffer vkframebuffer, VkRenderPass render_pass, VkCommandBuffer command_buffer, VkSubpassContents subpass_contents, const Vector<RID> &p_storage_textures);
+ Error _draw_list_render_pass_begin(Framebuffer *framebuffer, InitialAction p_initial_color_action, FinalAction p_final_color_action, InitialAction p_initial_depth_action, FinalAction p_final_depth_action, const Vector<Color> &p_clear_colors, float p_clear_depth, uint32_t p_clear_stencil, Point2i viewport_offset, Point2i viewport_size, VkFramebuffer vkframebuffer, VkRenderPass render_pass, VkCommandBuffer command_buffer, VkSubpassContents subpass_contents, const Vector<RID> &p_storage_textures, bool p_constrained_to_region);
_FORCE_INLINE_ DrawList *_get_draw_list_ptr(DrawListID p_id);
Buffer *_get_buffer_from_owner(RID p_buffer, VkPipelineStageFlags &dst_stage_mask, VkAccessFlags &dst_access, BitField<BarrierMask> p_post_barrier);
Error _draw_list_allocate(const Rect2i &p_viewport, uint32_t p_splits, uint32_t p_subpass);
@@ -1015,8 +1015,13 @@ class RenderingDeviceVulkan : public RenderingDevice {
List<ComputePipeline> compute_pipelines_to_dispose_of;
VkCommandPool command_pool = VK_NULL_HANDLE;
- VkCommandBuffer setup_command_buffer = VK_NULL_HANDLE; // Used at the beginning of every frame for set-up.
- VkCommandBuffer draw_command_buffer = VK_NULL_HANDLE; // Used at the beginning of every frame for set-up.
+ // Used for filling up newly created buffers with data provided on creation.
+ // Primarily intended to be accessed by worker threads.
+ // Ideally this cmd buffer should use an async transfer queue.
+ VkCommandBuffer setup_command_buffer = VK_NULL_HANDLE;
+ // The main cmd buffer for drawing and compute.
+ // Primarily intended to be used by the main thread to do most stuff.
+ VkCommandBuffer draw_command_buffer = VK_NULL_HANDLE;
struct Timestamp {
String description;