ShaderEditor icon indicating copy to clipboard operation
ShaderEditor copied to clipboard

"const bool array[] = true;" crashes app

Open Robert-K opened this issue 7 years ago • 5 comments

Running a shader containing this line crashes ShaderEditor. To be honest, I have no idea why this happens, but as this most likely isn't intended, I thought I'd create an issue. I will continue to experiment with arrays... Maybe there are other similar errors? Anyway, I would recommend checking shaders using glValidateProgram before running them. That should take care of this kind of crash.

Robert-K avatar Aug 13 '18 12:08 Robert-K

Thanks for the issue!

Unfortunately, those crashes depend from what the graphics driver is doing. I've tested several of my devices and had no crash with that line. On what device do you see that crash?

Anyway, I've implemented validating the program with glValidateProgram in this branch: https://github.com/markusfisch/ShaderEditor/tree/validate_program

So if you like, you may try that branch to see if that would fix the crash. If it does, I would merge it into the master branch.

markusfisch avatar Aug 13 '18 19:08 markusfisch

Thanks for the quick reply!

I'm using a Nexus 5X running Android 7.1.2. Could you build and upload an .apk for me to download and try out? Currently there is no way for me to build it myself.

I really love ShaderEditor, great job! (I actually consider contributing in the future, as I would like to see some other features and don't want to clutter your plans 😃)

Robert-K avatar Aug 13 '18 21:08 Robert-K

No problem, here's a signed debug build from said branch: shader-editor-test-validate.zip

It's .zip because GitHub doesn't accept files with the extension .apk. Since APK's are really just zip archives, you may simply rename the file back to .apk to install it.

This build has a .debug suffix on the application ID so it can be installed beside your already existing installation from Google Play.

Contributions are always welcome! 😄 Don't hesitate, this is Open Source! If something doesn't fit in here, you can always fork :wink: Just make sure to have a look at the open issues.

markusfisch avatar Aug 14 '18 08:08 markusfisch

Just tested it. Apparently I overestimated glValidateProgram. const bool array[]=true; still causes a crash on my device. Also infinite loop protection (topic of another open issue) isn't provided either (while(true){} is fatal, too). I will study ShaderEditor's code and experiment a bit soon :smiley:

Robert-K avatar Aug 15 '18 09:08 Robert-K

Oh well, I was afraid it would turn out that way from what I read about glValidateProgram, sorry.

To add that infinite loop protection, like it was mentioned, I'd need to implement some kind of static analysis. And of course, that would only cover issues that can be detected with static analysis. So I'm not sure if it's really worth the effort.

Yes, please, have fun experimenting! 😄

markusfisch avatar Aug 15 '18 11:08 markusfisch