2024-07-03 17:55:25 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
CONFIGURATION:
|
|
|
|
|
|
|
|
#define these before including oogabooga.c to configure
|
|
|
|
|
|
|
|
All configuration properties has default values if you do not explicitly #define them.
|
|
|
|
|
|
|
|
- ENTRY_PROC
|
|
|
|
Define this as whatever the entry procedure of your program should be.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
#define ENTRY_PROC my_entry
|
|
|
|
void entry_proc(int, char**) {
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
|
|
|
|
Note:
|
|
|
|
void entry_proc(int, char**);
|
|
|
|
|
|
|
|
- DO_ZERO_INITIALIZATION
|
|
|
|
|
|
|
|
0: Disable zero initialization
|
|
|
|
1: Enable zero initialization
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
// Disable zero initialization
|
|
|
|
#define DO_ZERO_INITIALIZATION 0
|
|
|
|
|
|
|
|
Note:
|
|
|
|
Zero initialization only happens to memory allocated with the alloc() procedure.
|
|
|
|
|
|
|
|
- ENABLE_SIMD
|
|
|
|
0: Disable SIMD
|
|
|
|
1: Enable SIMD
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
// Disable simd
|
|
|
|
#define ENABLE_SIMD 0
|
|
|
|
|
|
|
|
- Simd Extensions
|
|
|
|
0: Disable
|
|
|
|
1: Enable
|
|
|
|
|
|
|
|
Possible extensions:
|
|
|
|
SIMD_ENABLE_SSE2
|
|
|
|
SIMD_ENABLE_SSE41
|
|
|
|
SIMD_ENABLE_AVX
|
|
|
|
SIMD_ENABLE_AVX2
|
|
|
|
SIMD_ENABLE_AVX512
|
|
|
|
|
|
|
|
Example:
|
|
|
|
// Enable SSE2 Extension
|
|
|
|
#define SIMD_ENABLE_SSE2 1
|
|
|
|
|
|
|
|
Note:
|
|
|
|
I recommend that you do not touch this unless you know what you're doing.
|
|
|
|
These may require you to pass the respective instruction set flag to your
|
|
|
|
compiler.
|
|
|
|
For compatilibility reasons, all simd extensions are disabled by default.
|
|
|
|
|
|
|
|
- INITIAL_PROGRAM_MEMORY_SIZE
|
|
|
|
Defines this as the size in number of bytes you want the initial allocation for
|
|
|
|
your program memory to be.
|
|
|
|
This will grow dynamically as needed.
|
|
|
|
You can use helper macros KB, MB, GB.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
#define INITIAL_PROGRAM_MEMORY_SIZE (MB(10))
|
|
|
|
|
|
|
|
Note:
|
|
|
|
This is not guaranteed to be exactly what you set it to because we have
|
|
|
|
minimum requirements for example to fit the temporary storage in program
|
|
|
|
memory. It's more of a rough guideline.
|
|
|
|
|
|
|
|
- RUN_TESTS
|
|
|
|
Run ooga booga tests.
|
|
|
|
|
|
|
|
0: Disable
|
|
|
|
1: Enable
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
#define RUN_TESTS 0
|
|
|
|
|
|
|
|
- ENABLE_PROFILING
|
|
|
|
Enable time profiling which will be dumped to google_trace.json.
|
|
|
|
|
|
|
|
0: Disable
|
|
|
|
1: Enable
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
#define ENABLE_PROFILING 1
|
|
|
|
|
|
|
|
Note:
|
|
|
|
See timing macros in profile.c
|
|
|
|
tm_scope_cycles
|
|
|
|
tm_scope_cycles_var
|
|
|
|
tm_scope_cycles_accum
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.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 u8 uint8;
|
|
|
|
typedef s8 int8;
|
|
|
|
typedef u16 uint16;
|
|
|
|
typedef s16 int16;
|
|
|
|
typedef u32 uint32;
|
|
|
|
typedef s32 int32;
|
|
|
|
typedef u64 uint64;
|
|
|
|
typedef s64 int64;
|
|
|
|
|
|
|
|
typedef float f32;
|
|
|
|
typedef double f64;
|
|
|
|
typedef f32 float32;
|
|
|
|
typedef f64 float64;
|
|
|
|
|
|
|
|
typedef u8 bool;
|
|
|
|
#define false 0
|
|
|
|
#define true 1
|
|
|
|
|
|
|
|
// Determine what compiler we are on
|
|
|
|
#ifdef __clang__
|
|
|
|
#define COMPILER_CLANG 1
|
|
|
|
#elif defined(__GNUC__) || defined(__GNUG__)
|
|
|
|
#define COMPILER_GCC 1
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
#define COMPILER_MSVC 1
|
|
|
|
#else
|
|
|
|
#define COMPILER_UNKNOWN 1
|
|
|
|
#warning "Compiler is not explicitly supported, some things will probably not work as expected"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cpu.c"
|
2024-06-28 03:28:23 +02:00
|
|
|
|
2024-07-02 19:12:31 +02:00
|
|
|
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#define DEBUG 0
|
|
|
|
#define VERY_DEBUG 1
|
|
|
|
#define RELEASE 2
|
|
|
|
|
|
|
|
#if !defined(CONFIGURATION)
|
|
|
|
|
|
|
|
#if defined(NDEBUG)
|
|
|
|
#define CONFIGURATION RELEASE
|
|
|
|
#else
|
|
|
|
#define CONFIGURATION DEBUG
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ENTRY_PROC
|
|
|
|
#define ENTRY_PROC entry
|
|
|
|
#endif
|
|
|
|
|
2024-07-02 19:12:31 +02:00
|
|
|
#ifndef DO_ZERO_INITIALIZATION
|
|
|
|
#define DO_ZERO_INITIALIZATION 1
|
|
|
|
#endif
|
|
|
|
|
2024-07-03 00:01:11 +02:00
|
|
|
#ifndef ENABLE_SIMD
|
|
|
|
#define ENABLE_SIMD 1
|
|
|
|
#endif
|
|
|
|
|
2024-07-03 17:55:25 +02:00
|
|
|
#if ENABLE_SIMD && !defined(SIMD_ENABLE_SSE2)
|
|
|
|
#if COMPILER_CAN_DO_SSE2
|
|
|
|
#define SIMD_ENABLE_SSE2 1
|
|
|
|
#else
|
|
|
|
#define SIMD_ENABLE_SSE2 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if ENABLE_SIMD && !defined(SIMD_ENABLE_SSE41)
|
|
|
|
#define SIMD_ENABLE_SSE41 0
|
|
|
|
#endif
|
|
|
|
#if ENABLE_SIMD && !defined(SIMD_ENABLE_AVX)
|
|
|
|
#define SIMD_ENABLE_AVX 0
|
|
|
|
#endif
|
|
|
|
#if ENABLE_SIMD && !defined(SIMD_ENABLE_AVX2)
|
|
|
|
#define SIMD_ENABLE_AVX2 0
|
|
|
|
#endif
|
|
|
|
#if ENABLE_SIMD && !defined(SIMD_ENABLE_AVX512)
|
|
|
|
#define SIMD_ENABLE_AVX512 0
|
|
|
|
#endif
|
|
|
|
|
2024-07-03 00:01:11 +02:00
|
|
|
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#define WINDOWS 0
|
|
|
|
#define LINUX 1
|
|
|
|
#define MACOS 2
|
|
|
|
|
2024-06-28 18:50:30 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#define TARGET_OS WINDOWS
|
2024-07-01 02:14:08 +02:00
|
|
|
#define OS_PATHS_HAVE_BACKSLASH 1
|
2024-06-28 18:50:30 +02:00
|
|
|
#elif defined(__linux__)
|
|
|
|
// Include whatever #Incomplete #Portability
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#define TARGET_OS LINUX
|
2024-06-28 18:50:30 +02:00
|
|
|
#error "Linux is not supported yet";
|
2024-07-01 02:14:08 +02:00
|
|
|
#define OS_PATHS_HAVE_BACKSLASH 0
|
2024-06-28 18:50:30 +02:00
|
|
|
#elif defined(__APPLE__) && defined(__MACH__)
|
|
|
|
// Include whatever #Incomplete #Portability
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#define TARGET_OS MACOS
|
2024-07-03 17:55:25 +02:00
|
|
|
#error "Macos is not supported yet";
|
2024-07-01 02:14:08 +02:00
|
|
|
#define OS_PATHS_HAVE_BACKSLASH 1
|
2024-06-28 18:50:30 +02:00
|
|
|
#else
|
|
|
|
#error "Current OS not supported!";
|
|
|
|
#endif
|
|
|
|
|
2024-07-02 15:27:33 +02:00
|
|
|
|
2024-07-03 17:55:25 +02:00
|
|
|
// This needs to be included before dependencies
|
|
|
|
#include "base.c"
|
|
|
|
|
|
|
|
///
|
|
|
|
///
|
|
|
|
// Dependencies
|
|
|
|
///
|
2024-07-02 15:27:33 +02:00
|
|
|
|
2024-07-03 17:55:25 +02:00
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "third_party.c"
|
|
|
|
|
|
|
|
/////
|
|
|
|
|
|
|
|
#include "simd.c"
|
|
|
|
|
|
|
|
// #Incomplete
|
|
|
|
// We might want to make this configurable ?
|
2024-06-29 13:27:37 +02:00
|
|
|
#define GFX_RENDERER_D3D11 0
|
|
|
|
#define GFX_RENDERER_VULKAN 1
|
|
|
|
#define GFX_RENDERER_METAL 2
|
|
|
|
#ifndef GFX_RENDERER
|
|
|
|
// #Portability
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#if TARGET_OS == WINDOWS
|
2024-06-29 13:27:37 +02:00
|
|
|
#define GFX_RENDERER GFX_RENDERER_D3D11
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#elif TARGET_OS == LINUX
|
2024-06-29 13:27:37 +02:00
|
|
|
#define GFX_RENDERER GFX_RENDERER_VULKAN
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#elif TARGET_OS == MACOS
|
2024-06-29 13:27:37 +02:00
|
|
|
#define GFX_RENDERER GFX_RENDERER_METAL
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2024-06-28 12:07:02 +02:00
|
|
|
#include "string.c"
|
2024-06-29 17:54:30 +02:00
|
|
|
#include "unicode.c"
|
2024-06-28 21:57:37 +02:00
|
|
|
#include "string_format.c"
|
2024-07-01 02:14:08 +02:00
|
|
|
#include "path_utils.c"
|
2024-07-01 17:22:10 +07:00
|
|
|
#include "linmath.c"
|
2024-07-03 17:55:25 +02:00
|
|
|
|
2024-06-28 03:28:23 +02:00
|
|
|
#include "os_interface.c"
|
2024-07-01 02:14:08 +02:00
|
|
|
#include "gfx_interface.c"
|
|
|
|
|
2024-07-03 17:55:25 +02:00
|
|
|
#include "profiling.c"
|
2024-06-29 13:27:37 +02:00
|
|
|
#include "random.c"
|
2024-07-02 12:48:05 +07:00
|
|
|
#include "color.c"
|
2024-06-29 01:18:22 +02:00
|
|
|
#include "memory.c"
|
|
|
|
#include "input.c"
|
|
|
|
#include "drawing.c"
|
2024-06-28 18:50:30 +02:00
|
|
|
|
2024-06-29 13:27:37 +02:00
|
|
|
// #Portability
|
|
|
|
#if GFX_RENDERER == GFX_RENDERER_D3D11
|
|
|
|
#include "gfx_impl_d3d11.c"
|
|
|
|
#elif GFX_RENDERER == GFX_RENDERER_VULKAN
|
|
|
|
#error "We only have a D3D11 renderer at the moment"
|
|
|
|
#elif GFX_RENDERER == GFX_RENDERER_METAL
|
|
|
|
#error "We only have a D3D11 renderer at the moment"
|
|
|
|
#elif GFX_RENDERER == GFX_RENDERER_LEGACY_OPENGL
|
|
|
|
#include "gfx_impl_legacy_opengl.c"
|
|
|
|
#else
|
2024-07-01 02:14:08 +02:00
|
|
|
#error "Unknown renderer GFX_RENDERER defined"
|
2024-06-29 13:27:37 +02:00
|
|
|
#endif
|
|
|
|
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#if TARGET_OS == WINDOWS
|
2024-06-28 03:28:23 +02:00
|
|
|
#include "os_impl_windows.c"
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#elif TARGET_OS == LINUX
|
2024-07-03 17:55:25 +02:00
|
|
|
#error "Linux is not supported yet"
|
- File IO
- os_file_open(string path, Os_Io_Open_Flags flags)
- os_file_close(File f)
- os_file_delete(string path)
- os_file_write_string(File f, string s)
- os_file_write_bytes(File f, void *buffer, u64 size_in_bytes)
- os_file_read(File f, void* buffer, u64 bytes_to_read, u64 *actual_read_bytes)
- os_write_entire_file_handle(File f, string data)
- os_write_entire_file(string path, string data)
- os_read_entire_file_handle(File f, string *result)
- os_read_entire_file(string path, string *result)
- fprint(File, string/char*, ...)
- Buncha tests
- os_high_precision_sleep
- talloc_string
- Program memory is touched on VirtualAlloc so it actually allocates physical memory (and we can tell when an address is untouched)
2024-06-29 20:55:43 +02:00
|
|
|
#elif TARGET_OS == MACOS
|
2024-07-03 17:55:25 +02:00
|
|
|
#error "Macos is not supported yet"
|
|
|
|
#else
|
|
|
|
#error "Current OS is not supported"
|
2024-06-28 03:28:23 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "tests.c"
|
|
|
|
|
|
|
|
|
|
|
|
void oogabooga_init(u64 program_memory_size) {
|
2024-07-01 02:14:08 +02:00
|
|
|
context.logger = default_logger;
|
2024-07-01 13:10:06 +02:00
|
|
|
temp = get_initialization_allocator();
|
2024-07-03 00:01:11 +02:00
|
|
|
Cpu_Capabilities features = query_cpu_capabilities();
|
2024-06-28 03:28:23 +02:00
|
|
|
os_init(program_memory_size);
|
2024-06-29 01:18:22 +02:00
|
|
|
heap_init();
|
2024-06-28 03:28:23 +02:00
|
|
|
temporary_storage_init();
|
2024-07-01 13:10:06 +02:00
|
|
|
gfx_init();
|
2024-07-03 00:01:11 +02:00
|
|
|
log_verbose("CPU has sse1: %cs", features.sse1 ? "true" : "false");
|
|
|
|
log_verbose("CPU has sse2: %cs", features.sse2 ? "true" : "false");
|
|
|
|
log_verbose("CPU has sse3: %cs", features.sse3 ? "true" : "false");
|
|
|
|
log_verbose("CPU has ssse3: %cs", features.ssse3 ? "true" : "false");
|
|
|
|
log_verbose("CPU has sse41: %cs", features.sse41 ? "true" : "false");
|
|
|
|
log_verbose("CPU has sse42: %cs", features.sse42 ? "true" : "false");
|
|
|
|
log_verbose("CPU has avx: %cs", features.avx ? "true" : "false");
|
|
|
|
log_verbose("CPU has avx2: %cs", features.avx2 ? "true" : "false");
|
|
|
|
log_verbose("CPU has avx512: %cs", features.avx512 ? "true" : "false");
|
2024-06-28 12:16:48 +02:00
|
|
|
}
|
|
|
|
|
2024-06-29 01:18:22 +02:00
|
|
|
int ENTRY_PROC(int argc, char **argv);
|
2024-06-28 18:50:30 +02:00
|
|
|
|
2024-06-28 12:16:48 +02:00
|
|
|
int main(int argc, char **argv) {
|
2024-07-02 19:12:31 +02:00
|
|
|
|
2024-06-28 18:50:30 +02:00
|
|
|
printf("Ooga booga program started\n");
|
2024-07-02 19:12:31 +02:00
|
|
|
oogabooga_init(INITIAL_PROGRAM_MEMORY_SIZE);
|
|
|
|
|
|
|
|
assert(main != ENTRY_PROC, "You've ooga'd your last booga");
|
2024-06-28 12:16:48 +02:00
|
|
|
|
|
|
|
#if RUN_TESTS
|
|
|
|
oogabooga_run_tests();
|
|
|
|
#endif
|
|
|
|
|
2024-06-29 01:18:22 +02:00
|
|
|
int code = ENTRY_PROC(argc, argv);
|
2024-06-28 12:16:48 +02:00
|
|
|
|
2024-07-02 15:27:33 +02:00
|
|
|
#if ENABLE_PROFILING
|
|
|
|
|
|
|
|
dump_profile_result();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2024-06-28 12:16:48 +02:00
|
|
|
printf("Ooga booga program exit with code %i\n", code);
|
|
|
|
|
|
|
|
return code;
|
2024-07-01 02:14:08 +02:00
|
|
|
}
|
|
|
|
|
2024-07-03 17:55:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
// I hope whoever caused this @ microsoft is fired.
|
|
|
|
#ifdef near
|
|
|
|
#undef near
|
|
|
|
#endif
|
|
|
|
#ifdef far
|
|
|
|
#undef far
|
|
|
|
#endif
|