Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
MtlUtilsPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 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_MtlUtilsPriv_DEFINED
9#define skgpu_MtlUtilsPriv_DEFINED
10
11#import <Metal/Metal.h>
12
16
17namespace SkSL {
18
19enum class ProgramKind : int8_t;
20struct ProgramInterface;
21struct ProgramSettings;
22struct ShaderCaps;
23
24} // namespace SkSL
25
26namespace skgpu {
27
28class ShaderErrorHandler;
29
30inline bool SkSLToMSL(const SkSL::ShaderCaps* caps,
31 const std::string& sksl,
32 SkSL::ProgramKind programKind,
33 const SkSL::ProgramSettings& settings,
34 std::string* msl,
35 SkSL::ProgramInterface* outInterface,
36 ShaderErrorHandler* errorHandler) {
37 return SkSLToBackend(caps, &SkSL::ToMetal, "MSL",
38 sksl, programKind, settings, msl, outInterface, errorHandler);
39}
40
41bool MtlFormatIsDepthOrStencil(MTLPixelFormat);
42bool MtlFormatIsDepth(MTLPixelFormat);
43bool MtlFormatIsStencil(MTLPixelFormat);
44bool MtlFormatIsCompressed(MTLPixelFormat);
45
46uint32_t MtlFormatChannels(MTLPixelFormat);
47
48size_t MtlFormatBytesPerBlock(MTLPixelFormat);
49
51
52const char* MtlFormatToString(MTLPixelFormat);
53
54} // namespace skgpu
55
56#endif // skgpu_MtlUtilsPriv_DEFINED
bool ToMetal(Program &program, const ShaderCaps *caps, OutputStream &out)
uint32_t MtlFormatChannels(MTLPixelFormat mtlFormat)
Definition MtlUtils.mm:91
bool SkSLToMSL(const SkSL::ShaderCaps *caps, const std::string &sksl, SkSL::ProgramKind programKind, const SkSL::ProgramSettings &settings, std::string *msl, SkSL::ProgramInterface *outInterface, ShaderErrorHandler *errorHandler)
const char * MtlFormatToString(MTLPixelFormat mtlFormat)
Definition MtlUtils.mm:62
bool SkSLToBackend(const SkSL::ShaderCaps *caps, bool(*toBackend)(SkSL::Program &, const SkSL::ShaderCaps *, std::string *), const char *backendLabel, const std::string &sksl, SkSL::ProgramKind programKind, const SkSL::ProgramSettings &settings, std::string *output, SkSL::ProgramInterface *outInterface, ShaderErrorHandler *errorHandler)
bool MtlFormatIsStencil(MTLPixelFormat format)
Definition MtlUtils.mm:39
bool MtlFormatIsDepthOrStencil(MTLPixelFormat format)
Definition MtlUtils.mm:18
bool MtlFormatIsDepth(MTLPixelFormat format)
Definition MtlUtils.mm:29
SkTextureCompressionType MtlFormatToCompressionType(MTLPixelFormat mtlFormat)
Definition MtlUtils.mm:148
bool MtlFormatIsCompressed(MTLPixelFormat mtlFormat)
Definition MtlUtils.mm:49
size_t MtlFormatBytesPerBlock(MTLPixelFormat mtlFormat)
Definition MtlUtils.mm:119