I am using Adreno Profiler 4.0 and I was wondering as to what version of the GLSL ES compiler is being used. I have fragment shader that declared
#version 300 es and calls a function that does
#if __VERSION__ >= 300
return float4( 1.0, 0.0, 0.0, 1.0 );
#else
return float4( 0.0, 0.0, 1.0, 1.0 );
#endif
If the shader compiles fine which is does by the specification __VERSION__ will be at least 300, however this does not seems to be the case because I have seeing blue for output instead of the expected red. The device Adreno 305 does show the red output. There seems to be some inconsistency in how macros are processed by the shader compiler and I will be posting another macro related issue and soon as I narrow this down as this is the first part of the test.
Host Platform:
Window 7 64-bit
Adreno Profiler and Macros
Posted: Sun, 2015-03-01 06:46
Any thoughts or feeback on this one? Its been weeks now.
My apologies for the delay,
I have passed your question on to the Adreno Profiler team, and will report back with findings. I suspect that it's a problem in how we modify the shaders for use on the PC, or perhaps (less likely) with your desktop GPU drivers. Would you mind sharing your GPU information using this utility?
http://www.ozone3d.net/gpu_caps_viewer/
Cheers,
Pete Brubaker
Staff Engineer
Qualcomm Developer Support
===================================[ Graphics Adapters / GPUs ]
- Current Display Mode: 1920x1200 @ 60 Hz - 32 bpp
- Num GPUs: 1
- GPU 1
- Name: AMD Radeon R7 265 / HD 7850
- GPU codename: Pitcairn
- Device ID: 1002-6819
- Subdevice ID: 174B-E221
- Driver: 14.501.1003.0 - Catalyst 14.12 AMD Catalyst Omega Software (11-20-2014)
I also made a follow up post as describe in my original post in regards to macro expansion on Adreno 3xx devices not behaving according to the specification and I can no longer find the post.
I want to run my understanding back with you so that I'm clear on the issue.
The macro expansion problem occurs in Adreno Profiler and on certain A3x devices? Which devices exhibit the poor behavior?
I've talked to the Adreno Profiler team and at this time we are unsure when we will release another update, but I've added the bug to the team's JIRA. I'm guessing that __VERSION__ isn't defined in the preprocessor used in Profiler prior to sending the shader to the host machine's OpenGL shader compiler.
Also, have you considered bypassing the preprocessor in the compiler and running a pre-processor (like MCPP for example) on your shaders in a build pipeline? I think this would be a decent (albeit a pain) workaround for your issue.
http://mcpp.sourceforge.net/
Your understanding is correct. I can work with the pre-preprocessor not working correctly in the emulator, however, this is probably related to the post I mentioned in passing in regards to macro expansion not working correctly on my Adreno 305 GPU in a HTC Desire 610.
I cannot bypass the preprocessor because the tokens inserted by the preprocess would be specific to the shader compiler used to generate the code..i.e. it would not have any understanding as to which token to substitute for ex. __VERSION__( in this case the token to substitute should be the GLSL version number ). I'll actually run my shaders through the Khronos reference compiler and see what it does...but macro expansion and substitution is usually domain/language specific. Actually, on further inspection, the link you provided would probably work, but that also brings along with it a significant time investment. I'll try to find other workaround if possible..