Skip to content

Commit bf10625

Browse files
committed
chore: update platform-specific configurations in renderer
- update target dependencies in `cargo.toml` - update platform-specific configurations in `renderer.rs`
1 parent 79e0005 commit bf10625

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ termcolor = "1.4.1"
108108
wgpu = { workspace = true, features = ["glsl"] }
109109
winit = { workspace = true }
110110

111-
[target.'cfg(not(target_os = "macos"))'.dependencies]
111+
[target.'cfg(not(any(target_os = "linux", target_os = "macos")))'.dependencies]
112112
wgpu-profiler = { version = "0.18.0", features = ["tracy"] }
113113

114114
[dev-dependencies]

src/renderer.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use glam::*;
55
use glamour::{AsRaw, Rect};
66
use wgpu::*;
77

8-
#[cfg(not(target_os = "macos"))]
8+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
99
use wgpu_profiler::{GpuProfiler, GpuProfilerSettings};
1010

1111
use crate::{
@@ -32,7 +32,7 @@ pub struct Renderer {
3232
pub queue: Queue,
3333
pub shaders: HashMap<String, ShaderModule>,
3434

35-
#[cfg(not(target_os = "macos"))]
35+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
3636
pub profiler: GpuProfiler,
3737

3838
pub format: TextureFormat,
@@ -157,7 +157,7 @@ impl Renderer {
157157
);
158158
let shaders = shaders.await;
159159

160-
#[cfg(not(target_os = "macos"))]
160+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
161161
let mut profiler = GpuProfiler::new_with_tracy_client(
162162
GpuProfilerSettings {
163163
// enable_timer_queries: false,
@@ -169,7 +169,7 @@ impl Renderer {
169169
)
170170
.expect("Could not create profiler");
171171

172-
#[cfg(not(target_os = "macos"))]
172+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
173173
profiler
174174
.change_settings(GpuProfilerSettings {
175175
enable_timer_queries: false,
@@ -183,7 +183,7 @@ impl Renderer {
183183
queue,
184184
shaders,
185185

186-
#[cfg(not(target_os = "macos"))]
186+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
187187
profiler,
188188

189189
format,
@@ -248,7 +248,7 @@ impl Renderer {
248248
// | Features::TIMESTAMP_QUERY_INSIDE_ENCODERS
249249
}
250250

251-
#[cfg(not(target_os = "macos"))]
251+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
252252
{
253253
Features::PUSH_CONSTANTS
254254
| Features::SPIRV_SHADER_PASSTHROUGH
@@ -375,7 +375,7 @@ impl Renderer {
375375
);
376376
}
377377

378-
#[cfg(not(target_os = "macos"))]
378+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
379379
{
380380
self.profiler.resolve_queries(&mut encoder);
381381

@@ -396,7 +396,7 @@ impl Renderer {
396396
constants: ShaderConstants,
397397
resources: &Resources,
398398
) {
399-
#[cfg(not(target_os = "macos"))]
399+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
400400
let mut mask_scope = self.profiler.scope("mask", encoder, &self.device);
401401

402402
#[cfg(target_os = "macos")]
@@ -405,7 +405,7 @@ impl Renderer {
405405
if let Some(mask_contents) = mask_contents {
406406
for batch in mask_contents.primitives.iter() {
407407
for drawable in self.drawables.iter_mut() {
408-
#[cfg(not(target_os = "macos"))]
408+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
409409
let mut render_pass = mask_scope.scoped_render_pass(
410410
"Mask",
411411
&self.device,
@@ -445,7 +445,7 @@ impl Renderer {
445445

446446
profiling::scope!("drawable", &drawable.name);
447447

448-
#[cfg(not(target_os = "macos"))]
448+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
449449
let mut drawable_scope = render_pass.scope(&drawable.name, &self.device);
450450

451451
#[cfg(target_os = "macos")]
@@ -479,7 +479,7 @@ impl Renderer {
479479
}
480480
}
481481
} else {
482-
#[cfg(not(target_os = "macos"))]
482+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
483483
mask_scope.scoped_render_pass(
484484
"Clear Mask Texture",
485485
&self.device,
@@ -531,7 +531,7 @@ impl Renderer {
531531
constants: ShaderConstants,
532532
resources: &Resources,
533533
) {
534-
#[cfg(not(target_os = "macos"))]
534+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
535535
let mut content_scope = self
536536
.profiler
537537
.scope("content", context.encoder, &self.device);
@@ -540,7 +540,7 @@ impl Renderer {
540540
let content_scope = context.encoder;
541541

542542
if *context.first {
543-
#[cfg(not(target_os = "macos"))]
543+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
544544
content_scope.scoped_render_pass(
545545
"Clear Offscreen Texture",
546546
&self.device,
@@ -579,7 +579,7 @@ impl Renderer {
579579
'offscreen_copy: for batch in contents.primitives.iter() {
580580
for drawable in self.drawables.iter() {
581581
if drawable.has_work(batch) && drawable.requires_offscreen_copy() {
582-
#[cfg(not(target_os = "macos"))]
582+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
583583
let mut copy_scope =
584584
content_scope.scope("Copy Frame to Offscreen", &self.device);
585585

@@ -630,7 +630,7 @@ impl Renderer {
630630
}
631631
};
632632

633-
#[cfg(not(target_os = "macos"))]
633+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
634634
let mut render_pass = content_scope.scoped_render_pass(
635635
"Layer Render Pass",
636636
&self.device,
@@ -660,7 +660,7 @@ impl Renderer {
660660

661661
profiling::scope!("drawable", &drawable.name);
662662

663-
#[cfg(not(target_os = "macos"))]
663+
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
664664
let mut drawable_scope = render_pass.scope(&drawable.name, &self.device);
665665

666666
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)