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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
//
// Copyright (c) 2002-2014 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.
//
// Context.h: Defines the gl::Context class, managing all GL state and performing
// rendering operations. It is the GLES2 specific implementation of EGLContext.
#ifndef LIBANGLE_CONTEXT_H_
#define LIBANGLE_CONTEXT_H_
#include <set>
#include <string>
#include "angle_gl.h"
#include "common/MemoryBuffer.h"
#include "common/PackedEnums.h"
#include "common/angleutils.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Constants.h"
#include "libANGLE/Context_gl_1_0_autogen.h"
#include "libANGLE/Context_gl_1_1_autogen.h"
#include "libANGLE/Context_gl_1_2_autogen.h"
#include "libANGLE/Context_gl_1_3_autogen.h"
#include "libANGLE/Context_gl_1_4_autogen.h"
#include "libANGLE/Context_gl_1_5_autogen.h"
#include "libANGLE/Context_gl_2_0_autogen.h"
#include "libANGLE/Context_gl_2_1_autogen.h"
#include "libANGLE/Context_gl_3_0_autogen.h"
#include "libANGLE/Context_gl_3_1_autogen.h"
#include "libANGLE/Context_gl_3_2_autogen.h"
#include "libANGLE/Context_gl_3_3_autogen.h"
#include "libANGLE/Context_gl_4_0_autogen.h"
#include "libANGLE/Context_gl_4_1_autogen.h"
#include "libANGLE/Context_gl_4_2_autogen.h"
#include "libANGLE/Context_gl_4_3_autogen.h"
#include "libANGLE/Context_gl_4_4_autogen.h"
#include "libANGLE/Context_gl_4_5_autogen.h"
#include "libANGLE/Context_gl_4_6_autogen.h"
#include "libANGLE/Context_gles_1_0_autogen.h"
#include "libANGLE/Context_gles_2_0_autogen.h"
#include "libANGLE/Context_gles_3_0_autogen.h"
#include "libANGLE/Context_gles_3_1_autogen.h"
#include "libANGLE/Context_gles_ext_autogen.h"
#include "libANGLE/Error.h"
#include "libANGLE/HandleAllocator.h"
#include "libANGLE/RefCountObject.h"
#include "libANGLE/ResourceManager.h"
#include "libANGLE/ResourceMap.h"
#include "libANGLE/State.h"
#include "libANGLE/VertexAttribute.h"
#include "libANGLE/WorkerThread.h"
#include "libANGLE/angletypes.h"
namespace angle
{
class FrameCapture;
struct FrontendFeatures;
} // namespace angle
namespace rx
{
class ContextImpl;
class EGLImplFactory;
} // namespace rx
namespace egl
{
class AttributeMap;
class Surface;
struct Config;
class Thread;
} // namespace egl
namespace gl
{
class Buffer;
class Compiler;
class FenceNV;
class Framebuffer;
class GLES1Renderer;
class MemoryProgramCache;
class MemoryObject;
class Program;
class ProgramPipeline;
class Query;
class Renderbuffer;
class Sampler;
class Semaphore;
class Shader;
class Sync;
class Texture;
class TransformFeedback;
class VertexArray;
struct VertexAttribute;
class ErrorSet : angle::NonCopyable
{
public:
explicit ErrorSet(Context *context);
~ErrorSet();
bool empty() const;
GLenum popError();
void handleError(GLenum errorCode,
const char *message,
const char *file,
const char *function,
unsigned int line);
void validationError(GLenum errorCode, const char *message);
private:
Context *mContext;
std::set<GLenum> mErrors;
};
enum class VertexAttribTypeCase
{
Invalid = 0,
Valid = 1,
ValidSize4Only = 2,
};
// Helper class for managing cache variables and state changes.
class StateCache final : angle::NonCopyable
{
public:
StateCache();
~StateCache();
void initialize(Context *context);
// Places that can trigger updateActiveAttribsMask:
// 1. onVertexArrayBindingChange.
// 2. onProgramExecutableChange.
// 3. onVertexArrayStateChange.
// 4. onGLES1ClientStateChange.
AttributesMask getActiveBufferedAttribsMask() const { return mCachedActiveBufferedAttribsMask; }
AttributesMask getActiveClientAttribsMask() const { return mCachedActiveClientAttribsMask; }
AttributesMask getActiveDefaultAttribsMask() const { return mCachedActiveDefaultAttribsMask; }
bool hasAnyEnabledClientAttrib() const { return mCachedHasAnyEnabledClientAttrib; }
bool hasAnyActiveClientAttrib() const { return mCachedActiveClientAttribsMask.any(); }
// Places that can trigger updateVertexElementLimits:
// 1. onVertexArrayBindingChange.
// 2. onProgramExecutableChange.
// 3. onVertexArrayFormatChange.
// 4. onVertexArrayBufferChange.
// 5. onVertexArrayStateChange.
GLint64 getNonInstancedVertexElementLimit() const
{
return mCachedNonInstancedVertexElementLimit;
}
GLint64 getInstancedVertexElementLimit() const { return mCachedInstancedVertexElementLimit; }
// Places that can trigger updateBasicDrawStatesError:
// 1. onVertexArrayBindingChange.
// 2. onProgramExecutableChange.
// 3. onVertexArrayBufferContentsChange.
// 4. onVertexArrayStateChange.
// 5. onVertexArrayBufferStateChange.
// 6. onDrawFramebufferChange.
// 7. onContextCapChange.
// 8. onStencilStateChange.
// 9. onDefaultVertexAttributeChange.
// 10. onActiveTextureChange.
// 11. onQueryChange.
// 12. onActiveTransformFeedbackChange.
// 13. onUniformBufferStateChange.
// 14. onColorMaskChange.
// 15. onBufferBindingChange.
bool hasBasicDrawStatesError(Context *context) const
{
if (mCachedBasicDrawStatesError == 0)
{
return false;
}
if (mCachedBasicDrawStatesError != kInvalidPointer)
{
return true;
}
return getBasicDrawStatesErrorImpl(context) != 0;
}
intptr_t getBasicDrawStatesError(Context *context) const
{
if (mCachedBasicDrawStatesError != kInvalidPointer)
{
return mCachedBasicDrawStatesError;
}
return getBasicDrawStatesErrorImpl(context);
}
// Places that can trigger updateBasicDrawElementsError:
// 1. onActiveTransformFeedbackChange.
// 2. onVertexArrayBufferStateChange.
// 3. onBufferBindingChange.
intptr_t getBasicDrawElementsError(Context *context) const
{
if (mCachedBasicDrawElementsError != kInvalidPointer)
{
return mCachedBasicDrawElementsError;
}
return getBasicDrawElementsErrorImpl(context);
}
// Places that can trigger updateValidDrawModes:
// 1. onProgramExecutableChange.
// 2. onActiveTransformFeedbackChange.
bool isValidDrawMode(PrimitiveMode primitiveMode) const
{
return mCachedValidDrawModes[primitiveMode];
}
// Cannot change except on Context/Extension init.
bool isValidBindTextureType(TextureType type) const
{
return mCachedValidBindTextureTypes[type];
}
// Cannot change except on Context/Extension init.
bool isValidDrawElementsType(DrawElementsType type) const
{
return mCachedValidDrawElementsTypes[type];
}
// Places that can trigger updateTransformFeedbackActiveUnpaused:
// 1. onActiveTransformFeedbackChange.
bool isTransformFeedbackActiveUnpaused() const
{
return mCachedTransformFeedbackActiveUnpaused;
}
// Cannot change except on Context/Extension init.
VertexAttribTypeCase getVertexAttribTypeValidation(VertexAttribType type) const
{
return mCachedVertexAttribTypesValidation[type];
}
VertexAttribTypeCase getIntegerVertexAttribTypeValidation(VertexAttribType type) const
{
return mCachedIntegerVertexAttribTypesValidation[type];
}
// State change notifications.
void onVertexArrayBindingChange(Context *context);
void onProgramExecutableChange(Context *context);
void onVertexArrayFormatChange(Context *context);
void onVertexArrayBufferContentsChange(Context *context);
void onVertexArrayStateChange(Context *context);
void onVertexArrayBufferStateChange(Context *context);
void onGLES1ClientStateChange(Context *context);
void onDrawFramebufferChange(Context *context);
void onContextCapChange(Context *context);
void onStencilStateChange(Context *context);
void onDefaultVertexAttributeChange(Context *context);
void onActiveTextureChange(Context *context);
void onQueryChange(Context *context);
void onActiveTransformFeedbackChange(Context *context);
void onUniformBufferStateChange(Context *context);
void onColorMaskChange(Context *context);
void onBufferBindingChange(Context *context);
private:
// Cache update functions.
void updateActiveAttribsMask(Context *context);
void updateVertexElementLimits(Context *context);
void updateVertexElementLimitsImpl(Context *context);
void updateValidDrawModes(Context *context);
void updateValidBindTextureTypes(Context *context);
void updateValidDrawElementsTypes(Context *context);
void updateBasicDrawStatesError();
void updateBasicDrawElementsError();
void updateTransformFeedbackActiveUnpaused(Context *context);
void updateVertexAttribTypesValidation(Context *context);
void setValidDrawModes(bool pointsOK, bool linesOK, bool trisOK, bool lineAdjOK, bool triAdjOK);
intptr_t getBasicDrawStatesErrorImpl(Context *context) const;
intptr_t getBasicDrawElementsErrorImpl(Context *context) const;
static constexpr intptr_t kInvalidPointer = 1;
AttributesMask mCachedActiveBufferedAttribsMask;
AttributesMask mCachedActiveClientAttribsMask;
AttributesMask mCachedActiveDefaultAttribsMask;
bool mCachedHasAnyEnabledClientAttrib;
GLint64 mCachedNonInstancedVertexElementLimit;
GLint64 mCachedInstancedVertexElementLimit;
mutable intptr_t mCachedBasicDrawStatesError;
mutable intptr_t mCachedBasicDrawElementsError;
bool mCachedTransformFeedbackActiveUnpaused;
// Reserve an extra slot at the end of these maps for invalid enum.
angle::PackedEnumMap<PrimitiveMode, bool, angle::EnumSize<PrimitiveMode>() + 1>
mCachedValidDrawModes;
angle::PackedEnumMap<TextureType, bool, angle::EnumSize<TextureType>() + 1>
mCachedValidBindTextureTypes;
angle::PackedEnumMap<DrawElementsType, bool, angle::EnumSize<DrawElementsType>() + 1>
mCachedValidDrawElementsTypes;
angle::PackedEnumMap<VertexAttribType,
VertexAttribTypeCase,
angle::EnumSize<VertexAttribType>() + 1>
mCachedVertexAttribTypesValidation;
angle::PackedEnumMap<VertexAttribType,
VertexAttribTypeCase,
angle::EnumSize<VertexAttribType>() + 1>
mCachedIntegerVertexAttribTypesValidation;
};
class Context final : public egl::LabeledObject, angle::NonCopyable, public angle::ObserverInterface
{
public:
Context(egl::Display *display,
const egl::Config *config,
const Context *shareContext,
TextureManager *shareTextures,
MemoryProgramCache *memoryProgramCache,
const EGLenum clientType,
const egl::AttributeMap &attribs,
const egl::DisplayExtensions &displayExtensions,
const egl::ClientExtensions &clientExtensions);
egl::Error onDestroy(const egl::Display *display);
~Context() override;
void setLabel(EGLLabelKHR label) override;
EGLLabelKHR getLabel() const override;
egl::Error makeCurrent(egl::Display *display, egl::Surface *surface);
egl::Error unMakeCurrent(const egl::Display *display);
// These create and destroy methods are merely pass-throughs to
// ResourceManager, which owns these object types
GLuint createBuffer();
GLuint createTexture();
GLuint createRenderbuffer();
GLuint createProgramPipeline();
GLuint createMemoryObject();
GLuint createSemaphore();
void deleteBuffer(GLuint buffer);
void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer);
void deleteProgramPipeline(GLuint pipeline);
void deleteMemoryObject(GLuint memoryObject);
void deleteSemaphore(GLuint semaphore);
// CHROMIUM_path_rendering
bool isPathGenerated(GLuint path) const;
void bindReadFramebuffer(GLuint framebufferHandle);
void bindDrawFramebuffer(GLuint framebufferHandle);
Buffer *getBuffer(GLuint handle) const;
FenceNV *getFenceNV(GLuint handle);
Sync *getSync(GLsync handle) const;
ANGLE_INLINE Texture *getTexture(GLuint handle) const
{
return mState.mTextureManager->getTexture(handle);
}
Framebuffer *getFramebuffer(GLuint handle) const;
Renderbuffer *getRenderbuffer(GLuint handle) const;
VertexArray *getVertexArray(GLuint handle) const;
Sampler *getSampler(GLuint handle) const;
Query *getQuery(GLuint handle, bool create, QueryType type);
Query *getQuery(GLuint handle) const;
TransformFeedback *getTransformFeedback(GLuint handle) const;
ProgramPipeline *getProgramPipeline(GLuint handle) const;
MemoryObject *getMemoryObject(GLuint handle) const;
Semaphore *getSemaphore(GLuint handle) const;
Texture *getTextureByType(TextureType type) const;
Texture *getTextureByTarget(TextureTarget target) const;
Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
Compiler *getCompiler() const;
bool isVertexArrayGenerated(GLuint vertexArray);
bool isTransformFeedbackGenerated(GLuint vertexArray);
void getBooleanvImpl(GLenum pname, GLboolean *params);
void getFloatvImpl(GLenum pname, GLfloat *params);
void getIntegervImpl(GLenum pname, GLint *params);
void getInteger64vImpl(GLenum pname, GLint64 *params);
void getPointerv(GLenum pname, void **params) const;
// Framebuffers are owned by the Context, so these methods do not pass through
GLuint createFramebuffer();
void deleteFramebuffer(GLuint framebuffer);
bool hasActiveTransformFeedback(GLuint program) const;
// GL emulation: Interface to entry points
ANGLE_GL_1_0_CONTEXT_API
ANGLE_GL_1_1_CONTEXT_API
ANGLE_GL_1_2_CONTEXT_API
ANGLE_GL_1_3_CONTEXT_API
ANGLE_GL_1_4_CONTEXT_API
ANGLE_GL_1_5_CONTEXT_API
ANGLE_GL_2_0_CONTEXT_API
ANGLE_GL_2_1_CONTEXT_API
ANGLE_GL_3_0_CONTEXT_API
ANGLE_GL_3_1_CONTEXT_API
ANGLE_GL_3_2_CONTEXT_API
ANGLE_GL_3_3_CONTEXT_API
ANGLE_GL_4_0_CONTEXT_API
ANGLE_GL_4_1_CONTEXT_API
ANGLE_GL_4_2_CONTEXT_API
ANGLE_GL_4_3_CONTEXT_API
ANGLE_GL_4_4_CONTEXT_API
ANGLE_GL_4_5_CONTEXT_API
ANGLE_GL_4_6_CONTEXT_API
// GLES emulation: Interface to entry points
ANGLE_GLES_1_0_CONTEXT_API
ANGLE_GLES_2_0_CONTEXT_API
ANGLE_GLES_3_0_CONTEXT_API
ANGLE_GLES_3_1_CONTEXT_API
ANGLE_GLES_EXT_CONTEXT_API
// Consumes an error.
void handleError(GLenum errorCode,
const char *message,
const char *file,
const char *function,
unsigned int line);
void validationError(GLenum errorCode, const char *message);
void markContextLost(GraphicsResetStatus status);
bool isContextLost() const { return mContextLost; }
GLenum getGraphicsResetStrategy() const { return mResetStrategy; }
bool isResetNotificationEnabled();
const egl::Config *getConfig() const;
EGLenum getClientType() const;
EGLenum getRenderBuffer() const;
const GLubyte *getString(GLenum name) const;
const GLubyte *getStringi(GLenum name, GLuint index) const;
size_t getExtensionStringCount() const;
bool isExtensionRequestable(const char *name);
size_t getRequestableExtensionStringCount() const;
rx::ContextImpl *getImplementation() const { return mImplementation.get(); }
ANGLE_NO_DISCARD bool getScratchBuffer(size_t requestedSizeBytes,
angle::MemoryBuffer **scratchBufferOut) const;
ANGLE_NO_DISCARD bool getZeroFilledBuffer(size_t requstedSizeBytes,
angle::MemoryBuffer **zeroBufferOut) const;
angle::ScratchBuffer *getScratchBuffer() const { return &mScratchBuffer; }
angle::Result prepareForDispatch();
MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
bool hasBeenCurrent() const { return mHasBeenCurrent; }
egl::Display *getDisplay() const { return mDisplay; }
egl::Surface *getCurrentDrawSurface() const { return mCurrentSurface; }
egl::Surface *getCurrentReadSurface() const { return mCurrentSurface; }
bool isRobustResourceInitEnabled() const { return mState.isRobustResourceInitEnabled(); }
bool isCurrentTransformFeedback(const TransformFeedback *tf) const;
bool isCurrentVertexArray(const VertexArray *va) const
{
return mState.isCurrentVertexArray(va);
}
const State &getState() const { return mState; }
GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); }
GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); }
const Version &getClientVersion() const { return mState.getClientVersion(); }
const Caps &getCaps() const { return mState.getCaps(); }
const TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); }
const Extensions &getExtensions() const { return mState.getExtensions(); }
const Limitations &getLimitations() const { return mState.getLimitations(); }
bool skipValidation() const { return mSkipValidation; }
bool isGLES1() const;
// Specific methods needed for validation.
bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const;
bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams) const;
ANGLE_INLINE Program *getProgramResolveLink(GLuint handle) const
{
Program *program = mState.mShaderProgramManager->getProgram(handle);
if (program)
{
program->resolveLink(this);
}
return program;
}
Program *getProgramNoResolveLink(GLuint handle) const;
Shader *getShader(GLuint handle) const;
ANGLE_INLINE bool isTextureGenerated(GLuint texture) const
{
return mState.mTextureManager->isHandleGenerated(texture);
}
ANGLE_INLINE bool isBufferGenerated(GLuint buffer) const
{
return mState.mBufferManager->isHandleGenerated(buffer);
}
bool isRenderbufferGenerated(GLuint renderbuffer) const;
bool isFramebufferGenerated(GLuint framebuffer) const;
bool isProgramPipelineGenerated(GLuint pipeline) const;
bool usingDisplayTextureShareGroup() const;
// Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
GLenum getConvertedRenderbufferFormat(GLenum internalformat) const;
bool isWebGL() const { return mState.isWebGL(); }
bool isWebGL1() const { return mState.isWebGL1(); }
bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; }
// GLES1 emulation: Renderer level (for validation)
int vertexArrayIndex(ClientVertexArrayType type) const;
static int TexCoordArrayIndex(unsigned int unit);
// GL_KHR_parallel_shader_compile
std::shared_ptr<angle::WorkerThreadPool> getWorkerThreadPool() const { return mThreadPool; }
const StateCache &getStateCache() const { return mStateCache; }
StateCache &getStateCache() { return mStateCache; }
void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
void onSamplerUniformChange(size_t textureUnitIndex);
bool isBufferAccessValidationEnabled() const { return mBufferAccessValidationEnabled; }
const angle::FrontendFeatures &getFrontendFeatures() const;
angle::FrameCapture *getFrameCapture();
private:
void initialize();
bool noopDraw(PrimitiveMode mode, GLsizei count);
bool noopDrawInstanced(PrimitiveMode mode, GLsizei count, GLsizei instanceCount);
angle::Result prepareForDraw(PrimitiveMode mode);
angle::Result prepareForClear(GLbitfield mask);
angle::Result prepareForClearBuffer(GLenum buffer, GLint drawbuffer);
angle::Result syncState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask);
angle::Result syncDirtyBits();
angle::Result syncDirtyBits(const State::DirtyBits &bitMask);
angle::Result syncDirtyObjects(const State::DirtyObjects &objectMask);
angle::Result syncStateForReadPixels();
angle::Result syncStateForTexImage();
angle::Result syncStateForBlit();
angle::Result syncStateForPathOperation();
VertexArray *checkVertexArrayAllocation(GLuint vertexArrayHandle);
TransformFeedback *checkTransformFeedbackAllocation(GLuint transformFeedback);
angle::Result onProgramLink(Program *programObject);
void detachBuffer(Buffer *buffer);
void detachTexture(GLuint texture);
void detachFramebuffer(GLuint framebuffer);
void detachRenderbuffer(GLuint renderbuffer);
void detachVertexArray(GLuint vertexArray);
void detachTransformFeedback(GLuint transformFeedback);
void detachSampler(GLuint sampler);
void detachProgramPipeline(GLuint pipeline);
// A small helper method to facilitate using the ANGLE_CONTEXT_TRY macro.
void tryGenPaths(GLsizei range, GLuint *createdOut);
egl::Error setDefaultFramebuffer(egl::Surface *surface);
egl::Error unsetDefaultFramebuffer();
void initRendererString();
void initVersionStrings();
void initExtensionStrings();
Extensions generateSupportedExtensions() const;
void initCaps();
void updateCaps();
gl::LabeledObject *getLabeledObject(GLenum identifier, GLuint name) const;
gl::LabeledObject *getLabeledObjectFromPtr(const void *ptr) const;
void setUniform1iImpl(Program *program, GLint location, GLsizei count, const GLint *v);
State mState;
bool mSkipValidation;
bool mDisplayTextureShareGroup;
// Recorded errors
ErrorSet mErrors;
// Stores for each buffer binding type whether is it allowed to be used in this context.
angle::PackedEnumBitSet<BufferBinding> mValidBufferBindings;
std::unique_ptr<rx::ContextImpl> mImplementation;
EGLLabelKHR mLabel;
// Extensions supported by the implementation plus extensions that are implemented entirely
// within the frontend.
Extensions mSupportedExtensions;
// Shader compiler. Lazily initialized hence the mutable value.
mutable BindingPointer<Compiler> mCompiler;
const egl::Config *mConfig;
TextureMap mZeroTextures;
ResourceMap<FenceNV> mFenceNVMap;
HandleAllocator mFenceNVHandleAllocator;
ResourceMap<Query> mQueryMap;
HandleAllocator mQueryHandleAllocator;
ResourceMap<VertexArray> mVertexArrayMap;
HandleAllocator mVertexArrayHandleAllocator;
ResourceMap<TransformFeedback> mTransformFeedbackMap;
HandleAllocator mTransformFeedbackHandleAllocator;
const char *mVersionString;
const char *mShadingLanguageString;
const char *mRendererString;
const char *mExtensionString;
std::vector<const char *> mExtensionStrings;
const char *mRequestableExtensionString;
std::vector<const char *> mRequestableExtensionStrings;
// GLES1 renderer state
std::unique_ptr<GLES1Renderer> mGLES1Renderer;
// Current/lost context flags
bool mHasBeenCurrent;
bool mContextLost;
GraphicsResetStatus mResetStatus;
bool mContextLostForced;
GLenum mResetStrategy;
const bool mRobustAccess;
const bool mSurfacelessSupported;
const bool mExplicitContextAvailable;
egl::Surface *mCurrentSurface;
egl::Display *mDisplay;
const bool mWebGLContext;
bool mBufferAccessValidationEnabled;
const bool mExtensionsEnabled;
MemoryProgramCache *mMemoryProgramCache;
State::DirtyObjects mDrawDirtyObjects;
State::DirtyObjects mPathOperationDirtyObjects;
StateCache mStateCache;
State::DirtyBits mAllDirtyBits;
State::DirtyBits mTexImageDirtyBits;
State::DirtyObjects mTexImageDirtyObjects;
State::DirtyBits mReadPixelsDirtyBits;
State::DirtyObjects mReadPixelsDirtyObjects;
State::DirtyBits mClearDirtyBits;
State::DirtyObjects mClearDirtyObjects;
State::DirtyBits mBlitDirtyBits;
State::DirtyObjects mBlitDirtyObjects;
State::DirtyBits mComputeDirtyBits;
State::DirtyObjects mComputeDirtyObjects;
State::DirtyObjects mCopyImageDirtyObjects;
// Binding to container objects that use dependent state updates.
angle::ObserverBinding mVertexArrayObserverBinding;
angle::ObserverBinding mDrawFramebufferObserverBinding;
angle::ObserverBinding mReadFramebufferObserverBinding;
std::vector<angle::ObserverBinding> mUniformBufferObserverBindings;
std::vector<angle::ObserverBinding> mSamplerObserverBindings;
// Not really a property of context state. The size and contexts change per-api-call.
mutable angle::ScratchBuffer mScratchBuffer;
mutable angle::ScratchBuffer mZeroFilledBuffer;
std::shared_ptr<angle::WorkerThreadPool> mThreadPool;
};
} // namespace gl
#endif // LIBANGLE_CONTEXT_H_
|