Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrMockCaps.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2019 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
9
10#include "src/base/SkMathPriv.h"
13
14int GrMockCaps::getRenderTargetSampleCount(int requestCount, GrColorType ct) const {
15 requestCount = std::max(requestCount, 1);
16
17 switch (fOptions.fConfigOptions[(int)ct].fRenderability) {
19 return 0;
21 return requestCount > 1 ? 0 : 1;
23 return requestCount > kMaxSampleCnt ? 0 : GrNextPow2(requestCount);
24 }
25 return 0;
26}
27
29 const GrProgramInfo& programInfo,
30 ProgramDescOverrideFlags overrideFlags) const {
32 GrProgramDesc desc;
33 GrProgramDesc::Build(&desc, programInfo, *this);
34 return desc;
35}
36
38#ifdef SK_DEBUG
39 SkTextureCompressionType compression = format.asMockCompressionType();
41#endif
42 auto ct = format.asMockColorType();
43 return (uint64_t)ct;
44}
45
46#if defined(GR_TEST_UTILS)
47std::vector<GrTest::TestFormatColorTypeCombination> GrMockCaps::getTestingCombinations() const {
48 // TODO: need to add compressed formats to this list
49 std::vector<GrTest::TestFormatColorTypeCombination> combos = {
88 // For these two compressed image formats the color type will effectively be RGB_888x
95 };
96
97#ifdef SK_DEBUG
98 for (const GrTest::TestFormatColorTypeCombination& combo : combos) {
99 SkASSERT(this->onAreColorTypeAndFormatCompatible(combo.fColorType, combo.fFormat));
100 }
101#endif
102
103 return combos;
104}
105
106#endif
GrColorType
#define SkASSERT(cond)
Definition SkAssert.h:116
static uint32_t GrNextPow2(uint32_t n)
Definition SkMathPriv.h:302
static GrBackendFormat MakeMock(GrColorType colorType, SkTextureCompressionType compression, bool isStencilFormat=false)
ProgramDescOverrideFlags
Definition GrCaps.h:511
bool onAreColorTypeAndFormatCompatible(GrColorType ct, const GrBackendFormat &format) const override
Definition GrMockCaps.h:184
uint64_t computeFormatKey(const GrBackendFormat &) const override
GrProgramDesc makeDesc(GrRenderTarget *, const GrProgramInfo &, ProgramDescOverrideFlags) const override
int getRenderTargetSampleCount(int requestCount, GrColorType) const
static void Build(GrProgramDesc *, const GrProgramInfo &, const GrCaps &)
uint32_t uint32_t * format
ConfigOptions fConfigOptions[kGrColorTypeCnt]