diff options
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/render.c b/src/render.c index f625dba..6ff1f9e 100644 --- a/src/render.c +++ b/src/render.c @@ -3,20 +3,6 @@ #include <stdlib.h> #include <time.h> -#include <shaderc/shaderc.h> -#include <vulkan/vulkan_core.h> - -#define SDL_MAIN_HANDLED -#define VK_USE_PLATFORM_XCB_KHR -#include <SDL2/SDL.h> -#include <SDL2/SDL_vulkan.h> - -#include <vulkan/vulkan.h> - -/* #define VMA_STATIC_VULKAN_FUNCTIONS 0 */ -/* #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 */ -/* #include "vk_mem_alloc.h" */ - #define STB_IMAGE_IMPLEMENTATION #include <stb_image.h> @@ -30,10 +16,6 @@ //#include "vkutil.h" #include "state.h" -#define VMA_STATIC_VULKAN_FUNCTIONS 0 -#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 -#include "vk_mem_alloc.h" - #define MODEL_PATH "assets/human.obj" #define TEXTURE_PATH "assets/viking_room.png" @@ -127,7 +109,7 @@ move_towards(vec3 position, vec3 front, float step) } bool -init() +sdl_init() { if (SDL_Init(SDL_INIT_VIDEO) < 0) { vk_log(VK_INFO, "SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); @@ -1288,7 +1270,7 @@ load_model_obj() void load_model_gltf() { // TODO maybe copy the raylib implemenetation - char * path = "assets/monkey.glb"; + char * path = "assets/bugati.glb"; cgltf_options options; memset(&options, 0, sizeof(cgltf_options)); cgltf_data* data = NULL; @@ -1366,7 +1348,7 @@ void vulkan_create_compute_stuff() { shaderc_compilation_result_t comp_result = load_compile_shader_data("src/shader.comp", shaderc_compute_shader); if (!comp_result) { - vk_log(VK_ERROR, "Can't load compupte shader\n"); + vk_log(VK_ERROR, "Can't load compute shader\n"); if (s.prev_comp_result) { comp_result = s.prev_comp_result; } @@ -1399,7 +1381,7 @@ void vulkan_create_compute_stuff() particles[i].position[0] = x; particles[i].position[1] = y; - + vec2 norm; glm_vec2_copy((vec2){x, y}, norm); glm_vec2_normalize(norm); @@ -1424,9 +1406,9 @@ void vulkan_create_compute_stuff() vkUnmapMemory(s.vk.device, stagingBuffer.memory); for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { - vks_create_buffer(s.vk, bufferSize, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, &s.frames[i].shader_storage_buffer); + // vks_create_buffer(s.vk, bufferSize, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, &s.frames[i].shader_storage_buffer); // Copy data from the staging buffer (host) to the shader storage buffer (GPU) - vks_copy_buffer(s.vk, stagingBuffer.handle, s.frames[i].shader_storage_buffer.handle, bufferSize); + // vks_copy_buffer(s.vk, stagingBuffer.handle, s.frames[i].shader_storage_buffer.handle, bufferSize); } VkDescriptorSetLayoutBinding layoutBindings[3]; @@ -1717,7 +1699,7 @@ main(int argc, char* argv[]) phash_destroy(&tbl); init_state(&s); - if (!init()) { + if (!sdl_init()) { vk_log(VK_INFO, "Failed to initialize!\n"); abort(); } |