]> git.nega.tv - josh/narcissus/commitdiff
shark: Disable Wayland when RenderDoc is detected
authorJosh Simmons <josh@nega.tv>
Sat, 11 May 2024 10:15:17 +0000 (12:15 +0200)
committerJosh Simmons <josh@nega.tv>
Sat, 11 May 2024 10:15:17 +0000 (12:15 +0200)
Cargo.lock
title/shark/Cargo.toml
title/shark/src/main.rs

index f71014194795c7a392ed8826d25e8cf14e02ebfc..e4fb89e92ca2706f521bdb2dbbeed93778e314ea 100644 (file)
@@ -183,6 +183,7 @@ dependencies = [
  "narcissus-gpu",
  "narcissus-image",
  "narcissus-maths",
+ "renderdoc-sys",
  "shark-shaders",
 ]
 
index 8b6d1aa9c6c8927d7ac6444b685f0fd0658f950d..635da7d54e5b078adf415a28af0c5d2e1e0079e2 100644 (file)
@@ -6,6 +6,9 @@ edition = "2021"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
+
+renderdoc-sys = { path = "../../external/renderdoc-sys" }
+
 narcissus-app = { path = "../../engine/narcissus-app" }
 narcissus-core = { path = "../../engine/narcissus-core" }
 narcissus-font = { path = "../../engine/narcissus-font" }
index 618672473171836361384b685895b07d37c813cd..c9d0c85b9fa092f296ccad1bfaa1e68bdeb91dc5 100644 (file)
@@ -1,5 +1,7 @@
 use std::fmt::Write;
 
+use renderdoc_sys as rdoc;
+
 use crate::{
     fonts::{FontFamily, Fonts},
     pipelines::{BasicPipeline, TextPipeline},
@@ -443,8 +445,11 @@ pub fn main() {
         std::env::set_var("RUST_BACKTRACE", "1")
     }
 
+    let renderdoc = rdoc::RenderdocApi1_5_0::load();
+
     // Default to wayland because otherwise HiDPI is totally borked.
-    if std::env::var("SDL_VIDEODRIVER").is_err() {
+    // Unless renderdoc is attached, in which case wayland would break capture.
+    if renderdoc.is_none() && std::env::var("SDL_VIDEODRIVER").is_err() {
         std::env::set_var("SDL_VIDEODRIVER", "wayland")
     }