mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-04 15:04:28 +01:00
internal/atlas: reduce the access to (*restorable.Shader).Unit
This commit is contained in:
parent
2437ad8248
commit
00fade9dcf
@ -405,7 +405,7 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderSrcImageCount]*Image, vertice
|
||||
vertices[i+2] += oxf
|
||||
vertices[i+3] += oyf
|
||||
}
|
||||
if shader.ensureShader().Unit() == shaderir.Texels {
|
||||
if shader.unit == shaderir.Texels {
|
||||
sw, sh := srcs[0].backend.restorable.InternalSize()
|
||||
swf, shf := float32(sw), float32(sh)
|
||||
for i := 0; i < n; i += graphics.VertexFloatCount {
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
type Shader struct {
|
||||
ir *shaderir.Program
|
||||
shader *restorable.Shader
|
||||
unit shaderir.Unit
|
||||
name string
|
||||
}
|
||||
|
||||
@ -32,6 +33,7 @@ func NewShader(ir *shaderir.Program, name string) *Shader {
|
||||
return &Shader{
|
||||
ir: ir,
|
||||
name: name,
|
||||
unit: ir.Unit,
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +79,12 @@ func (s *Shader) deallocate() {
|
||||
}
|
||||
|
||||
var (
|
||||
NearestFilterShader = &Shader{shader: restorable.NearestFilterShader}
|
||||
LinearFilterShader = &Shader{shader: restorable.LinearFilterShader}
|
||||
NearestFilterShader = &Shader{
|
||||
shader: restorable.NearestFilterShader,
|
||||
unit: restorable.NearestFilterShader.Unit(),
|
||||
}
|
||||
LinearFilterShader = &Shader{
|
||||
shader: restorable.LinearFilterShader,
|
||||
unit: restorable.LinearFilterShader.Unit(),
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user