relay_event_schema/protocol/contexts/
gpu.rs1use relay_protocol::{Annotated, Empty, FromValue, IntoValue, Object, Value};
2
3use crate::processor::ProcessValue;
4
5#[derive(Clone, Debug, Default, PartialEq, Empty, FromValue, IntoValue, ProcessValue)]
21pub struct GpuContext {
22 #[metastructure(pii = "maybe")]
24 pub name: Annotated<String>,
25
26 #[metastructure(pii = "maybe")]
28 pub version: Annotated<String>,
29
30 #[metastructure(pii = "maybe")]
32 pub id: Annotated<Value>,
33
34 #[metastructure(pii = "maybe")]
36 pub vendor_id: Annotated<String>,
37
38 #[metastructure(pii = "maybe")]
40 pub vendor_name: Annotated<String>,
41
42 #[metastructure(pii = "maybe")]
44 pub driver_version: Annotated<String>,
45
46 #[metastructure(pii = "maybe")]
48 pub memory_size: Annotated<u64>,
49
50 #[metastructure(pii = "maybe")]
54 pub api_type: Annotated<String>,
55
56 #[metastructure(pii = "maybe")]
58 pub multi_threaded_rendering: Annotated<bool>,
59
60 #[metastructure(pii = "maybe")]
62 pub npot_support: Annotated<String>,
63
64 pub max_texture_size: Annotated<u64>,
68
69 pub graphics_shader_level: Annotated<String>,
73
74 pub supports_draw_call_instancing: Annotated<bool>,
76
77 pub supports_ray_tracing: Annotated<bool>,
79
80 pub supports_compute_shaders: Annotated<bool>,
82
83 pub supports_geometry_shaders: Annotated<bool>,
85
86 #[metastructure(additional_properties, retain = true, pii = "maybe")]
88 pub other: Object<Value>,
89}
90
91impl super::DefaultContext for GpuContext {
92 fn default_key() -> &'static str {
93 "gpu"
94 }
95
96 fn from_context(context: super::Context) -> Option<Self> {
97 match context {
98 super::Context::Gpu(c) => Some(*c),
99 _ => None,
100 }
101 }
102
103 fn cast(context: &super::Context) -> Option<&Self> {
104 match context {
105 super::Context::Gpu(c) => Some(c),
106 _ => None,
107 }
108 }
109
110 fn cast_mut(context: &mut super::Context) -> Option<&mut Self> {
111 match context {
112 super::Context::Gpu(c) => Some(c),
113 _ => None,
114 }
115 }
116
117 fn into_context(self) -> super::Context {
118 super::Context::Gpu(Box::new(self))
119 }
120}