mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/ui: refactoring
This commit is contained in:
parent
0a6813c17f
commit
6a72b1e10d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user