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 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 if (kGL_GrGLStandard == standard) { | 386 if (kGL_GrGLStandard == standard) { |
387 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf
fer_object")) { | 387 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buf
fer_object")) { |
388 fTransferBufferType = kPBO_TransferBufferType; | 388 fTransferBufferType = kPBO_TransferBufferType; |
389 } | 389 } |
390 } else { | 390 } else { |
391 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_NV_pixel_buff
er_object")) { | 391 if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_NV_pixel_buff
er_object")) { |
392 fTransferBufferType = kPBO_TransferBufferType; | 392 fTransferBufferType = kPBO_TransferBufferType; |
393 } else if (ctxInfo.hasExtension("GL_CHROMIUM_pixel_transfer_buffer_objec
t")) { | 393 // TODO: get transfer buffers working in Chrome |
394 fTransferBufferType = kChromium_TransferBufferType; | 394 // } else if (ctxInfo.hasExtension("GL_CHROMIUM_pixel_transfer_buffer_obj
ect")) { |
| 395 // fTransferBufferType = kChromium_TransferBufferType; |
395 } | 396 } |
396 } | 397 } |
397 | 398 |
398 // On many GPUs, map memory is very expensive, so we effectively disable it
here by setting the | 399 // On many GPUs, map memory is very expensive, so we effectively disable it
here by setting the |
399 // threshold to the maximum unless the client gives us a hint that map memor
y is cheap. | 400 // threshold to the maximum unless the client gives us a hint that map memor
y is cheap. |
400 if (fBufferMapThreshold < 0) { | 401 if (fBufferMapThreshold < 0) { |
401 // We think mapping on Chromium will be cheaper once we know ahead of ti
me how much space | 402 // We think mapping on Chromium will be cheaper once we know ahead of ti
me how much space |
402 // we will use for all GrBatchs. Right now we might wind up mapping a la
rge buffer and using | 403 // we will use for all GrBatchs. Right now we might wind up mapping a la
rge buffer and using |
403 // a small subset. | 404 // a small subset. |
404 #if 0 | 405 #if 0 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 544 |
544 if (kGL_GrGLStandard == standard) { | 545 if (kGL_GrGLStandard == standard) { |
545 if ((version >= GR_GL_VER(4, 0) || ctxInfo.hasExtension("GL_ARB_sample_s
hading")) && | 546 if ((version >= GR_GL_VER(4, 0) || ctxInfo.hasExtension("GL_ARB_sample_s
hading")) && |
546 ctxInfo.vendor() != kIntel_GrGLVendor) { | 547 ctxInfo.vendor() != kIntel_GrGLVendor) { |
547 fSampleShadingSupport = true; | 548 fSampleShadingSupport = true; |
548 } | 549 } |
549 } else if (ctxInfo.hasExtension("GL_OES_sample_shading")) { | 550 } else if (ctxInfo.hasExtension("GL_OES_sample_shading")) { |
550 fSampleShadingSupport = true; | 551 fSampleShadingSupport = true; |
551 } | 552 } |
552 | 553 |
| 554 // TODO: support CHROMIUM_sync_point and maybe KHR_fence_sync |
| 555 if (kGL_GrGLStandard == standard) { |
| 556 if (version >= GR_GL_VER(3, 2) || ctxInfo.hasExtension("GL_ARB_sync")) { |
| 557 fFenceSyncSupport = true; |
| 558 } |
| 559 } else if (version >= GR_GL_VER(3, 0)) { |
| 560 fFenceSyncSupport = true; |
| 561 } |
| 562 |
553 // We support manual mip-map generation (via iterative downsampling draw cal
ls). This fixes | 563 // We support manual mip-map generation (via iterative downsampling draw cal
ls). This fixes |
554 // bugs on some cards/drivers that produce incorrect mip-maps for sRGB textu
res when using | 564 // bugs on some cards/drivers that produce incorrect mip-maps for sRGB textu
res when using |
555 // glGenerateMipmap. Our implementation requires mip-level sampling control.
Additionally, | 565 // glGenerateMipmap. Our implementation requires mip-level sampling control.
Additionally, |
556 // it can be much slower (especially on mobile GPUs), so we opt-in only when
necessary: | 566 // it can be much slower (especially on mobile GPUs), so we opt-in only when
necessary: |
557 if (fMipMapLevelAndLodControlSupport && | 567 if (fMipMapLevelAndLodControlSupport && |
558 (contextOptions.fDoManualMipmapping || | 568 (contextOptions.fDoManualMipmapping || |
559 (kIntel_GrGLVendor == ctxInfo.vendor()) || | 569 (kIntel_GrGLVendor == ctxInfo.vendor()) || |
560 (kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) || | 570 (kNVIDIA_GrGLDriver == ctxInfo.driver() && isMAC) || |
561 (kATI_GrGLVendor == ctxInfo.vendor()))) { | 571 (kATI_GrGLVendor == ctxInfo.vendor()))) { |
562 fDoManualMipmapping = true; | 572 fDoManualMipmapping = true; |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 1971 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
1962 if (options.fEnableInstancedRendering) { | 1972 if (options.fEnableInstancedRendering) { |
1963 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); | 1973 fInstancedSupport = gr_instanced::GLInstancedRendering::CheckSupport(*th
is); |
1964 #ifndef SK_BUILD_FOR_MAC | 1974 #ifndef SK_BUILD_FOR_MAC |
1965 // OS X doesn't seem to write correctly to floating point textures when
using | 1975 // OS X doesn't seem to write correctly to floating point textures when
using |
1966 // glDraw*Indirect, regardless of the underlying GPU. | 1976 // glDraw*Indirect, regardless of the underlying GPU. |
1967 fAvoidInstancedDrawsToFPTargets = true; | 1977 fAvoidInstancedDrawsToFPTargets = true; |
1968 #endif | 1978 #endif |
1969 } | 1979 } |
1970 } | 1980 } |
OLD | NEW |