Closed zyxkad closed 10 months ago
When run g3n with -race flag, program will failed:
-race
It's because g3n will covert uint32 offset into unsafe.Pointer in order to pass it to C function *void. https://github.com/g3n/engine/blob/4e30d5c3f79e6690781696921fb09f3c329ae520/gls/gls-desktop.go#L813-L816
uint32
unsafe.Pointer
*void
Thanks!!
When run g3n with
-race
flag, program will failed:Stacktrace
``` fatal error: checkptr: pointer arithmetic computed bad pointer value goroutine 1 [running, locked to thread]: runtime.throw({0x1046f90e6?, 0x1045aad24?}) /opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:1077 +0x40 fp=0xc0000e94f0 sp=0xc0000e94c0 pc=0x10450b490 runtime.checkptrArithmetic(0xe9538?, {0x0?, 0xc0000e9568?, 0x1045a9500?}) /opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/checkptr.go:52 +0xb8 fp=0xc0000e9520 sp=0xc0000e94f0 pc=0x1044de028 github.com/g3n/engine/gls.(*VBO).Transfer.(*GLS).VertexAttribPointer.func1(0x3?, 0xc0?, 0x98ab0?, 0xc0?, 0x46f05ed?, 0xc) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/gls/gls-desktop.go:815 +0x60 fp=0xc0000e9570 sp=0xc0000e9520 pc=0x1045a96b0 github.com/g3n/engine/gls.(*GLS).VertexAttribPointer(...) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/gls/gls-desktop.go:815 github.com/g3n/engine/gls.(*VBO).Transfer(0xc00028e230, 0xc000000120) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/gls/vbo.go:311 +0x45c fp=0xc0000e96a0 sp=0xc0000e9570 pc=0x1045a951c github.com/g3n/engine/geometry.(*Geometry).RenderSetup(0xc0001fe410, 0xc000000120) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/geometry/geometry.go:528 +0x218 fp=0xc0000e9740 sp=0xc0000e96a0 pc=0x10460f7a8 github.com/g3n/engine/graphic.(*GraphicMaterial).Render(0xc00028cc60, 0xc000000120, 0xc0000e99f8?) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/graphic/graphic.go:305 +0xac fp=0xc0000e9840 sp=0xc0000e9740 pc=0x104623dbc github.com/g3n/engine/renderer.(*Renderer).renderGraphicMaterial(0xc0000f6580, 0xc00028cc60) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/renderer/renderer.go:354 +0x5cc fp=0xc0000e9a60 sp=0xc0000e9840 pc=0x10467410c github.com/g3n/engine/renderer.(*Renderer).Render(0xc0000f6580, {0x1047c66e0, 0xc0000b2140}, {0x1047c4da0, 0xc00022a000}) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/test/g3n/renderer/renderer.go:191 +0x7d8 fp=0xc0000e9d10 sp=0xc0000e9a60 pc=0x1046723e8 main.(*Runner).Tick(0xc0000c62c0, 0x658252f0?, 0x72a) /Users/ckpn/Mine/projects/golang/src/github.com/LiterMC/curve/runner.go:203 +0x2b0 fp=0xc0000e9e00 sp=0xc0000e9d10 pc=0x104680200 main.(*Runner).Tick-fm(0xc158b29c2bc5f690?, 0x2bcb7d1e?)It's because g3n will covert
uint32
offset intounsafe.Pointer
in order to pass it to C function*void
. https://github.com/g3n/engine/blob/4e30d5c3f79e6690781696921fb09f3c329ae520/gls/gls-desktop.go#L813-L816