1use std::{
7 sync::Arc,
8 time::{Duration, Instant},
9};
10
11use nsh_core::{
12 animation::AnimationValue,
13 geometry::{Points, Size},
14 shader::{ShaderInput, ShaderLayer},
15};
16
17#[cfg(windows)]
18pub use crate::shader_frame::SharedTexture;
19pub use crate::shader_frame::{Frame, MAX_SIDE, PixelFormat};
20
21pub const LINKED: bool = false;
24
25pub(crate) fn no_gpu() -> bool {
27 false
28}
29
30pub struct Renderer {
32 format: PixelFormat,
33}
34
35impl Renderer {
36 pub fn new(_format: PixelFormat) -> Option<Renderer> {
38 None
39 }
40
41 pub fn open(_format: PixelFormat, done: impl FnOnce(Option<Renderer>) + Send + 'static) {
43 done(None);
44 }
45
46 pub fn on_pipeline_ready(&self, f: impl Fn() + Send + Sync + 'static) {
48 drop(f);
49 }
50
51 pub fn compiling(&self) -> bool {
53 false
54 }
55
56 pub fn wait_for_pipelines(&self, _timeout: Duration) -> bool {
58 true
59 }
60
61 pub fn format(&self) -> PixelFormat {
63 self.format
64 }
65
66 pub fn when_done(&self, f: impl FnOnce() + Send + 'static) -> bool {
68 drop(f);
69 false
70 }
71}
72
73#[derive(Default)]
75pub struct ShaderView {
76 layer: Option<Arc<ShaderLayer>>,
77 frame: Frame,
78}
79
80impl ShaderView {
81 pub fn set_layer(&mut self, layer: Option<Arc<ShaderLayer>>) {
83 self.layer = layer;
84 }
85
86 pub fn set_input(
88 &mut self,
89 _renderer: &Renderer,
90 _input: ShaderInput,
91 _picture: Option<(&[u8], u32, u32, u32)>,
92 ) {
93 }
94
95 pub fn set_input_from_frame(&mut self, _renderer: &Renderer, _input: ShaderInput) -> bool {
97 false
98 }
99
100 pub fn has_input(&self, _input: ShaderInput) -> bool {
102 false
103 }
104
105 pub fn start_transition(&mut self, _duration: Duration, _now: Instant) {}
107
108 pub fn start_transition_backwards(&mut self, _duration: Duration, _now: Instant) {}
110
111 pub fn transitioning(&mut self, _now: Instant) -> bool {
113 false
114 }
115
116 pub fn replaces_children(&mut self, _now: Instant) -> bool {
118 false
119 }
120
121 pub fn overflow(&self) -> Points {
123 Points(0.0)
124 }
125
126 pub fn layer(&self) -> Option<&Arc<ShaderLayer>> {
128 self.layer.as_ref()
129 }
130
131 pub fn set_slot(&mut self, _slot: u16, _value: AnimationValue) {}
133
134 pub fn set_size(&mut self, _size: Size<Points>, _scale: f32) {}
136
137 pub fn wants_frame(&self) -> bool {
139 false
140 }
141
142 pub fn compiling(&self) -> bool {
144 false
145 }
146
147 pub fn pending(&self) -> bool {
149 false
150 }
151
152 pub fn due(&self) -> bool {
154 false
155 }
156
157 pub fn animates(&self) -> bool {
159 false
160 }
161
162 pub fn frame(&self) -> &Frame {
164 &self.frame
165 }
166
167 #[cfg(any(target_vendor = "apple", windows))]
169 pub fn show_on_surfaces(&mut self, _on: bool) {}
170
171 #[cfg(windows)]
173 pub fn surface(&self) -> Option<SharedTexture> {
174 None
175 }
176
177 #[cfg(target_vendor = "apple")]
179 pub fn surface(&self) -> Option<&objc2_io_surface::IOSurfaceRef> {
180 None
181 }
182
183 pub fn collect_frame(&mut self, _renderer: &Renderer) -> bool {
185 false
186 }
187
188 pub fn render(&mut self, _renderer: &Renderer, _now: Instant) -> bool {
190 false
191 }
192}