forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathegl_native_windowless.cc
90 lines (72 loc) · 2.69 KB
/
egl_native_windowless.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Using egl_native from gles2_conform_support
// TODO: We may want to phase out the old gles2_conform support in preference
// of this implementation. So eventually we'll need to move the egl_native
// stuff here or to a shareable location/path.
#include "gpu/gles2_conform_support/egl/test_support.h"
#include "third_party/khronos_glcts/framework/egl/tcuEglPlatform.hpp"
namespace egl {
namespace native {
namespace windowless {
class Surface : public tcu::egl::WindowSurface {
public:
Surface(tcu::egl::Display& display,
EGLConfig config,
const EGLint* attribList,
int width,
int height)
: tcu::egl::WindowSurface(display,
config,
(EGLNativeWindowType) nullptr,
attribList),
width_(width),
height_(height) {}
int getWidth() const override { return width_; }
int getHeight() const override { return height_; }
private:
const int width_;
const int height_;
};
class Window : public tcu::NativeWindow {
public:
Window(tcu::egl::Display& display,
EGLConfig config,
const EGLint* attribList,
int width,
int height)
: tcu::NativeWindow::NativeWindow(),
eglDisplay_(display),
surface_(display, config, attribList, width, height) {}
~Window() override {}
tcu::egl::Display& getEglDisplay() override { return eglDisplay_; }
tcu::egl::WindowSurface& getEglSurface() override { return surface_; }
void processEvents() override { return; }
private:
tcu::egl::Display& eglDisplay_;
Surface surface_;
};
class Platform : public tcu::EglPlatform {
public:
Platform() : tcu::EglPlatform::EglPlatform() {}
~Platform() override {}
tcu::NativeWindow* createWindow(tcu::NativeDisplay& dpy,
EGLConfig config,
const EGLint* attribList,
int width,
int height,
qpVisibility visibility) override {
tcu::egl::Display& eglDisplay = dpy.getEglDisplay();
EGLDisplay display = eglDisplay.getEGLDisplay();
CommandBufferGLESSetNextCreateWindowSurfaceCreatesPBuffer(display, width,
height);
return new Window(eglDisplay, config, attribList, width, height);
}
};
} // namespace windowless
} // namespace native
} // namespace egl
tcu::Platform* createPlatform(void) {
return new egl::native::windowless::Platform();
}