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

Performance slowdown using w/ shaders (shine library)? #10

Closed
ianfitzpatrick opened this issue Mar 1, 2017 · 9 comments
Closed

Performance slowdown using w/ shaders (shine library)? #10

ianfitzpatrick opened this issue Mar 1, 2017 · 9 comments

Comments

@ianfitzpatrick
Copy link

Hi, thanks so much for making this, it works flawlessly UNLESS I turn on shaders :(

I am using the Shine Library to apply a few post processing effects. When I enable these effects, I have intermittent issues with my framerate dropping way way down.

Sometimes it just sort of stutters, but other times everything starts slowing down. If I turn off the shader effects, everything is fine. If I turn the shader effects on, but turn off Push, everything is fine. It's only when both are enabled that I experience these slowdowns.

I'm attaching an example Love file where this behavior happens, maybe you can make some sense of this behavior, or it's a known thing with shaders? To re-create sometimes I have to quit/reload the game several times to trigger the issue, though often it manifests on first load.

FYI you can kick by hitting the space bar, sometimes it seems like actually doing something in game also triggers the slowdown.

OurTeam.love.zip

@Ulydev
Copy link
Owner

Ulydev commented Mar 1, 2017

Hello ianfitzpatrick, thanks for opening an issue.

This is a known problem (#1) and unfortunately I can't find a way around it. Push has a setShader function, I recommend you take the shaders code from shine and apply them directly with push. Shine creates additional canvases under the hood, so the push+shine combination makes it only more graphics intensive.

I'll try to do something, but in the meantime you should consider working around that problem.

@ianfitzpatrick
Copy link
Author

ianfitzpatrick commented Mar 1, 2017

Okay thanks for getting back to me, I should have looked in closed issues! I'll try and manually apply the shaders instead through push like you mention, thanks.

@Ulydev
Copy link
Owner

Ulydev commented Mar 1, 2017

Also worth mentioning, next update will have a canvas API that will allow you to create as many canvases as you want to apply different shaders.

@Ulydev
Copy link
Owner

Ulydev commented Mar 1, 2017

@ianfitzpatrick , I've added the canvas and shader API. You might want to check out the new examples.

@ianfitzpatrick
Copy link
Author

@Ulydev Thanks a ton, I got shaders working with the new code examples in the readme!

Just for the benefit of anyone who stumbled on this thread later, in the case of the Shine shaders they are sort of embedded inside of Lua code, so you can't just include them as they are not normal shader files. You have to extract the shader portion to a separate file.

@ianfitzpatrick
Copy link
Author

Ah sorry one more question, is there a simple way to apply multiple shaders to one canvas? In Shine there was a chaining system, but push:setShader is not cumulative right, it's just "this is the active shader?"

From what I read in love forums I think I need to setup some kind of multi-pass logic in my draw loop. But just want to make sure I'm not missing a simpler way from within push.

Thanks again.

@D0NM
Copy link

D0NM commented Mar 1, 2017

I use 3+ canvases
and apply different shaders to them.
Then I draw all the canvases on the main canvas (where I use the push lib)

on switching to the fullscreen mode I lose all my shaders (they stop working. I apply them, but I see no results).
I have to investigate the bug (my bug, probable).

Your conversation might give me more clues.

@Ulydev
Copy link
Owner

Ulydev commented Mar 1, 2017

@ianfitzpatrick , you're right. push doesn't have a multi-pass system yet, but it should be fairly easy to implement. For now, it only supports drawing each canvas with 1 custom shader, then apply another shader to the final, combined render.
I'll keep you updated about it.

@D0NM , please open another issue so we can keep them organized (and give me some .love so I can help you further, the demo works fine even in fullscreen mode).

@ianfitzpatrick
Copy link
Author

@Ulydev Cool, thanks much.

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