PixelEffect:send() throws error if uniform unused

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
SaxonDouglass
Prole
Posts: 6
Joined: Sun Nov 11, 2012 2:14 pm

PixelEffect:send() throws error if uniform unused

Post by SaxonDouglass »

Hello everyone,

I am working on a jam game using Love 0.8.0 and have an issue with PixelEffect. I would really appreciate your help.

I have several shaders that I would like to switch between at run-time, but some of them use uniforms and some of them don't.

If I try to send() the data to a PixelEffect without the uniforms, it throws an error. I can't just declare the uniforms in the shader because they get optimized out.

Is there some way of silencing the error on Love2D's end, or can I trick the GLSL optimiser into leaving the uniforms in?

Thank you,
Saxon
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: PixelEffect:send() throws error if uniform unused

Post by Xgoff »

SaxonDouglass wrote:Hello everyone,

I am working on a jam game using Love 0.8.0 and have an issue with PixelEffect. I would really appreciate your help.

I have several shaders that I would like to switch between at run-time, but some of them use uniforms and some of them don't.

If I try to send() the data to a PixelEffect without the uniforms, it throws an error. I can't just declare the uniforms in the shader because they get optimized out.

Is there some way of silencing the error on Love2D's end, or can I trick the GLSL optimiser into leaving the uniforms in?

Thank you,
Saxon
you'll probably just have to pcall those send calls
SaxonDouglass
Prole
Posts: 6
Joined: Sun Nov 11, 2012 2:14 pm

Re: PixelEffect:send() throws error if uniform unused

Post by SaxonDouglass »

Thank you very much Xgoff, I had forgotten about pcall(). That should do the trick.

Regards,
Saxon
SaxonDouglass
Prole
Posts: 6
Joined: Sun Nov 11, 2012 2:14 pm

Re: PixelEffect:send() throws error if uniform unused

Post by SaxonDouglass »

I have been unable to get pcall() to work. I have tried it two different ways, but it still throws an error and blue screens:

Code: Select all

pcall(pixelEffect.send(pixelEffect, "rubyTextureSize", {200, 100}))

Code: Select all

pcall(pixelEffect:send("rubyTextureSize", {200, 100}))
Is there any other way I could silence or avoid this error?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: PixelEffect:send() throws error if uniform unused

Post by kikito »

The syntax is:

Code: Select all

pcall(function, param1, param2, ...)
So in your case:

Code: Select all

pcall(pixelEffect.send, pixelEffect, "rubyTextureSize", {200, 100})
When I write def I mean function.
SaxonDouglass
Prole
Posts: 6
Joined: Sun Nov 11, 2012 2:14 pm

Re: PixelEffect:send() throws error if uniform unused

Post by SaxonDouglass »

Thank you very much kikito, that works.

I'll make sure to double-check the syntax in future.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests