@@ -27,6 +27,7 @@ use crate::{ContextID, Error, SurfaceAccess, SurfaceInfo, SurfaceType};
27
27
use euclid:: default:: Size2D ;
28
28
use fnv:: { FnvHashMap , FnvHashSet } ;
29
29
use glow as gl;
30
+ use glow:: Context as Gl ;
30
31
use glow:: HasContext ;
31
32
use log:: debug;
32
33
use std:: collections:: hash_map:: Entry ;
@@ -36,8 +37,8 @@ use std::mem;
36
37
use std:: num:: NonZero ;
37
38
use std:: sync:: { Arc , Mutex , MutexGuard , RwLock , RwLockReadGuard , RwLockWriteGuard } ;
38
39
39
- fn frame_buffer ( frame_buffer : u32 ) -> Option < glow :: NativeFramebuffer > {
40
- NonZero :: new ( frame_buffer ) . map ( glow :: NativeFramebuffer )
40
+ fn framebuffer ( framebuffer : u32 ) -> Option < gl :: NativeFramebuffer > {
41
+ NonZero :: new ( framebuffer ) . map ( gl :: NativeFramebuffer )
41
42
}
42
43
43
44
// The data stored for each swap chain.
@@ -57,7 +58,7 @@ struct SwapChainData<Device: DeviceAPI> {
57
58
}
58
59
59
60
pub enum PreserveBuffer < ' a > {
60
- Yes ( & ' a glow :: Context ) ,
61
+ Yes ( & ' a Gl ) ,
61
62
No ,
62
63
}
63
64
@@ -199,15 +200,15 @@ impl<Device: DeviceAPI> SwapChainData<Device> {
199
200
let front_info = device. surface_info ( & new_front_buffer) ;
200
201
unsafe {
201
202
gl. bind_framebuffer (
202
- glow :: READ_FRAMEBUFFER ,
203
- frame_buffer ( front_info. framebuffer_object ) ,
203
+ gl :: READ_FRAMEBUFFER ,
204
+ framebuffer ( front_info. framebuffer_object ) ,
204
205
) ;
205
- debug_assert_eq ! ( gl. get_error( ) , glow :: NO_ERROR ) ;
206
+ debug_assert_eq ! ( gl. get_error( ) , gl :: NO_ERROR ) ;
206
207
gl. bind_framebuffer (
207
- glow :: DRAW_FRAMEBUFFER ,
208
- frame_buffer ( back_info. framebuffer_object ) ,
208
+ gl :: DRAW_FRAMEBUFFER ,
209
+ framebuffer ( back_info. framebuffer_object ) ,
209
210
) ;
210
- debug_assert_eq ! ( gl. get_error( ) , glow :: NO_ERROR ) ;
211
+ debug_assert_eq ! ( gl. get_error( ) , gl :: NO_ERROR ) ;
211
212
gl. blit_framebuffer (
212
213
0 ,
213
214
0 ,
@@ -352,7 +353,7 @@ impl<Device: DeviceAPI> SwapChainData<Device> {
352
353
& mut self ,
353
354
device : & mut Device ,
354
355
context : & mut Device :: Context ,
355
- gl : & glow :: Context ,
356
+ gl : & Gl ,
356
357
color : [ f32 ; 4 ] ,
357
358
) -> Result < ( ) , Error > {
358
359
self . validate_context ( device, context) ?;
@@ -402,7 +403,7 @@ impl<Device: DeviceAPI> SwapChainData<Device> {
402
403
. unwrap ( )
403
404
. framebuffer_object ;
404
405
unsafe {
405
- gl. bind_framebuffer ( gl:: FRAMEBUFFER , frame_buffer ( fbo) ) ;
406
+ gl. bind_framebuffer ( gl:: FRAMEBUFFER , framebuffer ( fbo) ) ;
406
407
gl. clear_color ( color[ 0 ] , color[ 1 ] , color[ 2 ] , color[ 3 ] ) ;
407
408
gl. clear_depth_f64 ( 1. ) ;
408
409
gl. clear_stencil ( 0 ) ;
@@ -428,8 +429,8 @@ impl<Device: DeviceAPI> SwapChainData<Device> {
428
429
429
430
// Restore the GL state
430
431
unsafe {
431
- gl. bind_framebuffer ( gl:: DRAW_FRAMEBUFFER , frame_buffer ( bound_fbos[ 0 ] as _ ) ) ;
432
- gl. bind_framebuffer ( gl:: READ_FRAMEBUFFER , frame_buffer ( bound_fbos[ 1 ] as _ ) ) ;
432
+ gl. bind_framebuffer ( gl:: DRAW_FRAMEBUFFER , framebuffer ( bound_fbos[ 0 ] as _ ) ) ;
433
+ gl. bind_framebuffer ( gl:: READ_FRAMEBUFFER , framebuffer ( bound_fbos[ 1 ] as _ ) ) ;
433
434
gl. clear_color (
434
435
clear_color[ 0 ] ,
435
436
clear_color[ 1 ] ,
@@ -581,7 +582,7 @@ impl<Device: DeviceAPI> SwapChain<Device> {
581
582
& self ,
582
583
device : & mut Device ,
583
584
context : & mut Device :: Context ,
584
- gl : & glow :: Context ,
585
+ gl : & Gl ,
585
586
color : [ f32 ; 4 ] ,
586
587
) -> Result < ( ) , Error > {
587
588
self . lock ( ) . clear_surface ( device, context, gl, color)
0 commit comments