summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorhendrikw <hendrikw@chromium.org>2015-08-07 15:19:52 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-07 22:20:25 +0000
commit4c34f74692858664ccec7078ab698da4c8b8d1d0 (patch)
tree44d34174279ba2efdb398b27815c70a214186615 /gpu
parent2249c80e8c4b50793a8261c4f9eb3f879ddf4aff (diff)
downloadchromium_src-4c34f74692858664ccec7078ab698da4c8b8d1d0.zip
chromium_src-4c34f74692858664ccec7078ab698da4c8b8d1d0.tar.gz
chromium_src-4c34f74692858664ccec7078ab698da4c8b8d1d0.tar.bz2
gpu: Implement a eglCreatePbufferSurface
We're making steps towards having a library to use the command buffer on skia's test framework, and we need a eglCreatePbufferSurface function. There was pre-exisiting code (create_offscreen_) to generate offscreen surfaces, and I'm reusing this here. Review URL: https://codereview.chromium.org/1282603003 Cr-Commit-Position: refs/heads/master@{#342459}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/gles2_conform_support/egl/egl.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/gpu/gles2_conform_support/egl/egl.cc b/gpu/gles2_conform_support/egl/egl.cc
index b777f23..343937f 100644
--- a/gpu/gles2_conform_support/egl/egl.cc
+++ b/gpu/gles2_conform_support/egl/egl.cc
@@ -218,7 +218,32 @@ EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
EGLSurface eglCreatePbufferSurface(EGLDisplay dpy,
EGLConfig config,
const EGLint* attrib_list) {
- return EGL_NO_SURFACE;
+ EGLint error_code = ValidateDisplayConfig(dpy, config);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_NO_SURFACE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ int width = 1;
+ int height = 1;
+ if (attrib_list) {
+ for (const int32_t* attr = attrib_list; attr[0] != EGL_NONE; attr += 2) {
+ switch (attr[0]) {
+ case EGL_WIDTH:
+ width = attr[1];
+ break;
+ case EGL_HEIGHT:
+ height = attr[1];
+ break;
+ }
+ }
+ }
+ display->SetCreateOffscreen(width, height);
+
+ EGLSurface surface = display->CreateWindowSurface(config, 0, attrib_list);
+ if (surface == EGL_NO_SURFACE)
+ return EglError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+
+ return EglSuccess(surface);
}
EGLSurface eglCreatePixmapSurface(EGLDisplay dpy,