gpu: prevent texture to be larger than MaxTextureSize

Change eeb2febfea added extra space to FBO
sizes to avoid re-creating them often. However, the size could end up higher
than the GPU supports. This change caps the size.

Fixes: https://todo.sr.ht/~eliasnaur/gio/380
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2022-03-15 12:37:26 +00:00
committed by Elias Naur
parent 3fd231367f
commit eec78223d1
+7
View File
@@ -261,6 +261,13 @@ func (s *fboSet) resize(ctx driver.Device, sizes []image.Point) {
}
// Add 5% extra space in each dimension to minimize resizing.
sz = sz.Mul(105).Div(100)
max := ctx.Caps().MaxTextureSize
if sz.Y > max {
sz.Y = max
}
if sz.X > max {
sz.X = max
}
tex, err := ctx.NewTexture(driver.TextureFormatFloat, sz.X, sz.Y, driver.FilterNearest, driver.FilterNearest,
driver.BufferBindingTexture|driver.BufferBindingFramebuffer)
if err != nil {