Skip to content

Commit eaba484

Browse files
authored
Add GpuContext (#428)
1 parent 6d37c7f commit eaba484

File tree

1 file changed

+60
-0
lines changed
  • sentry-types/src/protocol

1 file changed

+60
-0
lines changed

sentry-types/src/protocol/v7.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,8 @@ pub enum Context {
11051105
Browser(Box<BrowserContext>),
11061106
/// Tracing data.
11071107
Trace(Box<TraceContext>),
1108+
/// GPU data
1109+
Gpu(Box<GpuContext>),
11081110
/// Generic other context data.
11091111
#[serde(rename = "unknown")]
11101112
Other(Map<String, Value>),
@@ -1120,6 +1122,7 @@ impl Context {
11201122
Context::App(..) => "app",
11211123
Context::Browser(..) => "browser",
11221124
Context::Trace(..) => "trace",
1125+
Context::Gpu(..) => "gpu",
11231126
Context::Other(..) => "unknown",
11241127
}
11251128
}
@@ -1282,6 +1285,62 @@ pub struct BrowserContext {
12821285
pub other: Map<String, Value>,
12831286
}
12841287

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+
12851344
/// Holds the identifier for a Span
12861345
#[derive(Serialize, Deserialize, Debug, Copy, Clone, Eq, PartialEq, Hash)]
12871346
#[serde(try_from = "String", into = "String")]
@@ -1413,6 +1472,7 @@ into_context!(Os, OsContext);
14131472
into_context!(Runtime, RuntimeContext);
14141473
into_context!(Browser, BrowserContext);
14151474
into_context!(Trace, TraceContext);
1475+
into_context!(Gpu, GpuContext);
14161476

14171477
mod event {
14181478
use super::*;

0 commit comments

Comments
 (0)