Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
33fffed
Move the glutin opengl functionality out to its own module
fredizzimo Jan 20, 2023
e4cb546
Remove references to glutin
fredizzimo Jan 20, 2023
706e6bd
Pass the winit window around, not the glutin context
fredizzimo Jan 20, 2023
c102070
Integrate tracy profiler
fredizzimo Nov 14, 2022
415ecff
Add some profiling zones
fredizzimo Nov 16, 2022
d347cad
Add a profiling build profile
fredizzimo Nov 16, 2022
5a8113e
Split the grid into separate lines
fredizzimo Jan 7, 2023
d4b3ce3
Move scroll_region to the grid
fredizzimo Jan 8, 2023
eeb6107
Add some unit tests for grid scrolling
fredizzimo Jan 8, 2023
5b35ede
Use a ringbuffer to represent the grid
fredizzimo Jan 8, 2023
852de63
Draw each line as a skia picture
fredizzimo Jan 14, 2023
05f651f
Reimplement scrolling
fredizzimo Jan 15, 2023
872e161
Use simple pd controller for scrolling
fredizzimo Oct 29, 2022
f399580
Implement floating window transparency
fredizzimo Mar 5, 2023
91c0273
Optimize the foreground drawing a bit
fredizzimo Mar 5, 2023
b3a845a
Use pixel scroll offsets
fredizzimo Mar 11, 2023
984e398
Merge branch 'fsundvik/fix-nvim-detection' into HEAD
fredizzimo Mar 4, 2023
9f77a20
Merge branch 'fsundvik/remove-glutin-refs' into HEAD
fredizzimo Mar 13, 2023
8ad105d
Update Skia, enable Skia D3D on Windows
fredizzimo Jan 20, 2023
808090c
Improve the event loop
fredizzimo Oct 1, 2022
e39611c
Temp logging changes
fredizzimo Oct 5, 2022
ccd72d3
Split rendering and animation
fredizzimo Oct 2, 2022
6458040
WIP render thread
fredizzimo Nov 4, 2022
6a34822
Deal with scale factor changed events
fredizzimo Mar 19, 2023
38d8359
Remove the redraw_scheduler
fredizzimo Mar 12, 2023
60c886a
Use maximum dt timesteps for animation
fredizzimo Oct 2, 2022
339a5fb
Calculate the frame time directly after the previous frame is ready
fredizzimo Oct 30, 2022
f549059
Filter the frame dt by a moving average
fredizzimo Oct 31, 2022
f66c634
Use gr_context.flush_and_submit
fredizzimo Oct 30, 2022
766c588
Merge remote-tracking branch 'upstream/new-keyboard-v3' into HEAD
fredizzimo Mar 26, 2023
aff413b
Split up skia operations for more performance and accurate profiling
fredizzimo Jan 24, 2023
a3dce08
Add wgpu, remove glutin and use only base Skia
fredizzimo Mar 24, 2023
ef8c21e
Change types and comment out code to make it compile
fredizzimo Mar 24, 2023
9c57d79
Initialize the window
fredizzimo Mar 24, 2023
c7b9415
Start implementing wgpu renderer
fredizzimo Mar 25, 2023
90d0a2f
Actually draw something
fredizzimo Mar 25, 2023
23daf79
Create background buffers, but no rendering yet
fredizzimo Mar 25, 2023
2df068f
Render a quad
fredizzimo Mar 26, 2023
80cde68
Add a camera
fredizzimo Mar 26, 2023
4060d8d
TODO: Working background rendering
fredizzimo Mar 27, 2023
5fef692
Atlas texture WIP
fredizzimo Mar 31, 2023
2779f62
Add wr_glyph_rasterizer
fredizzimo Mar 31, 2023
d1556a9
Draw text as rectangles
fredizzimo Apr 2, 2023
797ba77
Rasterize the glyphs, but not to the atlas yet
fredizzimo Apr 5, 2023
94ac15b
Copy the glyph data to the atlas texture
fredizzimo Apr 6, 2023
bd091e6
Temporarily switch to just D3D12
fredizzimo Apr 6, 2023
fa4a352
Upload the texture data
fredizzimo Apr 6, 2023
ec8f580
Pass the glyph coordinates to the shader
fredizzimo Apr 7, 2023
1b97e07
Split up and refactor the renderer
fredizzimo Apr 7, 2023
1fddbb0
Bind the atlas texture
fredizzimo Apr 7, 2023
5a2973a
Hack some hot reloading for the glyph shaders
fredizzimo Apr 7, 2023
86a6fc4
Fix glyph loading
fredizzimo Apr 7, 2023
8b27fec
Use half coordinates for the atlas
fredizzimo Apr 7, 2023
ada30f3
Initial version of working text rendering
fredizzimo Apr 7, 2023
b630b64
Bigger atlas size
fredizzimo Apr 8, 2023
598b8e9
fix: crash on macOS
qinyuhang Apr 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,325 changes: 1,475 additions & 850 deletions Cargo.lock
100755 → 100644

