mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-18 18:08:07 +03:00
Update blade to a version that can run GLES for Zed (#10243)
Release Notes: - N/A Picks up https://github.com/kvark/blade/pull/105, https://github.com/kvark/blade/pull/97, and more Switches the presentation to be non-blocking, which will improve the latency slightly. Allows to start playing with GLES backend, e.g. ```bash cd crates/gpui RUSTFLAGS="--cfg gles" CARGO_TARGET_DIR=./target-gl cargo run --example hello_world ``` It doesn't currently render properly due to an issue that needs investigation, see https://github.com/kvark/blade/pull/105#issuecomment-2041006542 But at least it's a start Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
3fc08a0610
commit
8f69eac402
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -1439,8 +1439,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blade-graphics"
|
name = "blade-graphics"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/zed-industries/blade?rev=85981c0f4890a5fcd08da2a53cc4a0459247af44#85981c0f4890a5fcd08da2a53cc4a0459247af44"
|
source = "git+https://github.com/kvark/blade?rev=810ec594358aafea29a4a3d8ab601d25292b2ce4#810ec594358aafea29a4a3d8ab601d25292b2ce4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash",
|
"ash",
|
||||||
"ash-window",
|
"ash-window",
|
||||||
@ -1470,7 +1470,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "blade-macros"
|
name = "blade-macros"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "git+https://github.com/zed-industries/blade?rev=85981c0f4890a5fcd08da2a53cc4a0459247af44#85981c0f4890a5fcd08da2a53cc4a0459247af44"
|
source = "git+https://github.com/kvark/blade?rev=810ec594358aafea29a4a3d8ab601d25292b2ce4#810ec594358aafea29a4a3d8ab601d25292b2ce4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -230,9 +230,8 @@ async-recursion = "1.0.0"
|
|||||||
async-tar = "0.4.2"
|
async-tar = "0.4.2"
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
bitflags = "2.4.2"
|
bitflags = "2.4.2"
|
||||||
# todo(linux): Remove these once https://github.com/kvark/blade/pull/107 is merged and we've upgraded our renderer
|
blade-graphics = { git = "https://github.com/kvark/blade", rev = "810ec594358aafea29a4a3d8ab601d25292b2ce4" }
|
||||||
blade-graphics = { git = "https://github.com/zed-industries/blade", rev = "85981c0f4890a5fcd08da2a53cc4a0459247af44" }
|
blade-macros = { git = "https://github.com/kvark/blade", rev = "810ec594358aafea29a4a3d8ab601d25292b2ce4" }
|
||||||
blade-macros = { git = "https://github.com/zed-industries/blade", rev = "85981c0f4890a5fcd08da2a53cc4a0459247af44" }
|
|
||||||
blade-rwh = { package = "raw-window-handle", version = "0.5" }
|
blade-rwh = { package = "raw-window-handle", version = "0.5" }
|
||||||
cap-std = "3.0"
|
cap-std = "3.0"
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
|
@ -29,6 +29,9 @@ struct BladeAtlasState {
|
|||||||
uploads: Vec<PendingUpload>,
|
uploads: Vec<PendingUpload>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(gles)]
|
||||||
|
unsafe impl Send for BladeAtlasState {}
|
||||||
|
|
||||||
impl BladeAtlasState {
|
impl BladeAtlasState {
|
||||||
fn destroy(&mut self) {
|
fn destroy(&mut self) {
|
||||||
self.storage.destroy(&self.gpu);
|
self.storage.destroy(&self.gpu);
|
||||||
|
@ -17,7 +17,6 @@ use std::ffi::c_void;
|
|||||||
use blade_graphics as gpu;
|
use blade_graphics as gpu;
|
||||||
use std::{mem, sync::Arc};
|
use std::{mem, sync::Arc};
|
||||||
|
|
||||||
const SURFACE_FRAME_COUNT: u32 = 3;
|
|
||||||
const MAX_FRAME_TIME_MS: u32 = 1000;
|
const MAX_FRAME_TIME_MS: u32 = 1000;
|
||||||
|
|
||||||
pub type Context = ();
|
pub type Context = ();
|
||||||
@ -209,6 +208,7 @@ impl BladePipelines {
|
|||||||
name: "quads",
|
name: "quads",
|
||||||
data_layouts: &[&ShaderQuadsData::layout()],
|
data_layouts: &[&ShaderQuadsData::layout()],
|
||||||
vertex: shader.at("vs_quad"),
|
vertex: shader.at("vs_quad"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -225,6 +225,7 @@ impl BladePipelines {
|
|||||||
name: "shadows",
|
name: "shadows",
|
||||||
data_layouts: &[&ShaderShadowsData::layout()],
|
data_layouts: &[&ShaderShadowsData::layout()],
|
||||||
vertex: shader.at("vs_shadow"),
|
vertex: shader.at("vs_shadow"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -241,6 +242,7 @@ impl BladePipelines {
|
|||||||
name: "path_rasterization",
|
name: "path_rasterization",
|
||||||
data_layouts: &[&ShaderPathRasterizationData::layout()],
|
data_layouts: &[&ShaderPathRasterizationData::layout()],
|
||||||
vertex: shader.at("vs_path_rasterization"),
|
vertex: shader.at("vs_path_rasterization"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleList,
|
topology: gpu::PrimitiveTopology::TriangleList,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -257,6 +259,7 @@ impl BladePipelines {
|
|||||||
name: "paths",
|
name: "paths",
|
||||||
data_layouts: &[&ShaderPathsData::layout()],
|
data_layouts: &[&ShaderPathsData::layout()],
|
||||||
vertex: shader.at("vs_path"),
|
vertex: shader.at("vs_path"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -273,6 +276,7 @@ impl BladePipelines {
|
|||||||
name: "underlines",
|
name: "underlines",
|
||||||
data_layouts: &[&ShaderUnderlinesData::layout()],
|
data_layouts: &[&ShaderUnderlinesData::layout()],
|
||||||
vertex: shader.at("vs_underline"),
|
vertex: shader.at("vs_underline"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -289,6 +293,7 @@ impl BladePipelines {
|
|||||||
name: "mono-sprites",
|
name: "mono-sprites",
|
||||||
data_layouts: &[&ShaderMonoSpritesData::layout()],
|
data_layouts: &[&ShaderMonoSpritesData::layout()],
|
||||||
vertex: shader.at("vs_mono_sprite"),
|
vertex: shader.at("vs_mono_sprite"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -305,6 +310,7 @@ impl BladePipelines {
|
|||||||
name: "poly-sprites",
|
name: "poly-sprites",
|
||||||
data_layouts: &[&ShaderPolySpritesData::layout()],
|
data_layouts: &[&ShaderPolySpritesData::layout()],
|
||||||
vertex: shader.at("vs_poly_sprite"),
|
vertex: shader.at("vs_poly_sprite"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -321,6 +327,7 @@ impl BladePipelines {
|
|||||||
name: "surfaces",
|
name: "surfaces",
|
||||||
data_layouts: &[&ShaderSurfacesData::layout()],
|
data_layouts: &[&ShaderSurfacesData::layout()],
|
||||||
vertex: shader.at("vs_surface"),
|
vertex: shader.at("vs_surface"),
|
||||||
|
vertex_fetches: &[],
|
||||||
primitive: gpu::PrimitiveState {
|
primitive: gpu::PrimitiveState {
|
||||||
topology: gpu::PrimitiveTopology::TriangleStrip,
|
topology: gpu::PrimitiveTopology::TriangleStrip,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -356,7 +363,7 @@ impl BladeRenderer {
|
|||||||
gpu::SurfaceConfig {
|
gpu::SurfaceConfig {
|
||||||
size,
|
size,
|
||||||
usage: gpu::TextureUsage::TARGET,
|
usage: gpu::TextureUsage::TARGET,
|
||||||
frame_count: SURFACE_FRAME_COUNT,
|
display_sync: gpu::DisplaySync::Recent,
|
||||||
//Note: this matches the original logic of the Metal backend,
|
//Note: this matches the original logic of the Metal backend,
|
||||||
// but ultimaterly we need to switch to `Linear`.
|
// but ultimaterly we need to switch to `Linear`.
|
||||||
color_space: gpu::ColorSpace::Srgb,
|
color_space: gpu::ColorSpace::Srgb,
|
||||||
|
Loading…
Reference in New Issue
Block a user