trying single threaded
This commit is contained in:
parent
e625c20f07
commit
04b351e792
|
@ -15,15 +15,15 @@
|
|||
|
||||
struct handle
|
||||
{
|
||||
u32 Generation;
|
||||
u32 Index;
|
||||
u32 Generation;
|
||||
u32 Index;
|
||||
};
|
||||
|
||||
inline bool
|
||||
Handle_IsValid(handle Handle)
|
||||
{
|
||||
bool Result = (Handle.Generation != 0);
|
||||
return Result;
|
||||
bool Result = (Handle.Generation != 0);
|
||||
return Result;
|
||||
}
|
||||
|
||||
#include "..\gs_libs\gs_string.h"
|
||||
|
@ -40,9 +40,9 @@ global debug_services* GlobalDebugServices;
|
|||
|
||||
struct platform_network_address
|
||||
{
|
||||
s32 Family;
|
||||
u16 Port;
|
||||
u32 Address;
|
||||
s32 Family;
|
||||
u16 Port;
|
||||
u32 Address;
|
||||
};
|
||||
|
||||
typedef s32 platform_socket_handle;
|
||||
|
@ -59,16 +59,16 @@ typedef struct context context;
|
|||
typedef void temp_job_req_proc(gs_thread_context* Ctx, u8* Memory);
|
||||
struct temp_job_req
|
||||
{
|
||||
temp_job_req_proc* Proc;
|
||||
u8* Memory;
|
||||
temp_job_req_proc* Proc;
|
||||
u8* Memory;
|
||||
};
|
||||
// This isn't necessarily temp but I'm not sure it goes here
|
||||
#define PACKETS_MAX 32
|
||||
struct packet_ringbuffer
|
||||
{
|
||||
gs_data Values[PACKETS_MAX];
|
||||
u32 ReadHead;
|
||||
u32 WriteHead;
|
||||
gs_data Values[PACKETS_MAX];
|
||||
u32 ReadHead;
|
||||
u32 WriteHead;
|
||||
};
|
||||
|
||||
#define INITIALIZE_APPLICATION(name) void name(context* Context)
|
||||
|
@ -87,9 +87,9 @@ typedef CLEANUP_APPLICATION(cleanup_application);
|
|||
|
||||
struct window_info
|
||||
{
|
||||
char* Name;
|
||||
s32 Width;
|
||||
s32 Height;
|
||||
char* Name;
|
||||
s32 Width;
|
||||
s32 Height;
|
||||
};
|
||||
|
||||
typedef struct window window;
|
||||
|
@ -97,38 +97,38 @@ typedef struct window window;
|
|||
#define PLATFORM_MEMORY_NO_ERROR 0
|
||||
enum platform_memory_error
|
||||
{
|
||||
PlatformMemory_NoError,
|
||||
PlatformMemory_FileNotFound,
|
||||
PlatformMemory_NoError,
|
||||
PlatformMemory_FileNotFound,
|
||||
|
||||
PlatformMemory_UnknownError, // You should implement handling this when you see it
|
||||
PlatformMemory_UnknownError, // You should implement handling this when you see it
|
||||
};
|
||||
|
||||
struct data
|
||||
{
|
||||
u8* Base;
|
||||
u64 Size;
|
||||
u8* Base;
|
||||
u64 Size;
|
||||
};
|
||||
|
||||
struct platform_memory_result
|
||||
{
|
||||
data Data;
|
||||
platform_memory_error Error;
|
||||
data Data;
|
||||
platform_memory_error Error;
|
||||
};
|
||||
|
||||
struct system_path
|
||||
{
|
||||
char* Path;
|
||||
s32 PathLength;
|
||||
s32 IndexOfLastSlash;
|
||||
char* Path;
|
||||
s32 PathLength;
|
||||
s32 IndexOfLastSlash;
|
||||
};
|
||||
|
||||
struct texture_buffer
|
||||
{
|
||||
u8* Memory;
|
||||
s32 Width;
|
||||
s32 Height;
|
||||
s32 Pitch;
|
||||
s32 BytesPerPixel;
|
||||
u8* Memory;
|
||||
s32 Width;
|
||||
s32 Height;
|
||||
s32 Pitch;
|
||||
s32 BytesPerPixel;
|
||||
};
|
||||
|
||||
#define PLATFORM_GET_GPU_TEXTURE_HANDLE(name) s32 name(u8* Memory, s32 Width, s32 Height)
|
||||
|
@ -140,25 +140,25 @@ typedef PLATFORM_GET_SOCKET_HANDLE(platform_get_socket_handle);
|
|||
// Font
|
||||
struct platform_font_info
|
||||
{
|
||||
s32 PixelHeight;
|
||||
s32 Ascent, Descent, Leading;
|
||||
s32 MaxCharWidth;
|
||||
s32 CodepointStart;
|
||||
s32 CodepointOnePastLast;
|
||||
s32 PixelHeight;
|
||||
s32 Ascent, Descent, Leading;
|
||||
s32 MaxCharWidth;
|
||||
s32 CodepointStart;
|
||||
s32 CodepointOnePastLast;
|
||||
};
|
||||
|
||||
enum font_weight
|
||||
{
|
||||
FontWeight_Invalid = 0,
|
||||
FontWeight_Thin = 100,
|
||||
FontWeight_ExtraLight = 200,
|
||||
FontWeight_Light = 300,
|
||||
FontWeight_Normal = 400,
|
||||
FontWeight_Medium = 500,
|
||||
FontWeight_SemiBold = 600,
|
||||
FontWeight_Bold = 700,
|
||||
FontWeight_ExtraBold = 800,
|
||||
FontWeight_Heavy = 900,
|
||||
FontWeight_Invalid = 0,
|
||||
FontWeight_Thin = 100,
|
||||
FontWeight_ExtraLight = 200,
|
||||
FontWeight_Light = 300,
|
||||
FontWeight_Normal = 400,
|
||||
FontWeight_Medium = 500,
|
||||
FontWeight_SemiBold = 600,
|
||||
FontWeight_Bold = 700,
|
||||
FontWeight_ExtraBold = 800,
|
||||
FontWeight_Heavy = 900,
|
||||
};
|
||||
|
||||
#define GET_FONT_INFO(name) platform_font_info name(char* FontName, s32 PixelHeight, font_weight FontWeight, b32 Italic, b32 Underline, b32 Strikeout)
|
||||
|
@ -169,19 +169,19 @@ typedef DRAW_FONT_CODEPOINT(platform_draw_font_codepoint);
|
|||
|
||||
// Worker Threads
|
||||
|
||||
#define PLATFORM_THREAD_COUNT 3
|
||||
#define PLATFORM_THREAD_COUNT 0
|
||||
|
||||
RESET_WORK_QUEUE(ResetWorkQueue)
|
||||
{
|
||||
for (u32 i = 0; i < Queue->JobsMax; i++)
|
||||
{
|
||||
Queue->Jobs[i].Data = {0};
|
||||
Queue->Jobs[i].WorkProc = 0;
|
||||
}
|
||||
for (u32 i = 0; i < Queue->JobsMax; i++)
|
||||
{
|
||||
Queue->Jobs[i].Data = {0};
|
||||
Queue->Jobs[i].WorkProc = 0;
|
||||
}
|
||||
|
||||
Queue->JobsCount = 0;
|
||||
Queue->NextJobIndex = 0;
|
||||
Queue->JobsCompleted = 0;
|
||||
Queue->JobsCount = 0;
|
||||
Queue->NextJobIndex = 0;
|
||||
Queue->JobsCompleted = 0;
|
||||
}
|
||||
|
||||
// Time
|
||||
|
@ -189,66 +189,66 @@ RESET_WORK_QUEUE(ResetWorkQueue)
|
|||
internal r32
|
||||
GetSecondsElapsed (s64 Start, s64 End, s64 PerformanceCountFrequency)
|
||||
{
|
||||
r32 Result = ((r32)(End - Start) / (r32) PerformanceCountFrequency);
|
||||
return Result;
|
||||
r32 Result = ((r32)(End - Start) / (r32) PerformanceCountFrequency);
|
||||
return Result;
|
||||
}
|
||||
|
||||
typedef struct system_time
|
||||
{
|
||||
u64 NanosSinceEpoch;
|
||||
u64 NanosSinceEpoch;
|
||||
|
||||
s32 Year;
|
||||
s32 Month;
|
||||
s32 Day;
|
||||
s32 Hour; // [0:23]
|
||||
s32 Minute;
|
||||
s32 Second;
|
||||
s32 Year;
|
||||
s32 Month;
|
||||
s32 Day;
|
||||
s32 Hour; // [0:23]
|
||||
s32 Minute;
|
||||
s32 Second;
|
||||
} system_time;
|
||||
|
||||
internal r64
|
||||
SecondsElapsed(system_time Start, system_time End)
|
||||
{
|
||||
u64 N = End.NanosSinceEpoch - Start.NanosSinceEpoch;
|
||||
r64 S = (r64)N * NanosToSeconds;
|
||||
return S;
|
||||
u64 N = End.NanosSinceEpoch - Start.NanosSinceEpoch;
|
||||
r64 S = (r64)N * NanosToSeconds;
|
||||
return S;
|
||||
}
|
||||
|
||||
struct context
|
||||
{
|
||||
gs_thread_context ThreadContext;
|
||||
gs_thread_context ThreadContext;
|
||||
|
||||
u8* MemoryBase;
|
||||
u32 MemorySize;
|
||||
u8* MemoryBase;
|
||||
u32 MemorySize;
|
||||
|
||||
b32 WindowIsVisible;
|
||||
rect2 WindowBounds;
|
||||
r64 TotalTime;
|
||||
r32 DeltaTime;
|
||||
mouse_state Mouse;
|
||||
b32 WindowIsVisible;
|
||||
rect2 WindowBounds;
|
||||
r64 TotalTime;
|
||||
r32 DeltaTime;
|
||||
mouse_state Mouse;
|
||||
|
||||
// Application Services
|
||||
initialize_application* InitializeApplication;
|
||||
reload_static_data* ReloadStaticData;
|
||||
update_and_render* UpdateAndRender;
|
||||
cleanup_application* CleanupApplication;
|
||||
// Application Services
|
||||
initialize_application* InitializeApplication;
|
||||
reload_static_data* ReloadStaticData;
|
||||
update_and_render* UpdateAndRender;
|
||||
cleanup_application* CleanupApplication;
|
||||
|
||||
platform_thread_manager* ThreadManager;
|
||||
platform_socket_manager* SocketManager;
|
||||
platform_thread_manager* ThreadManager;
|
||||
platform_socket_manager* SocketManager;
|
||||
|
||||
// Platform Services
|
||||
gs_work_queue* GeneralWorkQueue;
|
||||
// Platform Services
|
||||
gs_work_queue* GeneralWorkQueue;
|
||||
|
||||
platform_get_gpu_texture_handle* PlatformGetGPUTextureHandle;
|
||||
platform_get_font_info* PlatformGetFontInfo;
|
||||
platform_draw_font_codepoint* PlatformDrawFontCodepoint;
|
||||
platform_get_gpu_texture_handle* PlatformGetGPUTextureHandle;
|
||||
platform_get_font_info* PlatformGetFontInfo;
|
||||
platform_draw_font_codepoint* PlatformDrawFontCodepoint;
|
||||
|
||||
platform_get_socket_handle* PlatformGetSocketHandle;
|
||||
platform_get_socket_handle* PlatformGetSocketHandle;
|
||||
|
||||
system_time SystemTime_Last;
|
||||
system_time SystemTime_Current;
|
||||
system_time SystemTime_Last;
|
||||
system_time SystemTime_Current;
|
||||
|
||||
//
|
||||
bool Headless;
|
||||
//
|
||||
bool Headless;
|
||||
};
|
||||
|
||||
#define FOLDHAUS_PLATFORM_H
|
||||
|
|
Loading…
Reference in New Issue