Delete WebMetal implementation in favor of WebGPU
[WebKit-https.git] / Source / JavaScriptCore / inspector / protocol / Canvas.json
1 {
2     "domain": "Canvas",
3     "availability": ["web"],
4     "description": "Canvas domain allows tracking of canvases that have an associated graphics context. Tracks canvases in the DOM and CSS canvases created with -webkit-canvas.",
5     "types": [
6         {
7             "id": "CanvasId",
8             "type": "string",
9             "description": "Unique canvas identifier."
10         },
11         {
12             "id": "ProgramId",
13             "type": "string",
14             "description": "Unique shader program identifier."
15         },
16         {
17             "id": "ContextType",
18             "type": "string",
19             "enum": ["canvas-2d", "bitmaprenderer", "webgl", "webgl2", "webgpu"],
20             "description": "The type of rendering context backing the canvas element."
21         },
22         {
23             "id": "ShaderType",
24             "type": "string",
25             "enum": ["fragment", "vertex"],
26             "description": "Shader type. WebGL supports vertex and fragment shaders."
27         },
28         {
29             "id": "ContextAttributes",
30             "type": "object",
31             "description": "Drawing surface attributes.",
32             "properties": [
33                 { "name": "alpha", "type": "boolean", "optional": true },
34                 { "name": "depth", "type": "boolean", "optional": true },
35                 { "name": "stencil", "type": "boolean", "optional": true },
36                 { "name": "antialias", "type": "boolean", "optional": true },
37                 { "name": "premultipliedAlpha", "type": "boolean", "optional": true },
38                 { "name": "preserveDrawingBuffer", "type": "boolean", "optional": true },
39                 { "name": "failIfMajorPerformanceCaveat", "type": "boolean", "optional": true }
40             ]
41         },
42         {
43             "id": "Canvas",
44             "type": "object",
45             "description": "Information about a canvas for which a rendering context has been created.",
46             "properties": [
47                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
48                 { "name": "contextType", "$ref": "ContextType", "description": "The type of rendering context backing the canvas." },
49                 { "name": "nodeId", "$ref": "DOM.NodeId", "optional": true, "description": "The corresponding DOM node id." },
50                 { "name": "cssCanvasName", "type": "string", "optional": true, "description": "The CSS canvas identifier, for canvases created with <code>document.getCSSCanvasContext</code>." },
51                 { "name": "contextAttributes", "$ref": "ContextAttributes", "optional": true, "description": "Context attributes for rendering contexts." },
52                 { "name": "memoryCost", "type": "number", "optional": true, "description": "Memory usage of the canvas in bytes." },
53                 { "name": "backtrace", "type": "array", "items": { "$ref": "Console.CallFrame" }, "optional": true, "description": "Backtrace that was captured when this canvas context was created." }
54             ]
55         }
56     ],
57     "commands": [
58         {
59             "name": "enable",
60             "description": "Enables Canvas domain events."
61         },
62         {
63             "name": "disable",
64             "description": "Disables Canvas domain events."
65         },
66         {
67             "name": "requestNode",
68             "description": "Gets the NodeId for the canvas node with the given CanvasId.",
69             "parameters": [
70                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }
71             ],
72             "returns": [
73                 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Node identifier for given canvas." }
74             ]
75         },
76         {
77             "name": "requestContent",
78             "description": "Gets the data for the canvas node with the given CanvasId.",
79             "parameters": [
80                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." }
81             ],
82             "returns": [
83                 { "name": "content", "type": "string", "description": "Base64-encoded data of the canvas' contents." }
84             ]
85         },
86         {
87             "name": "requestCSSCanvasClientNodes",
88             "description": "Gets all the nodes that are using this canvas via -webkit-canvas.",
89             "parameters": [
90                 { "name": "canvasId", "$ref": "CanvasId" }
91             ],
92             "returns": [
93                 { "name": "clientNodeIds", "type": "array", "items": { "$ref": "DOM.NodeId" } }
94             ]
95         },
96         {
97             "name": "resolveCanvasContext",
98             "description": "Resolves JavaScript canvas context object for given canvasId.",
99             "parameters": [
100                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
101                 { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }
102             ],
103             "returns": [
104                 { "name": "object", "$ref": "Runtime.RemoteObject", "description": "JavaScript object wrapper for given canvas context." }
105             ]
106         },
107         {
108             "name": "setRecordingAutoCaptureFrameCount",
109             "description": "Tells the backend to record `count` frames whenever a new context is created.",
110             "parameters": [
111                 { "name": "count", "type": "integer", "description": "Number of frames to record (0 means don't record anything)." }
112             ]
113         },
114         {
115             "name": "startRecording",
116             "description": "Record the next frame, or up to the given number of bytes of data, for the given canvas.",
117             "parameters": [
118                 { "name": "canvasId", "$ref": "CanvasId" },
119                 { "name": "frameCount", "type": "integer", "optional": true, "description": "Number of frames to record (unlimited when not specified)." },
120                 { "name": "memoryLimit", "type": "integer", "optional": true, "description": "Memory limit of recorded data (100MB when not specified)." }
121             ]
122         },
123         {
124             "name": "stopRecording",
125             "description": "Stop recording the given canvas.",
126             "parameters": [
127                 { "name": "canvasId", "$ref": "CanvasId" }
128             ]
129         },
130         {
131             "name": "requestShaderSource",
132             "description": "Requests the source of the shader of the given type from the program with the given id.",
133             "parameters": [
134                 { "name": "programId", "$ref": "ProgramId" },
135                 { "name": "shaderType", "$ref": "ShaderType" }
136             ],
137             "returns": [
138                 { "name": "content", "type": "string" }
139             ]
140         },
141         {
142             "name": "updateShader",
143             "description": "Compiles and links the shader with identifier and type with the given source code.",
144             "parameters": [
145                 { "name": "programId", "$ref": "ProgramId" },
146                 { "name": "shaderType", "$ref": "ShaderType" },
147                 { "name": "source", "type": "string" }
148             ]
149         },
150         {
151             "name": "setShaderProgramDisabled",
152             "description": "Enable/disable the visibility of the given shader program.",
153             "parameters": [
154                 { "name": "programId", "$ref": "ProgramId" },
155                 { "name": "disabled", "type": "boolean" }
156             ]
157         },
158         {
159             "name": "setShaderProgramHighlighted",
160             "description": "Enable/disable highlighting of the given shader program.",
161             "parameters": [
162                 { "name": "programId", "$ref": "ProgramId" },
163                 { "name": "highlighted", "type": "boolean" }
164             ]
165         }
166     ],
167     "events": [
168         {
169             "name": "canvasAdded",
170             "parameters": [
171                 { "name": "canvas", "$ref": "Canvas", "description": "Canvas object." }
172             ]
173         },
174         {
175             "name": "canvasRemoved",
176             "parameters": [
177                 { "name": "canvasId", "$ref": "CanvasId", "description": "Removed canvas identifier." }
178             ]
179         },
180         {
181             "name": "canvasMemoryChanged",
182             "parameters": [
183                 { "name": "canvasId", "$ref": "CanvasId", "description": "Identifier of canvas that changed." },
184                 { "name": "memoryCost", "type": "number", "description": "New memory cost value for the canvas in bytes." }
185             ]
186         },
187         {
188             "name": "extensionEnabled",
189             "parameters": [
190                 { "name": "canvasId", "$ref": "CanvasId" },
191                 { "name": "extension", "type": "string", "description": "Name of the extension that was enabled." }
192             ]
193         },
194         {
195             "name": "cssCanvasClientNodesChanged",
196             "parameters": [
197                 { "name": "canvasId", "$ref": "CanvasId", "description": "Identifier of canvas that changed." }
198             ]
199         },
200         {
201             "name": "recordingStarted",
202             "parameters": [
203                 { "name": "canvasId", "$ref": "CanvasId" },
204                 { "name": "initiator", "$ref": "Recording.Initiator" }
205             ]
206         },
207         {
208             "name": "recordingProgress",
209             "parameters": [
210                 { "name": "canvasId", "$ref": "CanvasId" },
211                 { "name": "frames", "type": "array", "items": { "$ref": "Recording.Frame" }},
212                 { "name": "bufferUsed", "type": "integer", "description": "Total memory size in bytes of all data recorded since the recording began." }
213             ]
214         },
215         {
216             "name": "recordingFinished",
217             "parameters": [
218                 { "name": "canvasId", "$ref": "CanvasId" },
219                 { "name": "recording", "$ref": "Recording.Recording", "optional": true }
220             ]
221         },
222         {
223             "name": "programCreated",
224             "parameters": [
225                 { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
226                 { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." }
227             ]
228         },
229         {
230             "name": "programDeleted",
231             "parameters": [
232                 { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." }
233             ]
234         }
235     ]
236 }