Large diffs are not rendered by default.

40 changes: 26 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ members = ["neovide-derive"]
[features]
default = []
embed-fonts = []
profiling = ["dep:tracy-client-sys"]
gpu_profiling = ["profiling"]

[dependencies]
copypasta = "0.8.1"
async-trait = "0.1.53"
backtrace = "0.3.67"
cfg-if = "1.0.0"
clap = { version = "4.0.8", features = ["cargo", "derive", "env"] }
copypasta = "0.8.1"
csscolorparser = "0.6.2"
derive-new = "0.5.9"
dirs = "4.0.0"
euclid = "0.22.7"
flexi_logger = { version = "0.22.3", default-features = false }
futures = "0.3.21"
gl = "0.14.0"
glutin = { git = "https://github.com/neovide/glutin", branch = "new-keyboard-all", features = ["serde"] }
image = { version = "0.24.1", default-features = false, features = ["ico"] }
itertools = "0.10.5"
lazy_static = "1.4.0"
Expand All @@ -41,42 +42,53 @@ rand = "0.8.5"
rmpv = "1.0.0"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
simple_moving_average = "0.1.2"
swash = "0.1.4"
time = "0.3.9"
tokio = { version = "1.25.0", features = ["full"] }
tokio-util = { version = "0.7.4", features = ["compat"] }
tracy-client-sys = { version = "0.19.0", optional = true }
unicode-segmentation = "1.9.0"
which = "4.2.5"
winit = { git = "https://github.com/neovide/winit", branch = "new-keyboard-all" }
winit = { git = "https://github.com/neovide/winit", branch = "new-keyboard-v3", features = ["serde"]}
xdg = "2.4.1"
wgpu = "0.14.2"
skia-safe = "0.60.0"
pollster = "0.3.0"
bytemuck = { version = "1.12", features = [ "derive" ] }
wr_glyph_rasterizer = { git = "https://github.com/servo/webrender", version = "0.1.0", ref="6e043ad24b6305e34960511dade7f526e48fff99"}
webrender_api = { git = "https://github.com/servo/webrender", version = "0.62.0", ref="6e043ad24b6305e34960511dade7f526e48fff99" }
rayon = "1.7.0"
num_cpus = "1.15.0"
enum-map = "2.5.0"
hotwatch = "0.4.6"

[dev-dependencies]
mockall = "0.11.0"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["winuser"] }

