From 07fdc1a2de1de2a1ea20570aa2aac2fcccf7c89b Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 18 Aug 2021 13:48:55 +0200 Subject: [PATCH] gpu,gpu/internal: drop implied transformation from BlitFramebuffer The Metal (and presumably the D3D11) backend doesn't support transformed framebuffer blits. The only caller doesn't need it either, so drop that capability from the driver abstraction. Signed-off-by: Elias Naur --- gpu/compute.go | 3 +-- gpu/internal/d3d11/d3d11_windows.go | 2 +- gpu/internal/driver/driver.go | 2 +- gpu/internal/opengl/opengl.go | 3 ++- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gpu/compute.go b/gpu/compute.go index a4cd3408..8de7e5ac 100644 --- a/gpu/compute.go +++ b/gpu/compute.go @@ -695,8 +695,7 @@ func (g *compute) compactLayers() error { dst := atlas.fbo sz := l.rect.Size() sr := image.Rectangle{Min: l.place.pos, Max: l.place.pos.Add(sz)} - dr := image.Rectangle{Min: l.newPlace.pos, Max: l.newPlace.pos.Add(sz)} - g.ctx.BlitFramebuffer(dst, src, sr, dr) + g.ctx.BlitFramebuffer(dst, src, sr, l.newPlace.pos) l.place.atlas.layers-- layers[i].place = l.newPlace } diff --git a/gpu/internal/d3d11/d3d11_windows.go b/gpu/internal/d3d11/d3d11_windows.go index 16ee99f2..3339b40a 100644 --- a/gpu/internal/d3d11/d3d11_windows.go +++ b/gpu/internal/d3d11/d3d11_windows.go @@ -165,7 +165,7 @@ func (b *Backend) BeginFrame(target driver.RenderTarget, clear bool, viewport im return &Framebuffer{ctx: b.ctx, dev: b.dev, renderTarget: renderTarget, foreign: true} } -func (b *Backend) BlitFramebuffer(dst, src driver.Framebuffer, srect, drect image.Rectangle) { +func (b *Backend) BlitFramebuffer(dst, src driver.Framebuffer, srect image.Rectangle, dorigin image.Point) { panic("not implemented") } diff --git a/gpu/internal/driver/driver.go b/gpu/internal/driver/driver.go index 726f1801..4fb4da24 100644 --- a/gpu/internal/driver/driver.go +++ b/gpu/internal/driver/driver.go @@ -45,7 +45,7 @@ type Device interface { BindFragmentUniforms(buf Buffer) BindStorageBuffer(binding int, buf Buffer) - BlitFramebuffer(dst, src Framebuffer, srect, drect image.Rectangle) + BlitFramebuffer(dst, src Framebuffer, srcRect image.Rectangle, dstOrigin image.Point) MemoryBarrier() DispatchCompute(x, y, z int) diff --git a/gpu/internal/opengl/opengl.go b/gpu/internal/opengl/opengl.go index 34f20e56..57a910de 100644 --- a/gpu/internal/opengl/opengl.go +++ b/gpu/internal/opengl/opengl.go @@ -1166,9 +1166,10 @@ func (b *Backend) BindIndexBuffer(buf driver.Buffer) { b.glstate.bindBuffer(b.funcs, gl.ELEMENT_ARRAY_BUFFER, gbuf.obj) } -func (b *Backend) BlitFramebuffer(dst, src driver.Framebuffer, srect, drect image.Rectangle) { +func (b *Backend) BlitFramebuffer(dst, src driver.Framebuffer, srect image.Rectangle, dorig image.Point) { b.glstate.bindFramebuffer(b.funcs, gl.DRAW_FRAMEBUFFER, dst.(*framebuffer).obj) b.glstate.bindFramebuffer(b.funcs, gl.READ_FRAMEBUFFER, src.(*framebuffer).obj) + drect := image.Rectangle{Min: dorig, Max: dorig.Add(srect.Size())} b.funcs.BlitFramebuffer( srect.Min.X, srect.Min.Y, srect.Max.X, srect.Max.Y, drect.Min.X, drect.Min.Y, drect.Max.X, drect.Max.Y,