diff --git a/gpu/compute.go b/gpu/compute.go index 6de65c21..c72773c8 100644 --- a/gpu/compute.go +++ b/gpu/compute.go @@ -1340,9 +1340,7 @@ func (g *compute) render(images *textureAtlas, dst driver.Texture, cpuDst cpu.Im } func (g *compute) memoryBarrier() { - if !g.useCPU { - g.ctx.MemoryBarrier() - } else { + if g.useCPU { g.dispatcher.Barrier() } } diff --git a/gpu/internal/d3d11/d3d11_windows.go b/gpu/internal/d3d11/d3d11_windows.go index a30f6a23..08698c33 100644 --- a/gpu/internal/d3d11/d3d11_windows.go +++ b/gpu/internal/d3d11/d3d11_windows.go @@ -591,8 +591,6 @@ func (b *Backend) BindImageTexture(unit int, tex driver.Texture) { } } -func (b *Backend) MemoryBarrier() {} - func (b *Backend) DispatchCompute(x, y, z int) { b.ctx.CSSetShader(b.program.shader) b.ctx.Dispatch(uint32(x), uint32(y), uint32(z)) diff --git a/gpu/internal/driver/driver.go b/gpu/internal/driver/driver.go index b07cbb50..a5a27b9f 100644 --- a/gpu/internal/driver/driver.go +++ b/gpu/internal/driver/driver.go @@ -49,7 +49,6 @@ type Device interface { BeginCompute() EndCompute() CopyTexture(dst Texture, dstOrigin image.Point, src Texture, srcRect image.Rectangle) - MemoryBarrier() DispatchCompute(x, y, z int) Release() diff --git a/gpu/internal/metal/metal_darwin.go b/gpu/internal/metal/metal_darwin.go index 1c29fafb..b915ce5e 100644 --- a/gpu/internal/metal/metal_darwin.go +++ b/gpu/internal/metal/metal_darwin.go @@ -818,8 +818,6 @@ func (b *Backend) BindImageTexture(unit int, tex driver.Texture) { b.BindTexture(unit, tex) } -func (b *Backend) MemoryBarrier() {} - func (b *Backend) BeginCompute() { b.endEncoder() b.ensureCmdBuffer() diff --git a/gpu/internal/opengl/opengl.go b/gpu/internal/opengl/opengl.go index 7436b225..62c28ce4 100644 --- a/gpu/internal/opengl/opengl.go +++ b/gpu/internal/opengl/opengl.go @@ -760,10 +760,6 @@ func (b *Backend) Release() { *b = Backend{} } -func (b *Backend) MemoryBarrier() { - b.funcs.MemoryBarrier(gl.ALL_BARRIER_BITS) -} - func (b *Backend) DispatchCompute(x, y, z int) { for binding, buf := range b.storage { if buf != nil { @@ -771,6 +767,7 @@ func (b *Backend) DispatchCompute(x, y, z int) { } } b.funcs.DispatchCompute(x, y, z) + b.funcs.MemoryBarrier(gl.ALL_BARRIER_BITS) } func (b *Backend) BindImageTexture(unit int, tex driver.Texture) { @@ -1157,6 +1154,7 @@ func (b *Backend) BindPipeline(pl driver.Pipeline) { } func (b *Backend) BeginCompute() { + b.funcs.MemoryBarrier(gl.ALL_BARRIER_BITS) } func (b *Backend) EndCompute() {