OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 library gpu_capabilities_mojom; | |
6 | |
7 import 'dart:async'; | |
8 | |
9 import 'package:mojo/bindings.dart' as bindings; | |
10 import 'package:mojo/core.dart' as core; | |
11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; | |
12 | |
13 | |
14 | |
15 | |
16 class GpuShaderPrecision extends bindings.Struct { | |
17 static const List<bindings.StructDataHeader> kVersions = const [ | |
18 const bindings.StructDataHeader(24, 0) | |
19 ]; | |
20 int minRange = 0; | |
21 int maxRange = 0; | |
22 int precision = 0; | |
23 | |
24 GpuShaderPrecision() : super(kVersions.last.size); | |
25 | |
26 static GpuShaderPrecision deserialize(bindings.Message message) { | |
27 var decoder = new bindings.Decoder(message); | |
28 var result = decode(decoder); | |
29 if (decoder.excessHandles != null) { | |
30 decoder.excessHandles.forEach((h) => h.close()); | |
31 } | |
32 return result; | |
33 } | |
34 | |
35 static GpuShaderPrecision decode(bindings.Decoder decoder0) { | |
36 if (decoder0 == null) { | |
37 return null; | |
38 } | |
39 GpuShaderPrecision result = new GpuShaderPrecision(); | |
40 | |
41 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
42 if (mainDataHeader.version <= kVersions.last.version) { | |
43 // Scan in reverse order to optimize for more recent versions. | |
44 for (int i = kVersions.length - 1; i >= 0; --i) { | |
45 if (mainDataHeader.version >= kVersions[i].version) { | |
46 if (mainDataHeader.size == kVersions[i].size) { | |
47 // Found a match. | |
48 break; | |
49 } | |
50 throw new bindings.MojoCodecError( | |
51 'Header size doesn\'t correspond to known version size.'); | |
52 } | |
53 } | |
54 } else if (mainDataHeader.size < kVersions.last.size) { | |
55 throw new bindings.MojoCodecError( | |
56 'Message newer than the last known version cannot be shorter than ' | |
57 'required by the last known version.'); | |
58 } | |
59 if (mainDataHeader.version >= 0) { | |
60 | |
61 result.minRange = decoder0.decodeInt32(8); | |
62 } | |
63 if (mainDataHeader.version >= 0) { | |
64 | |
65 result.maxRange = decoder0.decodeInt32(12); | |
66 } | |
67 if (mainDataHeader.version >= 0) { | |
68 | |
69 result.precision = decoder0.decodeInt32(16); | |
70 } | |
71 return result; | |
72 } | |
73 | |
74 void encode(bindings.Encoder encoder) { | |
75 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
76 | |
77 encoder0.encodeInt32(minRange, 8); | |
78 | |
79 encoder0.encodeInt32(maxRange, 12); | |
80 | |
81 encoder0.encodeInt32(precision, 16); | |
82 } | |
83 | |
84 String toString() { | |
85 return "GpuShaderPrecision(" | |
86 "minRange: $minRange" ", " | |
87 "maxRange: $maxRange" ", " | |
88 "precision: $precision" ")"; | |
89 } | |
90 | |
91 Map toJson() { | |
92 Map map = new Map(); | |
93 map["minRange"] = minRange; | |
94 map["maxRange"] = maxRange; | |
95 map["precision"] = precision; | |
96 return map; | |
97 } | |
98 } | |
99 | |
100 | |
101 | |
102 | |
103 class GpuPerStagePrecisions extends bindings.Struct { | |
104 static const List<bindings.StructDataHeader> kVersions = const [ | |
105 const bindings.StructDataHeader(56, 0) | |
106 ]; | |
107 GpuShaderPrecision lowInt = null; | |
108 GpuShaderPrecision mediumInt = null; | |
109 GpuShaderPrecision highInt = null; | |
110 GpuShaderPrecision lowFloat = null; | |
111 GpuShaderPrecision mediumFloat = null; | |
112 GpuShaderPrecision highFloat = null; | |
113 | |
114 GpuPerStagePrecisions() : super(kVersions.last.size); | |
115 | |
116 static GpuPerStagePrecisions deserialize(bindings.Message message) { | |
117 var decoder = new bindings.Decoder(message); | |
118 var result = decode(decoder); | |
119 if (decoder.excessHandles != null) { | |
120 decoder.excessHandles.forEach((h) => h.close()); | |
121 } | |
122 return result; | |
123 } | |
124 | |
125 static GpuPerStagePrecisions decode(bindings.Decoder decoder0) { | |
126 if (decoder0 == null) { | |
127 return null; | |
128 } | |
129 GpuPerStagePrecisions result = new GpuPerStagePrecisions(); | |
130 | |
131 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
132 if (mainDataHeader.version <= kVersions.last.version) { | |
133 // Scan in reverse order to optimize for more recent versions. | |
134 for (int i = kVersions.length - 1; i >= 0; --i) { | |
135 if (mainDataHeader.version >= kVersions[i].version) { | |
136 if (mainDataHeader.size == kVersions[i].size) { | |
137 // Found a match. | |
138 break; | |
139 } | |
140 throw new bindings.MojoCodecError( | |
141 'Header size doesn\'t correspond to known version size.'); | |
142 } | |
143 } | |
144 } else if (mainDataHeader.size < kVersions.last.size) { | |
145 throw new bindings.MojoCodecError( | |
146 'Message newer than the last known version cannot be shorter than ' | |
147 'required by the last known version.'); | |
148 } | |
149 if (mainDataHeader.version >= 0) { | |
150 | |
151 var decoder1 = decoder0.decodePointer(8, false); | |
152 result.lowInt = GpuShaderPrecision.decode(decoder1); | |
153 } | |
154 if (mainDataHeader.version >= 0) { | |
155 | |
156 var decoder1 = decoder0.decodePointer(16, false); | |
157 result.mediumInt = GpuShaderPrecision.decode(decoder1); | |
158 } | |
159 if (mainDataHeader.version >= 0) { | |
160 | |
161 var decoder1 = decoder0.decodePointer(24, false); | |
162 result.highInt = GpuShaderPrecision.decode(decoder1); | |
163 } | |
164 if (mainDataHeader.version >= 0) { | |
165 | |
166 var decoder1 = decoder0.decodePointer(32, false); | |
167 result.lowFloat = GpuShaderPrecision.decode(decoder1); | |
168 } | |
169 if (mainDataHeader.version >= 0) { | |
170 | |
171 var decoder1 = decoder0.decodePointer(40, false); | |
172 result.mediumFloat = GpuShaderPrecision.decode(decoder1); | |
173 } | |
174 if (mainDataHeader.version >= 0) { | |
175 | |
176 var decoder1 = decoder0.decodePointer(48, false); | |
177 result.highFloat = GpuShaderPrecision.decode(decoder1); | |
178 } | |
179 return result; | |
180 } | |
181 | |
182 void encode(bindings.Encoder encoder) { | |
183 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
184 | |
185 encoder0.encodeStruct(lowInt, 8, false); | |
186 | |
187 encoder0.encodeStruct(mediumInt, 16, false); | |
188 | |
189 encoder0.encodeStruct(highInt, 24, false); | |
190 | |
191 encoder0.encodeStruct(lowFloat, 32, false); | |
192 | |
193 encoder0.encodeStruct(mediumFloat, 40, false); | |
194 | |
195 encoder0.encodeStruct(highFloat, 48, false); | |
196 } | |
197 | |
198 String toString() { | |
199 return "GpuPerStagePrecisions(" | |
200 "lowInt: $lowInt" ", " | |
201 "mediumInt: $mediumInt" ", " | |
202 "highInt: $highInt" ", " | |
203 "lowFloat: $lowFloat" ", " | |
204 "mediumFloat: $mediumFloat" ", " | |
205 "highFloat: $highFloat" ")"; | |
206 } | |
207 | |
208 Map toJson() { | |
209 Map map = new Map(); | |
210 map["lowInt"] = lowInt; | |
211 map["mediumInt"] = mediumInt; | |
212 map["highInt"] = highInt; | |
213 map["lowFloat"] = lowFloat; | |
214 map["mediumFloat"] = mediumFloat; | |
215 map["highFloat"] = highFloat; | |
216 return map; | |
217 } | |
218 } | |
219 | |
220 | |
221 | |
222 | |
223 class GpuCapabilities extends bindings.Struct { | |
224 static const List<bindings.StructDataHeader> kVersions = const [ | |
225 const bindings.StructDataHeader(80, 0) | |
226 ]; | |
227 GpuPerStagePrecisions vertexShaderPrecisions = null; | |
228 GpuPerStagePrecisions fragmentShaderPrecisions = null; | |
229 int maxCombinedTextureImageUnits = 0; | |
230 int maxCubeMapTextureSize = 0; | |
231 int maxFragmentUniformVectors = 0; | |
232 int maxRenderbufferSize = 0; | |
233 int maxTextureImageUnits = 0; | |
234 int maxTextureSize = 0; | |
235 int maxVaryingVectors = 0; | |
236 int maxVertexAttribs = 0; | |
237 int maxVertexTextureImageUnits = 0; | |
238 int maxVertexUniformVectors = 0; | |
239 int numCompressedTextureFormats = 0; | |
240 int numShaderBinaryFormats = 0; | |
241 int bindGeneratesResourceChromium = 0; | |
242 bool postSubBuffer = false; | |
243 bool eglImageExternal = false; | |
244 bool textureFormatBgra8888 = false; | |
245 bool textureFormatEtc1 = false; | |
246 bool textureFormatEtc1Npot = false; | |
247 bool textureRectangle = false; | |
248 bool iosurface = false; | |
249 bool textureUsage = false; | |
250 bool textureStorage = false; | |
251 bool discardFramebuffer = false; | |
252 bool syncQuery = false; | |
253 bool image = false; | |
254 bool futureSyncPoints = false; | |
255 bool blendEquationAdvanced = false; | |
256 bool blendEquationAdvancedCoherent = false; | |
257 | |
258 GpuCapabilities() : super(kVersions.last.size); | |
259 | |
260 static GpuCapabilities deserialize(bindings.Message message) { | |
261 var decoder = new bindings.Decoder(message); | |
262 var result = decode(decoder); | |
263 if (decoder.excessHandles != null) { | |
264 decoder.excessHandles.forEach((h) => h.close()); | |
265 } | |
266 return result; | |
267 } | |
268 | |
269 static GpuCapabilities decode(bindings.Decoder decoder0) { | |
270 if (decoder0 == null) { | |
271 return null; | |
272 } | |
273 GpuCapabilities result = new GpuCapabilities(); | |
274 | |
275 var mainDataHeader = decoder0.decodeStructDataHeader(); | |
276 if (mainDataHeader.version <= kVersions.last.version) { | |
277 // Scan in reverse order to optimize for more recent versions. | |
278 for (int i = kVersions.length - 1; i >= 0; --i) { | |
279 if (mainDataHeader.version >= kVersions[i].version) { | |
280 if (mainDataHeader.size == kVersions[i].size) { | |
281 // Found a match. | |
282 break; | |
283 } | |
284 throw new bindings.MojoCodecError( | |
285 'Header size doesn\'t correspond to known version size.'); | |
286 } | |
287 } | |
288 } else if (mainDataHeader.size < kVersions.last.size) { | |
289 throw new bindings.MojoCodecError( | |
290 'Message newer than the last known version cannot be shorter than ' | |
291 'required by the last known version.'); | |
292 } | |
293 if (mainDataHeader.version >= 0) { | |
294 | |
295 var decoder1 = decoder0.decodePointer(8, false); | |
296 result.vertexShaderPrecisions = GpuPerStagePrecisions.decode(decoder1); | |
297 } | |
298 if (mainDataHeader.version >= 0) { | |
299 | |
300 var decoder1 = decoder0.decodePointer(16, false); | |
301 result.fragmentShaderPrecisions = GpuPerStagePrecisions.decode(decoder1); | |
302 } | |
303 if (mainDataHeader.version >= 0) { | |
304 | |
305 result.maxCombinedTextureImageUnits = decoder0.decodeInt32(24); | |
306 } | |
307 if (mainDataHeader.version >= 0) { | |
308 | |
309 result.maxCubeMapTextureSize = decoder0.decodeInt32(28); | |
310 } | |
311 if (mainDataHeader.version >= 0) { | |
312 | |
313 result.maxFragmentUniformVectors = decoder0.decodeInt32(32); | |
314 } | |
315 if (mainDataHeader.version >= 0) { | |
316 | |
317 result.maxRenderbufferSize = decoder0.decodeInt32(36); | |
318 } | |
319 if (mainDataHeader.version >= 0) { | |
320 | |
321 result.maxTextureImageUnits = decoder0.decodeInt32(40); | |
322 } | |
323 if (mainDataHeader.version >= 0) { | |
324 | |
325 result.maxTextureSize = decoder0.decodeInt32(44); | |
326 } | |
327 if (mainDataHeader.version >= 0) { | |
328 | |
329 result.maxVaryingVectors = decoder0.decodeInt32(48); | |
330 } | |
331 if (mainDataHeader.version >= 0) { | |
332 | |
333 result.maxVertexAttribs = decoder0.decodeInt32(52); | |
334 } | |
335 if (mainDataHeader.version >= 0) { | |
336 | |
337 result.maxVertexTextureImageUnits = decoder0.decodeInt32(56); | |
338 } | |
339 if (mainDataHeader.version >= 0) { | |
340 | |
341 result.maxVertexUniformVectors = decoder0.decodeInt32(60); | |
342 } | |
343 if (mainDataHeader.version >= 0) { | |
344 | |
345 result.numCompressedTextureFormats = decoder0.decodeInt32(64); | |
346 } | |
347 if (mainDataHeader.version >= 0) { | |
348 | |
349 result.numShaderBinaryFormats = decoder0.decodeInt32(68); | |
350 } | |
351 if (mainDataHeader.version >= 0) { | |
352 | |
353 result.bindGeneratesResourceChromium = decoder0.decodeInt32(72); | |
354 } | |
355 if (mainDataHeader.version >= 0) { | |
356 | |
357 result.postSubBuffer = decoder0.decodeBool(76, 0); | |
358 } | |
359 if (mainDataHeader.version >= 0) { | |
360 | |
361 result.eglImageExternal = decoder0.decodeBool(76, 1); | |
362 } | |
363 if (mainDataHeader.version >= 0) { | |
364 | |
365 result.textureFormatBgra8888 = decoder0.decodeBool(76, 2); | |
366 } | |
367 if (mainDataHeader.version >= 0) { | |
368 | |
369 result.textureFormatEtc1 = decoder0.decodeBool(76, 3); | |
370 } | |
371 if (mainDataHeader.version >= 0) { | |
372 | |
373 result.textureFormatEtc1Npot = decoder0.decodeBool(76, 4); | |
374 } | |
375 if (mainDataHeader.version >= 0) { | |
376 | |
377 result.textureRectangle = decoder0.decodeBool(76, 5); | |
378 } | |
379 if (mainDataHeader.version >= 0) { | |
380 | |
381 result.iosurface = decoder0.decodeBool(76, 6); | |
382 } | |
383 if (mainDataHeader.version >= 0) { | |
384 | |
385 result.textureUsage = decoder0.decodeBool(76, 7); | |
386 } | |
387 if (mainDataHeader.version >= 0) { | |
388 | |
389 result.textureStorage = decoder0.decodeBool(77, 0); | |
390 } | |
391 if (mainDataHeader.version >= 0) { | |
392 | |
393 result.discardFramebuffer = decoder0.decodeBool(77, 1); | |
394 } | |
395 if (mainDataHeader.version >= 0) { | |
396 | |
397 result.syncQuery = decoder0.decodeBool(77, 2); | |
398 } | |
399 if (mainDataHeader.version >= 0) { | |
400 | |
401 result.image = decoder0.decodeBool(77, 3); | |
402 } | |
403 if (mainDataHeader.version >= 0) { | |
404 | |
405 result.futureSyncPoints = decoder0.decodeBool(77, 4); | |
406 } | |
407 if (mainDataHeader.version >= 0) { | |
408 | |
409 result.blendEquationAdvanced = decoder0.decodeBool(77, 5); | |
410 } | |
411 if (mainDataHeader.version >= 0) { | |
412 | |
413 result.blendEquationAdvancedCoherent = decoder0.decodeBool(77, 6); | |
414 } | |
415 return result; | |
416 } | |
417 | |
418 void encode(bindings.Encoder encoder) { | |
419 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | |
420 | |
421 encoder0.encodeStruct(vertexShaderPrecisions, 8, false); | |
422 | |
423 encoder0.encodeStruct(fragmentShaderPrecisions, 16, false); | |
424 | |
425 encoder0.encodeInt32(maxCombinedTextureImageUnits, 24); | |
426 | |
427 encoder0.encodeInt32(maxCubeMapTextureSize, 28); | |
428 | |
429 encoder0.encodeInt32(maxFragmentUniformVectors, 32); | |
430 | |
431 encoder0.encodeInt32(maxRenderbufferSize, 36); | |
432 | |
433 encoder0.encodeInt32(maxTextureImageUnits, 40); | |
434 | |
435 encoder0.encodeInt32(maxTextureSize, 44); | |
436 | |
437 encoder0.encodeInt32(maxVaryingVectors, 48); | |
438 | |
439 encoder0.encodeInt32(maxVertexAttribs, 52); | |
440 | |
441 encoder0.encodeInt32(maxVertexTextureImageUnits, 56); | |
442 | |
443 encoder0.encodeInt32(maxVertexUniformVectors, 60); | |
444 | |
445 encoder0.encodeInt32(numCompressedTextureFormats, 64); | |
446 | |
447 encoder0.encodeInt32(numShaderBinaryFormats, 68); | |
448 | |
449 encoder0.encodeInt32(bindGeneratesResourceChromium, 72); | |
450 | |
451 encoder0.encodeBool(postSubBuffer, 76, 0); | |
452 | |
453 encoder0.encodeBool(eglImageExternal, 76, 1); | |
454 | |
455 encoder0.encodeBool(textureFormatBgra8888, 76, 2); | |
456 | |
457 encoder0.encodeBool(textureFormatEtc1, 76, 3); | |
458 | |
459 encoder0.encodeBool(textureFormatEtc1Npot, 76, 4); | |
460 | |
461 encoder0.encodeBool(textureRectangle, 76, 5); | |
462 | |
463 encoder0.encodeBool(iosurface, 76, 6); | |
464 | |
465 encoder0.encodeBool(textureUsage, 76, 7); | |
466 | |
467 encoder0.encodeBool(textureStorage, 77, 0); | |
468 | |
469 encoder0.encodeBool(discardFramebuffer, 77, 1); | |
470 | |
471 encoder0.encodeBool(syncQuery, 77, 2); | |
472 | |
473 encoder0.encodeBool(image, 77, 3); | |
474 | |
475 encoder0.encodeBool(futureSyncPoints, 77, 4); | |
476 | |
477 encoder0.encodeBool(blendEquationAdvanced, 77, 5); | |
478 | |
479 encoder0.encodeBool(blendEquationAdvancedCoherent, 77, 6); | |
480 } | |
481 | |
482 String toString() { | |
483 return "GpuCapabilities(" | |
484 "vertexShaderPrecisions: $vertexShaderPrecisions" ", " | |
485 "fragmentShaderPrecisions: $fragmentShaderPrecisions" ", " | |
486 "maxCombinedTextureImageUnits: $maxCombinedTextureImageUnits" ", " | |
487 "maxCubeMapTextureSize: $maxCubeMapTextureSize" ", " | |
488 "maxFragmentUniformVectors: $maxFragmentUniformVectors" ", " | |
489 "maxRenderbufferSize: $maxRenderbufferSize" ", " | |
490 "maxTextureImageUnits: $maxTextureImageUnits" ", " | |
491 "maxTextureSize: $maxTextureSize" ", " | |
492 "maxVaryingVectors: $maxVaryingVectors" ", " | |
493 "maxVertexAttribs: $maxVertexAttribs" ", " | |
494 "maxVertexTextureImageUnits: $maxVertexTextureImageUnits" ", " | |
495 "maxVertexUniformVectors: $maxVertexUniformVectors" ", " | |
496 "numCompressedTextureFormats: $numCompressedTextureFormats" ", " | |
497 "numShaderBinaryFormats: $numShaderBinaryFormats" ", " | |
498 "bindGeneratesResourceChromium: $bindGeneratesResourceChromium" ", " | |
499 "postSubBuffer: $postSubBuffer" ", " | |
500 "eglImageExternal: $eglImageExternal" ", " | |
501 "textureFormatBgra8888: $textureFormatBgra8888" ", " | |
502 "textureFormatEtc1: $textureFormatEtc1" ", " | |
503 "textureFormatEtc1Npot: $textureFormatEtc1Npot" ", " | |
504 "textureRectangle: $textureRectangle" ", " | |
505 "iosurface: $iosurface" ", " | |
506 "textureUsage: $textureUsage" ", " | |
507 "textureStorage: $textureStorage" ", " | |
508 "discardFramebuffer: $discardFramebuffer" ", " | |
509 "syncQuery: $syncQuery" ", " | |
510 "image: $image" ", " | |
511 "futureSyncPoints: $futureSyncPoints" ", " | |
512 "blendEquationAdvanced: $blendEquationAdvanced" ", " | |
513 "blendEquationAdvancedCoherent: $blendEquationAdvancedCoherent" ")"; | |
514 } | |
515 | |
516 Map toJson() { | |
517 Map map = new Map(); | |
518 map["vertexShaderPrecisions"] = vertexShaderPrecisions; | |
519 map["fragmentShaderPrecisions"] = fragmentShaderPrecisions; | |
520 map["maxCombinedTextureImageUnits"] = maxCombinedTextureImageUnits; | |
521 map["maxCubeMapTextureSize"] = maxCubeMapTextureSize; | |
522 map["maxFragmentUniformVectors"] = maxFragmentUniformVectors; | |
523 map["maxRenderbufferSize"] = maxRenderbufferSize; | |
524 map["maxTextureImageUnits"] = maxTextureImageUnits; | |
525 map["maxTextureSize"] = maxTextureSize; | |
526 map["maxVaryingVectors"] = maxVaryingVectors; | |
527 map["maxVertexAttribs"] = maxVertexAttribs; | |
528 map["maxVertexTextureImageUnits"] = maxVertexTextureImageUnits; | |
529 map["maxVertexUniformVectors"] = maxVertexUniformVectors; | |
530 map["numCompressedTextureFormats"] = numCompressedTextureFormats; | |
531 map["numShaderBinaryFormats"] = numShaderBinaryFormats; | |
532 map["bindGeneratesResourceChromium"] = bindGeneratesResourceChromium; | |
533 map["postSubBuffer"] = postSubBuffer; | |
534 map["eglImageExternal"] = eglImageExternal; | |
535 map["textureFormatBgra8888"] = textureFormatBgra8888; | |
536 map["textureFormatEtc1"] = textureFormatEtc1; | |
537 map["textureFormatEtc1Npot"] = textureFormatEtc1Npot; | |
538 map["textureRectangle"] = textureRectangle; | |
539 map["iosurface"] = iosurface; | |
540 map["textureUsage"] = textureUsage; | |
541 map["textureStorage"] = textureStorage; | |
542 map["discardFramebuffer"] = discardFramebuffer; | |
543 map["syncQuery"] = syncQuery; | |
544 map["image"] = image; | |
545 map["futureSyncPoints"] = futureSyncPoints; | |
546 map["blendEquationAdvanced"] = blendEquationAdvanced; | |
547 map["blendEquationAdvancedCoherent"] = blendEquationAdvancedCoherent; | |
548 return map; | |
549 } | |
550 } | |
551 | |
552 | |
553 | |
554 | |
555 | |
556 | |
OLD | NEW |