Initial profiling support for Iced.
This commit is contained in:
parent
ba20ac8e49
commit
c5cd236b73
20 changed files with 357 additions and 35 deletions
|
|
@ -8,24 +8,25 @@ license = "MIT AND OFL-1.1"
|
|||
repository = "https://github.com/iced-rs/iced"
|
||||
|
||||
[features]
|
||||
svg = ["iced_graphics/svg"]
|
||||
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"]
|
||||
image = ["iced_graphics/image"]
|
||||
png = ["iced_graphics/png"]
|
||||
jpeg = ["iced_graphics/jpeg"]
|
||||
jpeg_rayon = ["iced_graphics/jpeg_rayon"]
|
||||
gif = ["iced_graphics/gif"]
|
||||
webp = ["iced_graphics/webp"]
|
||||
png = ["iced_graphics/png"]
|
||||
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"]
|
||||
svg = ["iced_graphics/svg"]
|
||||
trace = ["iced_profiling"]
|
||||
webgl = ["wgpu/webgl"]
|
||||
webp = ["iced_graphics/webp"]
|
||||
|
||||
[dependencies]
|
||||
wgpu = "0.14"
|
||||
|
|
@ -50,6 +51,11 @@ version = "0.5"
|
|||
path = "../graphics"
|
||||
features = ["font-fallback", "font-icons"]
|
||||
|
||||
[dependencies.iced_profiling]
|
||||
version = "0.1.0"
|
||||
path = "../profiling"
|
||||
optional = true
|
||||
|
||||
[dependencies.encase]
|
||||
version = "0.3.0"
|
||||
features = ["glam"]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ use iced_graphics::{Primitive, Viewport};
|
|||
use iced_native::alignment;
|
||||
use iced_native::{Font, Size};
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use iced_profiling::info_span;
|
||||
|
||||
#[cfg(any(feature = "image", feature = "svg"))]
|
||||
use crate::image;
|
||||
|
||||
|
|
@ -77,6 +80,8 @@ impl Backend {
|
|||
overlay_text: &[T],
|
||||
) {
|
||||
log::debug!("Drawing");
|
||||
#[cfg(feature = "trace")]
|
||||
let _ = info_span!("Wgpu::Backend", "PRESENT").entered();
|
||||
|
||||
let target_size = viewport.physical_size();
|
||||
let scale_factor = viewport.scale_factor() as f32;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ use iced_native::image;
|
|||
#[cfg(feature = "svg")]
|
||||
use iced_native::svg;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use iced_profiling::info_span;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Pipeline {
|
||||
#[cfg(feature = "image")]
|
||||
|
|
@ -289,6 +292,9 @@ impl Pipeline {
|
|||
target: &wgpu::TextureView,
|
||||
_scale: f32,
|
||||
) {
|
||||
#[cfg(feature = "trace")]
|
||||
let _ = info_span!("Wgpu::Image", "DRAW").entered();
|
||||
|
||||
let instances: &mut Vec<Instance> = &mut Vec::new();
|
||||
|
||||
#[cfg(feature = "image")]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ use bytemuck::{Pod, Zeroable};
|
|||
use std::mem;
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use iced_profiling::info_span;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Pipeline {
|
||||
pipeline: wgpu::RenderPipeline,
|
||||
|
|
@ -173,6 +176,9 @@ impl Pipeline {
|
|||
bounds: Rectangle<u32>,
|
||||
target: &wgpu::TextureView,
|
||||
) {
|
||||
#[cfg(feature = "trace")]
|
||||
let _ = info_span!("Wgpu::Quad", "DRAW").entered();
|
||||
|
||||
let uniforms = Uniforms::new(transformation, scale);
|
||||
|
||||
{
|
||||
|
|
@ -207,6 +213,9 @@ impl Pipeline {
|
|||
|
||||
instance_buffer.copy_from_slice(instance_bytes);
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
let _ = info_span!("Wgpu::Quad", "BEGIN_RENDER_PASS").enter();
|
||||
|
||||
{
|
||||
let mut render_pass =
|
||||
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
|
|
|
|||
|
|
@ -8,6 +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;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Pipeline {
|
||||
|
|
@ -53,6 +55,9 @@ impl Pipeline {
|
|||
scale_factor: f32,
|
||||
meshes: &[Mesh<'_>],
|
||||
) {
|
||||
#[cfg(feature = "trace")]
|
||||
let _ = info_span!("Wgpu::Triangle", "DRAW").entered();
|
||||
|
||||
// Count the total amount of vertices & indices we need to handle
|
||||
let count = mesh::attribute_count_of(meshes);
|
||||
|
||||
|
|
@ -247,6 +252,9 @@ impl Pipeline {
|
|||
(target, None, wgpu::LoadOp::Load)
|
||||
};
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
let _ = info_span!("Wgpu::Triangle", "BEGIN_RENDER_PASS").enter();
|
||||
|
||||
let mut render_pass =
|
||||
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("iced_wgpu::triangle render pass"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue