Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: src/gpu/gl/GrGLCaps.h

Issue 395203002: Revert of Reopened: Caching the result of readPixelsSupported (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkTHashCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef GrGLCaps_DEFINED 9 #ifndef GrGLCaps_DEFINED
10 #define GrGLCaps_DEFINED 10 #define GrGLCaps_DEFINED
11 11
12 #include "GrDrawTargetCaps.h" 12 #include "GrDrawTargetCaps.h"
13 #include "GrGLStencilBuffer.h" 13 #include "GrGLStencilBuffer.h"
14 #include "SkChecksum.h"
15 #include "SkTHashCache.h"
16 #include "SkTArray.h" 14 #include "SkTArray.h"
15 #include "SkTDArray.h"
17 16
18 class GrGLContextInfo; 17 class GrGLContextInfo;
19 18
20 /** 19 /**
21 * Stores some capabilities of a GL context. Most are determined by the GL 20 * Stores some capabilities of a GL context. Most are determined by the GL
22 * version and the extensions string. It also tracks formats that have passed 21 * version and the extensions string. It also tracks formats that have passed
23 * the FBO completeness test. 22 * the FBO completeness test.
24 */ 23 */
25 class GrGLCaps : public GrDrawTargetCaps { 24 class GrGLCaps : public GrDrawTargetCaps {
26 public: 25 public:
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; } 246 bool vertexArrayObjectSupport() const { return fVertexArrayObjectSupport; }
248 247
249 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte nt. 248 /// Use indices or vertices in CPU arrays rather than VBOs for dynamic conte nt.
250 bool useNonVBOVertexAndIndexDynamicData() const { 249 bool useNonVBOVertexAndIndexDynamicData() const {
251 return fUseNonVBOVertexAndIndexDynamicData; 250 return fUseNonVBOVertexAndIndexDynamicData;
252 } 251 }
253 252
254 /// Does ReadPixels support the provided format/type combo? 253 /// Does ReadPixels support the provided format/type combo?
255 bool readPixelsSupported(const GrGLInterface* intf, 254 bool readPixelsSupported(const GrGLInterface* intf,
256 GrGLenum format, 255 GrGLenum format,
257 GrGLenum type, 256 GrGLenum type) const;
258 GrGLenum currFboFormat) const;
259 257
260 bool isCoreProfile() const { return fIsCoreProfile; } 258 bool isCoreProfile() const { return fIsCoreProfile; }
261 259
262 260
263 bool fullClearIsFree() const { return fFullClearIsFree; } 261 bool fullClearIsFree() const { return fFullClearIsFree; }
264 262
265 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; } 263 bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
266 264
267 /** 265 /**
268 * Returns a string containing the caps info. 266 * Returns a string containing the caps info.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx)); 317 return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx));
320 } 318 }
321 }; 319 };
322 320
323 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); 321 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*);
324 void initStencilFormats(const GrGLContextInfo&); 322 void initStencilFormats(const GrGLContextInfo&);
325 // This must be called after initFSAASupport(). 323 // This must be called after initFSAASupport().
326 void initConfigRenderableTable(const GrGLContextInfo&); 324 void initConfigRenderableTable(const GrGLContextInfo&);
327 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*) ; 325 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*) ;
328 326
329 bool doReadPixelsSupported(const GrGLInterface* intf,
330 GrGLenum format,
331 GrGLenum type) const;
332
333 // tracks configs that have been verified to pass the FBO completeness when 327 // tracks configs that have been verified to pass the FBO completeness when
334 // used as a color attachment 328 // used as a color attachment
335 VerifiedColorConfigs fVerifiedColorConfigs; 329 VerifiedColorConfigs fVerifiedColorConfigs;
336 330
337 SkTArray<StencilFormat, true> fStencilFormats; 331 SkTArray<StencilFormat, true> fStencilFormats;
338 // tracks configs that have been verified to pass the FBO completeness when 332 // tracks configs that have been verified to pass the FBO completeness when
339 // used as a color attachment when a particular stencil format is used 333 // used as a color attachment when a particular stencil format is used
340 // as a stencil attachment. 334 // as a stencil attachment.
341 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs; 335 SkTArray<VerifiedColorConfigs, true> fStencilVerifiedColorConfigs;
342 336
(...skipping 20 matching lines...) Expand all
363 bool fTextureRedSupport : 1; 357 bool fTextureRedSupport : 1;
364 bool fImagingSupport : 1; 358 bool fImagingSupport : 1;
365 bool fTwoFormatLimit : 1; 359 bool fTwoFormatLimit : 1;
366 bool fFragCoordsConventionSupport : 1; 360 bool fFragCoordsConventionSupport : 1;
367 bool fVertexArrayObjectSupport : 1; 361 bool fVertexArrayObjectSupport : 1;
368 bool fUseNonVBOVertexAndIndexDynamicData : 1; 362 bool fUseNonVBOVertexAndIndexDynamicData : 1;
369 bool fIsCoreProfile : 1; 363 bool fIsCoreProfile : 1;
370 bool fFullClearIsFree : 1; 364 bool fFullClearIsFree : 1;
371 bool fDropsTileOnZeroDivide : 1; 365 bool fDropsTileOnZeroDivide : 1;
372 366
373 class ReadPixelsSupportedFormats {
374 public:
375 struct Key {
376 GrGLenum fFormat;
377 GrGLenum fType;
378 GrGLenum fFboFormat;
379
380 bool operator==(const Key& rhs) const {
381 return fFormat == rhs.fFormat
382 && fType == rhs.fType
383 && fFboFormat == rhs.fFboFormat;
384 }
385
386 uint32_t getHash() const {
387 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(thi s), sizeof(*this));
388 }
389 };
390
391 ReadPixelsSupportedFormats(Key key, bool value) : fKey(key), fValue(valu e) {
392 }
393
394 static const Key& GetKey(const ReadPixelsSupportedFormats& element) {
395 return element.fKey;
396 }
397
398 static uint32_t Hash(const Key& key) {
399 return key.getHash();
400 }
401
402 bool value() const {
403 return fValue;
404 }
405 private:
406 Key fKey;
407 bool fValue;
408 };
409
410 mutable SkTHashCache<ReadPixelsSupportedFormats,
411 ReadPixelsSupportedFormats::Key> fReadPixelsSupportedCa che;
412
413 typedef GrDrawTargetCaps INHERITED; 367 typedef GrDrawTargetCaps INHERITED;
414 }; 368 };
415 369
416 #endif 370 #endif
OLDNEW
« no previous file with comments | « src/core/SkTHashCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698