1#![deny(unsafe_code)]
2#![allow(clippy::too_many_arguments)]
3
4mod capture;
5mod device;
6mod diagnostics;
7mod draw;
8mod feathering;
9mod geometry;
10mod gpu;
11mod interop;
12mod output;
13mod path_cache;
14mod paths;
15mod primitives;
16mod renderer;
17mod resources;
18mod retained;
19mod scene;
20mod shaders;
21mod submission;
22mod surface;
23#[cfg(test)]
24mod tests;
25mod text;
26mod text_background;
27mod text_engine;
28mod text_hinting;
29mod text_policy;
30mod text_raster;
31mod uploads;
32
33pub use sui_scene::TextSubpixelOrder;
34
35pub use capture::DebugCaptureArtifact;
36pub use capture::HdrRgbaImage;
37pub use capture::RgbaImage;
38pub use diagnostics::RendererFrameStats;
39pub use diagnostics::RendererPacketHotspot;
40pub use diagnostics::RetainedPacketRebuildStats;
41pub use interop::RendererInterop;
42pub use interop::WgpuExternalTextureContext;
43pub use interop::WgpuExternalTextureRegistry;
44pub use output::ColorManagementMode;
45pub use output::DEFAULT_SDR_CONTENT_BRIGHTNESS_NITS;
46pub use output::DebugCaptureEncoding;
47pub use output::DebugCaptureRequest;
48pub use output::DebugCaptureStage;
49pub use output::DebugSdrVisualization;
50pub use output::DisplayCapabilities;
51pub use output::DisplayColorPrimaries;
52pub use output::DisplayTransferFunction;
53pub use output::DynamicRangeMode;
54pub use output::OutputStrategy;
55pub use output::RendererCapabilities;
56pub use output::RequestedColorManagementMode;
57pub use output::RequestedDynamicRangeMode;
58pub use output::RequestedOutputColorPrimaries;
59pub use output::RequestedToneMappingMode;
60pub use text::GlyphCacheSnapshot;
61pub use text::RendererTextCacheSnapshot;
62pub use text_policy::FeatheringOptions;
63pub use text_policy::StemDarkening;
64pub use text_policy::TextCoveragePolicy;
65pub use text_policy::TextHinting;
66pub use text_policy::TextRenderMode;
67
68use crate::gpu::SharedRenderer;
69use crate::resources::CachedAnalyticPathGpu;
70use crate::resources::CachedExternalTextureBindGroup;
71use crate::resources::CachedImageTexture;
72use crate::resources::CachedTextAtlasTexture;
73use crate::resources::FrameResources;
74use crate::resources::ImageTextureCacheKey;
75use crate::resources::OffscreenTarget;
76use crate::retained::RetainedCompositorState;
77use crate::surface::SurfaceState;
78use crate::text_engine::TextEngine;
79use std::collections::HashMap;
80use sui_core::ImageHandle;
81use sui_core::WindowId;
82use sui_scene::SceneFrame;
83
84pub struct WgpuRenderer {
85 instance: wgpu::Instance,
86 feathering_enabled: bool,
87 feather_width: f32,
88 text_render_mode: TextRenderMode,
89 text_subpixel_order: TextSubpixelOrder,
90 text_hinting: TextHinting,
91 stem_darkening: StemDarkening,
92 text_coverage_policy: TextCoveragePolicy,
93 vsync_enabled: bool,
94 runtime_feathering_override: Option<FeatheringOptions>,
95 runtime_text_subpixel_order_override: Option<TextSubpixelOrder>,
96 runtime_text_hinting_override: Option<TextHinting>,
97 runtime_stem_darkening_override: Option<StemDarkening>,
98 runtime_text_coverage_policy_override: Option<TextCoveragePolicy>,
99 runtime_diagnostics_enabled: bool,
100 pending_device_prepare_time_us: u64,
101 pending_device_wait_time_us: u64,
102 #[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
103 device_preparation: Option<device::DevicePreparation>,
104 prepared_surfaces: HashMap<WindowId, surface::PreparedSurface>,
105 frames_rendered: usize,
106 capabilities: RendererCapabilities,
107 last_frames: HashMap<WindowId, SceneFrame>,
108 last_frame_stats: HashMap<WindowId, RendererFrameStats>,
109 shared: Option<SharedRenderer>,
110 text_engine: Option<TextEngine>,
111 image_cache: HashMap<ImageTextureCacheKey, CachedImageTexture>,
112 external_texture_registry: Option<WgpuExternalTextureRegistry>,
113 external_image_cache: HashMap<ImageHandle, CachedExternalTextureBindGroup>,
114 text_atlas_array: Option<CachedTextAtlasTexture>,
115 analytic_path_cache: HashMap<u64, CachedAnalyticPathGpu>,
116 compositors: HashMap<WindowId, RetainedCompositorState>,
117 surfaces: HashMap<WindowId, SurfaceState>,
118 offscreen_targets: HashMap<WindowId, OffscreenTarget>,
119 intermediate_targets: HashMap<WindowId, OffscreenTarget>,
120 frame_resources: FrameResources,
121}