-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove dependency on cgo #109
Comments
I don't know of a way of doing this. If someone knows a way, please share. |
I honestly don't think this would be possible. OpenGL itself is an API for graphics and the interface is all written in C, so you don't have to know (proprietary) things about the graphics card and driver. Even if you did reverse engineer your own card and figure out what memory addresses and what needs to be written there to perform what, it would work specifically for your card and driver. You'd have to do it all over again for every graphics card / driver setup out there. That's exactly the problem OpenGL was created to solve. Another issue would be whether or not Go could actually do this since it's got a GC. It would require a lot of working around that to get it functional. |
I'd imagine a solution like c2goasm, where we have a tool to auto-generate Go assembly versions of each of the OpenGL functions. c2goasm: https://github.com/minio/c2goasm |
Another potential solution is using this too: |
That's not relevant. You need Go code to call a C API. You can't convert
the opengl implementation to Go. (I guess technically you could, but you'd
then have a dog slow software implementation. )
…On Sun, Sep 30, 2018, 2:19 AM Jake Bentvelzen ***@***.***> wrote:
Another potential solution is using this too:
https://github.com/elliotchance/c2go
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#109 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AhhKJwvW76gqHgMSBC8uikgGIckgSFNJks5ugH51gaJpZM4W1mHp>
.
|
This is possible at least on Windows by |
I meant |
@silbinarywolf I was wondering if you are working on this. If not, can I do this (for Windows)? |
@hajimehoshi I haven't started anything and I've only toyed with a few of the c2go libraries to see how they work. So go ahead and do this :) |
I realized this is important to improve even |
Question: now on Windows, |
glfw/glfw#120 I got it, |
https://godoc.org/github.com/go-gl/gl/v2.1/gl#BufferStorageExternalEXT Oops, there are APIs that exposes C types. This means that we'll break backward compatibility if we eliminate dependencies on Cgo :-/ |
Indeed. However, there's only 8 of them (compared to hundreds or thousands of Go types), and I don't think they should've been exposed in the first place. I don't know whether they're functional (it might not be possible to use them). According to https://golang.org/cmd/cgo/, "a Go package should not expose C types in its exported API":
|
I confirmed these functions are not used (at least on GitHub). I'm now writing proposal to replace these types :-) |
I think I've done 80%: https://github.com/hajimehoshi/glow/tree/nocgo Probably I'll be able to send a PR this week end :-) |
The current problem is that |
Hi, I wrote the proposal https://docs.google.com/document/d/1mqquznil9fR2amtb3eTC2ObCx3A8Af_5INqKjO-pKDg/edit?usp=sharing how to eliminate Cgo usages on Windows. Feedbacks are welcome! Before starting to review the PR, I'd like to confirm that we agree the direction. Thanks! |
Hi, what's going on this? (@dmitshur ?) |
That is unfortunate, but if we couldn't reach agreement, I'd need to make a fork of go-gl... |
I think we did reach agreement. We talked on slack and I left some comments on the proposal document. As long as you're willing to help maintain the Windows cgo-free version, we're happy to accept it. |
In the meantime it gets merged, you can use my fork. |
Can I ask, when will it official? |
At least, we will want syscall.Syscall18 for Windows in near future to remove Cgo usages from Windows. 1.12 is the minimum version to support this. Updates #109
At least, we will want syscall.Syscall18 for Windows in near future to remove Cgo usages from Windows. 1.12 is the minimum version to support this. Updates #109
This absolutely needs to be merged, I literally can't build anything on Windows and this fixed my issue
|
Friedly ping |
Wait, wasn`t it pull request? If the problem is not pull request, I will look to this ... |
Has anyone made an attempt using this? https://github.com/petermattis/fastcgo All of my calls to OpenGL are inside an OS-locked thread, so my understanding is that the drawbacks would not be an issue. |
fastcgo is unsafe and use cgo, this is thread obout remove them similar https://github.com/ebitengine/purego |
Oh, you are correct, sorry about this. I confused this thread for a discussion about the performance overhead of cgo, while this one is more about the build process. |
How much effort is this or how feasible is this?
It'd be great if I didn't need to install additional build tools on my Windows machines when working with this library. It would also make cross-compilation from Windows to Linux easier.
I'd be willing to put in the work if someone is able to point to examples of other repositories that removed the dependency on cgo.
The text was updated successfully, but these errors were encountered: