Forums - Debugging shaders and FBO

3 posts / 0 new
Last post
Debugging shaders and FBO
Flamaros
Join Date: 6 May 14
Posts: 17
Posted: Tue, 2017-12-19 09:22
Hello,
 
I have an issue when trying to use gl_FragData in my shader on a One Plus 3T which has an Adreno 530 (OpenGL ES 3.2 [email protected]). Same code is working fine on a Samsung Note 3 with an Adreno 330 (OpenGL ES 3.0 [email protected]).
 
The shader doesn't compile on the One Plus 3T and I get the following error :
I Adreno : ERROR: 0:49: '[' : array index out of range '1'
I Adreno : ERROR: 1 compilation errors. No code generated.
 
And with the profiler I am not able to see shader programs or the color attachment buffers.
 
PS: In my shader code I don't precise the version number, as we support OpenGL ES 2.0 and use the MRT only if available on the device.
 
  • Up0
  • Down0
BenM
Join Date: 12 May 16
Posts: 29
Posted: Tue, 2017-12-19 10:28

I believe different versions of the shader compiler may enforce some restrictions differently, especially if you are not specifying a specific version for it to target.  Make sure that you are not specifying an index value >= gl_MaxDrawBuffers when indexing gl_FragData, and note that the built-in constant gl_MaxDrawBuffers may change depending on the shader version being targeted.  You will likely need to write different shaders to support both the MRT and non-MRT versions.

What version of Profiler are you using, and are any errors reported when you are selecting the shader program to view?  Note that we cannot display shader code for binary shaders/programs, so its best to disable the use of these when debugging your own applications.

-Ben

  • Up0
  • Down0
Flamaros
Join Date: 6 May 14
Posts: 17
Posted: Tue, 2017-12-19 10:59

Thank you a lot for help.

 

I think the usage of gl_FragData is little confusing because I found a documentation of Apple that tell that it is removed in GLSL 300 : https://developer.apple.com/library/content/documentation/3DDrawing/Conc...

 

But I am currently looking to use it on OpenGL ES 3.0 devices, here is my condition to activate the support of MRT (majorVersion >= 3) || strstr(extensionsString, "GL_EXT_draw_buffers");

And currently I just add one buffer (ATTACHMENT1) with the exact same configuration as the default one (ATTACHMENT0).

 

So I don't really figure out what is the best way to support MRT on all platforms with the fewest differences possible (we also target PC with OpenGL 2.1) at the same time as Mobile with OpenGL ES 2.0. I am not particularely interested to have the outputs named in the shader file, my only priority is to make it works everywhere with a performance improvement (compared to have a separed pass).

 

PS: To debug the shader, you are correct I certainly forgot to disable our binary cache (I'll take a look).

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.