1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 03:39:16 +03:00

wezterm: tidy up shader a bit

More properly annotate the types of the data used in the shaders.
Make the declarations more consistent with each other.
This commit is contained in:
Wez Furlong 2020-10-24 10:42:23 -07:00
parent b49b82ae89
commit 91ce0b77ea
3 changed files with 32 additions and 29 deletions

View File

@ -1326,6 +1326,7 @@ impl TerminalState {
return;
}
// FIXME: cache recent images and avoid assigning a new id for repeated data!
let image_data = Arc::new(ImageData::with_raw_data(png_image_data));
self.assign_image_to_cells(width, height, image_data);
}
@ -1343,9 +1344,9 @@ impl TerminalState {
let cursor_x = self.cursor.x;
let x_delta = 1.0 / (width as f32 / (self.pixel_width as f32 / physical_cols as f32));
let y_delta = 1.0 / (height as f32 / (self.pixel_height as f32 / physical_rows as f32));
debug!(
"image is {}x{} cells, {}x{} pixels",
width_in_cells, height_in_cells, width, height
log::error!(
"image is {}x{} cells, {}x{} pixels, x_delta:{} y_delta:{}",
width_in_cells, height_in_cells, width, height, x_delta, y_delta,
);
for _ in 0..height_in_cells {
let mut xpos = NotNan::new(0.0).unwrap();

View File

@ -1,18 +1,19 @@
precision highp float;
in vec2 o_tex;
in vec4 o_fg_color;
in vec4 o_bg_color;
in float o_has_color;
in vec3 o_hsv;
in vec2 o_underline;
in vec2 o_cursor;
in vec4 o_cursor_color;
varying float o_has_color;
varying vec2 o_cursor;
varying vec2 o_tex;
varying vec2 o_underline;
varying vec3 o_hsv;
varying vec4 o_bg_color;
varying vec4 o_cursor_color;
varying vec4 o_fg_color;
uniform mat4 projection;
uniform bool window_bg_layer;
uniform bool bg_and_line_layer;
uniform bool has_background_image;
uniform sampler2D atlas_nearest_sampler;
uniform sampler2D atlas_linear_sampler;

View File

@ -1,28 +1,29 @@
precision highp float;
in vec2 position;
in vec2 adjust;
in vec2 tex;
in vec2 underline;
in vec4 bg_color;
in vec4 fg_color;
in float has_color;
in vec2 cursor;
in vec4 cursor_color;
in vec3 hsv;
attribute vec2 position;
attribute vec2 adjust;
attribute vec2 tex;
attribute vec2 underline;
attribute vec4 bg_color;
attribute vec4 fg_color;
attribute float has_color;
attribute vec2 cursor;
attribute vec4 cursor_color;
attribute vec3 hsv;
uniform mat4 projection;
uniform bool window_bg_layer;
uniform bool bg_and_line_layer;
uniform bool has_background_image;
out vec2 o_tex;
out vec4 o_fg_color;
out vec4 o_bg_color;
out float o_has_color;
out vec2 o_underline;
out vec2 o_cursor;
out vec4 o_cursor_color;
out vec3 o_hsv;
varying float o_has_color;
varying vec2 o_cursor;
varying vec2 o_tex;
varying vec2 o_underline;
varying vec3 o_hsv;
varying vec4 o_bg_color;
varying vec4 o_cursor_color;
varying vec4 o_fg_color;
// Returns a position that is outside of the viewport,
// such that this vertex effectively won't contribute