OLD | NEW |
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 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 enum MapBufferType { | 81 enum MapBufferType { |
82 kNone_MapBufferType, | 82 kNone_MapBufferType, |
83 kMapBuffer_MapBufferType, // glMapBuffer() | 83 kMapBuffer_MapBufferType, // glMapBuffer() |
84 kMapBufferRange_MapBufferType, // glMapBufferRange() | 84 kMapBufferRange_MapBufferType, // glMapBufferRange() |
85 kChromium_MapBufferType, // GL_CHROMIUM_map_sub | 85 kChromium_MapBufferType, // GL_CHROMIUM_map_sub |
86 | 86 |
87 kLast_MapBufferType = kChromium_MapBufferType, | 87 kLast_MapBufferType = kChromium_MapBufferType, |
88 }; | 88 }; |
89 | 89 |
90 /** | 90 /** |
91 * Creates a GrGLCaps that advertises no support for any extensions, | |
92 * formats, etc. Call init to initialize from a GrGLContextInfo. | |
93 */ | |
94 GrGLCaps(); | |
95 | |
96 GrGLCaps(const GrGLCaps& caps); | |
97 | |
98 GrGLCaps& operator = (const GrGLCaps& caps); | |
99 | |
100 /** | |
101 * Resets the caps such that nothing is supported. | |
102 */ | |
103 void reset() override; | |
104 | |
105 /** | |
106 * Initializes the GrGLCaps to the set of features supported in the current | 91 * Initializes the GrGLCaps to the set of features supported in the current |
107 * OpenGL context accessible via ctxInfo. | 92 * OpenGL context accessible via ctxInfo. |
108 */ | 93 */ |
109 bool init(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface); | 94 GrGLCaps(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface); |
110 | 95 |
111 /** | 96 /** |
112 * Call to note that a color config has been verified as a valid color | 97 * Call to note that a color config has been verified as a valid color |
113 * attachment. This may save future calls to glCheckFramebufferStatus | 98 * attachment. This may save future calls to glCheckFramebufferStatus |
114 * using isConfigVerifiedColorAttachment(). | 99 * using isConfigVerifiedColorAttachment(). |
115 */ | 100 */ |
116 void markConfigAsValidColorAttachment(GrPixelConfig config) { | 101 void markConfigAsValidColorAttachment(GrPixelConfig config) { |
117 fVerifiedColorConfigs.markVerified(config); | 102 fVerifiedColorConfigs.markVerified(config); |
118 } | 103 } |
119 | 104 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 kLATC_LATCAlias, | 255 kLATC_LATCAlias, |
271 kRGTC_LATCAlias, | 256 kRGTC_LATCAlias, |
272 k3DC_LATCAlias | 257 k3DC_LATCAlias |
273 }; | 258 }; |
274 | 259 |
275 LATCAlias latcAlias() const { return fLATCAlias; } | 260 LATCAlias latcAlias() const { return fLATCAlias; } |
276 | 261 |
277 GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderC
aps.get()); } | 262 GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderC
aps.get()); } |
278 | 263 |
279 private: | 264 private: |
| 265 void init(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface); |
| 266 |
280 /** | 267 /** |
281 * Maintains a bit per GrPixelConfig. It is used to avoid redundantly | 268 * Maintains a bit per GrPixelConfig. It is used to avoid redundantly |
282 * performing glCheckFrameBufferStatus for the same config. | 269 * performing glCheckFrameBufferStatus for the same config. |
283 */ | 270 */ |
284 struct VerifiedColorConfigs { | 271 struct VerifiedColorConfigs { |
285 VerifiedColorConfigs() { | 272 VerifiedColorConfigs() { |
286 this->reset(); | 273 this->reset(); |
287 } | 274 } |
288 | 275 |
289 void reset() { | 276 void reset() { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 enum AdvBlendEqInteraction { | 377 enum AdvBlendEqInteraction { |
391 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension | 378 kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advance
d extension |
392 kAutomatic_AdvBlendEqInteraction, //<! No interaction required | 379 kAutomatic_AdvBlendEqInteraction, //<! No interaction required |
393 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_e
quations) out | 380 kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_e
quations) out |
394 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers
per equation | 381 kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers
per equation |
395 | 382 |
396 kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction | 383 kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction |
397 }; | 384 }; |
398 | 385 |
399 /** | 386 /** |
400 * Creates a GrGLSLCaps that advertises no support for any extensions, | |
401 * formats, etc. Call init to initialize from a GrGLContextInfo. | |
402 */ | |
403 GrGLSLCaps(); | |
404 ~GrGLSLCaps() override {} | |
405 | |
406 GrGLSLCaps(const GrGLSLCaps& caps); | |
407 | |
408 GrGLSLCaps& operator = (const GrGLSLCaps& caps); | |
409 | |
410 /** | |
411 * Resets the caps such that nothing is supported. | |
412 */ | |
413 void reset() override; | |
414 | |
415 /** | |
416 * Initializes the GrGLSLCaps to the set of features supported in the curren
t | 387 * Initializes the GrGLSLCaps to the set of features supported in the curren
t |
417 * OpenGL context accessible via ctxInfo. | 388 * OpenGL context accessible via ctxInfo. |
418 */ | 389 */ |
419 bool init(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); | 390 GrGLSLCaps(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); |
420 | 391 |
421 /** | 392 /** |
422 * Some helper functions for encapsulating various extensions to read FB Buf
fer on openglES | 393 * Some helper functions for encapsulating various extensions to read FB Buf
fer on openglES |
423 * | 394 * |
424 * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar
to this effect | 395 * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar
to this effect |
425 */ | 396 */ |
426 bool fbFetchSupport() const { return fFBFetchSupport; } | 397 bool fbFetchSupport() const { return fFBFetchSupport; } |
427 | 398 |
428 bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } | 399 bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } |
429 | 400 |
(...skipping 12 matching lines...) Expand all Loading... |
442 bool mustEnableSpecificAdvBlendEqs() const { | 413 bool mustEnableSpecificAdvBlendEqs() const { |
443 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; | 414 return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; |
444 } | 415 } |
445 | 416 |
446 /** | 417 /** |
447 * Returns a string containing the caps info. | 418 * Returns a string containing the caps info. |
448 */ | 419 */ |
449 SkString dump() const override; | 420 SkString dump() const override; |
450 | 421 |
451 private: | 422 private: |
| 423 void init(const GrGLContextInfo&, const GrGLInterface*, const GrGLCaps&); |
| 424 |
452 // Must be called after fGeometryShaderSupport is initialized. | 425 // Must be called after fGeometryShaderSupport is initialized. |
453 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); | 426 void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*); |
454 | 427 |
455 bool fDropsTileOnZeroDivide : 1; | 428 bool fDropsTileOnZeroDivide : 1; |
456 bool fFBFetchSupport : 1; | 429 bool fFBFetchSupport : 1; |
457 bool fFBFetchNeedsCustomOutput : 1; | 430 bool fFBFetchNeedsCustomOutput : 1; |
458 | 431 |
459 const char* fFBFetchColorName; | 432 const char* fFBFetchColorName; |
460 const char* fFBFetchExtensionString; | 433 const char* fFBFetchExtensionString; |
461 | 434 |
462 AdvBlendEqInteraction fAdvBlendEqInteraction; | 435 AdvBlendEqInteraction fAdvBlendEqInteraction; |
463 | 436 |
464 typedef GrShaderCaps INHERITED; | 437 typedef GrShaderCaps INHERITED; |
465 }; | 438 }; |
466 | 439 |
467 | 440 |
468 #endif | 441 #endif |
OLD | NEW |