mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
gpu: fold driver.Framebuffer functionality into driver.Texture
driver.Device.NewFramebuffer doesn't provide additional information over driver.Device.NewTexture, so Texture can hold its (optional) framebuffer on behalf of the renderers. Metal don't even need a separate framebuffer object. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-9
@@ -95,7 +95,6 @@ type fboSet struct {
|
||||
|
||||
type stencilFBO struct {
|
||||
size image.Point
|
||||
fbo driver.Framebuffer
|
||||
tex driver.Texture
|
||||
}
|
||||
|
||||
@@ -257,8 +256,7 @@ func (s *fboSet) resize(ctx driver.Device, sizes []image.Point) {
|
||||
waste := float32(sz.X*sz.Y) / float32(f.size.X*f.size.Y)
|
||||
resize = resize || waste > 1.2
|
||||
if resize {
|
||||
if f.fbo != nil {
|
||||
f.fbo.Release()
|
||||
if f.tex != nil {
|
||||
f.tex.Release()
|
||||
}
|
||||
tex, err := ctx.NewTexture(driver.TextureFormatFloat, sz.X, sz.Y, driver.FilterNearest, driver.FilterNearest,
|
||||
@@ -266,13 +264,8 @@ func (s *fboSet) resize(ctx driver.Device, sizes []image.Point) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fbo, err := ctx.NewFramebuffer(tex)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
f.size = sz
|
||||
f.tex = tex
|
||||
f.fbo = fbo
|
||||
}
|
||||
}
|
||||
// Delete extra fbos.
|
||||
@@ -282,7 +275,6 @@ func (s *fboSet) resize(ctx driver.Device, sizes []image.Point) {
|
||||
func (s *fboSet) delete(ctx driver.Device, idx int) {
|
||||
for i := idx; i < len(s.fbos); i++ {
|
||||
f := s.fbos[i]
|
||||
f.fbo.Release()
|
||||
f.tex.Release()
|
||||
}
|
||||
s.fbos = s.fbos[:idx]
|
||||
|
||||
Reference in New Issue
Block a user