Mixedrealitytoolkit-unity: [Android] Shader error in 'Mixed Reality Toolkit/Standard': Program 'frag', error X8000: D3D11 Internal Compiler Error: Invalid Bytecode

Created on 23 Oct 2019  路  15Comments  路  Source: microsoft/MixedRealityToolkit-Unity

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

Android Bug Consider for Next Iteration Shaders / Materials

All 15 comments

Ah, that's reported already, just having this too

Try lowering your Graphics Quality on the Camera Settings to Medium or lower, as depending on the device .

I found this as a very similar cause for the very same error:

Thanks @Alexees!

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)

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

This issue has been closed by an automated process because it is stale. If this is still an issue please add a new comment with more recent details and repro steps.

Hi I am still facing this issue in Unity 2019.4.5
Auto Graphics API
Minimum API Level: 24

Platform - Android
Mixed Reality Toolkit v2.4.0

Can someone provide a solution for this?

@davidkline-ms can you reopen this issue, I don't seem to have that access anymore

I can also attest to still seeing this error when working with MRTK-Quest.

It might be best to report this to Unity since the error is stemming from the D3D compiler: error X8000: D3D11 Internal Compiler Error

I have a few ideas on how we might be able to "side step" the issues. But, it would be good to know the root cause rather than having to guess and check.

@davidkline-ms do you have time to report this to Unity? If not, I can try to in the coming weeks.

It seems that if we replace all fixed< X> and half< X> with float< X> in the shader, the error is no longer present.

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 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

I've found another way to fix this by using the URP and upgrading all shaders using the provided mrtk upgrade tool: https://github.com/provencher/MRTK-Quest/issues/84

Was this page helpful?
0 / 5 - 0 ratings