Red screen?

Initalised vulkan for rendering bar some validation errors
Added core types, platform detection and util macros
This commit is contained in:
2025-10-03 20:04:40 +01:00
parent 50eb947811
commit 655964852c
8 changed files with 698 additions and 3 deletions

15
code/core/macros.h Normal file
View File

@@ -0,0 +1,15 @@
#if !defined(LD_CORE_MACROS_H_)
#define LD_CORE_MACROS_H_
#define ArraySize(x) (sizeof(x) / sizeof((x)[0]))
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define _Glue(a, b) a##b
#define _Stringify(x) #x
#define Glue(a, b) _Glue(a, b)
#define Stringify(x) _Stringify(x)
#endif // LD_CORE_MACROS_H_

73
code/core/platform.h Normal file
View File

@@ -0,0 +1,73 @@
#if !defined(LD_CORE_PLATFORM_H_)
#define LD_CORE_PLATFORM_H_
#if !defined(LD_RELEASE)
#define LD_RELEASE 0
#endif
// -- Operating system
#define OS_WINDOWS 0
#define OS_LINUX 0
#if defined(_WIN32)
#undef OS_WINDOWS
#define OS_WINDOWS 1
#elif defined(__linux__)
#undef OS_LINUX
#define OS_LINUX 1
#else
#error "unsupported operating system"
#endif
// -- Architecture
#define ARCH_AMD64 0
#if defined(__amd64__) || defined(_M_AMD64)
#undef ARCH_AMD64
#define ARCH_AMD64 1
#else
#error "unsupported architecture"
#endif
// -- Compiler
#define COMPILER_CLANG 0
#define COMPILER_CL 0
#define COMPILER_GCC 0
#if defined(__clang__)
#undef COMPILER_CLANG
#define COMPILER_CLANG 1
#elif defined(_MSC_VER)
#undef COMPILER_CL
#define COMPILER_CL 1
#elif defined(__GNUC__)
#undef COMPILER_GCC
#define COMPILER_GCC 1
#else
#error "unsupported compiler"
#endif
// -- Language
#define LANG_C 0
#define LANG_CPP 0
#if defined(__OBJC__)
#error "unuspported language"
#elif defined(__cplusplus)
#undef LANG_CPP
#define LANG_CPP 1
#else
#undef LANG_C
#define LANG_C 1
#endif
#if OS_WINDOWS
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#endif // LD_CORE_PLATFORM_H_

32
code/core/types.h Normal file
View File

@@ -0,0 +1,32 @@
#if !defined(LD_CORE_TYPES_H_)
#define LD_CORE_TYPES_H_
#include <stdint.h>
#include <stdbool.h>
#include <float.h>
typedef uint8_t U8;
typedef uint16_t U16;
typedef uint32_t U32;
typedef uint64_t U64;
typedef int8_t S8;
typedef int16_t S16;
typedef int32_t S32;
typedef int64_t S64;
typedef int8_t B8;
typedef int16_t B16;
typedef int32_t B32;
typedef int64_t B64;
typedef float F32;
typedef double F64;
typedef struct Str8 Str8;
struct Str8 {
S64 count;
U8 *data;
};
#endif // LD_CORE_TYPES_H_