mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
Revert "macos: enable Metal shader logging"
This reverts commit aad101565abff3368af76e8c2e93cbe7c278a89f.
This commit is contained in:
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -196,9 +196,6 @@ jobs:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- name: XCode Select
|
||||
run: sudo xcode-select -s /Applications/Xcode_16.0.app
|
||||
|
||||
- name: Test All
|
||||
run: |
|
||||
# OpenGL
|
||||
@ -355,9 +352,6 @@ jobs:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- name: XCode Select
|
||||
run: sudo xcode-select -s /Applications/Xcode_16.0.app
|
||||
|
||||
- name: test
|
||||
run: nix develop -c zig build test
|
||||
|
||||
|
11
build.zig
11
build.zig
@ -1385,21 +1385,10 @@ fn addMetallib(
|
||||
b: *std.Build,
|
||||
step: *std.Build.Step.Compile,
|
||||
) !void {
|
||||
const optimize = step.root_module.optimize.?;
|
||||
|
||||
const metal_step = MetallibStep.create(b, .{
|
||||
.name = "Ghostty",
|
||||
.target = step.root_module.resolved_target.?,
|
||||
.sources = &.{b.path("src/renderer/shaders/cell.metal")},
|
||||
.logging = switch (optimize) {
|
||||
.Debug,
|
||||
=> true,
|
||||
|
||||
.ReleaseFast,
|
||||
.ReleaseSmall,
|
||||
.ReleaseSafe,
|
||||
=> false,
|
||||
},
|
||||
});
|
||||
|
||||
metal_step.output.addStepDependencies(&step.step);
|
||||
|
@ -55,23 +55,6 @@
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "MTL_LOG_BUFFER_SIZE"
|
||||
value = "4096"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "MTL_LOG_LEVEL"
|
||||
value = "MTLLogLevelDebug"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "MTL_LOG_TO_STDERR"
|
||||
value = "1"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
<AdditionalOption
|
||||
key = "NSZombieEnabled"
|
||||
|
@ -16,9 +16,6 @@ pub const Options = struct {
|
||||
|
||||
/// The Metal source files.
|
||||
sources: []const LazyPath,
|
||||
|
||||
/// Whether to enable Metal shader logging.
|
||||
logging: bool = false,
|
||||
};
|
||||
|
||||
step: *Step,
|
||||
@ -45,20 +42,7 @@ pub fn create(b: *std.Build, opts: Options) *MetallibStep {
|
||||
b,
|
||||
b.fmt("metal {s}", .{opts.name}),
|
||||
);
|
||||
run_ir.addArgs(&.{
|
||||
"xcrun",
|
||||
"-sdk",
|
||||
sdk,
|
||||
"metal",
|
||||
"-std=metal3.2",
|
||||
});
|
||||
|
||||
if (opts.logging) run_ir.addArgs(&.{
|
||||
// https://developer.apple.com/documentation/metal/logging_shader_debug_messages
|
||||
"-fmetal-enable-logging",
|
||||
});
|
||||
|
||||
run_ir.addArgs(&.{"-o"});
|
||||
run_ir.addArgs(&.{ "xcrun", "-sdk", sdk, "metal", "-o" });
|
||||
const output_ir = run_ir.addOutputFileArg(b.fmt("{s}.ir", .{opts.name}));
|
||||
run_ir.addArgs(&.{"-c"});
|
||||
for (opts.sources) |source| run_ir.addFileArg(source);
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
using namespace metal;
|
||||
|
||||
constant os_log logger("com.mitchellh.ghostty", "cell");
|
||||
|
||||
enum Padding : uint8_t {
|
||||
EXTEND_LEFT = 1u,
|
||||
EXTEND_RIGHT = 2u,
|
||||
@ -81,7 +79,9 @@ struct FullScreenVertexOut {
|
||||
float4 position [[position]];
|
||||
};
|
||||
|
||||
vertex FullScreenVertexOut full_screen_vertex(uint vid [[vertex_id]]) {
|
||||
vertex FullScreenVertexOut full_screen_vertex(
|
||||
uint vid [[vertex_id]]
|
||||
) {
|
||||
FullScreenVertexOut out;
|
||||
|
||||
float4 position;
|
||||
@ -112,11 +112,12 @@ vertex FullScreenVertexOut full_screen_vertex(uint vid [[vertex_id]]) {
|
||||
//-------------------------------------------------------------------
|
||||
#pragma mark - Cell BG Shader
|
||||
|
||||
fragment float4 cell_bg_fragment(FullScreenVertexOut in [[stage_in]],
|
||||
fragment float4 cell_bg_fragment(
|
||||
FullScreenVertexOut in [[stage_in]],
|
||||
constant uchar4 *cells [[buffer(0)]],
|
||||
constant Uniforms& uniforms [[buffer(1)]]) {
|
||||
int2 grid_pos = int2(
|
||||
floor((in.position.xy - uniforms.grid_padding.wx) / uniforms.cell_size));
|
||||
constant Uniforms& uniforms [[buffer(1)]]
|
||||
) {
|
||||
int2 grid_pos = int2(floor((in.position.xy - uniforms.grid_padding.wx) / uniforms.cell_size));
|
||||
|
||||
// Clamp x position, extends edge bg colors in to padding on sides.
|
||||
if (grid_pos.x < 0) {
|
||||
@ -196,12 +197,12 @@ struct CellTextVertexOut {
|
||||
float2 tex_coord;
|
||||
};
|
||||
|
||||
vertex CellTextVertexOut cell_text_vertex(uint vid [[vertex_id]],
|
||||
vertex CellTextVertexOut cell_text_vertex(
|
||||
uint vid [[vertex_id]],
|
||||
CellTextVertexIn in [[stage_in]],
|
||||
constant Uniforms& uniforms
|
||||
[[buffer(1)]],
|
||||
constant uchar4* bg_colors
|
||||
[[buffer(2)]]) {
|
||||
constant Uniforms& uniforms [[buffer(1)]],
|
||||
constant uchar4 *bg_colors [[buffer(2)]]
|
||||
) {
|
||||
// Convert the grid x, y into world space x, y by accounting for cell size
|
||||
float2 cell_pos = uniforms.cell_size * float2(in.grid_pos);
|
||||
|
||||
@ -286,31 +287,36 @@ vertex CellTextVertexOut cell_text_vertex(uint vid [[vertex_id]],
|
||||
// and Powerline glyphs to be unaffected (else parts of the line would
|
||||
// have different colors as some parts are displayed via background colors).
|
||||
if (uniforms.min_contrast > 1.0f && in.mode == MODE_TEXT) {
|
||||
float4 bg_color =
|
||||
float4(
|
||||
bg_colors[in.grid_pos.y * uniforms.grid_size.x + in.grid_pos.x]) /
|
||||
255.0f;
|
||||
float4 bg_color = float4(bg_colors[in.grid_pos.y * uniforms.grid_size.x + in.grid_pos.x]) / 255.0f;
|
||||
out.color = contrasted_color(uniforms.min_contrast, out.color, bg_color);
|
||||
}
|
||||
|
||||
// If this cell is the cursor cell, then we need to change the color.
|
||||
if (in.mode != MODE_TEXT_CURSOR &&
|
||||
(in.grid_pos.x == uniforms.cursor_pos.x ||
|
||||
uniforms.cursor_wide && in.grid_pos.x == uniforms.cursor_pos.x + 1) &&
|
||||
in.grid_pos.y == uniforms.cursor_pos.y) {
|
||||
if (
|
||||
in.mode != MODE_TEXT_CURSOR &&
|
||||
(
|
||||
in.grid_pos.x == uniforms.cursor_pos.x ||
|
||||
uniforms.cursor_wide &&
|
||||
in.grid_pos.x == uniforms.cursor_pos.x + 1
|
||||
) &&
|
||||
in.grid_pos.y == uniforms.cursor_pos.y
|
||||
) {
|
||||
out.color = float4(uniforms.cursor_color) / 255.0f;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
fragment float4 cell_text_fragment(CellTextVertexOut in [[stage_in]],
|
||||
texture2d<float> textureGrayscale
|
||||
[[texture(0)]],
|
||||
texture2d<float> textureColor
|
||||
[[texture(1)]]) {
|
||||
constexpr sampler textureSampler(coord::pixel, address::clamp_to_edge,
|
||||
filter::nearest);
|
||||
fragment float4 cell_text_fragment(
|
||||
CellTextVertexOut in [[stage_in]],
|
||||
texture2d<float> textureGrayscale [[texture(0)]],
|
||||
texture2d<float> textureColor [[texture(1)]]
|
||||
) {
|
||||
constexpr sampler textureSampler(
|
||||
coord::pixel,
|
||||
address::clamp_to_edge,
|
||||
filter::nearest
|
||||
);
|
||||
|
||||
switch (in.mode) {
|
||||
default:
|
||||
@ -361,10 +367,12 @@ struct ImageVertexOut {
|
||||
float2 tex_coord;
|
||||
};
|
||||
|
||||
vertex ImageVertexOut image_vertex(uint vid [[vertex_id]],
|
||||
vertex ImageVertexOut image_vertex(
|
||||
uint vid [[vertex_id]],
|
||||
ImageVertexIn in [[stage_in]],
|
||||
texture2d<uint> image [[texture(0)]],
|
||||
constant Uniforms& uniforms [[buffer(1)]]) {
|
||||
constant Uniforms& uniforms [[buffer(1)]]
|
||||
) {
|
||||
// The size of the image in pixels
|
||||
float2 image_size = float2(image.get_width(), image.get_height());
|
||||
|
||||
@ -401,8 +409,10 @@ vertex ImageVertexOut image_vertex(uint vid [[vertex_id]],
|
||||
return out;
|
||||
}
|
||||
|
||||
fragment float4 image_fragment(ImageVertexOut in [[stage_in]],
|
||||
texture2d<uint> image [[texture(0)]]) {
|
||||
fragment float4 image_fragment(
|
||||
ImageVertexOut in [[stage_in]],
|
||||
texture2d<uint> image [[texture(0)]]
|
||||
) {
|
||||
constexpr sampler textureSampler(address::clamp_to_edge, filter::linear);
|
||||
|
||||
// Ehhhhh our texture is in RGBA8Uint but our color attachment is
|
||||
@ -416,3 +426,4 @@ fragment float4 image_fragment(ImageVertexOut in [[stage_in]],
|
||||
result.rgb *= result.a;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user