Skip to content

Commit 287307a

Browse files
committed
split into a separate public function
to keep wasm-bindgen happy
1 parent 51b3fd9 commit 287307a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use context::WgpuContext;
1010
use lazy_regex::regex;
1111
use num::Integer;
1212
use pp::{SourceMap, WGSLError};
13-
use wgpu::{Maintain, SubmissionIndex};
1413
use std::collections::HashMap;
1514
use std::mem::{size_of, take};
1615
use std::sync::atomic::{AtomicBool, Ordering};
1716
use wasm_bindgen::prelude::*;
17+
use wgpu::{Maintain, SubmissionIndex};
1818

1919
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
2020
// allocator.
@@ -198,7 +198,18 @@ impl WgpuToyRenderer {
198198
}
199199
}
200200

201-
pub fn render_to(&mut self, frame: &wgpu::SurfaceTexture) -> (Option<wgpu::Buffer>, SubmissionIndex) {
201+
#[cfg(not(target_arch = "wasm32"))]
202+
pub fn render_to_surface(
203+
&mut self,
204+
frame: &wgpu::SurfaceTexture,
205+
) -> (Option<wgpu::Buffer>, SubmissionIndex) {
206+
self.render_to(frame)
207+
}
208+
209+
fn render_to(
210+
&mut self,
211+
frame: &wgpu::SurfaceTexture,
212+
) -> (Option<wgpu::Buffer>, SubmissionIndex) {
202213
let mut encoder = self.wgpu.device.create_command_encoder(&Default::default());
203214
self.bindings.stage(&self.wgpu.queue);
204215
if self.bindings.time.host.frame % STATS_PERIOD == 0 {

0 commit comments

Comments
 (0)