Reduce GPU memory usage (#7319)

This pull request decreases the size of each instance buffer and shares
instance buffers across windows.

Release Notes:

- Improved GPU memory usage.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2024-02-03 05:27:08 -07:00
committed by GitHub
co-authored by Nathan Sobo
parent d08d4174a5
commit c906fd232d
3 changed files with 24 additions and 13 deletions
+2 -1
View File
@@ -459,6 +459,7 @@ impl MacWindow {
handle: AnyWindowHandle,
options: WindowOptions,
executor: ForegroundExecutor,
instance_buffer_pool: Arc<Mutex<Vec<metal::Buffer>>>,
) -> Self {
unsafe {
let pool = NSAutoreleasePool::new(nil);
@@ -535,7 +536,7 @@ impl MacWindow {
native_window,
native_view: NonNull::new_unchecked(native_view as *mut _),
display_link,
renderer: MetalRenderer::new(true),
renderer: MetalRenderer::new(instance_buffer_pool),
kind: options.kind,
request_frame_callback: None,
event_callback: None,