aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-09-20 15:53:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-20 20:16:29 +0000
commit8d4a5c75f07a70f71320a426f392783dbcf180ba (patch)
tree0695f809268512bbd5c57429d1ac91fe332e794d
parent083870a3defded7f81dab5f53252adfdc8b1116e (diff)
Avoid using glUnmapBufferOES with ES3
As reported in https://github.com/flutter/flutter/issues/10617#issuecomment-330935921, we were mixing ES2 and ES3 API. This makes our interface assembly code directly parallel our caps code. Bug: skia: Change-Id: I91c0696a223f7eaf27641dbe16ab451b0bdc362c Reviewed-on: https://skia-review.googlesource.com/49440 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
-rw-r--r--src/gpu/gl/GrGLAssembleInterface.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index 6b0234abb7..d33a8b6cb1 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -801,8 +801,22 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC(GetRenderbufferParameteriv);
GET_PROC(RenderbufferStorage);
+ // There are several APIs for buffer mapping:
+ // ES2 + GL_OES_mapbuffer: MapBufferOES and UnmapBufferOES
+ // ES2 + GL_EXT_map_buffer_range: Adds MapBufferRangeEXT and FlushMappedBufferRangeEXT
+ // ES3: MapBufferRange, FlushMappedBufferRange, and UnmapBuffer are core (so no suffix).
+ //
+ // MapBuffer is not part of ES3, but implementations may still report the OES versions of
+ // MapBuffer and UnmapBuffer, per the older GL_OES_mapbuffer extension. Some implementations
+ // let us mix the newer MapBufferRange with the older UnmapBufferOES, but we've hit others that
+ // don't permit it. Note that in GrGLBuffer, we choose which API to use based on version and
+ // extensions. This code is written so that we never mix OES and non-OES functions.
GET_PROC_SUFFIX(MapBuffer, OES);
- GET_PROC_SUFFIX(UnmapBuffer, OES);
+ if (version >= GR_GL_VER(3, 0)) {
+ GET_PROC(UnmapBuffer);
+ } else {
+ GET_PROC_SUFFIX(UnmapBuffer, OES);
+ }
if (version >= GR_GL_VER(3,0)) {
GET_PROC(MapBufferRange);