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

Add option to not remove \n for easier debugging. #440

Open
wrightwriter opened this issue Aug 11, 2024 · 6 comments
Open

Add option to not remove \n for easier debugging. #440

wrightwriter opened this issue Aug 11, 2024 · 6 comments

Comments

@wrightwriter
Copy link

If new line characters are stripped, shader errors (on windows/nvidia) become very hard to track.
image
I propose an option --no-remove-newline, which would allow easier spotting of issues.

@LeStahL
Copy link

LeStahL commented Aug 11, 2024

--format indented

@wrightwriter
Copy link
Author

hm, i thought it's not that option, because --format <text|indented|c-variables|c-array|js|nasm|rust> seems unrelated to the preprocessing.

@eldritchconundrum
Copy link
Collaborator

For most formats, newlines and indentation can be preserved in the source code of the surrounding language, but are not preserved at run-time, the shader source itself is fully compressed.

--format indented is different. It preserves newlines and indentation in the shader source itself.

It's a bit confusing, I guess... When generating C/JS/nasm/Rust, there's currently no way to preserve newlines and indentation in the shader source itself.

@therontarigo
Copy link
Contributor

For every format option we could have a -indented flavor, which would keep the spaces and newline escapes within the string literals.

It shouldn't be needed though, since a shader may be easily loaded from file for testing purposes, and glslang can catch most errors at project build time.

@wrightwriter
Copy link
Author

It can be loaded from file, but my engine has a whole build system around it, which involves shader_minifier, so it's a bit complicated. I'll end up generating the c strings myself, but at that point - it could be a feature of shader minifier. It does already exist to some extent.

Glslang is a valid option... It fared pretty well in my vulkan engine. But it adds complexity to the project.

@LeStahL
Copy link

LeStahL commented Aug 14, 2024

or you could use an incbin type of mechanism, which enables using the plain text formats in both debug and release builds.

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

4 participants