blob: 245e3c32e6b0d5176145e64b623443da997b7eba [file] [log] [blame]
Geoff Langd08f3b32016-09-23 15:56:30 -04001//
2// Copyright 2016 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// DisplayNULL.cpp:
7// Implements the class methods for DisplayNULL.
8//
9
10#include "libANGLE/renderer/null/DisplayNULL.h"
11
12#include "common/debug.h"
13
Geoff Lang76cdbd52016-09-23 16:51:04 -040014#include "libANGLE/renderer/null/ContextNULL.h"
15#include "libANGLE/renderer/null/DeviceNULL.h"
16#include "libANGLE/renderer/null/ImageNULL.h"
17#include "libANGLE/renderer/null/SurfaceNULL.h"
18
Geoff Langd08f3b32016-09-23 15:56:30 -040019namespace rx
20{
21
Geoff Lang76cdbd52016-09-23 16:51:04 -040022DisplayNULL::DisplayNULL() : DisplayImpl(), mDevice(nullptr)
Geoff Langd08f3b32016-09-23 15:56:30 -040023{
24}
25
26DisplayNULL::~DisplayNULL()
27{
28}
29
30egl::Error DisplayNULL::initialize(egl::Display *display)
31{
Geoff Lang76cdbd52016-09-23 16:51:04 -040032 mDevice = new DeviceNULL();
33 return egl::NoError();
Geoff Langd08f3b32016-09-23 15:56:30 -040034}
35
36void DisplayNULL::terminate()
37{
Geoff Lang76cdbd52016-09-23 16:51:04 -040038 SafeDelete(mDevice);
Geoff Langd08f3b32016-09-23 15:56:30 -040039}
40
41egl::Error DisplayNULL::makeCurrent(egl::Surface *drawSurface,
42 egl::Surface *readSurface,
43 gl::Context *context)
44{
Geoff Lang76cdbd52016-09-23 16:51:04 -040045 return egl::NoError();
Geoff Langd08f3b32016-09-23 15:56:30 -040046}
47
48egl::ConfigSet DisplayNULL::generateConfigs()
49{
Geoff Lang76cdbd52016-09-23 16:51:04 -040050 egl::Config config;
51 config.renderTargetFormat = GL_RGBA8;
52 config.depthStencilFormat = GL_DEPTH24_STENCIL8;
53 config.bufferSize = 32;
54 config.redSize = 8;
55 config.greenSize = 8;
56 config.blueSize = 8;
57 config.alphaSize = 8;
58 config.alphaMaskSize = 0;
59 config.bindToTextureRGB = EGL_TRUE;
60 config.bindToTextureRGBA = EGL_TRUE;
61 config.colorBufferType = EGL_RGB_BUFFER;
62 config.configCaveat = EGL_NONE;
63 config.conformant = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
64 config.depthSize = 24;
65 config.level = 0;
66 config.matchNativePixmap = EGL_NONE;
67 config.maxPBufferWidth = 0;
68 config.maxPBufferHeight = 0;
69 config.maxPBufferPixels = 0;
70 config.maxSwapInterval = 1;
71 config.minSwapInterval = 1;
72 config.nativeRenderable = EGL_TRUE;
73 config.nativeVisualID = 0;
74 config.nativeVisualType = EGL_NONE;
75 config.renderableType = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
76 config.sampleBuffers = 0;
77 config.samples = 0;
78 config.stencilSize = 8;
79 config.surfaceType = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
80 config.optimalOrientation = 0;
81 config.transparentType = EGL_NONE;
82 config.transparentRedValue = 0;
83 config.transparentGreenValue = 0;
84 config.transparentBlueValue = 0;
85
86 egl::ConfigSet configSet;
87 configSet.add(config);
88 return configSet;
Geoff Langd08f3b32016-09-23 15:56:30 -040089}
90
91bool DisplayNULL::testDeviceLost()
92{
Geoff Lang76cdbd52016-09-23 16:51:04 -040093 return false;
Geoff Langd08f3b32016-09-23 15:56:30 -040094}
95
96egl::Error DisplayNULL::restoreLostDevice()
97{
Geoff Lang76cdbd52016-09-23 16:51:04 -040098 return egl::NoError();
Geoff Langd08f3b32016-09-23 15:56:30 -040099}
100
101bool DisplayNULL::isValidNativeWindow(EGLNativeWindowType window) const
102{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400103 return true;
Geoff Langd08f3b32016-09-23 15:56:30 -0400104}
105
106std::string DisplayNULL::getVendorString() const
107{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400108 return "NULL";
Geoff Langd08f3b32016-09-23 15:56:30 -0400109}
110
111egl::Error DisplayNULL::getDevice(DeviceImpl **device)
112{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400113 *device = mDevice;
114 return egl::NoError();
Geoff Langd08f3b32016-09-23 15:56:30 -0400115}
116
117egl::Error DisplayNULL::waitClient() const
118{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400119 return egl::NoError();
Geoff Langd08f3b32016-09-23 15:56:30 -0400120}
121
122egl::Error DisplayNULL::waitNative(EGLint engine,
123 egl::Surface *drawSurface,
124 egl::Surface *readSurface) const
125{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400126 return egl::NoError();
Geoff Langd08f3b32016-09-23 15:56:30 -0400127}
128
129gl::Version DisplayNULL::getMaxSupportedESVersion() const
130{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400131 return gl::Version(3, 2);
Geoff Langd08f3b32016-09-23 15:56:30 -0400132}
133
134SurfaceImpl *DisplayNULL::createWindowSurface(const egl::SurfaceState &state,
135 const egl::Config *configuration,
136 EGLNativeWindowType window,
137 const egl::AttributeMap &attribs)
138{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400139 return new SurfaceNULL(state);
Geoff Langd08f3b32016-09-23 15:56:30 -0400140}
141
142SurfaceImpl *DisplayNULL::createPbufferSurface(const egl::SurfaceState &state,
143 const egl::Config *configuration,
144 const egl::AttributeMap &attribs)
145{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400146 return new SurfaceNULL(state);
Geoff Langd08f3b32016-09-23 15:56:30 -0400147}
148
149SurfaceImpl *DisplayNULL::createPbufferFromClientBuffer(const egl::SurfaceState &state,
150 const egl::Config *configuration,
Geoff Lang2018c0b2015-12-08 11:48:51 -0500151 EGLenum buftype,
152 EGLClientBuffer buffer,
Geoff Langd08f3b32016-09-23 15:56:30 -0400153 const egl::AttributeMap &attribs)
154{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400155 return new SurfaceNULL(state);
Geoff Langd08f3b32016-09-23 15:56:30 -0400156}
157
158SurfaceImpl *DisplayNULL::createPixmapSurface(const egl::SurfaceState &state,
159 const egl::Config *configuration,
160 NativePixmapType nativePixmap,
161 const egl::AttributeMap &attribs)
162{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400163 return new SurfaceNULL(state);
Geoff Langd08f3b32016-09-23 15:56:30 -0400164}
165
166ImageImpl *DisplayNULL::createImage(EGLenum target,
167 egl::ImageSibling *buffer,
168 const egl::AttributeMap &attribs)
169{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400170 return new ImageNULL();
Geoff Langd08f3b32016-09-23 15:56:30 -0400171}
172
173ContextImpl *DisplayNULL::createContext(const gl::ContextState &state)
174{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400175 return new ContextNULL(state);
Geoff Langd08f3b32016-09-23 15:56:30 -0400176}
177
178StreamProducerImpl *DisplayNULL::createStreamProducerD3DTextureNV12(
179 egl::Stream::ConsumerType consumerType,
180 const egl::AttributeMap &attribs)
181{
182 UNIMPLEMENTED();
Geoff Lang76cdbd52016-09-23 16:51:04 -0400183 return nullptr;
Geoff Langd08f3b32016-09-23 15:56:30 -0400184}
185
186void DisplayNULL::generateExtensions(egl::DisplayExtensions *outExtensions) const
187{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400188 outExtensions->createContextRobustness = true;
189 outExtensions->postSubBuffer = true;
190 outExtensions->createContext = true;
191 outExtensions->deviceQuery = true;
192 outExtensions->image = true;
193 outExtensions->imageBase = true;
194 outExtensions->glTexture2DImage = true;
195 outExtensions->glTextureCubemapImage = true;
196 outExtensions->glTexture3DImage = true;
197 outExtensions->glRenderbufferImage = true;
198 outExtensions->getAllProcAddresses = true;
199 outExtensions->flexibleSurfaceCompatibility = true;
200 outExtensions->directComposition = true;
201 outExtensions->createContextNoError = true;
202 outExtensions->createContextWebGLCompatibility = true;
203 outExtensions->createContextBindGeneratesResource = true;
204 outExtensions->swapBuffersWithDamage = true;
Geoff Langd08f3b32016-09-23 15:56:30 -0400205}
206
207void DisplayNULL::generateCaps(egl::Caps *outCaps) const
208{
Geoff Lang76cdbd52016-09-23 16:51:04 -0400209 outCaps->textureNPOT = true;
Geoff Langd08f3b32016-09-23 15:56:30 -0400210}
211
212} // namespace rx