Add transfer buffer to GLCaps
Adds a check for PBO/transfer buffer support to GrGLCaps,
and uses that to pick the correct buffer type.
BUG=skia:4604
Review URL: https://codereview.chromium.org/1503593002
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index a768b37..6c0ee19 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -23,6 +23,7 @@
fInvalidateFBType = kNone_InvalidateFBType;
fLATCAlias = kLATC_LATCAlias;
fMapBufferType = kNone_MapBufferType;
+ fTransferBufferType = kNone_TransferBufferType;
fMaxFragmentUniformVectors = 0;
fMaxVertexAttributes = 0;
fMaxFragmentTextureUnits = 0;
@@ -370,6 +371,18 @@
}
}
+ if (kGL_GrGLStandard == standard) {
+ if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_pixel_buffer_object")) {
+ fTransferBufferType = kPBO_TransferBufferType;
+ }
+ } else {
+ if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_NV_pixel_buffer_object")) {
+ fTransferBufferType = kPBO_TransferBufferType;
+ } else if (ctxInfo.hasExtension("GL_CHROMIUM_pixel_transfer_buffer_object")) {
+ fTransferBufferType = kChromium_TransferBufferType;
+ }
+ }
+
// On many GPUs, map memory is very expensive, so we effectively disable it here by setting the
// threshold to the maximum unless the client gives us a hint that map memory is cheap.
if (fGeometryBufferMapThreshold < 0) {