-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Check for IO errors when loading binary shader #745
Conversation
I just found out that you can actually enable C++ exceptions with http://en.cppreference.com/w/cpp/io/basic_ios/exceptions @jfirebaugh Would this be a better way to handle errors? |
Can we use our caching infrastructure instead of writing directly to disk? E.g., we could introduce a |
I suppose we could do that. Does the caching infrastructure support overwriting? Since binary shader depends on GL state combinations, loading different maps/areas could trigger more information to be included in the binary shader each time the app is closed. |
@kkaefer Perhaps I should cut a new ticket for that? In the mean time this pull request will at least fix a crash that was holding me up on working on another bug. |
Yeah, I generally prefer exceptions to manual error checking. In this case, I think the code should also handle any other exceptions (e.g. from |
d4be23c
to
4caa48d
Compare
@jfirebaugh converted to exceptions Also fixed the missing call to map::terminate which was causing havok with shader destructor. I think this might have been causing some other crashes on Android too. Can you review and merge if all is OK? |
4caa48d
to
6e3fddc
Compare
Also fix rare crash when HTTP request finishes after Map termination begins. |
Log::Error(Event::Shader, "Loading binary shader failed!"); | ||
|
||
// Delete the bad file | ||
std::remove(binaryFileName.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which std::remove
is this? I'm surprised a one-argument call compiles.
6e3fddc
to
8cca0a2
Compare
Check for IO errors when loading binary shader
This fixes #740
I had to add checks for IO errors (I thought iostream threw on errors).
I also put in the sanity check code from android-mason for good measure.