12 #include "GrTypesPriv.h"
14 #include "GrShaderVar.h"
39 bool operator!=(
const PrecisionInfo& that)
const {
return !(*
this == that); }
60 bool shaderDerivativeSupport()
const {
return fShaderDerivativeSupport; }
61 bool geometryShaderSupport()
const {
return fGeometryShaderSupport; }
62 bool pathRenderingSupport()
const {
return fPathRenderingSupport; }
63 bool dstReadInShaderSupport()
const {
return fDstReadInShaderSupport; }
64 bool dualSourceBlendingSupport()
const {
return fDualSourceBlendingSupport; }
65 bool integerSupport()
const {
return fIntegerSupport; }
66 bool texelBufferSupport()
const {
return fTexelBufferSupport; }
75 GrSLPrecision precision)
const {
76 return fFloatPrecisions[shaderType][precision];
97 #if GR_ENABLE_PLS_PATH_RENDERING
98 return fPLSPathRenderingSupport;
109 bool fShaderDerivativeSupport : 1;
110 bool fGeometryShaderSupport : 1;
111 bool fPathRenderingSupport : 1;
112 bool fDstReadInShaderSupport : 1;
113 bool fDualSourceBlendingSupport : 1;
114 bool fIntegerSupport : 1;
115 bool fTexelBufferSupport : 1;
117 bool fShaderPrecisionVaries;
118 PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
119 int fPixelLocalStorageSize;
120 bool fPLSPathRenderingSupport;
136 GrShaderCaps* shaderCaps()
const {
return fShaderCaps; }
138 bool npotTextureTileSupport()
const {
return fNPOTTextureTileSupport; }
153 bool twoSidedStencilSupport()
const {
return fTwoSidedStencilSupport; }
154 bool stencilWrapOpsSupport()
const {
return fStencilWrapOpsSupport; }
155 bool discardRenderTargetSupport()
const {
return fDiscardRenderTargetSupport; }
156 bool gpuTracingSupport()
const {
return fGpuTracingSupport; }
157 bool compressedTexSubImageSupport()
const {
return fCompressedTexSubImageSupport; }
158 bool oversizedStencilSupport()
const {
return fOversizedStencilSupport; }
159 bool textureBarrierSupport()
const {
return fTextureBarrierSupport; }
160 bool sampleLocationsSupport()
const {
return fSampleLocationsSupport; }
161 bool multisampleDisableSupport()
const {
return fMultisampleDisableSupport; }
162 bool usesMixedSamples()
const {
return fUsesMixedSamples; }
163 bool preferClientSideDynamicBuffers()
const {
return fPreferClientSideDynamicBuffers; }
165 bool useDrawInsteadOfClear()
const {
return fUseDrawInsteadOfClear; }
166 bool useDrawInsteadOfPartialRenderTargetWrite()
const {
167 return fUseDrawInsteadOfPartialRenderTargetWrite;
170 bool useDrawInsteadOfAllRenderTargetWrites()
const {
171 return fUseDrawInsteadOfAllRenderTargetWrites;
174 bool preferVRAMUseOverFlushes()
const {
return fPreferVRAMUseOverFlushes; }
189 bool avoidInstancedDrawsToFPTargets()
const {
return fAvoidInstancedDrawsToFPTargets; }
195 kBasic_BlendEquationSupport,
197 kAdvanced_BlendEquationSupport,
199 kAdvancedCoherent_BlendEquationSupport,
202 kLast_BlendEquationSupport = kAdvancedCoherent_BlendEquationSupport
207 bool advancedBlendEquationSupport()
const {
208 return fBlendEquationSupport >= kAdvanced_BlendEquationSupport;
211 bool advancedCoherentBlendEquationSupport()
const {
212 return kAdvancedCoherent_BlendEquationSupport == fBlendEquationSupport;
215 bool canUseAdvancedBlendEquation(GrBlendEquation equation)
const {
216 SkASSERT(GrBlendEquationIsAdvanced(equation));
217 return SkToBool(fAdvBlendEqBlacklist & (1 << equation));
225 kNone_MapFlags = 0x0,
227 kCanMap_MapFlag = 0x1,
229 kSubset_MapFlag = 0x2,
232 uint32_t mapBufferFlags()
const {
return fMapBufferFlags; }
238 bool reuseScratchTextures()
const {
return fReuseScratchTextures; }
239 bool reuseScratchBuffers()
const {
return fReuseScratchBuffers; }
244 int maxRenderTargetSize()
const {
return fMaxRenderTargetSize; }
245 int maxTextureSize()
const {
return fMaxTextureSize; }
248 int maxTileSize()
const { SkASSERT(fMaxTileSize <= fMaxTextureSize);
return fMaxTileSize; }
251 int maxColorSampleCount()
const {
return fMaxColorSampleCount; }
253 int maxStencilSampleCount()
const {
return fMaxStencilSampleCount; }
256 int maxRasterSamples()
const {
return fMaxRasterSamples; }
259 int maxSampleCount()
const {
260 if (this->usesMixedSamples()) {
261 return this->maxStencilSampleCount();
263 return SkTMin(this->maxColorSampleCount(), this->maxStencilSampleCount());
267 int maxWindowRectangles()
const {
return fMaxWindowRectangles; }
269 virtual bool isConfigTexturable(GrPixelConfig config)
const = 0;
270 virtual bool isConfigRenderable(GrPixelConfig config,
bool withMSAA)
const = 0;
272 bool suppressPrints()
const {
return fSuppressPrints; }
274 bool immediateFlush()
const {
return fImmediateFlush; }
276 size_t bufferMapThreshold()
const {
277 SkASSERT(fBufferMapThreshold >= 0);
278 return fBufferMapThreshold;
281 bool fullClearIsFree()
const {
return fFullClearIsFree; }
287 bool sampleShadingSupport()
const {
return fSampleShadingSupport; }
297 bool fNPOTTextureTileSupport : 1;
298 bool fMipMapSupport : 1;
299 bool fSRGBSupport : 1;
300 bool fSRGBWriteControl : 1;
301 bool fTwoSidedStencilSupport : 1;
302 bool fStencilWrapOpsSupport : 1;
303 bool fDiscardRenderTargetSupport : 1;
304 bool fReuseScratchTextures : 1;
305 bool fReuseScratchBuffers : 1;
306 bool fGpuTracingSupport : 1;
307 bool fCompressedTexSubImageSupport : 1;
308 bool fOversizedStencilSupport : 1;
309 bool fTextureBarrierSupport : 1;
310 bool fSampleLocationsSupport : 1;
311 bool fMultisampleDisableSupport : 1;
312 bool fUsesMixedSamples : 1;
313 bool fPreferClientSideDynamicBuffers : 1;
314 bool fFullClearIsFree : 1;
315 bool fMustClearUploadedBufferData : 1;
318 bool fUseDrawInsteadOfClear : 1;
319 bool fUseDrawInsteadOfPartialRenderTargetWrite : 1;
320 bool fUseDrawInsteadOfAllRenderTargetWrites : 1;
321 bool fAvoidInstancedDrawsToFPTargets : 1;
324 bool fPreferVRAMUseOverFlushes : 1;
326 bool fSampleShadingSupport : 1;
331 uint32_t fAdvBlendEqBlacklist;
332 GR_STATIC_ASSERT(kLast_GrBlendEquation < 32);
334 uint32_t fMapBufferFlags;
335 int fBufferMapThreshold;
337 int fMaxRenderTargetSize;
338 int fMaxVertexAttributes;
341 int fMaxColorSampleCount;
342 int fMaxStencilSampleCount;
343 int fMaxRasterSamples;
344 int fMaxWindowRectangles;
349 bool fSuppressPrints : 1;
350 bool fImmediateFlush: 1;
Definition: GrContextOptions.h:13
Info about shader variable precision within a given shader stage.
Definition: GrCaps.h:25
bool supported() const
Is this precision level allowed in the shader stage?
Definition: GrCaps.h:33
int pixelLocalStorageSize() const
PLS storage size in bytes (0 when not supported).
Definition: GrCaps.h:90
Represents the capabilities of a GrContext.
Definition: GrCaps.h:130
bool srgbWriteControl() const
Is there support for enabling/disabling sRGB writes for sRGB-capable color buffers?
Definition: GrCaps.h:152
bool plsPathRenderingSupport() const
True if this context supports the necessary extensions and features to enable the PLS path renderer...
Definition: GrCaps.h:96
void applyOptionsOverrides(const GrContextOptions &options)
Subclasses must call this after initialization in order to apply caps overrides requested by the clie...
int fLogRangeLow
floor(log2(|min_value|))
Definition: GrCaps.h:42
MapFlags
Indicates whether GPU->CPU memory mapping for GPU resources such as vertex buffers and textures allow...
Definition: GrCaps.h:224
InstancedSupport
Indicates the level of support for gr_instanced::* functionality.
Definition: GrCaps.h:180
Definition: SkRefCnt.h:135
#define SkToBool(cond)
Returns 0 or 1 based on the condition.
Definition: SkTypes.h:287
int fBits
Number of bits of precision.
Definition: GrCaps.h:53
bool floatPrecisionVaries() const
Is there any difference between the float shader variable precision types? If this is true then unles...
Definition: GrCaps.h:84
int maxVertexAttributes() const
maximum number of attribute values per vertex
Definition: GrCaps.h:242
bool mipMapSupport() const
To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e...
Definition: GrCaps.h:141
int fLogRangeHigh
floor(log2(|max_value|))
Definition: GrCaps.h:44
BlendEquationSupport
Indicates the capabilities of the fixed function blend unit.
Definition: GrCaps.h:194
void applyOptionsOverrides(const GrContextOptions &options)
Subclasses must call this at the end of their constructors in order to apply caps overrides requested...
const PrecisionInfo & getFloatShaderPrecisionInfo(GrShaderType shaderType, GrSLPrecision precision) const
Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a given shader...
Definition: GrCaps.h:74
bool srgbSupport() const
Skia convention is that a device only has sRGB support if it supports sRGB formats for both textures ...
Definition: GrCaps.h:148
bool mustClearUploadedBufferData() const
True in environments that will issue errors if memory uploaded to buffers is not initialized (even if...
Definition: GrCaps.h:285
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:248