mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user