@@ -1105,6 +1105,8 @@ pub enum Context {
1105
1105
Browser ( Box < BrowserContext > ) ,
1106
1106
/// Tracing data.
1107
1107
Trace ( Box < TraceContext > ) ,
1108
+ /// GPU data
1109
+ Gpu ( Box < GpuContext > ) ,
1108
1110
/// Generic other context data.
1109
1111
#[ serde( rename = "unknown" ) ]
1110
1112
Other ( Map < String , Value > ) ,
@@ -1120,6 +1122,7 @@ impl Context {
1120
1122
Context :: App ( ..) => "app" ,
1121
1123
Context :: Browser ( ..) => "browser" ,
1122
1124
Context :: Trace ( ..) => "trace" ,
1125
+ Context :: Gpu ( ..) => "gpu" ,
1123
1126
Context :: Other ( ..) => "unknown" ,
1124
1127
}
1125
1128
}
@@ -1282,6 +1285,62 @@ pub struct BrowserContext {
1282
1285
pub other : Map < String , Value > ,
1283
1286
}
1284
1287
1288
+ /// GPU context describes the GPU of the device.
1289
+ #[ derive( Serialize , Deserialize , Debug , Clone , Default , PartialEq ) ]
1290
+ pub struct GpuContext {
1291
+ /// The name of the graphics device.
1292
+ pub name : String ,
1293
+ /// The Version of the graphics device.
1294
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1295
+ pub version : Option < String > ,
1296
+ /// The version of the graphic device driver.
1297
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1298
+ pub driver_version : Option < String > ,
1299
+ /// The PCI identifier of the graphics device.
1300
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1301
+ pub id : Option < String > ,
1302
+ /// The PCI vendor identifier of the graphics device.
1303
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1304
+ pub vendor_id : Option < String > ,
1305
+ /// The vendor name as reported by the graphics device.
1306
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1307
+ pub vendor_name : Option < String > ,
1308
+ /// The total GPU memory available in Megabytes.
1309
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1310
+ pub memory_size : Option < u32 > ,
1311
+ /// The device low-level API type. Examples: "Apple Metal" or "Direct3D11"
1312
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1313
+ pub api_type : Option < String > ,
1314
+ /// Whether the GPU has multi-threaded rendering or not.
1315
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1316
+ pub multi_threaded_rendering : Option < bool > ,
1317
+ /// The Non-Power-Of-Two-Support support.
1318
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1319
+ pub npot_support : Option < bool > ,
1320
+ /// Largest size of a texture that is supported by the graphics hardware.
1321
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1322
+ pub max_texture_size : Option < u32 > ,
1323
+ /// Approximate "shader capability" level of the graphics device. For example,
1324
+ /// `Shader Model 2.0, OpenGL ES 3.0, Metal / OpenGL ES 3.1, 27 (unknown)`.
1325
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1326
+ pub graphics_shader_level : Option < String > ,
1327
+ /// Is GPU draw call instancing supported?
1328
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1329
+ pub supports_draw_call_instancing : Option < bool > ,
1330
+ /// Is ray tracing available on the device?
1331
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1332
+ pub supports_ray_tracing : Option < bool > ,
1333
+ /// Are compute shaders available on the device?
1334
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1335
+ pub supports_compute_shaders : Option < bool > ,
1336
+ /// Are geometry shaders available on the device?
1337
+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
1338
+ pub supports_geometry_shaders : Option < bool > ,
1339
+ /// Additional arbitrary fields for forwards compatibility.
1340
+ #[ serde( flatten) ]
1341
+ pub other : Map < String , Value > ,
1342
+ }
1343
+
1285
1344
/// Holds the identifier for a Span
1286
1345
#[ derive( Serialize , Deserialize , Debug , Copy , Clone , Eq , PartialEq , Hash ) ]
1287
1346
#[ serde( try_from = "String" , into = "String" ) ]
@@ -1413,6 +1472,7 @@ into_context!(Os, OsContext);
1413
1472
into_context ! ( Runtime , RuntimeContext ) ;
1414
1473
into_context ! ( Browser , BrowserContext ) ;
1415
1474
into_context ! ( Trace , TraceContext ) ;
1475
+ into_context ! ( Gpu , GpuContext ) ;
1416
1476
1417
1477
mod event {
1418
1478
use super :: * ;
0 commit comments