mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +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
|
Height float32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
InvalidImageID = -1
|
||||||
|
InvalidShaderID = -1
|
||||||
|
)
|
||||||
|
|
||||||
type Graphics interface {
|
type Graphics interface {
|
||||||
Begin()
|
Begin()
|
||||||
End()
|
End()
|
||||||
@ -43,7 +48,6 @@ type Graphics interface {
|
|||||||
IsGL() bool
|
IsGL() bool
|
||||||
HasHighPrecisionFloat() bool
|
HasHighPrecisionFloat() bool
|
||||||
MaxImageSize() int
|
MaxImageSize() int
|
||||||
InvalidImageID() ImageID
|
|
||||||
|
|
||||||
NewShader(program *shaderir.Program) (Shader, error)
|
NewShader(program *shaderir.Program) (Shader, error)
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ func (c *drawTrianglesCommand) Exec(indexOffset int) error {
|
|||||||
var imgs [graphics.ShaderImageNum]driver.ImageID
|
var imgs [graphics.ShaderImageNum]driver.ImageID
|
||||||
for i, src := range c.srcs {
|
for i, src := range c.srcs {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
imgs[i] = theGraphicsDriver.InvalidImageID()
|
imgs[i] = driver.InvalidImageID
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
imgs[i] = src.image.ID()
|
imgs[i] = src.image.ID()
|
||||||
|
@ -413,10 +413,6 @@ func (g *Graphics) genNextImageID() driver.ImageID {
|
|||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) InvalidImageID() driver.ImageID {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Graphics) genNextShaderID() driver.ShaderID {
|
func (g *Graphics) genNextShaderID() driver.ShaderID {
|
||||||
id := g.nextShaderID
|
id := g.nextShaderID
|
||||||
g.nextShaderID++
|
g.nextShaderID++
|
||||||
|
@ -79,10 +79,6 @@ func (g *Graphics) genNextImageID() driver.ImageID {
|
|||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Graphics) InvalidImageID() driver.ImageID {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *Graphics) genNextShaderID() driver.ShaderID {
|
func (g *Graphics) genNextShaderID() driver.ShaderID {
|
||||||
id := g.nextShaderID
|
id := g.nextShaderID
|
||||||
g.nextShaderID++
|
g.nextShaderID++
|
||||||
@ -391,7 +387,7 @@ func (g *Graphics) DrawShader(dst driver.ImageID, srcs [graphics.ShaderImageNum]
|
|||||||
|
|
||||||
var ts [graphics.ShaderImageNum]textureVariable
|
var ts [graphics.ShaderImageNum]textureVariable
|
||||||
for i, src := range srcs {
|
for i, src := range srcs {
|
||||||
if src == g.InvalidImageID() {
|
if src == driver.InvalidImageID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ts[i].valid = true
|
ts[i].valid = true
|
||||||
|
Loading…
Reference in New Issue
Block a user