diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-06 00:10:47 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-06 00:10:47 +0000 |
commit | 1d796c8dde526364ba087a6f16b2bfdf1483e9b8 (patch) | |
tree | 553821a90fc04c02acefd6bf442bb38a73790b80 | |
parent | 274d4f290792337125c0eca249b7af09dfb1b9b8 (diff) | |
download | chromium_src-1d796c8dde526364ba087a6f16b2bfdf1483e9b8.zip chromium_src-1d796c8dde526364ba087a6f16b2bfdf1483e9b8.tar.gz chromium_src-1d796c8dde526364ba087a6f16b2bfdf1483e9b8.tar.bz2 |
Add support to test harness EGL for OpenGL ES 1.1 tests on Regal
BUG=none
Review URL: https://chromiumcodereview.appspot.com/10911086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155064 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | gpu/gles2_conform_support/egl/display.cc | 30 | ||||
-rw-r--r-- | gpu/gles2_conform_support/egl/display.h | 2 | ||||
-rw-r--r-- | gpu/gles2_conform_support/egl/egl.cc | 42 |
3 files changed, 66 insertions, 8 deletions
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index b00770e..34e48639 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -43,6 +43,21 @@ bool Display::IsValidConfig(EGLConfig config) { return (config != NULL) && (config == config_.get()); } +bool Display::ChooseConfigs(EGLConfig* configs, + EGLint config_size, + EGLint* num_config) { + // TODO(alokp): Find out a way to find all configs. CommandBuffer currently + // does not support finding or choosing configs. + *num_config = 1; + if (configs != NULL) { + if (config_ == NULL) { + config_.reset(new Config); + } + configs[0] = config_.get(); + } + return true; +} + bool Display::GetConfigs(EGLConfig* configs, EGLint config_size, EGLint* num_config) { @@ -129,7 +144,22 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, gl_context_->MakeCurrent(gl_surface_); + EGLint depth_size = 0; + EGLint alpha_size = 0; + EGLint stencil_size = 0; + GetConfigAttrib(config, EGL_DEPTH_SIZE, &depth_size); + GetConfigAttrib(config, EGL_ALPHA_SIZE, &alpha_size); + GetConfigAttrib(config, EGL_STENCIL_SIZE, &stencil_size); std::vector<int32> attribs; + attribs.push_back(EGL_DEPTH_SIZE); + attribs.push_back(depth_size); + attribs.push_back(EGL_ALPHA_SIZE); + attribs.push_back(alpha_size); + attribs.push_back(EGL_STENCIL_SIZE); + attribs.push_back(stencil_size); + // TODO(gman): Insert attrib_list. Although ES 1.1 says it must be null + attribs.push_back(EGL_NONE); + if (!decoder_->Initialize(gl_surface_.get(), gl_context_.get(), gl_surface_->IsOffscreen(), diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h index 1c466d7..251904c 100644 --- a/gpu/gles2_conform_support/egl/display.h +++ b/gpu/gles2_conform_support/egl/display.h @@ -49,6 +49,8 @@ class Display { // Config routines. bool IsValidConfig(EGLConfig config); + bool ChooseConfigs( + EGLConfig* configs, EGLint config_size, EGLint* num_config); bool GetConfigs(EGLConfig* configs, EGLint config_size, EGLint* num_config); bool GetConfigAttrib(EGLConfig config, EGLint attribute, EGLint* value); diff --git a/gpu/gles2_conform_support/egl/egl.cc b/gpu/gles2_conform_support/egl/egl.cc index b342b9d..443aeaf 100644 --- a/gpu/gles2_conform_support/egl/egl.cc +++ b/gpu/gles2_conform_support/egl/egl.cc @@ -9,6 +9,16 @@ #include "ui/gl/gl_context.h" #include "ui/gl/gl_surface.h" +#if REGAL_STATIC_EGL +extern "C" { + +typedef EGLContext RegalSystemContext; +#define REGAL_DECL +REGAL_DECL void RegalMakeCurrent( RegalSystemContext ctx ); + +} // extern "C" +#endif + namespace { void SetCurrentError(EGLint error_code) { } @@ -133,6 +143,25 @@ const char* eglQueryString(EGLDisplay dpy, EGLint name) { } } +EGLBoolean eglChooseConfig(EGLDisplay dpy, + const EGLint* attrib_list, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config) { + EGLint error_code = ValidateDisplay(dpy); + if (error_code != EGL_SUCCESS) + return EglError(error_code, EGL_FALSE); + + if (num_config == NULL) + return EglError(EGL_BAD_PARAMETER, EGL_FALSE); + + egl::Display* display = static_cast<egl::Display*>(dpy); + if (!display->ChooseConfigs(configs, config_size, num_config)) + return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); + + return EglSuccess(EGL_TRUE); +} + EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, @@ -151,14 +180,6 @@ EGLBoolean eglGetConfigs(EGLDisplay dpy, return EglSuccess(EGL_TRUE); } -EGLBoolean eglChooseConfig(EGLDisplay dpy, - const EGLint* attrib_list, - EGLConfig* configs, - EGLint config_size, - EGLint* num_config) { - return EGL_FALSE; -} - EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, @@ -323,6 +344,11 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, egl::Display* display = static_cast<egl::Display*>(dpy); if (!display->MakeCurrent(draw, read, ctx)) return EglError(EGL_CONTEXT_LOST, EGL_FALSE); + +#if REGAL_STATIC_EGL + RegalMakeCurrent(ctx); +#endif + return EGL_TRUE; } |