Hash :
f044aaf8
Author :
Date :
2024-03-02T00:51:33
Vulkan: Create instance/device without access to Display The feature overrides are now encapsulated in a struct, a reference to which is passed around until features are initialized. Additionally, some window system information needed to decide which extensions to use or workarounds to apply are passed around. This is a step towards decoupling RendererVk from egl::Display for direct use with OpenCL. Bug: angleproject:8564 Change-Id: Id6c5d1c3b38aafcd4397e54cc6cad32bf849eeda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5335823 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
//
// Copyright 2022 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.
//
// DisplayVkGbm.cpp:
// Implements the class methods for DisplayVkGbm.
//
#include "libANGLE/renderer/vulkan/linux/gbm/DisplayVkGbm.h"
#include <gbm.h>
#include "common/linux/dma_buf_utils.h"
#include "libANGLE/Display.h"
#include "libANGLE/renderer/vulkan/vk_caps_utils.h"
namespace rx
{
DisplayVkGbm::DisplayVkGbm(const egl::DisplayState &state)
: DisplayVkLinux(state), mGbmDevice(nullptr)
{}
egl::Error DisplayVkGbm::initialize(egl::Display *display)
{
mGbmDevice = reinterpret_cast<gbm_device *>(display->getNativeDisplayId());
if (!mGbmDevice)
{
ERR() << "Failed to retrieve GBM device";
return egl::EglNotInitialized();
}
return DisplayVk::initialize(display);
}
void DisplayVkGbm::terminate()
{
mGbmDevice = nullptr;
DisplayVk::terminate();
}
bool DisplayVkGbm::isValidNativeWindow(EGLNativeWindowType window) const
{
return (void *)window != nullptr;
}
SurfaceImpl *DisplayVkGbm::createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window)
{
return nullptr;
}
egl::ConfigSet DisplayVkGbm::generateConfigs()
{
const std::array<GLenum, 1> kColorFormats = {GL_BGRA8_EXT};
std::vector<GLenum> depthStencilFormats(
egl_vk::kConfigDepthStencilFormats,
egl_vk::kConfigDepthStencilFormats + ArraySize(egl_vk::kConfigDepthStencilFormats));
if (getCaps().stencil8)
{
depthStencilFormats.push_back(GL_STENCIL_INDEX8);
}
egl::ConfigSet cfgSet =
egl_vk::GenerateConfigs(kColorFormats.data(), kColorFormats.size(),
depthStencilFormats.data(), depthStencilFormats.size(), this);
return cfgSet;
}
void DisplayVkGbm::checkConfigSupport(egl::Config *config) {}
const char *DisplayVkGbm::getWSIExtension() const
{
return nullptr;
}
angle::NativeWindowSystem DisplayVkGbm::getWindowSystem() const
{
return angle::NativeWindowSystem::Gbm;
}
bool IsVulkanGbmDisplayAvailable()
{
return true;
}
DisplayImpl *CreateVulkanGbmDisplay(const egl::DisplayState &state)
{
return new DisplayVkGbm(state);
}
} // namespace rx