This discussion was created from comments split from: Long shader compilation time on SGX544MP(Galaxy S4)..
i also met this issue on powervr sgx544MP and some other powervr chips.
The time for shader compiling is very slow(10x or 100x time vs other GPUs) and this problem is not occurred in other gpu chips such as: adreno, tegra, mali.
could you please suggest any solutions for me.Do i need to optimize shader code in any specific way…?
thanks a alot,
I’ve spilt your post from the old discussion so we can easily focus on your problem.
Can you share an APK with us that reproduces the issue, or a PVRTrace recording of your app? If you would prefer to share files with us confidentially, you can attach them to a ticket in our support portal.
sorry for the late reply.
How can i attach file in this thread? I go to support portal but cannot find the way to attach file
thanks and regards,
It’s not possible to upload files to our forum. You can, however, host the file (e.g. Dropbox, box.com etc.) and post a link to it.
When filing a ticket, you can use the “Upload a file” option under the “Attachments” heading at the bottom of the page. Our ticketing system currently has an attachment size limit of 2Mb. We’re hoping to remove this restriction in the future.
after profiling, my game need to compile over 500 shader files(vertex and fragment).The time-cost for compile and link is over 150 seconds, unacceptable for loading time :-(.
I found that a solution is using binary program.I sent a mail to dev support and waiting for a shader compiler from you guys.
I want to compile and link shader programs offline totally, pack them into game data.Not for first time game run(because it still slow at first time game run if do this).
Do you see if it is a possible solution?
if yes, please give some guidances to implement this feature.
thanks and regards,
We can provide offline compilers to produce shader binaries, but the binaries are not portable. They’re very specific to not only the version of the hardware (e.g. SGX544), but also the revision of it. In some cases, the drivers can also be dependant on graphics driver version.
Recent versions of Android have a built-in shader cache that take a hash of a shader string on first compoilation & use the hash to look up existing shader binaries for subsequent runs. If you would prefer to cache binaries yourself, you can use the GL_OES_get_program_binary extension. Our SDK includes an example application that demonstrates how to use this extension.
thanks for you reply.
I will try to use cache binary shaders by myself.
i used GL_OES_get_program_binary extension to pre-compiles shaders, but i have some problem:
glGetProgramBinary usually return 0 in length and binaryFormat parameters.
my game linked about 400 shader programs and near 300 programs return 0.
I have no idea about this.
Have you referred to the implementation of the extension in our BinaryShader SDK Example? Are you encountering the issues when running on the Galaxy S4, or another device?
It’s oke when run BinaryShader sdk example on my S4 device.
But when running my game on S4, i can get some shader programs binary but almost others are fail to get.
I’m sure they’re linked successfully.
Is this driver issue? if that so i don’t know how to resolve the slowness problem.
Please help me.
Here are some debug infomations.
I have same vertex and fragment shaders but have diffirence in #define flags when compile and link, the first program can get binary successfully but the second is fail.
[2014/4/18 17:18:31.927] I/BinaryShader(19699): binaryFormat:37168
[2014/4/18 17:18:31.932] I/BinaryShader(19699): binaryLength:2230
[2014/4/18 17:18:31.935] I/BinaryShader(19699): lengthWritten:2230
[2014/4/18 17:18:32.485] I/BinaryShaderFail(19699): binaryFormat:0
[2014/4/18 17:18:32.488] I/BinaryShaderFail(19699): binaryLength:1741
[2014/4/18 17:18:32.492] I/BinaryShaderFail(19699): lengthWritten:0
Apologies for the delayed response. If you can share an APK or PVRTrace recording with us, we can continue our investigation.