1pub mod handles;
12pub mod prelude;
13
14pub mod stores;
16
17pub mod camera;
19pub mod lights;
20pub mod passes;
21pub mod render_scene;
22pub mod render_target;
23
24pub mod animation;
26pub mod bind_pool;
27pub mod compute;
28pub mod csm;
29pub mod dof;
30pub mod dream_animations;
31pub mod dreamlet_catalog;
32pub mod features;
33pub mod formats;
34pub mod frame_arena;
35pub mod gpu_driven;
36pub mod hiz;
37pub mod ibl;
38pub mod lod;
39pub mod micro_dreamlet;
40pub mod motion_vectors;
41pub mod pipeline;
42pub mod pipeline_cache;
43pub mod post;
44pub mod primitives;
45pub mod ring;
46pub mod shader;
47pub mod ssao;
48pub mod ssgi;
49pub mod ssr;
50pub mod taa;
51pub mod tangent;
52pub mod texture;
53pub mod texture_cache;
54pub mod upload;
55pub mod volumetric;
56pub mod vram;
57
58pub mod avatar;
60pub mod dreammatter;
61pub mod materialize;
62pub mod meshlet;
63pub mod meshlet_render;
64pub mod observer;
65pub mod quantum_bridge;
66pub mod quantum_cull;
67pub mod spatial_event;
68
69pub mod gltf;
71pub mod p3g;
72
73pub mod dream_procedures;
75pub mod particle;
76pub mod physics;
77pub mod picking;
78pub mod procedural;
79pub mod scene;
80pub mod skybox;
81pub mod sprite;
82pub mod text;
83pub mod tween;
84
85pub mod cooperative_matrix;
87pub mod debug_vis;
88pub mod mesh_shader;
89pub mod ray_tracing;
90pub mod rt_denoise;
91pub mod rt_gi;
92pub mod rt_shadows;
93
94pub mod dream_surface;
96pub mod dream_tsr;
97pub mod sdf;
98pub mod surface_cache;
99pub mod translucency_volume;
100
101pub use handles::*;
103
104pub struct GpuRuntime {
107 pub device: wgpu::Device,
108 pub queue: wgpu::Queue,
109 pub capabilities: features::GpuCapabilities,
110 pub ray_tracing: ray_tracing::RayTracingContext,
111 pub mesh_shader: mesh_shader::MeshShaderContext,
112 pub coop_matrix: cooperative_matrix::CooperativeMatrixContext,
113}
114
115impl GpuRuntime {
116 pub fn new(device: wgpu::Device, queue: wgpu::Queue, adapter: &wgpu::Adapter) -> Self {
118 let capabilities = features::GpuCapabilities::from_adapter(adapter);
119 let device_features = device.features();
120 let device_limits = device.limits();
121
122 let rt_ctx = ray_tracing::RayTracingContext::init_if_supported(&device, device_features);
123 let mesh_ctx = mesh_shader::MeshShaderContext::init_if_supported(device_features, &device_limits);
124 let coop_ctx = cooperative_matrix::CooperativeMatrixContext::init_if_supported(adapter, device_features);
125
126 log::info!("GPU: {}", capabilities.summary());
127 if rt_ctx.enabled {
128 log::info!(" Ray tracing: enabled");
129 }
130 if mesh_ctx.enabled {
131 log::info!(" Mesh shaders: enabled (max layers={})", mesh_ctx.max_output_layers);
132 }
133 if coop_ctx.enabled {
134 log::info!(" {}", coop_ctx.summary());
135 }
136
137 device.on_uncaptured_error(std::sync::Arc::new(|error| {
139 log::error!("gpu_device_error:{error}");
140 }));
141
142 Self {
143 device,
144 queue,
145 capabilities,
146 ray_tracing: rt_ctx,
147 mesh_shader: mesh_ctx,
148 coop_matrix: coop_ctx,
149 }
150 }
151
152 pub fn capabilities(&self) -> &features::GpuCapabilities {
154 &self.capabilities
155 }
156
157 pub fn surface_format(&self) -> wgpu::TextureFormat {
159 formats::TEXTURE_FORMAT
160 }
161
162 pub fn resize(&mut self, _width: u32, _height: u32) {
166 }
170}