Trying to optimize STK shaders using glsl-optimizer

Trying to optimize STK shaders using glsl-optimizer

Postby suiciwd » 27 Aug 2016, 06:37

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
Graphic Designer & Website Developer
User avatar
suiciwd
 
Posts: 52
Joined: 26 Aug 2016, 12:52

Re: Trying to optimize STK shaders using glsl-optimizer

Postby Auria » 28 Aug 2016, 01:38

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?
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Trying to optimize STK shaders using glsl-optimizer

Postby suiciwd » 28 Aug 2016, 02:46

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 ?
Graphic Designer & Website Developer
User avatar
suiciwd
 
Posts: 52
Joined: 26 Aug 2016, 12:52

Re: Trying to optimize STK shaders using glsl-optimizer

Postby QwertyChouskie » 28 Aug 2016, 22:47

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?
Contributor to/fan of STK (Upstreamed Cartoon theme, numerous random big fixes/tweaks)
User avatar
QwertyChouskie
 
Posts: 559
Joined: 29 Jun 2016, 14:57

Re: Trying to optimize STK shaders using glsl-optimizer

Postby Auria » 29 Aug 2016, 01:39

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
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Trying to optimize STK shaders using glsl-optimizer

Postby suiciwd » 01 Sep 2016, 03:10

QwertyChouskie {l Wrote}:Maybe try manually specifying a later version, e.g. #version 140?


In which file ?
Graphic Designer & Website Developer
User avatar
suiciwd
 
Posts: 52
Joined: 26 Aug 2016, 12:52

Re: Trying to optimize STK shaders using glsl-optimizer

Postby QwertyChouskie » 01 Sep 2016, 03:24

I think maybe the shader itself, though not really sure...
Contributor to/fan of STK (Upstreamed Cartoon theme, numerous random big fixes/tweaks)
User avatar
QwertyChouskie
 
Posts: 559
Joined: 29 Jun 2016, 14:57

Re: Trying to optimize STK shaders using glsl-optimizer

Postby suiciwd » 01 Sep 2016, 06:34

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
Graphic Designer & Website Developer
User avatar
suiciwd
 
Posts: 52
Joined: 26 Aug 2016, 12:52

Re: Trying to optimize STK shaders using glsl-optimizer

Postby suiciwd » 01 Sep 2016, 06:51

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
Graphic Designer & Website Developer
User avatar
suiciwd
 
Posts: 52
Joined: 26 Aug 2016, 12:52

Who is online

Users browsing this forum: No registered users and 1 guest