summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--b.c22
-rw-r--r--src/cplusplus.cpp1
-rw-r--r--src/render.c4
-rw-r--r--src/vkutil.h59
4 files changed, 25 insertions, 61 deletions
diff --git a/b.c b/b.c
index 22a2304..89ea2ce 100644
--- a/b.c
+++ b/b.c
@@ -210,9 +210,29 @@ build_objects(const char* lang,
return true;
}
+#include <time.h>
+float
+current_time()
+{
+ static struct timespec startTime;
+ static int isStartTimeInitialized = 0;
+
+ if (!isStartTimeInitialized) {
+ clock_gettime(CLOCK_MONOTONIC, &startTime);
+ isStartTimeInitialized = 1;
+ }
+
+ struct timespec currentTime;
+ clock_gettime(CLOCK_MONOTONIC, &currentTime);
+
+ return (currentTime.tv_sec - startTime.tv_sec) +
+ (currentTime.tv_nsec - startTime.tv_nsec) / 1e9f;
+}
+
int
main(int argc, char *argv[])
{
+ float before_build = current_time();
B_GO_REBUILD_URSELF(argc, argv);
const char *program_name = b_shift_args(&argc, &argv);
@@ -275,6 +295,8 @@ main(int argc, char *argv[])
if (!build_objects("C++", "src/cplusplus.cpp", cplusplus_deps, B_ARRAY_LEN(cplusplus_deps), objects, &it)) return 1;
if (!build_c(force, &cmd, render_paths, B_ARRAY_LEN(render_paths), render_deps, B_ARRAY_LEN(render_deps), objects, B_ARRAY_LEN(objects), BUILD_DIR"render")) return 1;
+ b_log(B_INFO, "Build time: %.3f seconds", current_time() - before_build);
+
return 0;
}
/*
diff --git a/src/cplusplus.cpp b/src/cplusplus.cpp
index 68cb8c3..b8dd787 100644
--- a/src/cplusplus.cpp
+++ b/src/cplusplus.cpp
@@ -56,6 +56,7 @@ imgui_proc_event(SDL_Event* e)
}
static VkDescriptorPool imguiPool;
+
void
init_imgui(vks_context *vk)
{
diff --git a/src/render.c b/src/render.c
index 0f1b12d..1ff2e13 100644
--- a/src/render.c
+++ b/src/render.c
@@ -1477,8 +1477,8 @@ init_vulkan()
init_imgui(&s.vk);
- load_model_obj();
- //load_model_gltf();
+ //load_model_obj();
+ load_model_gltf();
vulkan_create_vertex_buffer();
vulkan_create_index_buffer();
diff --git a/src/vkutil.h b/src/vkutil.h
deleted file mode 100644
index 7252ba8..0000000
--- a/src/vkutil.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _VKUTIL_H
-#define _VKUTIL_H
-
-/**
- * DEPRECATED
- * vkutil.h -- helper functions and macros for working with vulkan in C
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include <vulkan/vulkan.h>
-#include <vulkan/vk_enum_string_helper.h> // for string_VkResult
-
-#define VK_ARRAY_LEN(arr) sizeof((arr))/sizeof((arr)[0])
-
-#define VK_CHECK(x) \
-do { \
- VkResult err = x; \
- if (err) { \
- fprintf(stderr, "%s:%d:0: vulkan error: %s \n", \
- __FILE__, __LINE__, string_VkResult(err)); \
- abort(); \
- } \
-} while (0)
-
-typedef enum {
- VK_INFO = 0,
- VK_WARN,
- VK_ERROR,
-} log_type;
-
-static inline void
-vk_log(log_type t, const char * f, ...)
-{
-#ifdef VKDEBUG
- va_list args;
- va_start(args, f);
- switch (t) {
- case VK_INFO:
- printf("INFO: ");
- vprintf(f, args);
- break;
- case VK_WARN:
- fprintf(stderr, "WARN: ");
- vfprintf(stderr, f, args);
- break;
- case VK_ERROR:
- fprintf(stderr, "ERROR: ");
- vfprintf(stderr, f, args);
- break;
- }
- va_end(args);
-#else
- return;
-#endif
-}
-
-#endif /* _VKUTIL_H */