Search Issue Tracker

Won't Fix

Votes

1

Found in

2019.4

2020.3

2021.1

2021.2

2021.2.0b13

2022.1

Issue ID

1369438

Regression

No

Crash or freeze with large static array in compute shader when using Vulkan or OpenGLES3

Shader System

-

How to reproduce:
1. Open the attached project '1369438.zip'
2. Make sure that Vulkan or OpenGLES3 Graphics API is selected in the Player Settings
3. Build And Run on Android device

Expected results: The app does not crash or flicker
Actual results: With OpenGLES3 - a black screen is shown and the app crashes, on Vulkan - the app crashes instantly or the screen is flickering for under a minute and when it stops, the app crashes

Reproducible with: 2019.4.31f1, 2020.3.19f1, 2021.1.24f1, 2021.2.0b15, 2022.1.0a12

Reproducible on:
VLNQA00001, Google Pixel 2 (Pixel 2), Android 11, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00288, Samsung Galaxy J7 (SM-J730F), Android 8.1.0, CPU: Exynos 7 Octa 7870, GPU: Mali-T830 (only reproducible with Vulkan)
VLNQA00225, Qualcomm null (SDM845 for arm64), Android 8.1.0, CPU: Snapdragon 845 SDM845, GPU: Adreno (TM) 630 (only reproducible with Vulkan)

Not reproducible on:
VLNQA00316, Samsung Galaxy Note10 (SM-N970F), Android 9, CPU: Exynos 9 Series 9825, GPU: Mali-G76
VLNQA00022, Xiaomi Redmi Note 3 (Redmi Note 3), Android 6.0.1, CPU: Snapdragon 617 MSM8952, GPU: Adreno (TM) 510
N/A, Huawei - (NOH-NX9), Android 10, CPU: NOT FOUND, GPU: Mali-G78

Notes:
- Reproducible on Vulkan and OpenGLES3 Graphics APIs
- Not reproducible when 'Fixed Map Size' is ticked (press on 'Mesh Generator' GameObject, in the Inspector, under 'Mesh Generator (Script)' Component, select 'Fixed Map Size' property)

  1. Resolution Note (2022.2.X):

    Due to how HLSLcc works and wide range of driver behaviors on GL/Vulkan space, it is very difficult to fix this in a generic way. Large arrays of constant data written in the shader itself can quite easily cause trouble with the drivers. Fortunately there are couple of ways to workaround this.

    1) Manually pack the data into float4 array in the source shader. This ensures that the translated shader will also see tightly packed data, minimizing any extra padding elements. This workaround would work in the cases where the padding pushes the data amount over what the drivers can hancle.

    2) Use a buffer resource to pass in the data instead of trying to hardcode it in the shader. This is the safest and most generic approach.

Comments (1)

  1. CosmoM

    Jan 13, 2024 21:01

    What does the proposed solution 2) mean? I have this same issue building for Linux (OpenGL/Vulkan, no problems for MacOS or Windows) and am using computeshaders to fill rendertextures, this is where the error originates. How do I "pass a buffer resource" instead?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.