Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 15a8acf

Browse files
committedMay 2, 2022
Add webgl2 IDL spec and generated code
1 parent 671a5c4 commit 15a8acf

12 files changed

+1697
-0
lines changed
 

‎Sources/DOMKit/WebIDL/Strings.swift

+94
Large diffs are not rendered by default.

‎Sources/DOMKit/WebIDL/Typedefs.swift

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public typealias GLuint = UInt32
2929
public typealias GLfloat = Float
3030
public typealias GLclampf = Float
3131

32+
public typealias GLint64 = Int64
33+
public typealias GLuint64 = UInt64
34+
3235
public typealias MutationCallback = ([MutationRecord], MutationObserver) -> Void
3336
public typealias BlobCallback = (Blob?) -> Void
3437
public typealias FunctionStringCallback = (String) -> Void
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public protocol Any_Uint32List: ConvertibleToJSValue {}
7+
extension Uint32Array: Any_Uint32List {}
8+
extension Array: Any_Uint32List where Element == GLuint {}
9+
10+
public enum Uint32List: JSValueCompatible, Any_Uint32List {
11+
case uint32Array(Uint32Array)
12+
case seq_of_GLuint([GLuint])
13+
14+
var uint32Array: Uint32Array? {
15+
switch self {
16+
case let .uint32Array(uint32Array): return uint32Array
17+
default: return nil
18+
}
19+
}
20+
21+
var seq_of_GLuint: [GLuint]? {
22+
switch self {
23+
case let .seq_of_GLuint(seq_of_GLuint): return seq_of_GLuint
24+
default: return nil
25+
}
26+
}
27+
28+
public static func construct(from value: JSValue) -> Self? {
29+
if let uint32Array: Uint32Array = value.fromJSValue() {
30+
return .uint32Array(uint32Array)
31+
}
32+
if let seq_of_GLuint: [GLuint] = value.fromJSValue() {
33+
return .seq_of_GLuint(seq_of_GLuint)
34+
}
35+
return nil
36+
}
37+
38+
public var jsValue: JSValue {
39+
switch self {
40+
case let .uint32Array(uint32Array):
41+
return uint32Array.jsValue
42+
case let .seq_of_GLuint(seq_of_GLuint):
43+
return seq_of_GLuint.jsValue
44+
}
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public class WebGL2RenderingContext: JSBridgedClass, WebGLRenderingContextBase, WebGL2RenderingContextBase, WebGL2RenderingContextOverloads {
7+
@inlinable public class var constructor: JSFunction { JSObject.global[Strings.WebGL2RenderingContext].function! }
8+
9+
public let jsObject: JSObject
10+
11+
public required init(unsafelyWrapping jsObject: JSObject) {
12+
self.jsObject = jsObject
13+
}
14+
}

‎Sources/DOMKit/WebIDL/WebGL2RenderingContextBase.swift

+1,162
Large diffs are not rendered by default.

‎Sources/DOMKit/WebIDL/WebGL2RenderingContextOverloads.swift

+317
Large diffs are not rendered by default.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public class WebGLQuery: WebGLObject {
7+
@inlinable override public class var constructor: JSFunction { JSObject.global[Strings.WebGLQuery].function! }
8+
9+
public required init(unsafelyWrapping jsObject: JSObject) {
10+
super.init(unsafelyWrapping: jsObject)
11+
}
12+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public class WebGLSampler: WebGLObject {
7+
@inlinable override public class var constructor: JSFunction { JSObject.global[Strings.WebGLSampler].function! }
8+
9+
public required init(unsafelyWrapping jsObject: JSObject) {
10+
super.init(unsafelyWrapping: jsObject)
11+
}
12+
}

‎Sources/DOMKit/WebIDL/WebGLSync.swift

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public class WebGLSync: WebGLObject {
7+
@inlinable override public class var constructor: JSFunction { JSObject.global[Strings.WebGLSync].function! }
8+
9+
public required init(unsafelyWrapping jsObject: JSObject) {
10+
super.init(unsafelyWrapping: jsObject)
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public class WebGLTransformFeedback: WebGLObject {
7+
@inlinable override public class var constructor: JSFunction { JSObject.global[Strings.WebGLTransformFeedback].function! }
8+
9+
public required init(unsafelyWrapping jsObject: JSObject) {
10+
super.init(unsafelyWrapping: jsObject)
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public class WebGLVertexArrayObject: WebGLObject {
7+
@inlinable override public class var constructor: JSFunction { JSObject.global[Strings.WebGLVertexArrayObject].function! }
8+
9+
public required init(unsafelyWrapping jsObject: JSObject) {
10+
super.init(unsafelyWrapping: jsObject)
11+
}
12+
}

‎parse-idl/parse-all.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ console.log(
2525
"console",
2626
"webcodecs",
2727
"webgl1",
28+
"webgl2",
2829
].map((key) => parsedFiles[key]),
2930
null,
3031
2

0 commit comments

Comments
 (0)
Please sign in to comment.