Files
ebiten/internal/shaderir/bench_test.go
T
Hajime Hoshi b78d867e7a internal/colormshader: extract ColorM shader logic from builtinshader
Create a new internal/colormshader package that owns the color matrix
shader generation, fully independent of internal/builtinshader. It has
its own shader template with ColorM logic baked in, its own
Filter/Address types, and a go:generate pipeline producing defs.go.

This removes the useColorM dimension from internal/builtinshader,
reducing it from 18 shader variants to 9. The colorm package now
imports only colormshader (not builtinshader) for shader sources,
preparing for the v2/v3 split where v2's colorm cannot access v3's
builtinshader.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 15:59:50 +09:00

35 lines
1.1 KiB
Go

// Copyright 2023 The Ebitengine Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package shaderir_test
import (
"testing"
"github.com/hajimehoshi/ebiten/v2/internal/builtinshader"
"github.com/hajimehoshi/ebiten/v2/internal/graphics"
)
func BenchmarkFilter(b *testing.B) {
src := builtinshader.ShaderSource(builtinshader.FilterNearest, builtinshader.AddressUnsafe)
s, err := graphics.CompileShader(src)
if err != nil {
b.Fatal(err)
}
uniforms := make([]uint32, graphics.PreservedUniformDwordCount)
for i := 0; i < b.N; i++ {
s.FilterUniformVariables(uniforms)
}
}