Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Allocator function argument type in helpers #22

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/instancing/main.odin
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package main

import "base:runtime"
import "core:c"
import slog "../../sokol/log"
import sg "../../sokol/gfx"
import sapp "../../sokol/app"
Expand Down Expand Up @@ -123,7 +124,7 @@ frame :: proc "c" () {
// update instance data
sg.update_buffer(state.bind.vertex_buffers[1], {
ptr = &state.pos,
size = u64(state.cur_num_particles * size_of(m.vec3)),
size = c.size_t(state.cur_num_particles * size_of(m.vec3)),
})

// vertex shader uniform data with model-view-projection matrix
Expand Down
5 changes: 3 additions & 2 deletions sokol/helpers/allocator.odin
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ package sokol_helpers
import sapp "../app"
import sg "../gfx"
import "base:runtime"
import "core:c"

Allocator :: struct {
alloc_fn: proc "c" (size: u64, user_data: rawptr) -> rawptr,
alloc_fn: proc "c" (size: c.size_t, user_data: rawptr) -> rawptr,
free_fn: proc "c" (ptr: rawptr, user_data: rawptr),
user_data: rawptr,
}
Expand All @@ -22,7 +23,7 @@ allocator :: proc(context_ptr: ^runtime.Context) -> Allocator {
}
}

allocator_alloc_proc :: proc "c" (size: u64, user_data: rawptr) -> rawptr {
allocator_alloc_proc :: proc "c" (size: c.size_t, user_data: rawptr) -> rawptr {
context = (cast(^runtime.Context)user_data)^
bytes, err := runtime.mem_alloc(size = int(size))
if err != nil {
Expand Down
Loading