Page 1 of 1

love_Canvases undeclared identifier, cannot get shader to compile

Posted: Sun Sep 03, 2023 1:52 am
by bombquake
Hello
I'm writing shader code that writes to multiple canvses, but keep getting

Code: Select all

Version 11.4.0 - Mysterious Mysteries
Error: Error validating pixel shader code:
Line 211: ERROR: 'love_Canvases' : undeclared identifier 
Line 211: ERROR: 'love_Canvases' :  left of '[' is not of type array, matrix, or vector  
Line 211: ERROR: '' : missing #endif 
Line 211: ERROR: '' : compilation terminated 
ERROR: 4 compilation errors.  No code generated.
stack traceback:
	[love "boot.lua"]:345: in function <[love "boot.lua"]:341>
	[C]: in function 'newShader'
	render.lua:34: in function 'loadShaders'
	main.lua:13: in function 'load'
	[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
	[C]: in function 'xpcall'
	[love "boot.lua"]:361: in function <[love "boot.lua"]:348>
	[C]: in function 'xpcall'
Here's the file, shader.glsl

For the sake of testing I wrote a love file that also uses love_Canvases and it compiles just fine main.lua; I cannot figure out what I'm doing different in my shader code that's making it fail.

Re: love_Canvases undeclared identifier, cannot get shader to compile

Posted: Sun Sep 03, 2023 2:31 am
by slime
love 11's shader entry point parsing is pretty basic and doesn't know that your "vec4 effect" declaration won't be compiled, so it uses that. love 12 parses comments so it won't have that problem with your code.

Re: love_Canvases undeclared identifier, cannot get shader to compile

Posted: Sun Sep 03, 2023 3:08 am
by bombquake
Removing the comment fixed it tysm!