renderer/metal: font changes needs to reset cell contents

This commit is contained in:
Mitchell Hashimoto
2024-04-28 14:10:54 -07:00
parent a08cb7405a
commit 71b90bb2e0

View File

@ -676,6 +676,15 @@ pub fn setFontGrid(self: *Metal, grid: *font.SharedGrid) void {
const metrics = grid.metrics; const metrics = grid.metrics;
self.grid_metrics = metrics; self.grid_metrics = metrics;
// Reset our cell contents.
self.cells.resize(self.alloc, self.gridSize().?) catch |err| {
// The setFontGrid function can't fail but resizing our cell
// buffer definitely can fail. If it does, our renderer is probably
// screwed but let's just log it and continue until we can figure
// out a better way to handle this.
log.err("error resizing cells buffer err={}", .{err});
};
// Update our uniforms // Update our uniforms
self.uniforms = .{ self.uniforms = .{
.projection_matrix = self.uniforms.projection_matrix, .projection_matrix = self.uniforms.projection_matrix,