summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 19:37:35 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 19:37:35 +0000
commit7d36dcaef8f2a5c030ec5402e3fbe1f515a6d737 (patch)
tree3d6708b1b44ea3049aae78202bfc50b10d1f283a /gpu
parentd10740b13a3c2481b06539206bcb903bcf307fd4 (diff)
downloadchromium_src-7d36dcaef8f2a5c030ec5402e3fbe1f515a6d737.zip
chromium_src-7d36dcaef8f2a5c030ec5402e3fbe1f515a6d737.tar.gz
chromium_src-7d36dcaef8f2a5c030ec5402e3fbe1f515a6d737.tar.bz2
Resubmit CL 86306
TEST=ran locally BUG=83382 Review URL: http://codereview.chromium.org/7066028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/gles2_conform_support/DEPS3
-rw-r--r--gpu/gles2_conform_support/egl/config.cc152
-rw-r--r--gpu/gles2_conform_support/egl/config.h92
-rw-r--r--gpu/gles2_conform_support/egl/display.cc187
-rw-r--r--gpu/gles2_conform_support/egl/display.h77
-rw-r--r--gpu/gles2_conform_support/egl/egl.cc377
-rw-r--r--gpu/gles2_conform_support/egl/native/EGL/egl.h329
-rw-r--r--gpu/gles2_conform_support/egl/native/EGL/eglext.h222
-rw-r--r--gpu/gles2_conform_support/egl/native/EGL/eglplatform.h117
-rw-r--r--gpu/gles2_conform_support/egl/surface.cc15
-rw-r--r--gpu/gles2_conform_support/egl/surface.h29
-rw-r--r--gpu/gles2_conform_support/gles2_conform_support.c23
-rw-r--r--gpu/gles2_conform_support/gles2_conform_support.gyp100
-rw-r--r--gpu/gles2_conform_support/gtf/gtf_stubs.h23
-rw-r--r--gpu/gles2_conform_support/native/egl_native.cc22
-rw-r--r--gpu/gles2_conform_support/native/egl_native_linux.cc121
-rw-r--r--gpu/gles2_conform_support/native/egl_native_win.cc113
-rw-r--r--gpu/gles2_conform_support/native/main.cc32
18 files changed, 2034 insertions, 0 deletions
diff --git a/gpu/gles2_conform_support/DEPS b/gpu/gles2_conform_support/DEPS
new file mode 100644
index 0000000..45eed75
--- /dev/null
+++ b/gpu/gles2_conform_support/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+third_party/gles2_conform",
+]
diff --git a/gpu/gles2_conform_support/egl/config.cc b/gpu/gles2_conform_support/egl/config.cc
new file mode 100644
index 0000000..6c914be9
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/config.cc
@@ -0,0 +1,152 @@
+// Copyright (c) 2011 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/config.h"
+
+namespace egl {
+
+Config::Config()
+ : buffer_size_(0),
+ red_size_(0),
+ green_size_(0),
+ blue_size_(0),
+ luminance_size_(0),
+ alpha_size_(0),
+ alpha_mask_size_(0),
+ bind_to_texture_rgb_(EGL_DONT_CARE),
+ bind_to_texture_rgba_(EGL_DONT_CARE),
+ color_buffer_type_(EGL_RGB_BUFFER),
+ config_caveat_(EGL_DONT_CARE),
+ config_id_(EGL_DONT_CARE),
+ conformant_(EGL_OPENGL_ES2_BIT),
+ depth_size_(0),
+ level_(0),
+ max_pbuffer_width_(0),
+ max_pbuffer_height_(0),
+ max_pbuffer_pixels_(0),
+ min_swap_interval_(EGL_DONT_CARE),
+ max_swap_interval_(EGL_DONT_CARE),
+ native_renderable_(EGL_DONT_CARE),
+ native_visual_id_(0),
+ native_visual_type_(EGL_DONT_CARE),
+ renderable_type_(EGL_OPENGL_ES2_BIT),
+ sample_buffers_(0),
+ samples_(0),
+ stencil_size_(0),
+ surface_type_(EGL_WINDOW_BIT),
+ transparent_type_(EGL_NONE),
+ transparent_red_value_(EGL_DONT_CARE),
+ transparent_green_value_(EGL_DONT_CARE),
+ transparent_blue_value_(EGL_DONT_CARE) {
+}
+
+Config::~Config() {
+}
+
+bool Config::GetAttrib(EGLint attribute, EGLint* value) const {
+ // TODO(alokp): Find out how to get correct values.
+ switch (attribute) {
+ case EGL_BUFFER_SIZE:
+ *value = buffer_size_;
+ break;
+ case EGL_RED_SIZE:
+ *value = red_size_;
+ break;
+ case EGL_GREEN_SIZE:
+ *value = green_size_;
+ break;
+ case EGL_BLUE_SIZE:
+ *value = blue_size_;
+ break;
+ case EGL_LUMINANCE_SIZE:
+ *value = luminance_size_;
+ break;
+ case EGL_ALPHA_SIZE:
+ *value = alpha_size_;
+ break;
+ case EGL_ALPHA_MASK_SIZE:
+ *value = alpha_mask_size_;
+ break;
+ case EGL_BIND_TO_TEXTURE_RGB:
+ *value = bind_to_texture_rgb_;
+ break;
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ *value = bind_to_texture_rgba_;
+ break;
+ case EGL_COLOR_BUFFER_TYPE:
+ *value = color_buffer_type_;
+ break;
+ case EGL_CONFIG_CAVEAT:
+ *value = config_caveat_;
+ break;
+ case EGL_CONFIG_ID:
+ *value = config_id_;
+ break;
+ case EGL_CONFORMANT:
+ *value = conformant_;
+ break;
+ case EGL_DEPTH_SIZE:
+ *value = depth_size_;
+ break;
+ case EGL_LEVEL:
+ *value = level_;
+ break;
+ case EGL_MAX_PBUFFER_WIDTH:
+ *value = max_pbuffer_width_;
+ break;
+ case EGL_MAX_PBUFFER_HEIGHT:
+ *value = max_pbuffer_height_;
+ break;
+ case EGL_MAX_PBUFFER_PIXELS:
+ *value = max_pbuffer_pixels_;
+ break;
+ case EGL_MIN_SWAP_INTERVAL:
+ *value = min_swap_interval_;
+ break;
+ case EGL_MAX_SWAP_INTERVAL:
+ *value = max_swap_interval_;
+ break;
+ case EGL_NATIVE_RENDERABLE:
+ *value = native_renderable_;
+ break;
+ case EGL_NATIVE_VISUAL_ID:
+ *value = native_visual_id_;
+ break;
+ case EGL_NATIVE_VISUAL_TYPE:
+ *value = native_visual_type_;
+ break;
+ case EGL_RENDERABLE_TYPE:
+ *value = renderable_type_;
+ break;
+ case EGL_SAMPLE_BUFFERS:
+ *value = sample_buffers_;
+ break;
+ case EGL_SAMPLES:
+ *value = samples_;
+ break;
+ case EGL_STENCIL_SIZE:
+ *value = stencil_size_;
+ break;
+ case EGL_SURFACE_TYPE:
+ *value = surface_type_;
+ break;
+ case EGL_TRANSPARENT_TYPE:
+ *value = transparent_type_;
+ break;
+ case EGL_TRANSPARENT_RED_VALUE:
+ *value = transparent_red_value_;
+ break;
+ case EGL_TRANSPARENT_GREEN_VALUE:
+ *value = transparent_green_value_;
+ break;
+ case EGL_TRANSPARENT_BLUE_VALUE:
+ *value = transparent_blue_value_;
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+} // namespace egl
diff --git a/gpu/gles2_conform_support/egl/config.h b/gpu/gles2_conform_support/egl/config.h
new file mode 100644
index 0000000..ef2ae1d
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/config.h
@@ -0,0 +1,92 @@
+// Copyright (c) 2011 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.
+
+#ifndef GPU_GLES2_CONFORM_TEST_CONFIG_H_
+#define GPU_GLES2_CONFORM_TEST_CONFIG_H_
+
+#include <EGL/egl.h>
+
+#include "base/basictypes.h"
+
+namespace egl {
+
+class Config {
+ public:
+ Config();
+ ~Config();
+
+ bool GetAttrib(EGLint attribute, EGLint* value) const;
+
+ private:
+ // Total color component bits in the color buffer.
+ EGLint buffer_size_;
+ // Bits of Red in the color buffer.
+ EGLint red_size_;
+ // Bits of Green in the color buffer.
+ EGLint green_size_;
+ // Bits of Blue in the color buffer.
+ EGLint blue_size_;
+ // Bits of Luminance in the color buffer.
+ EGLint luminance_size_;
+ // Bits of Alpha in the color buffer.
+ EGLint alpha_size_;
+ // Bits of Alpha Mask in the mask buffer.
+ EGLint alpha_mask_size_;
+ // True if bindable to RGB textures.
+ EGLBoolean bind_to_texture_rgb_;
+ // True if bindable to RGBA textures.
+ EGLBoolean bind_to_texture_rgba_;
+ // Color buffer type.
+ EGLenum color_buffer_type_;
+ // Any caveats for the configuration.
+ EGLenum config_caveat_;
+ // Unique EGLConfig identifier.
+ EGLint config_id_;
+ // Whether contexts created with this config are conformant.
+ EGLint conformant_;
+ // Bits of Z in the depth buffer.
+ EGLint depth_size_;
+ // Frame buffer level.
+ EGLint level_;
+ // Maximum width of pbuffer.
+ EGLint max_pbuffer_width_;
+ // Maximum height of pbuffer.
+ EGLint max_pbuffer_height_;
+ // Maximum size of pbuffer.
+ EGLint max_pbuffer_pixels_;
+ // Minimum swap interval.
+ EGLint min_swap_interval_;
+ // Maximum swap interval.
+ EGLint max_swap_interval_;
+ // True if native rendering APIs can render to surface.
+ EGLBoolean native_renderable_;
+ // Handle of corresponding native visual.
+ EGLint native_visual_id_;
+ // Native visual type of the associated visual.
+ EGLint native_visual_type_;
+ // Which client rendering APIs are supported.
+ EGLint renderable_type_;
+ // Number of multisample buffers.
+ EGLint sample_buffers_;
+ // Number of samples per pixel.
+ EGLint samples_;
+ // Bits of Stencil in the stencil buffer.
+ EGLint stencil_size_;
+ // Which types of EGL surfaces are supported.
+ EGLint surface_type_;
+ // Type of transparency supported
+ EGLenum transparent_type_;
+ // Transparent red value
+ EGLint transparent_red_value_;
+ // Transparent green value
+ EGLint transparent_green_value_;
+ // Transparent blue value
+ EGLint transparent_blue_value_;
+
+ DISALLOW_COPY_AND_ASSIGN(Config);
+};
+
+} // namespace egl
+
+#endif // GPU_GLES2_CONFORM_TEST_CONFIG_H_
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
new file mode 100644
index 0000000..7bfded1
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -0,0 +1,187 @@
+// Copyright (c) 2011 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"
+
+#include <vector>
+#include "gpu/command_buffer/client/gles2_lib.h"
+#include "gpu/command_buffer/service/command_buffer_service.h"
+#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
+#include "gpu/command_buffer/service/gpu_scheduler.h"
+#include "gpu/GLES2/gles2_command_buffer.h"
+#include "gpu/gles2_conform_support/egl/config.h"
+#include "gpu/gles2_conform_support/egl/surface.h"
+
+namespace {
+const int32 kCommandBufferSize = 1024 * 1024;
+const int32 kTransferBufferSize = 512 * 1024;
+}
+
+namespace egl {
+
+Display::Display(EGLNativeDisplayType display_id)
+ : display_id_(display_id),
+ is_initialized_(false),
+ transfer_buffer_id_(-1) {
+}
+
+Display::~Display() {
+ gles2::Terminate();
+}
+
+bool Display::Initialize() {
+ using gpu::CommandBufferService;
+ scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService);
+ if (!command_buffer->Initialize(kCommandBufferSize))
+ return false;
+
+ using gpu::Buffer;
+ int32 transfer_buffer_id =
+ command_buffer->CreateTransferBuffer(kTransferBufferSize, -1);
+ Buffer transfer_buffer =
+ command_buffer->GetTransferBuffer(transfer_buffer_id);
+ if (transfer_buffer.ptr == NULL)
+ return false;
+
+ using gpu::gles2::GLES2CmdHelper;
+ scoped_ptr<GLES2CmdHelper> cmd_helper(
+ new GLES2CmdHelper(command_buffer.get()));
+ if (!cmd_helper->Initialize(kCommandBufferSize))
+ return false;
+
+ gles2::Initialize();
+
+ is_initialized_ = true;
+ command_buffer_.reset(command_buffer.release());
+ transfer_buffer_id_ = transfer_buffer_id;
+ gles2_cmd_helper_.reset(cmd_helper.release());
+ return true;
+}
+
+bool Display::IsValidConfig(EGLConfig config) {
+ return (config != NULL) && (config == config_.get());
+}
+
+bool Display::GetConfigs(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::GetConfigAttrib(EGLConfig config,
+ EGLint attribute,
+ EGLint* value) {
+ const egl::Config* cfg = static_cast<egl::Config*>(config);
+ return cfg->GetAttrib(attribute, value);
+}
+
+bool Display::IsValidNativeWindow(EGLNativeWindowType win) {
+#if defined OS_WIN
+ return ::IsWindow(win) != FALSE;
+#else
+ // TODO(alokp): Validate window handle.
+ return true;
+#endif // OS_WIN
+}
+
+bool Display::IsValidSurface(EGLSurface surface) {
+ return (surface != NULL) && (surface == surface_.get());
+}
+
+EGLSurface Display::CreateWindowSurface(EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint* attrib_list) {
+ if (surface_ != NULL) {
+ // We do not support more than one window surface.
+ return EGL_NO_SURFACE;
+ }
+
+ using gpu::GpuScheduler;
+ std::vector<int32> attribs;
+ scoped_ptr<GpuScheduler> gpu_scheduler(
+ new GpuScheduler(command_buffer_.get(), NULL));
+ if (!gpu_scheduler->Initialize(
+ win, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL,
+ attribs, NULL, 0))
+ return EGL_NO_SURFACE;
+
+ command_buffer_->SetPutOffsetChangeCallback(
+ NewCallback(gpu_scheduler.get(), &GpuScheduler::PutChanged));
+ gpu_scheduler_.reset(gpu_scheduler.release());
+ surface_.reset(new Surface(win));
+
+ return surface_.get();
+}
+
+void Display::DestroySurface(EGLSurface surface) {
+ DCHECK(IsValidSurface(surface));
+ gpu_scheduler_.reset();
+ surface_.reset();
+}
+
+void Display::SwapBuffers(EGLSurface surface) {
+ DCHECK(IsValidSurface(surface));
+ context_->SwapBuffers();
+}
+
+bool Display::IsValidContext(EGLContext ctx) {
+ return (ctx != NULL) && (ctx == context_.get());
+}
+
+EGLContext Display::CreateContext(EGLConfig config,
+ EGLContext share_ctx,
+ const EGLint* attrib_list) {
+ DCHECK(IsValidConfig(config));
+ // TODO(alokp): Command buffer does not support shared contexts.
+ if (share_ctx != NULL)
+ return EGL_NO_CONTEXT;
+
+ DCHECK(command_buffer_ != NULL);
+ DCHECK(transfer_buffer_id_ != -1);
+ gpu::Buffer buffer = command_buffer_->GetTransferBuffer(transfer_buffer_id_);
+ DCHECK(buffer.ptr != NULL);
+ bool share_resources = share_ctx != NULL;
+ using gpu::gles2::GLES2Implementation;
+ context_.reset(new GLES2Implementation(
+ gles2_cmd_helper_.get(),
+ buffer.size,
+ buffer.ptr,
+ transfer_buffer_id_,
+ share_resources));
+
+ context_->CommandBufferEnableCHROMIUM(
+ PEPPER3D_ALLOW_BUFFERS_ON_MULTIPLE_TARGETS);
+ context_->CommandBufferEnableCHROMIUM(
+ PEPPER3D_SUPPORT_FIXED_ATTRIBS);
+
+ return context_.get();
+}
+
+void Display::DestroyContext(EGLContext ctx) {
+ DCHECK(IsValidContext(ctx));
+ context_.reset();
+}
+
+bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) {
+ if (ctx == EGL_NO_CONTEXT) {
+ gles2::SetGLContext(NULL);
+ } else {
+ DCHECK(IsValidSurface(draw));
+ DCHECK(IsValidSurface(read));
+ DCHECK(IsValidContext(ctx));
+ gles2::SetGLContext(context_.get());
+ }
+ return true;
+}
+
+} // namespace egl
diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h
new file mode 100644
index 0000000..eb438fa
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/display.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2011 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.
+
+#ifndef GPU_GLES2_CONFORM_TEST_DISPLAY_H_
+#define GPU_GLES2_CONFORM_TEST_DISPLAY_H_
+
+#include <EGL/egl.h>
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+
+namespace gpu {
+class CommandBufferService;
+class GpuScheduler;
+
+namespace gles2 {
+class GLES2CmdHelper;
+class GLES2Implementation;
+} // namespace gles2
+} // namespace gpu
+
+namespace egl {
+
+class Config;
+class Surface;
+
+class Display {
+ public:
+ explicit Display(EGLNativeDisplayType display_id);
+ virtual ~Display();
+
+ bool is_initialized() const { return is_initialized_; }
+ bool Initialize();
+
+ // Config routines.
+ bool IsValidConfig(EGLConfig config);
+ bool GetConfigs(EGLConfig* configs, EGLint config_size, EGLint* num_config);
+ bool GetConfigAttrib(EGLConfig config, EGLint attribute, EGLint* value);
+
+ // Surface routines.
+ bool IsValidNativeWindow(EGLNativeWindowType win);
+ bool IsValidSurface(EGLSurface surface);
+ EGLSurface CreateWindowSurface(EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint* attrib_list);
+ void DestroySurface(EGLSurface surface);
+ void SwapBuffers(EGLSurface surface);
+
+ // Context routines.
+ bool IsValidContext(EGLContext ctx);
+ EGLContext CreateContext(EGLConfig config,
+ EGLContext share_ctx,
+ const EGLint* attrib_list);
+ void DestroyContext(EGLContext ctx);
+ bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx);
+
+ private:
+ EGLNativeDisplayType display_id_;
+
+ bool is_initialized_;
+ scoped_ptr<gpu::CommandBufferService> command_buffer_;
+ scoped_ptr<gpu::GpuScheduler> gpu_scheduler_;
+ scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
+ int32 transfer_buffer_id_;
+
+ // TODO(alokp): Support more than one config, surface, and context.
+ scoped_ptr<Config> config_;
+ scoped_ptr<Surface> surface_;
+ scoped_ptr<gpu::gles2::GLES2Implementation> context_;
+
+ DISALLOW_COPY_AND_ASSIGN(Display);
+};
+
+} // namespace egl
+
+#endif // GPU_GLES2_CONFORM_TEST_DISPLAY_H_
diff --git a/gpu/gles2_conform_support/egl/egl.cc b/gpu/gles2_conform_support/egl/egl.cc
new file mode 100644
index 0000000..1e414d3
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/egl.cc
@@ -0,0 +1,377 @@
+// Copyright (c) 2011 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 <EGL/egl.h>
+
+#include "ui/gfx/gl/gl_context.h"
+#include "ui/gfx/gl/gl_surface.h"
+#include "base/command_line.h"
+#include "gpu/gles2_conform_support/egl/display.h"
+
+namespace {
+void SetCurrentError(EGLint error_code) {
+}
+
+template<typename T>
+T EglError(EGLint error_code, T return_value) {
+ SetCurrentError(error_code);
+ return return_value;
+}
+
+template<typename T>
+T EglSuccess(T return_value) {
+ SetCurrentError(EGL_SUCCESS);
+ return return_value;
+}
+
+EGLint ValidateDisplay(EGLDisplay dpy) {
+ if (dpy == EGL_NO_DISPLAY)
+ return EGL_BAD_DISPLAY;
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->is_initialized())
+ return EGL_NOT_INITIALIZED;
+
+ return EGL_SUCCESS;
+}
+
+EGLint ValidateDisplayConfig(EGLDisplay dpy, EGLConfig config) {
+ EGLint error_code = ValidateDisplay(dpy);
+ if (error_code != EGL_SUCCESS)
+ return error_code;
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->IsValidConfig(config))
+ return EGL_BAD_CONFIG;
+
+ return EGL_SUCCESS;
+}
+
+EGLint ValidateDisplaySurface(EGLDisplay dpy, EGLSurface surface) {
+ EGLint error_code = ValidateDisplay(dpy);
+ if (error_code != EGL_SUCCESS)
+ return error_code;
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->IsValidSurface(surface))
+ return EGL_BAD_SURFACE;
+
+ return EGL_SUCCESS;
+}
+
+EGLint ValidateDisplayContext(EGLDisplay dpy, EGLContext context) {
+ EGLint error_code = ValidateDisplay(dpy);
+ if (error_code != EGL_SUCCESS)
+ return error_code;
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->IsValidContext(context))
+ return EGL_BAD_CONTEXT;
+
+ return EGL_SUCCESS;
+}
+} // namespace
+
+extern "C" {
+EGLint eglGetError() {
+ // TODO(alokp): Fix me.
+ return EGL_SUCCESS;
+}
+
+EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) {
+ return new egl::Display(display_id);
+}
+
+EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) {
+ if (dpy == EGL_NO_DISPLAY)
+ return EglError(EGL_BAD_DISPLAY, EGL_FALSE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->Initialize())
+ return EglError(EGL_NOT_INITIALIZED, EGL_FALSE);
+
+ int argc = 1;
+ const char* const argv[] = {
+ "dummy"
+ };
+ CommandLine::Init(argc, argv);
+ gfx::GLSurface::InitializeOneOff();
+
+ *major = 1;
+ *minor = 4;
+ return EglSuccess(EGL_TRUE);
+}
+
+EGLBoolean eglTerminate(EGLDisplay dpy) {
+ EGLint error_code = ValidateDisplay(dpy);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ delete display;
+
+ return EglSuccess(EGL_TRUE);
+}
+
+const char* eglQueryString(EGLDisplay dpy, EGLint name) {
+ EGLint error_code = ValidateDisplay(dpy);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, static_cast<const char*>(NULL));
+
+ switch (name) {
+ case EGL_CLIENT_APIS:
+ return EglSuccess("OpenGL_ES");
+ case EGL_EXTENSIONS:
+ return EglSuccess("");
+ case EGL_VENDOR:
+ return EglSuccess("Google Inc.");
+ case EGL_VERSION:
+ return EglSuccess("1.4");
+ default:
+ return EglError(EGL_BAD_PARAMETER, static_cast<const char*>(NULL));
+ }
+}
+
+EGLBoolean eglGetConfigs(EGLDisplay dpy,
+ 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->GetConfigs(configs, config_size, num_config))
+ return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+
+ 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,
+ EGLint* value) {
+ EGLint error_code = ValidateDisplayConfig(dpy, config);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->GetConfigAttrib(config, attribute, value))
+ return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+
+ return EglSuccess(EGL_TRUE);
+}
+
+EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint* attrib_list) {
+ 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);
+ if (!display->IsValidNativeWindow(win))
+ return EglError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+
+ EGLSurface surface = display->CreateWindowSurface(config, win, attrib_list);
+ if (surface == EGL_NO_SURFACE)
+ return EglError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+
+ return EglSuccess(surface);
+}
+
+EGLSurface eglCreatePbufferSurface(EGLDisplay dpy,
+ EGLConfig config,
+ const EGLint* attrib_list) {
+ return EGL_NO_SURFACE;
+}
+
+EGLSurface eglCreatePixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint* attrib_list) {
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean eglDestroySurface(EGLDisplay dpy,
+ EGLSurface surface) {
+ EGLint error_code = ValidateDisplaySurface(dpy, surface);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ display->DestroySurface(surface);
+ return EglSuccess(EGL_TRUE);
+}
+
+EGLBoolean eglQuerySurface(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint* value) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglBindAPI(EGLenum api) {
+ return EGL_FALSE;
+}
+
+EGLenum eglQueryAPI() {
+ return EGL_OPENGL_ES_API;
+}
+
+EGLBoolean eglWaitClient(void) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglReleaseThread(void) {
+ return EGL_FALSE;
+}
+
+EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ EGLConfig config,
+ const EGLint* attrib_list) {
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean eglSurfaceAttrib(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint value) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglBindTexImage(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint buffer) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglReleaseTexImage(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint buffer) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
+ return EGL_FALSE;
+}
+
+EGLContext eglCreateContext(EGLDisplay dpy,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint* attrib_list) {
+ EGLint error_code = ValidateDisplayConfig(dpy, config);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_NO_CONTEXT);
+
+ if (share_context != EGL_NO_CONTEXT) {
+ error_code = ValidateDisplayContext(dpy, share_context);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_NO_CONTEXT);
+ }
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ EGLContext context = display->CreateContext(
+ config, share_context, attrib_list);
+ if (context == EGL_NO_CONTEXT)
+ return EglError(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
+
+ return EglSuccess(context);
+}
+
+EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
+ EGLint error_code = ValidateDisplayContext(dpy, ctx);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ display->DestroyContext(ctx);
+ return EGL_TRUE;
+}
+
+EGLBoolean eglMakeCurrent(EGLDisplay dpy,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext ctx) {
+ if (ctx != EGL_NO_CONTEXT) {
+ EGLint error_code = ValidateDisplaySurface(dpy, draw);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+ error_code = ValidateDisplaySurface(dpy, read);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+ error_code = ValidateDisplayContext(dpy, ctx);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+ }
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ if (!display->MakeCurrent(draw, read, ctx))
+ return EglError(EGL_CONTEXT_LOST, EGL_FALSE);
+ return EGL_TRUE;
+}
+
+EGLContext eglGetCurrentContext() {
+ return EGL_NO_CONTEXT;
+}
+
+EGLSurface eglGetCurrentSurface(EGLint readdraw) {
+ return EGL_NO_SURFACE;
+}
+
+EGLDisplay eglGetCurrentDisplay() {
+ return EGL_NO_DISPLAY;
+}
+
+EGLBoolean eglQueryContext(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLint attribute,
+ EGLint* value) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglWaitGL() {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglWaitNative(EGLint engine) {
+ return EGL_FALSE;
+}
+
+EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) {
+ EGLint error_code = ValidateDisplaySurface(dpy, surface);
+ if (error_code != EGL_SUCCESS)
+ return EglError(error_code, EGL_FALSE);
+
+ egl::Display* display = static_cast<egl::Display*>(dpy);
+ display->SwapBuffers(surface);
+ return EglSuccess(EGL_TRUE);
+}
+
+EGLBoolean eglCopyBuffers(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLNativePixmapType target) {
+ return EGL_FALSE;
+}
+
+/* Now, define eglGetProcAddress using the generic function ptr. type */
+__eglMustCastToProperFunctionPointerType
+eglGetProcAddress(const char* procname) {
+ return NULL;
+}
+} // extern "C"
diff --git a/gpu/gles2_conform_support/egl/native/EGL/egl.h b/gpu/gles2_conform_support/egl/native/EGL/egl.h
new file mode 100644
index 0000000..99ea342
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/native/EGL/egl.h
@@ -0,0 +1,329 @@
+/* -*- mode: c; tab-width: 8; -*- */
+/* vi: set sw=4 ts=8: */
+/* Reference version of egl.h for EGL 1.4.
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ */
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#ifndef __egl_h_
+#define __egl_h_
+
+/* All platform-dependent types and macro boilerplate (such as EGLAPI
+ * and EGLAPIENTRY) should go in eglplatform.h.
+ */
+#include <EGL/eglplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* EGL Types */
+/* EGLint is defined in eglplatform.h */
+typedef unsigned int EGLBoolean;
+typedef unsigned int EGLenum;
+typedef void *EGLConfig;
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLSurface;
+typedef void *EGLClientBuffer;
+
+/* EGL Versioning */
+#define EGL_VERSION_1_0 1
+#define EGL_VERSION_1_1 1
+#define EGL_VERSION_1_2 1
+#define EGL_VERSION_1_3 1
+#define EGL_VERSION_1_4 1
+
+/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+ */
+
+/* EGL aliases */
+#define EGL_FALSE 0
+#define EGL_TRUE 1
+
+/* Out-of-band handle values */
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+#define EGL_NO_CONTEXT ((EGLContext)0)
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#define EGL_NO_SURFACE ((EGLSurface)0)
+
+/* Out-of-band attribute value */
+#define EGL_DONT_CARE ((EGLint)-1)
+
+/* Errors / GetError return values */
+#define EGL_SUCCESS 0x3000
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
+
+/* Reserved 0x300F-0x301F for additional errors */
+
+/* Config attributes */
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_RED_SIZE 0x3024
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_NONE 0x3038 /* Attrib list terminator */
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
+#define EGL_CONFORMANT 0x3042
+
+/* Reserved 0x3041-0x304F for additional config attributes */
+
+/* Config attribute values */
+#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
+#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
+#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
+#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
+#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
+
+/* More config attribute values, for EGL_TEXTURE_FORMAT */
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_2D 0x305F
+
+/* Config attribute mask bits */
+#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
+
+#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
+
+/* QueryString targets */
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_EXTENSIONS 0x3055
+#define EGL_CLIENT_APIS 0x308D
+
+/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
+#define EGL_HEIGHT 0x3056
+#define EGL_WIDTH 0x3057
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_TARGET 0x3081
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_VERTICAL_RESOLUTION 0x3091
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+
+/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_SINGLE_BUFFER 0x3085
+
+/* OpenVG color spaces */
+#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
+#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
+
+/* OpenVG alpha formats */
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
+
+/* Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+ */
+#define EGL_DISPLAY_SCALING 10000
+
+/* Unknown display resolution/aspect ratio */
+#define EGL_UNKNOWN ((EGLint)-1)
+
+/* Back buffer swap behaviors */
+#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
+#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
+
+/* CreatePbufferFromClientBuffer buffer types */
+#define EGL_OPENVG_IMAGE 0x3096
+
+/* QueryContext targets */
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+
+/* CreateContext attributes */
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+
+/* Multisample resolution behaviors */
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
+
+/* BindAPI/QueryAPI targets */
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENGL_API 0x30A2
+
+/* GetCurrentSurface targets */
+#define EGL_DRAW 0x3059
+#define EGL_READ 0x305A
+
+/* WaitNative engines */
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+
+/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
+#define EGL_COLORSPACE EGL_VG_COLORSPACE
+#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
+#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
+#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
+#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
+#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
+
+/* EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+ */
+
+
+
+/* EGL Functions */
+
+EGLAPI EGLint EGLAPIENTRY eglGetError(void);
+
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
+
+EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
+
+
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx);
+
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target);
+
+/* This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+ */
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+
+/* Now, define eglGetProcAddress using the generic function ptr. type */
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
+ eglGetProcAddress(const char *procname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __egl_h_ */
diff --git a/gpu/gles2_conform_support/egl/native/EGL/eglext.h b/gpu/gles2_conform_support/egl/native/EGL/eglext.h
new file mode 100644
index 0000000..638e336
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/native/EGL/eglext.h
@@ -0,0 +1,222 @@
+#ifndef __eglext_h_
+#define __eglext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#include <EGL/eglplatform.h>
+
+/*************************************************************/
+
+/* Header file version number */
+/* Current version at http://www.khronos.org/registry/egl/ */
+/* $Revision: 10795 $ on $Date: 2010-03-19 17:04:17 -0700 (Fri, 19 Mar 2010) $ */
+#define EGL_EGLEXT_VERSION 5
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
+#endif
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
+#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
+#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
+#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+#endif
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
+typedef void *EGLImageKHR;
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#endif
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+
+typedef void* EGLSyncKHR;
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+/* Most interfaces defined by EGL_KHR_image_pixmap above */
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+/* Interfaces defined by EGL_KHR_image above */
+#endif
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef void* EGLSyncNV;
+typedef unsigned long long EGLTimeNV;
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
+EGLBoolean eglFenceNV (EGLSyncNV sync);
+EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gpu/gles2_conform_support/egl/native/EGL/eglplatform.h b/gpu/gles2_conform_support/egl/native/EGL/eglplatform.h
new file mode 100644
index 0000000..b01aa4d
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/native/EGL/eglplatform.h
@@ -0,0 +1,117 @@
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "EGL" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+/* Macros used in EGL function prototype declarations.
+ *
+ * EGL functions should be prototyped as:
+ *
+ * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+ * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+ *
+ * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+ */
+
+#ifndef EGLAPI
+#define EGLAPI //KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY //KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+ * are aliases of window-system-dependent types, such as X Display * or
+ * Windows Device Context. They must be defined in platform-specific
+ * code below. The EGL-prefixed versions of Native*Type are the same
+ * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+ */
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND EGLNativeWindowType;
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#elif defined(__unix__)
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#elif defined(__APPLE__)
+
+// TODO(gman): these are place holders.
+typedef void *EGLNativeDisplayType;
+typedef int EGLNativePixmapType;
+typedef int EGLNativeWindowType;
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other. While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
diff --git a/gpu/gles2_conform_support/egl/surface.cc b/gpu/gles2_conform_support/egl/surface.cc
new file mode 100644
index 0000000..423fe27
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/surface.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2011 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/surface.h"
+
+namespace egl {
+
+Surface::Surface(EGLNativeWindowType win) : window_(win) {
+}
+
+Surface::~Surface() {
+}
+
+} // namespace egl
diff --git a/gpu/gles2_conform_support/egl/surface.h b/gpu/gles2_conform_support/egl/surface.h
new file mode 100644
index 0000000..3b66de0
--- /dev/null
+++ b/gpu/gles2_conform_support/egl/surface.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 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.
+
+#ifndef GPU_GLES2_CONFORM_TEST_SURFACE_H_
+#define GPU_GLES2_CONFORM_TEST_SURFACE_H_
+
+#include <EGL/egl.h>
+
+#include "base/basictypes.h"
+
+namespace egl {
+
+class Surface {
+ public:
+ explicit Surface(EGLNativeWindowType win);
+ ~Surface();
+
+ EGLNativeWindowType window() { return window_; }
+
+ private:
+ EGLNativeWindowType window_;
+
+ DISALLOW_COPY_AND_ASSIGN(Surface);
+};
+
+} // namespace egl
+
+#endif // GPU_GLES2_CONFORM_TEST_SURFACE_H_
diff --git a/gpu/gles2_conform_support/gles2_conform_support.c b/gpu/gles2_conform_support/gles2_conform_support.c
new file mode 100644
index 0000000..db0e8c0
--- /dev/null
+++ b/gpu/gles2_conform_support/gles2_conform_support.c
@@ -0,0 +1,23 @@
+// Copyright (c) 2011 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.
+
+// A small sample just to make sure we can actually compile and link
+// our OpenGL ES 2.0 conformance test support code.
+
+#include <EGL/egl.h>
+#include "gpu/gles2_conform_support/gtf/gtf_stubs.h"
+
+// Note: This code is not intended to run, only compile and link.
+int GTFMain(int argc, char** argv) {
+ EGLint major, minor;
+ EGLDisplay eglDisplay;
+ EGLNativeDisplayType nativeDisplay = EGL_DEFAULT_DISPLAY;
+
+ eglDisplay = eglGetDisplay(nativeDisplay);
+ eglInitialize(eglDisplay, &major, &minor);
+
+ return 0;
+}
+
+
diff --git a/gpu/gles2_conform_support/gles2_conform_support.gyp b/gpu/gles2_conform_support/gles2_conform_support.gyp
new file mode 100644
index 0000000..45737d4
--- /dev/null
+++ b/gpu/gles2_conform_support/gles2_conform_support.gyp
@@ -0,0 +1,100 @@
+# Copyright (c) 2011 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.
+
+{
+ 'variables': {
+ # These are defined here because we want to be able to compile them on
+ # the buildbots without needed the OpenGL ES 2.0 conformance tests
+ # which are not open source.
+ 'bootstrap_sources_native': [
+ 'native/main.cc',
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'bootstrap_sources_native': [
+ 'native/egl_native.cc',
+ 'native/egl_native_linux.cc',
+ ],
+ }],
+ ['OS=="win"', {
+ 'bootstrap_sources_native': [
+ 'native/egl_native.cc',
+ 'native/egl_native_win.cc',
+ ],
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'egl_native',
+ 'type': 'static_library',
+ 'dependencies': [
+ '<(DEPTH)/base/base.gyp:base',
+ '<(DEPTH)/gpu/gpu.gyp:command_buffer_service',
+ ],
+ 'include_dirs': ['egl/native'],
+ 'sources': [
+ 'egl/config.cc',
+ 'egl/config.h',
+ 'egl/display.cc',
+ 'egl/display.h',
+ 'egl/egl.cc',
+ 'egl/surface.cc',
+ 'egl/surface.h',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': ['egl/native'],
+ },
+ },
+ {
+ 'target_name': 'egl_main_native',
+ 'type': 'static_library',
+ 'dependencies': [
+ 'egl_native',
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'dependencies': ['../../build/linux/system.gyp:gtk'],
+ }],
+ ],
+ 'include_dirs': ['egl/native'],
+ 'sources': [
+ '<@(bootstrap_sources_native)',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': ['egl/native'],
+ },
+ 'defines': ['GTF_GLES20'],
+ },
+ {
+ 'target_name': 'gles2_conform_support',
+ 'type': 'executable',
+ 'dependencies': [
+ 'egl_native',
+ '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib_nocheck',
+ '<(DEPTH)/third_party/expat/expat.gyp:expat',
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'dependencies': ['../../build/linux/system.gyp:gtk'],
+ }],
+ ],
+ 'defines': [
+ 'GLES2_CONFORM_SUPPORT_ONLY',
+ 'GTF_GLES20',
+ ],
+ 'sources': [
+ '<@(bootstrap_sources_native)',
+ 'gles2_conform_support.c'
+ ],
+ },
+ ],
+}
+
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/gpu/gles2_conform_support/gtf/gtf_stubs.h b/gpu/gles2_conform_support/gtf/gtf_stubs.h
new file mode 100644
index 0000000..23bb362
--- /dev/null
+++ b/gpu/gles2_conform_support/gtf/gtf_stubs.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2011 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.
+
+// A few stubs so we don't need the actual OpenGL ES 2.0 conformance tests
+// to compile the support for them.
+
+#ifndef GPU_GLES2_CONFORM_SUPPORT_GTF_GTF_STUBS_H_
+#define GPU_GLES2_CONFORM_SUPPORT_GTF_GTF_STUBS_H_
+
+#include <GLES2/gl2.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+typedef unsigned char GTFbool;
+#define GTFfalse 0
+#define GTFtrue 1
+
+int GTFMain(int argc, char** argv);
+
+#endif // GPU_GLES2_CONFORM_SUPPORT_GTF_GTF_STUBS_H_
+
+
diff --git a/gpu/gles2_conform_support/native/egl_native.cc b/gpu/gles2_conform_support/native/egl_native.cc
new file mode 100644
index 0000000..97e0a44
--- /dev/null
+++ b/gpu/gles2_conform_support/native/egl_native.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 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.
+
+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 GTFNativeCreatePixmap(EGLNativeDisplayType nativeDisplay,
+ EGLDisplay eglDisplay, EGLConfig eglConfig,
+ const char *title, int width, int height,
+ EGLNativePixmapType *pNativePixmap) {
+ return GTFtrue;
+}
+
+void GTFNativeDestroyPixmap(EGLNativeDisplayType nativeDisplay,
+ EGLNativePixmapType nativePixmap) {
+}
diff --git a/gpu/gles2_conform_support/native/egl_native_linux.cc b/gpu/gles2_conform_support/native/egl_native_linux.cc
new file mode 100644
index 0000000..a356e61
--- /dev/null
+++ b/gpu/gles2_conform_support/native/egl_native_linux.cc
@@ -0,0 +1,121 @@
+// Copyright (c) 2011 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 <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <gdk/gdkx.h>
+#include <gtk/gtk.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) {
+ int argc = 0;
+ char **argv = NULL;
+ gtk_init(&argc, &argv);
+ *pNativeDisplay = GDK_DISPLAY();;
+ return *pNativeDisplay ? GTFtrue : GTFfalse;
+}
+
+void GTFNativeDestroyDisplay(EGLNativeDisplayType nativeDisplay) {
+ gtk_exit(0);
+}
+
+GTFbool GTFNativeCreateWindow(EGLNativeDisplayType nativeDisplay,
+ EGLDisplay eglDisplay, EGLConfig eglConfig,
+ const char* title, int width, int height,
+ EGLNativeWindowType *pNativeWindow) {
+#ifdef CHROMEOS_GLES2_CONFORMANCE
+ // Due to the behavior of ChromeOS window manager, which always resize the
+ // top level window etc, we had to create a popup window.
+ GtkWidget* hwnd = gtk_window_new(GTK_WINDOW_POPUP);
+#else
+ GtkWidget* hwnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+#endif
+
+ gtk_window_set_title(GTK_WINDOW(hwnd), title);
+ gtk_window_set_default_size(GTK_WINDOW(hwnd), width, height);
+ gtk_widget_set_double_buffered(hwnd, FALSE);
+ gtk_widget_set_app_paintable(hwnd, TRUE);
+
+ // We had to enter gtk main loop to realize the window on ChromeOS.
+ gtk_widget_show_now(hwnd);
+
+ *pNativeWindow = GDK_WINDOW_XWINDOW(hwnd->window);
+
+ return GTFtrue;
+}
+
+void GTFNativeDestroyWindow(EGLNativeDisplayType nativeDisplay,
+ EGLNativeWindowType nativeWindow) {
+ GdkWindow* window = gdk_window_lookup(nativeWindow);
+ gpointer widget = NULL;
+ gdk_window_get_user_data(window, &widget);
+ gtk_widget_destroy(GTK_WIDGET(widget));
+}
+
+EGLImageKHR GTFCreateEGLImage(int width, int height,
+ GLenum format, GLenum type) {
+ PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr_;
+ egl_create_image_khr_ = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>
+ (eglGetProcAddress("eglCreateImageKHR"));
+
+ static const EGLint attrib[] = {
+ EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
+ EGL_GL_TEXTURE_LEVEL_KHR, 0,
+ EGL_NONE
+ };
+
+ if (format != GL_RGBA && format != GL_RGB)
+ return static_cast<EGLImageKHR>(NULL);
+
+ if (type != GL_UNSIGNED_BYTE)
+ return static_cast<EGLImageKHR>(NULL);
+
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D,
+ 0,
+ format,
+ width,
+ height,
+ 0,
+ format,
+ type,
+ NULL);
+
+ // Disable mip-maps because we do not require it.
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ if(glGetError() != GL_NO_ERROR)
+ return static_cast<EGLImageKHR>(NULL);
+
+ EGLImageKHR egl_image =
+ egl_create_image_khr_(eglGetCurrentDisplay(),
+ eglGetCurrentContext(),
+ EGL_GL_TEXTURE_2D_KHR,
+ reinterpret_cast<EGLClientBuffer>(texture),
+ attrib);
+
+ if (eglGetError() == EGL_SUCCESS)
+ return egl_image;
+ else
+ return static_cast<EGLImageKHR>(NULL);
+}
+
+void GTFDestroyEGLImage(EGLImageKHR image) {
+ PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr_;
+ egl_destroy_image_khr_ = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>
+ (eglGetProcAddress("eglDestroyImageKHR"));
+
+ egl_destroy_image_khr_(eglGetCurrentDisplay(), image);
+}
diff --git a/gpu/gles2_conform_support/native/egl_native_win.cc b/gpu/gles2_conform_support/native/egl_native_win.cc
new file mode 100644
index 0000000..c083cca
--- /dev/null
+++ b/gpu/gles2_conform_support/native/egl_native_win.cc
@@ -0,0 +1,113 @@
+// Copyright (c) 2011 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.
+
+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
+}
+
+#include <string>
+
+namespace {
+LPCTSTR kWindowClassName = TEXT("ES2CONFORM");
+
+LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg,
+ WPARAM w_param, LPARAM l_param) {
+ LRESULT result = 0;
+ switch (msg) {
+ case WM_CLOSE:
+ ::DestroyWindow(hwnd);
+ break;
+ case WM_DESTROY:
+ ::PostQuitMessage(0);
+ break;
+ case WM_ERASEBKGND:
+ // Return a non-zero value to indicate that the background has been
+ // erased.
+ result = 1;
+ break;
+ default:
+ result = ::DefWindowProc(hwnd, msg, w_param, l_param);
+ break;
+ }
+ return result;
+}
+} // namespace.
+
+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) {
+ WNDCLASS wnd_class = {0};
+ HINSTANCE instance = GetModuleHandle(NULL);
+ wnd_class.style = CS_OWNDC;
+ wnd_class.lpfnWndProc = WindowProc;
+ wnd_class.hInstance = instance;
+ wnd_class.hbrBackground =
+ reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
+ wnd_class.lpszClassName = kWindowClassName;
+ if (!RegisterClass(&wnd_class))
+ return GTFfalse;
+
+ DWORD wnd_style = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
+ RECT wnd_rect;
+ wnd_rect.left = 0;
+ wnd_rect.top = 0;
+ wnd_rect.right = width;
+ wnd_rect.bottom = height;
+ if (!AdjustWindowRect(&wnd_rect, wnd_style, FALSE))
+ return GTFfalse;
+
+#ifdef UNICODE
+ // Convert ascii string to wide string.
+ const std::wstring wnd_title(title, title + strlen(title));
+#else
+ const std::string wnd_title = title;
+#endif // UNICODE
+
+ HWND hwnd = CreateWindow(
+ wnd_class.lpszClassName,
+ wnd_title.c_str(),
+ wnd_style,
+ 0,
+ 0,
+ wnd_rect.right - wnd_rect.left,
+ wnd_rect.bottom - wnd_rect.top,
+ NULL,
+ NULL,
+ instance,
+ NULL);
+ if (hwnd == NULL)
+ return GTFfalse;
+
+ ShowWindow(hwnd, SW_SHOWNORMAL);
+ *pNativeWindow = hwnd;
+ return GTFtrue;
+}
+
+void GTFNativeDestroyWindow(EGLNativeDisplayType nativeDisplay,
+ EGLNativeWindowType nativeWindow) {
+ DestroyWindow(nativeWindow);
+ UnregisterClass(kWindowClassName, GetModuleHandle(NULL));
+}
+
+EGLImageKHR GTFCreateEGLImage(int width, int height,
+ GLenum format, GLenum type) {
+ return (EGLImageKHR)NULL;
+}
+
+void GTFDestroyEGLImage(EGLImageKHR image) {
+}
diff --git a/gpu/gles2_conform_support/native/main.cc b/gpu/gles2_conform_support/native/main.cc
new file mode 100644
index 0000000..032318cf
--- /dev/null
+++ b/gpu/gles2_conform_support/native/main.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 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"
+
+#if defined(OS_LINUX)
+#include <gtk/gtk.h>
+#endif // OS_LINUX
+
+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/GTFMain.h"
+#endif
+}
+
+int main(int argc, char *argv[]) {
+#if defined(OS_LINUX)
+ gtk_init(&argc, &argv);
+#endif // OS_LINUX
+
+ base::AtExitManager at_exit;
+ MessageLoopForUI message_loop;
+
+ GTFMain(argc, argv);
+
+ return 0;
+}
+