@@ -8,7 +8,6 @@ use graphene_application_io::{ApplicationIo, EditorApi, SurfaceHandle, SurfaceId
8
8
use graphene_core:: { Color , Ctx } ;
9
9
pub use graphene_svg_renderer:: RenderContext ;
10
10
use std:: sync:: { Arc , Mutex } ;
11
- use vello:: Error ;
12
11
use vello:: { AaConfig , AaSupport , RenderParams , Renderer , RendererOptions , Scene } ;
13
12
use wgpu:: util:: TextureBlitter ;
14
13
use wgpu:: { Origin3d , SurfaceConfiguration , TextureAspect } ;
@@ -54,6 +53,8 @@ unsafe impl StaticType for Surface {
54
53
type Static = Surface ;
55
54
}
56
55
56
+ const VELLO_SURFACE_FORMAT : wgpu:: TextureFormat = wgpu:: TextureFormat :: Rgba8Unorm ;
57
+
57
58
impl WgpuExecutor {
58
59
pub async fn render_vello_scene ( & self , scene : & Scene , surface : & WgpuSurface , size : UVec2 , context : & RenderContext , background : Color ) -> Result < ( ) > {
59
60
let mut guard = surface. surface . target_texture . lock ( ) . unwrap ( ) ;
@@ -73,7 +74,7 @@ impl WgpuExecutor {
73
74
sample_count : 1 ,
74
75
dimension : wgpu:: TextureDimension :: D2 ,
75
76
usage : wgpu:: TextureUsages :: STORAGE_BINDING | wgpu:: TextureUsages :: TEXTURE_BINDING ,
76
- format : wgpu :: TextureFormat :: Rgba8Unorm ,
77
+ format : VELLO_SURFACE_FORMAT ,
77
78
view_formats : & [ ] ,
78
79
} ) ;
79
80
let view = texture. create_view ( & wgpu:: TextureViewDescriptor :: default ( ) ) ;
@@ -87,7 +88,7 @@ impl WgpuExecutor {
87
88
& self . context . device ,
88
89
& SurfaceConfiguration {
89
90
usage : wgpu:: TextureUsages :: RENDER_ATTACHMENT | wgpu:: TextureUsages :: STORAGE_BINDING ,
90
- format : wgpu :: TextureFormat :: Rgba8Unorm ,
91
+ format : VELLO_SURFACE_FORMAT ,
91
92
width : size. x ,
92
93
height : size. y ,
93
94
present_mode : surface_caps. present_modes [ 0 ] ,
@@ -151,13 +152,7 @@ impl WgpuExecutor {
151
152
}
152
153
153
154
pub fn create_surface_inner ( & self , surface : wgpu:: Surface < ' static > , window_id : SurfaceId ) -> Result < SurfaceHandle < Surface > > {
154
- let capabilities = surface. get_capabilities ( & self . context . adapter ) ;
155
- let format = capabilities
156
- . formats
157
- . into_iter ( )
158
- . find ( |it| matches ! ( it, wgpu:: TextureFormat :: Rgba8Unorm | wgpu:: TextureFormat :: Bgra8Unorm ) )
159
- . ok_or ( Error :: UnsupportedSurfaceFormat ) ?;
160
- let blitter = TextureBlitter :: new ( & self . context . device , format) ;
155
+ let blitter = TextureBlitter :: new ( & self . context . device , VELLO_SURFACE_FORMAT ) ;
161
156
Ok ( SurfaceHandle {
162
157
window_id,
163
158
surface : Surface {
0 commit comments