diff options
Diffstat (limited to 'src/deps/skia/include/gpu/mtl')
-rw-r--r-- | src/deps/skia/include/gpu/mtl/BUILD.bazel | 18 | ||||
-rw-r--r-- | src/deps/skia/include/gpu/mtl/GrMtlBackendContext.h | 21 | ||||
-rw-r--r-- | src/deps/skia/include/gpu/mtl/GrMtlTypes.h | 63 |
3 files changed, 102 insertions, 0 deletions
diff --git a/src/deps/skia/include/gpu/mtl/BUILD.bazel b/src/deps/skia/include/gpu/mtl/BUILD.bazel new file mode 100644 index 000000000..9881ff21f --- /dev/null +++ b/src/deps/skia/include/gpu/mtl/BUILD.bazel @@ -0,0 +1,18 @@ +load("//bazel:macros.bzl", "generated_cc_atom") + +generated_cc_atom( + name = "GrMtlBackendContext_hdr", + hdrs = ["GrMtlBackendContext.h"], + visibility = ["//:__subpackages__"], + deps = [":GrMtlTypes_hdr"], +) + +generated_cc_atom( + name = "GrMtlTypes_hdr", + hdrs = ["GrMtlTypes.h"], + visibility = ["//:__subpackages__"], + deps = [ + "//include/gpu:GrTypes_hdr", + "//include/ports:SkCFObject_hdr", + ], +) diff --git a/src/deps/skia/include/gpu/mtl/GrMtlBackendContext.h b/src/deps/skia/include/gpu/mtl/GrMtlBackendContext.h new file mode 100644 index 000000000..0d88f479a --- /dev/null +++ b/src/deps/skia/include/gpu/mtl/GrMtlBackendContext.h @@ -0,0 +1,21 @@ +/* + * Copyright 2020 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrMtlBackendContext_DEFINED +#define GrMtlBackendContext_DEFINED + +#include "include/gpu/mtl/GrMtlTypes.h" + +// The BackendContext contains all of the base Metal objects needed by the GrMtlGpu. The assumption +// is that the client will set these up and pass them to the GrMtlGpu constructor. +struct SK_API GrMtlBackendContext { + sk_cfp<GrMTLHandle> fDevice; + sk_cfp<GrMTLHandle> fQueue; + sk_cfp<GrMTLHandle> fBinaryArchive; +}; + +#endif diff --git a/src/deps/skia/include/gpu/mtl/GrMtlTypes.h b/src/deps/skia/include/gpu/mtl/GrMtlTypes.h new file mode 100644 index 000000000..f7a232e3c --- /dev/null +++ b/src/deps/skia/include/gpu/mtl/GrMtlTypes.h @@ -0,0 +1,63 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrMtlTypes_DEFINED +#define GrMtlTypes_DEFINED + +#include "include/gpu/GrTypes.h" +#include "include/ports/SkCFObject.h" + +/** + * Declares typedefs for Metal types used in Ganesh cpp code + */ +using GrMTLPixelFormat = unsigned int; +using GrMTLTextureUsage = unsigned int; +using GrMTLStorageMode = unsigned int; +using GrMTLHandle = const void*; + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef __APPLE__ + +#include <TargetConditionals.h> + +#if TARGET_OS_SIMULATOR +#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0)) +#else // TARGET_OS_SIMULATOR +#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0)) +#endif // TARGET_OS_SIMULATOR + +/** + * Types for interacting with Metal resources created externally to Skia. + * This is used by GrBackendObjects. + */ +struct GrMtlTextureInfo { +public: + GrMtlTextureInfo() {} + + sk_cfp<GrMTLHandle> fTexture; + + bool operator==(const GrMtlTextureInfo& that) const { + return fTexture == that.fTexture; + } +}; + +struct GrMtlSurfaceInfo { + uint32_t fSampleCount = 1; + uint32_t fLevelCount = 0; + GrProtected fProtected = GrProtected::kNo; + + // Since we aren't in an Obj-C header we can't directly use Mtl types here. Each of these can + // cast to their mapped Mtl types list below. + GrMTLPixelFormat fFormat = 0; // MTLPixelFormat fFormat = MTLPixelFormatInvalid; + GrMTLTextureUsage fUsage = 0; // MTLTextureUsage fUsage = MTLTextureUsageUnknown; + GrMTLStorageMode fStorageMode = 0; // MTLStorageMode fStorageMode = MTLStorageModeShared; +}; + +#endif + +#endif |