fixing issue when destroying an image in the loop hook, begenning single time command buffers manager

This commit is contained in:
2023-12-15 21:08:46 +01:00
parent a86eab4386
commit 2d89f41639
12 changed files with 127 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
/* Updated: 2023/12/11 19:46:13 by kbz_8 ### ########.fr */
/* Updated: 2023/12/15 20:51:41 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -61,7 +61,7 @@ namespace mlx::core
void Application::destroyTexture(void* ptr)
{
vkDeviceWaitIdle(Render_Core::get().getDevice().get());
vkDeviceWaitIdle(Render_Core::get().getDevice().get()); // TODO : synchronize with another method than stopping all the GPU porcess
Texture* texture = static_cast<Texture*>(ptr);
texture->destroy();
}

View File

@@ -74,8 +74,16 @@ namespace mlx::core
void Application::texturePut(void* win, void* img, int x, int y)
{
if(img == nullptr)
{
core::error::report(e_kind::error, "wrong texture (NULL)");
return;
}
Texture* texture = static_cast<Texture*>(img);
_graphics[*static_cast<int*>(win)]->texturePut(texture, x, y);
if(!texture->isInit())
core::error::report(e_kind::error, "trying to put a texture that has been destroyed");
else
_graphics[*static_cast<int*>(win)]->texturePut(texture, x, y);
}
int Application::getTexturePixel(void* img, int x, int y)

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
/* Updated: 2023/12/14 17:14:30 by maldavid ### ########.fr */
/* Updated: 2023/12/15 21:04:50 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -37,6 +37,8 @@ namespace mlx
for(auto& data : _textures_to_render)
{
if(!data.texture->isInit())
continue;
if(data.texture->getSet() == VK_NULL_HANDLE)
data.texture->setDescriptor(_renderer->getFragDescriptorSet().duplicate());
if(!data.texture->hasBeenUpdated())