From 7e0748b44274e50185b8b146ed7cd2c1e3dfc361 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Wed, 26 Apr 2023 19:05:02 +1000 Subject: [PATCH] ...could this fix dual gpu on windows??? --- gb-vst/src/ui.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gb-vst/src/ui.rs b/gb-vst/src/ui.rs index af36317..e71e1bb 100644 --- a/gb-vst/src/ui.rs +++ b/gb-vst/src/ui.rs @@ -12,7 +12,7 @@ use gb_emu_lib::{ }; use keyboard_types::{Code, KeyState}; use nih_plug::prelude::*; -use pixels::{Pixels, SurfaceTexture}; +use pixels::{wgpu::PowerPreference, Pixels, SurfaceTexture}; use crate::{FrameReceiver, JoypadSender}; @@ -121,12 +121,18 @@ fn init_pixbuf(info: WindowInfo, window: &mut Window) -> (Pixels, usize, Vec<[u8 let physical_size = info.physical_size(); let scale = (physical_size.width as usize / WIDTH).min(physical_size.height as usize / HEIGHT); let scaled_buf = vec![[0, 0, 0, 0xFF]; WIDTH * scale * HEIGHT * scale]; + ( - pixels::Pixels::new( + pixels::PixelsBuilder::new( physical_size.width, physical_size.height, SurfaceTexture::new(physical_size.width, physical_size.height, window), ) + .request_adapter_options(pixels::wgpu::RequestAdapterOptionsBase { + power_preference: PowerPreference::HighPerformance, + ..pixels::wgpu::RequestAdapterOptionsBase::default() + }) + .build() .unwrap(), scale, scaled_buf,