mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-17 01:12:41 +00:00
[rs] Merge #797
797: Move from `tracing` to `log` + `profiling` r=kvark a=cwfitzgerald Continuation of https://github.com/gfx-rs/wgpu/pull/1268 into wgpu-rs This also includes the naga gfx-15 train. Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This commit is contained in:
commit
f89244e3c3
@ -26,28 +26,28 @@ webgl = ["wgc"]
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "717c2d73e725c064a3c4696d6d7bdb428c9500b6"
|
||||
rev = "2f3b398e3887a336c963c43e7954f94cae42dd31"
|
||||
features = ["raw-window-handle", "cross"]
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "717c2d73e725c064a3c4696d6d7bdb428c9500b6"
|
||||
rev = "2f3b398e3887a336c963c43e7954f94cae42dd31"
|
||||
features = ["raw-window-handle", "cross"]
|
||||
optional = true
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "717c2d73e725c064a3c4696d6d7bdb428c9500b6"
|
||||
rev = "2f3b398e3887a336c963c43e7954f94cae42dd31"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
parking_lot = "0.11"
|
||||
profiling = { version = "0.1.10", default-features = false } # Need 0.1.10+ to avoid compliation error with proc macros off.
|
||||
raw-window-handle = "0.3"
|
||||
smallvec = "1"
|
||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||
serde = { version = "1", features = ["derive"], optional = true }
|
||||
smallvec = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
bytemuck = { version = "1.4", features = ["derive"] }
|
||||
@ -63,18 +63,18 @@ winit = { version = "0.24", features = ["web-sys"] }
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
async-executor = "1.0"
|
||||
pollster = "0.2"
|
||||
wgpu-subscriber = "0.1"
|
||||
env_logger = "0.8"
|
||||
|
||||
# used to test all the example shaders
|
||||
[dev-dependencies.naga]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
tag = "gfx-14"
|
||||
tag = "gfx-15"
|
||||
features = ["wgsl-in"]
|
||||
|
||||
# used to generate SPIR-V for the Web target
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.naga]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
tag = "gfx-14"
|
||||
tag = "gfx-15"
|
||||
features = ["wgsl-in", "spv-out"]
|
||||
|
||||
[[example]]
|
||||
|
@ -194,7 +194,7 @@ impl BufferDimensions {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
wgpu_subscriber::initialize_default_subscriber(None);
|
||||
env_logger::init();
|
||||
pollster::block_on(run("red.png"));
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
@ -75,10 +75,7 @@ struct Setup {
|
||||
async fn setup<E: Example>(title: &str) -> Setup {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACE");
|
||||
wgpu_subscriber::initialize_default_subscriber(
|
||||
chrome_tracing_dir.as_ref().map(std::path::Path::new).ok(),
|
||||
);
|
||||
env_logger::init();
|
||||
};
|
||||
|
||||
let event_loop = EventLoop::new();
|
||||
|
@ -191,7 +191,7 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
wgpu_subscriber::initialize_default_subscriber(None);
|
||||
env_logger::init();
|
||||
pollster::block_on(run());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
@ -131,7 +131,7 @@ fn main() {
|
||||
let window = winit::window::Window::new(&event_loop).unwrap();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
wgpu_subscriber::initialize_default_subscriber(None);
|
||||
env_logger::init();
|
||||
// Temporarily avoid srgb formats for the swapchain on the web
|
||||
pollster::block_on(run(event_loop, window));
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
wgpu_subscriber::initialize_default_subscriber(None);
|
||||
env_logger::init();
|
||||
// Temporarily avoid srgb formats for the swapchain on the web
|
||||
pollster::block_on(run(event_loop, viewports));
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ async fn run() {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
wgpu_subscriber::initialize_default_subscriber(None);
|
||||
env_logger::init();
|
||||
pollster::block_on(run());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
@ -397,7 +397,7 @@ mod pass_impl {
|
||||
&mut self,
|
||||
render_bundles: I,
|
||||
) {
|
||||
wgc::span!(_guard, TRACE, "RenderPass::execute_bundles wrapper");
|
||||
profiling::scope!("RenderPass::execute_bundles wrapper");
|
||||
let temp_render_bundles = render_bundles.cloned().collect::<SmallVec<[_; 4]>>();
|
||||
unsafe {
|
||||
wgpu_render_pass_execute_bundles(
|
||||
@ -843,7 +843,7 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &BindGroupDescriptor,
|
||||
) -> Self::BindGroupId {
|
||||
wgc::span!(_guard, TRACE, "Device::create_bind_group wrapper");
|
||||
profiling::scope!("Device::create_bind_group wrapper");
|
||||
use wgc::binding_model as bm;
|
||||
|
||||
let mut arrayed_texture_views = Vec::new();
|
||||
@ -920,7 +920,7 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &PipelineLayoutDescriptor,
|
||||
) -> Self::PipelineLayoutId {
|
||||
wgc::span!(_guard, TRACE, "Device::create_pipeline_layout wrapper");
|
||||
profiling::scope!("Device::create_pipeline_layout wrapper");
|
||||
|
||||
// Limit is always less or equal to wgc::MAX_BIND_GROUPS, so this is always right
|
||||
// Guards following ArrayVec
|
||||
@ -965,7 +965,7 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &RenderPipelineDescriptor,
|
||||
) -> Self::RenderPipelineId {
|
||||
wgc::span!(_guard, TRACE, "Device::create_render_pipeline wrapper");
|
||||
profiling::scope!("Device::create_render_pipeline wrapper");
|
||||
use wgc::pipeline as pipe;
|
||||
|
||||
let vertex_buffers: ArrayVec<[_; wgc::device::MAX_VERTEX_BUFFERS]> = desc
|
||||
@ -1268,7 +1268,7 @@ impl crate::Context for Context {
|
||||
mode: MapMode,
|
||||
range: Range<wgt::BufferAddress>,
|
||||
) -> Self::MapAsyncFuture {
|
||||
wgc::span!(_guard, TRACE, "Buffer::buffer_map_async wrapper");
|
||||
profiling::scope!("Buffer::buffer_map_async wrapper");
|
||||
|
||||
let (future, completion) = native_gpu_future::new_gpu_future();
|
||||
|
||||
@ -1313,7 +1313,7 @@ impl crate::Context for Context {
|
||||
sub_range.start,
|
||||
wgt::BufferSize::new(size)
|
||||
)) {
|
||||
Ok(ptr) => BufferMappedRange {
|
||||
Ok((ptr, size)) => BufferMappedRange {
|
||||
ptr,
|
||||
size: size as usize,
|
||||
},
|
||||
@ -1674,7 +1674,7 @@ impl crate::Context for Context {
|
||||
encoder: &Self::CommandEncoderId,
|
||||
desc: &crate::RenderPassDescriptor<'a, '_>,
|
||||
) -> Self::RenderPassId {
|
||||
wgc::span!(_guard, TRACE, "CommandEncoder::begin_render_pass wrapper");
|
||||
profiling::scope!("CommandEncoder::begin_render_pass wrapper");
|
||||
let colors = desc
|
||||
.color_attachments
|
||||
.iter()
|
||||
|
@ -113,7 +113,7 @@ impl StagingBelt {
|
||||
} else {
|
||||
let size = self.chunk_size.max(size.get());
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
wgc::span!(_guard, INFO, "Creating chunk of size {}", size);
|
||||
profiling::scope!("Creating chunk of size {}");
|
||||
Chunk {
|
||||
buffer: device.create_buffer(&BufferDescriptor {
|
||||
label: Some("staging"),
|
||||
@ -149,7 +149,7 @@ impl StagingBelt {
|
||||
/// the GPU is done copying the data from them.
|
||||
pub fn finish(&mut self) {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
wgc::span!(_guard, DEBUG, "Finishing chunks");
|
||||
profiling::scope!("Finishing chunks");
|
||||
|
||||
for chunk in self.active_chunks.drain(..) {
|
||||
chunk.buffer.unmap();
|
||||
|
Loading…
Reference in New Issue
Block a user