Hash :
5c04f18a
Author :
Date :
2023-04-24T16:18:24
Vulkan: Remove DisplayVk param from ToEGL It's no longer used Bug: angleproject:3041 Change-Id: I5063152d1598aa5d40d94bbf5c643a1288589037 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4470387 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
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
//
// Copyright 2019 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.
//
// WindowSurfaceVkGGP.cpp:
// Implements the class methods for WindowSurfaceVkGGP.
//
#include "libANGLE/renderer/vulkan/ggp/WindowSurfaceVkGGP.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/Surface.h"
#include "libANGLE/renderer/vulkan/DisplayVk.h"
#include "libANGLE/renderer/vulkan/RendererVk.h"
namespace rx
{
namespace
{
constexpr EGLAttrib kDefaultStreamDescriptor = static_cast<EGLAttrib>(kGgpPrimaryStreamDescriptor);
} // namespace
WindowSurfaceVkGGP::WindowSurfaceVkGGP(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window)
: WindowSurfaceVk(surfaceState, window)
{}
angle::Result WindowSurfaceVkGGP::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
{
RendererVk *renderer = context->getRenderer();
// Get the stream descriptor if specified. Default is kGgpPrimaryStreamDescriptor.
EGLAttrib streamDescriptor =
mState.attributes.get(EGL_GGP_STREAM_DESCRIPTOR_ANGLE, kDefaultStreamDescriptor);
VkStreamDescriptorSurfaceCreateInfoGGP createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP;
createInfo.streamDescriptor = static_cast<GgpStreamDescriptor>(streamDescriptor);
ANGLE_VK_TRY(context, vkCreateStreamDescriptorSurfaceGGP(renderer->getInstance(), &createInfo,
nullptr, &mSurface));
return getCurrentWindowSize(context, extentsOut);
}
angle::Result WindowSurfaceVkGGP::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;
}
egl::Error WindowSurfaceVkGGP::swapWithFrameToken(const gl::Context *context,
EGLFrameTokenANGLE frameToken)
{
VkPresentFrameTokenGGP frameTokenData = {};
frameTokenData.sType = VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP;
frameTokenData.frameToken = static_cast<GgpFrameToken>(frameToken);
angle::Result result = swapImpl(context, nullptr, 0, &frameTokenData);
return angle::ToEGL(result, EGL_BAD_SURFACE);
}
} // namespace rx