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