| 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 #include "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
| 10 | 10 |
| 11 #include "GrContextOptions.h" | 11 #include "GrContextOptions.h" |
| 12 #include "GrGLContext.h" | 12 #include "GrGLContext.h" |
| 13 #include "glsl/GrGLSLCaps.h" | 13 #include "glsl/GrGLSLCaps.h" |
| 14 #include "SkTSearch.h" | 14 #include "SkTSearch.h" |
| 15 #include "SkTSort.h" | 15 #include "SkTSort.h" |
| 16 | 16 |
| 17 GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, | 17 GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, |
| 18 const GrGLContextInfo& ctxInfo, | 18 const GrGLContextInfo& ctxInfo, |
| 19 const GrGLInterface* glInterface) : INHERITED(contextOptions)
{ | 19 const GrGLInterface* glInterface) : INHERITED(contextOptions)
{ |
| 20 fVerifiedColorConfigs.reset(); | 20 fVerifiedColorConfigs.reset(); |
| 21 fStencilFormats.reset(); | 21 fStencilFormats.reset(); |
| 22 fMSFBOType = kNone_MSFBOType; | 22 fMSFBOType = kNone_MSFBOType; |
| 23 fInvalidateFBType = kNone_InvalidateFBType; | 23 fInvalidateFBType = kNone_InvalidateFBType; |
| 24 fLATCAlias = kLATC_LATCAlias; | 24 fLATCAlias = kLATC_LATCAlias; |
| 25 fMapBufferType = kNone_MapBufferType; | 25 fMapBufferType = kNone_MapBufferType; |
| 26 fTransferBufferType = kNone_TransferBufferType; |
| 26 fMaxFragmentUniformVectors = 0; | 27 fMaxFragmentUniformVectors = 0; |
| 27 fMaxVertexAttributes = 0; | 28 fMaxVertexAttributes = 0; |
| 28 fMaxFragmentTextureUnits = 0; | 29 fMaxFragmentTextureUnits = 0; |
| 29 fRGBA8RenderbufferSupport = false; | 30 fRGBA8RenderbufferSupport = false; |
| 30 fBGRAIsInternalFormat = false; | 31 fBGRAIsInternalFormat = false; |
| 31 fUnpackRowLengthSupport = false; | 32 fUnpackRowLengthSupport = false; |
| 32 fUnpackFlipYSupport = false; | 33 fUnpackFlipYSupport = false; |
| 33 fPackRowLengthSupport = false; | 34 fPackRowLengthSupport = false; |
| 34 fPackFlipYSupport = false; | 35 fPackFlipYSupport = false; |
| 35 fTextureUsageSupport = false; | 36 fTextureUsageSupport = false; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 fMapBufferType = kChromium_MapBufferType; | 364 fMapBufferType = kChromium_MapBufferType; |
| 364 } else if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_ma
p_buffer_range")) { | 365 } else if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_ma
p_buffer_range")) { |
| 365 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; | 366 fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 366 fMapBufferType = kMapBufferRange_MapBufferType; | 367 fMapBufferType = kMapBufferRange_MapBufferType; |
| 367 } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { | 368 } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { |
| 368 fMapBufferFlags = kCanMap_MapFlag; | 369 fMapBufferFlags = kCanMap_MapFlag; |
| 369 fMapBufferType = kMapBuffer_MapBufferType; | 370 fMapBufferType = kMapBuffer_MapBufferType; |
| 370 } | 371 } |
| 371 } | 372 } |
| 372 | 373 |
| 374 if (kGL_GrGLStandard == standard) { |
| 375 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf
fer_object")) { |
| 376 fTransferBufferType = kPBO_TransferBufferType; |
| 377 } |
| 378 } else { |
| 379 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_NV_pixel_buff
er_object")) { |
| 380 fTransferBufferType = kPBO_TransferBufferType; |
| 381 } else if (ctxInfo.hasExtension("GL_CHROMIUM_pixel_transfer_buffer_objec
t")) { |
| 382 fTransferBufferType = kChromium_TransferBufferType; |
| 383 } |
| 384 } |
| 385 |
| 373 // On many GPUs, map memory is very expensive, so we effectively disable it
here by setting the | 386 // On many GPUs, map memory is very expensive, so we effectively disable it
here by setting the |
| 374 // threshold to the maximum unless the client gives us a hint that map memor
y is cheap. | 387 // threshold to the maximum unless the client gives us a hint that map memor
y is cheap. |
| 375 if (fGeometryBufferMapThreshold < 0) { | 388 if (fGeometryBufferMapThreshold < 0) { |
| 376 // We think mapping on Chromium will be cheaper once we know ahead of ti
me how much space | 389 // We think mapping on Chromium will be cheaper once we know ahead of ti
me how much space |
| 377 // we will use for all GrBatchs. Right now we might wind up mapping a la
rge buffer and using | 390 // we will use for all GrBatchs. Right now we might wind up mapping a la
rge buffer and using |
| 378 // a small subset. | 391 // a small subset. |
| 379 #if 0 | 392 #if 0 |
| 380 fGeometryBufferMapThreshold = kChromium_GrGLDriver == ctxInfo.driver() ?
0 : SK_MaxS32; | 393 fGeometryBufferMapThreshold = kChromium_GrGLDriver == ctxInfo.driver() ?
0 : SK_MaxS32; |
| 381 #else | 394 #else |
| 382 fGeometryBufferMapThreshold = SK_MaxS32; | 395 fGeometryBufferMapThreshold = SK_MaxS32; |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr"; | 1347 glslCaps->fConfigSwizzle[kR11_EAC_GrPixelConfig] = "rrrr"; |
| 1335 glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba"; | 1348 glslCaps->fConfigSwizzle[kASTC_12x12_GrPixelConfig] = "rgba"; |
| 1336 glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba"; | 1349 glslCaps->fConfigSwizzle[kRGBA_float_GrPixelConfig] = "rgba"; |
| 1337 glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba"; | 1350 glslCaps->fConfigSwizzle[kRGBA_half_GrPixelConfig] = "rgba"; |
| 1338 | 1351 |
| 1339 } | 1352 } |
| 1340 | 1353 |
| 1341 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} | 1354 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} |
| 1342 | 1355 |
| 1343 | 1356 |
| OLD | NEW |