• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef skgpu_graphite_DawnUtilsPriv_DEFINED
9 #define skgpu_graphite_DawnUtilsPriv_DEFINED
10 
11 #include "include/core/SkImageInfo.h"
12 #include "include/private/SkSLProgramKind.h"
13 #include "src/gpu/graphite/ResourceTypes.h"
14 #include "src/sksl/ir/SkSLProgram.h"
15 
16 #include "webgpu/webgpu_cpp.h"
17 
18 namespace SkSL {
19 class Compiler;
20 struct ProgramSettings;
21 }
22 
23 namespace skgpu {
24 class ShaderErrorHandler;
25 }
26 
27 namespace skgpu::graphite {
28 class DawnSharedContext;
29 
30 bool DawnFormatIsDepthOrStencil(wgpu::TextureFormat);
31 bool DawnFormatIsDepth(wgpu::TextureFormat);
32 bool DawnFormatIsStencil(wgpu::TextureFormat);
33 
34 wgpu::TextureFormat DawnDepthStencilFlagsToFormat(SkEnumBitMask<DepthStencilFlags>);
35 
36 bool SkSLToSPIRV(SkSL::Compiler*,
37                  const std::string& sksl,
38                  SkSL::ProgramKind kind,
39                  const SkSL::ProgramSettings& settings,
40                  std::string* spirv,
41                  SkSL::Program::Inputs* outInputs,
42                  ShaderErrorHandler* errorHandler);
43 
44 wgpu::ShaderModule DawnCompileSPIRVShaderModule(const DawnSharedContext* sharedContext,
45                                                 const std::string& spirv,
46                                                 ShaderErrorHandler* errorHandler);
47 } // namespace skgpu::graphite
48 
49 #endif // skgpu_graphite_DawnUtilsPriv_DEFINED
50