chromium/third_party/skia/src/gpu/graphite/dawn/DawnCaps.cpp

/*
 * Copyright 2022 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "src/gpu/graphite/dawn/DawnCaps.h"

#include <algorithm>

#include "include/core/SkTextureCompressionType.h"
#include "include/gpu/graphite/ContextOptions.h"
#include "include/gpu/graphite/TextureInfo.h"
#include "include/gpu/graphite/dawn/DawnBackendContext.h"
#include "src/gpu/SwizzlePriv.h"
#include "src/gpu/graphite/ComputePipelineDesc.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/GraphiteResourceKey.h"
#include "src/gpu/graphite/RenderPassDesc.h"
#include "src/gpu/graphite/RendererProvider.h"
#include "src/gpu/graphite/ResourceTypes.h"
#include "src/gpu/graphite/UniformManager.h"
#include "src/gpu/graphite/dawn/DawnGraphicsPipeline.h"
#include "src/gpu/graphite/dawn/DawnGraphiteTypesPriv.h"
#include "src/gpu/graphite/dawn/DawnGraphiteUtilsPriv.h"
#include "src/gpu/graphite/dawn/DawnUtilsPriv.h"
#include "src/sksl/SkSLUtil.h"

namespace {

skgpu::UniqueKey::Domain get_pipeline_domain() {}

// These are all the valid wgpu::TextureFormat that we currently support in Skia.
// They are roughly ordered from most frequently used to least to improve lookup times in arrays.
static constexpr wgpu::TextureFormat kFormats[] =;

#if !defined(__EMSCRIPTEN__)
bool IsMultiplanarFormat(wgpu::TextureFormat format) {}
#endif
}  // anonymous namespace

namespace skgpu::graphite {

DawnCaps::DawnCaps(const DawnBackendContext& backendContext, const ContextOptions& options)
    :{}

DawnCaps::~DawnCaps() = default;

uint32_t DawnCaps::channelMask(const TextureInfo& info) const {}

bool DawnCaps::onIsTexturable(const TextureInfo& info) const {}

bool DawnCaps::isTexturable(wgpu::TextureFormat format) const {}

bool DawnCaps::isRenderable(const TextureInfo& info) const {}

bool DawnCaps::isStorage(const TextureInfo& info) const {}

uint32_t DawnCaps::maxRenderTargetSampleCount(wgpu::TextureFormat format) const {}

bool DawnCaps::isRenderable(wgpu::TextureFormat format, uint32_t sampleCount) const {}

TextureInfo DawnCaps::getDefaultSampledTextureInfo(SkColorType colorType,
                                                   Mipmapped mipmapped,
                                                   Protected,
                                                   Renderable renderable) const {}

TextureInfo DawnCaps::getTextureInfoForSampledCopy(const TextureInfo& textureInfo,
                                                   Mipmapped mipmapped) const {}

namespace {
wgpu::TextureFormat format_from_compression(SkTextureCompressionType compression) {}
}

TextureInfo DawnCaps::getDefaultCompressedTextureInfo(SkTextureCompressionType compression,
                                                      Mipmapped mipmapped,
                                                      Protected) const {}

TextureInfo DawnCaps::getDefaultMSAATextureInfo(const TextureInfo& singleSampledInfo,
                                                Discardable discardable) const {}

TextureInfo DawnCaps::getDefaultDepthStencilTextureInfo(
    SkEnumBitMask<DepthStencilFlags> depthStencilType,
    uint32_t sampleCount,
    Protected) const {}

TextureInfo DawnCaps::getDefaultStorageTextureInfo(SkColorType colorType) const {}

SkISize DawnCaps::getDepthAttachmentDimensions(const TextureInfo& textureInfo,
                                               const SkISize colorAttachmentDimensions) const {}

const Caps::ColorTypeInfo* DawnCaps::getColorTypeInfo(SkColorType colorType,
                                                      const TextureInfo& textureInfo) const {}

bool DawnCaps::supportsWritePixels(const TextureInfo& textureInfo) const {}

bool DawnCaps::supportsReadPixels(const TextureInfo& textureInfo) const {}

std::pair<SkColorType, bool /*isRGBFormat*/> DawnCaps::supportedWritePixelsColorType(
        SkColorType dstColorType,
        const TextureInfo& dstTextureInfo,
        SkColorType srcColorType) const {}

std::pair<SkColorType, bool /*isRGBFormat*/> DawnCaps::supportedReadPixelsColorType(
        SkColorType srcColorType,
        const TextureInfo& srcTextureInfo,
        SkColorType dstColorType) const {}

void DawnCaps::initCaps(const DawnBackendContext& backendContext, const ContextOptions& options) {}

void DawnCaps::initShaderCaps(const wgpu::Device& device) {}

void DawnCaps::initFormatTable(const wgpu::Device& device) {}

// static
size_t DawnCaps::GetFormatIndex(wgpu::TextureFormat format) {}

void DawnCaps::setColorType(SkColorType colorType,
                            std::initializer_list<wgpu::TextureFormat> formats) {}

// Make sure the format table indices will fit into the packed bits, with room to spare for
// representing an unused attachment.
static constexpr int kFormatBits =; // x2 attachments (color & depthStencil formats)
static constexpr int kSampleBits =;  // x2 attachments (color & depthStencil numSamples)
static constexpr int kResolveBits =;
static constexpr int kUnusedAttachmentIndex =;
static_assert;
static_assert;

static constexpr int kDepthStencilNumSamplesOffset =;
static constexpr int kDepthStencilFormatOffset =;
static constexpr int kColorNumSamplesOffset =;
static constexpr int kColorFormatOffset =;

static constexpr uint32_t kFormatMask     =;
static constexpr uint32_t kNumSamplesMask =;
static constexpr uint32_t kResolveMask    =;

uint32_t DawnCaps::getRenderPassDescKeyForPipeline(const RenderPassDesc& renderPassDesc) const {}

static constexpr int kDawnGraphicsPipelineKeyData32Count =;

UniqueKey DawnCaps::makeGraphicsPipelineKey(const GraphicsPipelineDesc& pipelineDesc,
                                            const RenderPassDesc& renderPassDesc) const {}

bool DawnCaps::extractGraphicsDescs(const UniqueKey& key,
                                    GraphicsPipelineDesc* pipelineDesc,
                                    RenderPassDesc* renderPassDesc,
                                    const RendererProvider* rendererProvider) const {}

UniqueKey DawnCaps::makeComputePipelineKey(const ComputePipelineDesc& pipelineDesc) const {}

#if !defined(__EMSCRIPTEN__)
namespace {
usingnamespaceycbcrUtils;

uint32_t non_format_info_as_uint32(const wgpu::YCbCrVkDescriptor& desc) {}
} // anonymous
#endif

ImmutableSamplerInfo DawnCaps::getImmutableSamplerInfo(const TextureProxy* proxy) const {}

void DawnCaps::buildKeyForTexture(SkISize dimensions,
                                  const TextureInfo& info,
                                  ResourceType type,
                                  Shareable shareable,
                                  GraphiteResourceKey* key) const {}

GraphiteResourceKey DawnCaps::makeSamplerKey(const SamplerDesc& samplerDesc) const {}

} // namespace skgpu::graphite