Skip to content

gpui/metal: Clamp max texture width/height to 16kB - #10314

Merged
osiewicz merged 1 commit into
mainfrom
fix-max-texture-size-metal
Apr 9, 2024
Merged

gpui/metal: Clamp max texture width/height to 16kB#10314
osiewicz merged 1 commit into
mainfrom
fix-max-texture-size-metal

Conversation

@osiewicz

@osiewicz osiewicz commented Apr 9, 2024

Copy link
Copy Markdown
Member

Fixed #10149
A user had Zed crash due to invalid font size in settings. It turned out the width/height of glyphs does not pass validation in Metal texture initialization with a large enough font size.

All modern Macs have a max texture width/height of 16kB (barring Apple A8, used by iPhone 6 back in 2014, which uses 8kB). This commit clamps texture size at 16kB. Note that while it fixes Zed crash, using a font size that hits the limit is still pretty unusable - the users will still have a pretty unusable editor, but at least it won't crash for them.

Release Notes:

  • Fixed crashes with huge buffer_font_size values.

Fixed #10149
A user had Zed crash due to invalid font size in settings. It turned out the width/height of glyphs does not pass validation in Metal texture initialization with a large enough font size.

All modern Macs have a max texture width/height of 16kB (barring Apple A8, used by iPhone 6 back in 2014, which uses 8kB). This commit clamps texture size at 16kB. Note that while it fixes Zed crash, using a font size that hits the limit is still pretty unusable - the users will still have a pretty unusable editor, but at least it won't crash for them.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 9, 2024
@maxdeviant maxdeviant changed the title gpui/metal: Clamp max texture width/heigh to 16kB. gpui/metal: Clamp max texture width/height to 16kB Apr 9, 2024
@osiewicz
osiewicz merged commit 4fb9f41 into main Apr 9, 2024
@osiewicz
osiewicz deleted the fix-max-texture-size-metal branch April 9, 2024 12:09
ConradIrwin added a commit that referenced this pull request Feb 24, 2026
Port of #10314 to the wgpu renderer
@ConradIrwin ConradIrwin mentioned this pull request Feb 24, 2026
3 tasks
ConradIrwin added a commit that referenced this pull request Feb 24, 2026
Port of #10314 to the wgpu renderer

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a panic when rendering an image larger than the GPU could
support.
ConradIrwin added a commit that referenced this pull request Feb 24, 2026
Port of #10314 to the wgpu renderer
dapovoa pushed a commit to dapovoa/zed that referenced this pull request Mar 2, 2026
Port of zed-industries#10314 to the wgpu renderer

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a panic when rendering an image larger than the GPU could
support.
tahayvr pushed a commit to tahayvr/zed that referenced this pull request Mar 4, 2026
Port of zed-industries#10314 to the wgpu renderer

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a panic when rendering an image larger than the GPU could
support.
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Port of zed-industries#10314 to the wgpu renderer

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a panic when rendering an image larger than the GPU could
support.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
)

Fixed zed-industries#10149
A user had Zed crash due to invalid font size in settings. It turned out
the width/height of glyphs does not pass validation in Metal texture
initialization with a large enough font size.

All modern Macs have a max texture width/height of 16kB (barring Apple
A8, used by iPhone 6 back in 2014, which uses 8kB). This commit clamps
texture size at 16kB. Note that while it fixes Zed crash, using a font
size that hits the limit is still pretty unusable - the users will still
have a pretty unusable editor, but at least it won't crash for them.



Release Notes:

- Fixed crashes with huge `buffer_font_size` values.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Port of zed-industries#10314 to the wgpu renderer

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a panic when rendering an image larger than the GPU could
support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash after font size change

1 participant