mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/shaderir: performance optimization by reducing slices
This commit is contained in:
parent
7cb64ccffe
commit
94bf6a4cc1
@ -471,14 +471,16 @@ func (p *Program) FilterUniformVariables(uniforms []uint32) {
|
||||
for _, idx := range indices {
|
||||
reachableUniforms[idx] = true
|
||||
}
|
||||
p.uniformFactors = make([]uint32, len(uniforms))
|
||||
var idx int
|
||||
for i, typ := range p.Uniforms {
|
||||
fs := make([]uint32, typ.Uint32Count())
|
||||
c := typ.Uint32Count()
|
||||
if reachableUniforms[i] {
|
||||
for j := range fs {
|
||||
fs[j] = 1
|
||||
for i := idx; i < idx+c; i++ {
|
||||
p.uniformFactors[i] = 1
|
||||
}
|
||||
}
|
||||
p.uniformFactors = append(p.uniformFactors, fs...)
|
||||
idx += c
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user