Hash :
56fd2bce
Author :
Date :
2019-12-17T10:00:55
Fix GGP build Bug: angleproject:4246 Change-Id: I80906196ebc3c904e75516e8c53b05dd81c5fa5c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1982633 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@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
//
// 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)
{
DisplayVk *displayVk = vk::GetImpl(context->getDisplay());
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, displayVk, EGL_BAD_SURFACE);
}
} // namespace rx