mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add vendor:wgpu
This commit is contained in:
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
package wgpu
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
g_context: runtime.Context
|
||||
|
||||
@(private="file", init)
|
||||
wgpu_init_allocator :: proc() {
|
||||
if g_context.allocator.procedure == nil {
|
||||
g_context = runtime.default_context()
|
||||
}
|
||||
}
|
||||
|
||||
@(private="file", export)
|
||||
wgpu_alloc :: proc "contextless" (size: i32) -> [^]byte {
|
||||
context = g_context
|
||||
bytes, err := runtime.mem_alloc(int(size), 16)
|
||||
assert(err == nil, "wgpu_alloc failed")
|
||||
return raw_data(bytes)
|
||||
}
|
||||
|
||||
@(private="file", export)
|
||||
wgpu_free :: proc "contextless" (ptr: rawptr) {
|
||||
context = g_context
|
||||
assert(free(ptr) == nil, "wgpu_free failed")
|
||||
}
|
||||
Reference in New Issue
Block a user