From 6a72b1e10da37e906c7374236f6a52d4b56c7de8 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 3 Dec 2022 21:25:28 +0900 Subject: [PATCH] internal/ui: refactoring --- internal/ui/shader.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/ui/shader.go b/internal/ui/shader.go index 1adef6faf..a00364741 100644 --- a/internal/ui/shader.go +++ b/internal/ui/shader.go @@ -34,8 +34,8 @@ type Shader struct { func NewShader(ir *shaderir.Program) *Shader { return &Shader{ shader: mipmap.NewShader(ir), - uniformNames: ir.UniformNames, - uniformTypes: ir.Uniforms, + uniformNames: ir.UniformNames[graphics.PreservedUniformVariablesCount:], + uniformTypes: ir.Uniforms[graphics.PreservedUniformVariablesCount:], } } @@ -46,14 +46,14 @@ func (s *Shader) MarkDisposed() { func (s *Shader) ConvertUniforms(uniforms map[string]any) []uint32 { var n int - for _, typ := range s.uniformTypes[graphics.PreservedUniformVariablesCount:] { + for _, typ := range s.uniformTypes { n += typ.Uint32Count() } us := make([]uint32, n) var idx int - for i, name := range s.uniformNames[graphics.PreservedUniformVariablesCount:] { - typ := s.uniformTypes[graphics.PreservedUniformVariablesCount+i] + for i, name := range s.uniformNames { + typ := s.uniformTypes[i] if uv, ok := uniforms[name]; ok { // TODO: Panic if uniforms include an invalid name