[Fix] (MG_Backend/DirectVulkan): Fix compiling error on linux.

This commit is contained in:
BZLZHH
2026-01-31 23:06:58 +08:00
parent 7918300848
commit 516566321d
4 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
- name: Install clang-20
run: |
sudo apt-get update
sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev
sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev libvulkan-dev
- name: Show installed toolchain
run: |
+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
- name: Install clang-20
run: |
sudo apt-get update
sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev
sudo apt-get install -y clang-20 clang++-20 lld-20 libc++-20-dev libc++abi-20-dev libvulkan-dev
- name: Show installed toolchain
run: |
+1 -1
View File
@@ -80,6 +80,7 @@
#ifdef __linux__
#include <dlfcn.h>
#include <pthread.h>
#include <vulkan/vulkan.h>
#endif
#ifdef _WIN32
@@ -94,7 +95,6 @@
#include <unistd.h>
#include <pthread.h>
#include <android/log.h>
#include <vulkan/vulkan.h>
#include <android/native_window.h>
#include <vulkan/vulkan_android.h>
#endif
@@ -14,7 +14,7 @@
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_VULKAN
namespace MobileGL {
namespace MG_Impl::EGLImpl {
// TODO: complete EGL for Vulkan implementation
// TODO: complete EGL impl for Vulkan
const char* demoFS = R"(#version 460
layout(location = 0) out vec4 outColor;
@@ -86,18 +86,25 @@ namespace MobileGL {
});
}
#ifdef __ANDROID__
void CreateWindowSurfaceForVulkan(ANativeWindow* window) {
MG_Backend::DirectVulkan::pVulkanRenderer = MakeUnique<MG_Backend::DirectVulkan::VulkanRenderer>(window);
MG_Backend::DirectVulkan::pVulkanRenderer->Initialize();
PrepareDemoRes(); // for demo use
}
#endif
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
const EGLint* attrib_list) {
MGLOG_D("EGLForVulkan::CreateWindowSurface called with window=%p", window);
#ifdef __ANDROID__
auto* nativeWindow = static_cast<ANativeWindow*>(window);
CreateWindowSurfaceForVulkan(nativeWindow);
#else
MGLOG_W("EGLForVulkan::CreateWindowSurface is not implemented for this platform"); // TODO: support more
// platforms
#endif
return (EGLSurface)1;
}