mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/restorable: integrate Shader.Dispose into internal/atlas
Updates #805
This commit is contained in:
parent
2a465c2d0b
commit
bfa2c460a2
@ -68,7 +68,8 @@ func (s *Shader) deallocate() {
|
||||
if s.shader == nil {
|
||||
return
|
||||
}
|
||||
s.shader.Dispose()
|
||||
s.shader.Shader.Dispose()
|
||||
s.shader.Shader = nil
|
||||
s.shader = nil
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ func quadVertices(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1, cr, cg, cb, ca float32
|
||||
func clearImage(i *graphicscommand.Image, region image.Rectangle) {
|
||||
vs := quadVertices(float32(region.Min.X), float32(region.Min.Y), float32(region.Max.X), float32(region.Max.Y), 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
is := graphics.QuadIndices()
|
||||
i.DrawTriangles([graphics.ShaderImageCount]*graphicscommand.Image{}, vs, is, graphicsdriver.BlendClear, region, [graphics.ShaderImageCount]image.Rectangle{}, clearShader.shader, nil, graphicsdriver.FillAll)
|
||||
i.DrawTriangles([graphics.ShaderImageCount]*graphicscommand.Image{}, vs, is, graphicsdriver.BlendClear, region, [graphics.ShaderImageCount]image.Rectangle{}, clearShader.Shader, nil, graphicsdriver.FillAll)
|
||||
}
|
||||
|
||||
// ClearPixels clears the specified region by WritePixels.
|
||||
@ -141,5 +141,5 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
||||
}
|
||||
imgs[i] = src.Image
|
||||
}
|
||||
i.Image.DrawTriangles(imgs, vertices, indices, blend, dstRegion, srcRegions, shader.shader, uniforms, fillRule)
|
||||
i.Image.DrawTriangles(imgs, vertices, indices, blend, dstRegion, srcRegions, shader.Shader, uniforms, fillRule)
|
||||
}
|
||||
|
@ -26,21 +26,16 @@ import (
|
||||
)
|
||||
|
||||
type Shader struct {
|
||||
shader *graphicscommand.Shader
|
||||
Shader *graphicscommand.Shader
|
||||
}
|
||||
|
||||
func NewShader(ir *shaderir.Program) *Shader {
|
||||
s := &Shader{
|
||||
shader: graphicscommand.NewShader(ir),
|
||||
Shader: graphicscommand.NewShader(ir),
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Shader) Dispose() {
|
||||
s.shader.Dispose()
|
||||
s.shader = nil
|
||||
}
|
||||
|
||||
var (
|
||||
NearestFilterShader *Shader
|
||||
NearestFilterShaderIR *shaderir.Program
|
||||
|
Loading…
Reference in New Issue
Block a user