mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/ui: prepare extra capacities for uniform variables
This commit is contained in:
parent
80e3baae9f
commit
005e87a917
@ -18,6 +18,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/hajimehoshi/ebiten/v2/internal/graphics"
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/mipmap"
|
"github.com/hajimehoshi/ebiten/v2/internal/mipmap"
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
|
||||||
)
|
)
|
||||||
@ -72,7 +73,8 @@ func (s *Shader) ConvertUniforms(uniforms map[string]any) [][]float32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
us := make([][]float32, len(s.uniformNameToIndex))
|
// Allocate a new slice with an extra capacity. This slice's length is extended at internal/graphicscommand.
|
||||||
|
us := make([][]float32, len(s.uniformNameToIndex), len(s.uniformNameToIndex)+graphics.PreservedUniformVariablesCount)
|
||||||
for name, idx := range s.uniformNameToIndex {
|
for name, idx := range s.uniformNameToIndex {
|
||||||
if v, ok := nameToF32s[name]; ok {
|
if v, ok := nameToF32s[name]; ok {
|
||||||
us[idx] = v
|
us[idx] = v
|
||||||
|
Loading…
Reference in New Issue
Block a user