diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 80976a68577..41debc4a83a 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -17,7 +17,7 @@ gleam = "0.2.8" ipc-channel = "0.5" log = "0.3.5" num-traits = "0.1.32" -offscreen_gl_context = "0.4" +offscreen_gl_context = "0.5.0" plugins = {path = "../plugins"} util = {path = "../util"} diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index 8c966d3f956..4f8a639c29c 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -23,4 +23,4 @@ serde_derive = "0.8" [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index cd6d0e31f82..1ba3aa39eb8 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -36,4 +36,4 @@ features = ["serde_derive"] [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index 53ed1b14ccf..1734ec27df8 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -25,7 +25,7 @@ layout_traits = {path = "../layout_traits"} log = "0.3.5" msg = {path = "../msg"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.4" +offscreen_gl_context = "0.5.0" plugins = {path = "../plugins"} profile_traits = {path = "../profile_traits"} rand = "0.3" @@ -39,7 +39,7 @@ util = {path = "../util"} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] [target.'cfg(not(target_os = "windows"))'.dependencies] gaol = {git = "https://github.com/servo/gaol"} diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index 66b87a4177b..c61b2072f15 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -45,7 +45,7 @@ xi-unicode = "0.0.1" [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] [target.'cfg(target_os = "macos")'.dependencies] byteorder = "0.5" @@ -61,4 +61,4 @@ servo-fontconfig = "0.2.1" simd = {git = "https://github.com/huonw/simd"} [target.'cfg(target_os = "windows")'.dependencies] -dwrote = {git = "https://github.com/vvuk/dwrote-rs"} +dwrote = "0.1.1" diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 8bb0bfc6d64..6443c4a6aa3 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -50,4 +50,4 @@ util = {path = "../util"} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs index 0dec6409a49..2a6bc72c7da 100644 --- a/components/layout/webrender_helpers.rs +++ b/components/layout/webrender_helpers.rs @@ -8,10 +8,10 @@ // completely converting layout to directly generate WebRender display lists, for example. use app_units::Au; -use euclid::{Matrix4D, Point2D, Rect, Size2D, TypedRect}; +use euclid::{Point2D, Rect, Size2D}; use gfx::display_list::{BorderRadii, BoxShadowClipMode, ClippingRegion}; use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, StackingContextType}; -use gfx_traits::{FragmentType, ScrollPolicy, StackingContextId, ScrollRootId}; +use gfx_traits::{FragmentType, ScrollPolicy, ScrollRootId}; use style::computed_values::{image_rendering, mix_blend_mode}; use style::computed_values::filter::{self, Filter}; use style::values::computed::BorderStyle; @@ -346,22 +346,14 @@ impl WebRenderDisplayItemConverter for DisplayItem { ScrollPolicy::FixedPosition => webrender_traits::ScrollPolicy::Fixed, }; - let scroll_layer_id = if stacking_context.id == StackingContextId::root() { - Some(frame_builder.next_scroll_layer_id(ScrollRootId::root())) - } else { - None - }; - let context = webrender_traits::StackingContext::new( - scroll_layer_id, webrender_scroll_policy, stacking_context.bounds.to_rectf(), stacking_context.overflow.to_rectf(), stacking_context.z_index, &stacking_context.transform, &stacking_context.perspective, - stacking_context.establishes_3d_context, stacking_context.blend_mode.to_blend_mode(), stacking_context.filters.to_filter_ops(), &mut frame_builder.auxiliary_lists_builder); @@ -370,22 +362,11 @@ impl WebRenderDisplayItemConverter for DisplayItem { } DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(), DisplayItem::PushScrollRoot(ref item) => { - let overflow = TypedRect::new(Point2D::zero(), item.scroll_root.size); - let context = webrender_traits::StackingContext::new( - Some(frame_builder.next_scroll_layer_id(item.scroll_root.id)), - webrender_traits::ScrollPolicy::Scrollable, - item.scroll_root.clip.to_rectf(), - overflow.to_rectf(), - 0, - &Matrix4D::identity(), - &Matrix4D::identity(), - true, - mix_blend_mode::T::normal.to_blend_mode(), - filter::T::new(Vec::new()).to_filter_ops(), - &mut frame_builder.auxiliary_lists_builder); - builder.push_stacking_context(context); + builder.push_scroll_layer(item.scroll_root.clip.to_rectf(), + item.scroll_root.size.to_sizef(), + frame_builder.next_scroll_layer_id(item.scroll_root.id)); } - DisplayItem::PopScrollRoot(_) => builder.pop_stacking_context(), + DisplayItem::PopScrollRoot(_) => builder.pop_scroll_layer(), } } } diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml index bdacae6d758..3f750cf70fa 100644 --- a/components/layout_thread/Cargo.toml +++ b/components/layout_thread/Cargo.toml @@ -41,4 +41,4 @@ util = {path = "../util"} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/layout_traits/Cargo.toml b/components/layout_traits/Cargo.toml index 7c773e587c0..204914af714 100644 --- a/components/layout_traits/Cargo.toml +++ b/components/layout_traits/Cargo.toml @@ -21,4 +21,4 @@ servo_url = {path = "../url"} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index 8d045a3e91f..e52b1132664 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -21,4 +21,4 @@ serde_derive = "0.8" [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index ca04ba2f3c2..758f9b3aa20 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -46,7 +46,7 @@ websocket = "0.17" [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] [target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies] tinyfiledialogs = {git = "https://github.com/jdm/tinyfiledialogs"} diff --git a/components/net/image_cache_thread.rs b/components/net/image_cache_thread.rs index 71c70a03b28..5976ec50885 100644 --- a/components/net/image_cache_thread.rs +++ b/components/net/image_cache_thread.rs @@ -323,11 +323,12 @@ fn get_placeholder_image(webrender_api: &webrender_traits::RenderApi) -> io::Res let format = convert_format(image.format); let mut bytes = Vec::new(); bytes.extend_from_slice(&*image.bytes); + let data = webrender_traits::ImageData::new(bytes); image.id = Some(webrender_api.add_image(image.width, image.height, None, format, - bytes)); + data)); Ok(Arc::new(image)) } @@ -482,11 +483,12 @@ impl ImageCache { let format = convert_format(image.format); let mut bytes = Vec::new(); bytes.extend_from_slice(&*image.bytes); + let data = webrender_traits::ImageData::new(bytes); image.id = Some(self.webrender_api.add_image(image.width, image.height, None, format, - bytes)); + data)); } LoadResult::PlaceholderLoaded(..) | LoadResult::None => {} } diff --git a/components/net_traits/Cargo.toml b/components/net_traits/Cargo.toml index b474723eba6..71cd286f863 100644 --- a/components/net_traits/Cargo.toml +++ b/components/net_traits/Cargo.toml @@ -33,4 +33,4 @@ cookie = {version = "0.2.5", features = ["serialize-rustc"]} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 0b41c70a620..57fd5626195 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -52,7 +52,7 @@ mime_guess = "1.8.0" msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" -offscreen_gl_context = "0.4" +offscreen_gl_context = "0.5.0" open = "1.1.1" parking_lot = "0.3" phf = "0.7.18" @@ -83,4 +83,4 @@ xml5ever = {version = "0.2", features = ["unstable"]} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["nightly", "serde_derive"] +features = ["nightly", "serde_derive", "ipc"] diff --git a/components/script/dom/webglbuffer.rs b/components/script/dom/webglbuffer.rs index af8f83d256d..6e19c00ae9f 100644 --- a/components/script/dom/webglbuffer.rs +++ b/components/script/dom/webglbuffer.rs @@ -9,8 +9,9 @@ use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; use dom::globalscope::GlobalScope; use dom::webglobject::WebGLObject; -use ipc_channel::ipc::{self, IpcSender}; +use ipc_channel::ipc::IpcSender; use std::cell::Cell; +use webrender_traits; use webrender_traits::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult}; #[dom_struct] @@ -41,7 +42,7 @@ impl WebGLBuffer { pub fn maybe_new(global: &GlobalScope, renderer: IpcSender) -> Option> { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); renderer.send(CanvasMsg::WebGL(WebGLCommand::CreateBuffer(sender))).unwrap(); let result = receiver.recv().unwrap(); diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 25026dac22d..643661d67d4 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -13,8 +13,9 @@ use dom::globalscope::GlobalScope; use dom::webglobject::WebGLObject; use dom::webglrenderbuffer::WebGLRenderbuffer; use dom::webgltexture::WebGLTexture; -use ipc_channel::ipc::{self, IpcSender}; +use ipc_channel::ipc::IpcSender; use std::cell::Cell; +use webrender_traits; use webrender_traits::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId, WebGLResult, WebGLError}; #[must_root] @@ -67,7 +68,7 @@ impl WebGLFramebuffer { pub fn maybe_new(global: &GlobalScope, renderer: IpcSender) -> Option> { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); renderer.send(CanvasMsg::WebGL(WebGLCommand::CreateFramebuffer(sender))).unwrap(); let result = receiver.recv().unwrap(); diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs index 98139081c3b..47807a8086e 100644 --- a/components/script/dom/webglprogram.rs +++ b/components/script/dom/webglprogram.rs @@ -14,8 +14,9 @@ use dom::webglactiveinfo::WebGLActiveInfo; use dom::webglobject::WebGLObject; use dom::webglrenderingcontext::MAX_UNIFORM_AND_ATTRIBUTE_LEN; use dom::webglshader::WebGLShader; -use ipc_channel::ipc::{self, IpcSender}; +use ipc_channel::ipc::IpcSender; use std::cell::Cell; +use webrender_traits; use webrender_traits::{WebGLCommand, WebGLError, WebGLParameter}; use webrender_traits::{WebGLProgramId, WebGLResult}; @@ -50,7 +51,7 @@ impl WebGLProgram { pub fn maybe_new(global: &GlobalScope, renderer: IpcSender) -> Option> { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); renderer.send(CanvasMsg::WebGL(WebGLCommand::CreateProgram(sender))).unwrap(); let result = receiver.recv().unwrap(); @@ -224,7 +225,7 @@ impl WebGLProgram { if self.is_deleted() { return Err(WebGLError::InvalidValue); } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer .send(CanvasMsg::WebGL(WebGLCommand::GetActiveUniform(self.id, index, sender))) .unwrap(); @@ -238,7 +239,7 @@ impl WebGLProgram { if self.is_deleted() { return Err(WebGLError::InvalidValue); } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer .send(CanvasMsg::WebGL(WebGLCommand::GetActiveAttrib(self.id, index, sender))) .unwrap(); @@ -265,7 +266,7 @@ impl WebGLProgram { return Ok(None); } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer .send(CanvasMsg::WebGL(WebGLCommand::GetAttribLocation(self.id, String::from(name), sender))) .unwrap(); @@ -286,7 +287,7 @@ impl WebGLProgram { return Ok(None); } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer .send(CanvasMsg::WebGL(WebGLCommand::GetUniformLocation(self.id, String::from(name), sender))) .unwrap(); @@ -307,14 +308,14 @@ impl WebGLProgram { return Ok("One or more shaders failed to compile".to_string()); } } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer.send(CanvasMsg::WebGL(WebGLCommand::GetProgramInfoLog(self.id, sender))).unwrap(); Ok(receiver.recv().unwrap()) } /// glGetProgramParameter pub fn parameter(&self, param_id: u32) -> WebGLResult { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer.send(CanvasMsg::WebGL(WebGLCommand::GetProgramParameter(self.id, param_id, sender))).unwrap(); receiver.recv().unwrap() } diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs index 186b2aedf5a..d74d045363a 100644 --- a/components/script/dom/webglrenderbuffer.rs +++ b/components/script/dom/webglrenderbuffer.rs @@ -10,8 +10,9 @@ use dom::bindings::js::Root; use dom::bindings::reflector::reflect_dom_object; use dom::globalscope::GlobalScope; use dom::webglobject::WebGLObject; -use ipc_channel::ipc::{self, IpcSender}; +use ipc_channel::ipc::IpcSender; use std::cell::Cell; +use webrender_traits; use webrender_traits::{WebGLCommand, WebGLRenderbufferId, WebGLResult, WebGLError}; #[dom_struct] @@ -43,7 +44,7 @@ impl WebGLRenderbuffer { pub fn maybe_new(global: &GlobalScope, renderer: IpcSender) -> Option> { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); renderer.send(CanvasMsg::WebGL(WebGLCommand::CreateRenderbuffer(sender))).unwrap(); let result = receiver.recv().unwrap(); diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 5428fc794fa..f43576fba63 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -44,6 +44,7 @@ use net_traits::image_cache_thread::ImageResponse; use offscreen_gl_context::{GLContextAttributes, GLLimits}; use script_traits::ScriptMsg as ConstellationMsg; use std::cell::Cell; +use webrender_traits; use webrender_traits::{WebGLCommand, WebGLError, WebGLFramebufferBindingRequest, WebGLParameter}; use webrender_traits::WebGLError::*; @@ -597,7 +598,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11 fn Finish(&self) { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::Finish(sender))) .unwrap(); @@ -606,7 +607,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1 fn DrawingBufferWidth(&self) -> i32 { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::DrawingBufferWidth(sender))) .unwrap(); @@ -615,7 +616,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1 fn DrawingBufferHeight(&self) -> i32 { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::DrawingBufferHeight(sender))) .unwrap(); @@ -625,7 +626,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { #[allow(unsafe_code)] // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 unsafe fn GetBufferParameter(&self, _cx: *mut JSContext, target: u32, parameter: u32) -> JSVal { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::GetBufferParameter(target, parameter, sender))) .unwrap(); @@ -681,7 +682,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { _ => {} } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::GetParameter(parameter, sender))) .unwrap(); @@ -719,7 +720,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2 fn GetContextAttributes(&self) -> Option { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); // If the send does not succeed, assume context lost if let Err(_) = self.ipc_renderer @@ -1626,7 +1627,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { return result.get() } - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer.send(CanvasMsg::WebGL(WebGLCommand::GetVertexAttrib(index, pname, sender))).unwrap(); match handle_potential_webgl_error!(self, receiver.recv().unwrap(), WebGLParameter::Invalid) { @@ -1671,7 +1672,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3 fn IsEnabled(&self, cap: u32) -> bool { if self.validate_feature_enum(cap) { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::IsEnabled(cap, sender))) .unwrap(); @@ -1873,7 +1874,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { _ => return Ok(self.webgl_error(InvalidOperation)), }; - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.ipc_renderer .send(CanvasMsg::WebGL(WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, sender))) .unwrap(); diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs index 82d1b88a7da..93da1ca0bc5 100644 --- a/components/script/dom/webglshader.rs +++ b/components/script/dom/webglshader.rs @@ -12,9 +12,10 @@ use dom::bindings::reflector::reflect_dom_object; use dom::bindings::str::DOMString; use dom::globalscope::GlobalScope; use dom::webglobject::WebGLObject; -use ipc_channel::ipc::{self, IpcSender}; +use ipc_channel::ipc::IpcSender; use std::cell::Cell; use std::sync::{ONCE_INIT, Once}; +use webrender_traits; use webrender_traits::{WebGLCommand, WebGLParameter, WebGLResult, WebGLShaderId}; #[derive(Clone, Copy, PartialEq, Debug, JSTraceable, HeapSizeOf)] @@ -68,7 +69,7 @@ impl WebGLShader { pub fn maybe_new(global: &GlobalScope, renderer: IpcSender, shader_type: u32) -> Option> { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); renderer.send(CanvasMsg::WebGL(WebGLCommand::CreateShader(shader_type, sender))).unwrap(); let result = receiver.recv().unwrap(); @@ -165,7 +166,7 @@ impl WebGLShader { /// glGetParameter pub fn parameter(&self, param_id: u32) -> WebGLResult { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); self.renderer.send(CanvasMsg::WebGL(WebGLCommand::GetShaderParameter(self.id, param_id, sender))).unwrap(); receiver.recv().unwrap() } diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 3ba8eefca85..26cf14f7972 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -12,9 +12,10 @@ use dom::bindings::reflector::reflect_dom_object; use dom::globalscope::GlobalScope; use dom::webgl_validations::types::{TexImageTarget, TexFormat, TexDataType}; use dom::webglobject::WebGLObject; -use ipc_channel::ipc::{self, IpcSender}; +use ipc_channel::ipc::IpcSender; use std::cell::Cell; use std::cmp; +use webrender_traits; use webrender_traits::{WebGLCommand, WebGLError, WebGLResult, WebGLTextureId}; pub enum TexParameterValue { @@ -62,7 +63,7 @@ impl WebGLTexture { pub fn maybe_new(global: &GlobalScope, renderer: IpcSender) -> Option> { - let (sender, receiver) = ipc::channel().unwrap(); + let (sender, receiver) = webrender_traits::channel::msg_channel().unwrap(); renderer.send(CanvasMsg::WebGL(WebGLCommand::CreateTexture(sender))).unwrap(); let result = receiver.recv().unwrap(); diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 74df7f4ba4e..7856e67307c 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -25,7 +25,7 @@ ipc-channel = "0.5" libc = "0.2" msg = {path = "../msg"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.4" +offscreen_gl_context = "0.5.0" plugins = {path = "../plugins"} profile_traits = {path = "../profile_traits"} rustc-serialize = "0.3.4" diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index def52e5ce82..c2de4d5e798 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -70,7 +70,7 @@ features = ["serde_derive"] [dependencies.webrender_traits] git = "https://github.com/servo/webrender" default_features = false -features = ["serde_derive"] +features = ["serde_derive", "ipc"] [target.'cfg(not(target_os = "android"))'.dependencies] sig = "0.1" diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 32c9103201f..3cc549f102f 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -161,7 +161,7 @@ impl Browser where Window: WindowMethods + 'static { webrender::Renderer::new(webrender::RendererOptions { device_pixel_ratio: device_pixel_ratio, - resource_path: resource_path, + resource_override_path: Some(resource_path), enable_aa: opts.enable_text_antialiasing, enable_msaa: opts.use_msaa, enable_profiler: opts.webrender_stats, diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 31ff9f529b5..f617137f6f1 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -90,7 +90,7 @@ dependencies = [ "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", + "freetype 0.1.2 (git+https://github.com/servo/rust-freetype)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -245,10 +245,10 @@ dependencies = [ "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -264,7 +264,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -336,8 +336,8 @@ dependencies = [ "style_traits 0.0.1", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender 0.9.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender 0.10.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -360,7 +360,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -370,7 +370,7 @@ dependencies = [ "servo_url 0.0.1", "style_traits 0.0.1", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -559,20 +559,10 @@ dependencies = [ ] [[package]] -name = "dwrite-sys" -version = "0.2.0" +name = "dwrote" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dwrote" -version = "0.1.0" -source = "git+https://github.com/vvuk/dwrote-rs#7112cf6e4bb9f645217dacb5d7470178da13a544" -dependencies = [ - "dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -703,13 +693,21 @@ dependencies = [ [[package]] name = "freetype" -version = "0.1.1" -source = "git+https://github.com/servo/rust-freetype#7a753764468af57b30f0eda9441f17d635cb62cf" +version = "0.1.2" +source = "git+https://github.com/servo/rust-freetype#66a466247490cbf27410ffd652454a417f79f33e" dependencies = [ "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "freetype" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fs2" version = "0.2.5" @@ -768,11 +766,11 @@ dependencies = [ "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", + "dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fontsan 0.3.2 (git+https://github.com/servo/fontsan)", - "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", + "freetype 0.1.2 (git+https://github.com/servo/rust-freetype)", "gfx_traits 0.0.1", "harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -799,7 +797,7 @@ dependencies = [ "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1170,7 +1168,7 @@ dependencies = [ "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1204,7 +1202,7 @@ dependencies = [ "servo_url 0.0.1", "style 0.0.1", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1218,7 +1216,7 @@ dependencies = [ "profile_traits 0.0.1", "script_traits 0.0.1", "servo_url 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1308,8 +1306,8 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_server 0.0.1", - "webrender 0.9.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender 0.10.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1458,7 +1456,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1497,7 +1495,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1535,7 +1533,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1633,7 +1631,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "offscreen_gl_context" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2004,7 +2002,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2030,7 +2028,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2082,7 +2080,7 @@ dependencies = [ "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2786,8 +2784,8 @@ dependencies = [ [[package]] name = "webrender" -version = "0.9.0" -source = "git+https://github.com/servo/webrender#087516eab125a16ce150ade696b9de7fcef4980e" +version = "0.10.0" +source = "git+https://github.com/servo/webrender#a237f9b7c261e253fe0bcbd00a38abf0f8f5dfbd" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2796,35 +2794,34 @@ dependencies = [ "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", + "dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", + "freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] name = "webrender_traits" -version = "0.9.0" -source = "git+https://github.com/servo/webrender#087516eab125a16ce150ade696b9de7fcef4980e" +version = "0.10.0" +source = "git+https://github.com/servo/webrender#a237f9b7c261e253fe0bcbd00a38abf0f8f5dfbd" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", + "dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2975,8 +2972,7 @@ dependencies = [ "checksum dlib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd015f00d33d7e4ff66f1589fb824ccf3ccb10209b66c7b756f26ba9aa90215" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" "checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe" -"checksum dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7918280f33862bc8542212d74f2149b1a87ab402fd15f4ce9a1c56582958d6e" -"checksum dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)" = "" +"checksum dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8e46f81d58183d91a9d2dbd020538d8aef38e7d291aeae336d7f3ac15f941c0" "checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" "checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" "checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" @@ -2991,7 +2987,8 @@ dependencies = [ "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" "checksum fontsan 0.3.2 (git+https://github.com/servo/fontsan)" = "" -"checksum freetype 0.1.1 (git+https://github.com/servo/rust-freetype)" = "" +"checksum freetype 0.1.2 (git+https://github.com/servo/rust-freetype)" = "" +"checksum freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a89563eaf185762cf495c56cb16277549d2aaa7b1240d93338e8429fa33acd1" "checksum fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bcd414e5a1a979b931bb92f41b7a54106d3f6d2e6c253e9ce943b7cd468251ef" "checksum futf 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7a9689380a2553b51c564b3d9178075c68ebd0b397972c783acfd28b46c28ad" "checksum gaol 0.0.1 (git+https://github.com/servo/gaol)" = "" @@ -3061,7 +3058,7 @@ dependencies = [ "checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad" "checksum objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9311aa5acd7bee14476afa0f0557f564e9d0d61218a8b833d9b1f871fa5fba" "checksum odds 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "f3701cfdec1676e319ad37ff96c31de39df8c92006032976153366f52693bf40" -"checksum offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "000307b66855b01357765d9ac8d32a66aa09f3dcc3a7ccb272f74c76df475c9c" +"checksum offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9da33a538d9c8fc81102e5d5c1ed844568b400d86c22413550a9b8474be62ba3" "checksum ogg 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "426d8dc59cdd206be1925461087350385c0a02f291d87625829c6d08e72b457b" "checksum ogg_metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e755cc735fa6faa709cb23048433d9201d6caa85fa96215386ccdd5e9b40ad01" "checksum open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c228597177bc4a6876e278f7c7948ac033bfcb4d163ccdd5a009557c8fe5fa1e" @@ -3158,8 +3155,8 @@ dependencies = [ "checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a" "checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c" "checksum webdriver 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d43d9121a4d0313abca5fb621f094791300176cac493ce74ad2cc188bddac29" -"checksum webrender 0.9.0 (git+https://github.com/servo/webrender)" = "" -"checksum webrender_traits 0.9.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender 0.10.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender_traits 0.10.0 (git+https://github.com/servo/webrender)" = "" "checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/ports/servo/Cargo.lock b/ports/servo/Cargo.lock index af52dad8c24..3c830630cb2 100644 --- a/ports/servo/Cargo.lock +++ b/ports/servo/Cargo.lock @@ -89,7 +89,7 @@ dependencies = [ "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", + "freetype 0.1.2 (git+https://github.com/servo/rust-freetype)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -244,10 +244,10 @@ dependencies = [ "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -263,7 +263,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -365,8 +365,8 @@ dependencies = [ "style_traits 0.0.1", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender 0.9.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender 0.10.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -389,7 +389,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -399,7 +399,7 @@ dependencies = [ "servo_url 0.0.1", "style_traits 0.0.1", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -588,20 +588,10 @@ dependencies = [ ] [[package]] -name = "dwrite-sys" -version = "0.2.0" +name = "dwrote" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dwrote" -version = "0.1.0" -source = "git+https://github.com/vvuk/dwrote-rs#7112cf6e4bb9f645217dacb5d7470178da13a544" -dependencies = [ - "dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -773,13 +763,21 @@ dependencies = [ [[package]] name = "freetype" -version = "0.1.1" -source = "git+https://github.com/servo/rust-freetype#7a753764468af57b30f0eda9441f17d635cb62cf" +version = "0.1.2" +source = "git+https://github.com/servo/rust-freetype#66a466247490cbf27410ffd652454a417f79f33e" dependencies = [ "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "freetype" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fs2" version = "0.2.5" @@ -838,11 +836,11 @@ dependencies = [ "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", + "dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fontsan 0.3.2 (git+https://github.com/servo/fontsan)", - "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", + "freetype 0.1.2 (git+https://github.com/servo/rust-freetype)", "gfx_traits 0.0.1", "harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -869,7 +867,7 @@ dependencies = [ "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1249,7 +1247,7 @@ dependencies = [ "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1290,7 +1288,7 @@ dependencies = [ "servo_url 0.0.1", "style 0.0.1", "util 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1304,7 +1302,7 @@ dependencies = [ "profile_traits 0.0.1", "script_traits 0.0.1", "servo_url 0.0.1", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1395,8 +1393,8 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_server 0.0.1", - "webrender 0.9.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender 0.10.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1545,7 +1543,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1584,7 +1582,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1645,7 +1643,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1755,7 +1753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "offscreen_gl_context" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2154,7 +2152,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2180,7 +2178,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2242,7 +2240,7 @@ dependencies = [ "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2987,8 +2985,8 @@ dependencies = [ [[package]] name = "webrender" -version = "0.9.0" -source = "git+https://github.com/servo/webrender#087516eab125a16ce150ade696b9de7fcef4980e" +version = "0.10.0" +source = "git+https://github.com/servo/webrender#a237f9b7c261e253fe0bcbd00a38abf0f8f5dfbd" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2997,35 +2995,34 @@ dependencies = [ "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", + "dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", + "freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.9.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.10.0 (git+https://github.com/servo/webrender)", ] [[package]] name = "webrender_traits" -version = "0.9.0" -source = "git+https://github.com/servo/webrender#087516eab125a16ce150ade696b9de7fcef4980e" +version = "0.10.0" +source = "git+https://github.com/servo/webrender#a237f9b7c261e253fe0bcbd00a38abf0f8f5dfbd" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", + "dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3178,8 +3175,7 @@ dependencies = [ "checksum dlib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd015f00d33d7e4ff66f1589fb824ccf3ccb10209b66c7b756f26ba9aa90215" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" "checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe" -"checksum dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7918280f33862bc8542212d74f2149b1a87ab402fd15f4ce9a1c56582958d6e" -"checksum dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)" = "" +"checksum dwrote 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8e46f81d58183d91a9d2dbd020538d8aef38e7d291aeae336d7f3ac15f941c0" "checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" "checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" "checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" @@ -3199,7 +3195,8 @@ dependencies = [ "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" "checksum fontsan 0.3.2 (git+https://github.com/servo/fontsan)" = "" -"checksum freetype 0.1.1 (git+https://github.com/servo/rust-freetype)" = "" +"checksum freetype 0.1.2 (git+https://github.com/servo/rust-freetype)" = "" +"checksum freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a89563eaf185762cf495c56cb16277549d2aaa7b1240d93338e8429fa33acd1" "checksum fs2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bcd414e5a1a979b931bb92f41b7a54106d3f6d2e6c253e9ce943b7cd468251ef" "checksum futf 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7a9689380a2553b51c564b3d9178075c68ebd0b397972c783acfd28b46c28ad" "checksum gaol 0.0.1 (git+https://github.com/servo/gaol)" = "" @@ -3270,7 +3267,7 @@ dependencies = [ "checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad" "checksum objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9311aa5acd7bee14476afa0f0557f564e9d0d61218a8b833d9b1f871fa5fba" "checksum odds 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "f3701cfdec1676e319ad37ff96c31de39df8c92006032976153366f52693bf40" -"checksum offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "000307b66855b01357765d9ac8d32a66aa09f3dcc3a7ccb272f74c76df475c9c" +"checksum offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9da33a538d9c8fc81102e5d5c1ed844568b400d86c22413550a9b8474be62ba3" "checksum ogg 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "426d8dc59cdd206be1925461087350385c0a02f291d87625829c6d08e72b457b" "checksum ogg_metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e755cc735fa6faa709cb23048433d9201d6caa85fa96215386ccdd5e9b40ad01" "checksum open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c228597177bc4a6876e278f7c7948ac033bfcb4d163ccdd5a009557c8fe5fa1e" @@ -3370,8 +3367,8 @@ dependencies = [ "checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a" "checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c" "checksum webdriver 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d43d9121a4d0313abca5fb621f094791300176cac493ce74ad2cc188bddac29" -"checksum webrender 0.9.0 (git+https://github.com/servo/webrender)" = "" -"checksum webrender_traits 0.9.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender 0.10.0 (git+https://github.com/servo/webrender)" = "" +"checksum webrender_traits 0.10.0 (git+https://github.com/servo/webrender)" = "" "checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/resources/shaders/clip_shared.glsl b/resources/shaders/clip_shared.glsl deleted file mode 100644 index 62e51c3bbf1..00000000000 --- a/resources/shaders/clip_shared.glsl +++ /dev/null @@ -1,65 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -flat varying vec4 vClipRect; -flat varying vec4 vClipRadius; -flat varying vec4 vClipMaskUvRect; -flat varying vec4 vClipMaskLocalRect; - -#ifdef WR_VERTEX_SHADER -void write_clip(ClipData clip) { - vClipRect = vec4(clip.rect.rect.xy, clip.rect.rect.xy + clip.rect.rect.zw); - vClipRadius = vec4(clip.top_left.outer_inner_radius.x, - clip.top_right.outer_inner_radius.x, - clip.bottom_right.outer_inner_radius.x, - clip.bottom_left.outer_inner_radius.x); - //TODO: interpolate the final mask UV - vec2 texture_size = textureSize(sMask, 0); - vClipMaskUvRect = clip.mask_data.uv_rect / texture_size.xyxy; - vClipMaskLocalRect = clip.mask_data.local_rect; //TODO: transform -} -#endif - -#ifdef WR_FRAGMENT_SHADER -float do_clip(vec2 pos) { - vec2 ref_tl = vClipRect.xy + vec2( vClipRadius.x, vClipRadius.x); - vec2 ref_tr = vClipRect.zy + vec2(-vClipRadius.y, vClipRadius.y); - vec2 ref_br = vClipRect.zw + vec2(-vClipRadius.z, -vClipRadius.z); - vec2 ref_bl = vClipRect.xw + vec2( vClipRadius.w, -vClipRadius.w); - - float d_tl = distance(pos, ref_tl); - float d_tr = distance(pos, ref_tr); - float d_br = distance(pos, ref_br); - float d_bl = distance(pos, ref_bl); - - float pixels_per_fragment = length(fwidth(pos.xy)); - float nudge = 0.5 * pixels_per_fragment; - vec4 distances = vec4(d_tl, d_tr, d_br, d_bl) - vClipRadius + nudge; - - bvec4 is_out = bvec4(pos.x < ref_tl.x && pos.y < ref_tl.y, - pos.x > ref_tr.x && pos.y < ref_tr.y, - pos.x > ref_br.x && pos.y > ref_br.y, - pos.x < ref_bl.x && pos.y > ref_bl.y); - - float distance_from_border = dot(vec4(is_out), - max(vec4(0.0, 0.0, 0.0, 0.0), distances)); - - // Move the distance back into pixels. - distance_from_border /= pixels_per_fragment; - // Apply a more gradual fade out to transparent. - //distance_from_border -= 0.5; - - float border_alpha = 1.0 - smoothstep(0.0, 1.0, distance_from_border); - - bool repeat_mask = false; //TODO - vec2 vMaskUv = (pos - vClipMaskLocalRect.xy) / vClipMaskLocalRect.zw; - vec2 clamped_mask_uv = repeat_mask ? fract(vMaskUv) : - clamp(vMaskUv, vec2(0.0, 0.0), vec2(1.0, 1.0)); - vec2 source_uv = clamped_mask_uv * vClipMaskUvRect.zw + vClipMaskUvRect.xy; - float mask_alpha = texture(sMask, source_uv).r; //careful: texture has type A8 - - return border_alpha * mask_alpha; -} -#endif diff --git a/resources/shaders/cs_blur.fs.glsl b/resources/shaders/cs_blur.fs.glsl deleted file mode 100644 index 4217b780f2e..00000000000 --- a/resources/shaders/cs_blur.fs.glsl +++ /dev/null @@ -1,40 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// TODO(gw): Write a fast path blur that handles smaller blur radii -// with a offset / weight uniform table and a constant -// loop iteration count! - -// TODO(gw): Make use of the bilinear sampling trick to reduce -// the number of texture fetches needed for a gaussian blur. - -float gauss(float x, float sigma) { - return (1.0 / sqrt(6.283185307179586 * sigma * sigma)) * exp(-(x * x) / (2.0 * sigma * sigma)); -} - -void main(void) { - vec4 sample = texture(sCache, vUv); - vec4 color = vec4(sample.rgb * sample.a, sample.a) * gauss(0.0, vSigma); - - for (int i=1 ; i < vBlurRadius ; ++i) { - vec2 offset = vec2(float(i)) * vOffsetScale; - - vec2 st0 = clamp(vUv.xy + offset, vUvRect.xy, vUvRect.zw); - vec4 color0 = texture(sCache, vec3(st0, vUv.z)); - - vec2 st1 = clamp(vUv.xy - offset, vUvRect.xy, vUvRect.zw); - vec4 color1 = texture(sCache, vec3(st1, vUv.z)); - - // Alpha must be premultiplied in order to properly blur the alpha channel. - float weight = gauss(float(i), vSigma); - color += vec4(color0.rgb * color0.a, color0.a) * weight; - color += vec4(color1.rgb * color1.a, color1.a) * weight; - } - - // Unpremultiply the alpha. - color.rgb /= color.a; - - oFragColor = color; -} diff --git a/resources/shaders/cs_blur.glsl b/resources/shaders/cs_blur.glsl deleted file mode 100644 index 110b748b7dc..00000000000 --- a/resources/shaders/cs_blur.glsl +++ /dev/null @@ -1,10 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec3 vUv; -flat varying vec4 vUvRect; -flat varying vec2 vOffsetScale; -flat varying float vSigma; -flat varying int vBlurRadius; diff --git a/resources/shaders/cs_blur.vs.glsl b/resources/shaders/cs_blur.vs.glsl deleted file mode 100644 index 1e89b60e5e5..00000000000 --- a/resources/shaders/cs_blur.vs.glsl +++ /dev/null @@ -1,45 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// Applies a separable gaussian blur in one direction, as specified -// by the dir field in the blur command. - -#define DIR_HORIZONTAL 0 -#define DIR_VERTICAL 1 - -void main(void) { - BlurCommand cmd = fetch_blur(gl_InstanceID); - RenderTaskData task = fetch_render_task(cmd.task_id); - RenderTaskData src_task = fetch_render_task(cmd.src_task_id); - - vec4 local_rect = task.data0; - - vec2 pos = mix(local_rect.xy, - local_rect.xy + local_rect.zw, - aPosition.xy); - - vec2 texture_size = textureSize(sCache, 0).xy; - vUv.z = src_task.data1.x; - vBlurRadius = int(task.data1.y); - vSigma = task.data1.y * 0.5; - - switch (cmd.dir) { - case DIR_HORIZONTAL: - vOffsetScale = vec2(1.0 / texture_size.x, 0.0); - break; - case DIR_VERTICAL: - vOffsetScale = vec2(0.0, 1.0 / texture_size.y); - break; - } - - vUvRect = vec4(src_task.data0.xy, src_task.data0.xy + src_task.data0.zw); - vUvRect /= texture_size.xyxy; - - vec2 uv0 = src_task.data0.xy / texture_size; - vec2 uv1 = (src_task.data0.xy + src_task.data0.zw) / texture_size; - vUv.xy = mix(uv0, uv1, aPosition.xy); - - gl_Position = uTransform * vec4(pos, 0.0, 1.0); -} diff --git a/resources/shaders/cs_box_shadow.fs.glsl b/resources/shaders/cs_box_shadow.fs.glsl deleted file mode 100644 index 3243dc6d628..00000000000 --- a/resources/shaders/cs_box_shadow.fs.glsl +++ /dev/null @@ -1,148 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// See http://asciimath.org to render the equations here. - -// The Gaussian function used for blurring: -// -// G_sigma(x) = 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2)) -float gauss(float x, float sigma) { - float sigmaPow2 = sigma * sigma; - return 1.0 / sqrt(6.283185307179586 * sigmaPow2) * exp(-(x * x) / (2.0 * sigmaPow2)); -} - -// An approximation of the error function, which is related to the integral of the Gaussian -// function: -// -// "erf"(x) = 2/sqrt(pi) int_0^x e^(-t^2) dt -// ~~ 1 - 1 / (1 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4)^4 -// -// where: -// -// a_1 = 0.278393, a_2 = 0.230389, a_3 = 0.000972, a_4 = 0.078108 -// -// This approximation is accurate to `5 xx 10^-4`, more than accurate enough for our purposes. -// -// See: https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions -float erf(float x) { - bool negative = x < 0.0; - if (negative) - x = -x; - float x2 = x * x; - float x3 = x2 * x; - float x4 = x2 * x2; - float denom = 1.0 + 0.278393 * x + 0.230389 * x2 + 0.000972 * x3 + 0.078108 * x4; - float result = 1.0 - 1.0 / (denom * denom * denom * denom); - return negative ? -result : result; -} - -// A useful helper for calculating integrals of the Gaussian function via the error function: -// -// "erf"_sigma(x) = 2 int 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2)) dx -// = "erf"(x/(sigma sqrt(2))) -float erfSigma(float x, float sigma) { - return erf(x / (sigma * 1.4142135623730951)); -} - -// Returns the blurred color value from the box itself (not counting any rounded corners). `p_0` is -// the vector distance to the top left corner of the box; `p_1` is the vector distance to its -// bottom right corner. -// -// "colorFromRect"_sigma(p_0, p_1) -// = int_{p_{0_y}}^{p_{1_y}} int_{p_{1_x}}^{p_{0_x}} G_sigma(y) G_sigma(x) dx dy -// = 1/4 ("erf"_sigma(p_{1_x}) - "erf"_sigma(p_{0_x})) -// ("erf"_sigma(p_{1_y}) - "erf"_sigma(p_{0_y})) -float colorFromRect(vec2 p0, vec2 p1, float sigma) { - return (erfSigma(p1.x, sigma) - erfSigma(p0.x, sigma)) * - (erfSigma(p1.y, sigma) - erfSigma(p0.y, sigma)) / 4.0; -} - -// Returns the `x` coordinate on the ellipse with the given radii for the given `y` coordinate: -// -// "ellipsePoint"(y, y_0, a, b) = a sqrt(1 - ((y - y_0) / b)^2) -float ellipsePoint(float y, float y0, vec2 radii) { - float bStep = (y - y0) / radii.y; - return radii.x * sqrt(1.0 - bStep * bStep); -} - -// A helper function to compute the value that needs to be subtracted to accommodate the border -// corners. -// -// "colorCutout"_sigma(x_{0_l}, x_{0_r}, y_0, y_{min}, y_{max}, a, b) -// = int_{y_{min}}^{y_{max}} -// int_{x_{0_r} + "ellipsePoint"(y, y_0, a, b)}^{x_{0_r} + a} G_sigma(y) G_sigma(x) dx -// + int_{x_{0_l} - a}^{x_{0_l} - "ellipsePoint"(y, y_0, a, b)} G_sigma(y) G_sigma(x) -// dx dy -// = int_{y_{min}}^{y_{max}} 1/2 G_sigma(y) -// ("erf"_sigma(x_{0_r} + a) - "erf"_sigma(x_{0_r} + "ellipsePoint"(y, y_0, a, b)) + -// "erf"_sigma(x_{0_l} - "ellipsePoint"(y, y_0, a, b)) - "erf"_sigma(x_{0_l} - a)) -// -// with the outer integral evaluated numerically. -float colorCutoutGeneral(float x0l, - float x0r, - float y0, - float yMin, - float yMax, - vec2 radii, - float sigma) { - float sum = 0.0; - for (float y = yMin; y <= yMax; y += 1.0) { - float xEllipsePoint = ellipsePoint(y, y0, radii); - sum += gauss(y, sigma) * - (erfSigma(x0r + radii.x, sigma) - erfSigma(x0r + xEllipsePoint, sigma) + - erfSigma(x0l - xEllipsePoint, sigma) - erfSigma(x0l - radii.x, sigma)); - } - return sum / 2.0; -} - -// The value that needs to be subtracted to accommodate the top border corners. -float colorCutoutTop(float x0l, float x0r, float y0, vec2 radii, float sigma) { - return colorCutoutGeneral(x0l, x0r, y0, y0, y0 + radii.y, radii, sigma); -} - -// The value that needs to be subtracted to accommodate the bottom border corners. -float colorCutoutBottom(float x0l, float x0r, float y0, vec2 radii, float sigma) { - return colorCutoutGeneral(x0l, x0r, y0, y0 - radii.y, y0, radii, sigma); -} - -// The blurred color value for the point at `pos` with the top left corner of the box at -// `p_{0_"rect"}` and the bottom right corner of the box at `p_{1_"rect"}`. -float color(vec2 pos, vec2 p0Rect, vec2 p1Rect, vec2 radii, float sigma) { - // Compute the vector distances `p_0` and `p_1`. - vec2 p0 = p0Rect - pos, p1 = p1Rect - pos; - - // Compute the basic color `"colorFromRect"_sigma(p_0, p_1)`. This is all we have to do if - // the box is unrounded. - float cRect = colorFromRect(p0, p1, sigma); - if (radii.x == 0.0 || radii.y == 0.0) - return cRect; - - // Compute the inner corners of the box, taking border radii into account: `x_{0_l}`, - // `y_{0_t}`, `x_{0_r}`, and `y_{0_b}`. - float x0l = p0.x + radii.x; - float y0t = p1.y - radii.y; - float x0r = p1.x - radii.x; - float y0b = p0.y + radii.y; - - // Compute the final color: - // - // "colorFromRect"_sigma(p_0, p_1) - - // ("colorCutoutTop"_sigma(x_{0_l}, x_{0_r}, y_{0_t}, a, b) + - // "colorCutoutBottom"_sigma(x_{0_l}, x_{0_r}, y_{0_b}, a, b)) - float cCutoutTop = colorCutoutTop(x0l, x0r, y0t, radii, sigma); - float cCutoutBottom = colorCutoutBottom(x0l, x0r, y0b, radii, sigma); - return cRect - (cCutoutTop + cCutoutBottom); -} - -void main(void) { - vec2 pos = vPos.xy; - vec2 p0Rect = vBoxShadowRect.xy, p1Rect = vBoxShadowRect.zw; - vec2 radii = vBorderRadii.xy; - float sigma = vBlurRadius / 2.0; - float value = color(pos, p0Rect, p1Rect, radii, sigma); - - value = max(value, 0.0); - oFragColor = vec4(1.0, 1.0, 1.0, vInverted == 1.0 ? 1.0 - value : value); -} diff --git a/resources/shaders/cs_box_shadow.glsl b/resources/shaders/cs_box_shadow.glsl deleted file mode 100644 index 9e5dd036c54..00000000000 --- a/resources/shaders/cs_box_shadow.glsl +++ /dev/null @@ -1,10 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec2 vPos; -flat varying vec2 vBorderRadii; -flat varying float vBlurRadius; -flat varying vec4 vBoxShadowRect; -flat varying float vInverted; diff --git a/resources/shaders/cs_box_shadow.vs.glsl b/resources/shaders/cs_box_shadow.vs.glsl deleted file mode 100644 index fce6e53af1d..00000000000 --- a/resources/shaders/cs_box_shadow.vs.glsl +++ /dev/null @@ -1,31 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - CachePrimitiveInstance cpi = fetch_cache_instance(gl_InstanceID); - RenderTaskData task = fetch_render_task(cpi.render_task_index); - BoxShadow bs = fetch_boxshadow(cpi.specific_prim_index); - - vec2 p0 = task.data0.xy; - vec2 p1 = p0 + task.data0.zw; - - vec2 pos = mix(p0, p1, aPosition.xy); - - vBorderRadii = bs.border_radius_edge_size_blur_radius_inverted.xx; - vBlurRadius = bs.border_radius_edge_size_blur_radius_inverted.z; - vInverted = bs.border_radius_edge_size_blur_radius_inverted.w; - vBoxShadowRect = vec4(bs.bs_rect.xy, bs.bs_rect.xy + bs.bs_rect.zw); - - // The fragment shader expects logical units, beginning at where the - // blur radius begins. - // The first path of the equation gets the virtual position in - // logical pixels within the patch rectangle (accounting for - // bilinear offset). Then we add the start position of the - // box shadow rect and subtract the blur radius to get the - // virtual coordinates that the FS expects. - vPos = (pos - 1.0 - p0) / uDevicePixelRatio + bs.bs_rect.xy - vec2(2.0 * vBlurRadius); - - gl_Position = uTransform * vec4(pos, 0.0, 1.0); -} diff --git a/resources/shaders/cs_text_run.fs.glsl b/resources/shaders/cs_text_run.fs.glsl deleted file mode 100644 index 8e9b40db247..00000000000 --- a/resources/shaders/cs_text_run.fs.glsl +++ /dev/null @@ -1,9 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - float a = texture(sColor0, vUv).a; - oFragColor = vec4(vColor.rgb, vColor.a * a); -} diff --git a/resources/shaders/cs_text_run.glsl b/resources/shaders/cs_text_run.glsl deleted file mode 100644 index 39ed226b264..00000000000 --- a/resources/shaders/cs_text_run.glsl +++ /dev/null @@ -1,7 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec2 vUv; -flat varying vec4 vColor; diff --git a/resources/shaders/cs_text_run.vs.glsl b/resources/shaders/cs_text_run.vs.glsl deleted file mode 100644 index 3ac5314bce3..00000000000 --- a/resources/shaders/cs_text_run.vs.glsl +++ /dev/null @@ -1,35 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// Draw a text run to a cache target. These are always -// drawn un-transformed. These are used for effects such -// as text-shadow. - -void main(void) { - CachePrimitiveInstance cpi = fetch_cache_instance(gl_InstanceID); - RenderTaskData task = fetch_render_task(cpi.render_task_index); - TextRun text = fetch_text_run(cpi.specific_prim_index); - Glyph glyph = fetch_glyph(cpi.sub_index); - PrimitiveGeometry pg = fetch_prim_geometry(cpi.global_prim_index); - - // Glyphs size is already in device-pixels. - // The render task origin is in device-pixels. Offset that by - // the glyph offset, relative to its primitive bounding rect. - vec2 size = glyph.uv_rect.zw - glyph.uv_rect.xy; - vec2 origin = task.data0.xy + uDevicePixelRatio * (glyph.offset.xy - pg.local_rect.xy); - vec4 local_rect = vec4(origin, size); - - vec2 texture_size = vec2(textureSize(sColor0, 0)); - vec2 st0 = glyph.uv_rect.xy / texture_size; - vec2 st1 = glyph.uv_rect.zw / texture_size; - - vec2 pos = mix(local_rect.xy, - local_rect.xy + local_rect.zw, - aPosition.xy); - vUv = mix(st0, st1, aPosition.xy); - vColor = text.color; - - gl_Position = uTransform * vec4(pos, 0.0, 1.0); -} diff --git a/resources/shaders/debug_color.fs.glsl b/resources/shaders/debug_color.fs.glsl deleted file mode 100644 index e9aae641382..00000000000 --- a/resources/shaders/debug_color.fs.glsl +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) -{ - oFragColor = vColor; -} diff --git a/resources/shaders/debug_color.vs.glsl b/resources/shaders/debug_color.vs.glsl deleted file mode 100644 index 78e7a306c20..00000000000 --- a/resources/shaders/debug_color.vs.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) -{ - vColor = aColorRectTL; - vec4 pos = vec4(aPosition, 1.0); - pos.xy = floor(pos.xy * uDevicePixelRatio + 0.5) / uDevicePixelRatio; - gl_Position = uTransform * pos; -} diff --git a/resources/shaders/debug_font.fs.glsl b/resources/shaders/debug_font.fs.glsl deleted file mode 100644 index 5550fa93447..00000000000 --- a/resources/shaders/debug_font.fs.glsl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) -{ -#ifdef SERVO_ES2 - float alpha = texture(sColor0, vColorTexCoord.xy).a; -#else - float alpha = texture(sColor0, vColorTexCoord.xy).r; -#endif - oFragColor = vec4(vColor.xyz, vColor.w * alpha); -} diff --git a/resources/shaders/debug_font.vs.glsl b/resources/shaders/debug_font.vs.glsl deleted file mode 100644 index 9d9f38653cb..00000000000 --- a/resources/shaders/debug_font.vs.glsl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) -{ - vColor = aColorRectTL; - vColorTexCoord = aColorTexCoordRectTop.xy; - vec4 pos = vec4(aPosition, 1.0); - pos.xy = floor(pos.xy * uDevicePixelRatio + 0.5) / uDevicePixelRatio; - gl_Position = uTransform * pos; -} diff --git a/resources/shaders/prim_shared.glsl b/resources/shaders/prim_shared.glsl deleted file mode 100644 index b98d9d2b72f..00000000000 --- a/resources/shaders/prim_shared.glsl +++ /dev/null @@ -1,698 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#define PST_TOP_LEFT 0 -#define PST_TOP 1 -#define PST_TOP_RIGHT 2 -#define PST_RIGHT 3 -#define PST_BOTTOM_RIGHT 4 -#define PST_BOTTOM 5 -#define PST_BOTTOM_LEFT 6 -#define PST_LEFT 7 - -#define BORDER_LEFT 0 -#define BORDER_TOP 1 -#define BORDER_RIGHT 2 -#define BORDER_BOTTOM 3 - -#define UV_NORMALIZED uint(0) -#define UV_PIXEL uint(1) - -// Border styles as defined in webrender_traits/types.rs -#define BORDER_STYLE_NONE 0 -#define BORDER_STYLE_SOLID 1 -#define BORDER_STYLE_DOUBLE 2 -#define BORDER_STYLE_DOTTED 3 -#define BORDER_STYLE_DASHED 4 -#define BORDER_STYLE_HIDDEN 5 -#define BORDER_STYLE_GROOVE 6 -#define BORDER_STYLE_RIDGE 7 -#define BORDER_STYLE_INSET 8 -#define BORDER_STYLE_OUTSET 9 - -#define MAX_STOPS_PER_ANGLE_GRADIENT 8 - -uniform sampler2DArray sCache; - -#ifdef WR_VERTEX_SHADER - -#define VECS_PER_LAYER 13 -#define VECS_PER_RENDER_TASK 2 -#define VECS_PER_PRIM_GEOM 2 - -#define GRADIENT_HORIZONTAL 0 -#define GRADIENT_VERTICAL 1 -#define GRADIENT_ROTATED 2 - -uniform sampler2D sLayers; -uniform sampler2D sRenderTasks; -uniform sampler2D sPrimGeometry; -uniform sampler2D sClips; - -uniform sampler2D sData16; -uniform sampler2D sData32; -uniform sampler2D sData64; -uniform sampler2D sData128; - -ivec2 get_fetch_uv(int index, int vecs_per_item) { - int items_per_row = WR_MAX_VERTEX_TEXTURE_WIDTH / vecs_per_item; - int y = index / items_per_row; - int x = vecs_per_item * (index % items_per_row); - return ivec2(x, y); -} - -ivec2 get_fetch_uv_1(int index) { - return get_fetch_uv(index, 1); -} - -ivec2 get_fetch_uv_2(int index) { - return get_fetch_uv(index, 2); -} - -ivec2 get_fetch_uv_4(int index) { - return get_fetch_uv(index, 4); -} - -ivec2 get_fetch_uv_8(int index) { - return get_fetch_uv(index, 8); -} - -struct Layer { - mat4 transform; - mat4 inv_transform; - vec4 local_clip_rect; - vec4 screen_vertices[4]; -}; - -layout(std140) uniform Data { - ivec4 int_data[WR_MAX_UBO_VECTORS]; -}; - -Layer fetch_layer(int index) { - Layer layer; - - // Create a UV base coord for each 8 texels. - // This is required because trying to use an offset - // of more than 8 texels doesn't work on some versions - // of OSX. - ivec2 uv = get_fetch_uv(index, VECS_PER_LAYER); - ivec2 uv0 = ivec2(uv.x + 0, uv.y); - ivec2 uv1 = ivec2(uv.x + 8, uv.y); - - layer.transform[0] = texelFetchOffset(sLayers, uv0, 0, ivec2(0, 0)); - layer.transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(1, 0)); - layer.transform[2] = texelFetchOffset(sLayers, uv0, 0, ivec2(2, 0)); - layer.transform[3] = texelFetchOffset(sLayers, uv0, 0, ivec2(3, 0)); - - layer.inv_transform[0] = texelFetchOffset(sLayers, uv0, 0, ivec2(4, 0)); - layer.inv_transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(5, 0)); - layer.inv_transform[2] = texelFetchOffset(sLayers, uv0, 0, ivec2(6, 0)); - layer.inv_transform[3] = texelFetchOffset(sLayers, uv0, 0, ivec2(7, 0)); - - layer.local_clip_rect = texelFetchOffset(sLayers, uv1, 0, ivec2(0, 0)); - - layer.screen_vertices[0] = texelFetchOffset(sLayers, uv1, 0, ivec2(1, 0)); - layer.screen_vertices[1] = texelFetchOffset(sLayers, uv1, 0, ivec2(2, 0)); - layer.screen_vertices[2] = texelFetchOffset(sLayers, uv1, 0, ivec2(3, 0)); - layer.screen_vertices[3] = texelFetchOffset(sLayers, uv1, 0, ivec2(4, 0)); - - return layer; -} - -struct RenderTaskData { - vec4 data0; - vec4 data1; -}; - -RenderTaskData fetch_render_task(int index) { - RenderTaskData task; - - ivec2 uv = get_fetch_uv(index, VECS_PER_RENDER_TASK); - - task.data0 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(0, 0)); - task.data1 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(1, 0)); - - return task; -} - -struct Tile { - vec4 screen_origin_task_origin; - vec4 size_target_index; -}; - -Tile fetch_tile(int index) { - RenderTaskData task = fetch_render_task(index); - - Tile tile; - tile.screen_origin_task_origin = task.data0; - tile.size_target_index = task.data1; - - return tile; -} - -struct Gradient { - vec4 start_end_point; - vec4 kind; -}; - -Gradient fetch_gradient(int index) { - Gradient gradient; - - ivec2 uv = get_fetch_uv_2(index); - - gradient.start_end_point = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - gradient.kind = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - - return gradient; -} - -struct GradientStop { - vec4 color; - vec4 offset; -}; - -GradientStop fetch_gradient_stop(int index) { - GradientStop stop; - - ivec2 uv = get_fetch_uv_2(index); - - stop.color = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - stop.offset = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - - return stop; -} - -struct Glyph { - vec4 offset; - vec4 uv_rect; -}; - -Glyph fetch_glyph(int index) { - Glyph glyph; - - ivec2 uv = get_fetch_uv_2(index); - - glyph.offset = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - glyph.uv_rect = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - - return glyph; -} - -struct Border { - vec4 style; - vec4 widths; - vec4 colors[4]; - vec4 radii[2]; -}; - -Border fetch_border(int index) { - Border border; - - ivec2 uv = get_fetch_uv_8(index); - - border.style = texelFetchOffset(sData128, uv, 0, ivec2(0, 0)); - border.widths = texelFetchOffset(sData128, uv, 0, ivec2(1, 0)); - border.colors[0] = texelFetchOffset(sData128, uv, 0, ivec2(2, 0)); - border.colors[1] = texelFetchOffset(sData128, uv, 0, ivec2(3, 0)); - border.colors[2] = texelFetchOffset(sData128, uv, 0, ivec2(4, 0)); - border.colors[3] = texelFetchOffset(sData128, uv, 0, ivec2(5, 0)); - border.radii[0] = texelFetchOffset(sData128, uv, 0, ivec2(6, 0)); - border.radii[1] = texelFetchOffset(sData128, uv, 0, ivec2(7, 0)); - - return border; -} - -vec4 fetch_instance_geometry(int index) { - ivec2 uv = get_fetch_uv_1(index); - - vec4 rect = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); - - return rect; -} - -struct PrimitiveGeometry { - vec4 local_rect; - vec4 local_clip_rect; -}; - -PrimitiveGeometry fetch_prim_geometry(int index) { - PrimitiveGeometry pg; - - ivec2 uv = get_fetch_uv(index, VECS_PER_PRIM_GEOM); - - pg.local_rect = texelFetchOffset(sPrimGeometry, uv, 0, ivec2(0, 0)); - pg.local_clip_rect = texelFetchOffset(sPrimGeometry, uv, 0, ivec2(1, 0)); - - return pg; -} - -struct PrimitiveInstance { - int global_prim_index; - int specific_prim_index; - int render_task_index; - int layer_index; - int clip_address; - int sub_index; - ivec2 user_data; -}; - -PrimitiveInstance fetch_instance(int index) { - PrimitiveInstance pi; - - int offset = index * 2; - - ivec4 data0 = int_data[offset + 0]; - ivec4 data1 = int_data[offset + 1]; - - pi.global_prim_index = data0.x; - pi.specific_prim_index = data0.y; - pi.render_task_index = data0.z; - pi.layer_index = data0.w; - pi.clip_address = data1.x; - pi.sub_index = data1.y; - pi.user_data = data1.zw; - - return pi; -} - -struct BlurCommand { - int task_id; - int src_task_id; - int dir; -}; - -BlurCommand fetch_blur(int index) { - BlurCommand blur; - - int offset = index * 1; - - ivec4 data0 = int_data[offset + 0]; - - blur.task_id = data0.x; - blur.src_task_id = data0.y; - blur.dir = data0.z; - - return blur; -} - -struct CachePrimitiveInstance { - int global_prim_index; - int specific_prim_index; - int render_task_index; - int sub_index; -}; - -CachePrimitiveInstance fetch_cache_instance(int index) { - CachePrimitiveInstance cpi; - - int offset = index * 1; - - ivec4 data0 = int_data[offset + 0]; - - cpi.global_prim_index = data0.x; - cpi.specific_prim_index = data0.y; - cpi.render_task_index = data0.z; - cpi.sub_index = data0.w; - - return cpi; -} - -struct Primitive { - Layer layer; - Tile tile; - vec4 local_rect; - vec4 local_clip_rect; - int prim_index; - int clip_index; - // when sending multiple primitives of the same type (e.g. border segments) - // this index allows the vertex shader to recognize the difference - int sub_index; - ivec2 user_data; -}; - -Primitive load_primitive(int index) { - Primitive prim; - - PrimitiveInstance pi = fetch_instance(index); - - prim.layer = fetch_layer(pi.layer_index); - prim.tile = fetch_tile(pi.render_task_index); - - PrimitiveGeometry pg = fetch_prim_geometry(pi.global_prim_index); - prim.local_rect = pg.local_rect; - prim.local_clip_rect = pg.local_clip_rect; - - prim.prim_index = pi.specific_prim_index; - prim.clip_index = pi.clip_address; - prim.sub_index = pi.sub_index; - prim.user_data = pi.user_data; - - return prim; -} - -struct ClipRect { - vec4 rect; - vec4 dummy; -}; - -ClipRect fetch_clip_rect(int index) { - ClipRect rect; - - ivec2 uv = get_fetch_uv_2(index); - - rect.rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - //rect.dummy = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - rect.dummy = vec4(0.0, 0.0, 0.0, 0.0); - - return rect; -} - -struct ImageMaskData { - vec4 uv_rect; - vec4 local_rect; -}; - -ImageMaskData fetch_mask_data(int index) { - ImageMaskData info; - - ivec2 uv = get_fetch_uv_2(index); - - info.uv_rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - info.local_rect = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - - return info; -} - -struct ClipCorner { - vec4 rect; - vec4 outer_inner_radius; -}; - -ClipCorner fetch_clip_corner(int index) { - ClipCorner corner; - - ivec2 uv = get_fetch_uv_2(index); - - corner.rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - corner.outer_inner_radius = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - - return corner; -} - -struct ClipData { - ClipRect rect; - ClipCorner top_left; - ClipCorner top_right; - ClipCorner bottom_left; - ClipCorner bottom_right; - ImageMaskData mask_data; -}; - -ClipData fetch_clip(int index) { - ClipData clip; - - clip.rect = fetch_clip_rect(index + 0); - clip.top_left = fetch_clip_corner(index + 1); - clip.top_right = fetch_clip_corner(index + 2); - clip.bottom_left = fetch_clip_corner(index + 3); - clip.bottom_right = fetch_clip_corner(index + 4); - clip.mask_data = fetch_mask_data(index + 5); - - return clip; -} - -// Return the intersection of the plane (set up by "normal" and "point") -// with the ray (set up by "ray_origin" and "ray_dir"), -// writing the resulting scaler into "t". -bool ray_plane(vec3 normal, vec3 point, vec3 ray_origin, vec3 ray_dir, out float t) -{ - float denom = dot(normal, ray_dir); - if (denom > 1e-6) { - vec3 d = point - ray_origin; - t = dot(d, normal) / denom; - return t >= 0.0; - } - - return false; -} - -// Apply the inverse transform "inv_transform" -// to the reference point "ref" in CSS space, -// producing a local point on a layer plane, -// set by a base point "a" and a normal "n". -vec4 untransform(vec2 ref, vec3 n, vec3 a, mat4 inv_transform) { - vec3 p = vec3(ref, -10000.0); - vec3 d = vec3(0, 0, 1.0); - - float t = 0.0; - // get an intersection of the layer plane with Z axis vector, - // originated from the "ref" point - ray_plane(n, a, p, d, t); - float z = p.z + d.z * t; // Z of the visible point on the layer - - vec4 r = inv_transform * vec4(ref, z, 1.0); - return r; -} - -// Given a CSS space position, transform it back into the layer space. -vec4 get_layer_pos(vec2 pos, Layer layer) { - // get 3 of the layer corners in CSS space - vec3 a = layer.screen_vertices[0].xyz / layer.screen_vertices[0].w; - vec3 b = layer.screen_vertices[3].xyz / layer.screen_vertices[3].w; - vec3 c = layer.screen_vertices[2].xyz / layer.screen_vertices[2].w; - // get the normal to the layer plane - vec3 n = normalize(cross(b-a, c-a)); - return untransform(pos, n, a, layer.inv_transform); -} - -vec2 clamp_rect(vec2 point, vec4 rect) { - return clamp(point, rect.xy, rect.xy + rect.zw); -} - -struct Rect { - vec2 p0; - vec2 p1; -}; - -struct VertexInfo { - Rect local_rect; - vec2 local_clamped_pos; - vec2 global_clamped_pos; -}; - -VertexInfo write_vertex(vec4 instance_rect, - vec4 local_clip_rect, - Layer layer, - Tile tile) { - vec2 p0 = floor(0.5 + instance_rect.xy * uDevicePixelRatio) / uDevicePixelRatio; - vec2 p1 = floor(0.5 + (instance_rect.xy + instance_rect.zw) * uDevicePixelRatio) / uDevicePixelRatio; - - vec2 local_pos = mix(p0, p1, aPosition.xy); - - vec2 cp0 = floor(0.5 + local_clip_rect.xy * uDevicePixelRatio) / uDevicePixelRatio; - vec2 cp1 = floor(0.5 + (local_clip_rect.xy + local_clip_rect.zw) * uDevicePixelRatio) / uDevicePixelRatio; - local_pos = clamp(local_pos, cp0, cp1); - - local_pos = clamp_rect(local_pos, layer.local_clip_rect); - - vec4 world_pos = layer.transform * vec4(local_pos, 0, 1); - world_pos.xyz /= world_pos.w; - - vec2 device_pos = world_pos.xy * uDevicePixelRatio; - - vec2 clamped_pos = clamp(device_pos, - tile.screen_origin_task_origin.xy, - tile.screen_origin_task_origin.xy + tile.size_target_index.xy); - - vec4 local_clamped_pos = layer.inv_transform * vec4(clamped_pos / uDevicePixelRatio, world_pos.z, 1); - local_clamped_pos.xyz /= local_clamped_pos.w; - - vec2 final_pos = clamped_pos + tile.screen_origin_task_origin.zw - tile.screen_origin_task_origin.xy; - - gl_Position = uTransform * vec4(final_pos, 0, 1); - - VertexInfo vi = VertexInfo(Rect(p0, p1), local_clamped_pos.xy, clamped_pos.xy); - return vi; -} - -#ifdef WR_FEATURE_TRANSFORM - -struct TransformVertexInfo { - vec3 local_pos; - vec4 clipped_local_rect; -}; - -TransformVertexInfo write_transform_vertex(vec4 instance_rect, - vec4 local_clip_rect, - Layer layer, - Tile tile) { - vec2 lp0_base = instance_rect.xy; - vec2 lp1_base = instance_rect.xy + instance_rect.zw; - - vec2 lp0 = clamp_rect(clamp_rect(lp0_base, local_clip_rect), - layer.local_clip_rect); - vec2 lp1 = clamp_rect(clamp_rect(lp1_base, local_clip_rect), - layer.local_clip_rect); - - vec4 clipped_local_rect = vec4(lp0, lp1 - lp0); - - vec2 p0 = lp0; - vec2 p1 = vec2(lp1.x, lp0.y); - vec2 p2 = vec2(lp0.x, lp1.y); - vec2 p3 = lp1; - - vec4 t0 = layer.transform * vec4(p0, 0, 1); - vec4 t1 = layer.transform * vec4(p1, 0, 1); - vec4 t2 = layer.transform * vec4(p2, 0, 1); - vec4 t3 = layer.transform * vec4(p3, 0, 1); - - vec2 tp0 = t0.xy / t0.w; - vec2 tp1 = t1.xy / t1.w; - vec2 tp2 = t2.xy / t2.w; - vec2 tp3 = t3.xy / t3.w; - - // compute a CSS space aligned bounding box - vec2 min_pos = min(min(tp0.xy, tp1.xy), min(tp2.xy, tp3.xy)); - vec2 max_pos = max(max(tp0.xy, tp1.xy), max(tp2.xy, tp3.xy)); - - // clamp to the tile boundaries, in device space - vec2 min_pos_clamped = clamp(min_pos * uDevicePixelRatio, - tile.screen_origin_task_origin.xy, - tile.screen_origin_task_origin.xy + tile.size_target_index.xy); - - vec2 max_pos_clamped = clamp(max_pos * uDevicePixelRatio, - tile.screen_origin_task_origin.xy, - tile.screen_origin_task_origin.xy + tile.size_target_index.xy); - - // compute the device space position of this vertex - vec2 clamped_pos = mix(min_pos_clamped, - max_pos_clamped, - aPosition.xy); - - // compute the point position in side the layer, in CSS space - vec4 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, layer); - - // apply the task offset - vec2 final_pos = clamped_pos + tile.screen_origin_task_origin.zw - tile.screen_origin_task_origin.xy; - - gl_Position = uTransform * vec4(final_pos, 0, 1); - - return TransformVertexInfo(layer_pos.xyw, clipped_local_rect); -} - -#endif //WR_FEATURE_TRANSFORM - -struct Rectangle { - vec4 color; -}; - -Rectangle fetch_rectangle(int index) { - Rectangle rect; - - ivec2 uv = get_fetch_uv_1(index); - - rect.color = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); - - return rect; -} - -struct TextRun { - vec4 color; -}; - -TextRun fetch_text_run(int index) { - TextRun text; - - ivec2 uv = get_fetch_uv_1(index); - - text.color = texelFetchOffset(sData16, uv, 0, ivec2(0, 0)); - - return text; -} - -struct Image { - vec4 st_rect; // Location of the image texture in the texture atlas. - vec4 stretch_size_and_tile_spacing; // Size of the actual image and amount of space between - // tiled instances of this image. -}; - -Image fetch_image(int index) { - Image image; - - ivec2 uv = get_fetch_uv_2(index); - - image.st_rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0)); - image.stretch_size_and_tile_spacing = texelFetchOffset(sData32, uv, 0, ivec2(1, 0)); - - return image; -} - -struct BoxShadow { - vec4 src_rect; - vec4 bs_rect; - vec4 color; - vec4 border_radius_edge_size_blur_radius_inverted; -}; - -BoxShadow fetch_boxshadow(int index) { - BoxShadow bs; - - ivec2 uv = get_fetch_uv_4(index); - - bs.src_rect = texelFetchOffset(sData64, uv, 0, ivec2(0, 0)); - bs.bs_rect = texelFetchOffset(sData64, uv, 0, ivec2(1, 0)); - bs.color = texelFetchOffset(sData64, uv, 0, ivec2(2, 0)); - bs.border_radius_edge_size_blur_radius_inverted = texelFetchOffset(sData64, uv, 0, ivec2(3, 0)); - - return bs; -} - -struct Blend { - ivec4 src_id_target_id_op_amount; -}; - -Blend fetch_blend(int index) { - Blend blend; - - int offset = index * 1; - blend.src_id_target_id_op_amount = int_data[offset + 0]; - - return blend; -} - -struct Composite { - ivec4 src0_src1_target_id_op; -}; - -Composite fetch_composite(int index) { - Composite composite; - - int offset = index * 1; - - composite.src0_src1_target_id_op = int_data[offset + 0]; - - return composite; -} -#endif - -#ifdef WR_FRAGMENT_SHADER -float distance_from_rect(vec2 p, vec2 origin, vec2 size) { - vec2 clamped = clamp(p, origin, origin + size); - return distance(clamped, p); -} - -vec2 init_transform_fs(vec3 local_pos, vec4 local_rect, out float fragment_alpha) { - fragment_alpha = 1.0; - vec2 pos = local_pos.xy / local_pos.z; - - float border_distance = distance_from_rect(pos, local_rect.xy, local_rect.zw); - if (border_distance != 0.0) { - float delta = length(fwidth(local_pos.xy)); - fragment_alpha = 1.0 - smoothstep(0.0, 1.0, border_distance / delta * 2.0); - } - - return pos; -} -#endif diff --git a/resources/shaders/ps_angle_gradient.fs.glsl b/resources/shaders/ps_angle_gradient.fs.glsl deleted file mode 100644 index 70f42a19551..00000000000 --- a/resources/shaders/ps_angle_gradient.fs.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -float offset(int index) { - return vOffsets[index / 4][index % 4]; -} - -float linearStep(float lo, float hi, float x) { - float d = hi - lo; - float v = x - lo; - if (d != 0.0) { - v /= d; - } - return clamp(v, 0.0, 1.0); -} - -void main(void) { - float angle = atan(-vEndPoint.y + vStartPoint.y, - vEndPoint.x - vStartPoint.x); - float sa = sin(angle); - float ca = cos(angle); - - float sx = vStartPoint.x * ca - vStartPoint.y * sa; - float ex = vEndPoint.x * ca - vEndPoint.y * sa; - float d = ex - sx; - - float x = vPos.x * ca - vPos.y * sa; - - oFragColor = mix(vColors[0], - vColors[1], - linearStep(sx + d * offset(0), sx + d * offset(1), x)); - - for (int i=1 ; i < vStopCount-1 ; ++i) { - oFragColor = mix(oFragColor, - vColors[i+1], - linearStep(sx + d * offset(i), sx + d * offset(i+1), x)); - } -} diff --git a/resources/shaders/ps_angle_gradient.glsl b/resources/shaders/ps_angle_gradient.glsl deleted file mode 100644 index 0ef30941186..00000000000 --- a/resources/shaders/ps_angle_gradient.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -flat varying int vStopCount; -flat varying float vAngle; -flat varying vec2 vStartPoint; -flat varying vec2 vEndPoint; -varying vec2 vPos; -flat varying vec4 vColors[MAX_STOPS_PER_ANGLE_GRADIENT]; -flat varying vec4 vOffsets[MAX_STOPS_PER_ANGLE_GRADIENT/4]; diff --git a/resources/shaders/ps_angle_gradient.vs.glsl b/resources/shaders/ps_angle_gradient.vs.glsl deleted file mode 100644 index e1c91b544f8..00000000000 --- a/resources/shaders/ps_angle_gradient.vs.glsl +++ /dev/null @@ -1,32 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Gradient gradient = fetch_gradient(prim.prim_index); - - VertexInfo vi = write_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - - vStopCount = int(prim.user_data.x); - vPos = vi.local_clamped_pos; - - // Snap the start/end points to device pixel units. - // I'm not sure this is entirely correct, but the - // old render path does this, and it is needed to - // make the angle gradient ref tests pass. It might - // be better to fix this higher up in DL construction - // and not snap here? - vStartPoint = floor(0.5 + gradient.start_end_point.xy * uDevicePixelRatio) / uDevicePixelRatio; - vEndPoint = floor(0.5 + gradient.start_end_point.zw * uDevicePixelRatio) / uDevicePixelRatio; - - for (int i=0 ; i < vStopCount ; ++i) { - GradientStop stop = fetch_gradient_stop(prim.sub_index + i); - vColors[i] = stop.color; - vOffsets[i/4][i%4] = stop.offset.x; - } -} diff --git a/resources/shaders/ps_blend.fs.glsl b/resources/shaders/ps_blend.fs.glsl deleted file mode 100644 index 7ce203fbbf9..00000000000 --- a/resources/shaders/ps_blend.fs.glsl +++ /dev/null @@ -1,138 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -vec3 rgbToHsv(vec3 c) { - float value = max(max(c.r, c.g), c.b); - - float chroma = value - min(min(c.r, c.g), c.b); - if (chroma == 0.0) { - return vec3(0.0); - } - float saturation = chroma / value; - - float hue; - if (c.r == value) - hue = (c.g - c.b) / chroma; - else if (c.g == value) - hue = 2.0 + (c.b - c.r) / chroma; - else // if (c.b == value) - hue = 4.0 + (c.r - c.g) / chroma; - - hue *= 1.0/6.0; - if (hue < 0.0) - hue += 1.0; - return vec3(hue, saturation, value); -} - -vec3 hsvToRgb(vec3 c) { - if (c.s == 0.0) { - return vec3(c.z); - } - - float hue = c.x * 6.0; - int sector = int(hue); - float residualHue = hue - float(sector); - - vec3 pqt = c.z * vec3(1.0 - c.y, 1.0 - c.y * residualHue, 1.0 - c.y * (1.0 - residualHue)); - switch (sector) { - case 0: - return vec3(c.z, pqt.z, pqt.x); - case 1: - return vec3(pqt.y, c.z, pqt.x); - case 2: - return vec3(pqt.x, c.z, pqt.z); - case 3: - return vec3(pqt.x, pqt.y, c.z); - case 4: - return vec3(pqt.z, pqt.x, c.z); - default: - return vec3(c.z, pqt.x, pqt.y); - } -} - -vec4 Blur(float radius, vec2 direction) { - // TODO(gw): Support blur in WR2! - return vec4(1.0); -} - -vec4 Contrast(vec4 Cs, float amount) { - return vec4(Cs.rgb * amount - 0.5 * amount + 0.5, 1.0); -} - -vec4 Grayscale(vec4 Cs, float amount) { - float ia = 1.0 - amount; - return mat4(vec4(0.2126 + 0.7874 * ia, 0.2126 - 0.2126 * ia, 0.2126 - 0.2126 * ia, 0.0), - vec4(0.7152 - 0.7152 * ia, 0.7152 + 0.2848 * ia, 0.7152 - 0.7152 * ia, 0.0), - vec4(0.0722 - 0.0722 * ia, 0.0722 - 0.0722 * ia, 0.0722 + 0.9278 * ia, 0.0), - vec4(0.0, 0.0, 0.0, 1.0)) * Cs; -} - -vec4 HueRotate(vec4 Cs, float amount) { - vec3 CsHsv = rgbToHsv(Cs.rgb); - CsHsv.x = mod(CsHsv.x + amount / 6.283185307179586, 1.0); - return vec4(hsvToRgb(CsHsv), Cs.a); -} - -vec4 Invert(vec4 Cs, float amount) { - return mix(Cs, vec4(1.0, 1.0, 1.0, Cs.a) - vec4(Cs.rgb, 0.0), amount); -} - -vec4 Saturate(vec4 Cs, float amount) { - return vec4(hsvToRgb(min(vec3(1.0, amount, 1.0) * rgbToHsv(Cs.rgb), vec3(1.0))), Cs.a); -} - -vec4 Sepia(vec4 Cs, float amount) { - float ia = 1.0 - amount; - return mat4(vec4(0.393 + 0.607 * ia, 0.349 - 0.349 * ia, 0.272 - 0.272 * ia, 0.0), - vec4(0.769 - 0.769 * ia, 0.686 + 0.314 * ia, 0.534 - 0.534 * ia, 0.0), - vec4(0.189 - 0.189 * ia, 0.168 - 0.168 * ia, 0.131 + 0.869 * ia, 0.0), - vec4(0.0, 0.0, 0.0, 1.0)) * Cs; -} - -vec4 Brightness(vec4 Cs, float amount) { - return vec4(Cs.rgb * amount, Cs.a); -} - -vec4 Opacity(vec4 Cs, float amount) { - return vec4(Cs.rgb, Cs.a * amount); -} - -void main(void) { - vec4 Cs = texture(sCache, vUv); - - if (Cs.a == 0.0) { - discard; - } - - switch (vOp) { - case 0: - // Gaussian blur is specially handled: - oFragColor = Cs;// Blur(vAmount, vec2(0,0)); - break; - case 1: - oFragColor = Contrast(Cs, vAmount); - break; - case 2: - oFragColor = Grayscale(Cs, vAmount); - break; - case 3: - oFragColor = HueRotate(Cs, vAmount); - break; - case 4: - oFragColor = Invert(Cs, vAmount); - break; - case 5: - oFragColor = Saturate(Cs, vAmount); - break; - case 6: - oFragColor = Sepia(Cs, vAmount); - break; - case 7: - oFragColor = Brightness(Cs, vAmount); - break; - case 8: - oFragColor = Opacity(Cs, vAmount); - break; - } -} diff --git a/resources/shaders/ps_blend.glsl b/resources/shaders/ps_blend.glsl deleted file mode 100644 index 09e6d9262a2..00000000000 --- a/resources/shaders/ps_blend.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec3 vUv; -flat varying float vAmount; -flat varying int vOp; diff --git a/resources/shaders/ps_blend.vs.glsl b/resources/shaders/ps_blend.vs.glsl deleted file mode 100644 index 97a9c6838e0..00000000000 --- a/resources/shaders/ps_blend.vs.glsl +++ /dev/null @@ -1,28 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Blend blend = fetch_blend(gl_InstanceID); - Tile src = fetch_tile(blend.src_id_target_id_op_amount.x); - Tile dest = fetch_tile(blend.src_id_target_id_op_amount.y); - - vec2 dest_origin = dest.screen_origin_task_origin.zw - - dest.screen_origin_task_origin.xy + - src.screen_origin_task_origin.xy; - - vec2 local_pos = mix(dest_origin, - dest_origin + src.size_target_index.xy, - aPosition.xy); - - vec2 texture_size = vec2(textureSize(sCache, 0)); - vec2 st0 = src.screen_origin_task_origin.zw / texture_size; - vec2 st1 = (src.screen_origin_task_origin.zw + src.size_target_index.xy) / texture_size; - vUv = vec3(mix(st0, st1, aPosition.xy), src.size_target_index.z); - - vOp = blend.src_id_target_id_op_amount.z; - vAmount = blend.src_id_target_id_op_amount.w / 65535.0; - - gl_Position = uTransform * vec4(local_pos, 0, 1); -} diff --git a/resources/shaders/ps_border.fs.glsl b/resources/shaders/ps_border.fs.glsl deleted file mode 100644 index 339be8796d5..00000000000 --- a/resources/shaders/ps_border.fs.glsl +++ /dev/null @@ -1,335 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void discard_pixels_in_rounded_borders(vec2 local_pos) { - float distanceFromRef = distance(vRefPoint, local_pos); - if (vRadii.x > 0.0 && (distanceFromRef > vRadii.x || distanceFromRef < vRadii.z)) { - discard; - } -} - -vec4 get_fragment_color(float distanceFromMixLine, float pixelsPerFragment) { - // Here we are mixing between the two border colors. We need to convert - // distanceFromMixLine it to pixel space to properly anti-alias and then push - // it between the limits accepted by `mix`. - float colorMix = min(max(distanceFromMixLine / pixelsPerFragment, -0.5), 0.5) + 0.5; - return mix(vHorizontalColor, vVerticalColor, colorMix); -} - -float alpha_for_solid_border(float distance_from_ref, - float inner_radius, - float outer_radius, - float pixels_per_fragment) { - // We want to start anti-aliasing one pixel in from the border. - float nudge = pixels_per_fragment; - inner_radius += nudge; - outer_radius -= nudge; - - if (distance_from_ref < outer_radius && distance_from_ref > inner_radius) { - return 1.0; - } - - float distance_from_border = max(distance_from_ref - outer_radius, - inner_radius - distance_from_ref); - - // Move the distance back into pixels. - distance_from_border /= pixels_per_fragment; - - // Apply a more gradual fade out to transparent. - // distance_from_border -= 0.5; - - return 1.0 - smoothstep(0.0, 1.0, distance_from_border); -} - -float alpha_for_solid_border_corner(vec2 local_pos, - float inner_radius, - float outer_radius, - float pixels_per_fragment) { - float distance_from_ref = distance(vRefPoint, local_pos); - return alpha_for_solid_border(distance_from_ref, inner_radius, outer_radius, pixels_per_fragment); -} - -vec4 draw_dotted_edge(vec2 local_pos, vec4 piece_rect, float pixels_per_fragment) { - // We don't use pixels_per_fragment here, since it can change along the edge - // of a transformed border edge. We want this calculation to be consistent - // across the entire edge so that the positioning of the dots stays the same. - float two_pixels = 2.0 * length(fwidth(vLocalPos.xy)); - - // Circle diameter is stroke width, minus a couple pixels to account for anti-aliasing. - float circle_diameter = max(piece_rect.z - two_pixels, min(piece_rect.z, two_pixels)); - - // We want to spread the circles across the edge, but keep one circle diameter at the end - // reserved for two half-circles which connect to the corners. - float edge_available = piece_rect.w - (circle_diameter * 2.0); - float number_of_circles = floor(edge_available / (circle_diameter * 2.0)); - - // Here we are initializing the distance from the y coordinate of the center of the circle to - // the closest end half-circle. - vec2 relative_pos = local_pos - piece_rect.xy; - float y_distance = min(relative_pos.y, piece_rect.w - relative_pos.y); - - if (number_of_circles > 0.0) { - // Spread the circles throughout the edge, to distribute the extra space evenly. We want - // to ensure that we have at last two pixels of space for each circle so that they aren't - // touching. - float space_for_each_circle = ceil(max(edge_available / number_of_circles, two_pixels)); - - float first_half_circle_space = circle_diameter; - - float circle_index = (relative_pos.y - first_half_circle_space) / space_for_each_circle; - circle_index = floor(clamp(circle_index, 0.0, number_of_circles - 1.0)); - - float circle_y_pos = - circle_index * space_for_each_circle + (space_for_each_circle / 2.0) + circle_diameter; - y_distance = min(abs(circle_y_pos - relative_pos.y), y_distance); - } - - float distance_from_circle_center = length(vec2(relative_pos.x - (piece_rect.z / 2.0), y_distance)); - float distance_from_circle_edge = distance_from_circle_center - (circle_diameter / 2.0); - - // Don't anti-alias if the circle diameter is small to avoid a blur of color. - if (circle_diameter < two_pixels && distance_from_circle_edge > 0.0) - return vec4(0.0); - - // Move the distance back into pixels. - distance_from_circle_edge /= pixels_per_fragment; - - float alpha = 1.0 - smoothstep(0.0, 1.0, min(1.0, max(0.0, distance_from_circle_edge))); - return vHorizontalColor * vec4(1.0, 1.0, 1.0, alpha); -} - -vec4 draw_dashed_edge(float position, float border_width, float pixels_per_fragment) { - // TODO: Investigate exactly what FF does. - float size = border_width * 3.0; - float segment = floor(position / size); - - float alpha = alpha_for_solid_border(position, - segment * size, - (segment + 1.0) * size, - pixels_per_fragment); - - if (mod(segment + 2.0, 2.0) == 0.0) { - return vHorizontalColor * vec4(1.0, 1.0, 1.0, 1.0 - alpha); - } else { - return vHorizontalColor * vec4(1.0, 1.0, 1.0, alpha); - } -} - -void draw_dashed_or_dotted_border(vec2 local_pos, float distance_from_mix_line) { - // This is the conversion factor for transformations and device pixel scaling. - float pixels_per_fragment = length(fwidth(local_pos.xy)); - - switch (vBorderPart) { - // These are the layer tile part PrimitivePart as uploaded by the tiling.rs - case PST_TOP_LEFT: - case PST_TOP_RIGHT: - case PST_BOTTOM_LEFT: - case PST_BOTTOM_RIGHT: - { - oFragColor = get_fragment_color(distance_from_mix_line, pixels_per_fragment); - if (vRadii.x > 0.0) { - oFragColor *= vec4(1.0, 1.0, 1.0, alpha_for_solid_border_corner(local_pos, - vRadii.z, - vRadii.x, - pixels_per_fragment)); - } - - break; - } - case PST_BOTTOM: - case PST_TOP: { - if (vBorderStyle == BORDER_STYLE_DASHED) { - oFragColor = draw_dashed_edge(vLocalPos.x - vPieceRect.x, - vPieceRect.w, - pixels_per_fragment); - } else { - oFragColor = draw_dotted_edge(local_pos.yx, vPieceRect.yxwz, pixels_per_fragment); - } - break; - } - case PST_LEFT: - case PST_RIGHT: - { - if (vBorderStyle == BORDER_STYLE_DASHED) { - oFragColor = draw_dashed_edge(vLocalPos.y - vPieceRect.y, - vPieceRect.z, - pixels_per_fragment); - } else { - oFragColor = draw_dotted_edge(local_pos.xy, vPieceRect.xyzw, pixels_per_fragment); - } - break; - } - } -} - -vec4 draw_double_edge(float pos, - float len, - float distance_from_mix_line, - float pixels_per_fragment) { - float total_border_width = len; - float one_third_width = total_border_width / 3.0; - - // Contribution of the outer border segment. - float alpha = alpha_for_solid_border(pos, - total_border_width - one_third_width, - total_border_width, - pixels_per_fragment); - - // Contribution of the inner border segment. - alpha += alpha_for_solid_border(pos, 0.0, one_third_width, pixels_per_fragment); - return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha); -} - -vec4 draw_double_edge_vertical(vec2 local_pos, - float distance_from_mix_line, - float pixels_per_fragment) { - // Get our position within this specific segment - float position = local_pos.x - vLocalRect.x; - return draw_double_edge(position, vLocalRect.z, distance_from_mix_line, pixels_per_fragment); -} - -vec4 draw_double_edge_horizontal(vec2 local_pos, - float distance_from_mix_line, - float pixels_per_fragment) { - // Get our position within this specific segment - float position = local_pos.y - vLocalRect.y; - return draw_double_edge(position, vLocalRect.w, distance_from_mix_line, pixels_per_fragment); -} - -vec4 draw_double_edge_corner_with_radius(vec2 local_pos, - float distance_from_mix_line, - float pixels_per_fragment) { - float total_border_width = vRadii.x - vRadii.z; - float one_third_width = total_border_width / 3.0; - - // Contribution of the outer border segment. - float alpha = alpha_for_solid_border_corner(local_pos, - vRadii.x - one_third_width, - vRadii.x, - pixels_per_fragment); - - // Contribution of the inner border segment. - alpha += alpha_for_solid_border_corner(local_pos, - vRadii.z, - vRadii.z + one_third_width, - pixels_per_fragment); - return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha); -} - -vec4 draw_double_edge_corner(vec2 local_pos, - float distance_from_mix_line, - float pixels_per_fragment) { - if (vRadii.x > 0.0) { - return draw_double_edge_corner_with_radius(local_pos, - distance_from_mix_line, - pixels_per_fragment); - } - - bool is_vertical = (vBorderPart == PST_TOP_LEFT) ? distance_from_mix_line < 0.0 : - distance_from_mix_line >= 0.0; - if (is_vertical) { - return draw_double_edge_vertical(local_pos, distance_from_mix_line, pixels_per_fragment); - } else { - return draw_double_edge_horizontal(local_pos, distance_from_mix_line, pixels_per_fragment); - } -} - -void draw_double_border(float distance_from_mix_line, vec2 local_pos) { - float pixels_per_fragment = length(fwidth(local_pos.xy)); - switch (vBorderPart) { - // These are the layer tile part PrimitivePart as uploaded by the tiling.rs - case PST_TOP_LEFT: - case PST_TOP_RIGHT: - case PST_BOTTOM_LEFT: - case PST_BOTTOM_RIGHT: - { - oFragColor = draw_double_edge_corner(local_pos, distance_from_mix_line, pixels_per_fragment); - break; - } - case PST_BOTTOM: - case PST_TOP: - { - oFragColor = draw_double_edge_horizontal(local_pos, - distance_from_mix_line, - pixels_per_fragment); - break; - } - case PST_LEFT: - case PST_RIGHT: - { - oFragColor = draw_double_edge_vertical(local_pos, - distance_from_mix_line, - pixels_per_fragment); - break; - } - } -} - -void draw_solid_border(float distanceFromMixLine, vec2 localPos) { - switch (vBorderPart) { - case PST_TOP_LEFT: - case PST_TOP_RIGHT: - case PST_BOTTOM_LEFT: - case PST_BOTTOM_RIGHT: { - // This is the conversion factor for transformations and device pixel scaling. - float pixelsPerFragment = length(fwidth(localPos.xy)); - oFragColor = get_fragment_color(distanceFromMixLine, pixelsPerFragment); - - if (vRadii.x > 0.0) { - float alpha = alpha_for_solid_border_corner(localPos, vRadii.z, vRadii.x, pixelsPerFragment); - oFragColor *= vec4(1.0, 1.0, 1.0, alpha); - } - - break; - } - default: - oFragColor = vHorizontalColor; - discard_pixels_in_rounded_borders(localPos); - } -} - -// TODO: Investigate performance of this shader and see -// if it's worthwhile splitting it / removing branches etc. -void main(void) { -#ifdef WR_FEATURE_TRANSFORM - float alpha = 0.0; - vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha); -#else - vec2 local_pos = vLocalPos; -#endif - -#ifdef WR_FEATURE_TRANSFORM - // TODO(gw): Support other border styles for transformed elements. - float distance_from_mix_line = (local_pos.x - vPieceRect.x) * vPieceRect.w - - (local_pos.y - vPieceRect.y) * vPieceRect.z; - distance_from_mix_line /= vPieceRectHypotenuseLength; -#else - float distance_from_mix_line = vDistanceFromMixLine; -#endif - - switch (vBorderStyle) { - case BORDER_STYLE_DASHED: - case BORDER_STYLE_DOTTED: - draw_dashed_or_dotted_border(local_pos, distance_from_mix_line); - break; - case BORDER_STYLE_DOUBLE: - draw_double_border(distance_from_mix_line, local_pos); - break; - case BORDER_STYLE_OUTSET: - case BORDER_STYLE_INSET: - case BORDER_STYLE_SOLID: - case BORDER_STYLE_NONE: - draw_solid_border(distance_from_mix_line, local_pos); - break; - default: - discard; - - } - -#ifdef WR_FEATURE_TRANSFORM - oFragColor *= vec4(1.0, 1.0, 1.0, alpha); -#endif -} diff --git a/resources/shaders/ps_border.glsl b/resources/shaders/ps_border.glsl deleted file mode 100644 index 0047041205d..00000000000 --- a/resources/shaders/ps_border.glsl +++ /dev/null @@ -1,31 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// These are not changing. -flat varying vec4 vVerticalColor; // The vertical color, e.g. top/bottom -flat varying vec4 vHorizontalColor; // The horizontal color e.g. left/right -flat varying vec4 vRadii; // The border radius from CSS border-radius -flat varying vec4 vLocalRect; // The rect of the border (x, y, w, h) in local space. - -// for corners, this is the beginning of the corner. -// For the lines, this is the top left of the line. -flat varying vec2 vRefPoint; -flat varying int vBorderStyle; -flat varying int vBorderPart; // Which part of the border we're drawing. - -flat varying vec4 vPieceRect; - -// These are in device space -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; // The clamped position in local space. -flat varying float vPieceRectHypotenuseLength; -#else -varying vec2 vLocalPos; // The clamped position in local space. - -// These two are interpolated -varying float vDistanceFromMixLine; // This is the distance from the line where two colors - // meet in border corners. -#endif diff --git a/resources/shaders/ps_border.vs.glsl b/resources/shaders/ps_border.vs.glsl deleted file mode 100644 index feafb695467..00000000000 --- a/resources/shaders/ps_border.vs.glsl +++ /dev/null @@ -1,216 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Border border = fetch_border(prim.prim_index); - int sub_part = prim.sub_index; - - vec2 tl_outer = prim.local_rect.xy; - vec2 tl_inner = tl_outer + vec2(max(border.radii[0].x, border.widths.x), - max(border.radii[0].y, border.widths.y)); - - vec2 tr_outer = vec2(prim.local_rect.x + prim.local_rect.z, - prim.local_rect.y); - vec2 tr_inner = tr_outer + vec2(-max(border.radii[0].z, border.widths.z), - max(border.radii[0].w, border.widths.y)); - - vec2 br_outer = vec2(prim.local_rect.x + prim.local_rect.z, - prim.local_rect.y + prim.local_rect.w); - vec2 br_inner = br_outer - vec2(max(border.radii[1].x, border.widths.z), - max(border.radii[1].y, border.widths.w)); - - vec2 bl_outer = vec2(prim.local_rect.x, - prim.local_rect.y + prim.local_rect.w); - vec2 bl_inner = bl_outer + vec2(max(border.radii[1].z, border.widths.x), - -max(border.radii[1].w, border.widths.w)); - - vec4 segment_rect; - switch (sub_part) { - case PST_TOP_LEFT: - segment_rect = vec4(tl_outer, tl_inner - tl_outer); - break; - case PST_TOP_RIGHT: - segment_rect = vec4(tr_inner.x, - tr_outer.y, - tr_outer.x - tr_inner.x, - tr_inner.y - tr_outer.y); - break; - case PST_BOTTOM_RIGHT: - segment_rect = vec4(br_inner, br_outer - br_inner); - break; - case PST_BOTTOM_LEFT: - segment_rect = vec4(bl_outer.x, - bl_inner.y, - bl_inner.x - bl_outer.x, - bl_outer.y - bl_inner.y); - break; - case PST_LEFT: - segment_rect = vec4(tl_outer.x, - tl_inner.y, - border.widths.x, - bl_inner.y - tl_inner.y); - break; - case PST_RIGHT: - segment_rect = vec4(tr_outer.x - border.widths.z, - tr_inner.y, - border.widths.z, - br_inner.y - tr_inner.y); - break; - case PST_BOTTOM: - segment_rect = vec4(bl_inner.x, - bl_outer.y - border.widths.w, - br_inner.x - bl_inner.x, - border.widths.w); - break; - case PST_TOP: - segment_rect = vec4(tl_inner.x, - tl_outer.y, - tr_inner.x - tl_inner.x, - border.widths.y); - break; - } - -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalPos = vi.local_pos; - - // Local space - vLocalRect = vi.clipped_local_rect; -#else - VertexInfo vi = write_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalPos = vi.local_clamped_pos.xy; - - // Local space - vLocalRect = prim.local_rect; -#endif - - switch (sub_part) { - case PST_LEFT: - vBorderStyle = int(border.style.x); - vHorizontalColor = border.colors[BORDER_LEFT]; - vVerticalColor = border.colors[BORDER_LEFT]; - vRadii = vec4(0.0); - break; - case PST_TOP_LEFT: - vBorderStyle = int(border.style.x); - vHorizontalColor = border.colors[BORDER_LEFT]; - vVerticalColor = border.colors[BORDER_TOP]; - vRadii = vec4(border.radii[0].xy, - border.radii[0].xy - border.widths.xy); - break; - case PST_TOP: - vBorderStyle = int(border.style.y); - vHorizontalColor = border.colors[BORDER_TOP]; - vVerticalColor = border.colors[BORDER_TOP]; - vRadii = vec4(0.0); - break; - case PST_TOP_RIGHT: - vBorderStyle = int(border.style.y); - vHorizontalColor = border.colors[BORDER_TOP]; - vVerticalColor = border.colors[BORDER_RIGHT]; - vRadii = vec4(border.radii[0].zw, - border.radii[0].zw - border.widths.zy); - break; - case PST_RIGHT: - vBorderStyle = int(border.style.z); - vHorizontalColor = border.colors[BORDER_RIGHT]; - vVerticalColor = border.colors[BORDER_RIGHT]; - vRadii = vec4(0.0); - break; - case PST_BOTTOM_RIGHT: - vBorderStyle = int(border.style.z); - vHorizontalColor = border.colors[BORDER_BOTTOM]; - vVerticalColor = border.colors[BORDER_RIGHT]; - vRadii = vec4(border.radii[1].xy, - border.radii[1].xy - border.widths.zw); - break; - case PST_BOTTOM: - vBorderStyle = int(border.style.w); - vHorizontalColor = border.colors[BORDER_BOTTOM]; - vVerticalColor = border.colors[BORDER_BOTTOM]; - vRadii = vec4(0.0); - break; - case PST_BOTTOM_LEFT: - vBorderStyle = int(border.style.w); - vHorizontalColor = border.colors[BORDER_BOTTOM]; - vVerticalColor = border.colors[BORDER_LEFT]; - vRadii = vec4(border.radii[1].zw, - border.radii[1].zw - border.widths.xw); - break; - } - - float x0, y0, x1, y1; - switch (sub_part) { - // These are the layer tile part PrimitivePart as uploaded by the tiling.rs - case PST_TOP_LEFT: - x0 = segment_rect.x; - y0 = segment_rect.y; - // These are width / heights - x1 = segment_rect.x + segment_rect.z; - y1 = segment_rect.y + segment_rect.w; - - // The radius here is the border-radius. This is 0, so vRefPoint will - // just be the top left (x,y) corner. - vRefPoint = vec2(x0, y0) + vRadii.xy; - break; - case PST_TOP_RIGHT: - x0 = segment_rect.x + segment_rect.z; - y0 = segment_rect.y; - x1 = segment_rect.x; - y1 = segment_rect.y + segment_rect.w; - vRefPoint = vec2(x0, y0) + vec2(-vRadii.x, vRadii.y); - break; - case PST_BOTTOM_LEFT: - x0 = segment_rect.x; - y0 = segment_rect.y + segment_rect.w; - x1 = segment_rect.x + segment_rect.z; - y1 = segment_rect.y; - vRefPoint = vec2(x0, y0) + vec2(vRadii.x, -vRadii.y); - break; - case PST_BOTTOM_RIGHT: - x0 = segment_rect.x; - y0 = segment_rect.y; - x1 = segment_rect.x + segment_rect.z; - y1 = segment_rect.y + segment_rect.w; - vRefPoint = vec2(x1, y1) + vec2(-vRadii.x, -vRadii.y); - break; - case PST_TOP: - case PST_LEFT: - case PST_BOTTOM: - case PST_RIGHT: - vRefPoint = segment_rect.xy; - x0 = segment_rect.x; - y0 = segment_rect.y; - x1 = segment_rect.x + segment_rect.z; - y1 = segment_rect.y + segment_rect.w; - break; - } - - // y1 - y0 is the height of the corner / line - // x1 - x0 is the width of the corner / line. - float width = x1 - x0; - float height = y1 - y0; - - vBorderPart = sub_part; - vPieceRect = vec4(x0, y0, width, height); - - // The fragment shader needs to calculate the distance from the bisecting line - // to properly mix border colors. For transformed borders, we calculate this distance - // in the fragment shader itself. For non-transformed borders, we can use the - // interpolator. -#ifdef WR_FEATURE_TRANSFORM - vPieceRectHypotenuseLength = sqrt(pow(width, 2.0) + pow(height, 2.0)); -#else - vDistanceFromMixLine = (vi.local_clamped_pos.x - x0) * height - - (vi.local_clamped_pos.y - y0) * width; -#endif -} diff --git a/resources/shaders/ps_box_shadow.fs.glsl b/resources/shaders/ps_box_shadow.fs.glsl deleted file mode 100644 index 8392ab698be..00000000000 --- a/resources/shaders/ps_box_shadow.fs.glsl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - vec2 uv = min(vec2(1.0), vMirrorPoint - abs(vUv.xy - vMirrorPoint)); - uv = mix(vCacheUvRectCoords.xy, vCacheUvRectCoords.zw, uv); - oFragColor = vColor * texture(sCache, vec3(uv, vUv.z)); -} diff --git a/resources/shaders/ps_box_shadow.glsl b/resources/shaders/ps_box_shadow.glsl deleted file mode 100644 index 40faee87f58..00000000000 --- a/resources/shaders/ps_box_shadow.glsl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -flat varying vec4 vColor; - -varying vec3 vUv; -flat varying vec2 vMirrorPoint; -flat varying vec4 vCacheUvRectCoords; diff --git a/resources/shaders/ps_box_shadow.vs.glsl b/resources/shaders/ps_box_shadow.vs.glsl deleted file mode 100644 index 6b45af72d65..00000000000 --- a/resources/shaders/ps_box_shadow.vs.glsl +++ /dev/null @@ -1,31 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - BoxShadow bs = fetch_boxshadow(prim.prim_index); - vec4 segment_rect = fetch_instance_geometry(prim.sub_index); - - VertexInfo vi = write_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - - RenderTaskData child_task = fetch_render_task(prim.user_data.x); - vUv.z = child_task.data1.x; - - // Constant offsets to inset from bilinear filtering border. - vec2 patch_origin = child_task.data0.xy + vec2(1.0); - vec2 patch_size_device_pixels = child_task.data0.zw - vec2(2.0); - vec2 patch_size = patch_size_device_pixels / uDevicePixelRatio; - - vUv.xy = (vi.local_clamped_pos - prim.local_rect.xy) / patch_size; - vMirrorPoint = 0.5 * prim.local_rect.zw / patch_size; - - vec2 texture_size = vec2(textureSize(sCache, 0)); - vCacheUvRectCoords = vec4(patch_origin, patch_origin + patch_size_device_pixels) / texture_size.xyxy; - - vColor = bs.color; -} diff --git a/resources/shaders/ps_cache_image.fs.glsl b/resources/shaders/ps_cache_image.fs.glsl deleted file mode 100644 index 36ab69e3136..00000000000 --- a/resources/shaders/ps_cache_image.fs.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - oFragColor = texture(sCache, vUv); -} diff --git a/resources/shaders/ps_cache_image.glsl b/resources/shaders/ps_cache_image.glsl deleted file mode 100644 index a5930ae066d..00000000000 --- a/resources/shaders/ps_cache_image.glsl +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec3 vUv; diff --git a/resources/shaders/ps_cache_image.vs.glsl b/resources/shaders/ps_cache_image.vs.glsl deleted file mode 100644 index 57e380bbbed..00000000000 --- a/resources/shaders/ps_cache_image.vs.glsl +++ /dev/null @@ -1,27 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// Draw a cached primitive (e.g. a blurred text run) from the -// target cache to the framebuffer, applying tile clip boundaries. - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - - VertexInfo vi = write_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - - RenderTaskData child_task = fetch_render_task(prim.user_data.x); - vUv.z = child_task.data1.x; - - vec2 texture_size = vec2(textureSize(sCache, 0)); - vec2 uv0 = child_task.data0.xy / texture_size; - vec2 uv1 = (child_task.data0.xy + child_task.data0.zw) / texture_size; - - vec2 f = (vi.local_clamped_pos - prim.local_rect.xy) / prim.local_rect.zw; - - vUv.xy = mix(uv0, uv1, f); -} diff --git a/resources/shaders/ps_clear.fs.glsl b/resources/shaders/ps_clear.fs.glsl deleted file mode 100644 index 5ad3065f78d..00000000000 --- a/resources/shaders/ps_clear.fs.glsl +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - oFragColor = vec4(1, 1, 1, 1); -} diff --git a/resources/shaders/ps_clear.glsl b/resources/shaders/ps_clear.glsl deleted file mode 100644 index e0032240a4d..00000000000 --- a/resources/shaders/ps_clear.glsl +++ /dev/null @@ -1,3 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/resources/shaders/ps_clear.vs.glsl b/resources/shaders/ps_clear.vs.glsl deleted file mode 100644 index 37c941b092b..00000000000 --- a/resources/shaders/ps_clear.vs.glsl +++ /dev/null @@ -1,16 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -layout(std140) uniform Data { - uvec4 data[WR_MAX_UBO_VECTORS]; -}; - -void main() { - vec4 rect = vec4(data[gl_InstanceID]); - - vec4 pos = vec4(mix(rect.xy, rect.xy + rect.zw, aPosition.xy), 0, 1); - gl_Position = uTransform * pos; -} diff --git a/resources/shaders/ps_composite.fs.glsl b/resources/shaders/ps_composite.fs.glsl deleted file mode 100644 index 3b6606c880e..00000000000 --- a/resources/shaders/ps_composite.fs.glsl +++ /dev/null @@ -1,216 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -float gauss(float x, float sigma) { - if (sigma == 0.0) - return 1.0; - return (1.0 / sqrt(6.283185307179586 * sigma * sigma)) * exp(-(x * x) / (2.0 * sigma * sigma)); -} - -vec3 Multiply(vec3 Cb, vec3 Cs) { - return Cb * Cs; -} - -vec3 Screen(vec3 Cb, vec3 Cs) { - return Cb + Cs - (Cb * Cs); -} - -vec3 HardLight(vec3 Cb, vec3 Cs) { - vec3 m = Multiply(Cb, 2.0 * Cs); - vec3 s = Screen(Cb, 2.0 * Cs - 1.0); - vec3 edge = vec3(0.5, 0.5, 0.5); - return mix(m, s, step(edge, Cs)); -} - -// TODO: Worth doing with mix/step? Check GLSL output. -float ColorDodge(float Cb, float Cs) { - if (Cb == 0.0) - return 0.0; - else if (Cs == 1.0) - return 1.0; - else - return min(1.0, Cb / (1.0 - Cs)); -} - -// TODO: Worth doing with mix/step? Check GLSL output. -float ColorBurn(float Cb, float Cs) { - if (Cb == 1.0) - return 1.0; - else if (Cs == 0.0) - return 0.0; - else - return 1.0 - min(1.0, (1.0 - Cb) / Cs); -} - -float SoftLight(float Cb, float Cs) { - if (Cs <= 0.5) { - return Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb); - } else { - float D; - - if (Cb <= 0.25) - D = ((16.0 * Cb - 12.0) * Cb + 4.0) * Cb; - else - D = sqrt(Cb); - - return Cb + (2.0 * Cs - 1.0) * (D - Cb); - } -} - -vec3 Difference(vec3 Cb, vec3 Cs) { - return abs(Cb - Cs); -} - -vec3 Exclusion(vec3 Cb, vec3 Cs) { - return Cb + Cs - 2.0 * Cb * Cs; -} - -// These functions below are taken from the spec. -// There's probably a much quicker way to implement -// them in GLSL... -float Sat(vec3 c) { - return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); -} - -float Lum(vec3 c) { - vec3 f = vec3(0.3, 0.59, 0.11); - return dot(c, f); -} - -vec3 ClipColor(vec3 C) { - float L = Lum(C); - float n = min(C.r, min(C.g, C.b)); - float x = max(C.r, max(C.g, C.b)); - - if (n < 0.0) - C = L + (((C - L) * L) / (L - n)); - - if (x > 1.0) - C = L + (((C - L) * (1.0 - L)) / (x - L)); - - return C; -} - -vec3 SetLum(vec3 C, float l) { - float d = l - Lum(C); - return ClipColor(C + d); -} - -void SetSatInner(inout float Cmin, inout float Cmid, inout float Cmax, float s) { - if (Cmax > Cmin) { - Cmid = (((Cmid - Cmin) * s) / (Cmax - Cmin)); - Cmax = s; - } else { - Cmid = 0.0; - Cmax = 0.0; - } - Cmin = 0.0; -} - -vec3 SetSat(vec3 C, float s) { - if (C.r <= C.g) { - if (C.g <= C.b) { - SetSatInner(C.r, C.g, C.b, s); - } else { - if (C.r <= C.b) { - SetSatInner(C.r, C.b, C.g, s); - } else { - SetSatInner(C.b, C.r, C.g, s); - } - } - } else { - if (C.r <= C.b) { - SetSatInner(C.g, C.r, C.b, s); - } else { - if (C.g <= C.b) { - SetSatInner(C.g, C.b, C.r, s); - } else { - SetSatInner(C.b, C.g, C.r, s); - } - } - } - return C; -} - -vec3 Hue(vec3 Cb, vec3 Cs) { - return SetLum(SetSat(Cs, Sat(Cb)), Lum(Cb)); -} - -vec3 Saturation(vec3 Cb, vec3 Cs) { - return SetLum(SetSat(Cb, Sat(Cs)), Lum(Cb)); -} - -vec3 Color(vec3 Cb, vec3 Cs) { - return SetLum(Cs, Lum(Cb)); -} - -vec3 Luminosity(vec3 Cb, vec3 Cs) { - return SetLum(Cb, Lum(Cs)); -} - -void main(void) { - vec4 Cb = texture(sCache, vUv0); - - if (vUv1.x < vUv1Rect.x || - vUv1.x > vUv1Rect.z || - vUv1.y < vUv1Rect.y || - vUv1.y > vUv1Rect.w) { - oFragColor = Cb; - return; - } - - vec4 Cs = texture(sCache, vUv1); - - // Return yellow if none of the branches match (shouldn't happen). - vec4 result = vec4(1.0, 1.0, 0.0, 1.0); - - switch (vOp) { - case 2: - result.rgb = Screen(Cb.rgb, Cs.rgb); - break; - case 3: - result.rgb = HardLight(Cs.rgb, Cb.rgb); // Overlay is inverse of Hardlight - break; - case 6: - result.r = ColorDodge(Cb.r, Cs.r); - result.g = ColorDodge(Cb.g, Cs.g); - result.b = ColorDodge(Cb.b, Cs.b); - break; - case 7: - result.r = ColorBurn(Cb.r, Cs.r); - result.g = ColorBurn(Cb.g, Cs.g); - result.b = ColorBurn(Cb.b, Cs.b); - break; - case 8: - result.rgb = HardLight(Cb.rgb, Cs.rgb); - break; - case 9: - result.r = SoftLight(Cb.r, Cs.r); - result.g = SoftLight(Cb.g, Cs.g); - result.b = SoftLight(Cb.b, Cs.b); - break; - case 10: - result.rgb = Difference(Cb.rgb, Cs.rgb); - break; - case 11: - result.rgb = Exclusion(Cb.rgb, Cs.rgb); - break; - case 12: - result.rgb = Hue(Cb.rgb, Cs.rgb); - break; - case 13: - result.rgb = Saturation(Cb.rgb, Cs.rgb); - break; - case 14: - result.rgb = Color(Cb.rgb, Cs.rgb); - break; - case 15: - result.rgb = Luminosity(Cb.rgb, Cs.rgb); - break; - } - - oFragColor = result; -} diff --git a/resources/shaders/ps_composite.glsl b/resources/shaders/ps_composite.glsl deleted file mode 100644 index d2a1310d59b..00000000000 --- a/resources/shaders/ps_composite.glsl +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec3 vUv0; -varying vec3 vUv1; -flat varying vec4 vUv1Rect; -flat varying int vOp; diff --git a/resources/shaders/ps_composite.vs.glsl b/resources/shaders/ps_composite.vs.glsl deleted file mode 100644 index 2af03286cc6..00000000000 --- a/resources/shaders/ps_composite.vs.glsl +++ /dev/null @@ -1,33 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Composite composite = fetch_composite(gl_InstanceID); - Tile src0 = fetch_tile(composite.src0_src1_target_id_op.x); - Tile src1 = fetch_tile(composite.src0_src1_target_id_op.y); - Tile dest = fetch_tile(composite.src0_src1_target_id_op.z); - - vec2 local_pos = mix(dest.screen_origin_task_origin.zw, - dest.screen_origin_task_origin.zw + dest.size_target_index.xy, - aPosition.xy); - - vec2 texture_size = vec2(textureSize(sCache, 0)); - vec2 st0 = src0.screen_origin_task_origin.zw / texture_size; - vec2 st1 = (src0.screen_origin_task_origin.zw + src0.size_target_index.xy) / texture_size; - vUv0 = vec3(mix(st0, st1, aPosition.xy), src0.size_target_index.z); - - st0 = vec2(src1.screen_origin_task_origin.zw) / texture_size; - st1 = vec2(src1.screen_origin_task_origin.zw + src1.size_target_index.xy) / texture_size; - vec2 local_virtual_pos = mix(dest.screen_origin_task_origin.xy, - dest.screen_origin_task_origin.xy + dest.size_target_index.xy, - aPosition.xy); - vec2 f = (local_virtual_pos - src1.screen_origin_task_origin.xy) / src1.size_target_index.xy; - vUv1 = vec3(mix(st0, st1, f), src1.size_target_index.z); - vUv1Rect = vec4(st0, st1); - - vOp = composite.src0_src1_target_id_op.w; - - gl_Position = uTransform * vec4(local_pos, 0, 1); -} diff --git a/resources/shaders/ps_gradient.fs.glsl b/resources/shaders/ps_gradient.fs.glsl deleted file mode 100644 index 512d3d1db62..00000000000 --- a/resources/shaders/ps_gradient.fs.glsl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { -#ifdef WR_FEATURE_TRANSFORM - float alpha = 0.0; - vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha); -#else - float alpha = 1.0; - vec2 local_pos = vPos; -#endif - - oFragColor = vColor * vec4(1, 1, 1, alpha); -} diff --git a/resources/shaders/ps_gradient.glsl b/resources/shaders/ps_gradient.glsl deleted file mode 100644 index e1d18453633..00000000000 --- a/resources/shaders/ps_gradient.glsl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec4 vColor; - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; -flat varying vec4 vLocalRect; -#else -varying vec2 vPos; -#endif diff --git a/resources/shaders/ps_gradient.vs.glsl b/resources/shaders/ps_gradient.vs.glsl deleted file mode 100644 index a5e6bb0f3d4..00000000000 --- a/resources/shaders/ps_gradient.vs.glsl +++ /dev/null @@ -1,68 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Gradient gradient = fetch_gradient(prim.prim_index); - - GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0); - GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1); - - vec4 segment_rect; - switch (int(gradient.kind.x)) { - case GRADIENT_HORIZONTAL: - float x0 = mix(gradient.start_end_point.x, - gradient.start_end_point.z, - g0.offset.x); - float x1 = mix(gradient.start_end_point.x, - gradient.start_end_point.z, - g1.offset.x); - segment_rect.yw = prim.local_rect.yw; - segment_rect.x = x0; - segment_rect.z = x1 - x0; - break; - case GRADIENT_VERTICAL: - float y0 = mix(gradient.start_end_point.y, - gradient.start_end_point.w, - g0.offset.x); - float y1 = mix(gradient.start_end_point.y, - gradient.start_end_point.w, - g1.offset.x); - segment_rect.xz = prim.local_rect.xz; - segment_rect.y = y0; - segment_rect.w = y1 - y0; - break; - } - -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vLocalPos = vi.local_pos; - vec2 f = (vi.local_pos.xy - prim.local_rect.xy) / prim.local_rect.zw; -#else - VertexInfo vi = write_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - - vec2 f = (vi.local_clamped_pos - segment_rect.xy) / segment_rect.zw; - vPos = vi.local_clamped_pos; -#endif - - switch (int(gradient.kind.x)) { - case GRADIENT_HORIZONTAL: - vColor = mix(g0.color, g1.color, f.x); - break; - case GRADIENT_VERTICAL: - vColor = mix(g0.color, g1.color, f.y); - break; - case GRADIENT_ROTATED: - vColor = vec4(1.0, 0.0, 1.0, 1.0); - break; - } -} diff --git a/resources/shaders/ps_gradient_clip.fs.glsl b/resources/shaders/ps_gradient_clip.fs.glsl deleted file mode 100644 index c99c6e55d6a..00000000000 --- a/resources/shaders/ps_gradient_clip.fs.glsl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { -#ifdef WR_FEATURE_TRANSFORM - float alpha = 0.0; - vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha); -#else - float alpha = 1.0; - vec2 local_pos = vPos; -#endif - - alpha = min(alpha, do_clip(local_pos)); - oFragColor = vColor * vec4(1, 1, 1, alpha); -} diff --git a/resources/shaders/ps_gradient_clip.glsl b/resources/shaders/ps_gradient_clip.glsl deleted file mode 100644 index e1d18453633..00000000000 --- a/resources/shaders/ps_gradient_clip.glsl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec4 vColor; - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; -flat varying vec4 vLocalRect; -#else -varying vec2 vPos; -#endif diff --git a/resources/shaders/ps_gradient_clip.vs.glsl b/resources/shaders/ps_gradient_clip.vs.glsl deleted file mode 100644 index 8c20dfdbfa4..00000000000 --- a/resources/shaders/ps_gradient_clip.vs.glsl +++ /dev/null @@ -1,71 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Gradient gradient = fetch_gradient(prim.prim_index); - - GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0); - GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1); - - vec4 segment_rect; - switch (int(gradient.kind.x)) { - case GRADIENT_HORIZONTAL: - float x0 = mix(gradient.start_end_point.x, - gradient.start_end_point.z, - g0.offset.x); - float x1 = mix(gradient.start_end_point.x, - gradient.start_end_point.z, - g1.offset.x); - segment_rect.yw = prim.local_rect.yw; - segment_rect.x = x0; - segment_rect.z = x1 - x0; - break; - case GRADIENT_VERTICAL: - float y0 = mix(gradient.start_end_point.y, - gradient.start_end_point.w, - g0.offset.x); - float y1 = mix(gradient.start_end_point.y, - gradient.start_end_point.w, - g1.offset.x); - segment_rect.xz = prim.local_rect.xz; - segment_rect.y = y0; - segment_rect.w = y1 - y0; - break; - } - -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vLocalPos = vi.local_pos; - vec2 f = (vi.local_pos.xy - prim.local_rect.xy) / prim.local_rect.zw; -#else - VertexInfo vi = write_vertex(segment_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - - vec2 f = (vi.local_clamped_pos - segment_rect.xy) / segment_rect.zw; - vPos = vi.local_clamped_pos; -#endif - - switch (int(gradient.kind.x)) { - case GRADIENT_HORIZONTAL: - vColor = mix(g0.color, g1.color, f.x); - break; - case GRADIENT_VERTICAL: - vColor = mix(g0.color, g1.color, f.y); - break; - case GRADIENT_ROTATED: - vColor = vec4(1.0, 0.0, 1.0, 1.0); - break; - } - - ClipData clip = fetch_clip(prim.clip_index); - write_clip(clip); -} diff --git a/resources/shaders/ps_image.fs.glsl b/resources/shaders/ps_image.fs.glsl deleted file mode 100644 index f425fb33988..00000000000 --- a/resources/shaders/ps_image.fs.glsl +++ /dev/null @@ -1,29 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { -#ifdef WR_FEATURE_TRANSFORM - float alpha = 0.0; - vec2 pos = init_transform_fs(vLocalPos, vLocalRect, alpha); - - // We clamp the texture coordinate calculation here to the local rectangle boundaries, - // which makes the edge of the texture stretch instead of repeat. - vec2 relative_pos_in_rect = - clamp(pos, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw) - vLocalRect.xy; -#else - float alpha = 1.0;; - vec2 relative_pos_in_rect = vLocalPos; -#endif - - // We calculate the particular tile this fragment belongs to, taking into - // account the spacing in between tiles. We only paint if our fragment does - // not fall into that spacing. - vec2 position_in_tile = mod(relative_pos_in_rect, vStretchSize + vTileSpacing); - vec2 st = vTextureOffset + ((position_in_tile / vStretchSize) * vTextureSize); - alpha = alpha * float(all(bvec2(step(position_in_tile, vStretchSize)))); - - oFragColor = vec4(1, 1, 1, alpha) * texture(sColor0, st); -} diff --git a/resources/shaders/ps_image.glsl b/resources/shaders/ps_image.glsl deleted file mode 100644 index 0ca0ac57211..00000000000 --- a/resources/shaders/ps_image.glsl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -flat varying vec2 vTextureOffset; // Offset of this image into the texture atlas. -flat varying vec2 vTextureSize; // Size of the image in the texture atlas. -flat varying vec2 vTileSpacing; // Amount of space between tiled instances of this image. - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; -flat varying vec4 vLocalRect; -flat varying vec2 vStretchSize; -#else -varying vec2 vLocalPos; -flat varying vec2 vStretchSize; -#endif diff --git a/resources/shaders/ps_image.vs.glsl b/resources/shaders/ps_image.vs.glsl deleted file mode 100644 index a3eb7808e56..00000000000 --- a/resources/shaders/ps_image.vs.glsl +++ /dev/null @@ -1,34 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Image image = fetch_image(prim.prim_index); - -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vLocalPos = vi.local_pos; -#else - VertexInfo vi = write_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalPos = vi.local_clamped_pos - vi.local_rect.p0; -#endif - - // vUv will contain how many times this image has wrapped around the image size. - vec2 texture_size = vec2(textureSize(sColor0, 0)); - vec2 st0 = image.st_rect.xy / texture_size; - vec2 st1 = image.st_rect.zw / texture_size; - - vTextureSize = st1 - st0; - vTextureOffset = st0; - vTileSpacing = image.stretch_size_and_tile_spacing.zw; - vStretchSize = image.stretch_size_and_tile_spacing.xy; -} diff --git a/resources/shaders/ps_image_clip.fs.glsl b/resources/shaders/ps_image_clip.fs.glsl deleted file mode 100644 index 5d48c94b838..00000000000 --- a/resources/shaders/ps_image_clip.fs.glsl +++ /dev/null @@ -1,32 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { -#ifdef WR_FEATURE_TRANSFORM - float alpha = 1.f; - vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha); - - // We clamp the texture coordinate calculation here to the local rectangle boundaries, - // which makes the edge of the texture stretch instead of repeat. - vec2 relative_pos_in_rect = - clamp(local_pos, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw) - vLocalRect.xy; -#else - float alpha = 1.f; - vec2 local_pos = vLocalPos; - vec2 relative_pos_in_rect = vLocalPos - vLocalRect.xy; -#endif - - alpha = min(alpha, do_clip(local_pos)); - - // We calculate the particular tile this fragment belongs to, taking into - // account the spacing in between tiles. We only paint if our fragment does - // not fall into that spacing. - vec2 position_in_tile = mod(relative_pos_in_rect, vStretchSize + vTileSpacing); - vec2 st = vTextureOffset + ((position_in_tile / vStretchSize) * vTextureSize); - alpha = alpha * float(all(bvec2(step(position_in_tile, vStretchSize)))); - - oFragColor = texture(sColor0, st) * vec4(1, 1, 1, alpha); -} diff --git a/resources/shaders/ps_image_clip.glsl b/resources/shaders/ps_image_clip.glsl deleted file mode 100644 index 20c0343182e..00000000000 --- a/resources/shaders/ps_image_clip.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -flat varying vec2 vTextureOffset; // Offset of this image into the texture atlas. -flat varying vec2 vTextureSize; // Size of the image in the texture atlas. -flat varying vec2 vTileSpacing; // Amount of space between tiled instances of this image. -flat varying vec2 vStretchSize; -flat varying vec4 vLocalRect; - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; -#else -varying vec2 vLocalPos; -varying vec2 vUv; // Location within the CSS box to draw. -#endif diff --git a/resources/shaders/ps_image_clip.vs.glsl b/resources/shaders/ps_image_clip.vs.glsl deleted file mode 100644 index bfbf54bc857..00000000000 --- a/resources/shaders/ps_image_clip.vs.glsl +++ /dev/null @@ -1,38 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Image image = fetch_image(prim.prim_index); - -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vLocalPos = vi.local_pos; -#else - VertexInfo vi = write_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = prim.local_rect; - vLocalPos = vi.local_clamped_pos; -#endif - - ClipData clip = fetch_clip(prim.clip_index); - write_clip(clip); - - // vUv will contain how many times this image has wrapped around the image size. - vec2 texture_size = vec2(textureSize(sColor0, 0)); - vec2 st0 = image.st_rect.xy / texture_size; - vec2 st1 = image.st_rect.zw / texture_size; - - vTextureSize = st1 - st0; - vTextureOffset = st0; - vTileSpacing = image.stretch_size_and_tile_spacing.zw; - vStretchSize = image.stretch_size_and_tile_spacing.xy; -} diff --git a/resources/shaders/ps_rectangle.fs.glsl b/resources/shaders/ps_rectangle.fs.glsl deleted file mode 100644 index d65fe2581d4..00000000000 --- a/resources/shaders/ps_rectangle.fs.glsl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { -#ifdef WR_FEATURE_TRANSFORM - float alpha = 0.0; - init_transform_fs(vLocalPos, vLocalRect, alpha); - oFragColor = vec4(1, 1, 1, alpha) * vColor; -#else - oFragColor = vColor; -#endif -} diff --git a/resources/shaders/ps_rectangle.glsl b/resources/shaders/ps_rectangle.glsl deleted file mode 100644 index eb8c99226bf..00000000000 --- a/resources/shaders/ps_rectangle.glsl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec4 vColor; - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; -flat varying vec4 vLocalRect; -#endif diff --git a/resources/shaders/ps_rectangle.vs.glsl b/resources/shaders/ps_rectangle.vs.glsl deleted file mode 100644 index 0c886b6fc4e..00000000000 --- a/resources/shaders/ps_rectangle.vs.glsl +++ /dev/null @@ -1,23 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Rectangle rect = fetch_rectangle(prim.prim_index); - vColor = rect.color; -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vLocalPos = vi.local_pos; -#else - write_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); -#endif -} diff --git a/resources/shaders/ps_rectangle_clip.fs.glsl b/resources/shaders/ps_rectangle_clip.fs.glsl deleted file mode 100644 index cca1841d4b1..00000000000 --- a/resources/shaders/ps_rectangle_clip.fs.glsl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - float alpha = 1.f; -#ifdef WR_FEATURE_TRANSFORM - vec2 local_pos = init_transform_fs(vPos, vLocalRect, alpha); -#else - vec2 local_pos = vPos; -#endif - - alpha = min(alpha, do_clip(local_pos)); - oFragColor = vColor * vec4(1, 1, 1, alpha); -} diff --git a/resources/shaders/ps_rectangle_clip.glsl b/resources/shaders/ps_rectangle_clip.glsl deleted file mode 100644 index abd4a6cc5e8..00000000000 --- a/resources/shaders/ps_rectangle_clip.glsl +++ /dev/null @@ -1,14 +0,0 @@ -#line 1 - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -varying vec4 vColor; - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vPos; -flat varying vec4 vLocalRect; -#else -varying vec2 vPos; -#endif diff --git a/resources/shaders/ps_rectangle_clip.vs.glsl b/resources/shaders/ps_rectangle_clip.vs.glsl deleted file mode 100644 index 1cc281ac61c..00000000000 --- a/resources/shaders/ps_rectangle_clip.vs.glsl +++ /dev/null @@ -1,27 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - Rectangle rect = fetch_rectangle(prim.prim_index); - vColor = rect.color; -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vPos = vi.local_pos; -#else - VertexInfo vi = write_vertex(prim.local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vPos = vi.local_clamped_pos; -#endif - - ClipData clip = fetch_clip(prim.clip_index); - write_clip(clip); -} diff --git a/resources/shaders/ps_text_run.fs.glsl b/resources/shaders/ps_text_run.fs.glsl deleted file mode 100644 index a3dcacced46..00000000000 --- a/resources/shaders/ps_text_run.fs.glsl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { -#ifdef WR_FEATURE_SUBPIXEL_AA - oFragColor = texture(sColor0, vUv); -#else - float a = texture(sColor0, vUv).a; -#ifdef WR_FEATURE_TRANSFORM - float alpha = 0.0; - init_transform_fs(vLocalPos, vLocalRect, alpha); - a *= alpha; -#endif - oFragColor = vec4(vColor.rgb, vColor.a * a); -#endif -} diff --git a/resources/shaders/ps_text_run.glsl b/resources/shaders/ps_text_run.glsl deleted file mode 100644 index d58ff7d14bb..00000000000 --- a/resources/shaders/ps_text_run.glsl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -flat varying vec4 vColor; -varying vec2 vUv; - -#ifdef WR_FEATURE_TRANSFORM -varying vec3 vLocalPos; -flat varying vec4 vLocalRect; -#endif diff --git a/resources/shaders/ps_text_run.vs.glsl b/resources/shaders/ps_text_run.vs.glsl deleted file mode 100644 index 9adfbffc76b..00000000000 --- a/resources/shaders/ps_text_run.vs.glsl +++ /dev/null @@ -1,34 +0,0 @@ -#line 1 -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void main(void) { - Primitive prim = load_primitive(gl_InstanceID); - TextRun text = fetch_text_run(prim.prim_index); - Glyph glyph = fetch_glyph(prim.sub_index); - vec4 local_rect = vec4(glyph.offset.xy, (glyph.uv_rect.zw - glyph.uv_rect.xy) / uDevicePixelRatio); - -#ifdef WR_FEATURE_TRANSFORM - TransformVertexInfo vi = write_transform_vertex(local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vLocalRect = vi.clipped_local_rect; - vLocalPos = vi.local_pos; - vec2 f = (vi.local_pos.xy / vi.local_pos.z - local_rect.xy) / local_rect.zw; -#else - VertexInfo vi = write_vertex(local_rect, - prim.local_clip_rect, - prim.layer, - prim.tile); - vec2 f = (vi.local_clamped_pos - vi.local_rect.p0) / (vi.local_rect.p1 - vi.local_rect.p0); -#endif - - vec2 texture_size = vec2(textureSize(sColor0, 0)); - vec2 st0 = glyph.uv_rect.xy / texture_size; - vec2 st1 = glyph.uv_rect.zw / texture_size; - - vColor = text.color; - vUv = mix(st0, st1, f); -} diff --git a/resources/shaders/shared.glsl b/resources/shaders/shared.glsl deleted file mode 100644 index f250a709c6d..00000000000 --- a/resources/shaders/shared.glsl +++ /dev/null @@ -1,51 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//====================================================================================== -// Vertex shader attributes and uniforms -//====================================================================================== -#ifdef WR_VERTEX_SHADER - #define varying out - - // Uniform inputs - uniform mat4 uTransform; // Orthographic projection - uniform float uDevicePixelRatio; - - // Attribute inputs - in vec3 aPosition; -#endif - -//====================================================================================== -// Fragment shader attributes and uniforms -//====================================================================================== -#ifdef WR_FRAGMENT_SHADER - precision highp float; - - #define varying in - - // Uniform inputs - - // Fragment shader outputs - out vec4 oFragColor; -#endif - -//====================================================================================== -// Shared shader uniforms -//====================================================================================== -uniform sampler2D sColor0; -uniform sampler2D sColor1; -uniform sampler2D sColor2; -uniform sampler2D sMask; - -//====================================================================================== -// Interpolator definitions -//====================================================================================== - -//====================================================================================== -// VS only types and UBOs -//====================================================================================== - -//====================================================================================== -// VS only functions -//====================================================================================== diff --git a/resources/shaders/shared_other.glsl b/resources/shaders/shared_other.glsl deleted file mode 100644 index c6f8286b6f8..00000000000 --- a/resources/shaders/shared_other.glsl +++ /dev/null @@ -1,64 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//====================================================================================== -// Vertex shader attributes and uniforms -//====================================================================================== -#ifdef WR_VERTEX_SHADER - in vec4 aColorTexCoordRectTop; - in vec4 aColorRectTL; - - // box-shadow - in vec4 aBorderPosition; - in vec4 aBorderRadii; - in float aBlurRadius; - - // blur - in vec2 aDestTextureSize; - in vec2 aSourceTextureSize; -#endif - -//====================================================================================== -// Fragment shader attributes and uniforms -//====================================================================================== -#ifdef WR_FRAGMENT_SHADER - uniform vec2 uDirection; -#endif - -//====================================================================================== -// Interpolator definitions -//====================================================================================== - -// Hacks to be removed (needed for text etc) -varying vec2 vColorTexCoord; -varying vec4 vColor; - -// box_shadow -varying vec2 vPosition; -varying vec4 vBorderPosition; -varying vec4 vBorderRadii; -varying float vBlurRadius; - -// blur -varying vec2 vSourceTextureSize; -varying vec2 vDestTextureSize; - -//====================================================================================== -// VS only types and UBOs -//====================================================================================== - -//====================================================================================== -// VS only functions -//====================================================================================== - -//====================================================================================== -// FS only functions -//====================================================================================== -#ifdef WR_FRAGMENT_SHADER - -void SetFragColor(vec4 color) { - oFragColor = color; -} - -#endif