1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #if defined(GLES2_CONFORM_SUPPORT_ONLY)
7 #include "gpu/gles2_conform_support/gtf/gtf_stubs.h"
9 #include "third_party/gles2_conform/GTF_ES/glsl/GTF/Source/eglNative.h"
16 LPCTSTR kWindowClassName
= TEXT("ES2CONFORM");
18 LRESULT CALLBACK
WindowProc(HWND hwnd
, UINT msg
,
19 WPARAM w_param
, LPARAM l_param
) {
23 ::DestroyWindow(hwnd
);
29 // Return a non-zero value to indicate that the background has been
34 result
= ::DefWindowProc(hwnd
, msg
, w_param
, l_param
);
43 GTFbool
GTFNativeCreateDisplay(EGLNativeDisplayType
*pNativeDisplay
) {
44 *pNativeDisplay
= EGL_DEFAULT_DISPLAY
;
48 void GTFNativeDestroyDisplay(EGLNativeDisplayType nativeDisplay
) {
49 // Nothing to destroy since we are using EGL_DEFAULT_DISPLAY
52 GTFbool
GTFNativeCreateWindow(EGLNativeDisplayType nativeDisplay
,
53 EGLDisplay eglDisplay
, EGLConfig eglConfig
,
54 const char* title
, int width
, int height
,
55 EGLNativeWindowType
*pNativeWindow
) {
56 WNDCLASS wnd_class
= {0};
57 HINSTANCE instance
= GetModuleHandle(NULL
);
58 wnd_class
.style
= CS_OWNDC
;
59 wnd_class
.lpfnWndProc
= WindowProc
;
60 wnd_class
.hInstance
= instance
;
61 wnd_class
.hbrBackground
=
62 reinterpret_cast<HBRUSH
>(GetStockObject(BLACK_BRUSH
));
63 wnd_class
.lpszClassName
= kWindowClassName
;
64 if (!RegisterClass(&wnd_class
))
67 DWORD wnd_style
= WS_OVERLAPPEDWINDOW
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
;
71 wnd_rect
.right
= width
;
72 wnd_rect
.bottom
= height
;
73 if (!AdjustWindowRect(&wnd_rect
, wnd_style
, FALSE
))
77 // Convert ascii string to wide string.
78 const std::wstring
wnd_title(title
, title
+ strlen(title
));
80 const std::string wnd_title
= title
;
83 HWND hwnd
= CreateWindow(
84 wnd_class
.lpszClassName
,
89 wnd_rect
.right
- wnd_rect
.left
,
90 wnd_rect
.bottom
- wnd_rect
.top
,
98 ShowWindow(hwnd
, SW_SHOWNORMAL
);
99 *pNativeWindow
= hwnd
;
103 void GTFNativeDestroyWindow(EGLNativeDisplayType nativeDisplay
,
104 EGLNativeWindowType nativeWindow
) {
105 DestroyWindow(nativeWindow
);
106 UnregisterClass(kWindowClassName
, GetModuleHandle(NULL
));
109 EGLImageKHR
GTFCreateEGLImage(int width
, int height
,
110 GLenum format
, GLenum type
) {
111 return (EGLImageKHR
)NULL
;
114 void GTFDestroyEGLImage(EGLImageKHR image
) {