avoid possible race condition
This commit is contained in:
parent
b1f415d3ef
commit
828f7aa803
16
window.go
16
window.go
|
@ -379,20 +379,24 @@ func (wt *windowTriangles) Len() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wt *windowTriangles) Draw() {
|
func (wt *windowTriangles) Draw() {
|
||||||
|
pic := wt.w.pic // avoid
|
||||||
|
mat := wt.w.mat // race
|
||||||
|
col := wt.w.col // condition
|
||||||
|
|
||||||
pixelgl.DoNoBlock(func() {
|
pixelgl.DoNoBlock(func() {
|
||||||
wt.w.begin()
|
wt.w.begin()
|
||||||
|
|
||||||
wt.w.shader.SetUniformAttr(transformMat3, wt.w.mat)
|
wt.w.shader.SetUniformAttr(transformMat3, mat)
|
||||||
wt.w.shader.SetUniformAttr(maskColorVec4, wt.w.col)
|
wt.w.shader.SetUniformAttr(maskColorVec4, col)
|
||||||
|
|
||||||
if wt.w.pic != nil {
|
if pic != nil {
|
||||||
wt.w.pic.Texture().Begin()
|
pic.Texture().Begin()
|
||||||
}
|
}
|
||||||
wt.vs.Begin()
|
wt.vs.Begin()
|
||||||
wt.vs.Draw()
|
wt.vs.Draw()
|
||||||
wt.vs.End()
|
wt.vs.End()
|
||||||
if wt.w.pic != nil {
|
if pic != nil {
|
||||||
wt.w.pic.Texture().End()
|
pic.Texture().End()
|
||||||
}
|
}
|
||||||
|
|
||||||
wt.w.end()
|
wt.w.end()
|
||||||
|
|
Loading…
Reference in New Issue