mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (MG_Backend/DirectVulkan): Fix compiling error on linux.
This commit is contained in:
@@ -35,7 +35,7 @@ jobs:
|
|||||||
- name: Install clang-20
|
- name: Install clang-20
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
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
|
- name: Show installed toolchain
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
- name: Install clang-20
|
- name: Install clang-20
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
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
|
- name: Show installed toolchain
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
+1
-1
@@ -80,6 +80,7 @@
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -94,7 +95,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#include <android/native_window.h>
|
#include <android/native_window.h>
|
||||||
#include <vulkan/vulkan_android.h>
|
#include <vulkan/vulkan_android.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_VULKAN
|
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_VULKAN
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
namespace MG_Impl::EGLImpl {
|
namespace MG_Impl::EGLImpl {
|
||||||
// TODO: complete EGL for Vulkan implementation
|
// TODO: complete EGL impl for Vulkan
|
||||||
|
|
||||||
const char* demoFS = R"(#version 460
|
const char* demoFS = R"(#version 460
|
||||||
layout(location = 0) out vec4 outColor;
|
layout(location = 0) out vec4 outColor;
|
||||||
@@ -86,18 +86,25 @@ namespace MobileGL {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
void CreateWindowSurfaceForVulkan(ANativeWindow* window) {
|
void CreateWindowSurfaceForVulkan(ANativeWindow* window) {
|
||||||
MG_Backend::DirectVulkan::pVulkanRenderer = MakeUnique<MG_Backend::DirectVulkan::VulkanRenderer>(window);
|
MG_Backend::DirectVulkan::pVulkanRenderer = MakeUnique<MG_Backend::DirectVulkan::VulkanRenderer>(window);
|
||||||
MG_Backend::DirectVulkan::pVulkanRenderer->Initialize();
|
MG_Backend::DirectVulkan::pVulkanRenderer->Initialize();
|
||||||
|
|
||||||
PrepareDemoRes(); // for demo use
|
PrepareDemoRes(); // for demo use
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||||
const EGLint* attrib_list) {
|
const EGLint* attrib_list) {
|
||||||
MGLOG_D("EGLForVulkan::CreateWindowSurface called with window=%p", window);
|
MGLOG_D("EGLForVulkan::CreateWindowSurface called with window=%p", window);
|
||||||
|
#ifdef __ANDROID__
|
||||||
auto* nativeWindow = static_cast<ANativeWindow*>(window);
|
auto* nativeWindow = static_cast<ANativeWindow*>(window);
|
||||||
CreateWindowSurfaceForVulkan(nativeWindow);
|
CreateWindowSurfaceForVulkan(nativeWindow);
|
||||||
|
#else
|
||||||
|
MGLOG_W("EGLForVulkan::CreateWindowSurface is not implemented for this platform"); // TODO: support more
|
||||||
|
// platforms
|
||||||
|
#endif
|
||||||
return (EGLSurface)1;
|
return (EGLSurface)1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user