diff options
| author | Karl Zylinski <karl@zylinski.se> | 2025-12-26 23:34:45 +0100 |
|---|---|---|
| committer | Karl Zylinski <karl@zylinski.se> | 2025-12-26 23:34:45 +0100 |
| commit | 7dee25bdcc069bbb0ceb5d4a1ac1a9e3009bfb83 (patch) | |
| tree | 2ba171e519dd2d8e65ba7f243c7e58e01083952a /core/sys | |
| parent | 7e39239907885447b73c8c03648a85554552f1bc (diff) | |
More allocator-aware webgl bindings and added more missing bindings.
Diffstat (limited to 'core/sys')
| -rw-r--r-- | core/sys/wasm/js/odin.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/sys/wasm/js/odin.js b/core/sys/wasm/js/odin.js index ca4af18b8..b0a01f66c 100644 --- a/core/sys/wasm/js/odin.js +++ b/core/sys/wasm/js/odin.js @@ -646,6 +646,27 @@ class WebGLInterface { } }, + GetActiveUniform: (program, index, size_ptr, type_ptr, name_buf_ptr, name_buf_len, name_len_ptr) => { + let info = this.ctx.getActiveUniform(program, index); + + if (size_ptr) { + this.mem.storeInt(size_ptr, info.size); + } + + if (type_ptr) { + this.mem.storeI32(type_ptr, info.type); + } + + if name_buf_ptr && name_buf_len > 0 { + let n = Math.min(name_buf_len, info.name.length); + let name = info.name.substring(0, n); + this.mem.loadBytes(name_buf_ptr, name_buf_len).set(new TextEncoder().encode(name)); + this.mem.storeInt(name_len_ptr, n); + } else if name_len_ptr { + this.mem.storeInt(name_len_ptr, info.name.length); + } + }, + GetAttribLocation: (program, name_ptr, name_len) => { let name = this.mem.loadString(name_ptr, name_len); return this.ctx.getAttribLocation(this.programs[program], name); |