mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-03 02:48:11 +08:00
Use window size for surface creation
This commit is contained in:
committed by
Keavon Chambers
parent
5d1581dd70
commit
fe977208ba
@@ -15,6 +15,7 @@ gpu = [
|
|||||||
]
|
]
|
||||||
default = ["wgpu"]
|
default = ["wgpu"]
|
||||||
wgpu = ["wgpu-executor", "gpu"]
|
wgpu = ["wgpu-executor", "gpu"]
|
||||||
|
wayland = ["graphene-std/wayland"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -26,6 +27,7 @@ bezier-rs = { path = "../../libraries/bezier-rs" }
|
|||||||
glam = { version = "0.22", features = ["serde"] }
|
glam = { version = "0.22", features = ["serde"] }
|
||||||
|
|
||||||
# Node graph
|
# Node graph
|
||||||
|
graphene-std = { path = "../gstd" }
|
||||||
image = { version = "0.24", default-features = false, features = [
|
image = { version = "0.24", default-features = false, features = [
|
||||||
"bmp",
|
"bmp",
|
||||||
"png",
|
"png",
|
||||||
@@ -36,7 +38,6 @@ gpu-executor = { path = "../gpu-executor", optional = true }
|
|||||||
interpreted-executor = { path = "../interpreted-executor" }
|
interpreted-executor = { path = "../interpreted-executor" }
|
||||||
dyn-any = { path = "../../libraries/dyn-any" }
|
dyn-any = { path = "../../libraries/dyn-any" }
|
||||||
graphene-core = { path = "../gcore" }
|
graphene-core = { path = "../gcore" }
|
||||||
graphene-std = { path = "../gstd", features = [] }
|
|
||||||
future-executor = { path = "../future-executor", optional = true }
|
future-executor = { path = "../future-executor", optional = true }
|
||||||
|
|
||||||
wasm-bindgen = { version = "0.2.86", optional = true }
|
wasm-bindgen = { version = "0.2.86", optional = true }
|
||||||
|
|||||||
@@ -450,14 +450,15 @@ impl gpu_executor::GpuExecutor for WgpuExecutor {
|
|||||||
fn create_surface(&self, window: SurfaceHandle<Self::Window>) -> Result<SurfaceHandle<wgpu::Surface>> {
|
fn create_surface(&self, window: SurfaceHandle<Self::Window>) -> Result<SurfaceHandle<wgpu::Surface>> {
|
||||||
let surface = unsafe { self.context.instance.create_surface(window.surface.as_ref()) }?;
|
let surface = unsafe { self.context.instance.create_surface(window.surface.as_ref()) }?;
|
||||||
|
|
||||||
|
let size = window.surface.inner_size();
|
||||||
let surface_caps = surface.get_capabilities(&self.context.adapter);
|
let surface_caps = surface.get_capabilities(&self.context.adapter);
|
||||||
println!("{:?}", surface_caps);
|
println!("{:?}", surface_caps);
|
||||||
let surface_format = wgpu::TextureFormat::Bgra8Unorm;
|
let surface_format = wgpu::TextureFormat::Bgra8Unorm;
|
||||||
let config = wgpu::SurfaceConfiguration {
|
let config = wgpu::SurfaceConfiguration {
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||||
format: surface_format,
|
format: surface_format,
|
||||||
width: 1920,
|
width: size.width,
|
||||||
height: 1080,
|
height: size.height,
|
||||||
present_mode: surface_caps.present_modes[0],
|
present_mode: surface_caps.present_modes[0],
|
||||||
alpha_mode: surface_caps.alpha_modes[0],
|
alpha_mode: surface_caps.alpha_modes[0],
|
||||||
view_formats: vec![],
|
view_formats: vec![],
|
||||||
|
|||||||
Reference in New Issue
Block a user