mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
adding multiple mapping support on textures
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/12/17 23:33:34 by maldavid #+# #+# */
|
||||
/* Updated: 2023/03/31 12:22:34 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/23 19:09:21 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -23,13 +23,15 @@
|
||||
#include "render_core.h"
|
||||
#include <mutex>
|
||||
|
||||
#ifdef DEBUG
|
||||
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages and may impact rendering performances"
|
||||
#endif
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
std::mutex mutex;
|
||||
|
||||
namespace RCore
|
||||
{
|
||||
uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties)
|
||||
std::optional<uint32_t> findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties, bool error)
|
||||
{
|
||||
VkPhysicalDeviceMemoryProperties memProperties;
|
||||
vkGetPhysicalDeviceMemoryProperties(Render_Core::get().getDevice().getPhysicalDevice(), &memProperties);
|
||||
@@ -37,11 +39,11 @@ namespace mlx
|
||||
for(uint32_t i = 0; i < memProperties.memoryTypeCount; i++)
|
||||
{
|
||||
if((typeFilter & (1 << i)) && (memProperties.memoryTypes[i].propertyFlags & properties) == properties)
|
||||
return i;
|
||||
return i;
|
||||
}
|
||||
|
||||
core::error::report(e_kind::fatal_error, "Vulkan : failed to find suitable memory type");
|
||||
return -1; // just to avoid warning
|
||||
if(error)
|
||||
core::error::report(e_kind::fatal_error, "Vulkan : failed to find suitable memory type");
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,12 +62,10 @@ namespace mlx
|
||||
|
||||
void Render_Core::destroy()
|
||||
{
|
||||
std::unique_lock<std::mutex> watchdog(mutex, std::try_to_lock);
|
||||
|
||||
if(!_is_init)
|
||||
return;
|
||||
|
||||
vkDeviceWaitIdle(_device());
|
||||
vkDeviceWaitIdle(_device());
|
||||
|
||||
_device.destroy();
|
||||
_layers.destroy();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/08 19:16:32 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/21 14:13:32 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/23 12:31:42 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#define __MLX_RENDER_CORE__
|
||||
|
||||
#include <volk.h>
|
||||
#include <optional>
|
||||
|
||||
#include "vk_queues.h"
|
||||
#include "vk_device.h"
|
||||
@@ -27,10 +28,10 @@ namespace mlx
|
||||
{
|
||||
namespace RCore
|
||||
{
|
||||
uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties);
|
||||
std::optional<uint32_t> findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties, bool error = true);
|
||||
}
|
||||
|
||||
#ifndef DEBUG
|
||||
#ifdef DEBUG
|
||||
constexpr const bool enableValidationLayers = true;
|
||||
#else
|
||||
constexpr const bool enableValidationLayers = false;
|
||||
|
||||
Reference in New Issue
Block a user