MixedRealityToolkit-Unity: [Android] Shader error in 'Mixed Reality Toolkit/Standard': Program 'frag', error X8000: D3D11 Internal Compiler Error: Invalid Bytecode
Describe the bug
The first time i compile the MRTK Standard shader for Android, i see a collection (30) of errors that fith the following pattern. Each one specifies a different opcode, but they all look about the same
Shader error in 'Mixed Reality Toolkit/Standard': Program 'frag', error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #1 of opcode #29 (counts are 1-based). Expected int or uint. (on gles)
Compiling Vertex program with UNITY_PASS_FORWARDBASE _CLIPPING_PLANE _DISABLE_ALBEDO_MAP _ROUND_CORNERS _IGNORE_Z_SCALE
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING
This is when the following Android player settings are configured. Not sure if they are part of the issue:
- Auto Graphics API
- Minimum API Level: 24
Unity 2018.4.11f1 MRTK development branch
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (11 by maintainers)
I made the change on my Standard Shader mirror for those who don’t want to wait for this to land in the newest MRTK release. https://github.com/provencher/MRTK-StandardShader/commit/fe4f61f77ed423a3ed025d10a66adefe981edf5e
It seems that if we replace all
fixed< X>andhalf< X>withfloat< X>in the shader, the error is no longer present.@davidkline-ms can you reopen this issue, I don’t seem to have that access anymore
Thank you so much for putting up this quick fix! I’m currently attempting to implement clipping primitives functionality in the Quest 2 running passthrough as apart of my internship project with the NASA GRC GVIS lab which involves modifying an engine model to utilize this functionality. Unfortunately even after making the changes you have listed here, it does not appear to be working. I will admit I’m rather new to working with shaders at this level. Changing the “fixed” to “float” as you had listed did fix the compiling issues with the Mixed Reality Toolkit/Standard shader so I’m able to use it on my 3D model now, however it is not working with the clipping primitives the same way it did in the HoloLens 2. Do you happen to have ideas what I may be missing or any advice on how I could go about solving this issue?
Thank you @provencher! I almost changed the default precision to full a few changes back (since the Adreno 630 in HoloLens 2 only supports full precisions scalers). But, I was worried this might hurt performance on other Android/iOS platforms.
But, since it seems Android building is broken as is. This might be a worthy change to make since most mobile AR devices have pretty modern GPUs.
Does anyone have any objections to changing everything to full precision?
Update: @provencher helped point this out. HoloLens 1 only supports full precision. HoloLens 2 supports full and half precision. So, we should do a pass on precision being used and find the conversion errors on some platforms.
I unchecked “strip engine code” in the project settings and i could build without issues now. (No idea if the .apk still works on a device though)