0

The OpenGL ES 2.0 Specs state that "[s]hader compiler support is optional" (see "Notes" here).

Are there any Android devices that do not support shader compilation? If so, is there some shader compiler that I can include with my app to generate a binary instead? Or is the format of the binary also standardized so that I can precompile my shaders before hand and ship the binary with my app if needed? Or is there a requirement I can put into my app so that it isn't offered to devices without compiler support?

Markus A.
  • 12,349
  • 8
  • 52
  • 116
  • 1
    I haven't found a strict definition saying that shader compilation must be supported in Android. I have never seen a phone/tablet that does not support it. I believe making it optional in ES 2.0 was intended more for very minimal devices. Shader compilation is used in some of the public Android system/framework code. But at least theoretically, vendors could change that code. A lot of apps would not work without shader compilation, so this looks more like an academic question for typical phone/tablet types of devices. – Reto Koradi Aug 12 '15 at 03:10

1 Answers1

1

Since Android 4.0 (actually 3.0 but Google/Android never released the code as distinct product) OpenGL ES 2.0 has always been part of the spec required to get Android Market/Google Play. See: Android 4.0 Compatibility Definition Document and Android Compatibility Definition Document Archive for the other versions.

Since OpenGL ES 2.0 uses shaders written in OpenGL ES Shader Language I believe your reference to 'optional' for the Shader Compiler refers to the fact the driver vendor can provide a different interface (binary) to load shaders in. Given that there is no specified binary format, everyone as far as I can tell has got GLSL text fed into the graphics driver to build the shaders at runtime. And don't forget there are multiple GPU vendors/chipsets so specific binaries for each doesn't look too attractive from a developer point of view at least in the multi CPU architecture (ARM,x86,MIPS) multi GPU (Qualcomm,PowerVR,nVidia) world of Android. Vendors can still interpret the text differently but at least it would be within the proscribed Khronos spec.

Since text is the what is being sent over to the GPU driver, well performance could be better since it has to do the translation, mapping, scheduling, etc. which leads to the recent announcement for Vulkan see: Android Developer Blog Vulkan Announcement. If you look at the specs, it describes an intermediate binary format but is probably at least a year away from a consumer available implementation.

Unless your intention is to support Gingerbread (2.3) and below - you should be able to rely upon OpenGL ES 2.0 availability.

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77
  • I am indeed trying to support Gingerbread and below as well, but since I have an OpenGL ES 1.0 version of my code running already, that issue is basically taken care of. I'm really only worried about the case where OpenGL ES 2.0 is available, but without shader compiler support. – Markus A. Aug 11 '15 at 22:37
  • So what you're saying is that even if I can't find an official statement that all Android devices support a shader compiler, it's probably still a safe assumption, since anything else wouldn't make any sense. I'd buy that. So, probably the reason why this comment is in the official spec is for some fringe embedded cases or so, but it doesn't really apply in the real world... Did I get that right? :) – Markus A. Aug 11 '15 at 22:37
  • I'll wait a bit to accept your answer to see if anyone can still find an official reference, but if nothing comes up, you get the √, and definitely a +1 already. :) – Markus A. Aug 11 '15 at 22:39
  • So you could have the two paths - if on Gingerbread, 1.0 path, else 2.0 path (and to handle the big screens). Agree on your assessment of the spec. – Morrison Chang Aug 11 '15 at 22:40