From fb9a5b153f16d8c8fe961b6af0f54a7178e032a6 Mon Sep 17 00:00:00 2001 From: gramanas Date: Sun, 16 Jun 2024 20:27:29 +0300 Subject: Add pds --- src/render.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'src/render.c') diff --git a/src/render.c b/src/render.c index cb4203b..9b7541f 100644 --- a/src/render.c +++ b/src/render.c @@ -1136,7 +1136,11 @@ vulkan_create_texture_image() &stagingBuffer.allocation, NULL); - vmaCopyMemoryToAllocation(s.vk.allocator, pixels, stagingBuffer.allocation, 0, (size_t)imageSize); + vmaCopyMemoryToAllocation(s.vk.allocator, + pixels, + stagingBuffer.allocation, + 0, + (size_t)imageSize); stbi_image_free(pixels); @@ -1164,6 +1168,7 @@ vulkan_create_texture_image() s.texture_image.handle, (uint32_t)texWidth, (uint32_t)texHeight); + vks_generate_mipmaps(s.vk, s.texture_image.handle, VK_FORMAT_R8G8B8A8_SRGB, texWidth, texHeight, s.vk_mip_levels); transition_info.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; @@ -1680,12 +1685,42 @@ draw_frame() prev_time = time; } +#define PDS_IMPLEMENTATION +#include "pds.h" + int main(int argc, char* argv[]) { (void) argc; (void)argv; + int* lst = pstack_create(int); + pstack_push(lst, 1); + pstack_push(lst, 2); + + int i; + while (!pstack_pop(lst, &i)) { + printf("%d\n", i); + } + pstack_destroy(lst); + + phash tbl; + int mem[2]; + phash_create(sizeof(int), 2, &mem, 0, &tbl); + + int x = 2; + phash_set(&tbl, "Val", &x); + x = 3; + phash_set(&tbl, "Val1", &x); + + int y; + phash_get(&tbl, "Val", &y); + printf("%d\n", y); + phash_get(&tbl, "Val1", &y); + printf("%d\n", y); + + phash_destroy(&tbl); + init_state(&s); if (!init()) { vk_log(VK_INFO, "Failed to initialize!\n"); @@ -1696,8 +1731,6 @@ main(int argc, char* argv[]) bool quit = false; - // At the end, don't forget to: - update_camera(0, 0); // Game loop -- cgit v1.2.3