mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-23 20:26:09 +03:00
remove underline support from shaders since we now use sprites
This commit is contained in:
@ -102,8 +102,6 @@ const GPUUniforms = extern struct {
|
||||
cell_size: [2]f32,
|
||||
|
||||
/// Metrics for underline/strikethrough
|
||||
underline_position: f32,
|
||||
underline_thickness: f32,
|
||||
strikethrough_position: f32,
|
||||
strikethrough_thickness: f32,
|
||||
};
|
||||
@ -115,7 +113,6 @@ const GPUCellMode = enum(u8) {
|
||||
cursor_rect = 3,
|
||||
cursor_rect_hollow = 4,
|
||||
cursor_bar = 5,
|
||||
underline = 6,
|
||||
strikethrough = 8,
|
||||
|
||||
pub fn fromCursor(cursor: renderer.CursorStyle) GPUCellMode {
|
||||
@ -267,8 +264,6 @@ pub fn init(alloc: Allocator, options: renderer.Options) !Metal {
|
||||
.uniforms = .{
|
||||
.projection_matrix = undefined,
|
||||
.cell_size = undefined,
|
||||
.underline_position = metrics.underline_position,
|
||||
.underline_thickness = metrics.underline_thickness,
|
||||
.strikethrough_position = metrics.strikethrough_position,
|
||||
.strikethrough_thickness = metrics.strikethrough_thickness,
|
||||
},
|
||||
@ -405,8 +400,6 @@ pub fn setFontSize(self: *Metal, size: font.face.DesiredSize) !void {
|
||||
self.uniforms = .{
|
||||
.projection_matrix = self.uniforms.projection_matrix,
|
||||
.cell_size = .{ new_cell_size.width, new_cell_size.height },
|
||||
.underline_position = metrics.underline_position,
|
||||
.underline_thickness = metrics.underline_thickness,
|
||||
.strikethrough_position = metrics.strikethrough_position,
|
||||
.strikethrough_thickness = metrics.strikethrough_thickness,
|
||||
};
|
||||
@ -717,8 +710,6 @@ pub fn setScreenSize(self: *Metal, _: renderer.ScreenSize) !void {
|
||||
-1 * padding.top,
|
||||
),
|
||||
.cell_size = .{ self.cell_size.width, self.cell_size.height },
|
||||
.underline_position = old.underline_position,
|
||||
.underline_thickness = old.underline_thickness,
|
||||
.strikethrough_position = old.strikethrough_position,
|
||||
.strikethrough_thickness = old.strikethrough_thickness,
|
||||
};
|
||||
|
@ -137,7 +137,6 @@ const GPUCellMode = enum(u8) {
|
||||
cursor_rect = 3,
|
||||
cursor_rect_hollow = 4,
|
||||
cursor_bar = 5,
|
||||
underline = 6,
|
||||
strikethrough = 8,
|
||||
|
||||
// Non-exhaustive because masks change it
|
||||
@ -180,8 +179,6 @@ pub fn init(alloc: Allocator, options: renderer.Options) !OpenGL {
|
||||
const pbind = try program.use();
|
||||
defer pbind.unbind();
|
||||
try program.setUniform("cell_size", @Vector(2, f32){ metrics.cell_width, metrics.cell_height });
|
||||
try program.setUniform("underline_position", metrics.underline_position);
|
||||
try program.setUniform("underline_thickness", metrics.underline_thickness);
|
||||
try program.setUniform("strikethrough_position", metrics.strikethrough_position);
|
||||
try program.setUniform("strikethrough_thickness", metrics.strikethrough_thickness);
|
||||
|
||||
@ -536,8 +533,6 @@ fn resetFontMetrics(
|
||||
const pbind = try program.use();
|
||||
defer pbind.unbind();
|
||||
try program.setUniform("cell_size", @Vector(2, f32){ metrics.cell_width, metrics.cell_height });
|
||||
try program.setUniform("underline_position", metrics.underline_position);
|
||||
try program.setUniform("underline_thickness", metrics.underline_thickness);
|
||||
try program.setUniform("strikethrough_position", metrics.strikethrough_position);
|
||||
try program.setUniform("strikethrough_thickness", metrics.strikethrough_thickness);
|
||||
|
||||
|
@ -30,7 +30,6 @@ const uint MODE_FG_COLOR = 7u;
|
||||
const uint MODE_CURSOR_RECT = 3u;
|
||||
const uint MODE_CURSOR_RECT_HOLLOW = 4u;
|
||||
const uint MODE_CURSOR_BAR = 5u;
|
||||
const uint MODE_UNDERLINE = 6u;
|
||||
const uint MODE_STRIKETHROUGH = 8u;
|
||||
|
||||
void main() {
|
||||
@ -94,10 +93,6 @@ void main() {
|
||||
out_FragColor = color;
|
||||
break;
|
||||
|
||||
case MODE_UNDERLINE:
|
||||
out_FragColor = color;
|
||||
break;
|
||||
|
||||
case MODE_STRIKETHROUGH:
|
||||
out_FragColor = color;
|
||||
break;
|
||||
|
@ -8,15 +8,12 @@ enum Mode : uint8_t {
|
||||
MODE_CURSOR_RECT = 3u,
|
||||
MODE_CURSOR_RECT_HOLLOW = 4u,
|
||||
MODE_CURSOR_BAR = 5u,
|
||||
MODE_UNDERLINE = 6u,
|
||||
MODE_STRIKETHROUGH = 8u,
|
||||
};
|
||||
|
||||
struct Uniforms {
|
||||
float4x4 projection_matrix;
|
||||
float2 cell_size;
|
||||
float underline_position;
|
||||
float underline_thickness;
|
||||
float strikethrough_position;
|
||||
float strikethrough_thickness;
|
||||
};
|
||||
@ -154,22 +151,6 @@ vertex VertexOut uber_vertex(
|
||||
break;
|
||||
}
|
||||
|
||||
case MODE_UNDERLINE: {
|
||||
// Underline Y value is just our thickness
|
||||
float2 underline_size = float2(cell_size_scaled.x, uniforms.underline_thickness);
|
||||
|
||||
// Position the underline where we are told to
|
||||
float2 underline_offset = float2(cell_size_scaled.x, uniforms.underline_position);
|
||||
|
||||
// Go to the bottom of the cell, take away the size of the
|
||||
// underline, and that is our position. We also float it slightly
|
||||
// above the bottom.
|
||||
cell_pos = cell_pos + underline_offset - (underline_size * position);
|
||||
|
||||
out.position = uniforms.projection_matrix * float4(cell_pos, 0.0f, 1.0);
|
||||
break;
|
||||
}
|
||||
|
||||
case MODE_STRIKETHROUGH: {
|
||||
// Strikethrough Y value is just our thickness
|
||||
float2 strikethrough_size = float2(cell_size_scaled.x, uniforms.strikethrough_thickness);
|
||||
@ -259,9 +240,6 @@ fragment float4 uber_fragment(
|
||||
case MODE_CURSOR_BAR:
|
||||
return in.color;
|
||||
|
||||
case MODE_UNDERLINE:
|
||||
return in.color;
|
||||
|
||||
case MODE_STRIKETHROUGH:
|
||||
return in.color;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ const uint MODE_FG_COLOR = 7u;
|
||||
const uint MODE_CURSOR_RECT = 3u;
|
||||
const uint MODE_CURSOR_RECT_HOLLOW = 4u;
|
||||
const uint MODE_CURSOR_BAR = 5u;
|
||||
const uint MODE_UNDERLINE = 6u;
|
||||
const uint MODE_STRIKETHROUGH = 8u;
|
||||
|
||||
// The grid coordinates (x, y) where x < columns and y < rows
|
||||
@ -58,8 +57,6 @@ uniform sampler2D text;
|
||||
uniform sampler2D text_color;
|
||||
uniform vec2 cell_size;
|
||||
uniform mat4 projection;
|
||||
uniform float underline_position;
|
||||
uniform float underline_thickness;
|
||||
uniform float strikethrough_position;
|
||||
uniform float strikethrough_thickness;
|
||||
|
||||
@ -200,22 +197,6 @@ void main() {
|
||||
color = bg_color_in / 255.0;
|
||||
break;
|
||||
|
||||
case MODE_UNDERLINE:
|
||||
// Underline Y value is just our thickness
|
||||
vec2 underline_size = vec2(cell_size_scaled.x, underline_thickness);
|
||||
|
||||
// Position the underline where we are told to
|
||||
vec2 underline_offset = vec2(cell_size_scaled.x, underline_position) ;
|
||||
|
||||
// Go to the bottom of the cell, take away the size of the
|
||||
// underline, and that is our position. We also float it slightly
|
||||
// above the bottom.
|
||||
cell_pos = cell_pos + underline_offset - (underline_size * position);
|
||||
|
||||
gl_Position = projection * vec4(cell_pos, cell_z, 1.0);
|
||||
color = fg_color_in / 255.0;
|
||||
break;
|
||||
|
||||
case MODE_STRIKETHROUGH:
|
||||
// Strikethrough Y value is just our thickness
|
||||
vec2 strikethrough_size = vec2(cell_size_scaled.x, strikethrough_thickness);
|
||||
|
Reference in New Issue
Block a user