-
Notifications
You must be signed in to change notification settings - Fork 182
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
Added missing functions for compatibility with Vulkan #273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested the PR. Just some nitpicking comments ;)
Can you provide a simple main.go app to test this?
v3.3/glfw/go.mod
Outdated
@@ -1,3 +1,3 @@ | |||
module github.com/go-gl/glfw/v3.3/glfw | |||
module github.com/tracer8086/glfw/v3.3/glfw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/tracer8086/go-gl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add it after module
directive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace tracer8086
with go-gl
;)
Otherwise you are breaking go modules
v3.3/glfw/vulkan.h
Outdated
|
||
// Retrieves the address of glfwGetInstanceProcAddress. This workaround is necessary because | ||
// CGO doesn't allow referencing C functions in Go code. | ||
void* getVulkanProcAddr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a newline to make git happy
v3.3/glfw/window.go
Outdated
@@ -201,6 +201,12 @@ func GoWindow(window unsafe.Pointer) *Window { | |||
return &Window{data: (*C.GLFWwindow)(window)} | |||
} | |||
|
|||
// GLFWWindow returns a *C.GLFWwindow reference (i.e. the GLFW window itself). This can be used for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already .Handle()
for this purpose.
Lines 191 to 196 in 6f7a984
// Handle returns a *C.GLFWwindow reference (i.e. the GLFW window itself). | |
// This can be used for passing the GLFW window handle to external libraries | |
// like vulkan-go. | |
func (w *Window) Handle() unsafe.Pointer { | |
return unsafe.Pointer(w.data) | |
} |
@pchampio You can now test the PR using this repository which is a fork of the original vulkan-go demos repository. |
Thanks for your effort. I'd like to see this support added, of course. However, I'm not keen on pulling in ~thousands of lines of code whose origin is not precisely known. Please take a look at my efforts over at #271 to make its so that GLFW is pulled from the source dictated by a specific commit, for example. Having looked at this briefly, my understanding is that vulkan.h was generated by this repository at some revision: https://github.com/KhronosGroup/Vulkan-Docs -- I'm guessing you took the vulkan-go/glfw fork of this repository, which added a vulkan.h, but the commit in that repository doesn't precisely specify where the code came from either. However, if you run the master branch of Vulkan-Docs, the code you get is quite different, it's no longer all in one header file but split into different headers for different platforms. @tracer8086 Would you be willing to take a look at generating the vulkan headers from a commit? If I can run a short script whose behaviour is to fetch files from the official repository (or generate them if appropriate), then I would be happy. |
@pwaller Sorry, I'm not sure I can do that, all of that is really convoluted for me. If this PR is merged, you could do everything else you need. |
@tracer8086 it seems you have missed my key constraint which is that I don't want to merge >4k lines of code whose provenance is not precisely known. What should someone do if they want to update that code to fix a bug in it, for example? Where do they get the more recent version? How can I verify the license is correct? I'm afraid that "Just merge this and you can do everything else you need" isn't a great answer in this case. Personally I have only very limited time to spare for this and I'm only here to help the general health of this project, not an active developer. In that way I'm acting as a gatekeeper to your change, and I apologise for that, I know it can be frustrating. I do not require that you do everything I ask. Just that you tell me exactly how I can get the source code that you've provided me here, in a way that I can reproduce with minimal time and effort, and deduce that what you did doesn't cause harm to this project. You didn't provide a link to your source for example. Put another way: how would you feel about using it if this publicly developed project pulled in ~4k lines of code from random people on the internet without scrutiny? At the moment that is what I perceive you're asking me (a volunteer with no commercial interests), or another person on this project in similar circumstances, to do. |
However, that is not the source of the file, @xlab presumably obtained that file from somewhere else. @xlab can you share where these files came from? @xlab: I see in this commit you added "So expect this repo to be deleted, probably around end of Feb 2017." I take it you intended to upstream support for Vulkan into this repository. Am I right? Do you intend to? |
@pwaller
This is 100% official Vulkan API header distribution source. The file from
So In that PR maintainers and contributors decided that Vulkan support should be in a separate PR, as it may introduce additional problems and dependencies. So I believe @tracer8086 just tries to make that PR adding Vulkan support, based on my commits from https://github.com/vulkan-go/glfw. I totally don't have much time to help now, but I really appreciate the efforts. Let me know if there are questions. |
I don't currently understand why vulkan.h belongs in go-gl/glfw. It doesn't yet make sense to me.
It seems to me there must be a way of achieving this without actually copying the header into go-gl/glfw, which would be ideal. |
Why is that exactly? "GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.". I think there is confusion behind your purpose of An the original GLFW lib does support Vulkan, and also provides own set of Vulkan headers (for GLAD), including https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.zip |
Sorry, I think I wrote something confusing since I was lacking in time to write my thoughts more clearly. I'm concerned that this PR adds a I note that the number of symbols actually used from those headers is very small, and that glfw internal.h already has a minimal set of vulkan symbols in order to be able to define My general concern is of having header files which conflict and cause confusing and difficult to diagnose failures. This could arise through multiple means. The best solution I have in mind at the moment is that I can still be persuaded otherwise, so long as someone else can show they understand these issues reasonably well.
Yes, however, this package is implementing glfw for Go, in some sense. And it was a design decision to provide
Apologies, this was the thing which I wrote hastily, so it came out as a half-baked thought. What I think we want to avoid is to require users to All that aside, as far as I can tell the only reason for having the 4kloc header is to be able to make use of the symbol
Would it work to delete the header and use the above instead? |
@tracer8086 I currently think this is close now, with the above suggestions. Sorry for the hassle. If you can respond to/test those suggestions (and if they work, implement them), I will respond by merging your changes reasonably promptly if I can. |
@pwaller Ok, I will implement and test all the suggestions in the nearest free time. |
@pwaller I still have to insist that official GLFW started to ship Vulkan headers from 3.3. The reason why this package doesn't ship them is because GLFW prior to 3.3 didn't ship them. I mean, this could be the perfect time to decide which features of GLFW 3.3 require those headers and how to properly integrate them. |
@xlab please can you point at the files to which you refer? The only dependencies I see on glad are in glfw's tests, I didn't see an example of glfw providing an interface onto vulkan or glad, except via Another constraint in my mind is that we are actually pulling glfw from upstream verbatim -- see my in-progress effort in #271, which doesn't do much other than clone from remote. So my point that this commit shouldn't be adding headers stands -- we're already taking the v3.3 sources as they exist in upstream glfw/glfw as far as I understand. If you can point at something specific where I am wrong please do! |
I presume keeping this file was an oversight.
87b9dc7
to
24b9b66
Compare
Using both resulted in warnings of redefined macros. It seems to me that using the internal header is sufficient.
With the current approach I get the following warnings:
I have fixed this in 7ad7349. @tracer8086 please confirm you're happy with the changes I made to your PR (which I did since I saw you had 'enabled maintainers to make changes', and thought we could save some round-tripping on some simple things) and I will squash merge this. |
@pwaller Yeah, I confirm I'm happy with the changes. Everything is good, thank you. |
So I think there remains one outstanding thing from the conversation so far: @xlab are you happy with the changes as they are, or have we missed something big? A last thing I noticed is [0] (And further that the return type is a uintptr, which also feels like a no-no but I realise is likely to be safe in this context since it doesn't involve a garbage-collected pointer) |
Sorry for the delay. Ping @xlab: any further input before we merge this one? I'll try to merge this within a week if there is no further input. |
LGTM! :) |
👍 thanks for your effort @zergon321 and thanks for everyone's input! |
Vulkan-go has its own fork of GLFW, but it's missing gamepad bindings which I really need. I've added some necessary functions from there to the original repository.