Gut raylib usage from the codebase.
Going to either fully commit to sokol or if it fails, rolling the platform layer myself.
This commit is contained in:
		| @@ -1,6 +1,27 @@ | ||||
| package sectr | ||||
|  | ||||
| context_ext :: proc( $ Type : typeid ) -> (^Type) { | ||||
| context_usr :: #force_inline proc( $ Type : typeid ) -> (^Type) { | ||||
| 	return cast(^Type) context.user_ptr | ||||
| } | ||||
|  | ||||
| ContextExt :: struct { | ||||
| 	stack : StackFixed(rawptr, 1024), | ||||
| } | ||||
|  | ||||
| // Assign return value to context.user_ptr | ||||
| // context_ext_init :: proc() -> rawptr | ||||
| // { | ||||
|  | ||||
| // } | ||||
|  | ||||
| context_ext :: #force_inline proc() -> ^ContextExt { | ||||
| 	return cast(^ContextExt) context.user_ptr | ||||
| } | ||||
|  | ||||
| context_push :: proc( value : ^($Type) ) { | ||||
| 	push( & context_ext().stack, value ) | ||||
| } | ||||
|  | ||||
| context_pop :: proc( value : ^($Type) ) { | ||||
| 	pop( & context_ext().stack ) | ||||
| } | ||||
|   | ||||
| @@ -19,14 +19,14 @@ MemoryTracker :: struct { | ||||
|  | ||||
| Track_Memory :: false | ||||
|  | ||||
| tracker_msg_buffer : [Kilobyte * 16]u8 | ||||
| // tracker_msg_buffer : [Kilobyte * 16]u8 | ||||
|  | ||||
| memtracker_clear :: proc ( tracker : MemoryTracker ) { | ||||
| 	when ! Track_Memory { | ||||
| 		return | ||||
| 	} | ||||
| 	temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	context.temp_allocator = arena_allocator(& temp_arena) | ||||
| 	// temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	// context.temp_allocator = arena_allocator(& temp_arena) | ||||
|  | ||||
| 	logf("Clearing tracker: %v", tracker.name) | ||||
| 	memtracker_dump_entries(tracker); | ||||
| @@ -38,8 +38,8 @@ memtracker_init :: proc ( tracker : ^MemoryTracker, allocator : Allocator, num_e | ||||
| 	when ! Track_Memory { | ||||
| 		return | ||||
| 	} | ||||
| 	temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	context.temp_allocator = arena_allocator(& temp_arena) | ||||
| 	// temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	// context.temp_allocator = arena_allocator(& temp_arena) | ||||
|  | ||||
| 	tracker.name = name | ||||
|  | ||||
| @@ -56,8 +56,8 @@ memtracker_register :: proc( tracker : ^MemoryTracker, new_entry : MemoryTracker | ||||
| 		return | ||||
| 	} | ||||
| 	profile(#procedure) | ||||
| 	temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	context.temp_allocator = arena_allocator(& temp_arena) | ||||
| 	// temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	// context.temp_allocator = arena_allocator(& temp_arena) | ||||
|  | ||||
| 	if tracker.entries.num == tracker.entries.capacity { | ||||
| 		ensure(false, "Memory tracker entries array full, can no longer register any more allocations") | ||||
| @@ -110,8 +110,8 @@ memtracker_unregister :: proc( tracker : MemoryTracker, to_remove : MemoryTracke | ||||
| 		return | ||||
| 	} | ||||
| 	profile(#procedure) | ||||
| 	temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	context.temp_allocator = arena_allocator(& temp_arena) | ||||
| 	// temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	// context.temp_allocator = arena_allocator(& temp_arena) | ||||
|  | ||||
| 	entries := array_to_slice(tracker.entries) | ||||
| 	for idx in 0..< tracker.entries.num | ||||
| @@ -139,8 +139,8 @@ memtracker_check_for_collisions :: proc ( tracker : MemoryTracker ) | ||||
| 		return | ||||
| 	} | ||||
| 	profile(#procedure) | ||||
| 	temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	context.temp_allocator = arena_allocator(& temp_arena) | ||||
| 	// temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	// context.temp_allocator = arena_allocator(& temp_arena) | ||||
|  | ||||
| 	entries := array_to_slice(tracker.entries) | ||||
| 	for idx in 1 ..< tracker.entries.num { | ||||
| @@ -161,8 +161,8 @@ memtracker_dump_entries :: proc( tracker : MemoryTracker ) | ||||
| 	when ! Track_Memory { | ||||
| 		return | ||||
| 	} | ||||
| 	temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	context.temp_allocator = arena_allocator(& temp_arena) | ||||
| 	// temp_arena : Arena; arena_init(& temp_arena, tracker_msg_buffer[:]) | ||||
| 	// context.temp_allocator = arena_allocator(& temp_arena) | ||||
|  | ||||
| 	log( "Dumping Memory Tracker:") | ||||
| 	for idx in 0 ..< tracker.entries.num { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user