Page 1 of 1
Trying to optimize STK shaders using glsl-optimizer

Posted:
27 Aug 2016, 06:37
by suiciwd
I am trying to optimize STK's shaders using
https://github.com/aras-p/glsl-optimizer.I build and installed the tool using installed the tool on elementary OS freya 64-bit using
- {l Code}: {l Select All Code}
git clone https://github.com/aras-p/glsl-optimizer
cd glsl-optimizer
cmake .
make -j8 # Use double your amount of CPU cores (I have A8-4500M quad core) in place of 8
sudo cp glsl_compiler glslopt glsl_test /usr/bin
But then when I try to optimize the
billboard.frag shader in
stk-code/data/shaders/ using
glslopt -f billboard.frag I get this error.
- {l Code}: {l Select All Code}
Failed to compile billboard.frag:
(3,1): error: `in' qualifier in declaration of `uv' only valid for function parameters in GLSL 1.10
(4,1): error: `out' qualifier in declaration of `FragColor' only valid for function parameters in GLSL 1.10
(8,15): error: no matching function for call to `texture(sampler2D, vec2)'; candidates are:
This is my first post on this forum so sorry if I have put it in the wrong place
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
28 Aug 2016, 01:38
by Auria
It would appear that this tool doesn't support our shaders, Whether this is a limitation of the tool or something with our shaders I will leave up to shader experts to determine. This tool seems to be mainly meant for mobile GPUs though, considering STK doesn't run on mobile this doesn't seem too useful no?
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
28 Aug 2016, 02:46
by suiciwd
Auria {l Wrote}:It would appear that this tool doesn't support our shaders, Whether this is a limitation of the tool or something with our shaders I will leave up to shader experts to determine. This tool seems to be mainly meant for mobile GPUs though, considering STK doesn't run on mobile this doesn't seem too useful no?
So what kind of tool should we use then ?
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
28 Aug 2016, 22:47
by QwertyChouskie
From the Notes section of the GitHub page:
GLSL versions 1.10 and 1.20 are supported. 1.10 is the default, use #version 120 to specify 1.20. Higher GLSL versions might work, but aren't tested now.
Maybe try manually specifying a later version, e.g. #version 140?
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
29 Aug 2016, 01:39
by Auria
suiciwd {l Wrote}:Auria {l Wrote}:It would appear that this tool doesn't support our shaders, Whether this is a limitation of the tool or something with our shaders I will leave up to shader experts to determine. This tool seems to be mainly meant for mobile GPUs though, considering STK doesn't run on mobile this doesn't seem too useful no?
So what kind of tool should we use then ?
Usually there should be no need to use this kind of tool on desktop computers, drivers should do the optimisation job properly, and otherwise just hand-tweaking shaders
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
01 Sep 2016, 03:10
by suiciwd
QwertyChouskie {l Wrote}:Maybe try manually specifying a later version, e.g. #version 140?
In which file ?
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
01 Sep 2016, 03:24
by QwertyChouskie
I think maybe the shader itself, though not really sure...
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
01 Sep 2016, 06:34
by suiciwd
QwertyChouskie {l Wrote}:I think maybe the shader itself, though not really sure...
I added it to the the shader file and now it works

I'll do it for all the shaders and report back with the FPS improvments
Re: Trying to optimize STK shaders using glsl-optimizer

Posted:
01 Sep 2016, 06:51
by suiciwd
QwertyChouskie {l Wrote}:Maybe try manually specifying a later version, e.g. #version 140?
I tried with #version 330 (with #version 140 some shaders give errors) since STK requires OpenGL 3.3 but I get this error.
- {l Code}: {l Select All Code}
(1,10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, and 3.00 ES
I think this tool is too old for OpenGL 3.3 so is there any newer tool I can use