mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 23:11:01 +01:00
Merge #476
476: Convert to tracing for logging and add fmt logger r=kvark a=cwfitzgerald wgpu-rs half of https://github.com/gfx-rs/wgpu/pull/835 Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This commit is contained in:
commit
fe1c4021d9
6 files changed
+16
-22
No files matched your search
+2
-5
@@ -27,14 +27,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "6182495102e33ea22c354539aba06ef3bf393751"
|
||||
rev = "11b3a95671d096aae2eac0d187be5472b5ab91c0"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "6182495102e33ea22c354539aba06ef3bf393751"
|
||||
rev = "11b3a95671d096aae2eac0d187be5472b5ab91c0"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
@@ -87,9 +87,6 @@ test = true
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
objc = "0.2.7"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
env_logger = "0.7"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
wasm-bindgen = "0.2.62"
|
||||
web-sys = { version = "0.3.39", features = [
|
||||
|
||||
@@ -196,7 +196,8 @@ impl BufferDimensions {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
env_logger::init();
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
futures::executor::block_on(run("red.png"));
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
||||
@@ -72,8 +72,13 @@ struct Setup {
|
||||
}
|
||||
|
||||
async fn setup<E: Example>(title: &str) -> Setup {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
env_logger::init();
|
||||
#[cfg(feature = "subscriber")]
|
||||
{
|
||||
let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACE");
|
||||
wgpu::util::initialize_default_subscriber(
|
||||
chrome_tracing_dir.as_ref().map(std::path::Path::new).ok(),
|
||||
);
|
||||
};
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
console_log::init().expect("could not initialize logger");
|
||||
@@ -155,12 +160,6 @@ fn start<E: Example>(
|
||||
) {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let (mut pool, spawner) = {
|
||||
#[cfg(feature = "subscriber")]
|
||||
{
|
||||
let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACING");
|
||||
wgpu::util::initialize_default_subscriber(chrome_tracing_dir.ok());
|
||||
};
|
||||
|
||||
let local_pool = futures::executor::LocalPool::new();
|
||||
let spawner = local_pool.spawner();
|
||||
(local_pool, spawner)
|
||||
|
||||
@@ -134,13 +134,8 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
env_logger::init();
|
||||
|
||||
#[cfg(feature = "subscriber")]
|
||||
{
|
||||
let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACING");
|
||||
wgpu::util::initialize_default_subscriber(chrome_tracing_dir.ok());
|
||||
};
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
|
||||
futures::executor::block_on(run());
|
||||
}
|
||||
|
||||
@@ -141,7 +141,8 @@ fn main() {
|
||||
let window = winit::window::Window::new(&event_loop).unwrap();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
env_logger::init();
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
|
||||
// Temporarily avoid srgb formats for the swapchain on the web
|
||||
futures::executor::block_on(run(event_loop, window, wgpu::TextureFormat::Bgra8UnormSrgb));
|
||||
|
||||
@@ -16,7 +16,8 @@ async fn run() {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
env_logger::init();
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
futures::executor::block_on(run());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
||||
Reference in new issue
Block a user