1 // Copyright 2014 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.
5 // Using egl_native from gles2_conform_support
6 // TODO: We may want to phase out the old gles2_conform support in preference
7 // of this implementation. So eventually we'll need to move the egl_native
8 // stuff here or to a shareable location/path.
9 #include "gpu/gles2_conform_support/egl/display.h"
11 #include "third_party/khronos_glcts/framework/egl/tcuEglPlatform.hpp"
15 namespace windowless
{
17 class Surface
: public tcu::egl::WindowSurface
{
19 Surface(tcu::egl::Display
& display
,
21 const EGLint
* attribList
,
24 : tcu::egl::WindowSurface(display
,
26 (EGLNativeWindowType
)NULL
,
31 int getWidth() const { return width_
; }
33 int getHeight() const { return height_
; }
40 class Window
: public tcu::NativeWindow
{
42 Window(tcu::egl::Display
& display
,
44 const EGLint
* attribList
,
47 : tcu::NativeWindow::NativeWindow(),
49 surface_(display
, config
, attribList
, width
, height
) {}
53 tcu::egl::Display
& getEglDisplay() { return eglDisplay_
; }
55 tcu::egl::WindowSurface
& getEglSurface() { return surface_
; }
57 void processEvents() { return; }
60 tcu::egl::Display
& eglDisplay_
;
64 class Platform
: public tcu::EglPlatform
{
66 Platform() : tcu::EglPlatform::EglPlatform() {}
68 virtual ~Platform() {}
70 tcu::NativeWindow
* createWindow(tcu::NativeDisplay
& dpy
,
72 const EGLint
* attribList
,
75 qpVisibility visibility
) {
76 tcu::egl::Display
& eglDisplay
= dpy
.getEglDisplay();
77 egl::Display
* display
=
78 static_cast<egl::Display
*>(eglDisplay
.getEGLDisplay());
79 display
->SetCreateOffscreen(width
, height
);
80 return new Window(eglDisplay
, config
, attribList
, width
, height
);
84 } // namespace windowless
88 tcu::Platform
* createPlatform(void) {
89 return new egl::native::windowless::Platform();