mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/driver: Define InvalidImageID / InvalidShaderID
This commit is contained in:
parent
586130b96c
commit
73bf1f36e5
@ -29,6 +29,11 @@ type Region struct {
|
||||
Height float32
|
||||
}
|
||||
|
||||
const (
|
||||
InvalidImageID = -1
|
||||
InvalidShaderID = -1
|
||||
)
|
||||
|
||||
type Graphics interface {
|
||||
Begin()
|
||||
End()
|
||||
@ -43,7 +48,6 @@ type Graphics interface {
|
||||
IsGL() bool
|
||||
HasHighPrecisionFloat() bool
|
||||
MaxImageSize() int
|
||||
InvalidImageID() ImageID
|
||||
|
||||
NewShader(program *shaderir.Program) (Shader, error)
|
||||
|
||||
|
@ -417,7 +417,7 @@ func (c *drawTrianglesCommand) Exec(indexOffset int) error {
|
||||
var imgs [graphics.ShaderImageNum]driver.ImageID
|
||||
for i, src := range c.srcs {
|
||||
if src == nil {
|
||||
imgs[i] = theGraphicsDriver.InvalidImageID()
|
||||
imgs[i] = driver.InvalidImageID
|
||||
continue
|
||||
}
|
||||
imgs[i] = src.image.ID()
|
||||
|
@ -413,10 +413,6 @@ func (g *Graphics) genNextImageID() driver.ImageID {
|
||||
return id
|
||||
}
|
||||
|
||||
func (g *Graphics) InvalidImageID() driver.ImageID {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (g *Graphics) genNextShaderID() driver.ShaderID {
|
||||
id := g.nextShaderID
|
||||
g.nextShaderID++
|
||||
|
@ -79,10 +79,6 @@ func (g *Graphics) genNextImageID() driver.ImageID {
|
||||
return id
|
||||
}
|
||||
|
||||
func (g *Graphics) InvalidImageID() driver.ImageID {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (g *Graphics) genNextShaderID() driver.ShaderID {
|
||||
id := g.nextShaderID
|
||||
g.nextShaderID++
|
||||
@ -391,7 +387,7 @@ func (g *Graphics) DrawShader(dst driver.ImageID, srcs [graphics.ShaderImageNum]
|
||||
|
||||
var ts [graphics.ShaderImageNum]textureVariable
|
||||
for i, src := range srcs {
|
||||
if src == g.InvalidImageID() {
|
||||
if src == driver.InvalidImageID {
|
||||
continue
|
||||
}
|
||||
ts[i].valid = true
|
||||
|
Loading…
Reference in New Issue
Block a user