chromium/third_party/dawn/src/dawn/native/Surface.cpp

// Copyright 2020 the Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "dawn/native/Surface.h"

#include <memory>
#include <string>
#include <utility>

#include "dawn/common/Platform.h"
#include "dawn/native/ChainUtils.h"
#include "dawn/native/Device.h"
#include "dawn/native/Instance.h"
#include "dawn/native/SwapChain.h"
#include "dawn/native/ValidationUtils_autogen.h"
#include "dawn/native/utils/WGPUHelpers.h"

#if defined(DAWN_USE_WINDOWS_UI)
#include <windows.ui.core.h>
#include <windows.ui.xaml.controls.h>
#endif  // defined(DAWN_USE_WINDOWS_UI)

#if defined(DAWN_USE_X11)
#include "dawn/common/xlib_with_undefs.h"
#include "dawn/native/X11Functions.h"
#endif  // defined(DAWN_USE_X11)

namespace dawn::native {

absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
    Surface::Type value,
    const absl::FormatConversionSpec& spec,
    absl::FormatSink* s) {}

#if defined(DAWN_ENABLE_BACKEND_METAL)
bool InheritsFromCAMetalLayer(void* obj);
#endif  // defined(DAWN_ENABLE_BACKEND_METAL)

ResultOrError<UnpackedPtr<SurfaceDescriptor>> ValidateSurfaceDescriptor(
    InstanceBase* instance,
    const SurfaceDescriptor* rawDescriptor) {}

MaybeError ValidateSurfaceConfiguration(DeviceBase* device,
                                        const PhysicalDeviceSurfaceCapabilities& capabilities,
                                        const SurfaceConfiguration* config,
                                        const Surface* surface) {}

class AdapterSurfaceCapCache {};

// static
Ref<Surface> Surface::MakeError(InstanceBase* instance) {}

Surface::Surface(InstanceBase* instance, ErrorTag tag) :{}

Surface::Surface(InstanceBase* instance, const UnpackedPtr<SurfaceDescriptor>& descriptor)
    :{}

Surface::~Surface() {}

SwapChainBase* Surface::GetAttachedSwapChain() {}
void Surface::SetAttachedSwapChain(SwapChainBase* swapChain) {}

InstanceBase* Surface::GetInstance() const {}

DeviceBase* Surface::GetCurrentDevice() const {}

Surface::Type Surface::GetType() const {}

void* Surface::GetAndroidNativeWindow() const {}

void* Surface::GetMetalLayer() const {}

void* Surface::GetWaylandDisplay() const {}

void* Surface::GetWaylandSurface() const {}

void* Surface::GetHInstance() const {}
void* Surface::GetHWND() const {}

IUnknown* Surface::GetCoreWindow() const {}

IUnknown* Surface::GetSwapChainPanel() const {}

void* Surface::GetXDisplay() const {}
uint32_t Surface::GetXWindow() const {}

MaybeError Surface::Configure(const SurfaceConfiguration* configIn) {}

MaybeError Surface::Unconfigure() {}

MaybeError Surface::GetCapabilities(AdapterBase* adapter, SurfaceCapabilities* capabilities) const {}

void APISurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities capabilities) {}

MaybeError Surface::GetCurrentTexture(SurfaceTexture* surfaceTexture) const {}

ResultOrError<wgpu::TextureFormat> Surface::GetPreferredFormat(AdapterBase* adapter) const {}

MaybeError Surface::Present() {}

const std::string& Surface::GetLabel() const {}

void Surface::APIConfigure(const SurfaceConfiguration* config) {}

wgpu::Status Surface::APIGetCapabilities(AdapterBase* adapter,
                                         SurfaceCapabilities* capabilities) const {}

void Surface::APIGetCurrentTexture(SurfaceTexture* surfaceTexture) const {}

wgpu::TextureFormat Surface::APIGetPreferredFormat(AdapterBase* adapter) const {}

void Surface::APIPresent() {}

void Surface::APIUnconfigure() {}

void Surface::APISetLabel(const char* label) {}

void Surface::APISetLabel2(std::optional<std::string_view> label) {}

}  // namespace dawn::native