MCPcopy Create free account
hub / github.com/InoriRus/Kyty / UtilFillImage

Function UtilFillImage

source/emulator/src/Graphics/Utils.cpp:317–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317void 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
350void UtilFillBuffer(GraphicContext* ctx, void* dst_data, uint64_t size, uint32_t dst_pitch, VulkanImage* src_image, uint64_t src_layout)
351{

Callers 6

update_funcFunction · 0.85
update_funcFunction · 0.85
update_funcFunction · 0.85
update2_funcFunction · 0.85
update_funcFunction · 0.85
update2_funcFunction · 0.85

Calls 12

VulkanCreateBufferFunction · 0.85
VulkanMapMemoryFunction · 0.85
memcpyFunction · 0.85
VulkanUnmapMemoryFunction · 0.85
UtilBufferToImageFunction · 0.85
VulkanDeleteBufferFunction · 0.85
UtilImageToImageFunction · 0.85
WaitForFenceMethod · 0.80
IsInvalidMethod · 0.45
BeginMethod · 0.45
EndMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected