working on texts and fonts

This commit is contained in:
2024-10-27 01:14:07 +02:00
parent 3aaa5df929
commit 028cb57ff4
31 changed files with 414 additions and 187 deletions

View File

@@ -15,7 +15,7 @@ namespace mlx
{
if(data.Empty())
{
Warning("Vulkan : trying to create constant buffer without data (constant buffers cannot be modified after creation)");
Warning("Vulkan: trying to create constant buffer without data (constant buffers cannot be modified after creation)");
return;
}
m_usage = usage | VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
@@ -70,12 +70,12 @@ namespace mlx
MLX_PROFILE_FUNCTION();
if(!(m_usage & VK_BUFFER_USAGE_TRANSFER_DST_BIT))
{
Error("Vulkan : buffer cannot be the destination of a copy because it does not have the correct usage flag");
Error("Vulkan: buffer cannot be the destination of a copy because it does not have the correct usage flag");
return false;
}
if(!(buffer.m_usage & VK_BUFFER_USAGE_TRANSFER_SRC_BIT))
{
Error("Vulkan : buffer cannot be the source of a copy because it does not have the correct usage flag");
Error("Vulkan: buffer cannot be the source of a copy because it does not have the correct usage flag");
return false;
}
@@ -108,7 +108,7 @@ namespace mlx
if(new_buffer.CopyFrom(*this))
Swap(new_buffer);
new_buffer.Destroy();
DebugLog("Vulkan : pushed buffer to GPU memory");
DebugLog("Vulkan: pushed buffer to GPU memory");
}
void GPUBuffer::Destroy() noexcept
@@ -141,12 +141,12 @@ namespace mlx
MLX_PROFILE_FUNCTION();
if(data.GetSize() > m_size)
{
Error("Vulkan : trying to store to much data in a vertex buffer (% bytes in % bytes)", data.GetSize(), m_size);
Error("Vulkan: trying to store to much data in a vertex buffer (% bytes in % bytes)", data.GetSize(), m_size);
return;
}
if(data.Empty())
{
Warning("Vulkan : cannot set empty data in a vertex buffer");
Warning("Vulkan: cannot set empty data in a vertex buffer");
return;
}
GPUBuffer staging;
@@ -164,12 +164,12 @@ namespace mlx
MLX_PROFILE_FUNCTION();
if(data.GetSize() > m_size)
{
Error("Vulkan : trying to store to much data in an index buffer (% bytes in % bytes)", data.GetSize(), m_size);
Error("Vulkan: trying to store to much data in an index buffer (% bytes in % bytes)", data.GetSize(), m_size);
return;
}
if(data.Empty())
{
Warning("Vulkan : cannot set empty data in an index buffer");
Warning("Vulkan: cannot set empty data in an index buffer");
return;
}
GPUBuffer staging;
@@ -194,7 +194,7 @@ namespace mlx
#endif
m_maps[i] = m_buffers[i].GetMap();
if(m_maps[i] == nullptr)
FatalError("Vulkan : unable to map a uniform buffer");
FatalError("Vulkan: unable to map a uniform buffer");
}
}
@@ -203,7 +203,7 @@ namespace mlx
MLX_PROFILE_FUNCTION();
if(data.GetSize() != m_buffers[frame_index].GetSize())
{
Error("Vulkan : invalid data size to update to a uniform buffer, % != %", data.GetSize(), m_buffers[frame_index].GetSize());
Error("Vulkan: invalid data size to update to a uniform buffer, % != %", data.GetSize(), m_buffers[frame_index].GetSize());
return;
}
if(m_maps[frame_index] != nullptr)

View File

@@ -19,7 +19,7 @@ namespace mlx
if(image.GetType() == ImageType::Color)
image.TransitionLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, cmd);
else
Error("Vulkan : cannot transition descriptor image layout, unkown image type");
Error("Vulkan: cannot transition descriptor image layout, unkown image type");
}
void DescriptorPool::Init() noexcept
@@ -128,7 +128,7 @@ namespace mlx
});
if(it == m_used_sets.end())
{
Error("Vulkan : cannot return descriptor set to pool, invalid pool");
Error("Vulkan: cannot return descriptor set to pool, invalid pool");
return;
}
m_used_sets.erase(it);
@@ -182,12 +182,12 @@ namespace mlx
});
if(it == m_descriptors.end())
{
Warning("Vulkan : cannot update descriptor set image; invalid binding");
Warning("Vulkan: cannot update descriptor set image; invalid binding");
return;
}
if(it->type != VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)
{
Error("Vulkan : trying to bind an image to the wrong descriptor");
Error("Vulkan: trying to bind an image to the wrong descriptor");
return;
}
it->image_ptr = ℑ
@@ -203,12 +203,12 @@ namespace mlx
});
if(it == m_descriptors.end())
{
Warning("Vulkan : cannot update descriptor set buffer; invalid binding");
Warning("Vulkan: cannot update descriptor set buffer; invalid binding");
return;
}
if(it->type != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
{
Error("Vulkan : trying to bind a buffer to the wrong descriptor");
Error("Vulkan: trying to bind a buffer to the wrong descriptor");
return;
}
it->storage_buffer_ptr = &buffer;
@@ -224,12 +224,12 @@ namespace mlx
});
if(it == m_descriptors.end())
{
Warning("Vulkan : cannot update descriptor set buffer; invalid binding");
Warning("Vulkan: cannot update descriptor set buffer; invalid binding");
return;
}
if(it->type != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER)
{
Error("Vulkan : trying to bind a buffer to the wrong descriptor");
Error("Vulkan: trying to bind a buffer to the wrong descriptor");
return;
}
it->uniform_buffer_ptr = &buffer;

View File

@@ -14,6 +14,12 @@
#include <stb_image.h>
#endif
#ifdef IMAGE_OPTIMIZED
#define TILING VK_IMAGE_TILING_OPTIMAL
#else
#define TILING VK_IMAGE_TILING_LINEAR
#endif
namespace mlx
{
void Image::Init(ImageType type, std::uint32_t width, std::uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, bool is_multisampled, [[maybe_unused]] std::string_view debug_name)
@@ -153,7 +159,7 @@ namespace mlx
void Texture::Init(CPUBuffer pixels, std::uint32_t width, std::uint32_t height, VkFormat format, bool is_multisampled, [[maybe_unused]] std::string_view debug_name)
{
MLX_PROFILE_FUNCTION();
Image::Init(ImageType::Color, width, height, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name));
Image::Init(ImageType::Color, width, height, format, TILING, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name));
Image::CreateImageView(VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT);
Image::CreateSampler();
if(pixels)
@@ -228,7 +234,7 @@ namespace mlx
if(m_staging_buffer.has_value())
return;
#ifdef DEBUG
DebugLog("Texture : enabling CPU mapping for '%'", m_debug_name);
DebugLog("Texture: enabling CPU mapping for '%'", m_debug_name);
#endif
m_staging_buffer.emplace();
std::size_t size = m_width * m_height * kvfFormatSize(m_format);
@@ -263,12 +269,12 @@ namespace mlx
if(!std::filesystem::exists(file))
{
Error("Image : file not found %", file);
Error("Image: file not found %", file);
return nullptr;
}
if(stbi_is_hdr(filename.c_str()))
{
Error("Texture : unsupported image format % (HDR image)", file);
Error("Texture: unsupported image format % (HDR image)", file);
return nullptr;
}
int dummy_w;

View File

@@ -54,7 +54,7 @@ namespace mlx
allocator_create_info.pVulkanFunctions = &vma_vulkan_func;
kvfCheckVk(vmaCreateAllocator(&allocator_create_info, &m_allocator));
DebugLog("Graphics allocator : created new allocator");
DebugLog("Graphics Allocator: created new allocator");
}
VmaAllocation GPUAllocator::CreateBuffer(const VkBufferCreateInfo* binfo, const VmaAllocationCreateInfo* vinfo, VkBuffer& buffer, const char* name) noexcept
@@ -74,7 +74,7 @@ namespace mlx
#endif
vmaSetAllocationName(m_allocator, allocation, name);
}
DebugLog("Graphics Allocator : created new buffer '%'", name);
DebugLog("Graphics Allocator: created new buffer '%'", name);
m_active_buffers_allocations++;
return allocation;
}
@@ -85,9 +85,9 @@ namespace mlx
RenderCore::Get().WaitDeviceIdle();
vmaDestroyBuffer(m_allocator, buffer, allocation);
if(name != nullptr)
DebugLog("Graphics Allocator : destroyed buffer '%'", name);
DebugLog("Graphics Allocator: destroyed buffer '%'", name);
else
DebugLog("Graphics Allocator : destroyed buffer");
DebugLog("Graphics Allocator: destroyed buffer");
m_active_buffers_allocations--;
}
@@ -108,7 +108,7 @@ namespace mlx
#endif
vmaSetAllocationName(m_allocator, allocation, name);
}
DebugLog("Graphics Allocator : created new image '%'", name);
DebugLog("Graphics Allocator: created new image '%'", name);
m_active_images_allocations++;
return allocation;
}
@@ -119,9 +119,9 @@ namespace mlx
RenderCore::Get().WaitDeviceIdle();
vmaDestroyImage(m_allocator, image, allocation);
if(name != nullptr)
DebugLog("Graphics Allocator : destroyed image '%'", name);
DebugLog("Graphics Allocator: destroyed image '%'", name);
else
DebugLog("Graphics Allocator : destroyed image");
DebugLog("Graphics Allocator: destroyed image");
m_active_images_allocations--;
}
@@ -145,7 +145,7 @@ namespace mlx
std::ofstream file(name);
if(!file.is_open())
{
Error("Graphics allocator : unable to dump memory to a json file");
Error("Graphics Allocator: unable to dump memory to a json file");
return;
}
char* str = nullptr;
@@ -166,14 +166,14 @@ namespace mlx
{
MLX_PROFILE_FUNCTION();
if(m_active_images_allocations != 0)
Error("Graphics allocator : some user-dependant allocations were not freed before destroying the display (% active allocations). You may have not destroyed all the MLX resources you've created", m_active_images_allocations);
Error("Graphics Allocator: some user-dependant allocations were not freed before destroying the display (% active allocations). You may have not destroyed all the MLX resources you've created", m_active_images_allocations);
else if(m_active_buffers_allocations != 0)
Error("Graphics allocator : some MLX-dependant allocations were not freed before destroying the display (% active allocations). This is an error in the MLX, please report this should not happen", m_active_buffers_allocations);
Error("Graphics Allocator: some MLX-dependant allocations were not freed before destroying the display (% active allocations). This is an error in the MLX, please report this should not happen", m_active_buffers_allocations);
if(m_active_images_allocations < 0 || m_active_buffers_allocations < 0)
Warning("Graphics allocator : the impossible happened, the MLX has freed more allocations than it has made (wtf)");
Warning("Graphics Allocator: the impossible happened, the MLX has freed more allocations than it has made (wtf)");
vmaDestroyAllocator(m_allocator);
m_active_buffers_allocations = 0;
m_active_images_allocations = 0;
DebugLog("Vulkan : destroyed a graphics allocator");
DebugLog("Vulkan: destroyed a graphics allocator");
}
}

View File

@@ -11,7 +11,7 @@ namespace mlx
{
MLX_PROFILE_FUNCTION();
if(!descriptor.vertex_shader || !descriptor.fragment_shader)
FatalError("Vulkan : invalid shaders");
FatalError("Vulkan: invalid shaders");
m_attachments = descriptor.color_attachments;
p_vertex_shader = descriptor.vertex_shader;
@@ -51,7 +51,7 @@ namespace mlx
}
m_pipeline = kvfCreateGraphicsPipeline(RenderCore::Get().GetDevice(), m_pipeline_layout, builder, m_renderpass);
DebugLog("Vulkan : graphics pipeline created");
DebugLog("Vulkan: graphics pipeline created");
kvfDestroyGPipelineBuilder(builder);
#ifdef MLX_HAS_DEBUG_UTILS_FUNCTIONS
@@ -132,18 +132,18 @@ namespace mlx
for(auto& fb : m_framebuffers)
{
kvfDestroyFramebuffer(RenderCore::Get().GetDevice(), fb);
DebugLog("Vulkan : framebuffer destroyed");
DebugLog("Vulkan: framebuffer destroyed");
}
m_framebuffers.clear();
kvfDestroyPipelineLayout(RenderCore::Get().GetDevice(), m_pipeline_layout);
m_pipeline_layout = VK_NULL_HANDLE;
DebugLog("Vulkan : graphics pipeline layout destroyed");
DebugLog("Vulkan: graphics pipeline layout destroyed");
kvfDestroyRenderPass(RenderCore::Get().GetDevice(), m_renderpass);
m_renderpass = VK_NULL_HANDLE;
DebugLog("Vulkan : renderpass destroyed");
DebugLog("Vulkan: renderpass destroyed");
kvfDestroyPipeline(RenderCore::Get().GetDevice(), m_pipeline);
m_pipeline = VK_NULL_HANDLE;
DebugLog("Vulkan : graphics pipeline destroyed");
DebugLog("Vulkan: graphics pipeline destroyed");
}
void GraphicPipeline::CreateFramebuffers(const std::vector<NonOwningPtr<Texture>>& render_targets, bool clear_attachments)
@@ -167,7 +167,7 @@ namespace mlx
m_renderpass = kvfCreateRenderPass(RenderCore::Get().GetDevice(), attachments.data(), attachments.size(), GetPipelineBindPoint());
m_clears.clear();
m_clears.resize(attachments.size());
DebugLog("Vulkan : renderpass created");
DebugLog("Vulkan: renderpass created");
if(p_renderer)
{
@@ -175,14 +175,14 @@ namespace mlx
{
attachment_views[0] = image.GetImageView();
m_framebuffers.push_back(kvfCreateFramebuffer(RenderCore::Get().GetDevice(), m_renderpass, attachment_views.data(), attachment_views.size(), { .width = image.GetWidth(), .height = image.GetHeight() }));
DebugLog("Vulkan : framebuffer created");
DebugLog("Vulkan: framebuffer created");
}
}
#pragma omp parallel for
for(NonOwningPtr<Texture> image : render_targets)
{
m_framebuffers.push_back(kvfCreateFramebuffer(RenderCore::Get().GetDevice(), m_renderpass, attachment_views.data(), attachment_views.size(), { .width = image->GetWidth(), .height = image->GetHeight() }));
DebugLog("Vulkan : framebuffer created");
DebugLog("Vulkan: framebuffer created");
}
}

View File

@@ -15,7 +15,7 @@ namespace mlx
default : FatalError("wtf"); break;
}
m_module = kvfCreateShaderModule(RenderCore::Get().GetDevice(), reinterpret_cast<std::uint32_t*>(m_bytecode.data()), m_bytecode.size() / 4);
DebugLog("Vulkan : shader module created");
DebugLog("Vulkan: shader module created");
GeneratePipelineLayout(m_layout);
}
@@ -35,7 +35,7 @@ namespace mlx
bindings[i].stageFlags = m_stage;
}
m_set_layouts.emplace_back(kvfCreateDescriptorSetLayout(RenderCore::Get().GetDevice(), bindings.data(), bindings.size()));
DebugLog("Vulkan : descriptor set layout created");
DebugLog("Vulkan: descriptor set layout created");
m_pipeline_layout_part.set_layouts.push_back(m_set_layouts.back());
}
@@ -56,11 +56,11 @@ namespace mlx
{
MLX_PROFILE_FUNCTION();
kvfDestroyShaderModule(RenderCore::Get().GetDevice(), m_module);
DebugLog("Vulkan : shader module destroyed");
DebugLog("Vulkan: shader module destroyed");
for(auto& layout : m_set_layouts)
{
kvfDestroyDescriptorSetLayout(RenderCore::Get().GetDevice(), layout);
DebugLog("Vulkan : descriptor set layout destroyed");
DebugLog("Vulkan: descriptor set layout destroyed");
}
}
}

View File

@@ -69,7 +69,7 @@ namespace mlx
#endif
m_instance = kvfCreateInstance(instance_extensions.data(), instance_extensions.size());
DebugLog("Vulkan : instance created");
DebugLog("Vulkan: instance created");
loader->LoadInstance(m_instance);
LoadKVFInstanceVulkanFunctionPointers();
@@ -81,13 +81,13 @@ namespace mlx
// just for style
VkPhysicalDeviceProperties props;
vkGetPhysicalDeviceProperties(m_physical_device, &props);
DebugLog("Vulkan : physical device picked '%'", props.deviceName);
DebugLog("Vulkan: physical device picked '%'", props.deviceName);
const char* device_extensions[] = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
VkPhysicalDeviceFeatures features{};
vkGetPhysicalDeviceFeatures(m_physical_device, &features);
m_device = kvfCreateDevice(m_physical_device, device_extensions, sizeof(device_extensions) / sizeof(device_extensions[0]), &features);
DebugLog("Vulkan : logical device created");
DebugLog("Vulkan: logical device created");
loader->LoadDevice(m_device);
LoadKVFDeviceVulkanFunctionPointers();
@@ -201,9 +201,9 @@ namespace mlx
m_descriptor_pool_manager.Destroy();
m_allocator.Destroy();
kvfDestroyDevice(m_device);
DebugLog("Vulkan : logical device destroyed");
DebugLog("Vulkan: logical device destroyed");
kvfDestroyInstance(m_instance);
DebugLog("Vulkan : instance destroyed");
DebugLog("Vulkan: instance destroyed");
loader.reset();
s_instance = nullptr;

View File

@@ -92,32 +92,31 @@ namespace mlx
VkCommandBuffer cmd = renderer.GetActiveCommandBuffer();
const auto& sprites = scene.GetSprites();
const auto& drawables = scene.GetDrawables();
for(auto sprite : sprites)
for(auto drawable : drawables)
{
// Check every textures and update modified ones to GPU before starting the render pass
if(!sprite->IsSetInit())
sprite->UpdateDescriptorSet(p_texture_set);
Verify((bool)sprite->GetTexture(), "a sprite has no texture attached (internal mlx issue, please report to the devs)");
sprite->GetTexture()->Update(cmd);
if(!drawable->IsSetInit())
drawable->UpdateDescriptorSet(p_texture_set);
drawable->Update(cmd);
}
m_pipeline.BindPipeline(cmd, 0, {});
for(auto sprite : sprites)
for(auto drawable : drawables)
{
SpriteData sprite_data;
sprite_data.position = Vec4f{ sprite->GetPosition(), 0.0f, 1.0f };
sprite_data.color = sprite->GetColor();
SpriteData drawable_data;
drawable_data.position = Vec4f{ drawable->GetPosition(), 0.0f, 1.0f };
drawable_data.color = drawable->GetColor();
sprite->Bind(frame_index, cmd);
drawable->Bind(frame_index, cmd);
std::array<VkDescriptorSet, 2> sets = { p_viewer_data_set->GetSet(frame_index), sprite->GetSet(frame_index) };
std::array<VkDescriptorSet, 2> sets = { p_viewer_data_set->GetSet(frame_index), drawable->GetSet(frame_index) };
RenderCore::Get().vkCmdPushConstants(cmd, m_pipeline.GetPipelineLayout(), VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(SpriteData), &sprite_data);
RenderCore::Get().vkCmdPushConstants(cmd, m_pipeline.GetPipelineLayout(), VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(SpriteData), &drawable_data);
RenderCore::Get().vkCmdBindDescriptorSets(cmd, m_pipeline.GetPipelineBindPoint(), m_pipeline.GetPipelineLayout(), 0, sets.size(), sets.data(), 0, nullptr);
sprite->GetMesh()->Draw(cmd, renderer.GetDrawCallsCounterRef(), renderer.GetPolygonDrawnCounterRef());
drawable->GetMesh()->Draw(cmd, renderer.GetDrawCallsCounterRef(), renderer.GetPolygonDrawnCounterRef());
}
m_pipeline.EndPipeline(cmd);
}

View File

@@ -33,20 +33,20 @@ namespace mlx
p_window = window;
m_surface = p_window->CreateVulkanSurface(RenderCore::Get().GetInstance());
DebugLog("Vulkan : surface created");
DebugLog("Vulkan: surface created");
CreateSwapchain();
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
{
m_image_available_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
DebugLog("Vulkan : image available semaphore created");
DebugLog("Vulkan: image available semaphore created");
m_render_finished_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice());
DebugLog("Vulkan : render finished semaphore created");
DebugLog("Vulkan: render finished semaphore created");
m_cmd_buffers[i] = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());
DebugLog("Vulkan : command buffer created");
DebugLog("Vulkan: command buffer created");
m_cmd_fences[i] = kvfCreateFence(RenderCore::Get().GetDevice());
DebugLog("Vulkan : fence created");
DebugLog("Vulkan: fence created");
}
}
@@ -63,7 +63,7 @@ namespace mlx
//return false;
}
else if(result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR)
FatalError("Vulkan error : failed to acquire swapchain image, %", kvfVerbaliseVkResult(result));
FatalError("Vulkan error: failed to acquire swapchain image, %", kvfVerbaliseVkResult(result));
RenderCore::Get().vkResetCommandBuffer(m_cmd_buffers[m_current_frame_index], 0);
kvfBeginCommandBuffer(m_cmd_buffers[m_current_frame_index], 0);
@@ -110,7 +110,7 @@ namespace mlx
m_swapchain_images[i].TransitionLayout(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR);
m_swapchain_images[i].CreateImageView(VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT);
}
DebugLog("Vulkan : swapchain created");
DebugLog("Vulkan: swapchain created");
}
void Renderer::DestroySwapchain()
@@ -120,7 +120,7 @@ namespace mlx
for(Image& img : m_swapchain_images)
img.DestroyImageView();
kvfDestroySwapchainKHR(RenderCore::Get().GetDevice(), m_swapchain);
DebugLog("Vulkan : swapchain destroyed");
DebugLog("Vulkan: swapchain destroyed");
}
void Renderer::Destroy() noexcept
@@ -131,16 +131,16 @@ namespace mlx
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
{
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_image_available_semaphores[i]);
DebugLog("Vulkan : image available semaphore destroyed");
DebugLog("Vulkan: image available semaphore destroyed");
kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]);
DebugLog("Vulkan : render finished semaphore destroyed");
DebugLog("Vulkan: render finished semaphore destroyed");
kvfDestroyFence(RenderCore::Get().GetDevice(), m_cmd_fences[i]);
DebugLog("Vulkan : fence destroyed");
DebugLog("Vulkan: fence destroyed");
}
DestroySwapchain();
RenderCore::Get().vkDestroySurfaceKHR(RenderCore::Get().GetInstance(), m_surface, nullptr);
DebugLog("Vulkan : surface destroyed");
DebugLog("Vulkan: surface destroyed");
m_surface = VK_NULL_HANDLE;
}
}

