fix(android): Workaround for Adreno VK_ERROR_DEVICE_LOST (#4442)
This commit is contained in:
@@ -36,9 +36,9 @@ namespace vulkan {
|
||||
// this can be queried at runtime (VkPhysicalDeviceLimits.maxVertexInputBindings)
|
||||
constexpr uint32_t maximumVertexBindingCount = 16;
|
||||
|
||||
constexpr uint32_t globalDescriptorPoolSize = 3 * 4;
|
||||
constexpr uint32_t layerDescriptorPoolSize = 3 * 256;
|
||||
constexpr uint32_t drawableUniformDescriptorPoolSize = 3 * 1024;
|
||||
constexpr uint32_t globalDescriptorPoolSize = 2 * 1;
|
||||
constexpr uint32_t layerDescriptorPoolSize = 2 * 256;
|
||||
constexpr uint32_t drawableUniformDescriptorPoolSize = 2 * 1024;
|
||||
constexpr uint32_t drawableImageDescriptorPoolSize = drawableUniformDescriptorPoolSize / 2;
|
||||
|
||||
namespace {
|
||||
@@ -236,7 +236,7 @@ void Context::requestSurfaceUpdate(bool useDelay) {
|
||||
surfaceUpdateLatency = useDelay ? backend.getMaxFrames() * 3 : 0;
|
||||
}
|
||||
|
||||
void Context::waitFrame() const {
|
||||
bool Context::waitFrame() const {
|
||||
MLN_TRACE_FUNC();
|
||||
MBGL_VERIFY_THREAD(tid);
|
||||
|
||||
@@ -249,7 +249,10 @@ void Context::waitFrame() const {
|
||||
1, &frame.flightFrameFence.get(), VK_TRUE, timeout, dispatcher);
|
||||
if (waitFenceResult != vk::Result::eSuccess) {
|
||||
mbgl::Log::Error(mbgl::Event::Render, "Wait fence failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Context::beginFrame() {
|
||||
@@ -304,7 +307,9 @@ void Context::beginFrame() {
|
||||
auto& frame = frameResources[frameResourceIndex];
|
||||
constexpr uint64_t timeout = std::numeric_limits<uint64_t>::max();
|
||||
|
||||
waitFrame();
|
||||
if (!waitFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
frame.runDeletionQueue(*this);
|
||||
|
||||
@@ -323,6 +328,10 @@ void Context::beginFrame() {
|
||||
} else if (acquireImageResult.result == vk::Result::eSuboptimalKHR) {
|
||||
renderableResource.setAcquiredImageIndex(acquireImageResult.value);
|
||||
requestSurfaceUpdate();
|
||||
} else {
|
||||
mbgl::Log::Error(
|
||||
mbgl::Event::Render,
|
||||
"acquireNextImageKHR result: " + std::to_string(static_cast<int>(acquireImageResult.result)));
|
||||
}
|
||||
|
||||
} catch (const vk::OutOfDateKHRError& e) {
|
||||
@@ -521,11 +530,11 @@ void Context::bindGlobalUniformBuffers(gfx::RenderPass& renderPass) const noexce
|
||||
|
||||
auto& renderableResource = renderPassImpl.getDescriptor().renderable.getResource<SurfaceRenderableResource>();
|
||||
if (renderableResource.hasSurfaceTransformSupport()) {
|
||||
float surfaceRotation = renderableResource.getRotation();
|
||||
const float surfaceRotation = renderableResource.getRotation();
|
||||
const float sinRot = std::sin(surfaceRotation);
|
||||
const float cosRot = std::cos(surfaceRotation);
|
||||
|
||||
const shaders::GlobalPlatformParamsUBO platformUBO = {
|
||||
/* .rotation0 = */ {cosf(surfaceRotation), -sinf(surfaceRotation)},
|
||||
/* .rotation1 = */ {sinf(surfaceRotation), cosf(surfaceRotation)}};
|
||||
const shaders::GlobalPlatformParamsUBO platformUBO = {.surfaceRotation = {cosRot, -sinRot, sinRot, cosRot}};
|
||||
context.globalUniformBuffers.createOrUpdate(
|
||||
shaders::idGlobalPlatformParamsUBO, &platformUBO, sizeof(platformUBO), context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user