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:
Elias Naur
2021-09-19 19:36:48 +02:00
parent b599a6d1c5
commit 0bdd24c51e
9 changed files with 135 additions and 204 deletions
+3 -10
View File
@@ -144,7 +144,7 @@ func TestFramebuffers(t *testing.T) {
}
}
func newFBO(t *testing.T, b driver.Device, size image.Point) driver.Framebuffer {
func newFBO(t *testing.T, b driver.Device, size image.Point) driver.Texture {
fboTex, err := b.NewTexture(
driver.TextureFormatSRGBA,
size.X, size.Y,
@@ -157,14 +157,7 @@ func newFBO(t *testing.T, b driver.Device, size image.Point) driver.Framebuffer
t.Cleanup(func() {
fboTex.Release()
})
fbo, err := b.NewFramebuffer(fboTex)
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
fbo.Release()
})
return fbo
return fboTex
}
func newDriver(t *testing.T) driver.Device {
@@ -191,7 +184,7 @@ func newDriver(t *testing.T) driver.Device {
return b
}
func screenshot(t *testing.T, d driver.Device, fbo driver.Framebuffer, size image.Point) *image.RGBA {
func screenshot(t *testing.T, d driver.Device, fbo driver.Texture, size image.Point) *image.RGBA {
img, err := driver.DownloadImage(d, fbo, image.Rectangle{Max: size})
if err != nil {
t.Fatal(err)