View File

@@ -30,8 +30,8 @@ namespace mlx
{
PFN_vkVoidFunction function = RenderCore::Get().vkGetInstanceProcAddr(static_cast<VkInstance>(context), name);
if(!function)
FatalError("Vulkan loader : could not load '%'", name);
//DebugLog("Vulkan loader : loaded %", name);
FatalError("Vulkan Loader: could not load '%'", name);
//DebugLog("Vulkan Loader: loaded %", name);
return function;
}
@@ -39,8 +39,8 @@ namespace mlx
{
PFN_vkVoidFunction function = RenderCore::Get().vkGetDeviceProcAddr(static_cast<VkDevice>(context), name);
if(!function)
FatalError("Vulkan loader : could not load '%'", name);
//DebugLog("Vulkan loader : loaded %", name);
FatalError("Vulkan Loader: could not load '%'", name);
//DebugLog("Vulkan Loader: loaded %", name);
return function;
}
@@ -95,13 +95,13 @@ namespace mlx
RESTORE_GCC_PEDANTIC_WARNINGS
if(RenderCore::Get().vkGetInstanceProcAddr)
{
DebugLog("Vulkan loader : libvulkan loaded using '%'", libname);
DebugLog("Vulkan Loader: libvulkan loaded using '%'", libname);
break;
}
}
}
if(!p_module || !RenderCore::Get().vkGetInstanceProcAddr)
FatalError("Vulkan loader : failed to load libvulkan");
FatalError("Vulkan Loader: failed to load libvulkan");
LoadGlobalFunctions(nullptr, Internal::vkGetInstanceProcAddrStub);
}
@@ -120,7 +120,7 @@ namespace mlx
#define MLX_VULKAN_GLOBAL_FUNCTION(fn) RenderCore::Get().fn = reinterpret_cast<PFN_##fn>(load(context, #fn));
#include <Renderer/Vulkan/VulkanDefs.h>
#undef MLX_VULKAN_GLOBAL_FUNCTION
DebugLog("Vulkan loader : global functions loaded");
DebugLog("Vulkan Loader: global functions loaded");
}
void VulkanLoader::LoadInstanceFunctions(void* context, PFN_vkVoidFunction (*load)(void*, const char*)) noexcept
@@ -128,7 +128,7 @@ namespace mlx
#define MLX_VULKAN_INSTANCE_FUNCTION(fn) RenderCore::Get().fn = reinterpret_cast<PFN_##fn>(load(context, #fn));
#include <Renderer/Vulkan/VulkanDefs.h>
#undef MLX_VULKAN_INSTANCE_FUNCTION
DebugLog("Vulkan loader : instance functions loaded");
DebugLog("Vulkan Loader: instance functions loaded");
}
void VulkanLoader::LoadDeviceFunctions(void* context, PFN_vkVoidFunction (*load)(void*, const char*)) noexcept
@@ -136,7 +136,7 @@ namespace mlx
#define MLX_VULKAN_DEVICE_FUNCTION(fn) RenderCore::Get().fn = reinterpret_cast<PFN_##fn>(load(context, #fn));
#include <Renderer/Vulkan/VulkanDefs.h>
#undef MLX_VULKAN_DEVICE_FUNCTION
DebugLog("Vulkan loader : device functions loaded");
DebugLog("Vulkan Loader: device functions loaded");
}
VulkanLoader::~VulkanLoader()
@@ -147,6 +147,6 @@ namespace mlx
dlclose(p_module);
#endif
p_module = nullptr;
DebugLog("Vulkan loader : libvulkan unloaded");
DebugLog("Vulkan Loader: libvulkan unloaded");
}
}