Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux: switch to srgb color space output (#7666)

Dzmitry Malyshau664a195721ed
diff --git a/Cargo.lock b/Cargo.lock
index 38ecaa8f524..5808fddc9ec 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -937,7 +937,7 @@ dependencies = [
[[package]]
name = "blade-graphics"
version = "0.3.0"
-source = "git+https://github.com/kvark/blade?rev=26bc5e8b9ef67b4f2970eb95888db733eace98f3#26bc5e8b9ef67b4f2970eb95888db733eace98f3"
+source = "git+https://github.com/kvark/blade?rev=c4f951a88b345724cb952e920ad30e39851f7760#c4f951a88b345724cb952e920ad30e39851f7760"
dependencies = [
"ash",
"ash-window",
@@ -967,7 +967,7 @@ dependencies = [
[[package]]
name = "blade-macros"
version = "0.2.1"
-source = "git+https://github.com/kvark/blade?rev=26bc5e8b9ef67b4f2970eb95888db733eace98f3#26bc5e8b9ef67b4f2970eb95888db733eace98f3"
+source = "git+https://github.com/kvark/blade?rev=c4f951a88b345724cb952e920ad30e39851f7760#c4f951a88b345724cb952e920ad30e39851f7760"
dependencies = [
"proc-macro2",
"quote",
diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml
index 1bf95cfc336..6b12a2c7952 100644
--- a/crates/gpui/Cargo.toml
+++ b/crates/gpui/Cargo.toml
@@ -99,7 +99,7 @@ flume = "0.11"
xcb = { version = "1.3", features = ["as-raw-xcb-connection"] }
as-raw-xcb-connection = "1"
#TODO: use these on all platforms
-blade-graphics = { git = "https://github.com/kvark/blade", rev = "26bc5e8b9ef67b4f2970eb95888db733eace98f3" }
-blade-macros = { git = "https://github.com/kvark/blade", rev = "26bc5e8b9ef67b4f2970eb95888db733eace98f3" }
+blade-graphics = { git = "https://github.com/kvark/blade", rev = "c4f951a88b345724cb952e920ad30e39851f7760" }
+blade-macros = { git = "https://github.com/kvark/blade", rev = "c4f951a88b345724cb952e920ad30e39851f7760" }
bytemuck = "1"
cosmic-text = "0.10.0"
\ No newline at end of file
diff --git a/crates/gpui/src/platform/linux/blade_renderer.rs b/crates/gpui/src/platform/linux/blade_renderer.rs
index 9f2ae6b606a..67935c47128 100644
--- a/crates/gpui/src/platform/linux/blade_renderer.rs
+++ b/crates/gpui/src/platform/linux/blade_renderer.rs
@@ -237,12 +237,19 @@ pub struct BladeRenderer {
}
impl BladeRenderer {
- pub fn new(gpu: Arc<gpu::Context>, size: gpu::Extent) -> Self {
- let surface_format = gpu.resize(gpu::SurfaceConfig {
+ fn make_surface_config(size: gpu::Extent) -> gpu::SurfaceConfig {
+ gpu::SurfaceConfig {
size,
usage: gpu::TextureUsage::TARGET,
frame_count: SURFACE_FRAME_COUNT,
- });
+ //Note: this matches the original logic of the Metal backend,
+ // but ultimaterly we need to switch to `Linear`.
+ color_space: gpu::ColorSpace::Srgb,
+ }
+ }
+
+ pub fn new(gpu: Arc<gpu::Context>, size: gpu::Extent) -> Self {
+ let surface_format = gpu.resize(Self::make_surface_config(size));
let command_encoder = gpu.create_command_encoder(gpu::CommandEncoderDesc {
name: "main",
buffer_count: 2,
@@ -291,11 +298,7 @@ impl BladeRenderer {
pub fn resize(&mut self, size: gpu::Extent) {
self.wait_for_gpu();
- self.gpu.resize(gpu::SurfaceConfig {
- size,
- usage: gpu::TextureUsage::TARGET,
- frame_count: SURFACE_FRAME_COUNT,
- });
+ self.gpu.resize(Self::make_surface_config(size));
self.viewport_size = size;
}
@@ -455,7 +458,7 @@ impl BladeRenderer {
sprites,
} => {
let tex_info = self.atlas.get_texture_info(texture_id);
- let instance_buf = self.instance_belt.alloc_data(sprites, &self.gpu);
+ let instance_buf = self.instance_belt.alloc_data(&sprites, &self.gpu);
let mut encoder = pass.with(&self.pipelines.mono_sprites);
encoder.bind(
0,
@@ -473,7 +476,7 @@ impl BladeRenderer {
sprites,
} => {
let tex_info = self.atlas.get_texture_info(texture_id);
- let instance_buf = self.instance_belt.alloc_data(sprites, &self.gpu);
+ let instance_buf = self.instance_belt.alloc_data(&sprites, &self.gpu);
let mut encoder = pass.with(&self.pipelines.poly_sprites);
encoder.bind(
0,