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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
//
// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// validationEGL.h: Validation functions for generic EGL entry point parameters
#ifndef LIBANGLE_VALIDATIONEGL_H_
#define LIBANGLE_VALIDATIONEGL_H_
#include "common/PackedEnums.h"
#include "libANGLE/Error.h"
#include "libANGLE/Texture.h"
#include <EGL/egl.h>
#include <EGL/eglext.h>
namespace gl
{
class Context;
}
namespace egl
{
class AttributeMap;
struct ClientExtensions;
struct Config;
class Device;
class Display;
class Image;
class Stream;
class Surface;
class Sync;
class Thread;
class LabeledObject;
// Object validation
Error ValidateDisplay(const Display *display);
Error ValidateSurface(const Display *display, const Surface *surface);
Error ValidateConfig(const Display *display, const Config *config);
Error ValidateContext(const Display *display, const gl::Context *context);
Error ValidateImage(const Display *display, const Image *image);
Error ValidateDevice(const Device *device);
Error ValidateSync(const Display *display, const Sync *sync);
// Return the requested object only if it is valid (otherwise nullptr)
const Thread *GetThreadIfValid(const Thread *thread);
const Display *GetDisplayIfValid(const Display *display);
const Surface *GetSurfaceIfValid(const Display *display, const Surface *surface);
const Image *GetImageIfValid(const Display *display, const Image *image);
const Stream *GetStreamIfValid(const Display *display, const Stream *stream);
const gl::Context *GetContextIfValid(const Display *display, const gl::Context *context);
const Device *GetDeviceIfValid(const Device *device);
const Sync *GetSyncIfValid(const Display *display, const Sync *sync);
LabeledObject *GetLabeledObjectIfValid(Thread *thread,
const Display *display,
ObjectType objectType,
EGLObjectKHR object);
// Entry point validation
Error ValidateInitialize(const Display *display);
Error ValidateTerminate(const Display *display);
Error ValidateCreateContext(Display *display,
Config *configuration,
gl::Context *shareContext,
const AttributeMap &attributes);
Error ValidateCreateWindowSurface(Display *display,
Config *config,
EGLNativeWindowType window,
const AttributeMap &attributes);
Error ValidateCreatePbufferSurface(Display *display,
Config *config,
const AttributeMap &attributes);
Error ValidateCreatePbufferFromClientBuffer(Display *display,
EGLenum buftype,
EGLClientBuffer buffer,
Config *config,
const AttributeMap &attributes);
Error ValidateMakeCurrent(Display *display, Surface *draw, Surface *read, gl::Context *context);
Error ValidateCreateImage(const Display *display,
gl::Context *context,
EGLenum target,
EGLClientBuffer buffer,
const AttributeMap &attributes);
Error ValidateDestroyImage(const Display *display, const Image *image);
Error ValidateCreateImageKHR(const Display *display,
gl::Context *context,
EGLenum target,
EGLClientBuffer buffer,
const AttributeMap &attributes);
Error ValidateDestroyImageKHR(const Display *display, const Image *image);
Error ValidateCreateDeviceANGLE(EGLint device_type,
void *native_device,
const EGLAttrib *attrib_list);
Error ValidateReleaseDeviceANGLE(Device *device);
Error ValidateCreateSyncBase(const Display *display,
EGLenum type,
const AttributeMap &attribs,
const Display *currentDisplay,
const gl::Context *currentContext,
bool isExt);
Error ValidateGetSyncAttribBase(const Display *display, const Sync *sync, EGLint attribute);
Error ValidateCreateSyncKHR(const Display *display,
EGLenum type,
const AttributeMap &attribs,
const Display *currentDisplay,
const gl::Context *currentContext);
Error ValidateCreateSync(const Display *display,
EGLenum type,
const AttributeMap &attribs,
const Display *currentDisplay,
const gl::Context *currentContext);
Error ValidateDestroySync(const Display *display, const Sync *sync);
Error ValidateClientWaitSync(const Display *display,
const Sync *sync,
EGLint flags,
EGLTime timeout);
Error ValidateWaitSync(const Display *display,
const gl::Context *context,
const Sync *sync,
EGLint flags);
Error ValidateGetSyncAttribKHR(const Display *display,
const Sync *sync,
EGLint attribute,
EGLint *value);
Error ValidateGetSyncAttrib(const Display *display,
const Sync *sync,
EGLint attribute,
EGLAttrib *value);
Error ValidateCreateStreamKHR(const Display *display, const AttributeMap &attributes);
Error ValidateDestroyStreamKHR(const Display *display, const Stream *stream);
Error ValidateStreamAttribKHR(const Display *display,
const Stream *stream,
EGLint attribute,
EGLint value);
Error ValidateQueryStreamKHR(const Display *display,
const Stream *stream,
EGLenum attribute,
EGLint *value);
Error ValidateQueryStreamu64KHR(const Display *display,
const Stream *stream,
EGLenum attribute,
EGLuint64KHR *value);
Error ValidateStreamConsumerGLTextureExternalKHR(const Display *display,
gl::Context *context,
const Stream *stream);
Error ValidateStreamConsumerAcquireKHR(const Display *display,
gl::Context *context,
const Stream *stream);
Error ValidateStreamConsumerReleaseKHR(const Display *display,
gl::Context *context,
const Stream *stream);
Error ValidateStreamConsumerGLTextureExternalAttribsNV(const Display *display,
gl::Context *context,
const Stream *stream,
const AttributeMap &attribs);
Error ValidateCreateStreamProducerD3DTextureANGLE(const Display *display,
const Stream *stream,
const AttributeMap &attribs);
Error ValidateStreamPostD3DTextureANGLE(const Display *display,
const Stream *stream,
void *texture,
const AttributeMap &attribs);
Error ValidateGetSyncValuesCHROMIUM(const Display *display,
const Surface *surface,
const EGLuint64KHR *ust,
const EGLuint64KHR *msc,
const EGLuint64KHR *sbc);
Error ValidateDestroySurface(const Display *display,
const Surface *surface,
const EGLSurface eglSurface);
Error ValidateDestroyContext(const Display *display,
const gl::Context *glCtx,
const EGLContext eglCtx);
Error ValidateSwapBuffers(Thread *thread, const Display *display, const Surface *surface);
Error ValidateWaitNative(const Display *display, const EGLint engine);
Error ValidateCopyBuffers(Display *display, const Surface *surface);
Error ValidateSwapBuffersWithDamageKHR(const Display *display,
const Surface *surface,
EGLint *rects,
EGLint n_rects);
Error ValidateBindTexImage(const Display *display,
const Surface *surface,
const EGLSurface eglSurface,
const EGLint buffer,
const gl::Context *context,
gl::Texture **textureObject);
Error ValidateReleaseTexImage(const Display *display,
const Surface *surface,
const EGLSurface eglSurface,
const EGLint buffer);
Error ValidateSwapInterval(const Display *display,
const Surface *draw_surface,
const gl::Context *context);
Error ValidateBindAPI(const EGLenum api);
Error ValidatePresentationTimeANDROID(const Display *display,
const Surface *surface,
EGLnsecsANDROID time);
Error ValidateSetBlobCacheANDROID(const Display *display,
EGLSetBlobFuncANDROID set,
EGLGetBlobFuncANDROID get);
Error ValidateGetConfigAttrib(const Display *display, const Config *config, EGLint attribute);
Error ValidateChooseConfig(const Display *display,
const AttributeMap &attribs,
EGLint configSize,
EGLint *numConfig);
Error ValidateGetConfigs(const Display *display, EGLint configSize, EGLint *numConfig);
// Other validation
Error ValidateCompatibleConfigs(const Display *display,
const Config *config1,
const Surface *surface,
const Config *config2,
EGLint surfaceType);
Error ValidateGetPlatformDisplay(EGLenum platform,
void *native_display,
const EGLAttrib *attrib_list);
Error ValidateGetPlatformDisplayEXT(EGLenum platform,
void *native_display,
const EGLint *attrib_list);
Error ValidateCreatePlatformWindowSurfaceEXT(const Display *display,
const Config *configuration,
void *nativeWindow,
const AttributeMap &attributes);
Error ValidateCreatePlatformPixmapSurfaceEXT(const Display *display,
const Config *configuration,
void *nativePixmap,
const AttributeMap &attributes);
Error ValidateProgramCacheGetAttribANGLE(const Display *display, EGLenum attrib);
Error ValidateProgramCacheQueryANGLE(const Display *display,
EGLint index,
void *key,
EGLint *keysize,
void *binary,
EGLint *binarysize);
Error ValidateProgramCachePopulateANGLE(const Display *display,
const void *key,
EGLint keysize,
const void *binary,
EGLint binarysize);
Error ValidateProgramCacheResizeANGLE(const Display *display, EGLint limit, EGLenum mode);
Error ValidateSurfaceAttrib(const Display *display,
const Surface *surface,
EGLint attribute,
EGLint value);
Error ValidateQuerySurface(const Display *display,
const Surface *surface,
EGLint attribute,
EGLint *value);
Error ValidateQueryContext(const Display *display,
const gl::Context *context,
EGLint attribute,
EGLint *value);
// EGL_KHR_debug
Error ValidateDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const AttributeMap &attribs);
Error ValidateQueryDebugKHR(EGLint attribute, EGLAttrib *value);
Error ValidateLabelObjectKHR(Thread *thread,
const Display *display,
ObjectType objectType,
EGLObjectKHR object,
EGLLabelKHR label);
// ANDROID_get_frame_timestamps
Error ValidateGetCompositorTimingSupportedANDROID(const Display *display,
const Surface *surface,
CompositorTiming name);
Error ValidateGetCompositorTimingANDROID(const Display *display,
const Surface *surface,
EGLint numTimestamps,
const EGLint *names,
EGLnsecsANDROID *values);
Error ValidateGetNextFrameIdANDROID(const Display *display,
const Surface *surface,
EGLuint64KHR *frameId);
Error ValidateGetFrameTimestampSupportedANDROID(const Display *display,
const Surface *surface,
Timestamp timestamp);
Error ValidateGetFrameTimestampsANDROID(const Display *display,
const Surface *surface,
EGLuint64KHR frameId,
EGLint numTimestamps,
const EGLint *timestamps,
EGLnsecsANDROID *values);
Error ValidateQueryStringiANGLE(const Display *display, EGLint name, EGLint index);
Error ValidateQueryDisplayAttribEXT(const Display *display, const EGLint attribute);
Error ValidateQueryDisplayAttribANGLE(const Display *display, const EGLint attribute);
// EGL_ANDROID_get_native_client_buffer
Error ValidateGetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer);
// EGL_ANDROID_native_fence_sync
Error ValidateDupNativeFenceFDANDROID(const Display *display, const Sync *sync);
} // namespace egl
#define ANGLE_EGL_TRY(THREAD, EXPR, FUNCNAME, LABELOBJECT) \
do \
{ \
auto ANGLE_LOCAL_VAR = (EXPR); \
if (ANGLE_LOCAL_VAR.isError()) \
return THREAD->setError(ANGLE_LOCAL_VAR, GetDebug(), FUNCNAME, LABELOBJECT); \
} while (0)
#define ANGLE_EGL_TRY_RETURN(THREAD, EXPR, FUNCNAME, LABELOBJECT, RETVAL) \
do \
{ \
auto ANGLE_LOCAL_VAR = (EXPR); \
if (ANGLE_LOCAL_VAR.isError()) \
{ \
THREAD->setError(ANGLE_LOCAL_VAR, GetDebug(), FUNCNAME, LABELOBJECT); \
return RETVAL; \
} \
} while (0)
#endif // LIBANGLE_VALIDATIONEGL_H_
|