-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WPI for manual initialization example.
- Loading branch information
1 parent
fefb847
commit 7d3ff8c
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
integration_tests/examples/manual_graphics_initialization.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use compositor_pipeline::{ | ||
pipeline::{GraphicsContext, Options}, | ||
Pipeline, | ||
}; | ||
use live_compositor::config::read_config; | ||
|
||
// This example illustrates how to initialize a GraphicsContext separately to get access to a wgpu | ||
// instance, adapter, queue and device. | ||
fn main() { | ||
let graphics_context = | ||
GraphicsContext::new(false, wgpu::Features::default(), wgpu::Limits::default()).unwrap(); | ||
|
||
let _device = graphics_context.device.clone(); | ||
let _queue = graphics_context.queue.clone(); | ||
|
||
#[cfg(target_os = "linux")] | ||
let _adapter = graphics_context | ||
.vulkan_ctx | ||
.as_ref() | ||
.unwrap() | ||
.wgpu_ctx | ||
.adapter | ||
.clone(); | ||
|
||
#[cfg(target_os = "linux")] | ||
let _instance = graphics_context | ||
.vulkan_ctx | ||
.as_ref() | ||
.unwrap() | ||
.wgpu_ctx | ||
.instance | ||
.clone(); | ||
|
||
let config = read_config(); | ||
|
||
let _pipeline = Pipeline::new(Options { | ||
wgpu_ctx: Some(graphics_context), | ||
queue_options: config.queue_options, | ||
stream_fallback_timeout: config.stream_fallback_timeout, | ||
web_renderer: config.web_renderer, | ||
force_gpu: config.force_gpu, | ||
download_root: config.download_root, | ||
output_sample_rate: config.output_sample_rate, | ||
wgpu_features: config.required_wgpu_features, | ||
load_system_fonts: Some(true), | ||
}) | ||
.unwrap(); | ||
} |