Add texture handler

Added functionality to load images as textures and bind them to meshes.
This commit is contained in:
Piotr Krygier committed 2023-10-02 13:21:17 +02:00
1 parent 0e040dd0d5
commit 4fcda01ba2
24 files changed
+897 -200

No files matched your search

+16
View File
@@ -31,9 +31,11 @@
#include "window.h"
#include "vulkan_commons.h"
#include "rse_vulkan_commands.h"
#include "vulkan_buffers.h"
#include "vulkan_descriptors.h"
#include "vulkan_pipeline.h"
#include "rse_vulkan_image.h"
#include <stddef.h>
#include <stdlib.h>
@@ -564,12 +566,22 @@ uint8_t init_vulkan()
STATUS_CHECK(create_pipeline());
STATUS_CHECK(init_commands());
STATUS_CHECK(create_buffers());
STATUS_CHECK(init_vulkan_images());
//FIXME: Images have to be add after vulkan initialization but before creating descriptors.
// I have to fix it somehow to be able to add textures from anywhere in the code in some initialization step
// at the beginnning.
rse_load_texture("../../miotacz_piorunów.png");
STATUS_CHECK(create_descriptors());
STATUS_CHECK(create_sync_objects());
rse_init_time();
return status;
}
@@ -657,6 +669,10 @@ void deinit_vulkan()
vkDestroyFence(g_vulkan_state.device, g_in_flight_fences[i], NULL);
}
rse_destroy_textures();
destroy_commands();
destroy_pipeline();
vmaDestroyAllocator(g_vulkan_state.allocator);