diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 01:52:30 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 01:52:30 +0000 |
commit | af2f56c8ee88d09483ef83792f9b9a31f4f08f79 (patch) | |
tree | 1ba6730a3cf9101801d570bb9ea840ea4b100947 /gpu | |
parent | 14d8e6ad02c6268fcbcb2965a27196d32dd7921c (diff) | |
download | chromium_src-af2f56c8ee88d09483ef83792f9b9a31f4f08f79.zip chromium_src-af2f56c8ee88d09483ef83792f9b9a31f4f08f79.tar.gz chromium_src-af2f56c8ee88d09483ef83792f9b9a31f4f08f79.tar.bz2 |
Make windowless version of OpenGL ES 2.0 conformance tests
These can be used on mac and bots eventually
TEST=ran'em
BUG=none
Review URL: https://chromiumcodereview.appspot.com/10810029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/gles2_conform_support/egl/display.cc | 18 | ||||
-rw-r--r-- | gpu/gles2_conform_support/egl/display.h | 10 | ||||
-rw-r--r-- | gpu/gles2_conform_support/gles2_conform_support.gyp | 28 | ||||
-rw-r--r-- | gpu/gles2_conform_support/native/egl_native_windowless.cc | 45 | ||||
-rw-r--r-- | gpu/gles2_conform_support/native/main.cc | 21 |
5 files changed, 112 insertions, 10 deletions
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index 4c1c59d..0e92d09 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -23,7 +23,10 @@ namespace egl { Display::Display(EGLNativeDisplayType display_id) : display_id_(display_id), - is_initialized_(false) { + is_initialized_(false), + create_offscreen_(false), + create_offscreen_width_(0), + create_offscreen_height_(0) { } Display::~Display() { @@ -104,8 +107,15 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, NULL)); decoder_->set_engine(gpu_scheduler_.get()); - - gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, win); + gfx::Size size(create_offscreen_width_, create_offscreen_height_); + if (create_offscreen_) { + gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); + create_offscreen_ = false; + create_offscreen_width_ = 0; + create_offscreen_height_ = 0; + } else { + gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, win); + } if (!gl_surface_.get()) return EGL_NO_SURFACE; @@ -121,7 +131,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, if (!decoder_->Initialize(gl_surface_.get(), gl_context_.get(), gl_surface_->IsOffscreen(), - gfx::Size(), + size, gpu::gles2::DisallowedFeatures(), NULL, attribs)) { diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h index 1cec2f9..1c466d7 100644 --- a/gpu/gles2_conform_support/egl/display.h +++ b/gpu/gles2_conform_support/egl/display.h @@ -38,6 +38,12 @@ class Display { explicit Display(EGLNativeDisplayType display_id); virtual ~Display(); + void SetCreateOffscreen(int width, int height) { + create_offscreen_ = true; + create_offscreen_width_ = width; + create_offscreen_height_ = height; + } + bool is_initialized() const { return is_initialized_; } bool Initialize(); @@ -67,6 +73,10 @@ class Display { EGLNativeDisplayType display_id_; bool is_initialized_; + bool create_offscreen_; + int create_offscreen_width_; + int create_offscreen_height_; + scoped_ptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_; scoped_ptr<gpu::CommandBufferService> command_buffer_; scoped_ptr<gpu::GpuScheduler> gpu_scheduler_; diff --git a/gpu/gles2_conform_support/gles2_conform_support.gyp b/gpu/gles2_conform_support/gles2_conform_support.gyp index ee59476..54e5e58 100644 --- a/gpu/gles2_conform_support/gles2_conform_support.gyp +++ b/gpu/gles2_conform_support/gles2_conform_support.gyp @@ -81,6 +81,34 @@ ], }, { + 'target_name': 'egl_main_windowless', + 'type': 'static_library', + 'dependencies': [ + 'egl_native', + ], + 'conditions': [ + ['toolkit_uses_gtk == 1', { + 'dependencies': ['../../build/linux/system.gyp:gtk'], + }], + ], + 'include_dirs': ['<(DEPTH)/third_party/khronos'], + 'sources': [ + 'native/main.cc', + 'native/egl_native.cc', + 'native/egl_native_windowless.cc', + '<@(bootstrap_sources_native)', + ], + 'direct_dependent_settings': { + 'include_dirs': ['<(DEPTH)/third_party/khronos'], + }, + 'defines': [ + 'GLES2_CONFORM_SUPPORT_ONLY', + 'GTF_GLES20', + 'EGLAPI=', + 'EGLAPIENTRY=', + ], + }, + { 'target_name': 'gles2_conform_support', 'type': 'executable', 'dependencies': [ diff --git a/gpu/gles2_conform_support/native/egl_native_windowless.cc b/gpu/gles2_conform_support/native/egl_native_windowless.cc new file mode 100644 index 0000000..14172cfe --- /dev/null +++ b/gpu/gles2_conform_support/native/egl_native_windowless.cc @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/gles2_conform_support/egl/display.h" + +extern "C" { +#if defined(GLES2_CONFORM_SUPPORT_ONLY) +#include "gpu/gles2_conform_support/gtf/gtf_stubs.h" +#else +#include "third_party/gles2_conform/GTF_ES/glsl/GTF/Source/eglNative.h" +#endif + +GTFbool GTFNativeCreateDisplay(EGLNativeDisplayType *pNativeDisplay) { + *pNativeDisplay = EGL_DEFAULT_DISPLAY; + return GTFtrue; +} + +void GTFNativeDestroyDisplay(EGLNativeDisplayType nativeDisplay) { + // Nothing to destroy since we are using EGL_DEFAULT_DISPLAY +} + +GTFbool GTFNativeCreateWindow(EGLNativeDisplayType nativeDisplay, + EGLDisplay eglDisplay, EGLConfig eglConfig, + const char* title, int width, int height, + EGLNativeWindowType *pNativeWindow) { + egl::Display* display = static_cast<egl::Display*>(eglDisplay); + display->SetCreateOffscreen(width, height); + return GTFtrue; +} + +void GTFNativeDestroyWindow(EGLNativeDisplayType nativeDisplay, + EGLNativeWindowType nativeWindow) { +} + +EGLImageKHR GTFCreateEGLImage(int width, int height, + GLenum format, GLenum type) { + return (EGLImageKHR)NULL; +} + +void GTFDestroyEGLImage(EGLImageKHR image) { +} + +} // extern "C" + diff --git a/gpu/gles2_conform_support/native/main.cc b/gpu/gles2_conform_support/native/main.cc index 99d9858..69c0f91 100644 --- a/gpu/gles2_conform_support/native/main.cc +++ b/gpu/gles2_conform_support/native/main.cc @@ -1,12 +1,17 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/at_exit.h" #include "base/message_loop.h" +#include "base/command_line.h" +#if defined(OS_MACOSX) +#include "base/mac/scoped_nsautorelease_pool.h" +#endif +#include "ui/gl/gl_surface.h" #if defined(TOOLKIT_GTK) -#include <gtk/gtk.h> +#include "ui/gfx/gtk_util.h" #endif extern "C" { @@ -18,13 +23,17 @@ extern "C" { } int main(int argc, char *argv[]) { -#if defined(TOOLKIT_GTK) - gtk_init(&argc, &argv); -#endif - base::AtExitManager at_exit; + CommandLine::Init(argc, argv); MessageLoopForUI message_loop; +#if defined(OS_MACOSX) + base::mac::ScopedNSAutoreleasePool pool; +#endif +#if defined(TOOLKIT_GTK) + gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); +#endif + GTFMain(argc, argv); return 0; |