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

[Impeller] Build Impeller Vulkan backend on Windows #40196

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

bdero
Copy link
Member

@bdero bdero commented Mar 9, 2023

Fix build errors for Vulkan in Windows.

I spent some time trying to figure out why vmaCreateImage is failing with ErrorFeatureNotPresent, but didn't manage to figure it out.

  1. First it fails to allocate the 1x1 placeholder texture in the Impeller Scene context:
$ ../out/host_debug_unopt/impeller_unittests.exe --gtest_filter="*CanRenderColoredRect/Vulkan"
[INFO:test_timeout_listener.cc(76)] Test timeout of 120 seconds per test case will be enforced.
Note: Google Test filter = *CanRenderColoredRect/Vulkan
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Play/AiksTest
[ RUN      ] Play/AiksTest.CanRenderColoredRect/Vulkan
UNASSIGNED-khronos-validation-createinstance-status-message(INFO / SPEC): msgNum: -671457468 - Validation Information: [ UNASSIGNED-khronos-validation-createinstance-status-message ] Object 0: handle = 0x3f26060, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xd7fa5f44 | Khronos Validation Layer Active:
    Settings File: Found at C:\Users\bdero\AppData\Local\LunarG\vkconfig\override\vk_layer_settings.txt specified by VkConfig application override.
    Current Enables: None.
    Current Disables: VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT.

    Objects: 1
        [0] 0x3f26060, type: 1, name: NULL
[FATAL:flutter/impeller/base/validation.cc(31)] Unable to allocation Vulkan Image: ErrorFeatureNotPresent
[ERROR:flutter/fml/backtrace.cc(108)] Caught signal SIGABRT during program execution.
Frame 0: 000000014038D1D9 fml::KillProcess
Frame 1: 000000014038D1AB fml::LogMessage::~LogMessage
Frame 2: 0000000140377F86 impeller::ValidationLog::~ValidationLog
Frame 3: 00000001426B2FE1 impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK
Frame 4: 00000001426B21A8 std::_Construct_in_place<impeller::AllocatedTextureSourceVK,const impeller::TextureDescriptor &,VmaAllocator_T *&,impeller::vk::Device &>
Frame 5: 00000001426B20B0 std::_Ref_count_obj2<impeller::AllocatedTextureSourceVK>::_Ref_count_obj2<const impeller::TextureDescriptor &,VmaAllocator_T *&,impeller::vk::Device &>
Frame 6: 00000001426B00CB std::make_shared<impeller::AllocatedTextureSourceVK,const impeller::TextureDescriptor &,VmaAllocator_T *&,impeller::vk::Device &>
Frame 7: 00000001426ADC5E impeller::AllocatorVK::OnCreateTexture
Frame 8: 000000014249937E impeller::Allocator::CreateTexture
Frame 9: 0000000142A295E1 impeller::scene::SceneContext::SceneContext
Frame 10: 000000014287E30A std::_Construct_in_place<impeller::scene::SceneContext,std::shared_ptr<impeller::Context> &>
Frame 11: 000000014287E29C std::_Ref_count_obj2<impeller::scene::SceneContext>::_Ref_count_obj2<std::shared_ptr<impeller::Context> &>
Frame 12: 0000000142867C07 std::make_shared<impeller::scene::SceneContext,std::shared_ptr<impeller::Context> &>
Frame 13: 000000014285C792 impeller::ContentContext::ContentContext
Frame 14: 0000000142831A07 std::make_unique<impeller::ContentContext,std::shared_ptr<impeller::Context> &,0>
Frame 15: 000000014283170B impeller::AiksContext::AiksContext
Frame 16: 00000001401E8926 impeller::AiksPlayground::OpenPlaygroundHere
Frame 17: 00000001401E88B5 impeller::AiksPlayground::OpenPlaygroundHere
  1. When I comment out the Scene placeholder texture, the ImGui text atlas texture fails next for the same reason.
  2. When I comment out the texture, the GLFW window opens and I get validation failures because the texture failures.
  3. Finally, if I disable all of the validation layers, we get a swapchain-related failure:
[FATAL:flutter/impeller/base/validation.cc(31)] Could not acquire next swapchain image: ErrorOutOfDateKHR
[ERROR:flutter/fml/backtrace.cc(108)] Caught signal SIGABRT during program execution.
Frame 0: 000000014038D1D9 fml::KillProcess
Frame 1: 000000014038D1AB fml::LogMessage::~LogMessage
Frame 2: 0000000140377F86 impeller::ValidationLog::~ValidationLog
Frame 3: 0000000142729ABB impeller::SwapchainImplVK::AcquireNextDrawable
Frame 4: 000000014273A9EB impeller::SwapchainVK::AcquireNextDrawable
Frame 5: 00000001426D2B0C impeller::ContextVK::GetInstance
Frame 6: 00000001402F2142 impeller::PlaygroundImplVK::AcquireSurfaceFrame
Frame 7: 00000001402E3D5D impeller::Playground::OpenPlaygroundHere
Frame 8: 00000001401E8982 impeller::AiksPlayground::OpenPlaygroundHere
Frame 9: 00000001401E88B5 impeller::AiksPlayground::OpenPlaygroundHere

@bdero bdero self-assigned this Mar 9, 2023
@bdero bdero requested a review from chinmaygarde March 9, 2023 21:42
@bdero bdero force-pushed the bdero/impeller-vk-windows branch from 37abda6 to 1d56932 Compare March 9, 2023 21:44
Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSLGTM

@chinmaygarde
Copy link
Member

I'm doing the same since I could use better GPU debugging tools available on Windows. We can land this but I'll have some trouble merging this stuff into my branch as I've significantly reworked capability checks. Just a heads up that this will change soon :) LGTM.

@bdero
Copy link
Member Author

bdero commented Mar 10, 2023

We can land this but I'll have some trouble merging this stuff into my branch as I've significantly reworked capability checks.

Alrighty, I got rid of the added get_memory_requirements2 extension. (It's not actually needed to get stuff working, just happened to notice VMA can use it and it's missing)

@bdero bdero merged commit eaaa055 into flutter:main Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants