mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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.
|
||||
|
@ -46,11 +46,11 @@ type Image struct {
|
||||
bufferedWritePixelsArgs []writePixelsCommandArgs
|
||||
}
|
||||
|
||||
var nextID = 1
|
||||
var nextImageID = 1
|
||||
|
||||
func genNextID() int {
|
||||
id := nextID
|
||||
nextID++
|
||||
func genNextImageID() int {
|
||||
id := nextImageID
|
||||
nextImageID++
|
||||
return id
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ func NewImage(width, height int, screenFramebuffer bool) *Image {
|
||||
width: width,
|
||||
height: height,
|
||||
screen: screenFramebuffer,
|
||||
id: genNextID(),
|
||||
id: genNextImageID(),
|
||||
}
|
||||
c := &newImageCommand{
|
||||
result: i,
|
||||
|
@ -19,14 +19,24 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
||||
)
|
||||
|
||||
var nextShaderID = 1
|
||||
|
||||
func genNextShaderID() int {
|
||||
id := nextShaderID
|
||||
nextShaderID++
|
||||
return id
|
||||
}
|
||||
|
||||
type Shader struct {
|
||||
shader graphicsdriver.Shader
|
||||
ir *shaderir.Program
|
||||
id int
|
||||
}
|
||||
|
||||
func NewShader(ir *shaderir.Program) *Shader {
|
||||
s := &Shader{
|
||||
ir: ir,
|
||||
id: genNextShaderID(),
|
||||
}
|
||||
c := &newShaderCommand{
|
||||
result: s,
|
||||
|
Loading…
Reference in New Issue
Block a user