| 315 | } |
| 316 | |
| 317 | void UtilFillImage(GraphicContext* ctx, VulkanImage* dst_image, const void* src_data, uint64_t size, uint32_t src_pitch, |
| 318 | uint64_t dst_layout) |
| 319 | { |
| 320 | KYTY_PROFILER_FUNCTION(); |
| 321 | |
| 322 | EXIT_IF(ctx == nullptr); |
| 323 | EXIT_IF(dst_image == nullptr); |
| 324 | EXIT_IF(src_data == nullptr); |
| 325 | |
| 326 | VulkanBuffer staging_buffer {}; |
| 327 | staging_buffer.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; |
| 328 | staging_buffer.memory.property = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; |
| 329 | VulkanCreateBuffer(ctx, size, &staging_buffer); |
| 330 | |
| 331 | void* data = nullptr; |
| 332 | VulkanMapMemory(ctx, &staging_buffer.memory, &data); |
| 333 | std::memcpy(data, src_data, size); |
| 334 | VulkanUnmapMemory(ctx, &staging_buffer.memory); |
| 335 | |
| 336 | CommandBuffer buffer(GraphicContext::QUEUE_UTIL); |
| 337 | // buffer.SetQueue(GraphicContext::QUEUE_UTIL); |
| 338 | |
| 339 | EXIT_NOT_IMPLEMENTED(buffer.IsInvalid()); |
| 340 | |
| 341 | buffer.Begin(); |
| 342 | UtilBufferToImage(&buffer, &staging_buffer, src_pitch, dst_image, dst_layout); |
| 343 | buffer.End(); |
| 344 | buffer.Execute(); |
| 345 | buffer.WaitForFence(); |
| 346 | |
| 347 | VulkanDeleteBuffer(ctx, &staging_buffer); |
| 348 | } |
| 349 | |
| 350 | void UtilFillBuffer(GraphicContext* ctx, void* dst_data, uint64_t size, uint32_t dst_pitch, VulkanImage* src_image, uint64_t src_layout) |
| 351 | { |
no test coverage detected