12 #include "GrTypesPriv.h"
14 #include "GrShaderCaps.h"
19 class GrRenderTargetProxy;
29 const GrShaderCaps* shaderCaps()
const {
return fShaderCaps.get(); }
31 bool npotTextureTileSupport()
const {
return fNPOTTextureTileSupport; }
46 bool discardRenderTargetSupport()
const {
return fDiscardRenderTargetSupport; }
47 bool gpuTracingSupport()
const {
return fGpuTracingSupport; }
48 bool oversizedStencilSupport()
const {
return fOversizedStencilSupport; }
49 bool textureBarrierSupport()
const {
return fTextureBarrierSupport; }
50 bool sampleLocationsSupport()
const {
return fSampleLocationsSupport; }
51 bool multisampleDisableSupport()
const {
return fMultisampleDisableSupport; }
52 bool instanceAttribSupport()
const {
return fInstanceAttribSupport; }
53 bool usesMixedSamples()
const {
return fUsesMixedSamples; }
54 bool preferClientSideDynamicBuffers()
const {
return fPreferClientSideDynamicBuffers; }
56 bool useDrawInsteadOfClear()
const {
return fUseDrawInsteadOfClear; }
58 bool preferVRAMUseOverFlushes()
const {
return fPreferVRAMUseOverFlushes; }
73 bool avoidInstancedDrawsToFPTargets()
const {
return fAvoidInstancedDrawsToFPTargets; }
75 bool avoidStencilBuffers()
const {
return fAvoidStencilBuffers; }
81 kBasic_BlendEquationSupport,
83 kAdvanced_BlendEquationSupport,
85 kAdvancedCoherent_BlendEquationSupport,
88 kLast_BlendEquationSupport = kAdvancedCoherent_BlendEquationSupport
93 bool advancedBlendEquationSupport()
const {
94 return fBlendEquationSupport >= kAdvanced_BlendEquationSupport;
97 bool advancedCoherentBlendEquationSupport()
const {
98 return kAdvancedCoherent_BlendEquationSupport == fBlendEquationSupport;
101 bool canUseAdvancedBlendEquation(GrBlendEquation equation)
const {
102 SkASSERT(GrBlendEquationIsAdvanced(equation));
103 return SkToBool(fAdvBlendEqBlacklist & (1 << equation));
111 kNone_MapFlags = 0x0,
113 kCanMap_MapFlag = 0x1,
115 kSubset_MapFlag = 0x2,
118 uint32_t mapBufferFlags()
const {
return fMapBufferFlags; }
124 bool reuseScratchTextures()
const {
return fReuseScratchTextures; }
125 bool reuseScratchBuffers()
const {
return fReuseScratchBuffers; }
130 int maxRenderTargetSize()
const {
return fMaxRenderTargetSize; }
131 int maxTextureSize()
const {
return fMaxTextureSize; }
134 int maxTileSize()
const { SkASSERT(fMaxTileSize <= fMaxTextureSize);
return fMaxTileSize; }
137 int maxColorSampleCount()
const {
return fMaxColorSampleCount; }
139 int maxStencilSampleCount()
const {
return fMaxStencilSampleCount; }
142 int maxRasterSamples()
const {
return fMaxRasterSamples; }
145 int maxSampleCount()
const {
146 if (this->usesMixedSamples()) {
147 return this->maxStencilSampleCount();
149 return SkTMin(this->maxColorSampleCount(), this->maxStencilSampleCount());
153 int maxWindowRectangles()
const {
return fMaxWindowRectangles; }
155 virtual bool isConfigTexturable(GrPixelConfig)
const = 0;
156 virtual bool isConfigRenderable(GrPixelConfig config,
bool withMSAA)
const = 0;
157 virtual bool canConfigBeImageStorage(GrPixelConfig config)
const = 0;
159 bool suppressPrints()
const {
return fSuppressPrints; }
161 size_t bufferMapThreshold()
const {
162 SkASSERT(fBufferMapThreshold >= 0);
163 return fBufferMapThreshold;
166 bool fullClearIsFree()
const {
return fFullClearIsFree; }
172 bool wireframeMode()
const {
return fWireframeMode; }
174 bool sampleShadingSupport()
const {
return fSampleShadingSupport; }
176 bool fenceSyncSupport()
const {
return fFenceSyncSupport; }
177 bool crossContextTextureSupport()
const {
return fCrossContextTextureSupport; }
188 bool* rectsMustMatch,
bool* disallowSubrect)
const = 0;
198 bool fNPOTTextureTileSupport : 1;
199 bool fMipMapSupport : 1;
200 bool fSRGBSupport : 1;
201 bool fSRGBWriteControl : 1;
202 bool fDiscardRenderTargetSupport : 1;
203 bool fReuseScratchTextures : 1;
204 bool fReuseScratchBuffers : 1;
205 bool fGpuTracingSupport : 1;
206 bool fOversizedStencilSupport : 1;
207 bool fTextureBarrierSupport : 1;
208 bool fSampleLocationsSupport : 1;
209 bool fMultisampleDisableSupport : 1;
210 bool fInstanceAttribSupport : 1;
211 bool fUsesMixedSamples : 1;
212 bool fPreferClientSideDynamicBuffers : 1;
213 bool fFullClearIsFree : 1;
214 bool fMustClearUploadedBufferData : 1;
217 bool fUseDrawInsteadOfClear : 1;
218 bool fAvoidInstancedDrawsToFPTargets : 1;
219 bool fAvoidStencilBuffers : 1;
222 bool fPreferVRAMUseOverFlushes : 1;
224 bool fSampleShadingSupport : 1;
226 bool fFenceSyncSupport : 1;
229 bool fCrossContextTextureSupport : 1;
234 uint32_t fAdvBlendEqBlacklist;
235 GR_STATIC_ASSERT(kLast_GrBlendEquation < 32);
237 uint32_t fMapBufferFlags;
238 int fBufferMapThreshold;
240 int fMaxRenderTargetSize;
241 int fMaxVertexAttributes;
244 int fMaxColorSampleCount;
245 int fMaxStencilSampleCount;
246 int fMaxRasterSamples;
247 int fMaxWindowRectangles;
252 bool fSuppressPrints : 1;
253 bool fWireframeMode : 1;
Definition: GrContextOptions.h:14
Represents the capabilities of a GrContext.
Definition: GrCaps.h:24
bool srgbWriteControl() const
Is there support for enabling/disabling sRGB writes for sRGB-capable color buffers?
Definition: GrCaps.h:45
Describes a surface to be created.
Definition: GrTypes.h:589
MapFlags
Indicates whether GPU->CPU memory mapping for GPU resources such as vertex buffers and textures allow...
Definition: GrCaps.h:110
InstancedSupport
Indicates the level of support for gr_instanced::* functionality.
Definition: GrCaps.h:64
Definition: SkRefCnt.h:125
#define SkToBool(cond)
Returns 0 or 1 based on the condition.
Definition: SkTypes.h:227
int maxVertexAttributes() const
maximum number of attribute values per vertex
Definition: GrCaps.h:128
bool mipMapSupport() const
To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e...
Definition: GrCaps.h:34
BlendEquationSupport
Indicates the capabilities of the fixed function blend unit.
Definition: GrCaps.h:80
void applyOptionsOverrides(const GrContextOptions &options)
Subclasses must call this at the end of their constructors in order to apply caps overrides requested...
Definition: GrShaderCaps.h:20
bool srgbSupport() const
Skia convention is that a device only has sRGB support if it supports sRGB formats for both textures ...
Definition: GrCaps.h:41
bool mustClearUploadedBufferData() const
True in environments that will issue errors if memory uploaded to buffers is not initialized (even if...
Definition: GrCaps.h:170
virtual bool initDescForDstCopy(const GrRenderTargetProxy *src, GrSurfaceDesc *desc, bool *rectsMustMatch, bool *disallowSubrect) const =0
This is can be called before allocating a texture to be a dst for copySurface.
Light weight class for managing strings.
Definition: SkString.h:121
int maxTileSize() const
This is the maximum tile size to use by GPU devices for rendering sw-backed images/bitmaps.
Definition: GrCaps.h:134