From 744a962bebf24e7283ccbd9cbec8f94c452b1fa4 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 20 Feb 2020 22:42:53 +0100 Subject: [PATCH] gpu: remove Backend.NilTexture It serves no purpose other than paranoia. Perhaps buggy drivers exists that require unused texture slots cleared before drawing to a texture, but if so the workaround belongs in the GL backend. Signed-off-by: Elias Naur --- gpu/backend.go | 1 - gpu/gl/backend.go | 4 ---- gpu/path.go | 2 -- 3 files changed, 7 deletions(-) diff --git a/gpu/backend.go b/gpu/backend.go index b596723e..fcaee5e0 100644 --- a/gpu/backend.go +++ b/gpu/backend.go @@ -20,7 +20,6 @@ type Backend interface { IsTimeContinuous() bool NewTexture(format TextureFormat, width, height int, minFilter, magFilter TextureFilter) Texture DefaultFramebuffer() Framebuffer - NilTexture() Texture NewFramebuffer() Framebuffer NewImmutableBuffer(typ BufferType, data []byte) Buffer NewBuffer(typ BufferType, size int) Buffer diff --git a/gpu/gl/backend.go b/gpu/gl/backend.go index 53f0304a..50579e7d 100644 --- a/gpu/gl/backend.go +++ b/gpu/gl/backend.go @@ -167,10 +167,6 @@ func (b *Backend) NewFramebuffer() gpu.Framebuffer { return &gpuFramebuffer{funcs: b.funcs, obj: fb} } -func (b *Backend) NilTexture() gpu.Texture { - return &gpuTexture{backend: b} -} - func (b *Backend) DefaultFramebuffer() gpu.Framebuffer { return b.defFBO } diff --git a/gpu/path.go b/gpu/path.go index f4e04198..e2863877 100644 --- a/gpu/path.go +++ b/gpu/path.go @@ -279,7 +279,6 @@ func (p *pather) stencilPath(bounds image.Rectangle, offset f32.Point, uv image. } func (s *stenciler) beginIntersect(sizes []image.Point) { - s.ctx.NilTexture().Bind(1) s.ctx.BlendFunc(BlendFactorDstColor, BlendFactorZero) // 8 bit coverage is enough, but OpenGL ES only supports single channel // floating point formats. Replace with GL_RGB+GL_UNSIGNED_BYTE if @@ -304,7 +303,6 @@ func (s *stenciler) cover(idx int) stencilFBO { } func (s *stenciler) begin(sizes []image.Point) { - s.ctx.NilTexture().Bind(1) s.ctx.BlendFunc(BlendFactorOne, BlendFactorOne) s.fbos.resize(s.ctx, sizes) s.ctx.ClearColor(0.0, 0.0, 0.0, 0.0)