Commit Graph

17 Commits

Author SHA1 Message Date
2cd9844d07 Created basalt::context class and its implementation. Creates an underlying VkInstance, and if debug layers are present, creates a VkDebugUtilsMessengerEXT. There are two flags, should_free that controls whether the destructor will do anything, and using_validation_layers that states whether validation layers and debug utils have been setup. This is primarilly done to free them later and signify a runtime debug configuration. 2025-06-24 15:59:40 +10:00
105edea0f3 Updated memory interface for get_memory_usage_string. It now takes a pointer to a uint and optionally a char* to write the output buffers size to and the buffer pointer. It still returns the buffer pointer.
Fixed bug in dealloc where it would add to the memory used rather than subtract.
Added a zero-check to source-private get_eng_unit function to prevent dropping the unit to the minimum for a value of 0
Changed padding calculation to happen on every call to get_memory_usage_string rather than on the first call. As a result, it will now use minimum padding and ignore zero components. Merged zone and class name alignment values into one.
Fixed bug where the length of a user class/zone was not accounting for the prefix "USER_" by adding 5 to the result.
Made formatting change where by zone/class is tab indented and the values are double tab indented
2025-06-24 15:43:06 +10:00
7c2d6db2e7 Added VK_ASSERT macro to save some boilerplate when checking 'VkResult err;' sections 2025-06-24 15:35:45 +10:00
cd1430d258 Added initializer list constructor
Added array push back functions for iterator-style, base-length style and other darrays
Added check to constructors to ensure that allocation of the memory succeeded before setting values
Added changetag function and a default tag for initializer list constructor
2025-06-24 15:34:26 +10:00
6f1373f223 Updated include path to correspond to new structure of the engine 2025-06-23 00:48:18 +10:00
351dba6b70 Added .CppProperties.json back. Visual studio won't use it if it is in .gitignore, but it also shouldn't be added to the project so it will need to exist a permanant limbo for now 2025-06-23 00:47:37 +10:00
ce74ea138e Added a definition file that contains some typedefs and platform-specific aliasing (debug_break, static assert, and verifies that the C macro NULL is defined) 2025-06-23 00:46:26 +10:00
e4eb380ff1 Updated allocT implementation to cast the returned void* to a T*.
Moved builtin memory tag names to top of source file because it didn't like being forward declared. TODO: Revisit this later
Fixed compilation error where the source-local function get_eng_unit did not return the modified value.
Shuffled include order around to fix compilation issues.
2025-06-23 00:44:49 +10:00
87f66e291b Fixed compilation error in basalt_logger where it whined about or'ing together two enum values for the log level.
Fixed a compilation error where the log level mask was being shadowed by log level index in basalt_log and basalt_write.
Fixed a bug where logger_add_stream was checking the lower 48-bits of the FILE* rather than the upper 16 were zero.
Fixed a bug where logger_add_stream did not mark a stream as allocated in its flags.
Fixed a bug where logger_remove_stream did not check if a stream was allocated.
Addressed warnings of potential saftey issues when logging the prefixes as if they were format strings by having them be format-specified. I suspect this is marginally slower and realistically had no security risk in the first place but was fixed anyway.
2025-06-23 00:41:41 +10:00
f07977ff06 Implemented a dynamic array object that uses 24 bytes on the stack versus std::vector's 32. It uses basalt_memory module to allocate and free itself, thus requiring a tag. It is not atomic or thread-safe. 2025-06-23 00:35:18 +10:00
bff17a13b6 Fixed bugs in basalt memory tag name generation. Centralised alignment values to basalt::mem::get_memory_tag_alignment_bytes. 2025-06-22 14:58:20 +10:00
b5ef8e4ab5 Library:
Added a very basic window object that essentially just wraps an GLFW window object.
TODO: Set the window userdata pointer to point to its wrapping object
2025-06-22 03:04:28 +10:00
8d7bfe0bc9 Buildsystem: Removed include/basalt_window.h. See prior commit #cac50b01
Library:
Added logging and memory modules.
The logging module provides a flexible interface for adding and removing logging streams (think stdout, stderr, a file) and supports ANSI colouring and including the date and time of each log call. Its header also provides several definitions for assertions, each corresponding to a specific log level and some other side effects such as debug_break(), returning, exiting or doing nothing.
The memory module wraps (_)aligned_alloc and free functions and includes memory tagging by class and location and the ability to fetch a formatted string containing this information. This can allow you to narrow down where memory leaks and double frees occur to particular sections within a module. Memory can be aligned to any, 32, 64 or 4096 byte boundaries using this module.
2025-06-22 03:02:42 +10:00
cac50b0134 Restructured library source files 2025-06-22 02:54:15 +10:00
c992634e8e buildsystem: Added debug build flags to linker 2025-06-22 02:51:52 +10:00
62b1e79ec5 Initial commit - https://www.youtube.com/watch?v=_riranMmtvI&list=PL8327DO66nu9qYVKLDmdLW_84-yE4auCR&index=3 2025-06-20 15:10:02 +10:00
912d5cb768 Initial commit 2025-06-19 16:27:58 +10:00