@thi.ng/wasm-api-webgl 0.1.71 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/api.d.ts +1 -1
- package/api.js +1 -1
- package/generated/{api.d.ts → types.d.ts} +2 -2
- package/gl.d.ts +1 -1
- package/gl.js +1 -1
- package/package.json +11 -11
- package/zig/lib.zig +24 -18
- package/zig/{api.zig → types.zig} +2 -1
- /package/generated/{api.js → types.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-
|
|
3
|
+
- **Last updated**: 2025-09-01T16:38:35Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -11,6 +11,15 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
11
11
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
12
12
|
and/or version bumps of transitive dependencies.
|
|
13
13
|
|
|
14
|
+
# [1.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@1.0.0) (2025-09-01)
|
|
15
|
+
|
|
16
|
+
#### 🛑 Breaking changes
|
|
17
|
+
|
|
18
|
+
- internal restructure of generated types ([76a1592](https://github.com/thi-ng/umbrella/commit/76a1592))
|
|
19
|
+
- BREAKING CHANGE: internal restructure due to breaking Zig 0.15.1 changes
|
|
20
|
+
- `usenamespace` syntax deprecated in Zig 0.15.1, so earlier struct/namespace merging not possible anymore
|
|
21
|
+
- instead, generated types exposed via `types` (e.g. `gl.ShaderSpec` => `gl.types.ShaderSpec`)
|
|
22
|
+
|
|
14
23
|
### [0.1.16](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@0.1.16) (2024-11-10)
|
|
15
24
|
|
|
16
25
|
#### ♻️ Refactoring
|
package/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WasmExports } from "@thi.ng/wasm-api";
|
|
2
2
|
import type { WasmDomExports } from "@thi.ng/wasm-api-dom";
|
|
3
|
-
export * from "./generated/
|
|
3
|
+
export * from "./generated/types.js";
|
|
4
4
|
export interface WasmWebGLImports extends WebAssembly.ModuleImports {
|
|
5
5
|
canvasGLContext(canvasID: number, opts: number): number;
|
|
6
6
|
createShader(ctxID: number, shaderSpec: number): number;
|
package/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./generated/
|
|
1
|
+
export * from "./generated/types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by @thi.ng/wasm-api-bindgen at
|
|
2
|
+
* Generated by @thi.ng/wasm-api-bindgen at 2025-09-01T11:06:15.183Z
|
|
3
3
|
* DO NOT EDIT!
|
|
4
4
|
*/
|
|
5
5
|
import { WasmStringPtr, type WasmTypeBase } from "@thi.ng/wasm-api";
|
|
@@ -277,4 +277,4 @@ export declare enum UniformType {
|
|
|
277
277
|
sampler3D = 10,
|
|
278
278
|
samplerCube = 11
|
|
279
279
|
}
|
|
280
|
-
//# sourceMappingURL=
|
|
280
|
+
//# sourceMappingURL=types.d.ts.map
|
package/gl.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type WasmDom } from "@thi.ng/wasm-api-dom";
|
|
|
3
3
|
import { ObjectIndex } from "@thi.ng/wasm-api/object-index";
|
|
4
4
|
import type { ITexture, Shader, ModelSpec as WEBGL_ModelSpec } from "@thi.ng/webgl";
|
|
5
5
|
import type { AttribUpdateSpec, WasmWebGLExports, WasmWebGLImports, WebGLContextOpts } from "./api.js";
|
|
6
|
-
import { type ModelSpec, type ShaderSpec, type TextureSpec, type UniformValue } from "./generated/
|
|
6
|
+
import { type ModelSpec, type ShaderSpec, type TextureSpec, type UniformValue } from "./generated/types.js";
|
|
7
7
|
/**
|
|
8
8
|
* WASM module descriptor for use as dependency object in other module
|
|
9
9
|
* definitions or for direct use with
|
package/gl.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api-webgl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "WebGL bridge API for hybrid TypeScript & WASM (Zig) applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
32
32
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
33
33
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
34
|
-
"build:types": "npx wasm-api-bindgen -a analytics.json --config src/typedefs-config.json --lang ts -o src/generated/
|
|
34
|
+
"build:types": "npx wasm-api-bindgen -a analytics.json --config src/typedefs-config.json --lang ts -o src/generated/types.ts --lang zig -o zig/types.zig src/typedefs.json",
|
|
35
35
|
"clean": "bun ../../tools/src/clean-package.ts",
|
|
36
36
|
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
|
|
37
37
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@thi.ng/api": "^8.12.
|
|
44
|
-
"@thi.ng/errors": "^2.5.
|
|
45
|
-
"@thi.ng/wasm-api": "^2.
|
|
46
|
-
"@thi.ng/wasm-api-dom": "^
|
|
47
|
-
"@thi.ng/webgl": "^6.9.
|
|
43
|
+
"@thi.ng/api": "^8.12.2",
|
|
44
|
+
"@thi.ng/errors": "^2.5.42",
|
|
45
|
+
"@thi.ng/wasm-api": "^2.4.0",
|
|
46
|
+
"@thi.ng/wasm-api-dom": "^2.0.0",
|
|
47
|
+
"@thi.ng/webgl": "^6.9.76"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@thi.ng/wasm-api-bindgen": "^1.2.
|
|
51
|
-
"esbuild": "^0.25.
|
|
52
|
-
"typedoc": "^0.28.
|
|
50
|
+
"@thi.ng/wasm-api-bindgen": "^1.2.39",
|
|
51
|
+
"esbuild": "^0.25.9",
|
|
52
|
+
"typedoc": "^0.28.12",
|
|
53
53
|
"typescript": "^5.9.2"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"tag": "wasm",
|
|
100
100
|
"year": 2024
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "e215a3e8de3809736ba0042c93bd8703a5a1a337\n"
|
|
103
103
|
}
|
package/zig/lib.zig
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
const std = @import("std");
|
|
3
|
-
const api = @import("api.zig");
|
|
4
3
|
|
|
5
|
-
pub
|
|
4
|
+
pub const types = @import("types.zig");
|
|
6
5
|
|
|
7
|
-
pub extern "webgl" fn canvasGLContext(canvasID: i32, opts: *const
|
|
6
|
+
pub extern "webgl" fn canvasGLContext(canvasID: i32, opts: *const types.WebGLContextOpts) i32;
|
|
8
7
|
|
|
9
|
-
pub extern "webgl" fn createShader(ctxID: i32, spec: *const
|
|
8
|
+
pub extern "webgl" fn createShader(ctxID: i32, spec: *const types.ShaderSpec) i32;
|
|
10
9
|
|
|
11
|
-
pub extern "webgl" fn createModel(ctxID: i32, spec: *const
|
|
10
|
+
pub extern "webgl" fn createModel(ctxID: i32, spec: *const types.ModelSpec) i32;
|
|
12
11
|
|
|
13
|
-
pub extern "webgl" fn createTexture(ctxID: i32, spec: *const
|
|
12
|
+
pub extern "webgl" fn createTexture(ctxID: i32, spec: *const types.TextureSpec) i32;
|
|
14
13
|
|
|
15
|
-
pub extern "webgl" fn updateAttrib(modelID: i32, name: [*:0]const u8, spec: *const
|
|
14
|
+
pub extern "webgl" fn updateAttrib(modelID: i32, name: [*:0]const u8, spec: *const types.AttribUpdateSpec) void;
|
|
16
15
|
|
|
17
16
|
pub extern "webgl" fn uniformVec(modelID: i32, name: [*:0]const u8, value: [*]const f32, size: u32) void;
|
|
18
17
|
|
|
@@ -30,6 +29,13 @@ pub extern "webgl" fn draw(modelID: i32) void;
|
|
|
30
29
|
|
|
31
30
|
pub extern "webgl" fn clear(ctxID: i32, r: f32, g: f32, b: f32, a: f32) void;
|
|
32
31
|
|
|
32
|
+
// hoist generated helpers
|
|
33
|
+
pub const modelAttribs = types.modelAttribs;
|
|
34
|
+
pub const modelUniforms = types.modelUniforms;
|
|
35
|
+
pub const shaderAttribs = types.shaderAttribs;
|
|
36
|
+
pub const shaderUniforms = types.shaderUniforms;
|
|
37
|
+
pub const shaderVaryings = types.shaderVaryings;
|
|
38
|
+
|
|
33
39
|
// Syntax sugar for `uniformVec()` and vec2 values
|
|
34
40
|
pub fn uniformVec2(modelID: i32, name: [*:0]const u8, value: *const [2]f32) void {
|
|
35
41
|
uniformVec(modelID, name, value, 2);
|
|
@@ -67,7 +73,7 @@ pub fn modelAttribF32(
|
|
|
67
73
|
size: usize,
|
|
68
74
|
stride: usize,
|
|
69
75
|
offset: usize,
|
|
70
|
-
)
|
|
76
|
+
) types.ModelAttribSpec {
|
|
71
77
|
return .{
|
|
72
78
|
.name = name,
|
|
73
79
|
.data = attribDataF32(data),
|
|
@@ -85,7 +91,7 @@ pub fn modelAttribI32(
|
|
|
85
91
|
size: usize,
|
|
86
92
|
stride: usize,
|
|
87
93
|
offset: usize,
|
|
88
|
-
)
|
|
94
|
+
) types.ModelAttribSpec {
|
|
89
95
|
return .{
|
|
90
96
|
.name = name,
|
|
91
97
|
.data = attribDataI32(data),
|
|
@@ -103,7 +109,7 @@ pub fn modelAttribU32(
|
|
|
103
109
|
size: usize,
|
|
104
110
|
stride: usize,
|
|
105
111
|
offset: usize,
|
|
106
|
-
)
|
|
112
|
+
) types.ModelAttribSpec {
|
|
107
113
|
return .{
|
|
108
114
|
.name = name,
|
|
109
115
|
.data = attribDataU32(data),
|
|
@@ -126,19 +132,19 @@ pub fn updateAttribU32(modelID: i32, name: [*:0]const u8, data: []const u32, off
|
|
|
126
132
|
updateAttrib(modelID, name, &.{ .data = attribDataU32(data), .offset = offset });
|
|
127
133
|
}
|
|
128
134
|
|
|
129
|
-
pub inline fn attribDataF32(data: []const f32)
|
|
130
|
-
return .{ .f32 =
|
|
135
|
+
pub inline fn attribDataF32(data: []const f32) types.ModelAttribData {
|
|
136
|
+
return .{ .f32 = types.ConstF32Slice.wrap(data) };
|
|
131
137
|
}
|
|
132
138
|
|
|
133
|
-
pub inline fn attribDataI32(data: []const i32)
|
|
134
|
-
return .{ .i32 =
|
|
139
|
+
pub inline fn attribDataI32(data: []const i32) types.ModelAttribData {
|
|
140
|
+
return .{ .i32 = types.ConstI32Slice.wrap(data) };
|
|
135
141
|
}
|
|
136
142
|
|
|
137
|
-
pub inline fn attribDataU32(data: []const u32)
|
|
138
|
-
return .{ .u32 =
|
|
143
|
+
pub inline fn attribDataU32(data: []const u32) types.ModelAttribData {
|
|
144
|
+
return .{ .u32 = types.ConstI32Slice.wrap(data) };
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
/// Syntax sugar for defining u8 based `ImageData` from ABGR u32 source data
|
|
142
|
-
pub inline fn textureDataU32(data: []const u32)
|
|
143
|
-
return .{ .u8 =
|
|
148
|
+
pub inline fn textureDataU32(data: []const u32) types.ImageData {
|
|
149
|
+
return .{ .u8 = types.ConstU8Slice.wrap(std.mem.sliceAsBytes(data)) };
|
|
144
150
|
}
|
|
File without changes
|