@@ -10,7 +10,6 @@ use canvas_traits::webgl::ActiveAttribInfo;
10
10
use canvas_traits:: webgl:: ActiveUniformBlockInfo ;
11
11
use canvas_traits:: webgl:: ActiveUniformInfo ;
12
12
use canvas_traits:: webgl:: AlphaTreatment ;
13
- use canvas_traits:: webgl:: DOMToTextureCommand ;
14
13
use canvas_traits:: webgl:: GLContextAttributes ;
15
14
use canvas_traits:: webgl:: GLLimits ;
16
15
use canvas_traits:: webgl:: GlType ;
@@ -239,8 +238,6 @@ pub(crate) struct WebGLThread {
239
238
cached_context_info : FnvHashMap < WebGLContextId , WebGLContextInfo > ,
240
239
/// Current bound context.
241
240
bound_context_id : Option < WebGLContextId > ,
242
- /// Texture ids and sizes used in DOM to texture outputs.
243
- dom_outputs : FnvHashMap < webrender_api:: PipelineId , DOMToTextureData > ,
244
241
/// List of registered webrender external images.
245
242
/// We use it to get an unique ID for new WebGLContexts.
246
243
external_images : Arc < Mutex < WebrenderExternalImageRegistry > > ,
@@ -298,7 +295,6 @@ impl WebGLThread {
298
295
contexts : Default :: default ( ) ,
299
296
cached_context_info : Default :: default ( ) ,
300
297
bound_context_id : None ,
301
- dom_outputs : Default :: default ( ) ,
302
298
external_images,
303
299
sender,
304
300
receiver : receiver. into_inner ( ) ,
@@ -410,9 +406,6 @@ impl WebGLThread {
410
406
WebGLMsg :: SwapBuffers ( swap_ids, sender, sent_time) => {
411
407
self . handle_swap_buffers ( swap_ids, sender, sent_time) ;
412
408
} ,
413
- WebGLMsg :: DOMToTextureCommand ( command) => {
414
- self . handle_dom_to_texture ( command) ;
415
- } ,
416
409
WebGLMsg :: Exit => {
417
410
return true ;
418
411
} ,
@@ -890,88 +883,6 @@ impl WebGLThread {
890
883
SurfaceAccess :: GPUOnly
891
884
}
892
885
893
- fn handle_dom_to_texture ( & mut self , command : DOMToTextureCommand ) {
894
- match command {
895
- DOMToTextureCommand :: Attach ( context_id, texture_id, document_id, pipeline_id, size) => {
896
- let data = Self :: make_current_if_needed (
897
- & self . device ,
898
- context_id,
899
- & self . contexts ,
900
- & mut self . bound_context_id ,
901
- )
902
- . expect ( "WebGLContext not found in a WebGL DOMToTextureCommand::Attach command" ) ;
903
- // Initialize the texture that WR will use for frame outputs.
904
- data. gl . tex_image_2d (
905
- gl:: TEXTURE_2D ,
906
- 0 ,
907
- gl:: RGBA as gl:: GLint ,
908
- size. width ,
909
- size. height ,
910
- 0 ,
911
- gl:: RGBA ,
912
- gl:: UNSIGNED_BYTE ,
913
- gl:: TexImageSource :: Pixels ( None ) ,
914
- ) ;
915
- self . dom_outputs . insert (
916
- pipeline_id,
917
- DOMToTextureData {
918
- context_id,
919
- texture_id,
920
- document_id,
921
- size,
922
- } ,
923
- ) ;
924
- let mut txn = webrender_api:: Transaction :: new ( ) ;
925
- txn. enable_frame_output ( pipeline_id, true ) ;
926
- self . webrender_api . send_transaction ( document_id, txn) ;
927
- } ,
928
- DOMToTextureCommand :: Lock ( pipeline_id, gl_sync, sender) => {
929
- let result = self . handle_dom_to_texture_lock ( pipeline_id, gl_sync) ;
930
- // Send the texture id and size to WR.
931
- sender. send ( result) . unwrap ( ) ;
932
- } ,
933
- DOMToTextureCommand :: Detach ( texture_id) => {
934
- if let Some ( ( pipeline_id, document_id) ) = self
935
- . dom_outputs
936
- . iter ( )
937
- . find ( |& ( _, v) | v. texture_id == texture_id)
938
- . map ( |( k, v) | ( * k, v. document_id ) )
939
- {
940
- let mut txn = webrender_api:: Transaction :: new ( ) ;
941
- txn. enable_frame_output ( pipeline_id, false ) ;
942
- self . webrender_api . send_transaction ( document_id, txn) ;
943
- self . dom_outputs . remove ( & pipeline_id) ;
944
- }
945
- } ,
946
- }
947
- }
948
-
949
- pub ( crate ) fn handle_dom_to_texture_lock (
950
- & mut self ,
951
- pipeline_id : webrender_api:: PipelineId ,
952
- gl_sync : usize ,
953
- ) -> Option < ( u32 , Size2D < i32 > ) > {
954
- let device = & self . device ;
955
- let contexts = & self . contexts ;
956
- let bound_context_id = & mut self . bound_context_id ;
957
- self . dom_outputs . get ( & pipeline_id) . and_then ( |dom_data| {
958
- let data = Self :: make_current_if_needed (
959
- device,
960
- dom_data. context_id ,
961
- contexts,
962
- bound_context_id,
963
- ) ;
964
- data. and_then ( |data| {
965
- // The next glWaitSync call is used to synchronize the two flows of
966
- // OpenGL commands (WR and WebGL) in order to avoid using semi-ready WR textures.
967
- // glWaitSync doesn't block WebGL CPU thread.
968
- data. gl
969
- . wait_sync ( gl_sync as gl:: GLsync , 0 , gl:: TIMEOUT_IGNORED ) ;
970
- Some ( ( dom_data. texture_id . get ( ) , dom_data. size ) )
971
- } )
972
- } )
973
- }
974
-
975
886
/// Gets a reference to a Context for a given WebGLContextId and makes it current if required.
976
887
fn make_current_if_needed < ' a > (
977
888
device : & Device ,
@@ -1106,14 +1017,6 @@ fn current_wr_texture_target(device: &Device) -> webrender_api::TextureTarget {
1106
1017
}
1107
1018
}
1108
1019
1109
- /// Data about the linked DOM<->WebGLTexture elements.
1110
- struct DOMToTextureData {
1111
- context_id : WebGLContextId ,
1112
- texture_id : WebGLTextureId ,
1113
- document_id : webrender_api:: DocumentId ,
1114
- size : Size2D < i32 > ,
1115
- }
1116
-
1117
1020
/// WebGL Commands Implementation
1118
1021
pub struct WebGLImpl ;
1119
1022
0 commit comments