Restructured everything to make profiling a feature of iced_winit.

This commit is contained in:
bungoboingo 2022-12-20 20:41:09 -08:00 committed by Héctor Ramón Jiménez
parent c5cd236b73
commit 4b6d3797d4
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
23 changed files with 184 additions and 254 deletions

View file

@ -8,25 +8,24 @@ license = "MIT AND OFL-1.1"
repository = "https://github.com/iced-rs/iced"
[features]
bmp = ["iced_graphics/bmp"]
canvas = ["iced_graphics/canvas"]
dds = ["iced_graphics/dds"]
default_system_font = ["iced_graphics/font-source"]
farbfeld = ["iced_graphics/farbfeld"]
gif = ["iced_graphics/gif"]
hdr = ["iced_graphics/hdr"]
ico = ["iced_graphics/ico"]
svg = ["iced_graphics/svg"]
image = ["iced_graphics/image"]
png = ["iced_graphics/png"]
jpeg = ["iced_graphics/jpeg"]
jpeg_rayon = ["iced_graphics/jpeg_rayon"]
png = ["iced_graphics/png"]
pnm = ["iced_graphics/pnm"]
qr_code = ["iced_graphics/qr_code"]
spirv = ["wgpu/spirv"]
svg = ["iced_graphics/svg"]
trace = ["iced_profiling"]
webgl = ["wgpu/webgl"]
gif = ["iced_graphics/gif"]
webp = ["iced_graphics/webp"]
pnm = ["iced_graphics/pnm"]
ico = ["iced_graphics/ico"]
bmp = ["iced_graphics/bmp"]
hdr = ["iced_graphics/hdr"]
dds = ["iced_graphics/dds"]
farbfeld = ["iced_graphics/farbfeld"]
canvas = ["iced_graphics/canvas"]
qr_code = ["iced_graphics/qr_code"]
default_system_font = ["iced_graphics/font-source"]
spirv = ["wgpu/spirv"]
webgl = ["wgpu/webgl"]
[dependencies]
wgpu = "0.14"
@ -51,9 +50,8 @@ version = "0.5"
path = "../graphics"
features = ["font-fallback", "font-icons"]
[dependencies.iced_profiling]
version = "0.1.0"
path = "../profiling"
[dependencies.tracing]
version = "0.1.6"
optional = true
[dependencies.encase]

View file

@ -10,8 +10,8 @@ use iced_graphics::{Primitive, Viewport};
use iced_native::alignment;
use iced_native::{Font, Size};
#[cfg(feature = "trace")]
use iced_profiling::info_span;
#[cfg(feature = "tracing")]
use tracing::info_span;
#[cfg(any(feature = "image", feature = "svg"))]
use crate::image;
@ -80,7 +80,7 @@ impl Backend {
overlay_text: &[T],
) {
log::debug!("Drawing");
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Wgpu::Backend", "PRESENT").entered();
let target_size = viewport.physical_size();

View file

@ -23,8 +23,8 @@ use iced_native::image;
#[cfg(feature = "svg")]
use iced_native::svg;
#[cfg(feature = "trace")]
use iced_profiling::info_span;
#[cfg(feature = "tracing")]
use tracing::info_span;
#[derive(Debug)]
pub struct Pipeline {
@ -292,7 +292,7 @@ impl Pipeline {
target: &wgpu::TextureView,
_scale: f32,
) {
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Wgpu::Image", "DRAW").entered();
let instances: &mut Vec<Instance> = &mut Vec::new();

View file

@ -6,8 +6,8 @@ use bytemuck::{Pod, Zeroable};
use std::mem;
use wgpu::util::DeviceExt;
#[cfg(feature = "trace")]
use iced_profiling::info_span;
#[cfg(feature = "tracing")]
use tracing::info_span;
#[derive(Debug)]
pub struct Pipeline {
@ -176,7 +176,7 @@ impl Pipeline {
bounds: Rectangle<u32>,
target: &wgpu::TextureView,
) {
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Wgpu::Quad", "DRAW").entered();
let uniforms = Uniforms::new(transformation, scale);
@ -213,7 +213,7 @@ impl Pipeline {
instance_buffer.copy_from_slice(instance_bytes);
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Wgpu::Quad", "BEGIN_RENDER_PASS").enter();
{

View file

@ -8,8 +8,8 @@ use crate::Transformation;
use iced_graphics::layer::mesh::{self, Mesh};
use iced_graphics::triangle::ColoredVertex2D;
use iced_graphics::Size;
#[cfg(feature = "trace")]
use iced_profiling::info_span;
#[cfg(feature = "tracing")]
use tracing::info_span;
#[derive(Debug)]
pub struct Pipeline {
@ -55,7 +55,7 @@ impl Pipeline {
scale_factor: f32,
meshes: &[Mesh<'_>],
) {
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Wgpu::Triangle", "DRAW").entered();
// Count the total amount of vertices & indices we need to handle
@ -252,7 +252,7 @@ impl Pipeline {
(target, None, wgpu::LoadOp::Load)
};
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Wgpu::Triangle", "BEGIN_RENDER_PASS").enter();
let mut render_pass =