# Tweak renderer resource management \(\#62069\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/be8c6f9fb356dcd40a7ff06149568753e64ee171)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: be8c6f9fb356dcd40a7ff06149568753e64ee171

Requested commit: be8c6f9fb356dcd40a7ff06149568753e64ee171

Commit: be8c6f9fb356dcd40a7ff06149568753e64ee171

Tree: 5d52caba025aacba612ee79ee39ba5a9565a4d7a

Author: John Tur

Committer: GitHub

## Message

```
Tweak renderer resource management (#62069)

Factoring some changes out of
https://github.com/zed-industries/zed/pull/61461:
- On Metal and wgpu, bulk-upload instance buffers at the start of the
frame rather than uploading chunks as we draw them. The depth buffer
patch needs this architecture since all opaque quads in the scene are
painted before anything else. This also lets us get rid of the awkward
retry loop when the GPU buffer is too small for the scene.
- On Windows, use a constant buffer for the instance offset rather than
creating SRVs with different `FirstElement`s. `FirstElement` is buggy on
some vendors' drivers, and reusing the SRV object should reduce D3D
runtime overhead.
- Misc. refactoring: remove redundant parameters, deduplicate code,
create fewer bind groups on wgpu, etc.

Fixes https://github.com/zed-industries/zed/issues/49588
Fixes https://github.com/zed-industries/zed/issues/59192

Release Notes:

- Fixed an issue where UI elements would flicker on some Windows
devices.
```

## Parents

- [2d9680fc029853f9a8bade4db2a6440af563d0e9](https://git.cafe/gitcafe/zed/commit/2d9680fc029853f9a8bade4db2a6440af563d0e9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/be8c6f9fb356dcd40a7ff06149568753e64ee171?format=markdown)
