Android OpenGL ES着色器编译器支持 [英] Android OpenGL ES shader compiler support

查看:117
本文介绍了Android OpenGL ES着色器编译器支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenGL ES 2.0规范指出"[s] hader编译器支持是可选的"(请参阅​​).

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

是否有不支持着色器编译的Android设备?如果是这样,我可以在应用程序中包含一些着色器编译器来生成二进制文件吗?还是二进制文件的格式也已标准化,以便我可以事先预编译着色器,并在需要时将二进制文件与应用一起发布?还是我可以放入我的应用程序中,以使没有编译器支持的设备无法使用它?

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?

推荐答案

自Android 4.0(实际上是3.0,但Google/Android从未将代码作为独特的产品发布)以来,OpenGL ES 2.0一直是获取Android Market所需规范的一部分/Google Play.请参阅: Android 4.0兼容性定义文档和其他版本的 Android兼容性定义文档存档.

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.

由于OpenGL ES 2.0使用以OpenGL ES着色器语言编写的着色器,我相信您对着色器编译器"的可选"的引用是指驱动程序供应商可以提供不同的接口(二进制)来加载着色器.不是指定的二进制格式,据我所知,每个人都已将GLSL文本输入图形驱动程序以在运行时构建着色器.而且不要忘了有多个GPU供应商/芯片组,因此至少从多CPU架构(ARM,x86,MIPS)多GPU(Qualcomm,PowerVR, nVidia)的Android世界.供应商仍然可以对文本进行不同的解释,但至少在所禁止的Khronos规范之内.

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.

由于文本是发送到GPU驱动程序的内容,因此性能更好,因为它必须执行翻译,映射,调度等工作.这导致了Vulkan的最新公告,请参见: Android开发者博客Vulkan公告.如果您查看规格,它描述了一种中间二进制格式,但距离消费者可用的实现可能至少有一年的时间.

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.

除非您打算支持Gingerbread(2.3)及更低版本,否则您应该能够依赖OpenGL ES 2.0的可用性.

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

这篇关于Android OpenGL ES着色器编译器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