• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 GrD3DCaps_DEFINED
9 #define GrD3DCaps_DEFINED
10 
11 #include "src/gpu/GrCaps.h"
12 
13 class GrShaderCaps;
14 
15 /**
16  * Stores some capabilities of a D3D backend.
17  */
18 class GrD3DCaps : public GrCaps {
19 public:
20     /**
21      * Creates a GrD3DCaps that is set such that nothing is supported. The init function should
22      * be called to fill out the caps.
23      */
24     GrD3DCaps(const GrContextOptions& contextOptions, GrProtected isProtected = GrProtected::kNo);
25 
26     bool isFormatSRGB(const GrBackendFormat&) const override;
27     SkImage::CompressionType compressionType(const GrBackendFormat&) const override;
28 
29     bool isFormatTexturableAndUploadable(GrColorType, const GrBackendFormat&) const override;
30     bool isFormatTexturable(const GrBackendFormat&) const override;
31 
isFormatCopyable(const GrBackendFormat &)32     bool isFormatCopyable(const GrBackendFormat&) const override { return true; }
33 
34     bool isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat& format,
35                                        int sampleCount = 1) const override;
36     bool isFormatRenderable(const GrBackendFormat& format, int sampleCount) const override;
37 
38     int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat&) const override;
39 
40     int maxRenderTargetSampleCount(const GrBackendFormat&) const override;
41 
42     size_t bytesPerPixel(const GrBackendFormat&) const override;
43 
44     SupportedWrite supportedWritePixelsColorType(GrColorType surfaceColorType,
45                                                  const GrBackendFormat& surfaceFormat,
46                                                  GrColorType srcColorType) const override;
47 
48     SurfaceReadPixelsSupport surfaceSupportsReadPixels(const GrSurface*) const override;
49 
50     GrColorType getYUVAColorTypeFromBackendFormat(const GrBackendFormat&,
51                                                   bool isAlphaChannel) const override;
52 
53     GrBackendFormat getBackendFormatFromCompressionType(SkImage::CompressionType) const override;
54 
55     GrSwizzle getReadSwizzle(const GrBackendFormat&, GrColorType) const override;
56     GrSwizzle getOutputSwizzle(const GrBackendFormat&, GrColorType) const override;
57 
58     uint64_t computeFormatKey(const GrBackendFormat&) const override;
59 
60     void addExtraSamplerKey(GrProcessorKeyBuilder*,
61                             GrSamplerState,
62                             const GrBackendFormat&) const override;
63 
64     GrProgramDesc makeDesc(const GrRenderTarget*, const GrProgramInfo&) const override;
65 
66 #if GR_TEST_UTILS
67     std::vector<TestFormatColorTypeCombination> getTestingCombinations() const override;
68 #endif
69 
70 private:
71     void init(const GrContextOptions& contextOptions);
72 
73     bool onSurfaceSupportsWritePixels(const GrSurface*) const override;
74     bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,
75                           const SkIRect& srcRect, const SkIPoint& dstPoint) const override;
76     GrBackendFormat onGetDefaultBackendFormat(GrColorType, GrRenderable) const override;
77 
78     bool onAreColorTypeAndFormatCompatible(GrColorType, const GrBackendFormat&) const override;
79 
80     SupportedRead onSupportedReadPixelsColorType(GrColorType, const GrBackendFormat&,
81                                                  GrColorType) const override;
82 
83     typedef GrCaps INHERITED;
84 };
85 
86 #endif
87