зеркало из https://github.com/AvaloniaUI/angle.git
Reland "Add support for Linux vulkan backend with VK_KHR_display"
This is a reland of a7bb6a9b15
Original change's description:
> Add support for Linux vulkan backend with VK_KHR_display
>
> Implement Linux simple display mode with vulkan backend
> through VK_KHR_display.
>
> Added value 'EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE' for
> attribute EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE to identify
> the new simple display mode. Also reserved
> EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE for headless mode.
>
> How to enable:
> Add
>
> ```
> use_x11=false
> angle_vulkan_display_mode="simple" # default value
> ```
>
> into args.gn, then compile with linux vulkan args.
>
> Bug: angleproject:5214
> Change-Id: I1247585b9de8b55df106aba99322281f1c183203
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2494320
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Bug: angleproject:5214
Change-Id: I3921f6cb292c86658f39e739a878baad1ef64dba
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2515327
Commit-Queue: Xiaoxuan Liu <xiaoxuan.liu@arm.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
6bc362c415
Коммит
61180d011c
9
BUILD.gn
9
BUILD.gn
|
@ -114,6 +114,15 @@ config("internal_config") {
|
|||
if (is_ggp) {
|
||||
defines += [ "__ggp__" ]
|
||||
}
|
||||
|
||||
if (angle_use_vulkan_display) {
|
||||
defines += [ "ANGLE_USE_VULKAN_DISPLAY" ]
|
||||
if (angle_vulkan_display_mode == "simple") {
|
||||
defines += [ "ANGLE_VULKAN_DISPLAY_MODE_SIMPLE" ]
|
||||
} else if (angle_vulkan_display_mode == "headless") {
|
||||
defines += [ "ANGLE_VULKAN_DISPLAY_MODE_HEADLESS" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config("constructor_and_destructor_warnings") {
|
||||
|
|
|
@ -71,6 +71,7 @@ New Tokens
|
|||
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
|
||||
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
|
||||
EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED 0x3451
|
||||
EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348F
|
||||
|
||||
Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
|
||||
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
Name
|
||||
|
||||
ANGLE_vulkan_display
|
||||
|
||||
Name Strings
|
||||
|
||||
EGL_ANGLE_vulkan_display
|
||||
|
||||
Contributors
|
||||
|
||||
Xiaoxuan Liu, Arm Ltd.
|
||||
Sunny Sun, Arm Ltd.
|
||||
|
||||
Contacts
|
||||
|
||||
Xiaoxuan Liu, Arm Ltd. (xiaoxuan 'dot' liu 'at' arm 'dot' com)
|
||||
|
||||
Status
|
||||
|
||||
Draft
|
||||
|
||||
Version
|
||||
|
||||
Version 1, 2020-10-29
|
||||
|
||||
Number
|
||||
|
||||
EGL Extension XXX
|
||||
|
||||
Extension Type
|
||||
|
||||
EGL client extension
|
||||
|
||||
Dependencies
|
||||
|
||||
Requires EGL_EXT_platform_angle_vulkan.
|
||||
|
||||
Overview
|
||||
|
||||
This extension allows ANGLE to use simple display mode through
|
||||
VK_KHR_display without native platform support (e.g. X11, GBM).
|
||||
The EGLSurfaces to be created from native types only contain the
|
||||
basic width and height info.
|
||||
|
||||
New Types
|
||||
|
||||
The basic structure to represent a display window, used by vulkan
|
||||
backend to create valid display with VK_KHR_display.
|
||||
|
||||
typedef struct displayWindow
|
||||
{
|
||||
khronos_uint16_t width;
|
||||
khronos_uint16_t height;
|
||||
} DisplayWindow;
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted as values for the EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE
|
||||
attribute:
|
||||
|
||||
EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE 0x34A4
|
||||
EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE 0x34A5
|
||||
|
||||
Additions to the EGL Specification
|
||||
|
||||
None
|
||||
|
||||
New Behavior
|
||||
|
||||
To obtain an simple EGLDisplay backed by a ANGLE vulkan with
|
||||
VK_KHR_display, request a display that is backed by a Vulkan driver
|
||||
through EGL_ANGLE_platform_angle_vulkan. And the value of attribute
|
||||
EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE should be
|
||||
EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE or
|
||||
EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE.
|
||||
|
||||
If an EGLDisplay is backed by ANGLE vulkan VK_KHR_display and the
|
||||
value of attribute EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE is
|
||||
set but neither EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE or
|
||||
EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE, then EGL_NO_DISPLAY
|
||||
should be returned.
|
||||
|
||||
Issues
|
||||
|
||||
None
|
||||
|
||||
Revision History
|
||||
|
||||
Version 1, 2020-10-29 (Xiaoxuan Liu)
|
||||
- Initial draft
|
||||
|
|
@ -9,6 +9,9 @@ declare_args() {
|
|||
|
||||
# Extract native libs in ANGLE apk. Useful for flamegraph generation.
|
||||
angle_extract_native_libs = false
|
||||
|
||||
# Display mode for ANGLE vulkan display, could be 'simple' or 'headless', default is 'simple'.
|
||||
angle_vulkan_display_mode = "simple"
|
||||
}
|
||||
|
||||
if (angle_has_build) {
|
||||
|
@ -27,6 +30,7 @@ if (angle_has_build) {
|
|||
}
|
||||
|
||||
angle_use_x11 = use_x11 && !is_ggp
|
||||
angle_use_vulkan_display = is_linux && !use_x11 && !is_ggp && !use_ozone
|
||||
} else {
|
||||
declare_args() {
|
||||
is_ubsan = false
|
||||
|
@ -35,6 +39,7 @@ if (angle_has_build) {
|
|||
build_with_chromium = false
|
||||
dcheck_always_on = false
|
||||
angle_use_x11 = (is_linux || is_chromeos) && !is_ggp
|
||||
angle_use_vulkan_display = is_linux && !angle_use_x11 && !is_ggp
|
||||
use_ozone = false
|
||||
ozone_platform_gbm = false
|
||||
use_fuzzing_engine = false
|
||||
|
@ -101,10 +106,11 @@ declare_args() {
|
|||
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
|
||||
# Otherwise, API level 24 would have been enough.
|
||||
angle_enable_vulkan =
|
||||
angle_has_build && ((is_win && !angle_is_winuwp) ||
|
||||
(is_linux && angle_use_x11 && !is_chromeos) ||
|
||||
(is_android && ndk_api_level_at_least_26) ||
|
||||
is_fuchsia || is_ggp || is_mac)
|
||||
angle_has_build &&
|
||||
((is_win && !angle_is_winuwp) ||
|
||||
(is_linux && (angle_use_x11 || angle_use_vulkan_display) &&
|
||||
!is_chromeos) || (is_android && ndk_api_level_at_least_26) ||
|
||||
is_fuchsia || is_ggp || is_mac)
|
||||
angle_enable_null = true
|
||||
angle_enable_essl = true
|
||||
angle_enable_glsl = true
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
#ifndef EGL_ANGLE_platform_angle_vulkan
|
||||
#define EGL_ANGLE_platform_angle_vulkan 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
|
||||
#define EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE 0x34A4
|
||||
#define EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE 0x34A5
|
||||
#endif /* EGL_ANGLE_platform_angle_vulkan */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_metal
|
||||
|
|
|
@ -27,6 +27,12 @@ enum class ICD
|
|||
SwiftShader,
|
||||
};
|
||||
|
||||
struct SimpleDisplayWindow
|
||||
{
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
};
|
||||
|
||||
class ScopedVkLoaderEnvironment : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -226,11 +226,17 @@ EGLAttrib GetDeviceTypeFromEnvironment()
|
|||
|
||||
EGLAttrib GetPlatformTypeFromEnvironment()
|
||||
{
|
||||
#if defined(ANGLE_USE_X11) && !defined(ANGLE_USE_OZONE)
|
||||
#if defined(ANGLE_USE_OZONE)
|
||||
return 0;
|
||||
#elif defined(ANGLE_USE_X11)
|
||||
return EGL_PLATFORM_X11_EXT;
|
||||
#elif defined(ANGLE_USE_VULKAN_DISPLAY) && defined(ANGLE_VULKAN_DISPLAY_MODE_SIMPLE)
|
||||
return EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE;
|
||||
#elif defined(ANGLE_USE_VULKAN_DISPLAY) && defined(ANGLE_VULKAN_DISPLAY_MODE_HEADLESS)
|
||||
return EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif // defined(ANGLE_USE_OZONE)
|
||||
}
|
||||
|
||||
rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType,
|
||||
|
@ -354,6 +360,24 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType,
|
|||
impl = rx::CreateVulkanXcbDisplay(state);
|
||||
break;
|
||||
}
|
||||
# elif defined(ANGLE_USE_VULKAN_DISPLAY)
|
||||
if (platformType == EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE &&
|
||||
rx::IsVulkanSimpleDisplayAvailable())
|
||||
{
|
||||
impl = rx::CreateVulkanSimpleDisplay(state);
|
||||
}
|
||||
else if (platformType == EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE)
|
||||
{
|
||||
// TODO: anglebug.com/5260
|
||||
// Add support for headless rendering
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not supported creation type on vulkan display, fail display creation.
|
||||
impl = nullptr;
|
||||
}
|
||||
break;
|
||||
# endif
|
||||
# elif defined(ANGLE_PLATFORM_ANDROID)
|
||||
if (rx::IsVulkanAndroidDisplayAvailable())
|
||||
|
|
|
@ -101,6 +101,15 @@ _vulkan_backend_sources = [
|
|||
"vk_wrapper.h",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
_vulkan_backend_sources += [
|
||||
"display/DisplayVkSimple.cpp",
|
||||
"display/DisplayVkSimple.h",
|
||||
"display/WindowSurfaceVkSimple.cpp",
|
||||
"display/WindowSurfaceVkSimple.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
_vulkan_backend_sources += [
|
||||
"android/DisplayVkAndroid.cpp",
|
||||
|
|
|
@ -22,6 +22,9 @@ DisplayImpl *CreateVulkanWin32Display(const egl::DisplayState &state);
|
|||
#if defined(ANGLE_PLATFORM_LINUX)
|
||||
bool IsVulkanXcbDisplayAvailable();
|
||||
DisplayImpl *CreateVulkanXcbDisplay(const egl::DisplayState &state);
|
||||
|
||||
bool IsVulkanSimpleDisplayAvailable();
|
||||
DisplayImpl *CreateVulkanSimpleDisplay(const egl::DisplayState &state);
|
||||
#endif // defined(ANGLE_PLATFORM_LINUX)
|
||||
|
||||
#if defined(ANGLE_PLATFORM_ANDROID)
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// DisplayVkSimple.cpp:
|
||||
// Implements the class methods for DisplayVkSimple.
|
||||
//
|
||||
|
||||
#include "DisplayVkSimple.h"
|
||||
#include "WindowSurfaceVkSimple.h"
|
||||
|
||||
#include "libANGLE/Display.h"
|
||||
#include "libANGLE/renderer/vulkan/RendererVk.h"
|
||||
#include "libANGLE/renderer/vulkan/vk_caps_utils.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
DisplayVkSimple::DisplayVkSimple(const egl::DisplayState &state) : DisplayVk(state) {}
|
||||
|
||||
void DisplayVkSimple::terminate()
|
||||
{
|
||||
DisplayVk::terminate();
|
||||
}
|
||||
|
||||
bool DisplayVkSimple::isValidNativeWindow(EGLNativeWindowType window) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SurfaceImpl *DisplayVkSimple::createWindowSurfaceVk(const egl::SurfaceState &state,
|
||||
EGLNativeWindowType window)
|
||||
{
|
||||
return new WindowSurfaceVkSimple(state, window);
|
||||
}
|
||||
|
||||
egl::ConfigSet DisplayVkSimple::generateConfigs()
|
||||
{
|
||||
constexpr GLenum kColorFormats[] = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8};
|
||||
|
||||
return egl_vk::GenerateConfigs(kColorFormats, egl_vk::kConfigDepthStencilFormats, this);
|
||||
}
|
||||
|
||||
// TODO: anglebug.com/5214
|
||||
// Detemine if check is needed.
|
||||
void DisplayVkSimple::checkConfigSupport(egl::Config *config) {}
|
||||
|
||||
const char *DisplayVkSimple::getWSIExtension() const
|
||||
{
|
||||
return VK_KHR_DISPLAY_EXTENSION_NAME;
|
||||
}
|
||||
|
||||
bool IsVulkanSimpleDisplayAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
DisplayImpl *CreateVulkanSimpleDisplay(const egl::DisplayState &state)
|
||||
{
|
||||
return new DisplayVkSimple(state);
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// DisplayVkSimple.h:
|
||||
// Defines the class interface for DisplayVkSimple, implementing
|
||||
// DisplayVk for Linux via VK_KHR_display.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKSIMPLE_H_
|
||||
#define LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKSIMPLE_H_
|
||||
|
||||
#include "libANGLE/renderer/vulkan/DisplayVk.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class DisplayVkSimple : public DisplayVk
|
||||
{
|
||||
public:
|
||||
DisplayVkSimple(const egl::DisplayState &state);
|
||||
void terminate() override;
|
||||
|
||||
bool isValidNativeWindow(EGLNativeWindowType window) const override;
|
||||
|
||||
SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
|
||||
EGLNativeWindowType window) override;
|
||||
|
||||
egl::ConfigSet generateConfigs() override;
|
||||
void checkConfigSupport(egl::Config *config) override;
|
||||
|
||||
const char *getWSIExtension() const override;
|
||||
|
||||
private:
|
||||
std::vector<VkSurfaceFormatKHR> mSurfaceFormats;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKSIMPLE_H_
|
|
@ -0,0 +1,82 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// WindowSurfaceVkSimple.cpp:
|
||||
// Implements the class methods for WindowSurfaceVkSimple.
|
||||
//
|
||||
|
||||
#include "WindowSurfaceVkSimple.h"
|
||||
#include "libANGLE/renderer/vulkan/RendererVk.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
WindowSurfaceVkSimple::WindowSurfaceVkSimple(const egl::SurfaceState &surfaceState,
|
||||
EGLNativeWindowType window)
|
||||
: WindowSurfaceVk(surfaceState, window)
|
||||
{}
|
||||
|
||||
WindowSurfaceVkSimple::~WindowSurfaceVkSimple() {}
|
||||
|
||||
angle::Result WindowSurfaceVkSimple::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
|
||||
{
|
||||
RendererVk *renderer = context->getRenderer();
|
||||
ASSERT(renderer != nullptr);
|
||||
VkInstance instance = renderer->getInstance();
|
||||
VkPhysicalDevice physicalDevice = renderer->getPhysicalDevice();
|
||||
|
||||
// Query if there is a valid display
|
||||
uint32_t count = 1;
|
||||
ANGLE_VK_TRY(context, vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &count, nullptr));
|
||||
|
||||
// Get display properties
|
||||
VkDisplayPropertiesKHR prop = {};
|
||||
count = 1;
|
||||
ANGLE_VK_TRY(context, vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &count, &prop));
|
||||
|
||||
// we should have a valid display now
|
||||
ASSERT(prop.display != VK_NULL_HANDLE);
|
||||
ANGLE_VK_TRY(context,
|
||||
vkGetDisplayModePropertiesKHR(physicalDevice, prop.display, &count, nullptr));
|
||||
|
||||
ASSERT(count != 0);
|
||||
std::vector<VkDisplayModePropertiesKHR> modeProperties(count);
|
||||
ANGLE_VK_TRY(context, vkGetDisplayModePropertiesKHR(physicalDevice, prop.display, &count,
|
||||
modeProperties.data()));
|
||||
|
||||
angle::vk::SimpleDisplayWindow *displayWindow =
|
||||
reinterpret_cast<angle::vk::SimpleDisplayWindow *>(mNativeWindowType);
|
||||
VkDisplaySurfaceCreateInfoKHR info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR;
|
||||
info.flags = 0;
|
||||
info.displayMode = modeProperties[0].displayMode;
|
||||
info.planeIndex = 0;
|
||||
info.planeStackIndex = 0;
|
||||
info.transform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
|
||||
info.globalAlpha = 1.0f;
|
||||
info.alphaMode = VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR;
|
||||
info.imageExtent.width = displayWindow->width;
|
||||
info.imageExtent.height = displayWindow->height;
|
||||
|
||||
ANGLE_VK_TRY(context, vkCreateDisplayPlaneSurfaceKHR(instance, &info, nullptr, &mSurface));
|
||||
|
||||
return getCurrentWindowSize(context, extentsOut);
|
||||
}
|
||||
|
||||
angle::Result WindowSurfaceVkSimple::getCurrentWindowSize(vk::Context *context,
|
||||
gl::Extents *extentsOut)
|
||||
{
|
||||
RendererVk *renderer = context->getRenderer();
|
||||
const VkPhysicalDevice &physicalDevice = renderer->getPhysicalDevice();
|
||||
|
||||
ANGLE_VK_TRY(context, vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, mSurface,
|
||||
&mSurfaceCaps));
|
||||
|
||||
*extentsOut =
|
||||
gl::Extents(mSurfaceCaps.currentExtent.width, mSurfaceCaps.currentExtent.height, 1);
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
} // namespace rx
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// WindowSurfaceVkSimple.h:
|
||||
// Defines the class interface for WindowSurfaceVkSimple, implementing WindowSurfaceVk.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_VULKAN_DISPLAY_WINDOWSURFACEVKSIMPLE_H_
|
||||
#define LIBANGLE_RENDERER_VULKAN_DISPLAY_WINDOWSURFACEVKSIMPLE_H_
|
||||
|
||||
#include "libANGLE/renderer/vulkan/SurfaceVk.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
class WindowSurfaceVkSimple : public WindowSurfaceVk
|
||||
{
|
||||
public:
|
||||
WindowSurfaceVkSimple(const egl::SurfaceState &surfaceState, EGLNativeWindowType window);
|
||||
~WindowSurfaceVkSimple() final;
|
||||
|
||||
private:
|
||||
angle::Result createSurfaceVk(vk::Context *context, gl::Extents *extentsOut) override;
|
||||
angle::Result getCurrentWindowSize(vk::Context *context, gl::Extents *extentsOut) override;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_VULKAN_DISPLAY_WINDOWSURFACEVKSIMPLE_H_
|
|
@ -233,7 +233,7 @@ bool IsARM64()
|
|||
|
||||
bool IsOzone()
|
||||
{
|
||||
#if defined(USE_OZONE) && defined(USE_X11)
|
||||
#if defined(USE_OZONE) && (defined(USE_X11) || defined(ANGLE_USE_VULKAN_DISPLAY))
|
||||
// We do not have a proper support for Ozone/Linux yet. Still, we need to figure out how to
|
||||
// properly initialize tests and differentiate between X11 and Wayland. Probably, passing a
|
||||
// command line argument could be sufficient. At the moment, run tests only for X11 backend
|
||||
|
|
|
@ -40,6 +40,14 @@ if (is_win) {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
_util_sources += [
|
||||
"display/DisplayPixmap.cpp",
|
||||
"display/DisplayWindow.cpp",
|
||||
"display/DisplayWindow.h",
|
||||
]
|
||||
}
|
||||
|
||||
if (angle_use_x11) {
|
||||
_util_sources += [
|
||||
"x11/X11Pixmap.cpp",
|
||||
|
@ -56,7 +64,7 @@ if (is_fuchsia) {
|
|||
"fuchsia/ScenicWindow.cpp",
|
||||
"fuchsia/ScenicWindow.h",
|
||||
]
|
||||
} else if (use_ozone && !angle_use_x11) {
|
||||
} else if (use_ozone && !angle_use_x11 && !angle_use_vulkan_display) {
|
||||
# Use X11 impl by default otherwise switch to fake Ozone impl that does not
|
||||
# seem to do anything real.
|
||||
# TODO(msisov): probably, we need to have a proper support for different
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// DisplayPixmap.cpp: Implementation of OSPixmap for Linux Display
|
||||
|
||||
#include "util/OSPixmap.h"
|
||||
|
||||
#if defined(ANGLE_USE_VULKAN_DISPLAY)
|
||||
OSPixmap *CreateOSPixmap()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,87 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// DisplayWindow.cpp: Implementation of OSWindow for Linux Display
|
||||
|
||||
#include "util/display/DisplayWindow.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "util/Timer.h"
|
||||
#include "util/test_utils.h"
|
||||
|
||||
DisplayWindow::DisplayWindow()
|
||||
{
|
||||
mWindow.width = 0;
|
||||
mWindow.height = 0;
|
||||
}
|
||||
|
||||
DisplayWindow::~DisplayWindow() {}
|
||||
|
||||
bool DisplayWindow::initializeImpl(const std::string &name, int width, int height)
|
||||
{
|
||||
return resize(width, height);
|
||||
}
|
||||
|
||||
void DisplayWindow::disableErrorMessageDialog() {}
|
||||
|
||||
void DisplayWindow::destroy() {}
|
||||
|
||||
void DisplayWindow::resetNativeWindow() {}
|
||||
|
||||
EGLNativeWindowType DisplayWindow::getNativeWindow() const
|
||||
{
|
||||
return (EGLNativeWindowType)&mWindow;
|
||||
}
|
||||
|
||||
EGLNativeDisplayType DisplayWindow::getNativeDisplay() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DisplayWindow::messageLoop() {}
|
||||
|
||||
void DisplayWindow::setMousePosition(int x, int y)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool DisplayWindow::setOrientation(int width, int height)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DisplayWindow::setPosition(int x, int y)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DisplayWindow::resize(int width, int height)
|
||||
{
|
||||
mWindow.width = width;
|
||||
mWindow.height = height;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DisplayWindow::setVisible(bool isVisible) {}
|
||||
|
||||
void DisplayWindow::signalTestEvent()
|
||||
{
|
||||
Event event;
|
||||
event.Type = Event::EVENT_TEST;
|
||||
event.Move.X = 0;
|
||||
event.Move.Y = 0;
|
||||
pushEvent(event);
|
||||
}
|
||||
|
||||
// static
|
||||
#if defined(ANGLE_USE_VULKAN_DISPLAY)
|
||||
OSWindow *OSWindow::New()
|
||||
{
|
||||
return new DisplayWindow();
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// DisplayWindow.h: Definition of the implementation of OSWindow for Linux Display
|
||||
|
||||
#ifndef UTIL_DISPLAY_WINDOW_H_
|
||||
#define UTIL_DISPLAY_WINDOW_H_
|
||||
|
||||
#include <string>
|
||||
#include "util/OSWindow.h"
|
||||
#include "util/util_export.h"
|
||||
|
||||
struct SimpleDisplayWindow
|
||||
{
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
};
|
||||
|
||||
class ANGLE_UTIL_EXPORT DisplayWindow : public OSWindow
|
||||
{
|
||||
public:
|
||||
DisplayWindow();
|
||||
DisplayWindow(int visualId);
|
||||
~DisplayWindow() override;
|
||||
|
||||
void disableErrorMessageDialog() override;
|
||||
void destroy() override;
|
||||
|
||||
void resetNativeWindow() override;
|
||||
EGLNativeWindowType getNativeWindow() const override;
|
||||
EGLNativeDisplayType getNativeDisplay() const override;
|
||||
|
||||
void messageLoop() override;
|
||||
|
||||
void setMousePosition(int x, int y) override;
|
||||
bool setOrientation(int width, int height) override;
|
||||
bool setPosition(int x, int y) override;
|
||||
bool resize(int width, int height) override;
|
||||
void setVisible(bool isVisible) override;
|
||||
|
||||
void signalTestEvent() override;
|
||||
|
||||
private:
|
||||
bool initializeImpl(const std::string &name, int width, int height) override;
|
||||
SimpleDisplayWindow mWindow;
|
||||
};
|
||||
|
||||
#endif // UTIL_DISPLAY_WINDOW_H_
|
Загрузка…
Ссылка в новой задаче