[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"

[target.'cfg(linux)'.dependencies.skia-safe]
features = ["gl", "egl"]
version = "0.52.0"

[target.'cfg(not(linux))'.dependencies.skia-safe]
features = ["gl"]
version = "0.52.0"

[target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.24.0"
objc = "0.2.7"
shlex = "1.1.0"

[target.'cfg(not(windows))'.dependencies]

[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"

[profile.release]
lto = true
incremental = true
strip = true

[profile.profiling]
inherits = "release"
strip = false
debug = true

[package.metadata.bundle]
name = "Neovide"
identifier = "com.neovide.neovide"
Expand Down
17 changes: 6 additions & 11 deletions src/bridge/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::{
fmt::{self, Debug},
};

use csscolorparser::Color;
use log::debug;
use rmpv::Value;
use skia_safe::Color4f;

use crate::editor::{Colors, CursorMode, CursorShape, Style, UnderlineStyle};

Expand Down Expand Up @@ -276,17 +276,12 @@ pub enum RedrawEvent {
},
}

fn unpack_color(packed_color: u64) -> Color4f {
fn unpack_color(packed_color: u64) -> Color {
let packed_color = packed_color as u32;
let r = ((packed_color & 0x00ff_0000) >> 16) as f32;
let g = ((packed_color & 0xff00) >> 8) as f32;
let b = (packed_color & 0xff) as f32;
Color4f {
r: r / 255.0,
g: g / 255.0,
b: b / 255.0,
a: 1.0,
}
let r = ((packed_color & 0x00ff_0000) >> 16) as u8;
let g = ((packed_color & 0xff00) >> 8) as u8;
let b = (packed_color & 0xff) as u8;
Color::from_rgba8(r, g, b, 255)
}

fn extract_values<const REQ: usize>(values: Vec<Value>) -> Result<[Value; REQ]> {
Expand Down
20 changes: 19 additions & 1 deletion src/dimensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ use std::{
str::FromStr,
};

use glutin::dpi::PhysicalSize;
use serde::{Deserialize, Serialize};
use winit::dpi::PhysicalSize;

use crate::settings;

use euclid::default::Size2D;

// Maybe this should be independent from serialization?
#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
pub struct Dimensions {
Expand Down Expand Up @@ -83,6 +85,22 @@ impl From<Dimensions> for PhysicalSize<u32> {
}
}

macro_rules! impl_from_dimensions_to_size2d {
($type:ty) => {
impl From<Dimensions> for Size2D<$type> {
fn from(dimensions: Dimensions) -> Size2D<$type> {
Size2D::new(dimensions.width as $type, dimensions.height as $type)
}
}
};
}

impl_from_dimensions_to_size2d!(u64);
impl_from_dimensions_to_size2d!(u32);
impl_from_dimensions_to_size2d!(i32);
impl_from_dimensions_to_size2d!(f32);
impl_from_dimensions_to_size2d!(f64);

impl Mul for Dimensions {
type Output = Self;

Expand Down
26 changes: 13 additions & 13 deletions src/editor/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, sync::Arc};

use skia_safe::Color4f;
use csscolorparser::Color;

use crate::editor::style::{Colors, Style};

Expand Down Expand Up @@ -66,18 +66,18 @@ impl Cursor {
}
}

pub fn foreground(&self, default_colors: &Colors) -> Color4f {
pub fn foreground(&self, default_colors: &Colors) -> Color {
self.style
.as_ref()
.and_then(|s| s.colors.foreground)
.unwrap_or_else(|| default_colors.background.unwrap())
.and_then(|s| s.colors.foreground.clone())
.unwrap_or_else(|| default_colors.background.clone().unwrap())
}

pub fn background(&self, default_colors: &Colors) -> Color4f {
pub fn background(&self, default_colors: &Colors) -> Color {
self.style
.as_ref()
.and_then(|s| s.colors.background)
.unwrap_or_else(|| default_colors.foreground.unwrap())
.and_then(|s| s.colors.background.clone())
.unwrap_or_else(|| default_colors.foreground.clone().unwrap())
}

pub fn alpha(&self) -> u8 {
Expand Down Expand Up @@ -118,15 +118,15 @@ mod tests {
use super::*;

const COLORS: Colors = Colors {
foreground: Some(Color4f::new(0.1, 0.1, 0.1, 0.1)),
background: Some(Color4f::new(0.2, 0.1, 0.1, 0.1)),
special: Some(Color4f::new(0.3, 0.1, 0.1, 0.1)),
foreground: Some(Color::new(0.1, 0.1, 0.1, 0.1)),
background: Some(Color::new(0.2, 0.1, 0.1, 0.1)),
special: Some(Color::new(0.3, 0.1, 0.1, 0.1)),
};

const DEFAULT_COLORS: Colors = Colors {
foreground: Some(Color4f::new(0.1, 0.2, 0.1, 0.1)),
background: Some(Color4f::new(0.2, 0.2, 0.1, 0.1)),
special: Some(Color4f::new(0.3, 0.2, 0.1, 0.1)),
foreground: Some(Color::new(0.1, 0.2, 0.1, 0.1)),
background: Some(Color::new(0.2, 0.2, 0.1, 0.1)),
special: Some(Color::new(0.3, 0.2, 0.1, 0.1)),
};

const NONE_COLORS: Colors = Colors {
Expand Down
Loading