blob: 90cc8243cc9935ec97ca3fcbdf22a97043622c80 [file] [log] [blame]
Brian Salomoncfe910d2017-07-06 16:40:18 -04001/*
2 * Copyright 2017 Google Inc.
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 GrMockCaps_DEFINED
9#define GrMockCaps_DEFINED
10
11#include "GrCaps.h"
Brian Salomon8fe24272017-07-07 12:56:11 -040012#include "mock/GrMockTypes.h"
Brian Salomoncfe910d2017-07-06 16:40:18 -040013
14class GrMockCaps : public GrCaps {
15public:
16 GrMockCaps(const GrContextOptions& contextOptions, const GrMockOptions& options)
17 : INHERITED(contextOptions), fOptions(options) {
18 fBufferMapThreshold = SK_MaxS32;
19 fMaxTextureSize = options.fMaxTextureSize;
20 fMaxRenderTargetSize = SkTMin(options.fMaxRenderTargetSize, fMaxTextureSize);
21 fMaxVertexAttributes = options.fMaxVertexAttributes;
22 fShaderCaps.reset(new GrShaderCaps(contextOptions));
Brian Salomon8fe24272017-07-07 12:56:11 -040023 this->applyOptionsOverrides(contextOptions);
Brian Salomoncfe910d2017-07-06 16:40:18 -040024 }
Greg Daniel81e7bf82017-07-19 14:47:42 -040025 int getSampleCount(int /*requestCount*/, GrPixelConfig /*config*/) const override {
26 return 0;
27 }
Brian Salomoncfe910d2017-07-06 16:40:18 -040028 bool isConfigTexturable(GrPixelConfig config) const override {
29 return fOptions.fConfigOptions[config].fTexturable;
30 }
31 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
32 return fOptions.fConfigOptions[config].fRenderable[withMSAA];
33 }
Greg Danielbb76ace2017-09-29 15:58:22 -040034 bool isConfigCopyable(GrPixelConfig config) const override {
35 return false;
36 }
37
Brian Salomoncfe910d2017-07-06 16:40:18 -040038 bool canConfigBeImageStorage(GrPixelConfig) const override { return false; }
39 bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
40 bool* rectsMustMatch, bool* disallowSubrect) const override {
41 return false;
42 }
43
44private:
45 GrMockOptions fOptions;
46 typedef GrCaps INHERITED;
47};
48
49#endif