chromium/third_party/skia/src/gpu/graphite/dawn/DawnGraphicsPipeline.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/DawnGraphicsPipeline.h"

#include "include/gpu/graphite/TextureInfo.h"
#include "include/private/base/SkTemplates.h"
#include "src/gpu/SkSLToBackend.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/graphite/Attribute.h"
#include "src/gpu/graphite/ContextUtils.h"
#include "src/gpu/graphite/GraphicsPipelineDesc.h"
#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/RenderPassDesc.h"
#include "src/gpu/graphite/RendererProvider.h"
#include "src/gpu/graphite/UniformManager.h"
#include "src/gpu/graphite/dawn/DawnCaps.h"
#include "src/gpu/graphite/dawn/DawnErrorChecker.h"
#include "src/gpu/graphite/dawn/DawnGraphiteTypesPriv.h"
#include "src/gpu/graphite/dawn/DawnGraphiteUtilsPriv.h"
#include "src/gpu/graphite/dawn/DawnResourceProvider.h"
#include "src/gpu/graphite/dawn/DawnSharedContext.h"
#include "src/gpu/graphite/dawn/DawnUtilsPriv.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/ir/SkSLProgram.h"

#include <vector>

namespace skgpu::graphite {

namespace {

inline wgpu::VertexFormat attribute_type_to_dawn(VertexAttribType type) {}

wgpu::CompareFunction compare_op_to_dawn(CompareOp op) {}

wgpu::StencilOperation stencil_op_to_dawn(StencilOp op) {}

wgpu::StencilFaceState stencil_face_to_dawn(DepthStencilSettings::Face face) {}

size_t create_vertex_attributes(SkSpan<const Attribute> attrs,
                                int shaderLocationOffset,
                                std::vector<wgpu::VertexAttribute>* out) {}

// TODO: share this w/ Ganesh dawn backend?
static wgpu::BlendFactor blend_coeff_to_dawn_blend(const DawnCaps& caps, skgpu::BlendCoeff coeff) {}

static wgpu::BlendFactor blend_coeff_to_dawn_blend_for_alpha(const DawnCaps& caps,
                                                             skgpu::BlendCoeff coeff) {}

// TODO: share this w/ Ganesh Metal backend?
static wgpu::BlendOperation blend_equation_to_dawn_blend_op(skgpu::BlendEquation equation) {}

struct AsyncPipelineCreationBase {};

} // anonymous namespace

#if defined(__EMSCRIPTEN__)
// For wasm, we don't use async compilation.
struct DawnGraphicsPipeline::AsyncPipelineCreation : public AsyncPipelineCreationBase {};
#else
struct DawnGraphicsPipeline::AsyncPipelineCreation : public AsyncPipelineCreationBase {};
#endif

#if !defined(__EMSCRIPTEN__)
usingnamespaceycbcrUtils;
// Fetches any immutable samplers and accumulates them into outImmutableSamplers. Returns false
// if there is a failure that triggers us to fail a draw. Acts as a no-op and returns true if a
// shader doesn't store any data (meaning immutable samplers are never used with the given shader).
bool gather_immutable_samplers(const SkSpan<uint32_t> samplerData,
                               DawnResourceProvider* resourceProvider,
                               skia_private::AutoTArray<sk_sp<DawnSampler>>& outImmutableSamplers) {}
#endif

// static
sk_sp<DawnGraphicsPipeline> DawnGraphicsPipeline::Make(const DawnSharedContext* sharedContext,
                                                       DawnResourceProvider* resourceProvider,
                                                       const RuntimeEffectDictionary* runtimeDict,
                                                       const GraphicsPipelineDesc& pipelineDesc,
                                                       const RenderPassDesc& renderPassDesc) {}

DawnGraphicsPipeline::DawnGraphicsPipeline(
        const skgpu::graphite::SharedContext* sharedContext,
        PipelineInfo* pipelineInfo,
        std::unique_ptr<AsyncPipelineCreation> asyncCreationInfo,
        BindGroupLayouts groupLayouts,
        PrimitiveType primitiveType,
        uint32_t refValue,
        bool hasStepUniforms,
        bool hasPaintUniforms,
        bool hasGradientBuffer,
        int numFragmentTexturesAndSamplers,
        skia_private::AutoTArray<sk_sp<DawnSampler>> immutableSamplers)
        :{}

DawnGraphicsPipeline::~DawnGraphicsPipeline() {}

void DawnGraphicsPipeline::freeGpuData() {}

const wgpu::RenderPipeline& DawnGraphicsPipeline::dawnRenderPipeline() const {}

} // namespace skgpu::graphite