mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Revert "internal/restorable: integrate Shader.Dispose into internal/atlas"
This reverts commit bfa2c460a2
.
Updates #3083
This commit is contained in:
parent
17a5488c49
commit
19d2009a5f
@ -70,8 +70,7 @@ func (s *Shader) deallocate() {
|
|||||||
if s.shader == nil {
|
if s.shader == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.shader.Shader.Dispose()
|
s.shader.Dispose()
|
||||||
s.shader.Shader = nil
|
|
||||||
s.shader = nil
|
s.shader = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ func clearImage(i *graphicscommand.Image, region image.Rectangle) {
|
|||||||
vs := make([]float32, 4*graphics.VertexFloatCount)
|
vs := make([]float32, 4*graphics.VertexFloatCount)
|
||||||
graphics.QuadVerticesFromDstAndSrc(vs, float32(region.Min.X), float32(region.Min.Y), float32(region.Max.X), float32(region.Max.Y), 0, 0, 0, 0, 0, 0, 0, 0)
|
graphics.QuadVerticesFromDstAndSrc(vs, 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()
|
is := graphics.QuadIndices()
|
||||||
i.DrawTriangles([graphics.ShaderSrcImageCount]*graphicscommand.Image{}, vs, is, graphicsdriver.BlendClear, region, [graphics.ShaderSrcImageCount]image.Rectangle{}, clearShader.Shader, nil, graphicsdriver.FillRuleFillAll)
|
i.DrawTriangles([graphics.ShaderSrcImageCount]*graphicscommand.Image{}, vs, is, graphicsdriver.BlendClear, region, [graphics.ShaderSrcImageCount]image.Rectangle{}, clearShader.shader, nil, graphicsdriver.FillRuleFillAll)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearPixels clears the specified region by WritePixels.
|
// ClearPixels clears the specified region by WritePixels.
|
||||||
@ -133,5 +133,5 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
|
|||||||
}
|
}
|
||||||
imgs[i] = src.Image
|
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,16 +26,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Shader struct {
|
type Shader struct {
|
||||||
Shader *graphicscommand.Shader
|
shader *graphicscommand.Shader
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewShader(ir *shaderir.Program) *Shader {
|
func NewShader(ir *shaderir.Program) *Shader {
|
||||||
s := &Shader{
|
s := &Shader{
|
||||||
Shader: graphicscommand.NewShader(ir),
|
shader: graphicscommand.NewShader(ir),
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Shader) Dispose() {
|
||||||
|
s.shader.Dispose()
|
||||||
|
s.shader = nil
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
NearestFilterShader *Shader
|
NearestFilterShader *Shader
|
||||||
NearestFilterShaderIR *shaderir.Program
|
NearestFilterShaderIR *shaderir.Program
|
||||||
|
Loading…
Reference in New Issue
Block a user