mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
fixing issue with vulkan queues on multiple GPU computers
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 17:55:21 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/08 22:17:57 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/08 22:30:39 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -32,8 +32,8 @@ int update(void *param)
|
||||
mlx = (t_mlx *)param;
|
||||
mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->logo, 100, 100);
|
||||
mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->img, 150, 60);
|
||||
//if (i == 0)
|
||||
// mlx_set_font_scale(mlx->mlx, mlx->win, "font.ttf", 16.f);
|
||||
if (i == 0)
|
||||
mlx_set_font_scale(mlx->mlx, mlx->win, "font.ttf", 16.f);
|
||||
mlx_string_put(mlx->mlx, mlx->win, 20, 50, 0xFFFFFFFF, "that's a text");
|
||||
j = 0;
|
||||
k = 0;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/08 19:14:29 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/30 23:29:41 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/08 23:48:53 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -91,9 +91,6 @@ namespace mlx
|
||||
return std::make_pair(deviceScore(device, surface), device);
|
||||
});
|
||||
|
||||
vkDestroySurfaceKHR(Render_Core::get().getInstance().get(), surface, nullptr);
|
||||
SDL_DestroyWindow(window);
|
||||
|
||||
using device_pair = std::pair<int, VkPhysicalDevice>;
|
||||
std::sort(devices_score.begin(), devices_score.end(), [](const device_pair& a, const device_pair& b)
|
||||
{
|
||||
@@ -110,6 +107,9 @@ namespace mlx
|
||||
vkGetPhysicalDeviceProperties(_physicalDevice, &props);
|
||||
core::error::report(e_kind::message, "Vulkan : picked a physical device, %s", props.deviceName);
|
||||
#endif
|
||||
Render_Core::get().getQueue().findQueueFamilies(_physicalDevice, surface); // update queue indicies to current physical device
|
||||
vkDestroySurfaceKHR(Render_Core::get().getInstance().get(), surface, nullptr);
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
|
||||
int Device::deviceScore(VkPhysicalDevice device, VkSurfaceKHR surface)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/08 19:02:42 by maldavid #+# #+# */
|
||||
/* Updated: 2022/12/18 22:52:04 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/08 23:46:36 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace mlx
|
||||
_families->presentFamily = i;
|
||||
|
||||
if(_families->isComplete())
|
||||
break;
|
||||
return *_families;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/08 19:01:49 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/03 15:26:31 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/08 23:46:23 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <volk.h>
|
||||
#include <optional>
|
||||
#include <cstdint>
|
||||
#include <core/errors.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -37,7 +38,13 @@ namespace mlx
|
||||
|
||||
inline VkQueue& getGraphic() noexcept { return _graphicsQueue; }
|
||||
inline VkQueue& getPresent() noexcept { return _presentQueue; }
|
||||
inline QueueFamilyIndices getFamilies() noexcept { return *_families; }
|
||||
inline QueueFamilyIndices getFamilies() noexcept
|
||||
{
|
||||
if(_families.has_value())
|
||||
return *_families;
|
||||
core::error::report(e_kind::fatal_error, "Vulkan : cannot get queue families, not init");
|
||||
return {}; // just to avoid warnings
|
||||
}
|
||||
|
||||
private:
|
||||
VkQueue _graphicsQueue;
|
||||
|
||||
Reference in New Issue
Block a user