diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68ab0b48a..2cbb76a50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -196,6 +196,9 @@ 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 @@ -352,6 +355,9 @@ 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 diff --git a/build.zig b/build.zig index 8ba5d6b97..d2b1e63ce 100644 --- a/build.zig +++ b/build.zig @@ -1384,10 +1384,21 @@ 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); diff --git a/macos/Ghostty.xcodeproj/xcshareddata/xcschemes/Ghostty.xcscheme b/macos/Ghostty.xcodeproj/xcshareddata/xcschemes/Ghostty.xcscheme index d9b7183aa..59ae8d9d8 100644 --- a/macos/Ghostty.xcodeproj/xcshareddata/xcschemes/Ghostty.xcscheme +++ b/macos/Ghostty.xcodeproj/xcshareddata/xcschemes/Ghostty.xcscheme @@ -55,6 +55,23 @@ isEnabled = "YES"> + + + + + + + + 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 textureGrayscale [[texture(0)]], - texture2d textureColor [[texture(1)]] -) { - constexpr sampler textureSampler( - coord::pixel, - address::clamp_to_edge, - filter::nearest - ); +fragment float4 cell_text_fragment(CellTextVertexOut in [[stage_in]], + texture2d textureGrayscale + [[texture(0)]], + texture2d textureColor + [[texture(1)]]) { + constexpr sampler textureSampler(coord::pixel, address::clamp_to_edge, + filter::nearest); switch (in.mode) { default: @@ -367,12 +361,10 @@ struct ImageVertexOut { float2 tex_coord; }; -vertex ImageVertexOut image_vertex( - uint vid [[vertex_id]], - ImageVertexIn in [[stage_in]], - texture2d image [[texture(0)]], - constant Uniforms& uniforms [[buffer(1)]] -) { +vertex ImageVertexOut image_vertex(uint vid [[vertex_id]], + ImageVertexIn in [[stage_in]], + texture2d image [[texture(0)]], + constant Uniforms& uniforms [[buffer(1)]]) { // The size of the image in pixels float2 image_size = float2(image.get_width(), image.get_height()); @@ -409,10 +401,8 @@ vertex ImageVertexOut image_vertex( return out; } -fragment float4 image_fragment( - ImageVertexOut in [[stage_in]], - texture2d image [[texture(0)]] -) { +fragment float4 image_fragment(ImageVertexOut in [[stage_in]], + texture2d image [[texture(0)]]) { constexpr sampler textureSampler(address::clamp_to_edge, filter::linear); // Ehhhhh our texture is in RGBA8Uint but our color attachment is @@ -426,4 +416,3 @@ fragment float4 image_fragment( result.rgb *= result.a; return result; } -