32 VKBuffer &buffer = ensure_space(bytes_needed, offset_alignment);
35 current_subbuffer_len_ = bytes_needed;
37 return data + buffer_offset_;
48 uchar *first_vertex_ptr =
static_cast<uchar *
>(active_buffer_->mapped_memory_get()) +
50 size_t vertex_stride = current_subbuffer_len_ / (
vertex_len + 1);
52 memcpy(last_vertex_ptr, first_vertex_ptr, vertex_stride);
62 VKBuffer &buffer = active_buffer_.value();
82 vertex_attributes_.update_bindings(*
this);
84 VKFrameBuffer &framebuffer = *context.active_framebuffer_get();
90 node.data.instance_count = 1;
91 node.data.first_vertex = 0;
92 node.data.first_instance = 0;
94 vertex_attributes_.bind(
node.data.vertex_buffers);
95 context.update_pipeline_data(
96 framebuffer,
prim_type, vertex_attributes_.vertex_input_key,
node.data.graphics);
102 buffer_offset_ += current_subbuffer_len_;
103 current_subbuffer_len_ = 0;
112VkDeviceSize VKImmediate::buffer_bytes_free()
114 return active_buffer_->size_in_bytes() - buffer_offset_;
122VKBuffer &VKImmediate::ensure_space(VkDeviceSize bytes_needed, VkDeviceSize offset_alignment)
127 if (active_buffer_.has_value() && buffer_bytes_free() >= bytes_required) {
128 return active_buffer_.value();
134 "Immediate buffer cannot hold another %d bytes, it contains %d bytes. A new "
135 "buffer will be allocated (size=%d)",
140 VKBuffer &
result = active_buffer_.emplace();
142 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT |
143 VK_BUFFER_USAGE_TRANSFER_DST_BIT,
144 VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
145 VMA_ALLOCATION_CREATE_MAPPED_BIT |
146 VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
#define CLOG_TRACE(clg_ref,...)
#define BLI_assert_msg(a, msg)
void * mapped_memory_get() const
VKVertexInputDescriptionPool vertex_input_descriptions
void rendering_ensure(VKContext &context)
void storage_buffer_bind(BindSpaceStorageBuffers::Type resource_type, void *resource, int binding)
VKDrawCreateInfo CreateInfo
VKNodeData< NodeInfo > alloc_node()
#define GPU_SSBO_POLYLINE_POS_BUF_SLOT
#define GPU_SSBO_POLYLINE_COL_BUF_SLOT
#define GPU_SSBO_INDEX_BUF_SLOT
constexpr size_t DEFAULT_INTERNAL_BUFFER_SIZE
static VkDeviceSize new_buffer_size(VkDeviceSize sub_buffer_size)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE unsigned long long max_ulul(unsigned long long a, unsigned long long b)
void GPU_matrix_bind(gpu::Shader *shader)
size_t GPU_storage_buffer_alignment()
MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b)
BMesh const char void * data
uint vertex_buffer_size(const GPUVertFormat *format, uint vertex_len)