mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/graphicscommand: add Shader.id
This commit is contained in:
parent
6a7688d3ac
commit
d91455c0a7
@ -98,7 +98,7 @@ func (c *drawTrianglesCommand) String() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("draw-triangles: dst: %s <- src: [%s], num of dst regions: %d, num of indices: %d, blend: %s, fill rule: %s", dst, strings.Join(srcstrs[:], ", "), len(c.dstRegions), c.numIndices(), blend, c.fillRule)
|
return fmt.Sprintf("draw-triangles: dst: %s <- src: [%s], num of dst regions: %d, num of indices: %d, blend: %s, fill rule: %s, shader id: %d", dst, strings.Join(srcstrs[:], ", "), len(c.dstRegions), c.numIndices(), blend, c.fillRule, c.shader.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec executes the drawTrianglesCommand.
|
// Exec executes the drawTrianglesCommand.
|
||||||
|
@ -46,11 +46,11 @@ type Image struct {
|
|||||||
bufferedWritePixelsArgs []writePixelsCommandArgs
|
bufferedWritePixelsArgs []writePixelsCommandArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextID = 1
|
var nextImageID = 1
|
||||||
|
|
||||||
func genNextID() int {
|
func genNextImageID() int {
|
||||||
id := nextID
|
id := nextImageID
|
||||||
nextID++
|
nextImageID++
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ func NewImage(width, height int, screenFramebuffer bool) *Image {
|
|||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
screen: screenFramebuffer,
|
screen: screenFramebuffer,
|
||||||
id: genNextID(),
|
id: genNextImageID(),
|
||||||
}
|
}
|
||||||
c := &newImageCommand{
|
c := &newImageCommand{
|
||||||
result: i,
|
result: i,
|
||||||
|
@ -19,14 +19,24 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var nextShaderID = 1
|
||||||
|
|
||||||
|
func genNextShaderID() int {
|
||||||
|
id := nextShaderID
|
||||||
|
nextShaderID++
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
type Shader struct {
|
type Shader struct {
|
||||||
shader graphicsdriver.Shader
|
shader graphicsdriver.Shader
|
||||||
ir *shaderir.Program
|
ir *shaderir.Program
|
||||||
|
id int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewShader(ir *shaderir.Program) *Shader {
|
func NewShader(ir *shaderir.Program) *Shader {
|
||||||
s := &Shader{
|
s := &Shader{
|
||||||
ir: ir,
|
ir: ir,
|
||||||
|
id: genNextShaderID(),
|
||||||
}
|
}
|
||||||
c := &newShaderCommand{
|
c := &newShaderCommand{
|
||||||
result: s,
|
result: s,
|
||||||
|
Loading…
Reference in New Issue
Block a user