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

Only compile shaders that have changed or need to recompile #21

Open
tcdude opened this issue Mar 15, 2022 · 2 comments
Open

Only compile shaders that have changed or need to recompile #21

tcdude opened this issue Mar 15, 2022 · 2 comments

Comments

@tcdude
Copy link
Contributor

tcdude commented Mar 15, 2022

What is the problem this feature will solve?

Only compile shaders when necessary:

  1. When the shader source has changed
  2. When targeting another graphics backend

What is the feature you are proposing to solve the problem?

AFAIK, khamake already handles shader compilation that way. So similar/same strategy for Kinc/kmake projects.

What alternatives have you considered?

No real alternative viable.. I tend to add/remove the --noshaders flag to speed up / recompile all

@Paolo-Oliverio
Copy link
Contributor

kmake has no cached state that I know right?

we could keep track of the last-modified timestamp of each file in your project. If the timestamp has changed since the last build, you need to recompile the file. Could it be reliable?

what if a shader may in future depend on other files (e.g includes or we have a different output based on options?!?)

The system should then parse the file to check the dependencies too and store the options used in some way

what about simply having a hot path and cold path where both point to the same output directory and hot path overwrite files in the cold path on compile and get removed from hot path. when you modify the file you need to put it in the hot path.

it is manual and error prone , and present collaboration concurrency issues and manual dependency tracking (when you modify an ancestor you need to put all the childrens in the hot path too), possibly other issues with the workflow relative to versioning.

a less half assed solution could be to have a central .kmake_cache or similar name directory with checksums of the files at the last compilation but how to encode the full path / platform / and any option ( even future ones ).
path + platform could generate an hash that makes for the checksum filename and then the file could be a json with the checksum plus original file path and platform in readable form and any other metadata and/or compilation options.
Could this solution scale and be future proof?
This doesn't handle renames and moves or at least the cached file become disconnected from live files and they get recompiled creating a new entry.

Other ideas?

@RobDangerous
Copy link
Member

Those problems have already been solved, have a look at the last few commits in krafix.

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

3 participants