aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mock/GrMockCaps.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/mock/GrMockCaps.h')
-rw-r--r--src/gpu/mock/GrMockCaps.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
new file mode 100644
index 0000000000..7190ad7d61
--- /dev/null
+++ b/src/gpu/mock/GrMockCaps.h
@@ -0,0 +1,41 @@
+/*
+ * 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 GrMockCaps_DEFINED
+#define GrMockCaps_DEFINED
+
+#include "GrCaps.h"
+#include "mock/GrMockOptions.h"
+
+class GrMockCaps : public GrCaps {
+public:
+ GrMockCaps(const GrContextOptions& contextOptions, const GrMockOptions& options)
+ : INHERITED(contextOptions), fOptions(options) {
+ fBufferMapThreshold = SK_MaxS32;
+ fMaxTextureSize = options.fMaxTextureSize;
+ fMaxRenderTargetSize = SkTMin(options.fMaxRenderTargetSize, fMaxTextureSize);
+ fMaxVertexAttributes = options.fMaxVertexAttributes;
+ fShaderCaps.reset(new GrShaderCaps(contextOptions));
+ }
+ bool isConfigTexturable(GrPixelConfig config) const override {
+ return fOptions.fConfigOptions[config].fTexturable;
+ }
+ bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
+ return fOptions.fConfigOptions[config].fRenderable[withMSAA];
+ }
+ bool canConfigBeImageStorage(GrPixelConfig) const override { return false; }
+ bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
+ bool* rectsMustMatch, bool* disallowSubrect) const override {
+ return false;
+ }
+
+private:
+ GrMockOptions fOptions;
+ typedef GrCaps INHERITED;
+};
+
+#endif