Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adreno-based XR devices: VkCreateGraphicsPipelines returns VK_ERROR_UNKNOWN for PBR shaders. #625

Open
galibzon opened this issue Nov 30, 2023 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/graphics-audio Categorizes an issue or PR as relevant to SIG graphics-audio.

Comments

@galibzon
Copy link
Contributor

galibzon commented Nov 30, 2023

Describe the bug
It was found that meshes with PBR materials don't render when the game project is deployed and executed natively on Meta Quest Pro devices.

Workaround: Use DXC 1.6.2112 instead of the current one DXC 1.7.2308. I'm working on a PR that would allow to customize DXC via a settings registry.

Assets required
OpenXRTest game project.

Steps to reproduce
Compile and deploy OpenXRTest game project on an Meta Quest Pro or Quest3 device.

Expected behavior
The DefaultLevel has a SkyBox, a Grid, a Plane and a ShaderBall. All of them should be visible.

Actual behavior
Only the SkyBox and the Grid are visible.
The Plane and the ShaderBall are not visible.

Screenshots/Video
If applicable, add screenshots and/or a video to help explain your problem.

Found in Branch
o3de/development: commit e5a4c9482a2fee04d15584e7bdc5dd79297fbb60
o3de-extras/development: commit a30927e

Desktop/Device (please complete the following information):

  • Device: [Meta Quest Pro]
  • OS: [Android]
  • Version [12]
  • CPU [Octa-core Kryo 585 (1 x 2.84 GHz, 3 x 2.42 GHz, 4 x 1.8 GHz)]
  • GPU [Adreno 650]
  • Memory [12 GB LPDDR5]

Additional context
After noticing the missing meshes when running OpenXRTest on the Meta Quest Pro, I decided to debug with Android Studio.

The error occurred here, when executing VkCreateGraphicsPipelines, which returned VK_ERROR_UNKNOWN:
https://github.com/o3de/o3de/blob/1fea4bc55837d7ea0091b294dc3c17661806aeaa/Gems/Atom/RHI/Vulkan/Code/Source/RHI/GraphicsPipeline.cpp#L109
The shader name was: standardpbr_multiviewpipeline_forwardpass_standardlighting.

<12:25:26> [Error] (PipelineStateCache) - Failed to compile pipeline state. It will remain in an initialized state.
And then endless print outs of
<12:25:26> [Warning] (CommandList) - Failed to bind shader resources for draw item. Skipping.

Found a similar error as described here:
https://developer.qualcomm.com/forum/qdn-forums/software/adreno-gpu-sdk/68860
They suggest as a solution to code the shaders directly in GLSL instead of HLSL to GLSL (which is not an option for us).
That gave me the hint to revert to the older version of DXC and voila' everything worked again.

I also tried to use the Adreno Offline Compiler and compare the results between the same shader compiled with DXC 1.6.2112 vs DXC 1.7.2308. Unfortunately both versions of the shaders produced the following errors when using AOC:
Result for shaders compiled with DXC1.6.2112 (The good DXC):

    Adreno Offline Compiler (AOC)
    -----------------------------
    AOC Version     : 3.0
    Compiler Version: E031.42.19.00

Assertion failed: RegIndex == SHARED_CONST_BEGIN && "RegIndex is hard coded to c504.x during Metadata generation"
FATAL ERROR: Internal assertion error

Compilation failed.

Result for shaders compiled with DXC1.7.2308 (The "bad" DXC):

    Adreno Offline Compiler (AOC)
    -----------------------------
    AOC Version     : 3.0
    Compiler Version: E031.42.19.00

Assertion failed: false && "Unsupported Instruction in Fast Isel"
FATAL ERROR: Internal assertion error

Compilation failed.

As mentioned above the workaround is to use DXC1.6.2112 so I'm working on a feature to allow developers to customize which DXC version to use via a Settings Registry. This will buy us some time while I try to get help from Qualcomm.

@galibzon galibzon added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 30, 2023
@galibzon
Copy link
Contributor Author

FYI @moudgils , @jhmueller-huawei

galibzon added a commit to galibzon/o3de that referenced this issue Nov 30, 2023
Resolves o3de#17148 (DXC should be customizable via Settings Registry)
Which enables working around this bug:
o3de/o3de-extras#625

Developers can now pick a custom version of the DXC executable
via the Settings Registry Key:
`/O3DE/Atom/DxcOverridePath`.

Also, introduced the macro `PRE_HLSL_2021`, along with
an explanation in the following file:
/o3de/Gems/Atom/Feature/Common/Assets/ShaderLib/PRE_HLSL_2021.md
TL;DR: If a game project uses a DXC executable that doesn't conform
to the HLSL 2021 standard, then they should globally define the macro
PRE_HLSL_2021  when compiling shaders.

The O3DE default version of DXC is 1.7.2308 which conforms to HLSL 2021.
The problem is that some shaders get compiled to versions of SPIRV
not supported by Adreno GPU drivers. This commit gives the option
to use a different DXC and avoid this issue.

Removed redundant LinearToSRGB conversion functions.

Signed-off-by: galibzon <[email protected]>
galibzon added a commit to galibzon/o3de that referenced this issue Nov 30, 2023
Resolves o3de#17148 (DXC should be customizable via Settings Registry)
Which enables working around this bug:
o3de/o3de-extras#625

Developers can now pick a custom version of the DXC executable
via the Settings Registry Key:
`/O3DE/Atom/DxcOverridePath`.

