Refactor log usage

This commit is contained in:
Dzmitry Malyshau committed 2019-10-24 14:53:07 -04:00
1 parent 4851284150
commit 41c433ed27
7 files changed
+19 -26

No files matched your search

+1 -2
View File
@@ -6,7 +6,6 @@ use super::CommandBuffer;
use crate::{hub::GfxBackend, track::TrackerSet, DeviceId, Features, LifeGuard, Stored, SubmissionIndex};
use hal::{command::CommandBuffer as _, device::Device as _, pool::CommandPool as _};
use log::trace;
use parking_lot::Mutex;
use std::{collections::HashMap, sync::atomic::Ordering, thread};
@@ -127,7 +126,7 @@ impl<B: GfxBackend> CommandAllocator<B> {
.load(Ordering::Acquire);
if index <= last_done {
let cmd_buf = inner.pending.swap_remove(i);
trace!(
log::trace!(
"recycling comb submitted in {} when {} is done",
index,
last_done
+3 -4
View File
@@ -12,7 +12,6 @@ use crate::{
Stored,
};
use log::trace;
use smallvec::{smallvec, SmallVec};
use std::convert::identity;
@@ -174,7 +173,7 @@ impl Binder {
impl 'a + Iterator<Item = BindGroupId>,
impl 'a + Iterator<Item = &'a BufferAddress>,
)> {
trace!("\tBinding [{}] = group {:?}", index, bind_group_id);
log::trace!("\tBinding [{}] = group {:?}", index, bind_group_id);
debug_assert_eq!(B::VARIANT, bind_group_id.backend());
match self.entries[index].provide(bind_group_id, bind_group, offsets) {
@@ -184,7 +183,7 @@ impl Binder {
if index < compatible_count {
let end = compatible_count
.min(if was_compatible { index + 1 } else { self.entries.len() });
trace!("\t\tbinding up to {}", end);
log::trace!("\t\tbinding up to {}", end);
Some((
self.pipeline_layout_id?,
TakeSome {
@@ -197,7 +196,7 @@ impl Binder {
.flat_map(|entry| entry.dynamic_offsets.as_slice()),
))
} else {
trace!("\t\tskipping above compatible {}", compatible_count);
log::trace!("\t\tskipping above compatible {}", compatible_count);
None
}
}
+1 -2
View File
@@ -23,7 +23,6 @@ use crate::{
use crate::{gfx_select, hub::GLOBAL};
use hal::{self, command::CommandBuffer as _};
use log::trace;
use std::iter;
#[cfg(feature = "local")]
@@ -114,7 +113,7 @@ pub fn compute_pass_set_bind_group<B: GfxBackend>(
let (buffer_guard, mut token) = hub.buffers.read(&mut token);
let (texture_guard, _) = hub.textures.read(&mut token);
trace!(
log::trace!(
"Encoding barriers on binding of {:?} in pass {:?}",
bind_group_id,
pass_id
+7 -8
View File
@@ -47,7 +47,6 @@ use crate::{gfx_select, hub::GLOBAL};
use arrayvec::ArrayVec;
use hal::{adapter::PhysicalDevice as _, command::CommandBuffer as _, device::Device as _};
use log::trace;
#[cfg(feature = "local")]
use std::marker::PhantomData;
@@ -137,7 +136,7 @@ impl<B: GfxBackend> CommandBuffer<B> {
buffer_guard: &Storage<Buffer<B>, BufferId>,
texture_guard: &Storage<Texture<B>, TextureId>,
) {
trace!("\tstitch {:?}", stitch);
log::trace!("\tstitch {:?}", stitch);
debug_assert_eq!(B::VARIANT, base.backend());
debug_assert_eq!(B::VARIANT, head.backend());
@@ -145,7 +144,7 @@ impl<B: GfxBackend> CommandBuffer<B> {
.buffers
.merge_replace(&head.buffers, stitch)
.map(|pending| {
trace!("\tbuffer -> {:?}", pending);
log::trace!("\tbuffer -> {:?}", pending);
hal::memory::Barrier::Buffer {
states: pending.to_states(),
target: &buffer_guard[pending.id].raw,
@@ -157,7 +156,7 @@ impl<B: GfxBackend> CommandBuffer<B> {
.textures
.merge_replace(&head.textures, stitch)
.map(|pending| {
trace!("\ttexture -> {:?}", pending);
log::trace!("\ttexture -> {:?}", pending);
hal::memory::Barrier::Image {
states: pending.to_states(),
target: &texture_guard[pending.id].raw,
@@ -274,7 +273,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
"Attachment sample_count must be supported by physical device limits"
);
trace!(
log::trace!(
"Encoding render pass begin in command buffer {:?}",
encoder_id
);
@@ -322,7 +321,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
);
barriers.extend(pending.map(|pending| {
trace!("\tdepth-stencil {:?}", pending);
log::trace!("\tdepth-stencil {:?}", pending);
hal::memory::Barrier::Image {
states: pending.to_states(),
target: &texture.raw,
@@ -379,7 +378,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
TextureUsage::OUTPUT_ATTACHMENT,
);
barriers.extend(pending.map(|pending| {
trace!("\tcolor {:?}", pending);
log::trace!("\tcolor {:?}", pending);
hal::memory::Barrier::Image {
states: pending.to_states(),
target: &texture.raw,
@@ -451,7 +450,7 @@ pub fn command_encoder_begin_render_pass<B: GfxBackend>(
TextureUsage::OUTPUT_ATTACHMENT,
);
barriers.extend(pending.map(|pending| {
trace!("\tresolve {:?}", pending);
log::trace!("\tresolve {:?}", pending);
hal::memory::Barrier::Image {
states: pending.to_states(),
target: &texture.raw,
+1 -2
View File
@@ -24,7 +24,6 @@ use crate::{
use crate::{gfx_select, RawString, RenderBundleId, hub::GLOBAL};
use hal::command::CommandBuffer as _;
use log::trace;
use std::{iter, ops::Range};
#[cfg(feature = "local")]
@@ -197,7 +196,7 @@ pub fn render_pass_end_pass<B: GfxBackend>(global: &Global, pass_id: RenderPassI
match cmb.raw.last_mut() {
Some(last) => {
trace!("Encoding barriers before pass {:?}", pass_id);
log::trace!("Encoding barriers before pass {:?}", pass_id);
CommandBuffer::insert_barriers(
last,
&mut cmb.trackers,
+5 -6
View File
@@ -19,7 +19,6 @@ use crate::{gfx_select, SurfaceId, hub::GLOBAL};
#[cfg(feature = "local")]
use bitflags::bitflags;
use log::{info, warn};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
@@ -367,7 +366,7 @@ pub fn request_adapter(
let adapter = Adapter {
raw: adapters_vk.swap_remove(selected),
};
info!("Adapter Vulkan {:?}", adapter.raw.info);
log::info!("Adapter Vulkan {:?}", adapter.raw.info);
let id_out = backend::Vulkan::hub(global).adapters.register_identity(
id_vulkan.unwrap(),
adapter,
@@ -383,7 +382,7 @@ pub fn request_adapter(
let adapter = Adapter {
raw: adapters_mtl.swap_remove(selected),
};
info!("Adapter Metal {:?}", adapter.raw.info);
log::info!("Adapter Metal {:?}", adapter.raw.info);
let id_out = backend::Metal::hub(global).adapters.register_identity(
id_metal.unwrap(),
adapter,
@@ -399,7 +398,7 @@ pub fn request_adapter(
let adapter = Adapter {
raw: adapters_dx12.swap_remove(selected),
};
info!("Adapter Dx12 {:?}", adapter.raw.info);
log::info!("Adapter Dx12 {:?}", adapter.raw.info);
let id_out = backend::Dx12::hub(global).adapters.register_identity(
id_dx12.unwrap(),
adapter,
@@ -412,7 +411,7 @@ pub fn request_adapter(
let adapter = Adapter {
raw: adapters_dx11.swap_remove(selected),
};
info!("Adapter Dx11 {:?}", adapter.raw.info);
log::info!("Adapter Dx11 {:?}", adapter.raw.info);
let id_out = backend::Dx11::hub(global).adapters.register_identity(
id_dx11.unwrap(),
adapter,
@@ -469,7 +468,7 @@ pub fn adapter_request_device<B: GfxBackend>(
"Adapter uniform buffer offset alignment not compatible with WGPU"
);
if desc.limits.max_bind_groups == 0 {
warn!("max_bind_groups limit is missing");
log::warn!("max_bind_groups limit is missing");
} else {
assert!(
u32::from(limits.max_bound_descriptor_sets) >= desc.limits.max_bind_groups,
+1 -2
View File
@@ -9,7 +9,6 @@ use wgn::{AdapterId, Backend, DeviceId, IdentityManager, SurfaceId};
use crate::server::Server;
use ipc_channel::ipc;
use log::error;
use parking_lot::Mutex;
use serde::{Deserialize, Serialize};
@@ -124,7 +123,7 @@ pub extern "C" fn wgpu_initialize() -> Infrastructure {
}
}
Err(e) => {
error!("WGPU initialize failed: {:?}", e);
log::error!("WGPU initialize failed: {:?}", e);
Infrastructure {
client: ptr::null_mut(),
server: ptr::null_mut(),