Open SergeySave opened 5 years ago
Hey @SergeySave, this is interesting. Two suggestions:
https://build.lwjgl.org/release/3.2.1/windows/x64/bgfx-tools/shaderc.exe
).tools
, so that it can point to a cloned bgfx repository (easier to update without copying anything).I'm also not sure how to make this available to bgfx users, ideas are welcome.
Alright, I added those two suggestions to the file.
In terms of making this available to bgfx users, if this is made into a proper gradle plugin it could be included in the LWJGL gradle file generator. It could be made to work in such a way where you have to add it by only including the apply plugin line similarly to how you apply the java or kotlin plugins.
Other than that this plugin can also probably be made to clone the bgfx repository (or just the src folder in it) so that it can automatically fetch those include files, however I'm not really sure where it should put these.
Again it should work on windows and linux, but no guarantees.
Looking forward to it!
Environment
3.2.1
12
1.8.0_181
Linux|macOS|Windows
bgfx
Description
I wrote a wrapper plugin for BGFX's shaderc for Gradle so that running a task in gradle will result in a set of output files. This is based around/derived from the makefiles on the bgfx GitHub page. However, this Gradle plugin is probably pretty bad (my first gradle plugin), and I am unsure of how to properly publish it. I would like the LWJGL team to take what I have written here and use it to create something of similar functionality built into LWJGL. This would significantly lower the barrier to entry for bgfx in LWJGL.
Small disclaimer: this code was only tested on macOS so there is no guarantee that it will work on linux or windows.
While I don't expect anything to come from this, I hope the team can put it to some sort of use.
Here is a link to my build.gradle file that contains the code.
Some notes about how it works: In the tools directory (default:/tools) it looks for an include directory which contains all of the files in this directory. it also looks for the shaderc executable within tools/macosx, tools/linux, and tools/windows respectively depending on the operating system.
It looks for .sc files that are not varying.def.sc files inside of src/main/shaders (can be configured) and runs shaderc on all of them to turn them into each of the enabled output types (by default all).
The exported shader files are in binary format and can be read by simply using the loadShader method located in BGFXDemoUtil from LWJGL's demo project.
Thanks for taking the time to read this, and I hope you can manage to find some use for this.