Also, introduced the macro `PRE_HLSL_2021`, along with
an explanation in the following file:
/o3de/Gems/Atom/Feature/Common/Assets/ShaderLib/PRE_HLSL_2021.md
TL;DR: If a game project uses a DXC executable that doesn't conform
to the HLSL 2021 standard, then they should globally define the macro
PRE_HLSL_2021  when compiling shaders.

The O3DE default version of DXC is 1.7.2308 which conforms to HLSL 2021.
The problem is that some shaders get compiled to versions of SPIRV
not supported by Adreno GPU drivers. This commit gives the option
to use a different DXC and avoid this issue.

Removed redundant LinearToSRGB conversion functions.

Signed-off-by: galibzon <[email protected]>
galibzon added a commit to galibzon/o3de that referenced this issue Nov 30, 2023
Resolves o3de#17148 (DXC should be customizable via Settings Registry)
Which enables working around this bug:
o3de/o3de-extras#625

Developers can now pick a custom version of the DXC executable
via the Settings Registry Key:
`/O3DE/Atom/DxcOverridePath`.

Also, introduced the macro `PRE_HLSL_2021`, along with
an explanation in the following file:
/o3de/Gems/Atom/Feature/Common/Assets/ShaderLib/PRE_HLSL_2021.md
TL;DR: If a game project uses a DXC executable that doesn't conform
to the HLSL 2021 standard, then they should globally define the macro
PRE_HLSL_2021  when compiling shaders.

The O3DE default version of DXC is 1.7.2308 which conforms to HLSL 2021.
The problem is that some shaders get compiled to versions of SPIRV
not supported by Adreno GPU drivers. This commit gives the option
to use a different DXC and avoid this issue.

Removed redundant LinearToSRGB conversion functions.

Signed-off-by: galibzon <[email protected]>
galibzon added a commit to galibzon/o3de that referenced this issue Nov 30, 2023
Resolves o3de#17148 (DXC should be customizable via Settings Registry)
Which enables working around this bug:
o3de/o3de-extras#625

Developers can now pick a custom version of the DXC executable
via the Settings Registry Key:
`/O3DE/Atom/DxcOverridePath`.

Also, introduced the macro `PRE_HLSL_2021`, along with
an explanation in the following file:
/o3de/Gems/Atom/Feature/Common/Assets/ShaderLib/PRE_HLSL_2021.md
TL;DR: If a game project uses a DXC executable that doesn't conform
to the HLSL 2021 standard, then they should globally define the macro
PRE_HLSL_2021  when compiling shaders.

The O3DE default version of DXC is 1.7.2308 which conforms to HLSL 2021.
The problem is that some shaders get compiled to versions of SPIRV
not supported by Adreno GPU drivers. This commit gives the option
to use a different DXC and avoid this issue.

Removed redundant LinearToSRGB conversion functions.

Signed-off-by: galibzon <[email protected]>
galibzon added a commit to o3de/o3de that referenced this issue Dec 2, 2023
* Allow customization of DXC executable

Resolves #17148 (DXC should be customizable via Settings Registry)
Which enables working around this bug:
o3de/o3de-extras#625

Developers can now pick a custom version of the DXC executable
via the Settings Registry Key:
`/O3DE/Atom/DxcOverridePath`.

Also, introduced the macro `PRE_HLSL_2021`, along with
an explanation in the following file:
/o3de/Gems/Atom/Feature/Common/Assets/ShaderLib/PRE_HLSL_2021.md
TL;DR: If a game project uses a DXC executable that doesn't conform
to the HLSL 2021 standard, then they should globally define the macro
PRE_HLSL_2021  when compiling shaders.

The O3DE default version of DXC is 1.7.2308 which conforms to HLSL 2021.
The problem is that some shaders get compiled to versions of SPIRV
not supported by Adreno GPU drivers. This commit gives the option
to use a different DXC and avoid this issue.

Removed redundant LinearToSRGB conversion functions.

* Removed "real*" Linear<->SRGB functions
in favor of both "float*" and "half*" functions.

---------

Signed-off-by: galibzon <[email protected]>
martinwinter-huawei pushed a commit to martinwinter-huawei/o3de that referenced this issue Dec 7, 2023
* Allow customization of DXC executable

Resolves o3de#17148 (DXC should be customizable via Settings Registry)
Which enables working around this bug:
o3de/o3de-extras#625

Developers can now pick a custom version of the DXC executable
via the Settings Registry Key:
`/O3DE/Atom/DxcOverridePath`.

Also, introduced the macro `PRE_HLSL_2021`, along with
an explanation in the following file:
/o3de/Gems/Atom/Feature/Common/Assets/ShaderLib/PRE_HLSL_2021.md
TL;DR: If a game project uses a DXC executable that doesn't conform
to the HLSL 2021 standard, then they should globally define the macro
PRE_HLSL_2021  when compiling shaders.

The O3DE default version of DXC is 1.7.2308 which conforms to HLSL 2021.
The problem is that some shaders get compiled to versions of SPIRV
not supported by Adreno GPU drivers. This commit gives the option
to use a different DXC and avoid this issue.

Removed redundant LinearToSRGB conversion functions.

* Removed "real*" Linear<->SRGB functions
in favor of both "float*" and "half*" functions.

---------

Signed-off-by: galibzon <[email protected]>
@lemonade-dm lemonade-dm added sig/graphics-audio Categorizes an issue or PR as relevant to SIG graphics-audio. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/graphics-audio Categorizes an issue or PR as relevant to SIG graphics-audio.
Projects
None yet
Development

No branches or pull requests

2 participants