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 memory_size: Annotated<u64>,
45
46 #[metastructure(pii = "maybe")]
50 pub api_type: Annotated<String>,
51
52 #[metastructure(pii = "maybe")]
54 pub multi_threaded_rendering: Annotated<bool>,
55
56 #[metastructure(pii = "maybe")]
58 pub npot_support: Annotated<String>,
59
60 pub max_texture_size: Annotated<u64>,
64
65 pub graphics_shader_level: Annotated<String>,
69
70 pub supports_draw_call_instancing: Annotated<bool>,
72
73 pub supports_ray_tracing: Annotated<bool>,
75
76 pub supports_compute_shaders: Annotated<bool>,
78
79 pub supports_geometry_shaders: Annotated<bool>,
81
82 #[metastructure(additional_properties, retain = true, pii = "maybe")]
84 pub other: Object<Value>,
85}
86
87impl super::DefaultContext for GpuContext {
88 fn default_key() -> &'static str {
89 "gpu"
90 }
91
92 fn from_context(context: super::Context) -> Option<Self> {
93 match context {
94 super::Context::Gpu(c) => Some(*c),
95 _ => None,
96 }
97 }
98
99 fn cast(context: &super::Context) -> Option<&Self> {
100 match context {
101 super::Context::Gpu(c) => Some(c),
102 _ => None,
103 }
104 }
105
106 fn cast_mut(context: &mut super::Context) -> Option<&mut Self> {
107 match context {
108 super::Context::Gpu(c) => Some(c),
109 _ => None,
110 }
111 }
112
113 fn into_context(self) -> super::Context {
114 super::Context::Gpu(Box::new(self))
115 }
116}