summaryrefslogtreecommitdiffstats
path: root/gpu/gles2_conform_support/native
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-23 19:01:46 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-23 19:01:46 +0000
commit68c51ad5dd7a93413ba8cb54c97005c0072163f2 (patch)
treed80bb7e7f32ce3da0254e6ff5a58886ef6aac1fe /gpu/gles2_conform_support/native
parent78f6188251556c3065b8bb3f3926f48a1a49c0eb (diff)
downloadchromium_src-68c51ad5dd7a93413ba8cb54c97005c0072163f2.zip
chromium_src-68c51ad5dd7a93413ba8cb54c97005c0072163f2.tar.gz
chromium_src-68c51ad5dd7a93413ba8cb54c97005c0072163f2.tar.bz2
Revert 86306 (failed compile on win builder) - Move OpenGL ES 2.0 conformance test support into main tree
This support breaks often because it is not built but the buildbots. This CL adds it to the main tree so it will be built by the buildbots. Not sure where to add it in all.gyp but I need to make sure it's built TEST=opengl es 2.0 conformance tests still build BUG=83382 R=apatrick@chromium.org Review URL: http://codereview.chromium.org/7057033 TBR=gman@chromium.org Review URL: http://codereview.chromium.org/7066003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/gles2_conform_support/native')
-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
4 files changed, 0 insertions, 288 deletions
diff --git a/gpu/gles2_conform_support/native/egl_native.cc b/gpu/gles2_conform_support/native/egl_native.cc
deleted file mode 100644
index 97e0a44..0000000
--- a/gpu/gles2_conform_support/native/egl_native.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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
deleted file mode 100644
index a356e61..0000000
--- a/gpu/gles2_conform_support/native/egl_native_linux.cc
+++ /dev/null
@@ -1,121 +0,0 @@
-// 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
deleted file mode 100644
index c083cca..0000000
--- a/gpu/gles2_conform_support/native/egl_native_win.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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
deleted file mode 100644
index 032318cf..0000000
--- a/gpu/gles2_conform_support/native/main.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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;
-}
-