-
Notifications
You must be signed in to change notification settings - Fork 12
Proper ways to use external shader #77
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
Comments
I tried fixing this by using This would be hard problem to solve perfectly... (without zig itself's dependency tree support, or true solution of this comment in ziglang/zig#14288) |
I ran into this myself recently in my test game. I had to add Sokol as another dependency which works but is not super ideal - if I tried to pluck the Sokol module out of the Delve module instead, that gave me the Commit where I added a custom shader is here: |
Thinking about this more, the best thing to do for the moment would be to have the delve framework expose its sokol, and make a custom fork of Longer term, we could submit a PR to the sokol-tools project to make that header value overridable - flooh would appreciate that I'm sure. |
Thank you for your information. This is valuable for me.
I think so. In the meantime, it seems to be temporarily quicker that to write a shell script (or
Interesting. Sounds useful. |
After I read around this comment (which I quoted manytimes before) in ziglang/zig#14288, this issue may be solved in zig Porting current code base into |
@Interrupt (1) add this single line to Delve Framework's // Add sokol as module, using dependency module itself
try b.modules.put("sokol", dep_sokol.module("sokol")); ( see https://github.com/funatsufumiya/delve-framework/blob/1211a792c9795642f564ce6c6b9e1b7c8334acfd/build.zig#L117 for detail) (2) now we can use exe.root_module.addImport("sokol", delve_dep.module("sokol"));
// just like:
// exe.root_module.addImport("delve", delve_dep.module("delve")); ( see https://github.com/funatsufumiya/zig-delve-pbr-study/blob/25310f578f7a4d59df9cd21f96212a6ef6f685c7/build.zig#L48 as an example. ) This makes no conflict when using |
Great find! That looks like the best way to do this, would you like to open a PR for that build.zig change, or should I make the change? |
@Interrupt OK. Which dependencies should be exposed as modules like this in addition to |
feat: expose sokol module for shaders #77
First of all, I think this is a problem of zig dependency structure (probably related to ziglang/zig#14288, and this comment in it) , maybe not a problem of Delve Framework itself.
Description
I know that I can add custom shader by modifying Delve Framework source code itself.
However, when I use Delve Framework as a dependency of some application (with
build.zig.zon
andaddModule("delve", ...)
inbuild.zig
), accessing children dependencies can cause problem, such assokol
.At very first of
additional.glsl.zig
, we need to solveconst sg = @import("sokol").gfx;
, but if we addsokol
as additional dependency besides todelve
, causeserror: file exists in multiple modules
. (and additionally, using other commit-id'ssokol
, causes other problems.)But, when exposes
sokol
indelve
like below, we need to make a change inadditional.glsl.zig
:const sg = @import("delve").sokol.gfx;
instead ofconst sg = @import("sokol").gfx;
.( funatsufumiya@77a6ffb )
Modifying auto-generated
.glsl.zig
code would not be nice. So I'd like to know the proper way to use external shader ( and way to usesokol
also in application ), without cloning source code of Delve Framework for each applications.(There might be a way to properly handle sub-modules, and I will add it when I look into it. This article may be related.)
The text was updated successfully, but these errors were encountered: