mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
all: remove unnecessary conditions
Now a Kage shader is always used.
This commit is contained in:
parent
6fca8edc1b
commit
0ae2b1bc24
@ -304,11 +304,6 @@ func (c *drawTrianglesCommand) String() string {
|
||||
dst += " (screen)"
|
||||
}
|
||||
|
||||
shader := "default shader"
|
||||
if c.shader != nil {
|
||||
shader = "custom shader"
|
||||
}
|
||||
|
||||
var srcstrs [graphics.ShaderImageCount]string
|
||||
for i, src := range c.srcs {
|
||||
if src == nil {
|
||||
@ -323,7 +318,7 @@ func (c *drawTrianglesCommand) String() string {
|
||||
|
||||
r := fmt.Sprintf("(x:%d, y:%d, width:%d, height:%d)",
|
||||
int(c.dstRegion.X), int(c.dstRegion.Y), int(c.dstRegion.Width), int(c.dstRegion.Height))
|
||||
return fmt.Sprintf("draw-triangles: dst: %s <- src: [%s], %s, dst region: %s, num of indices: %d, mode: %s, even-odd: %t", dst, strings.Join(srcstrs[:], ", "), shader, r, c.nindices, mode, c.evenOdd)
|
||||
return fmt.Sprintf("draw-triangles: dst: %s <- src: [%s], dst region: %s, num of indices: %d, mode: %s, even-odd: %t", dst, strings.Join(srcstrs[:], ", "), r, c.nindices, mode, c.evenOdd)
|
||||
}
|
||||
|
||||
// Exec executes the drawTrianglesCommand.
|
||||
|
@ -104,11 +104,6 @@ func (m *Mipmap) DrawTriangles(srcs [graphics.ShaderImageCount]*Mipmap, vertices
|
||||
}
|
||||
}
|
||||
|
||||
var s *buffered.Shader
|
||||
if shader != nil {
|
||||
s = shader.shader
|
||||
}
|
||||
|
||||
var imgs [graphics.ShaderImageCount]*buffered.Image
|
||||
for i, src := range srcs {
|
||||
if src == nil {
|
||||
@ -129,7 +124,7 @@ func (m *Mipmap) DrawTriangles(srcs [graphics.ShaderImageCount]*Mipmap, vertices
|
||||
imgs[i] = src.orig
|
||||
}
|
||||
|
||||
m.orig.DrawTriangles(imgs, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, subimageOffsets, s, uniforms, evenOdd)
|
||||
m.orig.DrawTriangles(imgs, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, subimageOffsets, shader.shader, uniforms, evenOdd)
|
||||
m.disposeMipmaps()
|
||||
}
|
||||
|
||||
|
@ -603,11 +603,6 @@ func (i *Image) restore(graphicsDriver graphicsdriver.Graphics) error {
|
||||
i.basePixels.Apply(gimg)
|
||||
|
||||
for _, c := range i.drawTrianglesHistory {
|
||||
var s *graphicscommand.Shader
|
||||
if c.shader != nil {
|
||||
s = c.shader.shader
|
||||
}
|
||||
|
||||
var imgs [graphics.ShaderImageCount]*graphicscommand.Image
|
||||
for i, img := range c.images {
|
||||
if img == nil {
|
||||
@ -618,7 +613,7 @@ func (i *Image) restore(graphicsDriver graphicsdriver.Graphics) error {
|
||||
}
|
||||
imgs[i] = img.image
|
||||
}
|
||||
gimg.DrawTriangles(imgs, c.offsets, c.vertices, c.indices, c.mode, c.dstRegion, c.srcRegion, s, c.uniforms, c.evenOdd)
|
||||
gimg.DrawTriangles(imgs, c.offsets, c.vertices, c.indices, c.mode, c.dstRegion, c.srcRegion, c.shader.shader, c.uniforms, c.evenOdd)
|
||||
}
|
||||
|
||||
if len(i.drawTrianglesHistory) > 0 {
|
||||
|
@ -69,12 +69,7 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
||||
srcMipmaps[i] = src.mipmap
|
||||
}
|
||||
|
||||
var s *mipmap.Shader
|
||||
if shader != nil {
|
||||
s = shader.shader
|
||||
}
|
||||
|
||||
i.mipmap.DrawTriangles(srcMipmaps, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, subimageOffsets, s, uniforms, evenOdd, canSkipMipmap)
|
||||
i.mipmap.DrawTriangles(srcMipmaps, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, subimageOffsets, shader.shader, uniforms, evenOdd, canSkipMipmap)
|
||||
}
|
||||
|
||||
func (i *Image) WritePixels(pix []byte, x, y, width, height int) {
|
||||
|
Loading…
Reference in New Issue
Block a user