Skip to content
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

Nim to LLVM-IR to SPIR-V -> Is it feasible? #50

Open
heysokam opened this issue Aug 20, 2023 · 1 comment
Open

Nim to LLVM-IR to SPIR-V -> Is it feasible? #50

heysokam opened this issue Aug 20, 2023 · 1 comment

Comments

@heysokam
Copy link

heysokam commented Aug 20, 2023

Hi there.
I've been looking for a way to get nim code into shaders for a while.
I know of treeform/shady, but its made for glsl-opengl only. And I use mostly wgpu (and learning vk a bit).

Both wgpu and vulkan support spirv, and I was wondering if the code generated by this lib would be usable for conversion from llvm to spirv.
There is a converter on Khronos's github, but I know that shader lang has special requirements (don't know what thought, my knowledge of compiler internals is very low).

Do you think this conversion would be possible, using nlvm?
Could the IR generated by this compiler be used for that task?

@arnetheduck
Copy link
Owner

From what I can tell, https://github.com/KhronosGroup/SPIRV-LLVM-Translator translate llvm byte code - you can use nlvm c -c to generate raw llvm IR from Nim code which in principle should be translatable using the above tool.

I would recommend using --gc:none and -d:useMalloc to avoid including the Nim garbage collector - alternatively, --os:standalone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants