another defer optimization

This commit is contained in:
faiface 2016-12-15 00:25:31 +01:00
parent 86e64b6fa3
commit 6f57d4035a
1 changed files with 3 additions and 1 deletions

View File

@ -181,7 +181,7 @@ func (s *Shader) SetUniformAttr(attr Attr, value interface{}) (ok bool) {
} }
DoNoBlock(func() { DoNoBlock(func() {
defer s.program.bind().restore() s.program.bind()
switch attr.Type { switch attr.Type {
case Int: case Int:
@ -229,6 +229,8 @@ func (s *Shader) SetUniformAttr(attr Attr, value interface{}) (ok bool) {
default: default:
panic("set uniform attr: invalid attribute type") panic("set uniform attr: invalid attribute type")
} }
s.program.restore()
}) })
return true return true