Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions crates/gpui/src/platform/blade/blade_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ impl BladeRenderer {
profiling::scope!("render pass");
for batch in scene.batches() {
match batch {
PrimitiveBatch::Quads(quads) => {
PrimitiveBatch::Quads(range) => {
let quads = &scene.quads[range];
let instance_buf = unsafe { self.instance_belt.alloc_typed(quads, &self.gpu) };
let mut encoder = pass.with(&self.pipelines.quads);
encoder.bind(
Expand All @@ -731,7 +732,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, quads.len() as u32);
}
PrimitiveBatch::Shadows(shadows) => {
PrimitiveBatch::Shadows(range) => {
let shadows = &scene.shadows[range];
let instance_buf =
unsafe { self.instance_belt.alloc_typed(shadows, &self.gpu) };
let mut encoder = pass.with(&self.pipelines.shadows);
Expand All @@ -744,7 +746,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, shadows.len() as u32);
}
PrimitiveBatch::Paths(paths) => {
PrimitiveBatch::Paths(range) => {
let paths = &scene.paths[range];
let Some(first_path) = paths.first() else {
continue;
};
Expand Down Expand Up @@ -800,7 +803,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, sprites.len() as u32);
}
PrimitiveBatch::Underlines(underlines) => {
PrimitiveBatch::Underlines(range) => {
let underlines = &scene.underlines[range];
let instance_buf =
unsafe { self.instance_belt.alloc_typed(underlines, &self.gpu) };
let mut encoder = pass.with(&self.pipelines.underlines);
Expand All @@ -813,10 +817,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, underlines.len() as u32);
}
PrimitiveBatch::MonochromeSprites {
texture_id,
sprites,
} => {
PrimitiveBatch::MonochromeSprites { texture_id, range } => {
let sprites = &scene.monochrome_sprites[range];
let tex_info = self.atlas.get_texture_info(texture_id);
let instance_buf =
unsafe { self.instance_belt.alloc_typed(sprites, &self.gpu) };
Expand All @@ -836,10 +838,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, sprites.len() as u32);
}
PrimitiveBatch::PolychromeSprites {
texture_id,
sprites,
} => {
PrimitiveBatch::PolychromeSprites { texture_id, range } => {
let sprites = &scene.polychrome_sprites[range];
let tex_info = self.atlas.get_texture_info(texture_id);
let instance_buf =
unsafe { self.instance_belt.alloc_typed(sprites, &self.gpu) };
Expand All @@ -855,10 +855,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, sprites.len() as u32);
}
PrimitiveBatch::SubpixelSprites {
texture_id,
sprites,
} => {
PrimitiveBatch::SubpixelSprites { texture_id, range } => {
let sprites = &scene.subpixel_sprites[range];
let tex_info = self.atlas.get_texture_info(texture_id);
let instance_buf =
unsafe { self.instance_belt.alloc_typed(sprites, &self.gpu) };
Expand All @@ -878,7 +876,8 @@ impl BladeRenderer {
);
encoder.draw(0, 4, 0, sprites.len() as u32);
}
PrimitiveBatch::Surfaces(surfaces) => {
PrimitiveBatch::Surfaces(range) => {
let surfaces = &scene.surfaces[range];
let mut _encoder = pass.with(&self.pipelines.surfaces);

for surface in surfaces {
Expand Down
59 changes: 28 additions & 31 deletions crates/gpui/src/platform/mac/metal_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,21 +548,22 @@ impl MetalRenderer {

for batch in scene.batches() {
let ok = match batch {
PrimitiveBatch::Shadows(shadows) => self.draw_shadows(
shadows,
PrimitiveBatch::Shadows(range) => self.draw_shadows(
&scene.shadows[range],
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::Quads(quads) => self.draw_quads(
quads,
PrimitiveBatch::Quads(range) => self.draw_quads(
&scene.quads[range],
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::Paths(paths) => {
PrimitiveBatch::Paths(range) => {
let paths = &scene.paths[range];
command_encoder.end_encoding();

let did_draw = self.draw_paths_to_intermediate(
Expand Down Expand Up @@ -594,37 +595,33 @@ impl MetalRenderer {
false
}
}
PrimitiveBatch::Underlines(underlines) => self.draw_underlines(
underlines,
PrimitiveBatch::Underlines(range) => self.draw_underlines(
&scene.underlines[range],
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::MonochromeSprites {
texture_id,
sprites,
} => self.draw_monochrome_sprites(
texture_id,
sprites,
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::PolychromeSprites {
texture_id,
sprites,
} => self.draw_polychrome_sprites(
texture_id,
sprites,
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::Surfaces(surfaces) => self.draw_surfaces(
surfaces,
PrimitiveBatch::MonochromeSprites { texture_id, range } => self
.draw_monochrome_sprites(
texture_id,
&scene.monochrome_sprites[range],
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::PolychromeSprites { texture_id, range } => self
.draw_polychrome_sprites(
texture_id,
&scene.polychrome_sprites[range],
instance_buffer,
&mut instance_offset,
viewport_size,
command_encoder,
),
PrimitiveBatch::Surfaces(range) => self.draw_surfaces(
&scene.surfaces[range],
instance_buffer,
&mut instance_offset,
viewport_size,
Expand Down
Loading