This commit is contained in:
agra
2026-03-02 17:18:47 +02:00
parent ba9c4d69ce
commit 2f4f898d54
20 changed files with 418 additions and 49 deletions

View File

@@ -0,0 +1,6 @@
OperatingSystem :: enum { macos; linux; windows; wasm; unknown; }
Architecture :: enum { aarch64; x86_64; wasm32; unknown; }
OS : OperatingSystem = .unknown;
ARCH : Architecture = .unknown;
POINTER_SIZE : s64 = 8;

View File

@@ -49,11 +49,11 @@ glGenVertexArrays : (s32, *u32) -> void = ---;
glGenBuffers : (s32, *u32) -> void = ---;
glBindVertexArray : (u32) -> void = ---;
glBindBuffer : (u32, u32) -> void = ---;
glBufferData : (u32, s64, *void, u32) -> void = ---;
glBufferData : (u32, isize, *void, u32) -> void = ---;
glVertexAttribPointer : (u32, s32, u32, u8, s32, *void) -> void = ---;
glEnableVertexAttribArray : (u32) -> void = ---;
glGetUniformLocation : (u32, [:0]u8) -> s32 = ---;
glUniformMatrix4fv : (s32, s32, u8, [16]f32) -> void = ---;
glGetUniformLocation : (u32, [*]u8) -> s32 = ---;
glUniformMatrix4fv : (s32, s32, u8, [*]f32) -> void = ---;
glUniform3f : (s32, f32, f32, f32) -> void = ---;
glDepthFunc : (u32) -> void = ---;
glUniform1f : (s32, f32) -> void = ---;
@@ -72,10 +72,11 @@ GL_ONE_MINUS_SRC_ALPHA :u32: 0x0303;
GL_TEXTURE0 :u32: 0x84C0;
GL_LINEAR :u32: 0x2601;
GL_RED :u32: 0x1903;
GL_R8 :u32: 0x8229;
GL_UNPACK_ALIGNMENT :u32: 0x0CF5;
glScissor : (s32, s32, s32, s32) -> void = ---;
glBufferSubData : (u32, s64, s64, *void) -> void = ---;
glBufferSubData : (u32, isize, isize, *void) -> void = ---;
glGenTextures : (s32, *u32) -> void = ---;
glBindTexture : (u32, u32) -> void = ---;
glTexImage2D : (u32, s32, s32, s32, s32, s32, u32, u32, *void) -> void = ---;
@@ -88,7 +89,7 @@ glPixelStorei : (u32, s32) -> void = ---;
// Loader: call once after creating GL context
// Pass in a proc loader (e.g. SDL_GL_GetProcAddress)
load_gl :: (get_proc: ([:0]u8) -> *void) {
load_gl :: (get_proc: ([*]u8) -> *void) {
glClearColor = xx get_proc("glClearColor");
glClear = xx get_proc("glClear");
glEnable = xx get_proc("glEnable");

View File

@@ -16,6 +16,7 @@ SDL_GL_CONTEXT_PROFILE_MASK :s32: 20;
// SDL_GLProfile
SDL_GL_CONTEXT_PROFILE_CORE :s32: 0x1;
SDL_GL_CONTEXT_PROFILE_ES :s32: 0x4;
// SDL_GLContextFlag
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG :s32: 0x2;

View File

@@ -9,8 +9,8 @@ setsockopt :: (fd: s32, level: s32, optname: s32, optval: *s32, optlen: u32) ->
bind :: (fd: s32, addr: *SockAddr, addrlen: u32) -> s32 #foreign libc;
listen :: (fd: s32, backlog: s32) -> s32 #foreign libc;
accept :: (fd: s32, addr: *SockAddr, addrlen: *u32) -> s32 #foreign libc;
read :: (fd: s32, buf: [*]u8, count: s64) -> s64 #foreign libc;
write :: (fd: s32, buf: [*]u8, count: s64) -> s64 #foreign libc;
read :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc;
write :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc;
close :: (fd: s32) -> s32 #foreign libc;
// Constants (macOS)