gpt4 book ai didi

Unity upgrade to 2022.3 or Gradle Upgrade to 7x Causing Black Screen (GetGpuPixelFormat Error)(Unity升级到2022.3或Gradle升级到7x导致黑屏(GetGpuPixelFormat错误))

转载 作者:bug小助手 更新时间:2023-10-26 21:19:50 80 4
gpt4 key购买 nike



I've had to upgrade to Unity 2022.3, which comes with the Gradle plugin upgrade from 4.0.1 to 7.1.2 and gradle from 6x to 7x. android.enableR8 had to be removed from gradle.properties, since it is apparently now always on.

我不得不升级到Unity 2022.3,它伴随着Gradle插件从4.0.1升级到7.1.2,Gradle从6x升级到7x。Android.enableR8必须从gradle.properties中删除,因为它显然现在总是打开的。


However now I am getting a black screen (not a lethal crash) after the splash art displays. Logcat is giving the following error:

然而,现在我得到一个黑屏(不是致命的崩溃)后,飞溅的艺术显示。Logcat给出以下错误:


Error qdgralloc GetGpuPixelFormat: No map for format: 0x38
Error AdrenoUtils <validate_memory_layout_input_parmas:1923>: Unknown Format 0
Error AdrenoUtils <adreno_init_memory_layout:4634>: Memory Layout input parameter validation failed!
Error qdgralloc GetGpuResourceSizeAndDimensions Graphics metadata init failed
Error Gralloc4 isSupported(1, 1, 56, 1, ...) failed with 1
Error GraphicBufferAllocator Failed to allocate (4 x 4) layerCount 1 format 56 usage b00: 1
Error AHardwareBuffer GraphicBuffer(w=4, h=4, lc=1) failed (Unknown error -1), handle=0x0

I've found this documentation which contains the pixelformat code:

我找到了这个文档,其中包含像素格式代码:


https://android.googlesource.com/platform/frameworks/base/+/master/graphics/java/android/graphics/PixelFormat.java

Https://android.googlesource.com/platform/frameworks/base/+/master/graphics/java/android/graphics/PixelFormat.java


which includes the following line:

其中包括以下几行:


public static final int R_8 = 0x38;

which is the closest thing I've found to a clue regarding the GetGpuPixelFormat error. Which leads me to think the issue is somehow related to R8?

这是我找到的关于GetGpuPixelFormat错误的最接近线索的东西。这让我觉得这个问题在某种程度上与R8有关?


What I've so far tried is disabling Vulkan and resetting graphics settings in Unity, sadly to no avail. A new project doesn't have any issue, but when I copy my assets from the main project (including the Gradle files), the issue starts again.

到目前为止,我已经尝试了禁用Vulkan并在Unity中重置图形设置,遗憾的是没有效果。新项目没有任何问题,但当我从主项目(包括Gradle文件)复制我的资源时,问题再次开始。


I am mainly a Unity user and not experienced in Android development.

我主要是一个Unity用户,在Android开发方面没有经验。


Edit: Should also mention that iOS Build works fine on the Iphone.

编辑:还应该提到iOS版本在iPhone上运行得很好。


Edit2: While building a new project and adding my assets one by one, I've realized that some of my scenes actually load some textures and don't load others, some scenes don't load any textures. Could not yet determine what those who don't load have in common. It almost seems random. Except that all textures that don't load seem to be part of the UI.

编辑2:在构建一个新项目并逐个添加我的资产时,我意识到我的一些场景实际上加载了一些纹理而没有加载其他纹理,有些场景没有加载任何纹理。还不能确定那些不加载的人有什么共同点。几乎是随机的。除了所有不加载的纹理似乎是UI的一部分。


更多回答

R8 in Gradle is a code minimizer and optimizer, it doesn't have anything to do with what you showed in the source code. developer.android.com/build/shrink-code I'd check to make sure you have all of your shaders in the build and also make sure you're not using any weird texture compression settings. Since adding your assets to a working project breaks it you may have to be more surgical about it. Add them in stages testing each stage and see when it breaks then try and narrow down what part of what you added is causing the issue.

Gradle中的R8是一个代码最小化和优化器,它与您在源代码中显示的内容没有任何关系。Android.com/Build/Shrink-代码我会检查以确保您的所有着色器都在构建中,并确保您没有使用任何奇怪的纹理压缩设置。由于将你的资产添加到一个正在进行的项目中会破坏这一点,你可能不得不对此采取更严厉的态度。分阶段添加它们,测试每个阶段,并查看它何时损坏,然后尝试缩小您添加的内容中导致问题的部分。

You might also try things like adjusting engine stripping settings. Annoying problem, I hope you're able to figure it out or someone else that had the problem and fixed it shares some insight.

你也可以尝试一些事情,比如调整发动机剥离设置。令人讨厌的问题,我希望你能弄清楚它,或者其他有这个问题并解决它的人分享一些见解。

I will try all that, thank you. I've also realized that this R8 has nothing to do with enableR8 but is a pixel format. Just a coincidence.

我都试一试,谢谢。我也意识到这个R8与enableR8无关,而是一个像素格式。只是巧合而已。

优秀答案推荐

So this wasn't about textures. My UI elements were being pushed out of the screen space because of the Safe Area script that I was using. I can't discern what caused this, but Canvas.pixelRect was returning totally wrong values on Android. Not in editor simulator, not on iOS, but only on Android phones. The issue is new, since the script I am using for safe area adjustment I've been using for years without issue.

所以这不是质地的问题。由于我使用的安全区域脚本,我的UI元素被推出了屏幕空间。我不知道是什么原因导致了这个问题,但是Canvar.PixelRect在Android上返回了完全错误的值。不是在编辑器模拟器中,也不是在iOS上,而是只在Android手机上。这个问题是新的,因为我用来调整安全区域的脚本已经使用了很多年,没有出现任何问题。


I tried waiting for one frame before taking the pixelRect, and this solved the issue. The resolutions given were correct.

我试着在拍摄PixelRect之前等待一帧,这解决了问题。所给出的决议是正确的。


更多回答

80 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com