Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GpuTypesPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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_GpuTypesPriv_DEFINED
9#define skgpu_GpuTypesPriv_DEFINED
10
14
15#include <chrono>
16
17namespace skgpu {
18
19// The old libstdc++ uses the draft name "monotonic_clock" rather than "steady_clock". This might
20// not actually be monotonic, depending on how libstdc++ was built. However, this is only currently
21// used for idle resource purging so it shouldn't cause a correctness problem.
22#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20130000)
23using StdSteadyClock = std::chrono::monotonic_clock;
24#else
25using StdSteadyClock = std::chrono::steady_clock;
26#endif
27
28// In general we try to not mix CompressionType and ColorType, but currently SkImage still requires
29// an SkColorType even for CompressedTypes so we need some conversion.
40
41static constexpr const char* CompressionTypeToStr(SkTextureCompressionType compression) {
42 switch (compression) {
43 case SkTextureCompressionType::kNone: return "kNone";
44 case SkTextureCompressionType::kETC2_RGB8_UNORM: return "kETC2_RGB8_UNORM";
45 case SkTextureCompressionType::kBC1_RGB8_UNORM: return "kBC1_RGB8_UNORM";
46 case SkTextureCompressionType::kBC1_RGBA8_UNORM: return "kBC1_RGBA8_UNORM";
47 }
49}
50
51} // namespace skgpu
52
53#endif // skgpu_GpuTypesPriv_DEFINED
#define SkUNREACHABLE
Definition SkAssert.h:135
SkColorType
Definition SkColorType.h:19
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:25
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
static constexpr SkColorType CompressionTypeToSkColorType(SkTextureCompressionType compression)
std::chrono::steady_clock StdSteadyClock
static constexpr const char * CompressionTypeToStr(SkTextureCompressionType compression)