avoid possible race condition

This commit is contained in:
faiface 2017-01-11 00:35:16 +01:00
parent b1f415d3ef
commit 828f7aa803
1 changed files with 10 additions and 6 deletions

View File

@ -379,20 +379,24 @@ func (wt *windowTriangles) Len() int {
}
func (wt *windowTriangles) Draw() {
pic := wt.w.pic // avoid
mat := wt.w.mat // race
col := wt.w.col // condition
pixelgl.DoNoBlock(func() {
wt.w.begin()
wt.w.shader.SetUniformAttr(transformMat3, wt.w.mat)
wt.w.shader.SetUniformAttr(maskColorVec4, wt.w.col)
wt.w.shader.SetUniformAttr(transformMat3, mat)
wt.w.shader.SetUniformAttr(maskColorVec4, col)
if wt.w.pic != nil {
wt.w.pic.Texture().Begin()
if pic != nil {
pic.Texture().Begin()
}
wt.vs.Begin()
wt.vs.Draw()
wt.vs.End()
if wt.w.pic != nil {
wt.w.pic.Texture().End()
if pic != nil {
pic.Texture().End()
}
wt.w.end()