mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-14 15:07:26 +01:00
ebiten: add BenchmarkBuiltinShader
This commit is contained in:
parent
6cf235daef
commit
04c9a802a7
@ -14,6 +14,12 @@
|
||||
|
||||
package ebiten
|
||||
|
||||
import "github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
|
||||
|
||||
var (
|
||||
ImageToBytes = imageToBytes
|
||||
)
|
||||
|
||||
func BuiltinShader(filter builtinshader.Filter, address builtinshader.Address, useColorM bool) *Shader {
|
||||
return builtinShader(filter, address, useColorM)
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
|
||||
)
|
||||
|
||||
func TestShaderFill(t *testing.T) {
|
||||
@ -2818,3 +2819,11 @@ func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkBuiltinShader(b *testing.B) {
|
||||
// Create a shader to cache the shader compilation result.
|
||||
_ = ebiten.BuiltinShader(builtinshader.FilterNearest, builtinshader.AddressUnsafe, false)
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = ebiten.BuiltinShader(builtinshader.FilterNearest, builtinshader.AddressUnsafe, false)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user