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

Shaders on Android #17

Open
sorakun opened this issue Jun 15, 2015 · 29 comments
Open

Shaders on Android #17

sorakun opened this issue Jun 15, 2015 · 29 comments

Comments

@sorakun
Copy link

sorakun commented Jun 15, 2015

It seems that shaders are not compatible with GLSL ES, I attempted to run an example on adroid and it was not able to create shaders.

@WarpspeedSCP
Copy link

gl es doesn't support implicit type casting between int and float or default uniform values. you need to edit the shaders to remove default values from extern statements, and also to explicitly cast int to float, and vice-versa.

to not break functionality, you should also edit the lua files to send the default values to the shader at the very start, to emulate how default values work in desktop glsl.

@TangentFoxy
Copy link
Contributor

@WarpspeedSCP Can these changes be made on the PC without ill effect as well? Perhaps to fix this, the repo should just have modified shaders to start with.

@WarpspeedSCP
Copy link

WarpspeedSCP commented Mar 12, 2017

@Guard13007 I think it would work on desktop as well since the ES version of GLSL is a restricted form of desktop GLSL. I've seen forum posts confirm this as well.

@F483
Copy link

F483 commented Jul 17, 2017

I would really like to use this lib for a cross platform game I'm making, so I placed a 100$ bounty on this issue to help out.

@WarpspeedSCP
Copy link

Well, I sort of managed it before, so I guess I'll just try it again and issue a pull request some time?

@F483
Copy link

F483 commented Jul 17, 2017

Sure, as long as the lib works on all platforms (win/mac/linux/android/ios) I'm happy. Would try it myself but haven't got the time, so money is the best help I can offer.

@WarpspeedSCP
Copy link

I'll get around to it as soon as possible.

@Azorlogh
Copy link
Contributor

I added a util.loadShader function to load the shaders and send the initial extern values, and fixed the implicit conversions in the shaders : #31

@F483
Copy link

F483 commented Jul 19, 2017

Would this also fix ios? The bounty and issue are for android, but it would be nice to get two birds with one stone. Sadly I cant test ios myself.

@WarpspeedSCP
Copy link

It should. There's nothing platform specific in the way love handles graphics.

@Azorlogh
Copy link
Contributor

So is it good ?

@WarpspeedSCP
Copy link

WarpspeedSCP commented Jul 21, 2017

It fixes most of it, but 1 shader(phosphor.glsl) will still stop love. see here

EDIT OK, I tried these changes on my phone (android) and it caused a kernel panic or something (it freezes, then reboots)

Maybe it's just the demo, but something in this code doesn't agree with android (maybe also ios?).

@WarpspeedSCP
Copy link

WarpspeedSCP commented Jul 21, 2017

lw.zip Try it (if you dare) rename the .zip to .love. I haven't tested on desktop (though it probably wouldn't cause such problems)

EDIT - Desktop works fine. It's absoutely unusable on android though.

@F483
Copy link

F483 commented Jul 21, 2017

Fantastic! The zip above does work on my android setup. With low performance, but that is another issue.

I do however get the following error when I press the back button on the short example.

screenshot_2017-07-21-15-32-18

@Azorlogh
Copy link
Contributor

Weird! I just tried the phosphor.glsl again, but it works fine on my phone.
F483: I'm getting that too, I'll try to see what's going on.

@F483
Copy link

F483 commented Jul 21, 2017

Not all examples work and some crash the app without giving me a useful error. But this is great progress none the less.

Ultimately if I can get a 256x160 @ 60fps game on my phone I would be super happy. It may not work out and I will just have to use a classic tile based fog of war instead of using lighting to show only whats visible, but with the semi working zip above I am now at least hopeful we will get there. :)

@WarpspeedSCP
Copy link

WarpspeedSCP commented Jul 21, 2017

@F483 Just curious, but what phone do you have? Which examples are you able to run?

That error with the read only thing happens in all android phones as far as I've seen. Seems to be an implementation issue on love's end.

@F483
Copy link

F483 commented Jul 21, 2017

A very run of the mill Samsung, not the most expensive but it does manage most games well. I figure for a low res pixel art game it should be manageable with some optimization.

First entry is the phone model number.

screenshot_2017-07-21-15-51-23

@WarpspeedSCP
Copy link

If you let it idle for a while at the title screen, does anything untoward happen? Which examples crash on your phone? Because it invariably drives my phone nuts and makes it reboot. My phone isn't any pushover either. Very inexplicable.

@Azorlogh
Copy link
Contributor

Azorlogh commented Jul 21, 2017

Okay, I fixed the read-only file issue
light_world.zip

Indeed, for me it seems after some time on the menu screen the example just crashes. It does only if I am on the menu screen though, if I select an example and stay it won't crash. Strange.

All the examples seem to work for me, although some take a while to load.

@F483
Copy link

F483 commented Jul 21, 2017

I really have a hard-time pinpointing any errors. Sometimes it crashes straight when opening an example. Other times it works fine. Sometimes even the main screen crashes. Maybe it is time based? Seems very random at least. Will give the new zip a try in a bit, got to go eat.

@WarpspeedSCP
Copy link

WarpspeedSCP commented Jul 21, 2017

Seems like my phone is different from the rest, love just won't cooperate. Or not. With issues like this, maybe you should consider a different library to use for your game.

@F483
Copy link

F483 commented Jul 21, 2017

Can confirm the read only error is fixed. Still not sure about the crashes, they seem to be random and I have a hard time pinpointing it or getting any error.

Have you tried running it in the emulator? Can you get a console log from the emulator that is useful?
Will setup the emulator over the weekend to see if I can get anything.

@TangentFoxy
Copy link
Contributor

TangentFoxy commented Aug 13, 2017

In reference to the error about the read-only FS, can someone confirm that it was an error in the permissions for the app or something else? (That was my first assumption but I want to know if that was it or not in preparation for the possibility of encountering a similar error myself later on.)

@F483
Copy link

F483 commented Aug 14, 2017

I can confirm that the fix by @SpaVec worked in regards to the read-only FS issue, it still does crash after some time.

@TangentFoxy
Copy link
Contributor

@SpaVec What did you do that fixed the read-only FS issue?

@Azorlogh
Copy link
Contributor

Azorlogh commented Sep 8, 2017

@Guard13007 I just used love.filesystem.write instead of the lua function, so that it tries to write to the LÖVE save folder instead of some place it doesn't have access

@F483
Copy link

F483 commented Dec 18, 2017

Any update on the status of the issue? Would love to use this for an android/ios game.

@overjarko
Copy link

Are you still searching? What do you need in the light engine(bodys -> raycasting, which effects(just lights or also water, blur etc.))?

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

6 participants