summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-18 15:16:30 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-05-26 15:11:40 +0200
commit752497910b67b2a1a80560840ca44548d8893434 (patch)
tree541501c9abfd97c3d2fa450d2e6abb60582c4420 /src/3rdparty/angle/src/libANGLE
parent7db527dbdd911c79f31425d099d1fc9c63e42453 (diff)
Remove ANGLE
This marks the end of EGL and OpenGL ES support on Windows. The concepts of -opengl dynamic, -opengl desktop, QT_OPENGL=software, etc. remain unchanged, with the exception of the disapperance of everything ANGLE related. CMake builds now work identically to qmake on Windows: they default to 'dynamic' OpenGL on Windows, unless -DINPUT_opengl=desktop is specified. On Windows, Qt 6 is expected to default to the "dynamic" OpenGL model by default, just like Qt 5.15. This can be changed by switching to "desktop" OpenGL, which will link to opengl32 (publicly, so other libs and applications will do so as well) and disallows using another OpenGL DLL. The "dynamic" mode is essential still because the fallback to a software rasterizer, such as the opengl32sw.dll we ship with the Qt packages, has to to work exactly like in Qt 5, the removal of ANGLE does not change this concept in any way (except of course that the middle option of using ANGLE is now gone) When it comes to the windows plugin's OpenGL blacklist feature, it works like before and accepts the ANGLE/D3D related keywords. They will then be ignored. Similarly, requesting QT_OPENGL=angle is ignored (but will show a warning). The D3D11 and DXGI configure time tests are removed: Qt 5.14 already depends on D3D 11.1 and DXGI 1.3 headers being available unconditionally on Win32 (in QRhi's D3D11 backend). No need to test for these. [ChangeLog][Windows] ANGLE is no longer included with Qt. Dynamic OpenGL builds work like before but ANGLE is no longer an option. OpenGL proper or an alternative opengl32 implementation are the two remaining options now. Attempting to set QT_OPENGL=angle or Qt::AA_UseOpenGLES will have no effect on Windows. Fixes: QTBUG-79103 Change-Id: Ia404e0d07f3fe191b27434d863c81180112ecb3b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE')
-rw-r--r--src/3rdparty/angle/src/libANGLE/AttributeMap.cpp110
-rw-r--r--src/3rdparty/angle/src/libANGLE/AttributeMap.h49
-rw-r--r--src/3rdparty/angle/src/libANGLE/BinaryStream.h261
-rw-r--r--src/3rdparty/angle/src/libANGLE/Buffer.cpp215
-rw-r--r--src/3rdparty/angle/src/libANGLE/Buffer.h123
-rw-r--r--src/3rdparty/angle/src/libANGLE/Caps.cpp1213
-rw-r--r--src/3rdparty/angle/src/libANGLE/Caps.h758
-rw-r--r--src/3rdparty/angle/src/libANGLE/Compiler.cpp221
-rw-r--r--src/3rdparty/angle/src/libANGLE/Compiler.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/Config.cpp309
-rw-r--r--src/3rdparty/angle/src/libANGLE/Config.h101
-rw-r--r--src/3rdparty/angle/src/libANGLE/Constants.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/Context.cpp5558
-rw-r--r--src/3rdparty/angle/src/libANGLE/Context.h1154
-rw-r--r--src/3rdparty/angle/src/libANGLE/ContextState.cpp839
-rw-r--r--src/3rdparty/angle/src/libANGLE/ContextState.h164
-rw-r--r--src/3rdparty/angle/src/libANGLE/Debug.cpp327
-rw-r--r--src/3rdparty/angle/src/libANGLE/Debug.h129
-rw-r--r--src/3rdparty/angle/src/libANGLE/Device.cpp125
-rw-r--r--src/3rdparty/angle/src/libANGLE/Device.h58
-rw-r--r--src/3rdparty/angle/src/libANGLE/Display.cpp1240
-rw-r--r--src/3rdparty/angle/src/libANGLE/Display.h219
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.cpp110
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.h267
-rw-r--r--src/3rdparty/angle/src/libANGLE/Error.inl189
-rw-r--r--src/3rdparty/angle/src/libANGLE/ErrorStrings.h173
-rw-r--r--src/3rdparty/angle/src/libANGLE/Fence.cpp135
-rw-r--r--src/3rdparty/angle/src/libANGLE/Fence.h81
-rw-r--r--src/3rdparty/angle/src/libANGLE/Framebuffer.cpp2182
-rw-r--r--src/3rdparty/angle/src/libANGLE/Framebuffer.h389
-rw-r--r--src/3rdparty/angle/src/libANGLE/FramebufferAttachment.cpp385
-rw-r--r--src/3rdparty/angle/src/libANGLE/FramebufferAttachment.h250
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleAllocator.cpp142
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleAllocator.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.cpp229
-rw-r--r--src/3rdparty/angle/src/libANGLE/HandleRangeAllocator.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/Image.cpp245
-rw-r--r--src/3rdparty/angle/src/libANGLE/Image.h115
-rw-r--r--src/3rdparty/angle/src/libANGLE/ImageIndex.cpp249
-rw-r--r--src/3rdparty/angle/src/libANGLE/ImageIndex.h91
-rw-r--r--src/3rdparty/angle/src/libANGLE/IndexRangeCache.cpp121
-rw-r--r--src/3rdparty/angle/src/libANGLE/IndexRangeCache.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/LoggingAnnotator.cpp44
-rw-r--r--src/3rdparty/angle/src/libANGLE/LoggingAnnotator.h31
-rw-r--r--src/3rdparty/angle/src/libANGLE/MemoryProgramCache.cpp772
-rw-r--r--src/3rdparty/angle/src/libANGLE/MemoryProgramCache.h130
-rw-r--r--src/3rdparty/angle/src/libANGLE/PackedGLEnums.h111
-rw-r--r--src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.cpp174
-rw-r--r--src/3rdparty/angle/src/libANGLE/PackedGLEnums_autogen.h84
-rw-r--r--src/3rdparty/angle/src/libANGLE/Path.cpp78
-rw-r--r--src/3rdparty/angle/src/libANGLE/Path.h71
-rw-r--r--src/3rdparty/angle/src/libANGLE/Platform.cpp69
-rw-r--r--src/3rdparty/angle/src/libANGLE/Program.cpp3066
-rw-r--r--src/3rdparty/angle/src/libANGLE/Program.h735
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.cpp1040
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramLinkedResources.h274
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramPipeline.cpp65
-rw-r--r--src/3rdparty/angle/src/libANGLE/ProgramPipeline.h65
-rw-r--r--src/3rdparty/angle/src/libANGLE/Query.cpp87
-rw-r--r--src/3rdparty/angle/src/libANGLE/Query.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/RefCountObject.h187
-rw-r--r--src/3rdparty/angle/src/libANGLE/Renderbuffer.cpp235
-rw-r--r--src/3rdparty/angle/src/libANGLE/Renderbuffer.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/ResourceManager.cpp483
-rw-r--r--src/3rdparty/angle/src/libANGLE/ResourceManager.h289
-rw-r--r--src/3rdparty/angle/src/libANGLE/ResourceMap.h305
-rw-r--r--src/3rdparty/angle/src/libANGLE/Sampler.cpp169
-rw-r--r--src/3rdparty/angle/src/libANGLE/Sampler.h85
-rw-r--r--src/3rdparty/angle/src/libANGLE/Shader.cpp561
-rw-r--r--src/3rdparty/angle/src/libANGLE/Shader.h212
-rw-r--r--src/3rdparty/angle/src/libANGLE/SizedMRUCache.h174
-rw-r--r--src/3rdparty/angle/src/libANGLE/State.cpp2433
-rw-r--r--src/3rdparty/angle/src/libANGLE/State.h602
-rw-r--r--src/3rdparty/angle/src/libANGLE/Stream.cpp271
-rw-r--r--src/3rdparty/angle/src/libANGLE/Stream.h143
-rw-r--r--src/3rdparty/angle/src/libANGLE/Surface.cpp484
-rw-r--r--src/3rdparty/angle/src/libANGLE/Surface.h238
-rw-r--r--src/3rdparty/angle/src/libANGLE/Texture.cpp1484
-rw-r--r--src/3rdparty/angle/src/libANGLE/Texture.h471
-rw-r--r--src/3rdparty/angle/src/libANGLE/Thread.cpp91
-rw-r--r--src/3rdparty/angle/src/libANGLE/Thread.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/TransformFeedback.cpp221
-rw-r--r--src/3rdparty/angle/src/libANGLE/TransformFeedback.h101
-rw-r--r--src/3rdparty/angle/src/libANGLE/Uniform.cpp226
-rw-r--r--src/3rdparty/angle/src/libANGLE/Uniform.h126
-rw-r--r--src/3rdparty/angle/src/libANGLE/VaryingPacking.cpp408
-rw-r--r--src/3rdparty/angle/src/libANGLE/VaryingPacking.h184
-rw-r--r--src/3rdparty/angle/src/libANGLE/Version.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/Version.inl59
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexArray.cpp267
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexArray.h205
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp162
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.h107
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.inl58
-rw-r--r--src/3rdparty/angle/src/libANGLE/Workarounds.h29
-rw-r--r--src/3rdparty/angle/src/libANGLE/WorkerThread.cpp157
-rw-r--r--src/3rdparty/angle/src/libANGLE/WorkerThread.h284
-rw-r--r--src/3rdparty/angle/src/libANGLE/angletypes.cpp259
-rw-r--r--src/3rdparty/angle/src/libANGLE/angletypes.h487
-rw-r--r--src/3rdparty/angle/src/libANGLE/angletypes.inl35
-rw-r--r--src/3rdparty/angle/src/libANGLE/entry_points_enum_autogen.h336
-rw-r--r--src/3rdparty/angle/src/libANGLE/es3_copy_conversion_formats.json44
-rw-r--r--src/3rdparty/angle/src/libANGLE/es3_copy_conversion_table_autogen.cpp171
-rw-r--r--src/3rdparty/angle/src/libANGLE/es3_format_type_combinations.json171
-rw-r--r--src/3rdparty/angle/src/libANGLE/features.h65
-rw-r--r--src/3rdparty/angle/src/libANGLE/format_map_autogen.cpp1570
-rw-r--r--src/3rdparty/angle/src/libANGLE/format_map_data.json142
-rw-r--r--src/3rdparty/angle/src/libANGLE/formatutils.cpp2133
-rw-r--r--src/3rdparty/angle/src/libANGLE/formatutils.h329
-rw-r--r--src/3rdparty/angle/src/libANGLE/histogram_macros.h112
-rw-r--r--src/3rdparty/angle/src/libANGLE/packed_gl_enums.json35
-rw-r--r--src/3rdparty/angle/src/libANGLE/params.cpp68
-rw-r--r--src/3rdparty/angle/src/libANGLE/params.h228
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryconversions.cpp283
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryconversions.h117
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryutils.cpp1916
-rw-r--r--src/3rdparty/angle/src/libANGLE/queryutils.h162
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/BufferImpl.h69
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/BufferImpl_mock.h48
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/CompilerImpl.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.cpp119
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ContextImpl.h186
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.cpp22
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DeviceImpl.h37
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.cpp58
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/DisplayImpl.h96
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/EGLImplFactory.h68
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FenceNVImpl.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/Format.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/Format_ID_autogen.inl147
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/Format_table_autogen.cpp434
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h54
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl.h95
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/FramebufferImpl_mock.h73
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/GLImplFactory.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ImageImpl.h42
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ImageImpl_mock.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/PathImpl.h36
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl.h107
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ProgramImpl_mock.h84
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ProgramPipelineImpl.h32
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/QueryImpl.h44
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl.h50
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/RenderbufferImpl_mock.h40
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SamplerImpl.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/ShaderImpl.h40
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/StreamProducerImpl.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.cpp28
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SurfaceImpl.h73
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/SyncImpl.h34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.cpp63
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TextureImpl.h159
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TextureImpl_mock.h131
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/TransformFeedbackImpl_mock.h41
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/VertexArrayImpl.h37
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/angle_format_data.json24
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/angle_format_map.json132
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp190
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/BufferD3D.h89
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.cpp30
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/CompilerD3D.h33
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.cpp105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DeviceD3D.h39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp361
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DisplayD3D.h83
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp1427
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/DynamicHLSL.h175
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.cpp87
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/EGLImageD3D.h55
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp405
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/FramebufferD3D.h134
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp354
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/HLSLCompiler.h64
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ImageD3D.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.cpp189
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexBuffer.h100
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.cpp320
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/IndexDataManager.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp23
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/NativeWindowD3D.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp2867
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ProgramD3D.h523
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp36
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderTargetD3D.h47
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp130
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.cpp260
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h359
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SamplerD3D.h25
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp247
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderD3D.h99
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp71
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h57
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp509
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h136
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp34
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h83
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp3974
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureD3D.h891
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/TextureStorage.h82
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.cpp293
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexBuffer.h175
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp646
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/VertexDataManager.h152
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp2153
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.h332
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp1600
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h189
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp833
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.h100
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp405
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h155
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp119
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h37
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp240
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp507
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h104
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp657
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Image11.h112
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp159
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h50
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp503
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h135
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp258
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp24
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h27
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp375
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.h68
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp273
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h123
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp405
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h131
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp4089
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h576
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp533
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h366
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp119
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp3075
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.h557
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.cpp102
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/StreamProducerNV12.h44
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp1075
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h137
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp3155
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h589
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp124
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h60
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp100
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Trim11.h43
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp413
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h99
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp184
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h62
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.h40
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl386
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json118
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp516
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json1279
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp3042
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h49
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp1023
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h71
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp2421
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h431
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl77
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl635
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/MultiplyAlpha.hlsl131
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl122
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl146
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/ResolveDepthStencil.hlsl56
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl99
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h155
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_data.json523
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_map.json78
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp35
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h105
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp1938
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h85
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp217
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h53
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp208
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h90
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp297
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h136
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp126
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp359
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h93
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp829
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.h153
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp139
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp303
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h151
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp36
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h29
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp91
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Fence9.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp411
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h63
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp920
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Image9.h102
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp168
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h49
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp39
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h35
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.cpp188
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Query9.h48
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp163
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h98
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp3310
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h543
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h106
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp47
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h35
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp945
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.h209
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp467
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h81
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp647
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h154
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h46
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp169
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h53
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp257
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h65
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp652
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h94
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp671
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h95
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps67
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs29
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h200
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/formatutilsD3D.h38
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/driver_utils.cpp120
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/driver_utils.h73
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/load_functions_data.json602
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/load_functions_table.h22
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/load_functions_table_autogen.cpp2459
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.cpp549
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/renderer_utils.h254
-rw-r--r--src/3rdparty/angle/src/libANGLE/signal_utils.h187
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationEGL.cpp2501
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationEGL.h182
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES.cpp5828
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES.h601
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES2.cpp6351
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES2.h687
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES3.cpp3702
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES3.h614
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES31.cpp1786
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationES31.h325
358 files changed, 0 insertions, 146543 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/AttributeMap.cpp b/src/3rdparty/angle/src/libANGLE/AttributeMap.cpp
deleted file mode 100644
index e10d3add7c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/AttributeMap.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-#include "libANGLE/AttributeMap.h"
-
-#include "common/debug.h"
-
-namespace egl
-{
-
-AttributeMap::AttributeMap()
-{
-}
-
-AttributeMap::AttributeMap(const AttributeMap &other) = default;
-
-AttributeMap::~AttributeMap() = default;
-
-void AttributeMap::insert(EGLAttrib key, EGLAttrib value)
-{
- mAttributes[key] = value;
-}
-
-bool AttributeMap::contains(EGLAttrib key) const
-{
- return (mAttributes.find(key) != mAttributes.end());
-}
-
-EGLAttrib AttributeMap::get(EGLAttrib key) const
-{
- auto iter = mAttributes.find(key);
- ASSERT(iter != mAttributes.end());
- return iter->second;
-}
-
-EGLAttrib AttributeMap::get(EGLAttrib key, EGLAttrib defaultValue) const
-{
- auto iter = mAttributes.find(key);
- return (mAttributes.find(key) != mAttributes.end()) ? iter->second : defaultValue;
-}
-
-EGLint AttributeMap::getAsInt(EGLAttrib key) const
-{
- return static_cast<EGLint>(get(key));
-}
-
-EGLint AttributeMap::getAsInt(EGLAttrib key, EGLint defaultValue) const
-{
- return static_cast<EGLint>(get(key, static_cast<EGLAttrib>(defaultValue)));
-}
-
-bool AttributeMap::isEmpty() const
-{
- return mAttributes.empty();
-}
-
-std::vector<EGLint> AttributeMap::toIntVector() const
-{
- std::vector<EGLint> ret;
- for (const auto &pair : mAttributes)
- {
- ret.push_back(static_cast<EGLint>(pair.first));
- ret.push_back(static_cast<EGLint>(pair.second));
- }
- ret.push_back(EGL_NONE);
-
- return ret;
-}
-
-AttributeMap::const_iterator AttributeMap::begin() const
-{
- return mAttributes.begin();
-}
-
-AttributeMap::const_iterator AttributeMap::end() const
-{
- return mAttributes.end();
-}
-
-// static
-AttributeMap AttributeMap::CreateFromIntArray(const EGLint *attributes)
-{
- AttributeMap map;
- if (attributes)
- {
- for (const EGLint *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2)
- {
- map.insert(static_cast<EGLAttrib>(curAttrib[0]), static_cast<EGLAttrib>(curAttrib[1]));
- }
- }
- return map;
-}
-
-// static
-AttributeMap AttributeMap::CreateFromAttribArray(const EGLAttrib *attributes)
-{
- AttributeMap map;
- if (attributes)
- {
- for (const EGLAttrib *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2)
- {
- map.insert(curAttrib[0], curAttrib[1]);
- }
- }
- return map;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/AttributeMap.h b/src/3rdparty/angle/src/libANGLE/AttributeMap.h
deleted file mode 100644
index eddc1b72d0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/AttributeMap.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-#ifndef LIBANGLE_ATTRIBUTEMAP_H_
-#define LIBANGLE_ATTRIBUTEMAP_H_
-
-
-#include <EGL/egl.h>
-
-#include <map>
-#include <vector>
-
-namespace egl
-{
-
-class AttributeMap final
-{
- public:
- AttributeMap();
- AttributeMap(const AttributeMap &other);
- ~AttributeMap();
-
- void insert(EGLAttrib key, EGLAttrib value);
- bool contains(EGLAttrib key) const;
- EGLAttrib get(EGLAttrib key) const;
- EGLAttrib get(EGLAttrib key, EGLAttrib defaultValue) const;
- EGLint getAsInt(EGLAttrib key) const;
- EGLint getAsInt(EGLAttrib key, EGLint defaultValue) const;
- bool isEmpty() const;
- std::vector<EGLint> toIntVector() const;
-
- typedef std::map<EGLAttrib, EGLAttrib>::const_iterator const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- static AttributeMap CreateFromIntArray(const EGLint *attributes);
- static AttributeMap CreateFromAttribArray(const EGLAttrib *attributes);
-
- private:
- std::map<EGLAttrib, EGLAttrib> mAttributes;
-};
-
-}
-
-#endif // LIBANGLE_ATTRIBUTEMAP_H_
diff --git a/src/3rdparty/angle/src/libANGLE/BinaryStream.h b/src/3rdparty/angle/src/libANGLE/BinaryStream.h
deleted file mode 100644
index 3e4c0934cf..0000000000
--- a/src/3rdparty/angle/src/libANGLE/BinaryStream.h
+++ /dev/null
@@ -1,261 +0,0 @@
-//
-// Copyright (c) 2012 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.
-//
-
-// BinaryStream.h: Provides binary serialization of simple types.
-
-#ifndef LIBANGLE_BINARYSTREAM_H_
-#define LIBANGLE_BINARYSTREAM_H_
-
-#include <cstddef>
-#include <string>
-#include <vector>
-#include <stdint.h>
-
-#include "common/angleutils.h"
-#include "common/mathutil.h"
-
-namespace gl
-{
-
-class BinaryInputStream : angle::NonCopyable
-{
- public:
- BinaryInputStream(const void *data, size_t length)
- {
- mError = false;
- mOffset = 0;
- mData = static_cast<const uint8_t*>(data);
- mLength = length;
- }
-
- // readInt will generate an error for bool types
- template <class IntT>
- IntT readInt()
- {
- int value = 0;
- read(&value);
- return static_cast<IntT>(value);
- }
-
- template <class IntT>
- void readInt(IntT *outValue)
- {
- *outValue = readInt<IntT>();
- }
-
- template <class IntT, class VectorElementT>
- void readIntVector(std::vector<VectorElementT> *param)
- {
- unsigned int size = readInt<unsigned int>();
- for (unsigned int index = 0; index < size; ++index)
- {
- param->push_back(readInt<IntT>());
- }
- }
-
- bool readBool()
- {
- int value = 0;
- read(&value);
- return (value > 0);
- }
-
- void readBool(bool *outValue)
- {
- *outValue = readBool();
- }
-
- void readBytes(unsigned char outArray[], size_t count)
- {
- read<unsigned char>(outArray, count);
- }
-
- std::string readString()
- {
- std::string outString;
- readString(&outString);
- return outString;
- }
-
- void readString(std::string *v)
- {
- size_t length;
- readInt(&length);
-
- if (mError)
- {
- return;
- }
-
- angle::CheckedNumeric<size_t> checkedOffset(mOffset);
- checkedOffset += length;
-
- if (!checkedOffset.IsValid() || mOffset + length > mLength)
- {
- mError = true;
- return;
- }
-
- v->assign(reinterpret_cast<const char *>(mData) + mOffset, length);
- mOffset = checkedOffset.ValueOrDie();
- }
-
- void skip(size_t length)
- {
- angle::CheckedNumeric<size_t> checkedOffset(mOffset);
- checkedOffset += length;
-
- if (!checkedOffset.IsValid() || mOffset + length > mLength)
- {
- mError = true;
- return;
- }
-
- mOffset = checkedOffset.ValueOrDie();
- }
-
- size_t offset() const
- {
- return mOffset;
- }
-
- bool error() const
- {
- return mError;
- }
-
- bool endOfStream() const
- {
- return mOffset == mLength;
- }
-
- const uint8_t *data()
- {
- return mData;
- }
-
- private:
- bool mError;
- size_t mOffset;
- const uint8_t *mData;
- size_t mLength;
-
- template <typename T>
- void read(T *v, size_t num)
- {
- static_assert(std::is_fundamental<T>::value, "T must be a fundamental type.");
-
- angle::CheckedNumeric<size_t> checkedLength(num);
- checkedLength *= sizeof(T);
- if (!checkedLength.IsValid())
- {
- mError = true;
- return;
- }
-
- angle::CheckedNumeric<size_t> checkedOffset(mOffset);
- checkedOffset += checkedLength;
-
- if (!checkedOffset.IsValid() || checkedOffset.ValueOrDie() > mLength)
- {
- mError = true;
- return;
- }
-
- memcpy(v, mData + mOffset, checkedLength.ValueOrDie());
- mOffset = checkedOffset.ValueOrDie();
- }
-
- template <typename T>
- void read(T *v)
- {
- read(v, 1);
- }
-
-};
-
-class BinaryOutputStream : angle::NonCopyable
-{
- public:
- BinaryOutputStream();
- ~BinaryOutputStream();
-
- // writeInt also handles bool types
- template <class IntT>
- void writeInt(IntT param)
- {
- ASSERT(angle::IsValueInRangeForNumericType<int>(param));
- int intValue = static_cast<int>(param);
- write(&intValue, 1);
- }
-
- // Specialized writeInt for values that can also be exactly -1.
- template <class UintT>
- void writeIntOrNegOne(UintT param)
- {
- if (param == static_cast<UintT>(-1))
- {
- writeInt(-1);
- }
- else
- {
- writeInt(param);
- }
- }
-
- template <class IntT>
- void writeIntVector(std::vector<IntT> param)
- {
- writeInt(param.size());
- for (IntT element : param)
- {
- writeIntOrNegOne(element);
- }
- }
-
- void writeString(const std::string &v)
- {
- writeInt(v.length());
- write(v.c_str(), v.length());
- }
-
- void writeBytes(const unsigned char *bytes, size_t count)
- {
- write(bytes, count);
- }
-
- size_t length() const
- {
- return mData.size();
- }
-
- const void* data() const
- {
- return mData.size() ? &mData[0] : nullptr;
- }
-
- private:
- std::vector<char> mData;
-
- template <typename T>
- void write(const T *v, size_t num)
- {
- static_assert(std::is_fundamental<T>::value, "T must be a fundamental type.");
- const char *asBytes = reinterpret_cast<const char*>(v);
- mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
- }
-
-};
-
-inline BinaryOutputStream::BinaryOutputStream()
-{
-}
-
-inline BinaryOutputStream::~BinaryOutputStream() = default;
-
-} // namespace gl
-
-#endif // LIBANGLE_BINARYSTREAM_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Buffer.cpp b/src/3rdparty/angle/src/libANGLE/Buffer.cpp
deleted file mode 100644
index a1ebfc1acb..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Buffer.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-//
-// 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.
-//
-
-// Buffer.cpp: Implements the gl::Buffer class, representing storage of vertex and/or
-// index data. Implements GL buffer objects and related functionality.
-// [OpenGL ES 2.0.24] section 2.9 page 21.
-
-#include "libANGLE/Buffer.h"
-
-#include "libANGLE/Context.h"
-#include "libANGLE/renderer/BufferImpl.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-
-namespace gl
-{
-
-BufferState::BufferState()
- : mLabel(),
- mUsage(BufferUsage::StaticDraw),
- mSize(0),
- mAccessFlags(0),
- mAccess(GL_WRITE_ONLY_OES),
- mMapped(GL_FALSE),
- mMapPointer(nullptr),
- mMapOffset(0),
- mMapLength(0)
-{
-}
-
-BufferState::~BufferState()
-{
-}
-
-Buffer::Buffer(rx::GLImplFactory *factory, GLuint id)
- : RefCountObject(id), mImpl(factory->createBuffer(mState))
-{
-}
-
-Buffer::~Buffer()
-{
- SafeDelete(mImpl);
-}
-
-Error Buffer::onDestroy(const Context *context)
-{
- // In tests, mImpl might be null.
- if (mImpl)
- mImpl->destroy(context);
- return NoError();
-}
-
-void Buffer::setLabel(const std::string &label)
-{
- mState.mLabel = label;
-}
-
-const std::string &Buffer::getLabel() const
-{
- return mState.mLabel;
-}
-
-Error Buffer::bufferData(const Context *context,
- BufferBinding target,
- const void *data,
- GLsizeiptr size,
- BufferUsage usage)
-{
- const void *dataForImpl = data;
-
- // If we are using robust resource init, make sure the buffer starts cleared.
- // Note: the Context is checked for nullptr because of some testing code.
- // TODO(jmadill): Investigate lazier clearing.
- if (context && context->getGLState().isRobustResourceInitEnabled() && !data && size > 0)
- {
- angle::MemoryBuffer *scratchBuffer = nullptr;
- ANGLE_TRY(context->getZeroFilledBuffer(static_cast<size_t>(size), &scratchBuffer));
- dataForImpl = scratchBuffer->data();
- }
-
- ANGLE_TRY(mImpl->setData(context, target, dataForImpl, size, usage));
-
- mIndexRangeCache.clear();
- mState.mUsage = usage;
- mState.mSize = size;
-
- return NoError();
-}
-
-Error Buffer::bufferSubData(const Context *context,
- BufferBinding target,
- const void *data,
- GLsizeiptr size,
- GLintptr offset)
-{
- ANGLE_TRY(mImpl->setSubData(context, target, data, size, offset));
-
- mIndexRangeCache.invalidateRange(static_cast<unsigned int>(offset), static_cast<unsigned int>(size));
-
- return NoError();
-}
-
-Error Buffer::copyBufferSubData(const Context *context,
- Buffer *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size)
-{
- ANGLE_TRY(
- mImpl->copySubData(context, source->getImplementation(), sourceOffset, destOffset, size));
-
- mIndexRangeCache.invalidateRange(static_cast<unsigned int>(destOffset), static_cast<unsigned int>(size));
-
- return NoError();
-}
-
-Error Buffer::map(const Context *context, GLenum access)
-{
- ASSERT(!mState.mMapped);
-
- mState.mMapPointer = nullptr;
- ANGLE_TRY(mImpl->map(context, access, &mState.mMapPointer));
-
- ASSERT(access == GL_WRITE_ONLY_OES);
-
- mState.mMapped = GL_TRUE;
- mState.mMapOffset = 0;
- mState.mMapLength = mState.mSize;
- mState.mAccess = access;
- mState.mAccessFlags = GL_MAP_WRITE_BIT;
- mIndexRangeCache.clear();
-
- return NoError();
-}
-
-Error Buffer::mapRange(const Context *context,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- ASSERT(!mState.mMapped);
- ASSERT(offset + length <= mState.mSize);
-
- mState.mMapPointer = nullptr;
- ANGLE_TRY(mImpl->mapRange(context, offset, length, access, &mState.mMapPointer));
-
- mState.mMapped = GL_TRUE;
- mState.mMapOffset = static_cast<GLint64>(offset);
- mState.mMapLength = static_cast<GLint64>(length);
- mState.mAccess = GL_WRITE_ONLY_OES;
- mState.mAccessFlags = access;
-
- // The OES_mapbuffer extension states that GL_WRITE_ONLY_OES is the only valid
- // value for GL_BUFFER_ACCESS_OES because it was written against ES2. Since there is
- // no update for ES3 and the GL_READ_ONLY and GL_READ_WRITE enums don't exist for ES,
- // we cannot properly set GL_BUFFER_ACCESS_OES when glMapBufferRange is called.
-
- if ((access & GL_MAP_WRITE_BIT) > 0)
- {
- mIndexRangeCache.invalidateRange(static_cast<unsigned int>(offset), static_cast<unsigned int>(length));
- }
-
- return NoError();
-}
-
-Error Buffer::unmap(const Context *context, GLboolean *result)
-{
- ASSERT(mState.mMapped);
-
- *result = GL_FALSE;
- ANGLE_TRY(mImpl->unmap(context, result));
-
- mState.mMapped = GL_FALSE;
- mState.mMapPointer = nullptr;
- mState.mMapOffset = 0;
- mState.mMapLength = 0;
- mState.mAccess = GL_WRITE_ONLY_OES;
- mState.mAccessFlags = 0;
-
- return NoError();
-}
-
-void Buffer::onTransformFeedback()
-{
- mIndexRangeCache.clear();
-}
-
-void Buffer::onPixelUnpack()
-{
- mIndexRangeCache.clear();
-}
-
-Error Buffer::getIndexRange(const gl::Context *context,
- GLenum type,
- size_t offset,
- size_t count,
- bool primitiveRestartEnabled,
- IndexRange *outRange) const
-{
- if (mIndexRangeCache.findRange(type, offset, count, primitiveRestartEnabled, outRange))
- {
- return NoError();
- }
-
- ANGLE_TRY(
- mImpl->getIndexRange(context, type, offset, count, primitiveRestartEnabled, outRange));
-
- mIndexRangeCache.addRange(type, offset, count, primitiveRestartEnabled, *outRange);
-
- return NoError();
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Buffer.h b/src/3rdparty/angle/src/libANGLE/Buffer.h
deleted file mode 100644
index 86d4a9fd6f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Buffer.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// 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.
-//
-
-// Buffer.h: Defines the gl::Buffer class, representing storage of vertex and/or
-// index data. Implements GL buffer objects and related functionality.
-// [OpenGL ES 2.0.24] section 2.9 page 21.
-
-#ifndef LIBANGLE_BUFFER_H_
-#define LIBANGLE_BUFFER_H_
-
-#include "common/angleutils.h"
-#include "libANGLE/Debug.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/IndexRangeCache.h"
-#include "libANGLE/PackedGLEnums.h"
-#include "libANGLE/RefCountObject.h"
-
-namespace rx
-{
-class BufferImpl;
-class GLImplFactory;
-};
-
-namespace gl
-{
-class Buffer;
-class Context;
-
-class BufferState final : angle::NonCopyable
-{
- public:
- BufferState();
- ~BufferState();
-
- const std::string &getLabel();
-
- BufferUsage getUsage() const { return mUsage; }
- GLbitfield getAccessFlags() const { return mAccessFlags; }
- GLenum getAccess() const { return mAccess; }
- GLboolean isMapped() const { return mMapped; }
- void *getMapPointer() const { return mMapPointer; }
- GLint64 getMapOffset() const { return mMapOffset; }
- GLint64 getMapLength() const { return mMapLength; }
- GLint64 getSize() const { return mSize; }
-
- private:
- friend class Buffer;
-
- std::string mLabel;
-
- BufferUsage mUsage;
- GLint64 mSize;
- GLbitfield mAccessFlags;
- GLenum mAccess;
- GLboolean mMapped;
- void *mMapPointer;
- GLint64 mMapOffset;
- GLint64 mMapLength;
-};
-
-class Buffer final : public RefCountObject, public LabeledObject
-{
- public:
- Buffer(rx::GLImplFactory *factory, GLuint id);
- ~Buffer() override;
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- Error bufferData(const Context *context,
- BufferBinding target,
- const void *data,
- GLsizeiptr size,
- BufferUsage usage);
- Error bufferSubData(const Context *context,
- BufferBinding target,
- const void *data,
- GLsizeiptr size,
- GLintptr offset);
- Error copyBufferSubData(const Context *context,
- Buffer *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size);
- Error map(const Context *context, GLenum access);
- Error mapRange(const Context *context, GLintptr offset, GLsizeiptr length, GLbitfield access);
- Error unmap(const Context *context, GLboolean *result);
-
- void onTransformFeedback();
- void onPixelUnpack();
-
- Error getIndexRange(const gl::Context *context,
- GLenum type,
- size_t offset,
- size_t count,
- bool primitiveRestartEnabled,
- IndexRange *outRange) const;
-
- BufferUsage getUsage() const { return mState.mUsage; }
- GLbitfield getAccessFlags() const { return mState.mAccessFlags; }
- GLenum getAccess() const { return mState.mAccess; }
- GLboolean isMapped() const { return mState.mMapped; }
- void *getMapPointer() const { return mState.mMapPointer; }
- GLint64 getMapOffset() const { return mState.mMapOffset; }
- GLint64 getMapLength() const { return mState.mMapLength; }
- GLint64 getSize() const { return mState.mSize; }
-
- rx::BufferImpl *getImplementation() const { return mImpl; }
-
- private:
- BufferState mState;
- rx::BufferImpl *mImpl;
-
- mutable IndexRangeCache mIndexRangeCache;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_BUFFER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Caps.cpp b/src/3rdparty/angle/src/libANGLE/Caps.cpp
deleted file mode 100644
index 44da2bbe27..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Caps.cpp
+++ /dev/null
@@ -1,1213 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-#include "libANGLE/Caps.h"
-
-#include "common/debug.h"
-#include "common/angleutils.h"
-
-#include "libANGLE/formatutils.h"
-
-#include "angle_gl.h"
-
-#include <algorithm>
-#include <sstream>
-
-static void InsertExtensionString(const std::string &extension, bool supported, std::vector<std::string> *extensionVector)
-{
- if (supported)
- {
- extensionVector->push_back(extension);
- }
-}
-
-namespace gl
-{
-
-TextureCaps::TextureCaps()
- : texturable(false),
- filterable(false),
- renderable(false),
- sampleCounts()
-{
-}
-
-TextureCaps::TextureCaps(const TextureCaps &other) = default;
-
-TextureCaps::~TextureCaps() = default;
-
-GLuint TextureCaps::getMaxSamples() const
-{
- return !sampleCounts.empty() ? *sampleCounts.rbegin() : 0;
-}
-
-GLuint TextureCaps::getNearestSamples(GLuint requestedSamples) const
-{
- if (requestedSamples == 0)
- {
- return 0;
- }
-
- for (SupportedSampleSet::const_iterator i = sampleCounts.begin(); i != sampleCounts.end(); i++)
- {
- GLuint samples = *i;
- if (samples >= requestedSamples)
- {
- return samples;
- }
- }
-
- return 0;
-}
-
-TextureCaps GenerateMinimumTextureCaps(GLenum sizedInternalFormat,
- const Version &clientVersion,
- const Extensions &extensions)
-{
- TextureCaps caps;
-
- const InternalFormat &internalFormatInfo = GetSizedInternalFormatInfo(sizedInternalFormat);
- caps.texturable = internalFormatInfo.textureSupport(clientVersion, extensions);
- caps.renderable = internalFormatInfo.renderSupport(clientVersion, extensions);
- caps.filterable = internalFormatInfo.filterSupport(clientVersion, extensions);
-
- caps.sampleCounts.insert(0);
- if (internalFormatInfo.isRequiredRenderbufferFormat(clientVersion))
- {
- if ((clientVersion.major >= 3 && clientVersion.minor >= 1) ||
- (clientVersion.major >= 3 && internalFormatInfo.componentType != GL_UNSIGNED_INT &&
- internalFormatInfo.componentType != GL_INT))
- {
- caps.sampleCounts.insert(4);
- }
- }
-
- return caps;
-}
-
-TextureCapsMap::TextureCapsMap()
-{
-}
-
-TextureCapsMap::~TextureCapsMap()
-{
-}
-
-void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
-{
- angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat);
- get(formatID) = caps;
-}
-
-void TextureCapsMap::clear()
-{
- mFormatData.fill(TextureCaps());
-}
-
-const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const
-{
- angle::Format::ID formatID = angle::Format::InternalFormatToID(internalFormat);
- return get(formatID);
-}
-
-const TextureCaps &TextureCapsMap::get(angle::Format::ID formatID) const
-{
- return mFormatData[static_cast<size_t>(formatID)];
-}
-
-TextureCaps &TextureCapsMap::get(angle::Format::ID formatID)
-{
- return mFormatData[static_cast<size_t>(formatID)];
-}
-
-void TextureCapsMap::set(angle::Format::ID formatID, const TextureCaps &caps)
-{
- get(formatID) = caps;
-}
-
-void InitMinimumTextureCapsMap(const Version &clientVersion,
- const Extensions &extensions,
- TextureCapsMap *capsMap)
-{
- for (GLenum internalFormat : GetAllSizedInternalFormats())
- {
- capsMap->insert(internalFormat,
- GenerateMinimumTextureCaps(internalFormat, clientVersion, extensions));
- }
-}
-
-Extensions::Extensions()
- : elementIndexUint(false),
- packedDepthStencil(false),
- getProgramBinary(false),
- rgb8rgba8(false),
- textureFormatBGRA8888(false),
- readFormatBGRA(false),
- pixelBufferObject(false),
- mapBuffer(false),
- mapBufferRange(false),
- colorBufferHalfFloat(false),
- textureHalfFloat(false),
- textureHalfFloatLinear(false),
- textureFloat(false),
- textureFloatLinear(false),
- textureRG(false),
- textureCompressionDXT1(false),
- textureCompressionDXT3(false),
- textureCompressionDXT5(false),
- textureCompressionS3TCsRGB(false),
- textureCompressionASTCHDR(false),
- textureCompressionASTCLDR(false),
- compressedETC1RGB8Texture(false),
- sRGB(false),
- depthTextures(false),
- depth32(false),
- textureStorage(false),
- textureNPOT(false),
- drawBuffers(false),
- textureFilterAnisotropic(false),
- maxTextureAnisotropy(0.0f),
- occlusionQueryBoolean(false),
- fence(false),
- disjointTimerQuery(false),
- queryCounterBitsTimeElapsed(0),
- queryCounterBitsTimestamp(0),
- robustness(false),
- robustBufferAccessBehavior(false),
- blendMinMax(false),
- framebufferBlit(false),
- framebufferMultisample(false),
- instancedArrays(false),
- packReverseRowOrder(false),
- standardDerivatives(false),
- shaderTextureLOD(false),
- fragDepth(false),
- multiview(false),
- maxViews(1u),
- textureUsage(false),
- translatedShaderSource(false),
- fboRenderMipmap(false),
- discardFramebuffer(false),
- debugMarker(false),
- eglImage(false),
- eglImageExternal(false),
- eglImageExternalEssl3(false),
- eglStreamConsumerExternal(false),
- unpackSubimage(false),
- packSubimage(false),
- vertexArrayObject(false),
- debug(false),
- maxDebugMessageLength(0),
- maxDebugLoggedMessages(0),
- maxDebugGroupStackDepth(0),
- maxLabelLength(0),
- noError(false),
- lossyETCDecode(false),
- bindUniformLocation(false),
- syncQuery(false),
- copyTexture(false),
- copyCompressedTexture(false),
- webglCompatibility(false),
- requestExtension(false),
- bindGeneratesResource(false),
- robustClientMemory(false),
- textureSRGBDecode(false),
- sRGBWriteControl(false),
- colorBufferFloatRGB(false),
- colorBufferFloatRGBA(false),
- colorBufferFloat(false),
- multisampleCompatibility(false),
- framebufferMixedSamples(false),
- textureNorm16(false),
- pathRendering(false),
- surfacelessContext(false),
- clientArrays(false),
- robustResourceInitialization(false),
- programCacheControl(false),
- textureRectangle(false),
- geometryShader(false),
- maxGeometryOutputVertices(0),
- maxGeometryShaderInvocations(0)
-{
-}
-
-std::vector<std::string> Extensions::getStrings() const
-{
- std::vector<std::string> extensionStrings;
-
- for (const auto &extensionInfo : GetExtensionInfoMap())
- {
- if (this->*(extensionInfo.second.ExtensionsMember))
- {
- extensionStrings.push_back(extensionInfo.first);
- }
- }
-
- return extensionStrings;
-}
-
-Limitations::Limitations()
- : noFrontFacingSupport(false),
- noSampleAlphaToCoverageSupport(false),
- attributeZeroRequiresZeroDivisorInEXT(false),
- noSeparateStencilRefsAndMasks(false),
- shadersRequireIndexedLoopValidation(false),
- noSimultaneousConstantColorAndAlphaBlendFunc(false)
-{
-}
-
-static bool GetFormatSupportBase(const TextureCapsMap &textureCaps,
- const GLenum *requiredFormats,
- size_t requiredFormatsSize,
- bool requiresTexturing,
- bool requiresFiltering,
- bool requiresRendering)
-{
- for (size_t i = 0; i < requiredFormatsSize; i++)
- {
- const TextureCaps &cap = textureCaps.get(requiredFormats[i]);
-
- if (requiresTexturing && !cap.texturable)
- {
- return false;
- }
-
- if (requiresFiltering && !cap.filterable)
- {
- return false;
- }
-
- if (requiresRendering && !cap.renderable)
- {
- return false;
- }
- }
-
- return true;
-}
-
-template <size_t N>
-static bool GetFormatSupport(const TextureCapsMap &textureCaps,
- const GLenum (&requiredFormats)[N],
- bool requiresTexturing,
- bool requiresFiltering,
- bool requiresRendering)
-{
- return GetFormatSupportBase(textureCaps, requiredFormats, N, requiresTexturing,
- requiresFiltering, requiresRendering);
-}
-
-// Check for GL_OES_packed_depth_stencil
-static bool DeterminePackedDepthStencilSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_DEPTH24_STENCIL8,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, false, false, true);
-}
-
-// Checks for GL_OES_rgb8_rgba8 support
-static bool DetermineRGB8AndRGBA8TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB8, GL_RGBA8,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
-}
-
-// Checks for GL_EXT_texture_format_BGRA8888 support
-static bool DetermineBGRA8TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_BGRA8_EXT,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
-}
-
-// Checks for GL_OES_color_buffer_half_float support
-static bool DetermineColorBufferHalfFloatSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGBA16F, GL_RGB16F, GL_RG16F, GL_R16F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
-}
-
-// Checks for GL_OES_texture_half_float support
-static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB16F, GL_RGBA16F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, false);
-}
-
-// Checks for GL_OES_texture_half_float_linear support
-static bool DetermineHalfFloatTextureFilteringSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB16F, GL_RGBA16F,
- };
-
- return DetermineHalfFloatTextureSupport(textureCaps) &&
- GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Checks for GL_OES_texture_float support
-static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB32F, GL_RGBA32F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, false);
-}
-
-// Checks for GL_OES_texture_float_linear support
-static bool DetermineFloatTextureFilteringSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB32F, GL_RGBA32F,
- };
-
- return DetermineFloatTextureSupport(textureCaps) &&
- GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Checks for GL_EXT_texture_rg support
-static bool DetermineRGHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_R16F, GL_RG16F,
- };
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-static bool DetermineRGFloatTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_R32F, GL_RG32F,
- };
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps, bool checkHalfFloatFormats, bool checkFloatFormats)
-{
- if (checkHalfFloatFormats && !DetermineRGHalfFloatTextureSupport(textureCaps))
- {
- return false;
- }
-
- if (checkFloatFormats && !DetermineRGFloatTextureSupport(textureCaps))
- {
- return false;
- }
-
- constexpr GLenum requiredFormats[] = {
- GL_R8, GL_RG8,
- };
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_EXT_texture_compression_dxt1
-static bool DetermineDXT1TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_ANGLE_texture_compression_dxt3
-static bool DetermineDXT3TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_ANGLE_texture_compression_dxt5
-static bool DetermineDXT5TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_EXT_texture_compression_s3tc_srgb
-static bool DetermineS3TCsRGBTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
- GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_KHR_texture_compression_astc_hdr and GL_KHR_texture_compression_astc_ldr
-static bool DetermineASTCTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
- GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
- GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
- GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
- GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
- GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
- GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
- GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_ETC1_RGB8_OES
-static bool DetermineETC1RGB8TextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_ETC1_RGB8_OES,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
-}
-
-// Check for GL_ANGLE_texture_compression_dxt5
-static bool DetermineSRGBTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFilterFormats[] = {
- GL_SRGB8, GL_SRGB8_ALPHA8,
- };
-
- constexpr GLenum requiredRenderFormats[] = {
- GL_SRGB8_ALPHA8,
- };
-
- return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false) &&
- GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true);
-}
-
-// Check for GL_ANGLE_depth_texture
-static bool DetermineDepthTextureSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT32_OES, GL_DEPTH24_STENCIL8_OES,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
-}
-
-// Check for GL_OES_depth32
-static bool DetermineDepth32Support(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_DEPTH_COMPONENT32_OES,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, false, false, true);
-}
-
-// Check for GL_CHROMIUM_color_buffer_float_rgb
-static bool DetermineColorBufferFloatRGBSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGB32F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
-}
-
-// Check for GL_CHROMIUM_color_buffer_float_rgba
-static bool DetermineColorBufferFloatRGBASupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_RGBA32F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
-}
-
-// Check for GL_EXT_color_buffer_float
-static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFormats[] = {
- GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F, GL_R11F_G11F_B10F,
- };
-
- return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
-}
-
-// Check for GL_EXT_texture_norm16
-static bool DetermineTextureNorm16Support(const TextureCapsMap &textureCaps)
-{
- constexpr GLenum requiredFilterFormats[] = {
- GL_R16_EXT, GL_RG16_EXT, GL_RGB16_EXT, GL_RGBA16_EXT,
- GL_R16_SNORM_EXT, GL_RG16_SNORM_EXT, GL_RGB16_SNORM_EXT, GL_RGBA16_SNORM_EXT,
- };
-
- constexpr GLenum requiredRenderFormats[] = {
- GL_R16_EXT, GL_RG16_EXT, GL_RGBA16_EXT,
- };
-
- return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false) &&
- GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true);
-}
-
-void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
-{
- packedDepthStencil = DeterminePackedDepthStencilSupport(textureCaps);
- rgb8rgba8 = DetermineRGB8AndRGBA8TextureSupport(textureCaps);
- textureFormatBGRA8888 = DetermineBGRA8TextureSupport(textureCaps);
- colorBufferHalfFloat = DetermineColorBufferHalfFloatSupport(textureCaps);
- textureHalfFloat = DetermineHalfFloatTextureSupport(textureCaps);
- textureHalfFloatLinear = DetermineHalfFloatTextureFilteringSupport(textureCaps);
- textureFloat = DetermineFloatTextureSupport(textureCaps);
- textureFloatLinear = DetermineFloatTextureFilteringSupport(textureCaps);
- textureRG = DetermineRGTextureSupport(textureCaps, textureHalfFloat, textureFloat);
- textureCompressionDXT1 = DetermineDXT1TextureSupport(textureCaps);
- textureCompressionDXT3 = DetermineDXT3TextureSupport(textureCaps);
- textureCompressionDXT5 = DetermineDXT5TextureSupport(textureCaps);
- textureCompressionS3TCsRGB = DetermineS3TCsRGBTextureSupport(textureCaps);
- textureCompressionASTCHDR = DetermineASTCTextureSupport(textureCaps);
- textureCompressionASTCLDR = textureCompressionASTCHDR;
- compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps);
- sRGB = DetermineSRGBTextureSupport(textureCaps);
- depthTextures = DetermineDepthTextureSupport(textureCaps);
- depth32 = DetermineDepth32Support(textureCaps);
- colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
- colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps);
- colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
- textureNorm16 = DetermineTextureNorm16Support(textureCaps);
-}
-
-const ExtensionInfoMap &GetExtensionInfoMap()
-{
- auto buildExtensionInfoMap = []() {
- auto enableableExtension = [](ExtensionInfo::ExtensionBool member) {
- ExtensionInfo info;
- info.Requestable = true;
- info.ExtensionsMember = member;
- return info;
- };
-
- auto esOnlyExtension = [](ExtensionInfo::ExtensionBool member) {
- ExtensionInfo info;
- info.ExtensionsMember = member;
- return info;
- };
-
- // clang-format off
- ExtensionInfoMap map;
- map["GL_OES_element_index_uint"] = enableableExtension(&Extensions::elementIndexUint);
- map["GL_OES_packed_depth_stencil"] = esOnlyExtension(&Extensions::packedDepthStencil);
- map["GL_OES_get_program_binary"] = enableableExtension(&Extensions::getProgramBinary);
- map["GL_OES_rgb8_rgba8"] = enableableExtension(&Extensions::rgb8rgba8);
- map["GL_EXT_texture_format_BGRA8888"] = enableableExtension(&Extensions::textureFormatBGRA8888);
- map["GL_EXT_read_format_bgra"] = esOnlyExtension(&Extensions::readFormatBGRA);
- map["GL_NV_pixel_buffer_object"] = enableableExtension(&Extensions::pixelBufferObject);
- map["GL_OES_mapbuffer"] = enableableExtension(&Extensions::mapBuffer);
- map["GL_EXT_map_buffer_range"] = enableableExtension(&Extensions::mapBufferRange);
- map["GL_EXT_color_buffer_half_float"] = enableableExtension(&Extensions::colorBufferHalfFloat);
- map["GL_OES_texture_half_float"] = enableableExtension(&Extensions::textureHalfFloat);
- map["GL_OES_texture_half_float_linear"] = enableableExtension(&Extensions::textureHalfFloatLinear);
- map["GL_OES_texture_float"] = enableableExtension(&Extensions::textureFloat);
- map["GL_OES_texture_float_linear"] = enableableExtension(&Extensions::textureFloatLinear);
- map["GL_EXT_texture_rg"] = enableableExtension(&Extensions::textureRG);
- map["GL_EXT_texture_compression_dxt1"] = enableableExtension(&Extensions::textureCompressionDXT1);
- map["GL_ANGLE_texture_compression_dxt3"] = enableableExtension(&Extensions::textureCompressionDXT3);
- map["GL_ANGLE_texture_compression_dxt5"] = enableableExtension(&Extensions::textureCompressionDXT5);
- map["GL_EXT_texture_compression_s3tc_srgb"] = enableableExtension(&Extensions::textureCompressionS3TCsRGB);
- map["GL_KHR_texture_compression_astc_hdr"] = enableableExtension(&Extensions::textureCompressionASTCHDR);
- map["GL_KHR_texture_compression_astc_ldr"] = enableableExtension(&Extensions::textureCompressionASTCLDR);
- map["GL_OES_compressed_ETC1_RGB8_texture"] = enableableExtension(&Extensions::compressedETC1RGB8Texture);
- map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
- map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextures);
- map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32);
- map["GL_EXT_texture_storage"] = esOnlyExtension(&Extensions::textureStorage);
- map["GL_OES_texture_npot"] = enableableExtension(&Extensions::textureNPOT);
- map["GL_EXT_draw_buffers"] = enableableExtension(&Extensions::drawBuffers);
- map["GL_EXT_texture_filter_anisotropic"] = enableableExtension(&Extensions::textureFilterAnisotropic);
- map["GL_EXT_occlusion_query_boolean"] = enableableExtension(&Extensions::occlusionQueryBoolean);
- map["GL_NV_fence"] = esOnlyExtension(&Extensions::fence);
- map["GL_EXT_disjoint_timer_query"] = enableableExtension(&Extensions::disjointTimerQuery);
- map["GL_EXT_robustness"] = esOnlyExtension(&Extensions::robustness);
- map["GL_KHR_robust_buffer_access_behavior"] = esOnlyExtension(&Extensions::robustBufferAccessBehavior);
- map["GL_EXT_blend_minmax"] = enableableExtension(&Extensions::blendMinMax);
- map["GL_ANGLE_framebuffer_blit"] = enableableExtension(&Extensions::framebufferBlit);
- map["GL_ANGLE_framebuffer_multisample"] = enableableExtension(&Extensions::framebufferMultisample);
- map["GL_ANGLE_instanced_arrays"] = enableableExtension(&Extensions::instancedArrays);
- map["GL_ANGLE_pack_reverse_row_order"] = enableableExtension(&Extensions::packReverseRowOrder);
- map["GL_OES_standard_derivatives"] = enableableExtension(&Extensions::standardDerivatives);
- map["GL_EXT_shader_texture_lod"] = enableableExtension(&Extensions::shaderTextureLOD);
- map["GL_EXT_frag_depth"] = enableableExtension(&Extensions::fragDepth);
- map["GL_ANGLE_multiview"] = enableableExtension(&Extensions::multiview);
- map["GL_ANGLE_texture_usage"] = enableableExtension(&Extensions::textureUsage);
- map["GL_ANGLE_translated_shader_source"] = esOnlyExtension(&Extensions::translatedShaderSource);
- map["GL_OES_fbo_render_mipmap"] = enableableExtension(&Extensions::fboRenderMipmap);
- map["GL_EXT_discard_framebuffer"] = esOnlyExtension(&Extensions::discardFramebuffer);
- map["GL_EXT_debug_marker"] = esOnlyExtension(&Extensions::debugMarker);
- map["GL_OES_EGL_image"] = esOnlyExtension(&Extensions::eglImage);
- map["GL_OES_EGL_image_external"] = esOnlyExtension(&Extensions::eglImageExternal);
- map["GL_OES_EGL_image_external_essl3"] = esOnlyExtension(&Extensions::eglImageExternalEssl3);
- map["GL_NV_EGL_stream_consumer_external"] = esOnlyExtension(&Extensions::eglStreamConsumerExternal);
- map["GL_EXT_unpack_subimage"] = enableableExtension(&Extensions::unpackSubimage);
- map["GL_NV_pack_subimage"] = enableableExtension(&Extensions::packSubimage);
- map["GL_EXT_color_buffer_float"] = enableableExtension(&Extensions::colorBufferFloat);
- map["GL_OES_vertex_array_object"] = esOnlyExtension(&Extensions::vertexArrayObject);
- map["GL_KHR_debug"] = esOnlyExtension(&Extensions::debug);
- // TODO(jmadill): Enable this when complete.
- //map["GL_KHR_no_error"] = esOnlyExtension(&Extensions::noError);
- map["GL_ANGLE_lossy_etc_decode"] = enableableExtension(&Extensions::lossyETCDecode);
- map["GL_CHROMIUM_bind_uniform_location"] = esOnlyExtension(&Extensions::bindUniformLocation);
- map["GL_CHROMIUM_sync_query"] = enableableExtension(&Extensions::syncQuery);
- map["GL_CHROMIUM_copy_texture"] = esOnlyExtension(&Extensions::copyTexture);
- map["GL_CHROMIUM_copy_compressed_texture"] = esOnlyExtension(&Extensions::copyCompressedTexture);
- map["GL_ANGLE_webgl_compatibility"] = esOnlyExtension(&Extensions::webglCompatibility);
- map["GL_ANGLE_request_extension"] = esOnlyExtension(&Extensions::requestExtension);
- map["GL_CHROMIUM_bind_generates_resource"] = esOnlyExtension(&Extensions::bindGeneratesResource);
- map["GL_ANGLE_robust_client_memory"] = esOnlyExtension(&Extensions::robustClientMemory);
- map["GL_EXT_texture_sRGB_decode"] = esOnlyExtension(&Extensions::textureSRGBDecode);
- map["GL_EXT_sRGB_write_control"] = esOnlyExtension(&Extensions::sRGBWriteControl);
- map["GL_CHROMIUM_color_buffer_float_rgb"] = enableableExtension(&Extensions::colorBufferFloatRGB);
- map["GL_CHROMIUM_color_buffer_float_rgba"] = enableableExtension(&Extensions::colorBufferFloatRGBA);
- map["GL_EXT_multisample_compatibility"] = esOnlyExtension(&Extensions::multisampleCompatibility);
- map["GL_CHROMIUM_framebuffer_mixed_samples"] = esOnlyExtension(&Extensions::framebufferMixedSamples);
- map["GL_EXT_texture_norm16"] = esOnlyExtension(&Extensions::textureNorm16);
- map["GL_CHROMIUM_path_rendering"] = esOnlyExtension(&Extensions::pathRendering);
- map["GL_OES_surfaceless_context"] = esOnlyExtension(&Extensions::surfacelessContext);
- map["GL_ANGLE_client_arrays"] = esOnlyExtension(&Extensions::clientArrays);
- map["GL_ANGLE_robust_resource_initialization"] = esOnlyExtension(&Extensions::robustResourceInitialization);
- map["GL_ANGLE_program_cache_control"] = esOnlyExtension(&Extensions::programCacheControl);
- map["GL_ANGLE_texture_rectangle"] = enableableExtension(&Extensions::textureRectangle);
- map["GL_EXT_geometry_shader"] = enableableExtension(&Extensions::geometryShader);
- // clang-format on
-
- return map;
- };
-
- static const ExtensionInfoMap extensionInfo = buildExtensionInfoMap();
- return extensionInfo;
-}
-
-TypePrecision::TypePrecision() : range({{0, 0}}), precision(0)
-{
-}
-
-TypePrecision::TypePrecision(const TypePrecision &other) = default;
-
-void TypePrecision::setIEEEFloat()
-{
- range = {{127, 127}};
- precision = 23;
-}
-
-void TypePrecision::setTwosComplementInt(unsigned int bits)
-{
- range = {{static_cast<GLint>(bits) - 1, static_cast<GLint>(bits) - 2}};
- precision = 0;
-}
-
-void TypePrecision::setSimulatedFloat(unsigned int r, unsigned int p)
-{
- range = {{static_cast<GLint>(r), static_cast<GLint>(r)}};
- precision = static_cast<GLint>(p);
-}
-
-void TypePrecision::setSimulatedInt(unsigned int r)
-{
- range = {{static_cast<GLint>(r), static_cast<GLint>(r)}};
- precision = 0;
-}
-
-void TypePrecision::get(GLint *returnRange, GLint *returnPrecision) const
-{
- std::copy(range.begin(), range.end(), returnRange);
- *returnPrecision = precision;
-}
-
-Caps::Caps()
- : maxElementIndex(0),
- max3DTextureSize(0),
- max2DTextureSize(0),
- maxRectangleTextureSize(0),
- maxArrayTextureLayers(0),
- maxLODBias(0),
- maxCubeMapTextureSize(0),
- maxRenderbufferSize(0),
- minAliasedPointSize(0),
- maxAliasedPointSize(0),
- minAliasedLineWidth(0),
- maxAliasedLineWidth(0),
-
- // Table 20.40
- maxDrawBuffers(0),
- maxFramebufferWidth(0),
- maxFramebufferHeight(0),
- maxFramebufferSamples(0),
- maxColorAttachments(0),
- maxViewportWidth(0),
- maxViewportHeight(0),
- maxSampleMaskWords(0),
- maxColorTextureSamples(0),
- maxDepthTextureSamples(0),
- maxIntegerSamples(0),
- maxServerWaitTimeout(0),
-
- // Table 20.41
- maxVertexAttribRelativeOffset(0),
- maxVertexAttribBindings(0),
- maxVertexAttribStride(0),
- maxElementsIndices(0),
- maxElementsVertices(0),
-
- // Table 20.43
- maxVertexAttributes(0),
- maxVertexUniformComponents(0),
- maxVertexUniformVectors(0),
- maxVertexUniformBlocks(0),
- maxVertexOutputComponents(0),
- maxVertexTextureImageUnits(0),
- maxVertexAtomicCounterBuffers(0),
- maxVertexAtomicCounters(0),
- maxVertexImageUniforms(0),
- maxVertexShaderStorageBlocks(0),
-
- // Table 20.44
- maxFragmentUniformComponents(0),
- maxFragmentUniformVectors(0),
- maxFragmentUniformBlocks(0),
- maxFragmentInputComponents(0),
- maxTextureImageUnits(0),
- maxFragmentAtomicCounterBuffers(0),
- maxFragmentAtomicCounters(0),
- maxFragmentImageUniforms(0),
- maxFragmentShaderStorageBlocks(0),
- minProgramTextureGatherOffset(0),
- maxProgramTextureGatherOffset(0),
- minProgramTexelOffset(0),
- maxProgramTexelOffset(0),
-
- // Table 20.45
- maxComputeWorkGroupInvocations(0),
- maxComputeUniformBlocks(0),
- maxComputeTextureImageUnits(0),
- maxComputeSharedMemorySize(0),
- maxComputeUniformComponents(0),
- maxComputeAtomicCounterBuffers(0),
- maxComputeAtomicCounters(0),
- maxComputeImageUniforms(0),
- maxCombinedComputeUniformComponents(0),
- maxComputeShaderStorageBlocks(0),
-
- // Table 20.46
- maxUniformBufferBindings(0),
- maxUniformBlockSize(0),
- uniformBufferOffsetAlignment(0),
- maxCombinedUniformBlocks(0),
- maxCombinedVertexUniformComponents(0),
- maxCombinedFragmentUniformComponents(0),
- maxVaryingComponents(0),
- maxVaryingVectors(0),
- maxCombinedTextureImageUnits(0),
- maxCombinedShaderOutputResources(0),
-
- // Table 20.47
- maxUniformLocations(0),
- maxAtomicCounterBufferBindings(0),
- maxAtomicCounterBufferSize(0),
- maxCombinedAtomicCounterBuffers(0),
- maxCombinedAtomicCounters(0),
- maxImageUnits(0),
- maxCombinedImageUniforms(0),
- maxShaderStorageBufferBindings(0),
- maxShaderStorageBlockSize(0),
- maxCombinedShaderStorageBlocks(0),
- shaderStorageBufferOffsetAlignment(0),
-
- // Table 20.48
- maxTransformFeedbackInterleavedComponents(0),
- maxTransformFeedbackSeparateAttributes(0),
- maxTransformFeedbackSeparateComponents(0),
-
- // Table 20.49
- maxSamples(0)
-{
- for (size_t i = 0; i < 3; ++i)
- {
- maxComputeWorkGroupCount[i] = 0;
- maxComputeWorkGroupSize[i] = 0;
- }
-}
-
-Caps::Caps(const Caps &other) = default;
-Caps::~Caps() = default;
-
-Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions)
-{
- Caps caps;
-
- if (clientVersion >= Version(2, 0))
- {
- // Table 6.18
- caps.max2DTextureSize = 64;
- caps.maxCubeMapTextureSize = 16;
- caps.maxViewportWidth = caps.max2DTextureSize;
- caps.maxViewportHeight = caps.max2DTextureSize;
- caps.minAliasedPointSize = 1;
- caps.maxAliasedPointSize = 1;
- caps.minAliasedLineWidth = 1;
- caps.maxAliasedLineWidth = 1;
-
- // Table 6.19
- caps.vertexHighpFloat.setSimulatedFloat(62, 16);
- caps.vertexMediumpFloat.setSimulatedFloat(14, 10);
- caps.vertexLowpFloat.setSimulatedFloat(1, 8);
- caps.vertexHighpInt.setSimulatedInt(16);
- caps.vertexMediumpInt.setSimulatedInt(10);
- caps.vertexLowpInt.setSimulatedInt(8);
- caps.fragmentHighpFloat.setSimulatedFloat(62, 16);
- caps.fragmentMediumpFloat.setSimulatedFloat(14, 10);
- caps.fragmentLowpFloat.setSimulatedFloat(1, 8);
- caps.fragmentHighpInt.setSimulatedInt(16);
- caps.fragmentMediumpInt.setSimulatedInt(10);
- caps.fragmentLowpInt.setSimulatedInt(8);
-
- // Table 6.20
- caps.maxVertexAttributes = 8;
- caps.maxVertexUniformVectors = 128;
- caps.maxVaryingVectors = 8;
- caps.maxCombinedTextureImageUnits = 8;
- caps.maxTextureImageUnits = 8;
- caps.maxFragmentUniformVectors = 16;
- caps.maxRenderbufferSize = 1;
- }
-
- if (clientVersion >= Version(3, 0))
- {
- // Table 6.28
- caps.maxElementIndex = (1 << 24) - 1;
- caps.max3DTextureSize = 256;
- caps.max2DTextureSize = 2048;
- caps.maxArrayTextureLayers = 256;
- caps.maxLODBias = 2.0f;
- caps.maxCubeMapTextureSize = 2048;
- caps.maxRenderbufferSize = 2048;
- caps.maxDrawBuffers = 4;
- caps.maxColorAttachments = 4;
- caps.maxViewportWidth = caps.max2DTextureSize;
- caps.maxViewportHeight = caps.max2DTextureSize;
-
- // Table 6.29
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_R11_EAC);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_SIGNED_R11_EAC);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_RG11_EAC);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_SIGNED_RG11_EAC);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGB8_ETC2);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_ETC2);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGBA8_ETC2_EAC);
- caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC);
- caps.vertexHighpFloat.setIEEEFloat();
- caps.vertexHighpInt.setTwosComplementInt(32);
- caps.vertexMediumpInt.setTwosComplementInt(16);
- caps.vertexLowpInt.setTwosComplementInt(8);
- caps.fragmentHighpFloat.setIEEEFloat();
- caps.fragmentHighpInt.setSimulatedInt(32);
- caps.fragmentMediumpInt.setTwosComplementInt(16);
- caps.fragmentLowpInt.setTwosComplementInt(8);
- caps.maxServerWaitTimeout = 0;
-
- // Table 6.31
- caps.maxVertexAttributes = 16;
- caps.maxVertexUniformComponents = 1024;
- caps.maxVertexUniformVectors = 256;
- caps.maxVertexUniformBlocks = 12;
- caps.maxVertexOutputComponents = 64;
- caps.maxVertexTextureImageUnits = 16;
-
- // Table 6.32
- caps.maxFragmentUniformComponents = 896;
- caps.maxFragmentUniformVectors = 224;
- caps.maxFragmentUniformBlocks = 12;
- caps.maxFragmentInputComponents = 60;
- caps.maxTextureImageUnits = 16;
- caps.minProgramTexelOffset = -8;
- caps.maxProgramTexelOffset = 7;
-
- // Table 6.33
- caps.maxUniformBufferBindings = 24;
- caps.maxUniformBlockSize = 16384;
- caps.uniformBufferOffsetAlignment = 256;
- caps.maxCombinedUniformBlocks = 24;
- caps.maxCombinedVertexUniformComponents =
- caps.maxVertexUniformBlocks * (caps.maxUniformBlockSize / 4) +
- caps.maxVertexUniformComponents;
- caps.maxCombinedFragmentUniformComponents =
- caps.maxFragmentUniformBlocks * (caps.maxUniformBlockSize / 4) +
- caps.maxFragmentUniformComponents;
- caps.maxVaryingComponents = 60;
- caps.maxVaryingVectors = 15;
- caps.maxCombinedTextureImageUnits = 32;
-
- // Table 6.34
- caps.maxTransformFeedbackInterleavedComponents = 64;
- caps.maxTransformFeedbackSeparateAttributes = 4;
- caps.maxTransformFeedbackSeparateComponents = 4;
-
- // Table 3.35
- caps.maxSamples = 4;
- }
-
- if (clientVersion >= Version(3, 1))
- {
- // Table 20.40
- caps.maxFramebufferWidth = 2048;
- caps.maxFramebufferHeight = 2048;
- caps.maxFramebufferSamples = 4;
- caps.maxSampleMaskWords = 1;
- caps.maxColorTextureSamples = 1;
- caps.maxDepthTextureSamples = 1;
- caps.maxIntegerSamples = 1;
-
- // Table 20.41
- caps.maxVertexAttribRelativeOffset = 2047;
- caps.maxVertexAttribBindings = 16;
- caps.maxVertexAttribStride = 2048;
-
- // Table 20.43
- caps.maxVertexAtomicCounterBuffers = 0;
- caps.maxVertexAtomicCounters = 0;
- caps.maxVertexImageUniforms = 0;
- caps.maxVertexShaderStorageBlocks = 0;
-
- // Table 20.44
- caps.maxFragmentUniformComponents = 1024;
- caps.maxFragmentUniformVectors = 256;
- caps.maxFragmentAtomicCounterBuffers = 0;
- caps.maxFragmentAtomicCounters = 0;
- caps.maxFragmentImageUniforms = 0;
- caps.maxFragmentShaderStorageBlocks = 0;
- caps.minProgramTextureGatherOffset = 0;
- caps.maxProgramTextureGatherOffset = 0;
-
- // Table 20.45
- caps.maxComputeWorkGroupCount = {{65535, 65535, 65535}};
- caps.maxComputeWorkGroupSize = {{128, 128, 64}};
- caps.maxComputeWorkGroupInvocations = 12;
- caps.maxComputeUniformBlocks = 12;
- caps.maxComputeTextureImageUnits = 16;
- caps.maxComputeSharedMemorySize = 16384;
- caps.maxComputeUniformComponents = 1024;
- caps.maxComputeAtomicCounterBuffers = 1;
- caps.maxComputeAtomicCounters = 8;
- caps.maxComputeImageUniforms = 4;
- caps.maxCombinedComputeUniformComponents =
- caps.maxComputeUniformBlocks * static_cast<GLuint>(caps.maxUniformBlockSize / 4) +
- caps.maxComputeUniformComponents;
- caps.maxComputeShaderStorageBlocks = 4;
-
- // Table 20.46
- caps.maxUniformBufferBindings = 36;
- caps.maxCombinedFragmentUniformComponents =
- caps.maxFragmentUniformBlocks * (caps.maxUniformBlockSize / 4) +
- caps.maxFragmentUniformComponents;
- caps.maxCombinedTextureImageUnits = 48;
- caps.maxCombinedShaderOutputResources = 4;
-
- // Table 20.47
- caps.maxUniformLocations = 1024;
- caps.maxAtomicCounterBufferBindings = 1;
- caps.maxAtomicCounterBufferSize = 32;
- caps.maxCombinedAtomicCounterBuffers = 1;
- caps.maxCombinedAtomicCounters = 8;
- caps.maxImageUnits = 4;
- caps.maxCombinedImageUniforms = 4;
- caps.maxShaderStorageBufferBindings = 4;
- caps.maxShaderStorageBlockSize = 1 << 27;
- caps.maxCombinedShaderStorageBlocks = 4;
- caps.shaderStorageBufferOffsetAlignment = 256;
- }
-
- if (extensions.textureRectangle)
- {
- caps.maxRectangleTextureSize = 64;
- }
-
- return caps;
-}
-}
-
-namespace egl
-{
-
-Caps::Caps()
- : textureNPOT(false)
-{
-}
-
-DisplayExtensions::DisplayExtensions()
- : createContextRobustness(false),
- d3dShareHandleClientBuffer(false),
- d3dTextureClientBuffer(false),
- surfaceD3DTexture2DShareHandle(false),
- querySurfacePointer(false),
- windowFixedSize(false),
- keyedMutex(false),
- surfaceOrientation(false),
- postSubBuffer(false),
- createContext(false),
- deviceQuery(false),
- image(false),
- imageBase(false),
- imagePixmap(false),
- glTexture2DImage(false),
- glTextureCubemapImage(false),
- glTexture3DImage(false),
- glRenderbufferImage(false),
- getAllProcAddresses(false),
- flexibleSurfaceCompatibility(false),
- directComposition(false),
- createContextNoError(false),
- stream(false),
- streamConsumerGLTexture(false),
- streamConsumerGLTextureYUV(false),
- streamProducerD3DTextureNV12(false),
- createContextWebGLCompatibility(false),
- createContextBindGeneratesResource(false),
- getSyncValues(false),
- swapBuffersWithDamage(false),
- pixelFormatFloat(false),
- surfacelessContext(false),
- displayTextureShareGroup(false),
- createContextClientArrays(false),
- programCacheControl(false),
- robustResourceInitialization(false)
-{
-}
-
-std::vector<std::string> DisplayExtensions::getStrings() const
-{
- std::vector<std::string> extensionStrings;
-
- // clang-format off
- // | Extension name | Supported flag | Output vector |
- InsertExtensionString("EGL_EXT_create_context_robustness", createContextRobustness, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_d3d_share_handle_client_buffer", d3dShareHandleClientBuffer, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_d3d_texture_client_buffer", d3dTextureClientBuffer, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_surface_d3d_texture_2d_share_handle", surfaceD3DTexture2DShareHandle, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_query_surface_pointer", querySurfacePointer, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_window_fixed_size", windowFixedSize, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_keyed_mutex", keyedMutex, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_surface_orientation", surfaceOrientation, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_direct_composition", directComposition, &extensionStrings);
- InsertExtensionString("EGL_NV_post_sub_buffer", postSubBuffer, &extensionStrings);
- InsertExtensionString("EGL_KHR_create_context", createContext, &extensionStrings);
- InsertExtensionString("EGL_EXT_device_query", deviceQuery, &extensionStrings);
- InsertExtensionString("EGL_KHR_image", image, &extensionStrings);
- InsertExtensionString("EGL_KHR_image_base", imageBase, &extensionStrings);
- InsertExtensionString("EGL_KHR_image_pixmap", imagePixmap, &extensionStrings);
- InsertExtensionString("EGL_KHR_gl_texture_2D_image", glTexture2DImage, &extensionStrings);
- InsertExtensionString("EGL_KHR_gl_texture_cubemap_image", glTextureCubemapImage, &extensionStrings);
- InsertExtensionString("EGL_KHR_gl_texture_3D_image", glTexture3DImage, &extensionStrings);
- InsertExtensionString("EGL_KHR_gl_renderbuffer_image", glRenderbufferImage, &extensionStrings);
- InsertExtensionString("EGL_KHR_get_all_proc_addresses", getAllProcAddresses, &extensionStrings);
- InsertExtensionString("EGL_KHR_stream", stream, &extensionStrings);
- InsertExtensionString("EGL_KHR_stream_consumer_gltexture", streamConsumerGLTexture, &extensionStrings);
- InsertExtensionString("EGL_NV_stream_consumer_gltexture_yuv", streamConsumerGLTextureYUV, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_flexible_surface_compatibility", flexibleSurfaceCompatibility, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_stream_producer_d3d_texture_nv12", streamProducerD3DTextureNV12, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_create_context_webgl_compatibility", createContextWebGLCompatibility, &extensionStrings);
- InsertExtensionString("EGL_CHROMIUM_create_context_bind_generates_resource", createContextBindGeneratesResource, &extensionStrings);
- InsertExtensionString("EGL_CHROMIUM_sync_control", getSyncValues, &extensionStrings);
- InsertExtensionString("EGL_EXT_swap_buffers_with_damage", swapBuffersWithDamage, &extensionStrings);
- InsertExtensionString("EGL_EXT_pixel_format_float", pixelFormatFloat, &extensionStrings);
- InsertExtensionString("EGL_KHR_surfaceless_context", surfacelessContext, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_display_texture_share_group", displayTextureShareGroup, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_create_context_client_arrays", createContextClientArrays, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_program_cache_control", programCacheControl, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_robust_resource_initialization", robustResourceInitialization, &extensionStrings);
- // TODO(jmadill): Enable this when complete.
- //InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings);
- // clang-format on
-
- return extensionStrings;
-}
-
-DeviceExtensions::DeviceExtensions()
- : deviceD3D(false)
-{
-}
-
-std::vector<std::string> DeviceExtensions::getStrings() const
-{
- std::vector<std::string> extensionStrings;
-
- // | Extension name | Supported flag | Output vector |
- InsertExtensionString("EGL_ANGLE_device_d3d", deviceD3D, &extensionStrings);
-
- return extensionStrings;
-}
-
-ClientExtensions::ClientExtensions()
- : clientExtensions(false),
- platformBase(false),
- platformDevice(false),
- platformANGLE(false),
- platformANGLED3D(false),
- platformANGLEOpenGL(false),
- platformANGLEVulkan(false),
- deviceCreation(false),
- deviceCreationD3D11(false),
- x11Visual(false),
- experimentalPresentPath(false),
- clientGetAllProcAddresses(false)
-{
-}
-
-ClientExtensions::ClientExtensions(const ClientExtensions &other) = default;
-
-std::vector<std::string> ClientExtensions::getStrings() const
-{
- std::vector<std::string> extensionStrings;
-
- // clang-format off
- // | Extension name | Supported flag | Output vector |
- InsertExtensionString("EGL_EXT_client_extensions", clientExtensions, &extensionStrings);
- InsertExtensionString("EGL_EXT_platform_base", platformBase, &extensionStrings);
- InsertExtensionString("EGL_EXT_platform_device", platformDevice, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_platform_angle_vulkan", platformANGLEVulkan, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_device_creation", deviceCreation, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_device_creation_d3d11", deviceCreationD3D11, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_x11_visual", x11Visual, &extensionStrings);
- InsertExtensionString("EGL_ANGLE_experimental_present_path", experimentalPresentPath, &extensionStrings);
- InsertExtensionString("EGL_KHR_client_get_all_proc_addresses", clientGetAllProcAddresses, &extensionStrings);
- // clang-format on
-
- return extensionStrings;
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Caps.h b/src/3rdparty/angle/src/libANGLE/Caps.h
deleted file mode 100644
index 64bdf97112..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Caps.h
+++ /dev/null
@@ -1,758 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-#ifndef LIBANGLE_CAPS_H_
-#define LIBANGLE_CAPS_H_
-
-#include "angle_gl.h"
-#include "libANGLE/Version.h"
-#include "libANGLE/angletypes.h"
-#include "libANGLE/renderer/Format.h"
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-#include <array>
-
-namespace gl
-{
-
-struct Extensions;
-
-typedef std::set<GLuint> SupportedSampleSet;
-
-struct TextureCaps
-{
- TextureCaps();
- TextureCaps(const TextureCaps &other);
- ~TextureCaps();
-
- // Supports for basic texturing: glTexImage, glTexSubImage, etc
- bool texturable;
-
- // Support for linear or anisotropic filtering
- bool filterable;
-
- // Support for being used as a framebuffer attachment or renderbuffer format
- bool renderable;
-
- // Set of supported sample counts, only guaranteed to be valid in ES3.
- SupportedSampleSet sampleCounts;
-
- // Get the maximum number of samples supported
- GLuint getMaxSamples() const;
-
- // Get the number of supported samples that is at least as many as requested. Returns 0 if
- // there are no sample counts available
- GLuint getNearestSamples(GLuint requestedSamples) const;
-};
-
-TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
- const Version &clientVersion,
- const Extensions &extensions);
-
-class TextureCapsMap final : angle::NonCopyable
-{
- public:
- TextureCapsMap();
- ~TextureCapsMap();
-
- // These methods are deprecated. Please use angle::Format for new features.
- void insert(GLenum internalFormat, const TextureCaps &caps);
- const TextureCaps &get(GLenum internalFormat) const;
-
- void clear();
-
- // Prefer using angle::Format methods.
- const TextureCaps &get(angle::Format::ID formatID) const;
- void set(angle::Format::ID formatID, const TextureCaps &caps);
-
- private:
- TextureCaps &get(angle::Format::ID formatID);
-
- // Indexed by angle::Format::ID
- std::array<TextureCaps, angle::kNumANGLEFormats> mFormatData;
-};
-
-void InitMinimumTextureCapsMap(const Version &clientVersion,
- const Extensions &extensions,
- TextureCapsMap *capsMap);
-
-struct Extensions
-{
- Extensions();
-
- // Generate a vector of supported extension strings
- std::vector<std::string> getStrings() const;
-
- // Set all texture related extension support based on the supported textures.
- // Determines support for:
- // GL_OES_packed_depth_stencil
- // GL_OES_rgb8_rgba8
- // GL_EXT_texture_format_BGRA8888
- // GL_EXT_color_buffer_half_float,
- // GL_OES_texture_half_float, GL_OES_texture_half_float_linear
- // GL_OES_texture_float, GL_OES_texture_float_linear
- // GL_EXT_texture_rg
- // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3,
- // GL_ANGLE_texture_compression_dxt5
- // GL_KHR_texture_compression_astc_hdr, GL_KHR_texture_compression_astc_ldr
- // GL_OES_compressed_ETC1_RGB8_texture
- // GL_EXT_sRGB
- // GL_ANGLE_depth_texture, GL_OES_depth32
- // GL_EXT_color_buffer_float
- // GL_EXT_texture_norm16
- void setTextureExtensionSupport(const TextureCapsMap &textureCaps);
-
- // ES2 Extension support
-
- // GL_OES_element_index_uint
- bool elementIndexUint;
-
- // GL_OES_packed_depth_stencil
- bool packedDepthStencil;
-
- // GL_OES_get_program_binary
- bool getProgramBinary;
-
- // GL_OES_rgb8_rgba8
- // Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist
- bool rgb8rgba8;
-
- // GL_EXT_texture_format_BGRA8888
- // Implies that TextureCaps for GL_BGRA8 exist
- bool textureFormatBGRA8888;
-
- // GL_EXT_read_format_bgra
- bool readFormatBGRA;
-
- // GL_NV_pixel_buffer_object
- bool pixelBufferObject;
-
- // GL_OES_mapbuffer and GL_EXT_map_buffer_range
- bool mapBuffer;
- bool mapBufferRange;
-
- // GL_EXT_color_buffer_half_float
- // Together with GL_OES_texture_half_float in a GLES 2.0 context, implies that half-float
- // textures are renderable.
- bool colorBufferHalfFloat;
-
- // GL_OES_texture_half_float and GL_OES_texture_half_float_linear
- // Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and
- // GL_LUMINANCE_ALPHA32F_EXT exist
- bool textureHalfFloat;
- bool textureHalfFloatLinear;
-
- // GL_OES_texture_float and GL_OES_texture_float_linear
- // Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and
- // GL_LUMINANCE_ALPHA16F_EXT exist
- bool textureFloat;
- bool textureFloatLinear;
-
- // GL_EXT_texture_rg
- // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if floating point extensions
- // are also present) exist
- bool textureRG;
-
- // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5
- // Implies that TextureCaps exist for GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
- // GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE
- bool textureCompressionDXT1;
- bool textureCompressionDXT3;
- bool textureCompressionDXT5;
-
- // GL_EXT_texture_compression_s3tc_srgb
- // Implies that TextureCaps exist for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
- // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and
- // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
- bool textureCompressionS3TCsRGB;
-
- // GL_KHR_texture_compression_astc_hdr
- bool textureCompressionASTCHDR;
-
- // GL_KHR_texture_compression_astc_ldr
- bool textureCompressionASTCLDR;
-
- // GL_OES_compressed_ETC1_RGB8_texture
- // Implies that TextureCaps for GL_ETC1_RGB8_OES exist
- bool compressedETC1RGB8Texture;
-
- // GL_EXT_sRGB
- // Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
- // TODO: Don't advertise this extension in ES3
- bool sRGB;
-
- // GL_ANGLE_depth_texture
- bool depthTextures;
-
- // GL_OES_depth32
- // Allows DEPTH_COMPONENT32_OES as a valid Renderbuffer format.
- bool depth32;
-
- // GL_EXT_texture_storage
- bool textureStorage;
-
- // GL_OES_texture_npot
- bool textureNPOT;
-
- // GL_EXT_draw_buffers
- bool drawBuffers;
-
- // GL_EXT_texture_filter_anisotropic
- bool textureFilterAnisotropic;
- GLfloat maxTextureAnisotropy;
-
- // GL_EXT_occlusion_query_boolean
- bool occlusionQueryBoolean;
-
- // GL_NV_fence
- bool fence;
-
- // GL_EXT_disjoint_timer_query
- bool disjointTimerQuery;
- GLuint queryCounterBitsTimeElapsed;
- GLuint queryCounterBitsTimestamp;
-
- // GL_EXT_robustness
- bool robustness;
-
- // GL_KHR_robust_buffer_access_behavior
- bool robustBufferAccessBehavior;
-
- // GL_EXT_blend_minmax
- bool blendMinMax;
-
- // GL_ANGLE_framebuffer_blit
- bool framebufferBlit;
-
- // GL_ANGLE_framebuffer_multisample
- bool framebufferMultisample;
-
- // GL_ANGLE_instanced_arrays
- bool instancedArrays;
-
- // GL_ANGLE_pack_reverse_row_order
- bool packReverseRowOrder;
-
- // GL_OES_standard_derivatives
- bool standardDerivatives;
-
- // GL_EXT_shader_texture_lod
- bool shaderTextureLOD;
-
- // GL_EXT_frag_depth
- bool fragDepth;
-
- // ANGLE_multiview
- bool multiview;
- GLuint maxViews;
-
- // GL_ANGLE_texture_usage
- bool textureUsage;
-
- // GL_ANGLE_translated_shader_source
- bool translatedShaderSource;
-
- // GL_OES_fbo_render_mipmap
- bool fboRenderMipmap;
-
- // GL_EXT_discard_framebuffer
- bool discardFramebuffer;
-
- // EXT_debug_marker
- bool debugMarker;
-
- // GL_OES_EGL_image
- bool eglImage;
-
- // GL_OES_EGL_image_external
- bool eglImageExternal;
-
- // GL_OES_EGL_image_external_essl3
- bool eglImageExternalEssl3;
-
- // NV_EGL_stream_consumer_external
- bool eglStreamConsumerExternal;
-
- // EXT_unpack_subimage
- bool unpackSubimage;
-
- // NV_pack_subimage
- bool packSubimage;
-
- // GL_OES_vertex_array_object
- bool vertexArrayObject;
-
- // GL_KHR_debug
- bool debug;
- GLuint maxDebugMessageLength;
- GLuint maxDebugLoggedMessages;
- GLuint maxDebugGroupStackDepth;
- GLuint maxLabelLength;
-
- // KHR_no_error
- bool noError;
-
- // GL_ANGLE_lossy_etc_decode
- bool lossyETCDecode;
-
- // GL_CHROMIUM_bind_uniform_location
- bool bindUniformLocation;
-
- // GL_CHROMIUM_sync_query
- bool syncQuery;
-
- // GL_CHROMIUM_copy_texture
- bool copyTexture;
-
- // GL_CHROMIUM_copy_compressed_texture
- bool copyCompressedTexture;
-
- // GL_ANGLE_webgl_compatibility
- bool webglCompatibility;
-
- // GL_ANGLE_request_extension
- bool requestExtension;
-
- // GL_CHROMIUM_bind_generates_resource
- bool bindGeneratesResource;
-
- // GL_ANGLE_robust_client_memory
- bool robustClientMemory;
-
- // GL_EXT_texture_sRGB_decode
- bool textureSRGBDecode;
-
- // GL_EXT_sRGB_write_control
- bool sRGBWriteControl;
-
- // GL_CHROMIUM_color_buffer_float_rgb
- bool colorBufferFloatRGB;
-
- // GL_CHROMIUM_color_buffer_float_rgba
- bool colorBufferFloatRGBA;
-
- // ES3 Extension support
-
- // GL_EXT_color_buffer_float
- bool colorBufferFloat;
-
- // GL_EXT_multisample_compatibility.
- // written against ES 3.1 but can apply to earlier versions.
- bool multisampleCompatibility;
-
- // GL_CHROMIUM_framebuffer_mixed_samples
- bool framebufferMixedSamples;
-
- // GL_EXT_texture_norm16
- // written against ES 3.1 but can apply to ES 3.0 as well.
- bool textureNorm16;
-
- // GL_CHROMIUM_path_rendering
- bool pathRendering;
-
- // GL_OES_surfaceless_context
- bool surfacelessContext;
-
- // GL_ANGLE_client_arrays
- bool clientArrays;
-
- // GL_ANGLE_robust_resource_initialization
- bool robustResourceInitialization;
-
- // GL_ANGLE_program_cache_control
- bool programCacheControl;
-
- // GL_ANGLE_texture_rectangle
- bool textureRectangle;
-
- // GL_EXT_geometry_shader
- bool geometryShader;
- // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
- // limits
- // TODO(jiawei.shao@intel.com): add all implementation dependent geometry shader limits.
- GLuint maxGeometryOutputVertices;
- GLuint maxGeometryShaderInvocations;
-};
-
-struct ExtensionInfo
-{
- // If this extension can be enabled with glRequestExtension (GL_ANGLE_request_extension)
- bool Requestable = false;
-
- // Pointer to a boolean member of the Extensions struct
- typedef bool(Extensions::*ExtensionBool);
- ExtensionBool ExtensionsMember = nullptr;
-};
-
-using ExtensionInfoMap = std::map<std::string, ExtensionInfo>;
-const ExtensionInfoMap &GetExtensionInfoMap();
-
-struct Limitations
-{
- Limitations();
-
- // Renderer doesn't support gl_FrontFacing in fragment shaders
- bool noFrontFacingSupport;
-
- // Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE
- bool noSampleAlphaToCoverageSupport;
-
- // In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor
- bool attributeZeroRequiresZeroDivisorInEXT;
-
- // Unable to support different values for front and back faces for stencil refs and masks
- bool noSeparateStencilRefsAndMasks;
-
- // Renderer doesn't support non-constant indexing loops in fragment shader
- bool shadersRequireIndexedLoopValidation;
-
- // Renderer doesn't support Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA
- // and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR blend functions.
- bool noSimultaneousConstantColorAndAlphaBlendFunc;
-};
-
-struct TypePrecision
-{
- TypePrecision();
- TypePrecision(const TypePrecision &other);
-
- void setIEEEFloat();
- void setTwosComplementInt(unsigned int bits);
- void setSimulatedFloat(unsigned int range, unsigned int precision);
- void setSimulatedInt(unsigned int range);
-
- void get(GLint *returnRange, GLint *returnPrecision) const;
-
- std::array<GLint, 2> range;
- GLint precision;
-};
-
-struct Caps
-{
- Caps();
- Caps(const Caps &other);
- ~Caps();
-
- // ES 3.1 (April 29, 2015) 20.39: implementation dependent values
- GLuint64 maxElementIndex;
- GLuint max3DTextureSize;
- GLuint max2DTextureSize;
- GLuint maxRectangleTextureSize;
- GLuint maxArrayTextureLayers;
- GLfloat maxLODBias;
- GLuint maxCubeMapTextureSize;
- GLuint maxRenderbufferSize;
- GLfloat minAliasedPointSize;
- GLfloat maxAliasedPointSize;
- GLfloat minAliasedLineWidth;
- GLfloat maxAliasedLineWidth;
-
- // ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)
- GLuint maxDrawBuffers;
- GLuint maxFramebufferWidth;
- GLuint maxFramebufferHeight;
- GLuint maxFramebufferSamples;
- GLuint maxColorAttachments;
- GLuint maxViewportWidth;
- GLuint maxViewportHeight;
- GLuint maxSampleMaskWords;
- GLuint maxColorTextureSamples;
- GLuint maxDepthTextureSamples;
- GLuint maxIntegerSamples;
- GLuint64 maxServerWaitTimeout;
-
- // ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)
- GLint maxVertexAttribRelativeOffset;
- GLuint maxVertexAttribBindings;
- GLint maxVertexAttribStride;
- GLuint maxElementsIndices;
- GLuint maxElementsVertices;
- std::vector<GLenum> compressedTextureFormats;
- std::vector<GLenum> programBinaryFormats;
- std::vector<GLenum> shaderBinaryFormats;
- TypePrecision vertexHighpFloat;
- TypePrecision vertexMediumpFloat;
- TypePrecision vertexLowpFloat;
- TypePrecision vertexHighpInt;
- TypePrecision vertexMediumpInt;
- TypePrecision vertexLowpInt;
- TypePrecision fragmentHighpFloat;
- TypePrecision fragmentMediumpFloat;
- TypePrecision fragmentLowpFloat;
- TypePrecision fragmentHighpInt;
- TypePrecision fragmentMediumpInt;
- TypePrecision fragmentLowpInt;
-
- // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
- GLuint maxVertexAttributes;
- GLuint maxVertexUniformComponents;
- GLuint maxVertexUniformVectors;
- GLuint maxVertexUniformBlocks;
- GLuint maxVertexOutputComponents;
- GLuint maxVertexTextureImageUnits;
- GLuint maxVertexAtomicCounterBuffers;
- GLuint maxVertexAtomicCounters;
- GLuint maxVertexImageUniforms;
- GLuint maxVertexShaderStorageBlocks;
-
- // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
- GLuint maxFragmentUniformComponents;
- GLuint maxFragmentUniformVectors;
- GLuint maxFragmentUniformBlocks;
- GLuint maxFragmentInputComponents;
- GLuint maxTextureImageUnits;
- GLuint maxFragmentAtomicCounterBuffers;
- GLuint maxFragmentAtomicCounters;
- GLuint maxFragmentImageUniforms;
- GLuint maxFragmentShaderStorageBlocks;
- GLint minProgramTextureGatherOffset;
- GLuint maxProgramTextureGatherOffset;
- GLint minProgramTexelOffset;
- GLint maxProgramTexelOffset;
-
- // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
- std::array<GLuint, 3> maxComputeWorkGroupCount;
- std::array<GLuint, 3> maxComputeWorkGroupSize;
- GLuint maxComputeWorkGroupInvocations;
- GLuint maxComputeUniformBlocks;
- GLuint maxComputeTextureImageUnits;
- GLuint maxComputeSharedMemorySize;
- GLuint maxComputeUniformComponents;
- GLuint maxComputeAtomicCounterBuffers;
- GLuint maxComputeAtomicCounters;
- GLuint maxComputeImageUniforms;
- GLuint maxCombinedComputeUniformComponents;
- GLuint maxComputeShaderStorageBlocks;
-
- // ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits
- GLuint maxUniformBufferBindings;
- GLuint64 maxUniformBlockSize;
- GLuint uniformBufferOffsetAlignment;
- GLuint maxCombinedUniformBlocks;
- GLuint64 maxCombinedVertexUniformComponents;
- GLuint64 maxCombinedFragmentUniformComponents;
- GLuint maxVaryingComponents;
- GLuint maxVaryingVectors;
- GLuint maxCombinedTextureImageUnits;
- GLuint maxCombinedShaderOutputResources;
-
- // ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)
- GLuint maxUniformLocations;
- GLuint maxAtomicCounterBufferBindings;
- GLuint maxAtomicCounterBufferSize;
- GLuint maxCombinedAtomicCounterBuffers;
- GLuint maxCombinedAtomicCounters;
- GLuint maxImageUnits;
- GLuint maxCombinedImageUniforms;
- GLuint maxShaderStorageBufferBindings;
- GLuint64 maxShaderStorageBlockSize;
- GLuint maxCombinedShaderStorageBlocks;
- GLuint shaderStorageBufferOffsetAlignment;
-
- // ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits
- GLuint maxTransformFeedbackInterleavedComponents;
- GLuint maxTransformFeedbackSeparateAttributes;
- GLuint maxTransformFeedbackSeparateComponents;
-
- // ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values
- GLuint maxSamples;
-};
-
-Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions);
-}
-
-namespace egl
-{
-
-struct Caps
-{
- Caps();
-
- // Support for NPOT surfaces
- bool textureNPOT;
-};
-
-struct DisplayExtensions
-{
- DisplayExtensions();
-
- // Generate a vector of supported extension strings
- std::vector<std::string> getStrings() const;
-
- // EGL_EXT_create_context_robustness
- bool createContextRobustness;
-
- // EGL_ANGLE_d3d_share_handle_client_buffer
- bool d3dShareHandleClientBuffer;
-
- // EGL_ANGLE_d3d_texture_client_buffer
- bool d3dTextureClientBuffer;
-
- // EGL_ANGLE_surface_d3d_texture_2d_share_handle
- bool surfaceD3DTexture2DShareHandle;
-
- // EGL_ANGLE_query_surface_pointer
- bool querySurfacePointer;
-
- // EGL_ANGLE_window_fixed_size
- bool windowFixedSize;
-
- // EGL_ANGLE_keyed_mutex
- bool keyedMutex;
-
- // EGL_ANGLE_surface_orientation
- bool surfaceOrientation;
-
- // EGL_NV_post_sub_buffer
- bool postSubBuffer;
-
- // EGL_KHR_create_context
- bool createContext;
-
- // EGL_EXT_device_query
- bool deviceQuery;
-
- // EGL_KHR_image
- bool image;
-
- // EGL_KHR_image_base
- bool imageBase;
-
- // EGL_KHR_image_pixmap
- bool imagePixmap;
-
- // EGL_KHR_gl_texture_2D_image
- bool glTexture2DImage;
-
- // EGL_KHR_gl_texture_cubemap_image
- bool glTextureCubemapImage;
-
- // EGL_KHR_gl_texture_3D_image
- bool glTexture3DImage;
-
- // EGL_KHR_gl_renderbuffer_image
- bool glRenderbufferImage;
-
- // EGL_KHR_get_all_proc_addresses
- bool getAllProcAddresses;
-
- // EGL_ANGLE_flexible_surface_compatibility
- bool flexibleSurfaceCompatibility;
-
- // EGL_ANGLE_direct_composition
- bool directComposition;
-
- // KHR_create_context_no_error
- bool createContextNoError;
-
- // EGL_KHR_stream
- bool stream;
-
- // EGL_KHR_stream_consumer_gltexture
- bool streamConsumerGLTexture;
-
- // EGL_NV_stream_consumer_gltexture_yuv
- bool streamConsumerGLTextureYUV;
-
- // EGL_ANGLE_stream_producer_d3d_texture_nv12
- bool streamProducerD3DTextureNV12;
-
- // EGL_ANGLE_create_context_webgl_compatibility
- bool createContextWebGLCompatibility;
-
- // EGL_CHROMIUM_create_context_bind_generates_resource
- bool createContextBindGeneratesResource;
-
- // EGL_CHROMIUM_get_sync_values
- bool getSyncValues;
-
- // EGL_EXT_swap_buffers_with_damage
- bool swapBuffersWithDamage;
-
- // EGL_EXT_pixel_format_float
- bool pixelFormatFloat;
-
- // EGL_KHR_surfaceless_context
- bool surfacelessContext;
-
- // EGL_ANGLE_display_texture_share_group
- bool displayTextureShareGroup;
-
- // EGL_ANGLE_create_context_client_arrays
- bool createContextClientArrays;
-
- // EGL_ANGLE_program_cache_control
- bool programCacheControl;
-
- // EGL_ANGLE_robust_resource_initialization
- bool robustResourceInitialization;
-};
-
-struct DeviceExtensions
-{
- DeviceExtensions();
-
- // Generate a vector of supported extension strings
- std::vector<std::string> getStrings() const;
-
- // EGL_ANGLE_device_d3d
- bool deviceD3D;
-};
-
-struct ClientExtensions
-{
- ClientExtensions();
- ClientExtensions(const ClientExtensions &other);
-
- // Generate a vector of supported extension strings
- std::vector<std::string> getStrings() const;
-
- // EGL_EXT_client_extensions
- bool clientExtensions;
-
- // EGL_EXT_platform_base
- bool platformBase;
-
- // EGL_EXT_platform_device
- bool platformDevice;
-
- // EGL_ANGLE_platform_angle
- bool platformANGLE;
-
- // EGL_ANGLE_platform_angle_d3d
- bool platformANGLED3D;
-
- // EGL_ANGLE_platform_angle_opengl
- bool platformANGLEOpenGL;
-
- // EGL_ANGLE_platform_angle_null
- bool platformANGLENULL;
-
- // EGL_ANGLE_platform_angle_vulkan
- bool platformANGLEVulkan;
-
- // EGL_ANGLE_device_creation
- bool deviceCreation;
-
- // EGL_ANGLE_device_creation_d3d11
- bool deviceCreationD3D11;
-
- // EGL_ANGLE_x11_visual
- bool x11Visual;
-
- // EGL_ANGLE_experimental_present_path
- bool experimentalPresentPath;
-
- // EGL_KHR_client_get_all_proc_addresses
- bool clientGetAllProcAddresses;
-};
-
-} // namespace egl
-
-#endif // LIBANGLE_CAPS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Compiler.cpp b/src/3rdparty/angle/src/libANGLE/Compiler.cpp
deleted file mode 100644
index 236c7e1fc2..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Compiler.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-// Compiler.cpp: implements the gl::Compiler class.
-
-#include "libANGLE/Compiler.h"
-
-#include "common/debug.h"
-#include "libANGLE/ContextState.h"
-#include "libANGLE/renderer/CompilerImpl.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-
-namespace gl
-{
-
-namespace
-{
-
-// Global count of active shader compiler handles. Needed to know when to call sh::Initialize and
-// sh::Finalize.
-size_t activeCompilerHandles = 0;
-
-ShShaderSpec SelectShaderSpec(GLint majorVersion, GLint minorVersion, bool isWebGL)
-{
- if (majorVersion >= 3)
- {
- if (minorVersion == 1)
- {
- return isWebGL ? SH_WEBGL3_SPEC : SH_GLES3_1_SPEC;
- }
- else
- {
- return isWebGL ? SH_WEBGL2_SPEC : SH_GLES3_SPEC;
- }
- }
- return isWebGL ? SH_WEBGL_SPEC : SH_GLES2_SPEC;
-}
-
-} // anonymous namespace
-
-Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state)
- : mImplementation(implFactory->createCompiler()),
- mSpec(SelectShaderSpec(state.getClientMajorVersion(),
- state.getClientMinorVersion(),
- state.getExtensions().webglCompatibility)),
- mOutputType(mImplementation->getTranslatorOutputType()),
- mResources(),
- mFragmentCompiler(nullptr),
- mVertexCompiler(nullptr),
- mComputeCompiler(nullptr),
- mGeometryCompiler(nullptr)
-{
- ASSERT(state.getClientMajorVersion() == 2 || state.getClientMajorVersion() == 3);
-
- const gl::Caps &caps = state.getCaps();
- const gl::Extensions &extensions = state.getExtensions();
-
- sh::InitBuiltInResources(&mResources);
- mResources.MaxVertexAttribs = caps.maxVertexAttributes;
- mResources.MaxVertexUniformVectors = caps.maxVertexUniformVectors;
- mResources.MaxVaryingVectors = caps.maxVaryingVectors;
- mResources.MaxVertexTextureImageUnits = caps.maxVertexTextureImageUnits;
- mResources.MaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
- mResources.MaxTextureImageUnits = caps.maxTextureImageUnits;
- mResources.MaxFragmentUniformVectors = caps.maxFragmentUniformVectors;
- mResources.MaxDrawBuffers = caps.maxDrawBuffers;
- mResources.OES_standard_derivatives = extensions.standardDerivatives;
- mResources.EXT_draw_buffers = extensions.drawBuffers;
- mResources.EXT_shader_texture_lod = extensions.shaderTextureLOD;
- mResources.OES_EGL_image_external = extensions.eglImageExternal;
- mResources.OES_EGL_image_external_essl3 = extensions.eglImageExternalEssl3;
- mResources.NV_EGL_stream_consumer_external = extensions.eglStreamConsumerExternal;
- mResources.ARB_texture_rectangle = extensions.textureRectangle;
- // TODO: use shader precision caps to determine if high precision is supported?
- mResources.FragmentPrecisionHigh = 1;
- mResources.EXT_frag_depth = extensions.fragDepth;
-
- // OVR_multiview state
- mResources.OVR_multiview = extensions.multiview;
- mResources.MaxViewsOVR = extensions.maxViews;
-
- // GLSL ES 3.0 constants
- mResources.MaxVertexOutputVectors = caps.maxVertexOutputComponents / 4;
- mResources.MaxFragmentInputVectors = caps.maxFragmentInputComponents / 4;
- mResources.MinProgramTexelOffset = caps.minProgramTexelOffset;
- mResources.MaxProgramTexelOffset = caps.maxProgramTexelOffset;
-
- // GLSL ES 3.1 constants
- mResources.MaxProgramTextureGatherOffset = caps.maxProgramTextureGatherOffset;
- mResources.MinProgramTextureGatherOffset = caps.minProgramTextureGatherOffset;
- mResources.MaxImageUnits = caps.maxImageUnits;
- mResources.MaxVertexImageUniforms = caps.maxVertexImageUniforms;
- mResources.MaxFragmentImageUniforms = caps.maxFragmentImageUniforms;
- mResources.MaxComputeImageUniforms = caps.maxComputeImageUniforms;
- mResources.MaxCombinedImageUniforms = caps.maxCombinedImageUniforms;
- mResources.MaxCombinedShaderOutputResources = caps.maxCombinedShaderOutputResources;
- mResources.MaxUniformLocations = caps.maxUniformLocations;
-
- for (size_t index = 0u; index < 3u; ++index)
- {
- mResources.MaxComputeWorkGroupCount[index] = caps.maxComputeWorkGroupCount[index];
- mResources.MaxComputeWorkGroupSize[index] = caps.maxComputeWorkGroupSize[index];
- }
-
- mResources.MaxComputeUniformComponents = caps.maxComputeUniformComponents;
- mResources.MaxComputeTextureImageUnits = caps.maxComputeTextureImageUnits;
-
- mResources.MaxComputeAtomicCounters = caps.maxComputeAtomicCounters;
- mResources.MaxComputeAtomicCounterBuffers = caps.maxComputeAtomicCounterBuffers;
-
- mResources.MaxVertexAtomicCounters = caps.maxVertexAtomicCounters;
- mResources.MaxFragmentAtomicCounters = caps.maxFragmentAtomicCounters;
- mResources.MaxCombinedAtomicCounters = caps.maxCombinedAtomicCounters;
- mResources.MaxAtomicCounterBindings = caps.maxAtomicCounterBufferBindings;
- mResources.MaxVertexAtomicCounterBuffers = caps.maxVertexAtomicCounterBuffers;
- mResources.MaxFragmentAtomicCounterBuffers = caps.maxFragmentAtomicCounterBuffers;
- mResources.MaxCombinedAtomicCounterBuffers = caps.maxCombinedAtomicCounterBuffers;
- mResources.MaxAtomicCounterBufferSize = caps.maxAtomicCounterBufferSize;
-
- mResources.MaxUniformBufferBindings = caps.maxUniformBufferBindings;
- mResources.MaxShaderStorageBufferBindings = caps.maxShaderStorageBufferBindings;
-
- // Needed by point size clamping workaround
- mResources.MaxPointSize = caps.maxAliasedPointSize;
-
- if (state.getClientMajorVersion() == 2 && !extensions.drawBuffers)
- {
- mResources.MaxDrawBuffers = 1;
- }
-
- // Geometry Shader constants
- mResources.OES_geometry_shader = extensions.geometryShader;
- // TODO(jiawei.shao@intel.com): initialize all implementation dependent geometry shader limits.
- mResources.MaxGeometryOutputVertices = extensions.maxGeometryOutputVertices;
- mResources.MaxGeometryShaderInvocations = extensions.maxGeometryShaderInvocations;
-}
-
-Compiler::~Compiler()
-{
- if (mFragmentCompiler)
- {
- sh::Destruct(mFragmentCompiler);
- mFragmentCompiler = nullptr;
-
- ASSERT(activeCompilerHandles > 0);
- activeCompilerHandles--;
- }
-
- if (mVertexCompiler)
- {
- sh::Destruct(mVertexCompiler);
- mVertexCompiler = nullptr;
-
- ASSERT(activeCompilerHandles > 0);
- activeCompilerHandles--;
- }
-
- if (mComputeCompiler)
- {
- sh::Destruct(mComputeCompiler);
- mComputeCompiler = nullptr;
-
- ASSERT(activeCompilerHandles > 0);
- activeCompilerHandles--;
- }
-
- if (activeCompilerHandles == 0)
- {
- sh::Finalize();
- }
-
- ANGLE_SWALLOW_ERR(mImplementation->release());
-}
-
-ShHandle Compiler::getCompilerHandle(GLenum type)
-{
- ShHandle *compiler = nullptr;
- switch (type)
- {
- case GL_VERTEX_SHADER:
- compiler = &mVertexCompiler;
- break;
-
- case GL_FRAGMENT_SHADER:
- compiler = &mFragmentCompiler;
- break;
- case GL_COMPUTE_SHADER:
- compiler = &mComputeCompiler;
- break;
- case GL_GEOMETRY_SHADER_EXT:
- compiler = &mGeometryCompiler;
- break;
- default:
- UNREACHABLE();
- return nullptr;
- }
-
- if (!(*compiler))
- {
- if (activeCompilerHandles == 0)
- {
- sh::Initialize();
- }
-
- *compiler = sh::ConstructCompiler(type, mSpec, mOutputType, &mResources);
- ASSERT(*compiler);
- activeCompilerHandles++;
- }
-
- return *compiler;
-}
-
-const std::string &Compiler::getBuiltinResourcesString(GLenum type)
-{
- return sh::GetBuiltInResourcesString(getCompilerHandle(type));
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Compiler.h b/src/3rdparty/angle/src/libANGLE/Compiler.h
deleted file mode 100644
index b7f7e9f31b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Compiler.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-// Compiler.h: Defines the gl::Compiler class, abstracting the ESSL compiler
-// that a GL context holds.
-
-#ifndef LIBANGLE_COMPILER_H_
-#define LIBANGLE_COMPILER_H_
-
-#include "GLSLANG/ShaderLang.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/RefCountObject.h"
-
-namespace rx
-{
-class CompilerImpl;
-class GLImplFactory;
-}
-
-namespace gl
-{
-class ContextState;
-
-class Compiler final : public RefCountObjectNoID
-{
- public:
- Compiler(rx::GLImplFactory *implFactory, const ContextState &data);
-
- ShHandle getCompilerHandle(GLenum type);
- ShShaderOutput getShaderOutputType() const { return mOutputType; }
- const std::string &getBuiltinResourcesString(GLenum type);
-
- private:
- ~Compiler() override;
- std::unique_ptr<rx::CompilerImpl> mImplementation;
- ShShaderSpec mSpec;
- ShShaderOutput mOutputType;
- ShBuiltInResources mResources;
-
- ShHandle mFragmentCompiler;
- ShHandle mVertexCompiler;
- ShHandle mComputeCompiler;
- ShHandle mGeometryCompiler;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_COMPILER_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Config.cpp b/src/3rdparty/angle/src/libANGLE/Config.cpp
deleted file mode 100644
index 172c312ae0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Config.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-//
-// Copyright (c) 2002-2010 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.
-//
-
-// Config.cpp: Implements the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.5] section 3.4 page 19.
-
-#include "libANGLE/Config.h"
-#include "libANGLE/AttributeMap.h"
-
-#include <algorithm>
-#include <vector>
-
-#include "angle_gl.h"
-#include <EGL/eglext.h>
-
-#include "common/debug.h"
-
-namespace egl
-{
-
-Config::Config()
- : renderTargetFormat(GL_NONE),
- depthStencilFormat(GL_NONE),
- bufferSize(0),
- redSize(0),
- greenSize(0),
- blueSize(0),
- luminanceSize(0),
- alphaSize(0),
- alphaMaskSize(0),
- bindToTextureRGB(EGL_FALSE),
- bindToTextureRGBA(EGL_FALSE),
- colorBufferType(EGL_NONE),
- configCaveat(EGL_NONE),
- configID(0),
- conformant(0),
- depthSize(0),
- level(0),
- matchNativePixmap(EGL_FALSE),
- maxPBufferWidth(0),
- maxPBufferHeight(0),
- maxPBufferPixels(0),
- maxSwapInterval(0),
- minSwapInterval(0),
- nativeRenderable(EGL_FALSE),
- nativeVisualID(0),
- nativeVisualType(0),
- renderableType(0),
- sampleBuffers(0),
- samples(0),
- stencilSize(0),
- surfaceType(0),
- transparentType(EGL_NONE),
- transparentRedValue(0),
- transparentGreenValue(0),
- transparentBlueValue(0),
- optimalOrientation(0),
- colorComponentType(EGL_COLOR_COMPONENT_TYPE_FIXED_EXT)
-{
-}
-
-Config::~Config()
-{
-}
-
-Config::Config(const Config &other) = default;
-
-Config &Config::operator=(const Config &other) = default;
-
-ConfigSet::ConfigSet() = default;
-
-ConfigSet::ConfigSet(const ConfigSet &other) = default;
-
-ConfigSet &ConfigSet::operator=(const ConfigSet &other) = default;
-
-ConfigSet::~ConfigSet() = default;
-
-EGLint ConfigSet::add(const Config &config)
-{
- // Set the config's ID to a small number that starts at 1 ([EGL 1.5] section 3.4)
- EGLint id = static_cast<EGLint>(mConfigs.size()) + 1;
-
- Config copyConfig(config);
- copyConfig.configID = id;
- mConfigs.insert(std::make_pair(id, copyConfig));
-
- return id;
-}
-
-const Config &ConfigSet::get(EGLint id) const
-{
- ASSERT(mConfigs.find(id) != mConfigs.end());
- return mConfigs.find(id)->second;
-}
-
-void ConfigSet::clear()
-{
- mConfigs.clear();
-}
-
-size_t ConfigSet::size() const
-{
- return mConfigs.size();
-}
-
-bool ConfigSet::contains(const Config *config) const
-{
- for (auto i = mConfigs.begin(); i != mConfigs.end(); i++)
- {
- const Config &item = i->second;
- if (config == &item)
- {
- return true;
- }
- }
-
- return false;
-}
-
-// Function object used by STL sorting routines for ordering Configs according to [EGL 1.5] section 3.4.1.2 page 28.
-class ConfigSorter
-{
- public:
- explicit ConfigSorter(const AttributeMap &attributeMap)
- : mWantRed(false),
- mWantGreen(false),
- mWantBlue(false),
- mWantAlpha(false),
- mWantLuminance(false)
- {
- scanForWantedComponents(attributeMap);
- }
-
- bool operator()(const Config *x, const Config *y) const
- {
- return (*this)(*x, *y);
- }
-
- bool operator()(const Config &x, const Config &y) const
- {
- #define SORT(attribute) \
- if (x.attribute != y.attribute) \
- { \
- return x.attribute < y.attribute; \
- }
-
- static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG, "Unexpected EGL enum value.");
- SORT(configCaveat);
-
- static_assert(EGL_COLOR_COMPONENT_TYPE_FIXED_EXT < EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
- "Unexpected order of EGL enums.");
- SORT(colorComponentType);
-
- static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "Unexpected EGL enum value.");
- SORT(colorBufferType);
-
- // By larger total number of color bits, only considering those that are requested to be > 0.
- EGLint xComponentsSize = wantedComponentsSize(x);
- EGLint yComponentsSize = wantedComponentsSize(y);
- if (xComponentsSize != yComponentsSize)
- {
- return xComponentsSize > yComponentsSize;
- }
-
- SORT(bufferSize);
- SORT(sampleBuffers);
- SORT(samples);
- SORT(depthSize);
- SORT(stencilSize);
- SORT(alphaMaskSize);
- SORT(nativeVisualType);
- SORT(configID);
-
- #undef SORT
-
- return false;
- }
-
- private:
-
- void scanForWantedComponents(const AttributeMap &attributeMap)
- {
- // [EGL 1.5] section 3.4.1.2 page 30
- // Sorting rule #3: by larger total number of color bits, not considering
- // components that are 0 or don't-care.
- for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++)
- {
- EGLint attributeKey = attribIter->first;
- EGLint attributeValue = attribIter->second;
- if (attributeKey != 0 && attributeValue != EGL_DONT_CARE)
- {
- switch (attributeKey)
- {
- case EGL_RED_SIZE: mWantRed = true; break;
- case EGL_GREEN_SIZE: mWantGreen = true; break;
- case EGL_BLUE_SIZE: mWantBlue = true; break;
- case EGL_ALPHA_SIZE: mWantAlpha = true; break;
- case EGL_LUMINANCE_SIZE: mWantLuminance = true; break;
- }
- }
- }
- }
-
- EGLint wantedComponentsSize(const Config &config) const
- {
- EGLint total = 0;
-
- if (mWantRed) total += config.redSize;
- if (mWantGreen) total += config.greenSize;
- if (mWantBlue) total += config.blueSize;
- if (mWantAlpha) total += config.alphaSize;
- if (mWantLuminance) total += config.luminanceSize;
-
- return total;
- }
-
- bool mWantRed;
- bool mWantGreen;
- bool mWantBlue;
- bool mWantAlpha;
- bool mWantLuminance;
-};
-
-std::vector<const Config*> ConfigSet::filter(const AttributeMap &attributeMap) const
-{
- std::vector<const Config*> result;
- result.reserve(mConfigs.size());
-
- for (auto configIter = mConfigs.begin(); configIter != mConfigs.end(); configIter++)
- {
- const Config &config = configIter->second;
- bool match = true;
-
- for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++)
- {
- EGLAttrib attributeKey = attribIter->first;
- EGLAttrib attributeValue = attribIter->second;
-
- if (attributeValue == EGL_DONT_CARE)
- {
- continue;
- }
-
- switch (attributeKey)
- {
- case EGL_BUFFER_SIZE: match = config.bufferSize >= attributeValue; break;
- case EGL_ALPHA_SIZE: match = config.alphaSize >= attributeValue; break;
- case EGL_BLUE_SIZE: match = config.blueSize >= attributeValue; break;
- case EGL_GREEN_SIZE: match = config.greenSize >= attributeValue; break;
- case EGL_RED_SIZE: match = config.redSize >= attributeValue; break;
- case EGL_DEPTH_SIZE: match = config.depthSize >= attributeValue; break;
- case EGL_STENCIL_SIZE: match = config.stencilSize >= attributeValue; break;
- case EGL_CONFIG_CAVEAT: match = config.configCaveat == (EGLenum)attributeValue; break;
- case EGL_CONFIG_ID: match = config.configID == attributeValue; break;
- case EGL_LEVEL: match = config.level >= attributeValue; break;
- case EGL_NATIVE_RENDERABLE: match = config.nativeRenderable == (EGLBoolean)attributeValue; break;
- case EGL_NATIVE_VISUAL_TYPE: match = config.nativeVisualType == attributeValue; break;
- case EGL_SAMPLES: match = config.samples >= attributeValue; break;
- case EGL_SAMPLE_BUFFERS: match = config.sampleBuffers >= attributeValue; break;
- case EGL_SURFACE_TYPE: match = (config.surfaceType & attributeValue) == attributeValue; break;
- case EGL_TRANSPARENT_TYPE: match = config.transparentType == (EGLenum)attributeValue; break;
- case EGL_TRANSPARENT_BLUE_VALUE: match = config.transparentBlueValue == attributeValue; break;
- case EGL_TRANSPARENT_GREEN_VALUE: match = config.transparentGreenValue == attributeValue; break;
- case EGL_TRANSPARENT_RED_VALUE: match = config.transparentRedValue == attributeValue; break;
- case EGL_BIND_TO_TEXTURE_RGB: match = config.bindToTextureRGB == (EGLBoolean)attributeValue; break;
- case EGL_BIND_TO_TEXTURE_RGBA: match = config.bindToTextureRGBA == (EGLBoolean)attributeValue; break;
- case EGL_MIN_SWAP_INTERVAL: match = config.minSwapInterval == attributeValue; break;
- case EGL_MAX_SWAP_INTERVAL: match = config.maxSwapInterval == attributeValue; break;
- case EGL_LUMINANCE_SIZE: match = config.luminanceSize >= attributeValue; break;
- case EGL_ALPHA_MASK_SIZE: match = config.alphaMaskSize >= attributeValue; break;
- case EGL_COLOR_BUFFER_TYPE: match = config.colorBufferType == (EGLenum)attributeValue; break;
- case EGL_RENDERABLE_TYPE: match = (config.renderableType & attributeValue) == attributeValue; break;
- case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
- case EGL_CONFORMANT: match = (config.conformant & attributeValue) == attributeValue; break;
- case EGL_MAX_PBUFFER_WIDTH: match = config.maxPBufferWidth >= attributeValue; break;
- case EGL_MAX_PBUFFER_HEIGHT: match = config.maxPBufferHeight >= attributeValue; break;
- case EGL_MAX_PBUFFER_PIXELS: match = config.maxPBufferPixels >= attributeValue; break;
- case EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE:
- match = config.optimalOrientation == attributeValue;
- break;
- case EGL_COLOR_COMPONENT_TYPE_EXT:
- match = config.colorComponentType == static_cast<EGLenum>(attributeValue);
- break;
- default: UNREACHABLE();
- }
-
- if (!match)
- {
- break;
- }
- }
-
- if (match)
- {
- result.push_back(&config);
- }
- }
-
- // Sort the result
- std::sort(result.begin(), result.end(), ConfigSorter(attributeMap));
-
- return result;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/Config.h b/src/3rdparty/angle/src/libANGLE/Config.h
deleted file mode 100644
index f2fbe8b95a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Config.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// Copyright (c) 2002-2010 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.
-//
-
-// Config.h: Defines the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.5] section 3.4 page 19.
-
-#ifndef INCLUDE_CONFIG_H_
-#define INCLUDE_CONFIG_H_
-
-#include "libANGLE/AttributeMap.h"
-
-#include "common/angleutils.h"
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-
-#include <map>
-#include <vector>
-
-namespace egl
-{
-
-struct Config
-{
- Config();
- ~Config();
- Config(const Config &other);
- Config &operator=(const Config &other);
-
- GLenum renderTargetFormat; // TODO(geofflang): remove this
- GLenum depthStencilFormat; // TODO(geofflang): remove this
-
- EGLint bufferSize; // Depth of the color buffer
- EGLint redSize; // Bits of Red in the color buffer
- EGLint greenSize; // Bits of Green in the color buffer
- EGLint blueSize; // Bits of Blue in the color buffer
- EGLint luminanceSize; // Bits of Luminance in the color buffer
- EGLint alphaSize; // Bits of Alpha in the color buffer
- EGLint alphaMaskSize; // Bits of Alpha Mask in the mask buffer
- EGLBoolean bindToTextureRGB; // True if bindable to RGB textures.
- EGLBoolean bindToTextureRGBA; // True if bindable to RGBA textures.
- EGLenum colorBufferType; // Color buffer type
- EGLenum configCaveat; // Any caveats for the configuration
- EGLint configID; // Unique EGLConfig identifier
- EGLint conformant; // Whether contexts created with this config are conformant
- EGLint depthSize; // Bits of Z in the depth buffer
- EGLint level; // Frame buffer level
- EGLBoolean matchNativePixmap; // Match the native pixmap format
- EGLint maxPBufferWidth; // Maximum width of pbuffer
- EGLint maxPBufferHeight; // Maximum height of pbuffer
- EGLint maxPBufferPixels; // Maximum size of pbuffer
- EGLint maxSwapInterval; // Maximum swap interval
- EGLint minSwapInterval; // Minimum swap interval
- EGLBoolean nativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
- EGLint nativeVisualID; // Handle of corresponding native visual
- EGLint nativeVisualType; // Native visual type of the associated visual
- EGLint renderableType; // Which client rendering APIs are supported.
- EGLint sampleBuffers; // Number of multisample buffers
- EGLint samples; // Number of samples per pixel
- EGLint stencilSize; // Bits of Stencil in the stencil buffer
- EGLint surfaceType; // Which types of EGL surfaces are supported.
- EGLenum transparentType; // Type of transparency supported
- EGLint transparentRedValue; // Transparent red value
- EGLint transparentGreenValue; // Transparent green value
- EGLint transparentBlueValue; // Transparent blue value
- EGLint optimalOrientation; // Optimal window surface orientation
- EGLenum colorComponentType; // Color component type
-};
-
-class ConfigSet
-{
- public:
- ConfigSet();
- ConfigSet(const ConfigSet &other);
- ~ConfigSet();
- ConfigSet &operator=(const ConfigSet &other);
-
- EGLint add(const Config &config);
- const Config &get(EGLint id) const;
-
- void clear();
-
- size_t size() const;
-
- bool contains(const Config *config) const;
-
- // Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29
- std::vector<const Config*> filter(const AttributeMap &attributeMap) const;
-
- private:
- typedef std::map<EGLint, Config> ConfigMap;
- ConfigMap mConfigs;
-};
-
-}
-
-#endif // INCLUDE_CONFIG_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Constants.h b/src/3rdparty/angle/src/libANGLE/Constants.h
deleted file mode 100644
index 2fe921af38..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Constants.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Copyright (c) 2013 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.
-//
-
-// Contants.h: Defines some implementation specific and gl constants
-
-#ifndef LIBANGLE_CONSTANTS_H_
-#define LIBANGLE_CONSTANTS_H_
-
-#include "common/platform.h"
-
-namespace gl
-{
-
-// The binary cache is currently left disable by default, and the application can enable it.
-const size_t kDefaultMaxProgramCacheMemoryBytes = 0;
-
-enum
-{
- // Implementation upper limits, real maximums depend on the hardware
- MAX_SAMPLE_MASK_WORDS = 2,
-
- MAX_VERTEX_ATTRIBS = 16,
- MAX_VERTEX_ATTRIB_BINDINGS = 16,
-
- // Implementation upper limits, real maximums depend on the hardware
- IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
- IMPLEMENTATION_MAX_DRAW_BUFFERS = 8,
- IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS =
- IMPLEMENTATION_MAX_DRAW_BUFFERS + 2, // 2 extra for depth and/or stencil buffers
-
- IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
- IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
- IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS =
- IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS +
- IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS,
-
- IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS = 4,
-
- // Maximum number of views which are supported by the implementation of ANGLE_multiview.
- IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
-
- // These are the maximums the implementation can support
- // The actual GL caps are limited by the device caps
- // and should be queried from the Context
- IMPLEMENTATION_MAX_2D_TEXTURE_SIZE = 16384,
- IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
- IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = 2048,
- IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
-
- // 1+log2 of max of MAX_*_TEXTURE_SIZE
- IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15,
-
- // Limit active textures so we can use fast bitsets.
- IMPLEMENTATION_MAX_SHADER_TEXTURES = 32,
- IMPLEMENTATION_MAX_ACTIVE_TEXTURES = IMPLEMENTATION_MAX_SHADER_TEXTURES * 2,
-};
-}
-
-#endif // LIBANGLE_CONSTANTS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Context.cpp b/src/3rdparty/angle/src/libANGLE/Context.cpp
deleted file mode 100644
index f638beda58..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Context.cpp
+++ /dev/null
@@ -1,5558 +0,0 @@
-//
-// 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.cpp: Implements the gl::Context class, managing all GL state and performing
-// rendering operations. It is the GLES2 specific implementation of EGLContext.
-
-#include "libANGLE/Context.h"
-
-#include <string.h>
-#include <iterator>
-#include <sstream>
-#include <vector>
-
-#include "common/matrix_utils.h"
-#include "common/platform.h"
-#include "common/utilities.h"
-#include "common/version.h"
-#include "libANGLE/Buffer.h"
-#include "libANGLE/Compiler.h"
-#include "libANGLE/Display.h"
-#include "libANGLE/Fence.h"
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/Path.h"
-#include "libANGLE/Program.h"
-#include "libANGLE/ProgramPipeline.h"
-#include "libANGLE/Query.h"
-#include "libANGLE/Renderbuffer.h"
-#include "libANGLE/ResourceManager.h"
-#include "libANGLE/Sampler.h"
-#include "libANGLE/Surface.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/TransformFeedback.h"
-#include "libANGLE/VertexArray.h"
-#include "libANGLE/Workarounds.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/queryconversions.h"
-#include "libANGLE/queryutils.h"
-#include "libANGLE/renderer/ContextImpl.h"
-#include "libANGLE/renderer/EGLImplFactory.h"
-#include "libANGLE/renderer/Format.h"
-#include "libANGLE/validationES.h"
-
-namespace
-{
-
-#define ANGLE_HANDLE_ERR(X) \
- handleError(X); \
- return;
-#define ANGLE_CONTEXT_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_HANDLE_ERR);
-
-template <typename T>
-std::vector<gl::Path *> GatherPaths(gl::PathManager &resourceManager,
- GLsizei numPaths,
- const void *paths,
- GLuint pathBase)
-{
- std::vector<gl::Path *> ret;
- ret.reserve(numPaths);
-
- const auto *nameArray = static_cast<const T *>(paths);
-
- for (GLsizei i = 0; i < numPaths; ++i)
- {
- const GLuint pathName = nameArray[i] + pathBase;
-
- ret.push_back(resourceManager.getPath(pathName));
- }
-
- return ret;
-}
-
-std::vector<gl::Path *> GatherPaths(gl::PathManager &resourceManager,
- GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase)
-{
- switch (pathNameType)
- {
- case GL_UNSIGNED_BYTE:
- return GatherPaths<GLubyte>(resourceManager, numPaths, paths, pathBase);
-
- case GL_BYTE:
- return GatherPaths<GLbyte>(resourceManager, numPaths, paths, pathBase);
-
- case GL_UNSIGNED_SHORT:
- return GatherPaths<GLushort>(resourceManager, numPaths, paths, pathBase);
-
- case GL_SHORT:
- return GatherPaths<GLshort>(resourceManager, numPaths, paths, pathBase);
-
- case GL_UNSIGNED_INT:
- return GatherPaths<GLuint>(resourceManager, numPaths, paths, pathBase);
-
- case GL_INT:
- return GatherPaths<GLint>(resourceManager, numPaths, paths, pathBase);
- }
-
- UNREACHABLE();
- return std::vector<gl::Path *>();
-}
-
-template <typename T>
-gl::Error GetQueryObjectParameter(gl::Query *query, GLenum pname, T *params)
-{
- ASSERT(query != nullptr);
-
- switch (pname)
- {
- case GL_QUERY_RESULT_EXT:
- return query->getResult(params);
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- {
- bool available;
- gl::Error error = query->isResultAvailable(&available);
- if (!error.isError())
- {
- *params = gl::CastFromStateValue<T>(pname, static_cast<GLuint>(available));
- }
- return error;
- }
- default:
- UNREACHABLE();
- return gl::InternalError() << "Unreachable Error";
- }
-}
-
-void MarkTransformFeedbackBufferUsage(gl::TransformFeedback *transformFeedback)
-{
- if (transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- for (size_t tfBufferIndex = 0; tfBufferIndex < transformFeedback->getIndexedBufferCount();
- tfBufferIndex++)
- {
- const gl::OffsetBindingPointer<gl::Buffer> &buffer =
- transformFeedback->getIndexedBuffer(tfBufferIndex);
- if (buffer.get() != nullptr)
- {
- buffer->onTransformFeedback();
- }
- }
- }
-}
-
-// Attribute map queries.
-EGLint GetClientMajorVersion(const egl::AttributeMap &attribs)
-{
- return static_cast<EGLint>(attribs.get(EGL_CONTEXT_CLIENT_VERSION, 1));
-}
-
-EGLint GetClientMinorVersion(const egl::AttributeMap &attribs)
-{
- return static_cast<EGLint>(attribs.get(EGL_CONTEXT_MINOR_VERSION, 0));
-}
-
-gl::Version GetClientVersion(const egl::AttributeMap &attribs)
-{
- return gl::Version(GetClientMajorVersion(attribs), GetClientMinorVersion(attribs));
-}
-
-GLenum GetResetStrategy(const egl::AttributeMap &attribs)
-{
- EGLAttrib attrib = attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
- EGL_NO_RESET_NOTIFICATION);
- switch (attrib)
- {
- case EGL_NO_RESET_NOTIFICATION:
- return GL_NO_RESET_NOTIFICATION_EXT;
- case EGL_LOSE_CONTEXT_ON_RESET:
- return GL_LOSE_CONTEXT_ON_RESET_EXT;
- default:
- UNREACHABLE();
- return GL_NONE;
- }
-}
-
-bool GetRobustAccess(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_FALSE) == EGL_TRUE) ||
- ((attribs.get(EGL_CONTEXT_FLAGS_KHR, 0) & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) !=
- 0);
-}
-
-bool GetDebug(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_CONTEXT_OPENGL_DEBUG, EGL_FALSE) == EGL_TRUE) ||
- ((attribs.get(EGL_CONTEXT_FLAGS_KHR, 0) & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) != 0);
-}
-
-bool GetNoError(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, EGL_FALSE) == EGL_TRUE);
-}
-
-bool GetWebGLContext(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE, EGL_FALSE) == EGL_TRUE);
-}
-
-bool GetBindGeneratesResource(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM, EGL_TRUE) == EGL_TRUE);
-}
-
-bool GetClientArraysEnabled(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE, EGL_TRUE) == EGL_TRUE);
-}
-
-bool GetRobustResourceInit(const egl::AttributeMap &attribs)
-{
- return (attribs.get(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE, EGL_FALSE) == EGL_TRUE);
-}
-
-std::string GetObjectLabelFromPointer(GLsizei length, const GLchar *label)
-{
- std::string labelName;
- if (label != nullptr)
- {
- size_t labelLength = length < 0 ? strlen(label) : length;
- labelName = std::string(label, labelLength);
- }
- return labelName;
-}
-
-void GetObjectLabelBase(const std::string &objectLabel,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label)
-{
- size_t writeLength = objectLabel.length();
- if (label != nullptr && bufSize > 0)
- {
- writeLength = std::min(static_cast<size_t>(bufSize) - 1, objectLabel.length());
- std::copy(objectLabel.begin(), objectLabel.begin() + writeLength, label);
- label[writeLength] = '\0';
- }
-
- if (length != nullptr)
- {
- *length = static_cast<GLsizei>(writeLength);
- }
-}
-
-template <typename CapT, typename MaxT>
-void LimitCap(CapT *cap, MaxT maximum)
-{
- *cap = std::min(*cap, static_cast<CapT>(maximum));
-}
-
-} // anonymous namespace
-
-namespace gl
-{
-
-Context::Context(rx::EGLImplFactory *implFactory,
- const egl::Config *config,
- const Context *shareContext,
- TextureManager *shareTextures,
- MemoryProgramCache *memoryProgramCache,
- const egl::AttributeMap &attribs,
- const egl::DisplayExtensions &displayExtensions)
-
- : ValidationContext(shareContext,
- shareTextures,
- GetClientVersion(attribs),
- &mGLState,
- mCaps,
- mTextureCaps,
- mExtensions,
- mLimitations,
- GetNoError(attribs)),
- mImplementation(implFactory->createContext(mState)),
- mCompiler(),
- mConfig(config),
- mClientType(EGL_OPENGL_ES_API),
- mHasBeenCurrent(false),
- mContextLost(false),
- mResetStatus(GL_NO_ERROR),
- mContextLostForced(false),
- mResetStrategy(GetResetStrategy(attribs)),
- mRobustAccess(GetRobustAccess(attribs)),
- mCurrentSurface(static_cast<egl::Surface *>(EGL_NO_SURFACE)),
- mCurrentDisplay(static_cast<egl::Display *>(EGL_NO_DISPLAY)),
- mSurfacelessFramebuffer(nullptr),
- mWebGLContext(GetWebGLContext(attribs)),
- mMemoryProgramCache(memoryProgramCache),
- mScratchBuffer(1000u),
- mZeroFilledBuffer(1000u)
-{
- mImplementation->setMemoryProgramCache(memoryProgramCache);
-
- bool robustResourceInit = GetRobustResourceInit(attribs);
- initCaps(displayExtensions, robustResourceInit);
- initWorkarounds();
-
- mGLState.initialize(this, GetDebug(attribs), GetBindGeneratesResource(attribs),
- GetClientArraysEnabled(attribs), robustResourceInit,
- mMemoryProgramCache != nullptr);
-
- mFenceNVHandleAllocator.setBaseHandle(0);
-
- // [OpenGL ES 2.0.24] section 3.7 page 83:
- // In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have two-dimensional
- // and cube map texture state vectors respectively associated with them.
- // In order that access to these initial textures not be lost, they are treated as texture
- // objects all of whose names are 0.
-
- Texture *zeroTexture2D = new Texture(mImplementation.get(), 0, GL_TEXTURE_2D);
- mZeroTextures[GL_TEXTURE_2D].set(this, zeroTexture2D);
-
- Texture *zeroTextureCube = new Texture(mImplementation.get(), 0, GL_TEXTURE_CUBE_MAP);
- mZeroTextures[GL_TEXTURE_CUBE_MAP].set(this, zeroTextureCube);
-
- if (getClientVersion() >= Version(3, 0))
- {
- // TODO: These could also be enabled via extension
- Texture *zeroTexture3D = new Texture(mImplementation.get(), 0, GL_TEXTURE_3D);
- mZeroTextures[GL_TEXTURE_3D].set(this, zeroTexture3D);
-
- Texture *zeroTexture2DArray = new Texture(mImplementation.get(), 0, GL_TEXTURE_2D_ARRAY);
- mZeroTextures[GL_TEXTURE_2D_ARRAY].set(this, zeroTexture2DArray);
- }
- if (getClientVersion() >= Version(3, 1))
- {
- Texture *zeroTexture2DMultisample =
- new Texture(mImplementation.get(), 0, GL_TEXTURE_2D_MULTISAMPLE);
- mZeroTextures[GL_TEXTURE_2D_MULTISAMPLE].set(this, zeroTexture2DMultisample);
-
- for (unsigned int i = 0; i < mCaps.maxAtomicCounterBufferBindings; i++)
- {
- bindBufferRange(BufferBinding::AtomicCounter, 0, i, 0, 0);
- }
-
- for (unsigned int i = 0; i < mCaps.maxShaderStorageBufferBindings; i++)
- {
- bindBufferRange(BufferBinding::ShaderStorage, i, 0, 0, 0);
- }
- }
-
- const Extensions &nativeExtensions = mImplementation->getNativeExtensions();
- if (nativeExtensions.textureRectangle)
- {
- Texture *zeroTextureRectangle =
- new Texture(mImplementation.get(), 0, GL_TEXTURE_RECTANGLE_ANGLE);
- mZeroTextures[GL_TEXTURE_RECTANGLE_ANGLE].set(this, zeroTextureRectangle);
- }
-
- if (nativeExtensions.eglImageExternal || nativeExtensions.eglStreamConsumerExternal)
- {
- Texture *zeroTextureExternal =
- new Texture(mImplementation.get(), 0, GL_TEXTURE_EXTERNAL_OES);
- mZeroTextures[GL_TEXTURE_EXTERNAL_OES].set(this, zeroTextureExternal);
- }
-
- mGLState.initializeZeroTextures(this, mZeroTextures);
-
- bindVertexArray(0);
-
- if (getClientVersion() >= Version(3, 0))
- {
- // [OpenGL ES 3.0.2] section 2.14.1 pg 85:
- // In the initial state, a default transform feedback object is bound and treated as
- // a transform feedback object with a name of zero. That object is bound any time
- // BindTransformFeedback is called with id of zero
- bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
- }
-
- for (auto type : angle::AllEnums<BufferBinding>())
- {
- bindBuffer(type, 0);
- }
-
- bindRenderbuffer(GL_RENDERBUFFER, 0);
-
- for (unsigned int i = 0; i < mCaps.maxUniformBufferBindings; i++)
- {
- bindBufferRange(BufferBinding::Uniform, i, 0, 0, -1);
- }
-
- // Initialize dirty bit masks
- mTexImageDirtyBits.set(State::DIRTY_BIT_UNPACK_STATE);
- mTexImageDirtyBits.set(State::DIRTY_BIT_UNPACK_BUFFER_BINDING);
- // No dirty objects.
-
- // Readpixels uses the pack state and read FBO
- mReadPixelsDirtyBits.set(State::DIRTY_BIT_PACK_STATE);
- mReadPixelsDirtyBits.set(State::DIRTY_BIT_PACK_BUFFER_BINDING);
- mReadPixelsDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
-
- mClearDirtyBits.set(State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED);
- mClearDirtyBits.set(State::DIRTY_BIT_SCISSOR_TEST_ENABLED);
- mClearDirtyBits.set(State::DIRTY_BIT_SCISSOR);
- mClearDirtyBits.set(State::DIRTY_BIT_VIEWPORT);
- mClearDirtyBits.set(State::DIRTY_BIT_CLEAR_COLOR);
- mClearDirtyBits.set(State::DIRTY_BIT_CLEAR_DEPTH);
- mClearDirtyBits.set(State::DIRTY_BIT_CLEAR_STENCIL);
- mClearDirtyBits.set(State::DIRTY_BIT_COLOR_MASK);
- mClearDirtyBits.set(State::DIRTY_BIT_DEPTH_MASK);
- mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
- mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_BACK);
- mClearDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
-
- mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR_TEST_ENABLED);
- mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR);
- mBlitDirtyBits.set(State::DIRTY_BIT_FRAMEBUFFER_SRGB);
- mBlitDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
- mBlitDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
-
- handleError(mImplementation->initialize());
-}
-
-egl::Error Context::onDestroy(const egl::Display *display)
-{
- for (auto fence : mFenceNVMap)
- {
- SafeDelete(fence.second);
- }
- mFenceNVMap.clear();
-
- for (auto query : mQueryMap)
- {
- if (query.second != nullptr)
- {
- query.second->release(this);
- }
- }
- mQueryMap.clear();
-
- for (auto vertexArray : mVertexArrayMap)
- {
- if (vertexArray.second)
- {
- vertexArray.second->onDestroy(this);
- }
- }
- mVertexArrayMap.clear();
-
- for (auto transformFeedback : mTransformFeedbackMap)
- {
- if (transformFeedback.second != nullptr)
- {
- transformFeedback.second->release(this);
- }
- }
- mTransformFeedbackMap.clear();
-
- for (auto &zeroTexture : mZeroTextures)
- {
- ANGLE_TRY(zeroTexture.second->onDestroy(this));
- zeroTexture.second.set(this, nullptr);
- }
- mZeroTextures.clear();
-
- SafeDelete(mSurfacelessFramebuffer);
-
- ANGLE_TRY(releaseSurface(display));
- releaseShaderCompiler();
-
- mGLState.reset(this);
-
- mState.mBuffers->release(this);
- mState.mShaderPrograms->release(this);
- mState.mTextures->release(this);
- mState.mRenderbuffers->release(this);
- mState.mSamplers->release(this);
- mState.mSyncs->release(this);
- mState.mPaths->release(this);
- mState.mFramebuffers->release(this);
- mState.mPipelines->release(this);
-
- mImplementation->onDestroy(this);
-
- return egl::NoError();
-}
-
-Context::~Context()
-{
-}
-
-egl::Error Context::makeCurrent(egl::Display *display, egl::Surface *surface)
-{
- mCurrentDisplay = display;
-
- if (!mHasBeenCurrent)
- {
- initRendererString();
- initVersionStrings();
- initExtensionStrings();
-
- int width = 0;
- int height = 0;
- if (surface != nullptr)
- {
- width = surface->getWidth();
- height = surface->getHeight();
- }
-
- mGLState.setViewportParams(0, 0, width, height);
- mGLState.setScissorParams(0, 0, width, height);
-
- mHasBeenCurrent = true;
- }
-
- // TODO(jmadill): Rework this when we support ContextImpl
- mGLState.setAllDirtyBits();
- mGLState.setAllDirtyObjects();
-
- ANGLE_TRY(releaseSurface(display));
-
- Framebuffer *newDefault = nullptr;
- if (surface != nullptr)
- {
- ANGLE_TRY(surface->setIsCurrent(this, true));
- mCurrentSurface = surface;
- newDefault = surface->getDefaultFramebuffer();
- }
- else
- {
- if (mSurfacelessFramebuffer == nullptr)
- {
- mSurfacelessFramebuffer = new Framebuffer(mImplementation.get());
- }
-
- newDefault = mSurfacelessFramebuffer;
- }
-
- // Update default framebuffer, the binding of the previous default
- // framebuffer (or lack of) will have a nullptr.
- {
- if (mGLState.getReadFramebuffer() == nullptr)
- {
- mGLState.setReadFramebufferBinding(newDefault);
- }
- if (mGLState.getDrawFramebuffer() == nullptr)
- {
- mGLState.setDrawFramebufferBinding(newDefault);
- }
- mState.mFramebuffers->setDefaultFramebuffer(newDefault);
- }
-
- // Notify the renderer of a context switch
- mImplementation->onMakeCurrent(this);
- return egl::NoError();
-}
-
-egl::Error Context::releaseSurface(const egl::Display *display)
-{
- // Remove the default framebuffer
- Framebuffer *currentDefault = nullptr;
- if (mCurrentSurface != nullptr)
- {
- currentDefault = mCurrentSurface->getDefaultFramebuffer();
- }
- else if (mSurfacelessFramebuffer != nullptr)
- {
- currentDefault = mSurfacelessFramebuffer;
- }
-
- if (mGLState.getReadFramebuffer() == currentDefault)
- {
- mGLState.setReadFramebufferBinding(nullptr);
- }
- if (mGLState.getDrawFramebuffer() == currentDefault)
- {
- mGLState.setDrawFramebufferBinding(nullptr);
- }
- mState.mFramebuffers->setDefaultFramebuffer(nullptr);
-
- if (mCurrentSurface)
- {
- ANGLE_TRY(mCurrentSurface->setIsCurrent(this, false));
- mCurrentSurface = nullptr;
- }
-
- return egl::NoError();
-}
-
-GLuint Context::createBuffer()
-{
- return mState.mBuffers->createBuffer();
-}
-
-GLuint Context::createProgram()
-{
- return mState.mShaderPrograms->createProgram(mImplementation.get());
-}
-
-GLuint Context::createShader(GLenum type)
-{
- return mState.mShaderPrograms->createShader(mImplementation.get(), mLimitations, type);
-}
-
-GLuint Context::createTexture()
-{
- return mState.mTextures->createTexture();
-}
-
-GLuint Context::createRenderbuffer()
-{
- return mState.mRenderbuffers->createRenderbuffer();
-}
-
-GLuint Context::createPaths(GLsizei range)
-{
- auto resultOrError = mState.mPaths->createPaths(mImplementation.get(), range);
- if (resultOrError.isError())
- {
- handleError(resultOrError.getError());
- return 0;
- }
- return resultOrError.getResult();
-}
-
-// Returns an unused framebuffer name
-GLuint Context::createFramebuffer()
-{
- return mState.mFramebuffers->createFramebuffer();
-}
-
-GLuint Context::createFenceNV()
-{
- GLuint handle = mFenceNVHandleAllocator.allocate();
- mFenceNVMap.assign(handle, new FenceNV(mImplementation->createFenceNV()));
- return handle;
-}
-
-GLuint Context::createProgramPipeline()
-{
- return mState.mPipelines->createProgramPipeline();
-}
-
-GLuint Context::createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
-{
- UNIMPLEMENTED();
- return 0u;
-}
-
-void Context::deleteBuffer(GLuint buffer)
-{
- if (mState.mBuffers->getBuffer(buffer))
- {
- detachBuffer(buffer);
- }
-
- mState.mBuffers->deleteObject(this, buffer);
-}
-
-void Context::deleteShader(GLuint shader)
-{
- mState.mShaderPrograms->deleteShader(this, shader);
-}
-
-void Context::deleteProgram(GLuint program)
-{
- mState.mShaderPrograms->deleteProgram(this, program);
-}
-
-void Context::deleteTexture(GLuint texture)
-{
- if (mState.mTextures->getTexture(texture))
- {
- detachTexture(texture);
- }
-
- mState.mTextures->deleteObject(this, texture);
-}
-
-void Context::deleteRenderbuffer(GLuint renderbuffer)
-{
- if (mState.mRenderbuffers->getRenderbuffer(renderbuffer))
- {
- detachRenderbuffer(renderbuffer);
- }
-
- mState.mRenderbuffers->deleteObject(this, renderbuffer);
-}
-
-void Context::deleteSync(GLsync sync)
-{
- // The spec specifies the underlying Fence object is not deleted until all current
- // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
- // and since our API is currently designed for being called from a single thread, we can delete
- // the fence immediately.
- mState.mSyncs->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync)));
-}
-
-void Context::deleteProgramPipeline(GLuint pipeline)
-{
- if (mState.mPipelines->getProgramPipeline(pipeline))
- {
- detachProgramPipeline(pipeline);
- }
-
- mState.mPipelines->deleteObject(this, pipeline);
-}
-
-void Context::deletePaths(GLuint first, GLsizei range)
-{
- mState.mPaths->deletePaths(first, range);
-}
-
-bool Context::hasPathData(GLuint path) const
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (pathObj == nullptr)
- return false;
-
- return pathObj->hasPathData();
-}
-
-bool Context::hasPath(GLuint path) const
-{
- return mState.mPaths->hasPath(path);
-}
-
-void Context::setPathCommands(GLuint path,
- GLsizei numCommands,
- const GLubyte *commands,
- GLsizei numCoords,
- GLenum coordType,
- const void *coords)
-{
- auto *pathObject = mState.mPaths->getPath(path);
-
- handleError(pathObject->setCommands(numCommands, commands, numCoords, coordType, coords));
-}
-
-void Context::setPathParameterf(GLuint path, GLenum pname, GLfloat value)
-{
- auto *pathObj = mState.mPaths->getPath(path);
-
- switch (pname)
- {
- case GL_PATH_STROKE_WIDTH_CHROMIUM:
- pathObj->setStrokeWidth(value);
- break;
- case GL_PATH_END_CAPS_CHROMIUM:
- pathObj->setEndCaps(static_cast<GLenum>(value));
- break;
- case GL_PATH_JOIN_STYLE_CHROMIUM:
- pathObj->setJoinStyle(static_cast<GLenum>(value));
- break;
- case GL_PATH_MITER_LIMIT_CHROMIUM:
- pathObj->setMiterLimit(value);
- break;
- case GL_PATH_STROKE_BOUND_CHROMIUM:
- pathObj->setStrokeBound(value);
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const
-{
- const auto *pathObj = mState.mPaths->getPath(path);
-
- switch (pname)
- {
- case GL_PATH_STROKE_WIDTH_CHROMIUM:
- *value = pathObj->getStrokeWidth();
- break;
- case GL_PATH_END_CAPS_CHROMIUM:
- *value = static_cast<GLfloat>(pathObj->getEndCaps());
- break;
- case GL_PATH_JOIN_STYLE_CHROMIUM:
- *value = static_cast<GLfloat>(pathObj->getJoinStyle());
- break;
- case GL_PATH_MITER_LIMIT_CHROMIUM:
- *value = pathObj->getMiterLimit();
- break;
- case GL_PATH_STROKE_BOUND_CHROMIUM:
- *value = pathObj->getStrokeBound();
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void Context::setPathStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- mGLState.setPathStencilFunc(func, ref, mask);
-}
-
-void Context::deleteFramebuffer(GLuint framebuffer)
-{
- if (mState.mFramebuffers->getFramebuffer(framebuffer))
- {
- detachFramebuffer(framebuffer);
- }
-
- mState.mFramebuffers->deleteObject(this, framebuffer);
-}
-
-void Context::deleteFenceNV(GLuint fence)
-{
- FenceNV *fenceObject = nullptr;
- if (mFenceNVMap.erase(fence, &fenceObject))
- {
- mFenceNVHandleAllocator.release(fence);
- delete fenceObject;
- }
-}
-
-Buffer *Context::getBuffer(GLuint handle) const
-{
- return mState.mBuffers->getBuffer(handle);
-}
-
-Texture *Context::getTexture(GLuint handle) const
-{
- return mState.mTextures->getTexture(handle);
-}
-
-Renderbuffer *Context::getRenderbuffer(GLuint handle) const
-{
- return mState.mRenderbuffers->getRenderbuffer(handle);
-}
-
-Sync *Context::getSync(GLsync handle) const
-{
- return mState.mSyncs->getSync(static_cast<GLuint>(reinterpret_cast<uintptr_t>(handle)));
-}
-
-VertexArray *Context::getVertexArray(GLuint handle) const
-{
- return mVertexArrayMap.query(handle);
-}
-
-Sampler *Context::getSampler(GLuint handle) const
-{
- return mState.mSamplers->getSampler(handle);
-}
-
-TransformFeedback *Context::getTransformFeedback(GLuint handle) const
-{
- return mTransformFeedbackMap.query(handle);
-}
-
-ProgramPipeline *Context::getProgramPipeline(GLuint handle) const
-{
- return mState.mPipelines->getProgramPipeline(handle);
-}
-
-LabeledObject *Context::getLabeledObject(GLenum identifier, GLuint name) const
-{
- switch (identifier)
- {
- case GL_BUFFER:
- return getBuffer(name);
- case GL_SHADER:
- return getShader(name);
- case GL_PROGRAM:
- return getProgram(name);
- case GL_VERTEX_ARRAY:
- return getVertexArray(name);
- case GL_QUERY:
- return getQuery(name);
- case GL_TRANSFORM_FEEDBACK:
- return getTransformFeedback(name);
- case GL_SAMPLER:
- return getSampler(name);
- case GL_TEXTURE:
- return getTexture(name);
- case GL_RENDERBUFFER:
- return getRenderbuffer(name);
- case GL_FRAMEBUFFER:
- return getFramebuffer(name);
- default:
- UNREACHABLE();
- return nullptr;
- }
-}
-
-LabeledObject *Context::getLabeledObjectFromPtr(const void *ptr) const
-{
- return getSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr)));
-}
-
-void Context::objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
-{
- LabeledObject *object = getLabeledObject(identifier, name);
- ASSERT(object != nullptr);
-
- std::string labelName = GetObjectLabelFromPointer(length, label);
- object->setLabel(labelName);
-
- // TODO(jmadill): Determine if the object is dirty based on 'name'. Conservatively assume the
- // specified object is active until we do this.
- mGLState.setObjectDirty(identifier);
-}
-
-void Context::objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
-{
- LabeledObject *object = getLabeledObjectFromPtr(ptr);
- ASSERT(object != nullptr);
-
- std::string labelName = GetObjectLabelFromPointer(length, label);
- object->setLabel(labelName);
-}
-
-void Context::getObjectLabel(GLenum identifier,
- GLuint name,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label) const
-{
- LabeledObject *object = getLabeledObject(identifier, name);
- ASSERT(object != nullptr);
-
- const std::string &objectLabel = object->getLabel();
- GetObjectLabelBase(objectLabel, bufSize, length, label);
-}
-
-void Context::getObjectPtrLabel(const void *ptr,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label) const
-{
- LabeledObject *object = getLabeledObjectFromPtr(ptr);
- ASSERT(object != nullptr);
-
- const std::string &objectLabel = object->getLabel();
- GetObjectLabelBase(objectLabel, bufSize, length, label);
-}
-
-bool Context::isSampler(GLuint samplerName) const
-{
- return mState.mSamplers->isSampler(samplerName);
-}
-
-void Context::bindTexture(GLenum target, GLuint handle)
-{
- Texture *texture = nullptr;
-
- if (handle == 0)
- {
- texture = mZeroTextures[target].get();
- }
- else
- {
- texture = mState.mTextures->checkTextureAllocation(mImplementation.get(), handle, target);
- }
-
- ASSERT(texture);
- mGLState.setSamplerTexture(this, target, texture);
-}
-
-void Context::bindReadFramebuffer(GLuint framebufferHandle)
-{
- Framebuffer *framebuffer = mState.mFramebuffers->checkFramebufferAllocation(
- mImplementation.get(), mCaps, framebufferHandle);
- mGLState.setReadFramebufferBinding(framebuffer);
-}
-
-void Context::bindDrawFramebuffer(GLuint framebufferHandle)
-{
- Framebuffer *framebuffer = mState.mFramebuffers->checkFramebufferAllocation(
- mImplementation.get(), mCaps, framebufferHandle);
- mGLState.setDrawFramebufferBinding(framebuffer);
-}
-
-void Context::bindVertexArray(GLuint vertexArrayHandle)
-{
- VertexArray *vertexArray = checkVertexArrayAllocation(vertexArrayHandle);
- mGLState.setVertexArrayBinding(vertexArray);
-}
-
-void Context::bindVertexBuffer(GLuint bindingIndex,
- GLuint bufferHandle,
- GLintptr offset,
- GLsizei stride)
-{
- Buffer *buffer = mState.mBuffers->checkBufferAllocation(mImplementation.get(), bufferHandle);
- mGLState.bindVertexBuffer(this, bindingIndex, buffer, offset, stride);
-}
-
-void Context::bindSampler(GLuint textureUnit, GLuint samplerHandle)
-{
- ASSERT(textureUnit < mCaps.maxCombinedTextureImageUnits);
- Sampler *sampler =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), samplerHandle);
- mGLState.setSamplerBinding(this, textureUnit, sampler);
-}
-
-void Context::bindImageTexture(GLuint unit,
- GLuint texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format)
-{
- Texture *tex = mState.mTextures->getTexture(texture);
- mGLState.setImageUnit(this, unit, tex, level, layered, layer, access, format);
-}
-
-void Context::useProgram(GLuint program)
-{
- mGLState.setProgram(this, getProgram(program));
-}
-
-void Context::useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
-{
- UNIMPLEMENTED();
-}
-
-void Context::bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle)
-{
- ASSERT(target == GL_TRANSFORM_FEEDBACK);
- TransformFeedback *transformFeedback =
- checkTransformFeedbackAllocation(transformFeedbackHandle);
- mGLState.setTransformFeedbackBinding(this, transformFeedback);
-}
-
-void Context::bindProgramPipeline(GLuint pipelineHandle)
-{
- ProgramPipeline *pipeline =
- mState.mPipelines->checkProgramPipelineAllocation(mImplementation.get(), pipelineHandle);
- mGLState.setProgramPipelineBinding(this, pipeline);
-}
-
-void Context::beginQuery(GLenum target, GLuint query)
-{
- Query *queryObject = getQuery(query, true, target);
- ASSERT(queryObject);
-
- // begin query
- ANGLE_CONTEXT_TRY(queryObject->begin());
-
- // set query as active for specified target only if begin succeeded
- mGLState.setActiveQuery(this, target, queryObject);
-}
-
-void Context::endQuery(GLenum target)
-{
- Query *queryObject = mGLState.getActiveQuery(target);
- ASSERT(queryObject);
-
- handleError(queryObject->end());
-
- // Always unbind the query, even if there was an error. This may delete the query object.
- mGLState.setActiveQuery(this, target, nullptr);
-}
-
-void Context::queryCounter(GLuint id, GLenum target)
-{
- ASSERT(target == GL_TIMESTAMP_EXT);
-
- Query *queryObject = getQuery(id, true, target);
- ASSERT(queryObject);
-
- handleError(queryObject->queryCounter());
-}
-
-void Context::getQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- switch (pname)
- {
- case GL_CURRENT_QUERY_EXT:
- params[0] = mGLState.getActiveQueryId(target);
- break;
- case GL_QUERY_COUNTER_BITS_EXT:
- switch (target)
- {
- case GL_TIME_ELAPSED_EXT:
- params[0] = getExtensions().queryCounterBitsTimeElapsed;
- break;
- case GL_TIMESTAMP_EXT:
- params[0] = getExtensions().queryCounterBitsTimestamp;
- break;
- default:
- UNREACHABLE();
- params[0] = 0;
- break;
- }
- break;
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::getQueryObjectiv(GLuint id, GLenum pname, GLint *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-void Context::getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-void Context::getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-void Context::getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
-{
- handleError(GetQueryObjectParameter(getQuery(id), pname, params));
-}
-
-Framebuffer *Context::getFramebuffer(GLuint handle) const
-{
- return mState.mFramebuffers->getFramebuffer(handle);
-}
-
-FenceNV *Context::getFenceNV(GLuint handle)
-{
- return mFenceNVMap.query(handle);
-}
-
-Query *Context::getQuery(GLuint handle, bool create, GLenum type)
-{
- if (!mQueryMap.contains(handle))
- {
- return nullptr;
- }
-
- Query *query = mQueryMap.query(handle);
- if (!query && create)
- {
- query = new Query(mImplementation->createQuery(type), handle);
- query->addRef();
- mQueryMap.assign(handle, query);
- }
- return query;
-}
-
-Query *Context::getQuery(GLuint handle) const
-{
- return mQueryMap.query(handle);
-}
-
-Texture *Context::getTargetTexture(GLenum target) const
-{
- ASSERT(ValidTextureTarget(this, target) || ValidTextureExternalTarget(this, target));
- return mGLState.getTargetTexture(target);
-}
-
-Texture *Context::getSamplerTexture(unsigned int sampler, GLenum type) const
-{
- return mGLState.getSamplerTexture(sampler, type);
-}
-
-Compiler *Context::getCompiler() const
-{
- if (mCompiler.get() == nullptr)
- {
- mCompiler.set(this, new Compiler(mImplementation.get(), mState));
- }
- return mCompiler.get();
-}
-
-void Context::getBooleanvImpl(GLenum pname, GLboolean *params)
-{
- switch (pname)
- {
- case GL_SHADER_COMPILER:
- *params = GL_TRUE;
- break;
- case GL_CONTEXT_ROBUST_ACCESS_EXT:
- *params = mRobustAccess ? GL_TRUE : GL_FALSE;
- break;
- default:
- mGLState.getBooleanv(pname, params);
- break;
- }
-}
-
-void Context::getFloatvImpl(GLenum pname, GLfloat *params)
-{
- // Queries about context capabilities and maximums are answered by Context.
- // Queries about current GL state values are answered by State.
- switch (pname)
- {
- case GL_ALIASED_LINE_WIDTH_RANGE:
- params[0] = mCaps.minAliasedLineWidth;
- params[1] = mCaps.maxAliasedLineWidth;
- break;
- case GL_ALIASED_POINT_SIZE_RANGE:
- params[0] = mCaps.minAliasedPointSize;
- params[1] = mCaps.maxAliasedPointSize;
- break;
- case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
- ASSERT(mExtensions.textureFilterAnisotropic);
- *params = mExtensions.maxTextureAnisotropy;
- break;
- case GL_MAX_TEXTURE_LOD_BIAS:
- *params = mCaps.maxLODBias;
- break;
-
- case GL_PATH_MODELVIEW_MATRIX_CHROMIUM:
- case GL_PATH_PROJECTION_MATRIX_CHROMIUM:
- {
- ASSERT(mExtensions.pathRendering);
- const GLfloat *m = mGLState.getPathRenderingMatrix(pname);
- memcpy(params, m, 16 * sizeof(GLfloat));
- }
- break;
-
- default:
- mGLState.getFloatv(pname, params);
- break;
- }
-}
-
-void Context::getIntegervImpl(GLenum pname, GLint *params)
-{
- // Queries about context capabilities and maximums are answered by Context.
- // Queries about current GL state values are answered by State.
-
- switch (pname)
- {
- case GL_MAX_VERTEX_ATTRIBS:
- *params = mCaps.maxVertexAttributes;
- break;
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- *params = mCaps.maxVertexUniformVectors;
- break;
- case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
- *params = mCaps.maxVertexUniformComponents;
- break;
- case GL_MAX_VARYING_VECTORS:
- *params = mCaps.maxVaryingVectors;
- break;
- case GL_MAX_VARYING_COMPONENTS:
- *params = mCaps.maxVertexOutputComponents;
- break;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxCombinedTextureImageUnits;
- break;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxVertexTextureImageUnits;
- break;
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxTextureImageUnits;
- break;
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- *params = mCaps.maxFragmentUniformVectors;
- break;
- case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
- *params = mCaps.maxFragmentUniformComponents;
- break;
- case GL_MAX_RENDERBUFFER_SIZE:
- *params = mCaps.maxRenderbufferSize;
- break;
- case GL_MAX_COLOR_ATTACHMENTS_EXT:
- *params = mCaps.maxColorAttachments;
- break;
- case GL_MAX_DRAW_BUFFERS_EXT:
- *params = mCaps.maxDrawBuffers;
- break;
- // case GL_FRAMEBUFFER_BINDING: // now equivalent to
- // GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_SUBPIXEL_BITS:
- *params = 4;
- break;
- case GL_MAX_TEXTURE_SIZE:
- *params = mCaps.max2DTextureSize;
- break;
- case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE:
- *params = mCaps.maxRectangleTextureSize;
- break;
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
- *params = mCaps.maxCubeMapTextureSize;
- break;
- case GL_MAX_3D_TEXTURE_SIZE:
- *params = mCaps.max3DTextureSize;
- break;
- case GL_MAX_ARRAY_TEXTURE_LAYERS:
- *params = mCaps.maxArrayTextureLayers;
- break;
- case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
- *params = mCaps.uniformBufferOffsetAlignment;
- break;
- case GL_MAX_UNIFORM_BUFFER_BINDINGS:
- *params = mCaps.maxUniformBufferBindings;
- break;
- case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- *params = mCaps.maxVertexUniformBlocks;
- break;
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- *params = mCaps.maxFragmentUniformBlocks;
- break;
- case GL_MAX_COMBINED_UNIFORM_BLOCKS:
- *params = mCaps.maxCombinedTextureImageUnits;
- break;
- case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
- *params = mCaps.maxVertexOutputComponents;
- break;
- case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
- *params = mCaps.maxFragmentInputComponents;
- break;
- case GL_MIN_PROGRAM_TEXEL_OFFSET:
- *params = mCaps.minProgramTexelOffset;
- break;
- case GL_MAX_PROGRAM_TEXEL_OFFSET:
- *params = mCaps.maxProgramTexelOffset;
- break;
- case GL_MAJOR_VERSION:
- *params = getClientVersion().major;
- break;
- case GL_MINOR_VERSION:
- *params = getClientVersion().minor;
- break;
- case GL_MAX_ELEMENTS_INDICES:
- *params = mCaps.maxElementsIndices;
- break;
- case GL_MAX_ELEMENTS_VERTICES:
- *params = mCaps.maxElementsVertices;
- break;
- case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
- *params = mCaps.maxTransformFeedbackInterleavedComponents;
- break;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
- *params = mCaps.maxTransformFeedbackSeparateAttributes;
- break;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
- *params = mCaps.maxTransformFeedbackSeparateComponents;
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = static_cast<GLint>(mCaps.compressedTextureFormats.size());
- break;
- case GL_MAX_SAMPLES_ANGLE:
- *params = mCaps.maxSamples;
- break;
- case GL_MAX_VIEWPORT_DIMS:
- {
- params[0] = mCaps.maxViewportWidth;
- params[1] = mCaps.maxViewportHeight;
- }
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- std::copy(mCaps.compressedTextureFormats.begin(), mCaps.compressedTextureFormats.end(),
- params);
- break;
- case GL_RESET_NOTIFICATION_STRATEGY_EXT:
- *params = mResetStrategy;
- break;
- case GL_NUM_SHADER_BINARY_FORMATS:
- *params = static_cast<GLint>(mCaps.shaderBinaryFormats.size());
- break;
- case GL_SHADER_BINARY_FORMATS:
- std::copy(mCaps.shaderBinaryFormats.begin(), mCaps.shaderBinaryFormats.end(), params);
- break;
- case GL_NUM_PROGRAM_BINARY_FORMATS:
- *params = static_cast<GLint>(mCaps.programBinaryFormats.size());
- break;
- case GL_PROGRAM_BINARY_FORMATS:
- std::copy(mCaps.programBinaryFormats.begin(), mCaps.programBinaryFormats.end(), params);
- break;
- case GL_NUM_EXTENSIONS:
- *params = static_cast<GLint>(mExtensionStrings.size());
- break;
-
- // GL_KHR_debug
- case GL_MAX_DEBUG_MESSAGE_LENGTH:
- *params = mExtensions.maxDebugMessageLength;
- break;
- case GL_MAX_DEBUG_LOGGED_MESSAGES:
- *params = mExtensions.maxDebugLoggedMessages;
- break;
- case GL_MAX_DEBUG_GROUP_STACK_DEPTH:
- *params = mExtensions.maxDebugGroupStackDepth;
- break;
- case GL_MAX_LABEL_LENGTH:
- *params = mExtensions.maxLabelLength;
- break;
-
- // GL_ANGLE_multiview
- case GL_MAX_VIEWS_ANGLE:
- *params = mExtensions.maxViews;
- break;
-
- // GL_EXT_disjoint_timer_query
- case GL_GPU_DISJOINT_EXT:
- *params = mImplementation->getGPUDisjoint();
- break;
- case GL_MAX_FRAMEBUFFER_WIDTH:
- *params = mCaps.maxFramebufferWidth;
- break;
- case GL_MAX_FRAMEBUFFER_HEIGHT:
- *params = mCaps.maxFramebufferHeight;
- break;
- case GL_MAX_FRAMEBUFFER_SAMPLES:
- *params = mCaps.maxFramebufferSamples;
- break;
- case GL_MAX_SAMPLE_MASK_WORDS:
- *params = mCaps.maxSampleMaskWords;
- break;
- case GL_MAX_COLOR_TEXTURE_SAMPLES:
- *params = mCaps.maxColorTextureSamples;
- break;
- case GL_MAX_DEPTH_TEXTURE_SAMPLES:
- *params = mCaps.maxDepthTextureSamples;
- break;
- case GL_MAX_INTEGER_SAMPLES:
- *params = mCaps.maxIntegerSamples;
- break;
- case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET:
- *params = mCaps.maxVertexAttribRelativeOffset;
- break;
- case GL_MAX_VERTEX_ATTRIB_BINDINGS:
- *params = mCaps.maxVertexAttribBindings;
- break;
- case GL_MAX_VERTEX_ATTRIB_STRIDE:
- *params = mCaps.maxVertexAttribStride;
- break;
- case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxVertexAtomicCounterBuffers;
- break;
- case GL_MAX_VERTEX_ATOMIC_COUNTERS:
- *params = mCaps.maxVertexAtomicCounters;
- break;
- case GL_MAX_VERTEX_IMAGE_UNIFORMS:
- *params = mCaps.maxVertexImageUniforms;
- break;
- case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxVertexShaderStorageBlocks;
- break;
- case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxFragmentAtomicCounterBuffers;
- break;
- case GL_MAX_FRAGMENT_ATOMIC_COUNTERS:
- *params = mCaps.maxFragmentAtomicCounters;
- break;
- case GL_MAX_FRAGMENT_IMAGE_UNIFORMS:
- *params = mCaps.maxFragmentImageUniforms;
- break;
- case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxFragmentShaderStorageBlocks;
- break;
- case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
- *params = mCaps.minProgramTextureGatherOffset;
- break;
- case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET:
- *params = mCaps.maxProgramTextureGatherOffset;
- break;
- case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS:
- *params = mCaps.maxComputeWorkGroupInvocations;
- break;
- case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
- *params = mCaps.maxComputeUniformBlocks;
- break;
- case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
- *params = mCaps.maxComputeTextureImageUnits;
- break;
- case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
- *params = mCaps.maxComputeSharedMemorySize;
- break;
- case GL_MAX_COMPUTE_UNIFORM_COMPONENTS:
- *params = mCaps.maxComputeUniformComponents;
- break;
- case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxComputeAtomicCounterBuffers;
- break;
- case GL_MAX_COMPUTE_ATOMIC_COUNTERS:
- *params = mCaps.maxComputeAtomicCounters;
- break;
- case GL_MAX_COMPUTE_IMAGE_UNIFORMS:
- *params = mCaps.maxComputeImageUniforms;
- break;
- case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS:
- *params = mCaps.maxCombinedComputeUniformComponents;
- break;
- case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxComputeShaderStorageBlocks;
- break;
- case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
- *params = mCaps.maxCombinedShaderOutputResources;
- break;
- case GL_MAX_UNIFORM_LOCATIONS:
- *params = mCaps.maxUniformLocations;
- break;
- case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS:
- *params = mCaps.maxAtomicCounterBufferBindings;
- break;
- case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE:
- *params = mCaps.maxAtomicCounterBufferSize;
- break;
- case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS:
- *params = mCaps.maxCombinedAtomicCounterBuffers;
- break;
- case GL_MAX_COMBINED_ATOMIC_COUNTERS:
- *params = mCaps.maxCombinedAtomicCounters;
- break;
- case GL_MAX_IMAGE_UNITS:
- *params = mCaps.maxImageUnits;
- break;
- case GL_MAX_COMBINED_IMAGE_UNIFORMS:
- *params = mCaps.maxCombinedImageUniforms;
- break;
- case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS:
- *params = mCaps.maxShaderStorageBufferBindings;
- break;
- case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS:
- *params = mCaps.maxCombinedShaderStorageBlocks;
- break;
- case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
- *params = mCaps.shaderStorageBufferOffsetAlignment;
- break;
- default:
- mGLState.getIntegerv(this, pname, params);
- break;
- }
-}
-
-void Context::getInteger64vImpl(GLenum pname, GLint64 *params)
-{
- // Queries about context capabilities and maximums are answered by Context.
- // Queries about current GL state values are answered by State.
- switch (pname)
- {
- case GL_MAX_ELEMENT_INDEX:
- *params = mCaps.maxElementIndex;
- break;
- case GL_MAX_UNIFORM_BLOCK_SIZE:
- *params = mCaps.maxUniformBlockSize;
- break;
- case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
- *params = mCaps.maxCombinedVertexUniformComponents;
- break;
- case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
- *params = mCaps.maxCombinedFragmentUniformComponents;
- break;
- case GL_MAX_SERVER_WAIT_TIMEOUT:
- *params = mCaps.maxServerWaitTimeout;
- break;
-
- // GL_EXT_disjoint_timer_query
- case GL_TIMESTAMP_EXT:
- *params = mImplementation->getTimestamp();
- break;
-
- case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
- *params = mCaps.maxShaderStorageBlockSize;
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
-void Context::getPointerv(GLenum pname, void **params) const
-{
- mGLState.getPointerv(pname, params);
-}
-
-void Context::getIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- // Queries about context capabilities and maximums are answered by Context.
- // Queries about current GL state values are answered by State.
-
- GLenum nativeType;
- unsigned int numParams;
- bool queryStatus = getIndexedQueryParameterInfo(target, &nativeType, &numParams);
- ASSERT(queryStatus);
-
- if (nativeType == GL_INT)
- {
- switch (target)
- {
- case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
- ASSERT(index < 3u);
- *data = mCaps.maxComputeWorkGroupCount[index];
- break;
- case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
- ASSERT(index < 3u);
- *data = mCaps.maxComputeWorkGroupSize[index];
- break;
- default:
- mGLState.getIntegeri_v(target, index, data);
- }
- }
- else
- {
- CastIndexedStateValues(this, nativeType, target, index, numParams, data);
- }
-}
-
-void Context::getInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- // Queries about context capabilities and maximums are answered by Context.
- // Queries about current GL state values are answered by State.
-
- GLenum nativeType;
- unsigned int numParams;
- bool queryStatus = getIndexedQueryParameterInfo(target, &nativeType, &numParams);
- ASSERT(queryStatus);
-
- if (nativeType == GL_INT_64_ANGLEX)
- {
- mGLState.getInteger64i_v(target, index, data);
- }
- else
- {
- CastIndexedStateValues(this, nativeType, target, index, numParams, data);
- }
-}
-
-void Context::getBooleani_v(GLenum target, GLuint index, GLboolean *data)
-{
- // Queries about context capabilities and maximums are answered by Context.
- // Queries about current GL state values are answered by State.
-
- GLenum nativeType;
- unsigned int numParams;
- bool queryStatus = getIndexedQueryParameterInfo(target, &nativeType, &numParams);
- ASSERT(queryStatus);
-
- if (nativeType == GL_BOOL)
- {
- mGLState.getBooleani_v(target, index, data);
- }
- else
- {
- CastIndexedStateValues(this, nativeType, target, index, numParams, data);
- }
-}
-
-void Context::getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- QueryBufferParameteriv(buffer, pname, params);
-}
-
-void Context::getFramebufferAttachmentParameteriv(GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params)
-{
- const Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- QueryFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params);
-}
-
-void Context::getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- QueryRenderbufferiv(this, renderbuffer, pname, params);
-}
-
-void Context::getTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- Texture *texture = getTargetTexture(target);
- QueryTexParameterfv(texture, pname, params);
-}
-
-void Context::getTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- Texture *texture = getTargetTexture(target);
- QueryTexParameteriv(texture, pname, params);
-}
-
-void Context::getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- QueryTexLevelParameteriv(texture, target, level, pname, params);
-}
-
-void Context::getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- QueryTexLevelParameterfv(texture, target, level, pname, params);
-}
-
-void Context::texParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameterf(this, texture, pname, param);
- onTextureChange(texture);
-}
-
-void Context::texParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameterfv(this, texture, pname, params);
- onTextureChange(texture);
-}
-
-void Context::texParameteri(GLenum target, GLenum pname, GLint param)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameteri(this, texture, pname, param);
- onTextureChange(texture);
-}
-
-void Context::texParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- Texture *texture = getTargetTexture(target);
- SetTexParameteriv(this, texture, pname, params);
- onTextureChange(texture);
-}
-
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawArrays(this, mode, first, count));
- MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback());
-}
-
-void Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(
- mImplementation->drawArraysInstanced(this, mode, first, count, instanceCount));
- MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback());
-}
-
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawElements(this, mode, count, type, indices));
-}
-
-void Context::drawElementsInstanced(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(
- mImplementation->drawElementsInstanced(this, mode, count, type, indices, instances));
-}
-
-void Context::drawRangeElements(GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(
- mImplementation->drawRangeElements(this, mode, start, end, count, type, indices));
-}
-
-void Context::drawArraysIndirect(GLenum mode, const void *indirect)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawArraysIndirect(this, mode, indirect));
-}
-
-void Context::drawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
-{
- ANGLE_CONTEXT_TRY(prepareForDraw());
- ANGLE_CONTEXT_TRY(mImplementation->drawElementsIndirect(this, mode, type, indirect));
-}
-
-void Context::flush()
-{
- handleError(mImplementation->flush(this));
-}
-
-void Context::finish()
-{
- handleError(mImplementation->finish(this));
-}
-
-void Context::insertEventMarker(GLsizei length, const char *marker)
-{
- ASSERT(mImplementation);
- mImplementation->insertEventMarker(length, marker);
-}
-
-void Context::pushGroupMarker(GLsizei length, const char *marker)
-{
- ASSERT(mImplementation);
- mImplementation->pushGroupMarker(length, marker);
-}
-
-void Context::popGroupMarker()
-{
- ASSERT(mImplementation);
- mImplementation->popGroupMarker();
-}
-
-void Context::bindUniformLocation(GLuint program, GLint location, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
-
- programObject->bindUniformLocation(location, name);
-}
-
-void Context::setCoverageModulation(GLenum components)
-{
- mGLState.setCoverageModulation(components);
-}
-
-void Context::loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix)
-{
- mGLState.loadPathRenderingMatrix(matrixMode, matrix);
-}
-
-void Context::loadPathRenderingIdentityMatrix(GLenum matrixMode)
-{
- GLfloat I[16];
- angle::Matrix<GLfloat>::setToIdentity(I);
-
- mGLState.loadPathRenderingMatrix(matrixMode, I);
-}
-
-void Context::stencilFillPath(GLuint path, GLenum fillMode, GLuint mask)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilFillPath(pathObj, fillMode, mask);
-}
-
-void Context::stencilStrokePath(GLuint path, GLint reference, GLuint mask)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilStrokePath(pathObj, reference, mask);
-}
-
-void Context::coverFillPath(GLuint path, GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->coverFillPath(pathObj, coverMode);
-}
-
-void Context::coverStrokePath(GLuint path, GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->coverStrokePath(pathObj, coverMode);
-}
-
-void Context::stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilThenCoverFillPath(pathObj, fillMode, mask, coverMode);
-}
-
-void Context::stencilThenCoverStrokePath(GLuint path,
- GLint reference,
- GLuint mask,
- GLenum coverMode)
-{
- const auto *pathObj = mState.mPaths->getPath(path);
- if (!pathObj)
- return;
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilThenCoverStrokePath(pathObj, reference, mask, coverMode);
-}
-
-void Context::coverFillPathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->coverFillPathInstanced(pathObjects, coverMode, transformType, transformValues);
-}
-
-void Context::coverStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->coverStrokePathInstanced(pathObjects, coverMode, transformType,
- transformValues);
-}
-
-void Context::stencilFillPathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum fillMode,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilFillPathInstanced(pathObjects, fillMode, mask, transformType,
- transformValues);
-}
-
-void Context::stencilStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilStrokePathInstanced(pathObjects, reference, mask, transformType,
- transformValues);
-}
-
-void Context::stencilThenCoverFillPathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilThenCoverFillPathInstanced(pathObjects, coverMode, fillMode, mask,
- transformType, transformValues);
-}
-
-void Context::stencilThenCoverStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues)
-{
- const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
-
- // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
- syncRendererState();
-
- mImplementation->stencilThenCoverStrokePathInstanced(pathObjects, coverMode, reference, mask,
- transformType, transformValues);
-}
-
-void Context::bindFragmentInputLocation(GLuint program, GLint location, const GLchar *name)
-{
- auto *programObject = getProgram(program);
-
- programObject->bindFragmentInputLocation(location, name);
-}
-
-void Context::programPathFragmentInputGen(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs)
-{
- auto *programObject = getProgram(program);
-
- programObject->pathFragmentInputGen(this, location, genMode, components, coeffs);
-}
-
-GLuint Context::getProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
-{
- const auto *programObject = getProgram(program);
- return QueryProgramResourceIndex(programObject, programInterface, name);
-}
-
-void Context::getProgramResourceName(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name)
-{
- const auto *programObject = getProgram(program);
- QueryProgramResourceName(programObject, programInterface, index, bufSize, length, name);
-}
-
-GLint Context::getProgramResourceLocation(GLuint program,
- GLenum programInterface,
- const GLchar *name)
-{
- const auto *programObject = getProgram(program);
- return QueryProgramResourceLocation(programObject, programInterface, name);
-}
-
-void Context::getProgramResourceiv(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei propCount,
- const GLenum *props,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params)
-{
- const auto *programObject = getProgram(program);
- QueryProgramResourceiv(programObject, programInterface, index, propCount, props, bufSize,
- length, params);
-}
-
-void Context::getProgramInterfaceiv(GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params)
-{
- const auto *programObject = getProgram(program);
- QueryProgramInterfaceiv(programObject, programInterface, pname, params);
-}
-
-void Context::handleError(const Error &error)
-{
- if (error.isError())
- {
- GLenum code = error.getCode();
- mErrors.insert(code);
- if (code == GL_OUT_OF_MEMORY && getWorkarounds().loseContextOnOutOfMemory)
- {
- markContextLost();
- }
-
- ASSERT(!error.getMessage().empty());
- mGLState.getDebug().insertMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, error.getID(),
- GL_DEBUG_SEVERITY_HIGH, error.getMessage());
- }
-}
-
-// Get one of the recorded errors and clear its flag, if any.
-// [OpenGL ES 2.0.24] section 2.5 page 13.
-GLenum Context::getError()
-{
- if (mErrors.empty())
- {
- return GL_NO_ERROR;
- }
- else
- {
- GLenum error = *mErrors.begin();
- mErrors.erase(mErrors.begin());
- return error;
- }
-}
-
-// NOTE: this function should not assume that this context is current!
-void Context::markContextLost()
-{
- if (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT)
- {
- mResetStatus = GL_UNKNOWN_CONTEXT_RESET_EXT;
- mContextLostForced = true;
- }
- mContextLost = true;
-}
-
-bool Context::isContextLost()
-{
- return mContextLost;
-}
-
-GLenum Context::getResetStatus()
-{
- // Even if the application doesn't want to know about resets, we want to know
- // as it will allow us to skip all the calls.
- if (mResetStrategy == GL_NO_RESET_NOTIFICATION_EXT)
- {
- if (!mContextLost && mImplementation->getResetStatus() != GL_NO_ERROR)
- {
- mContextLost = true;
- }
-
- // EXT_robustness, section 2.6: If the reset notification behavior is
- // NO_RESET_NOTIFICATION_EXT, then the implementation will never deliver notification of
- // reset events, and GetGraphicsResetStatusEXT will always return NO_ERROR.
- return GL_NO_ERROR;
- }
-
- // The GL_EXT_robustness spec says that if a reset is encountered, a reset
- // status should be returned at least once, and GL_NO_ERROR should be returned
- // once the device has finished resetting.
- if (!mContextLost)
- {
- ASSERT(mResetStatus == GL_NO_ERROR);
- mResetStatus = mImplementation->getResetStatus();
-
- if (mResetStatus != GL_NO_ERROR)
- {
- mContextLost = true;
- }
- }
- else if (!mContextLostForced && mResetStatus != GL_NO_ERROR)
- {
- // If markContextLost was used to mark the context lost then
- // assume that is not recoverable, and continue to report the
- // lost reset status for the lifetime of this context.
- mResetStatus = mImplementation->getResetStatus();
- }
-
- return mResetStatus;
-}
-
-bool Context::isResetNotificationEnabled()
-{
- return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
-}
-
-const egl::Config *Context::getConfig() const
-{
- return mConfig;
-}
-
-EGLenum Context::getClientType() const
-{
- return mClientType;
-}
-
-EGLenum Context::getRenderBuffer() const
-{
- const Framebuffer *framebuffer = mState.mFramebuffers->getFramebuffer(0);
- if (framebuffer == nullptr)
- {
- return EGL_NONE;
- }
-
- const FramebufferAttachment *backAttachment = framebuffer->getAttachment(GL_BACK);
- ASSERT(backAttachment != nullptr);
- return backAttachment->getSurface()->getRenderBuffer();
-}
-
-VertexArray *Context::checkVertexArrayAllocation(GLuint vertexArrayHandle)
-{
- // Only called after a prior call to Gen.
- VertexArray *vertexArray = getVertexArray(vertexArrayHandle);
- if (!vertexArray)
- {
- vertexArray = new VertexArray(mImplementation.get(), vertexArrayHandle,
- mCaps.maxVertexAttributes, mCaps.maxVertexAttribBindings);
-
- mVertexArrayMap.assign(vertexArrayHandle, vertexArray);
- }
-
- return vertexArray;
-}
-
-TransformFeedback *Context::checkTransformFeedbackAllocation(GLuint transformFeedbackHandle)
-{
- // Only called after a prior call to Gen.
- TransformFeedback *transformFeedback = getTransformFeedback(transformFeedbackHandle);
- if (!transformFeedback)
- {
- transformFeedback =
- new TransformFeedback(mImplementation.get(), transformFeedbackHandle, mCaps);
- transformFeedback->addRef();
- mTransformFeedbackMap.assign(transformFeedbackHandle, transformFeedback);
- }
-
- return transformFeedback;
-}
-
-bool Context::isVertexArrayGenerated(GLuint vertexArray)
-{
- ASSERT(mVertexArrayMap.contains(0));
- return mVertexArrayMap.contains(vertexArray);
-}
-
-bool Context::isTransformFeedbackGenerated(GLuint transformFeedback)
-{
- ASSERT(mTransformFeedbackMap.contains(0));
- return mTransformFeedbackMap.contains(transformFeedback);
-}
-
-void Context::detachTexture(GLuint texture)
-{
- // Simple pass-through to State's detachTexture method, as textures do not require
- // allocation map management either here or in the resource manager at detach time.
- // Zero textures are held by the Context, and we don't attempt to request them from
- // the State.
- mGLState.detachTexture(this, mZeroTextures, texture);
-}
-
-void Context::detachBuffer(GLuint buffer)
-{
- // Simple pass-through to State's detachBuffer method, since
- // only buffer attachments to container objects that are bound to the current context
- // should be detached. And all those are available in State.
-
- // [OpenGL ES 3.2] section 5.1.2 page 45:
- // Attachments to unbound container objects, such as
- // deletion of a buffer attached to a vertex array object which is not bound to the context,
- // are not affected and continue to act as references on the deleted object
- mGLState.detachBuffer(this, buffer);
-}
-
-void Context::detachFramebuffer(GLuint framebuffer)
-{
- // Framebuffer detachment is handled by Context, because 0 is a valid
- // Framebuffer object, and a pointer to it must be passed from Context
- // to State at binding time.
-
- // [OpenGL ES 2.0.24] section 4.4 page 107:
- // If a framebuffer that is currently bound to the target FRAMEBUFFER is deleted, it is as
- // though BindFramebuffer had been executed with the target of FRAMEBUFFER and framebuffer of
- // zero.
-
- if (mGLState.removeReadFramebufferBinding(framebuffer) && framebuffer != 0)
- {
- bindReadFramebuffer(0);
- }
-
- if (mGLState.removeDrawFramebufferBinding(framebuffer) && framebuffer != 0)
- {
- bindDrawFramebuffer(0);
- }
-}
-
-void Context::detachRenderbuffer(GLuint renderbuffer)
-{
- mGLState.detachRenderbuffer(this, renderbuffer);
-}
-
-void Context::detachVertexArray(GLuint vertexArray)
-{
- // Vertex array detachment is handled by Context, because 0 is a valid
- // VAO, and a pointer to it must be passed from Context to State at
- // binding time.
-
- // [OpenGL ES 3.0.2] section 2.10 page 43:
- // If a vertex array object that is currently bound is deleted, the binding
- // for that object reverts to zero and the default vertex array becomes current.
- if (mGLState.removeVertexArrayBinding(vertexArray))
- {
- bindVertexArray(0);
- }
-}
-
-void Context::detachTransformFeedback(GLuint transformFeedback)
-{
- // Transform feedback detachment is handled by Context, because 0 is a valid
- // transform feedback, and a pointer to it must be passed from Context to State at
- // binding time.
-
- // The OpenGL specification doesn't mention what should happen when the currently bound
- // transform feedback object is deleted. Since it is a container object, we treat it like
- // VAOs and FBOs and set the current bound transform feedback back to 0.
- if (mGLState.removeTransformFeedbackBinding(this, transformFeedback))
- {
- bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
- }
-}
-
-void Context::detachSampler(GLuint sampler)
-{
- mGLState.detachSampler(this, sampler);
-}
-
-void Context::detachProgramPipeline(GLuint pipeline)
-{
- mGLState.detachProgramPipeline(this, pipeline);
-}
-
-void Context::vertexAttribDivisor(GLuint index, GLuint divisor)
-{
- mGLState.setVertexAttribDivisor(this, index, divisor);
-}
-
-void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameteri(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameteriv(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameterf(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- SetSamplerParameterfv(samplerObject, pname, param);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- const Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- QuerySamplerParameteriv(samplerObject, pname, params);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- const Sampler *samplerObject =
- mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
- QuerySamplerParameterfv(samplerObject, pname, params);
- mGLState.setObjectDirty(GL_SAMPLER);
-}
-
-void Context::programParameteri(GLuint program, GLenum pname, GLint value)
-{
- gl::Program *programObject = getProgram(program);
- SetProgramParameteri(programObject, pname, value);
-}
-
-void Context::initRendererString()
-{
- std::ostringstream rendererString;
- rendererString << "ANGLE (";
- rendererString << mImplementation->getRendererDescription();
- rendererString << ")";
-
- mRendererString = MakeStaticString(rendererString.str());
-}
-
-void Context::initVersionStrings()
-{
- const Version &clientVersion = getClientVersion();
-
- std::ostringstream versionString;
- versionString << "OpenGL ES " << clientVersion.major << "." << clientVersion.minor << " (ANGLE "
- << ANGLE_VERSION_STRING << ")";
- mVersionString = MakeStaticString(versionString.str());
-
- std::ostringstream shadingLanguageVersionString;
- shadingLanguageVersionString << "OpenGL ES GLSL ES "
- << (clientVersion.major == 2 ? 1 : clientVersion.major) << "."
- << clientVersion.minor << "0 (ANGLE " << ANGLE_VERSION_STRING
- << ")";
- mShadingLanguageString = MakeStaticString(shadingLanguageVersionString.str());
-}
-
-void Context::initExtensionStrings()
-{
- auto mergeExtensionStrings = [](const std::vector<const char *> &strings) {
- std::ostringstream combinedStringStream;
- std::copy(strings.begin(), strings.end(),
- std::ostream_iterator<const char *>(combinedStringStream, " "));
- return MakeStaticString(combinedStringStream.str());
- };
-
- mExtensionStrings.clear();
- for (const auto &extensionString : mExtensions.getStrings())
- {
- mExtensionStrings.push_back(MakeStaticString(extensionString));
- }
- mExtensionString = mergeExtensionStrings(mExtensionStrings);
-
- const gl::Extensions &nativeExtensions = mImplementation->getNativeExtensions();
-
- mRequestableExtensionStrings.clear();
- for (const auto &extensionInfo : GetExtensionInfoMap())
- {
- if (extensionInfo.second.Requestable &&
- !(mExtensions.*(extensionInfo.second.ExtensionsMember)) &&
- nativeExtensions.*(extensionInfo.second.ExtensionsMember))
- {
- mRequestableExtensionStrings.push_back(MakeStaticString(extensionInfo.first));
- }
- }
- mRequestableExtensionString = mergeExtensionStrings(mRequestableExtensionStrings);
-}
-
-const GLubyte *Context::getString(GLenum name) const
-{
- switch (name)
- {
- case GL_VENDOR:
- return reinterpret_cast<const GLubyte *>("Google Inc.");
-
- case GL_RENDERER:
- return reinterpret_cast<const GLubyte *>(mRendererString);
-
- case GL_VERSION:
- return reinterpret_cast<const GLubyte *>(mVersionString);
-
- case GL_SHADING_LANGUAGE_VERSION:
- return reinterpret_cast<const GLubyte *>(mShadingLanguageString);
-
- case GL_EXTENSIONS:
- return reinterpret_cast<const GLubyte *>(mExtensionString);
-
- case GL_REQUESTABLE_EXTENSIONS_ANGLE:
- return reinterpret_cast<const GLubyte *>(mRequestableExtensionString);
-
- default:
- UNREACHABLE();
- return nullptr;
- }
-}
-
-const GLubyte *Context::getStringi(GLenum name, GLuint index) const
-{
- switch (name)
- {
- case GL_EXTENSIONS:
- return reinterpret_cast<const GLubyte *>(mExtensionStrings[index]);
-
- case GL_REQUESTABLE_EXTENSIONS_ANGLE:
- return reinterpret_cast<const GLubyte *>(mRequestableExtensionStrings[index]);
-
- default:
- UNREACHABLE();
- return nullptr;
- }
-}
-
-size_t Context::getExtensionStringCount() const
-{
- return mExtensionStrings.size();
-}
-
-bool Context::isExtensionRequestable(const char *name)
-{
- const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
- auto extension = extensionInfos.find(name);
-
- const Extensions &nativeExtensions = mImplementation->getNativeExtensions();
- return extension != extensionInfos.end() && extension->second.Requestable &&
- nativeExtensions.*(extension->second.ExtensionsMember);
-}
-
-void Context::requestExtension(const char *name)
-{
- const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
- ASSERT(extensionInfos.find(name) != extensionInfos.end());
- const auto &extension = extensionInfos.at(name);
- ASSERT(extension.Requestable);
- ASSERT(mImplementation->getNativeExtensions().*(extension.ExtensionsMember));
-
- if (mExtensions.*(extension.ExtensionsMember))
- {
- // Extension already enabled
- return;
- }
-
- mExtensions.*(extension.ExtensionsMember) = true;
- updateCaps();
- initExtensionStrings();
-
- // Release the shader compiler so it will be re-created with the requested extensions enabled.
- releaseShaderCompiler();
-
- // Invalidate all textures and framebuffer. Some extensions make new formats renderable or
- // sampleable.
- mState.mTextures->signalAllTexturesDirty();
- for (auto &zeroTexture : mZeroTextures)
- {
- zeroTexture.second->signalDirty(InitState::Initialized);
- }
-
- mState.mFramebuffers->invalidateFramebufferComplenessCache();
-}
-
-size_t Context::getRequestableExtensionStringCount() const
-{
- return mRequestableExtensionStrings.size();
-}
-
-void Context::beginTransformFeedback(GLenum primitiveMode)
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- ASSERT(transformFeedback != nullptr);
- ASSERT(!transformFeedback->isPaused());
-
- transformFeedback->begin(this, primitiveMode, mGLState.getProgram());
-}
-
-bool Context::hasActiveTransformFeedback(GLuint program) const
-{
- for (auto pair : mTransformFeedbackMap)
- {
- if (pair.second != nullptr && pair.second->hasBoundProgram(program))
- {
- return true;
- }
- }
- return false;
-}
-
-void Context::initCaps(const egl::DisplayExtensions &displayExtensions, bool robustResourceInit)
-{
- mCaps = mImplementation->getNativeCaps();
-
- mExtensions = mImplementation->getNativeExtensions();
-
- mLimitations = mImplementation->getNativeLimitations();
-
- if (getClientVersion() < Version(3, 0))
- {
- // Disable ES3+ extensions
- mExtensions.colorBufferFloat = false;
- mExtensions.eglImageExternalEssl3 = false;
- mExtensions.textureNorm16 = false;
- mExtensions.multiview = false;
- mExtensions.maxViews = 1u;
- }
-
- if (getClientVersion() < ES_3_1)
- {
- // Disable ES3.1+ extensions
- mExtensions.geometryShader = false;
- }
-
- if (getClientVersion() > Version(2, 0))
- {
- // FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
- // mExtensions.sRGB = false;
- }
-
- // Some extensions are always available because they are implemented in the GL layer.
- mExtensions.bindUniformLocation = true;
- mExtensions.vertexArrayObject = true;
- mExtensions.bindGeneratesResource = true;
- mExtensions.clientArrays = true;
- mExtensions.requestExtension = true;
-
- // Enable the no error extension if the context was created with the flag.
- mExtensions.noError = mSkipValidation;
-
- // Enable surfaceless to advertise we'll have the correct behavior when there is no default FBO
- mExtensions.surfacelessContext = displayExtensions.surfacelessContext;
-
- // Explicitly enable GL_KHR_debug
- mExtensions.debug = true;
- mExtensions.maxDebugMessageLength = 1024;
- mExtensions.maxDebugLoggedMessages = 1024;
- mExtensions.maxDebugGroupStackDepth = 1024;
- mExtensions.maxLabelLength = 1024;
-
- // Explicitly enable GL_ANGLE_robust_client_memory
- mExtensions.robustClientMemory = true;
-
- // Determine robust resource init availability from EGL.
- mExtensions.robustResourceInitialization = robustResourceInit;
-
- // mExtensions.robustBufferAccessBehavior is true only if robust access is true and the backend
- // supports it.
- mExtensions.robustBufferAccessBehavior =
- mRobustAccess && mExtensions.robustBufferAccessBehavior;
-
- // Enable the cache control query unconditionally.
- mExtensions.programCacheControl = true;
-
- // Apply implementation limits
- LimitCap(&mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
-
- if (getClientVersion() < ES_3_1)
- {
- mCaps.maxVertexAttribBindings = mCaps.maxVertexAttributes;
- }
- else
- {
- LimitCap(&mCaps.maxVertexAttribBindings, MAX_VERTEX_ATTRIB_BINDINGS);
- }
-
- LimitCap(&mCaps.maxVertexUniformBlocks, IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
- LimitCap(&mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
- LimitCap(&mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
-
- // Limit textures as well, so we can use fast bitsets with texture bindings.
- LimitCap(&mCaps.maxCombinedTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES);
- LimitCap(&mCaps.maxVertexTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
- LimitCap(&mCaps.maxTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
-
- mCaps.maxSampleMaskWords = std::min<GLuint>(mCaps.maxSampleMaskWords, MAX_SAMPLE_MASK_WORDS);
-
- // WebGL compatibility
- mExtensions.webglCompatibility = mWebGLContext;
- for (const auto &extensionInfo : GetExtensionInfoMap())
- {
- // If this context is for WebGL, disable all enableable extensions
- if (mWebGLContext && extensionInfo.second.Requestable)
- {
- mExtensions.*(extensionInfo.second.ExtensionsMember) = false;
- }
- }
-
- // Generate texture caps
- updateCaps();
-}
-
-void Context::updateCaps()
-{
- mCaps.compressedTextureFormats.clear();
- mTextureCaps.clear();
-
- for (GLenum sizedInternalFormat : GetAllSizedInternalFormats())
- {
- TextureCaps formatCaps = mImplementation->getNativeTextureCaps().get(sizedInternalFormat);
- const InternalFormat &formatInfo = GetSizedInternalFormatInfo(sizedInternalFormat);
-
- // Update the format caps based on the client version and extensions.
- // Caps are AND'd with the renderer caps because some core formats are still unsupported in
- // ES3.
- formatCaps.texturable =
- formatCaps.texturable && formatInfo.textureSupport(getClientVersion(), mExtensions);
- formatCaps.renderable =
- formatCaps.renderable && formatInfo.renderSupport(getClientVersion(), mExtensions);
- formatCaps.filterable =
- formatCaps.filterable && formatInfo.filterSupport(getClientVersion(), mExtensions);
-
- // OpenGL ES does not support multisampling with non-rendererable formats
- // OpenGL ES 3.0 or prior does not support multisampling with integer formats
- if (!formatCaps.renderable ||
- (getClientVersion() < ES_3_1 &&
- (formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT)))
- {
- formatCaps.sampleCounts.clear();
- }
- else
- {
- // We may have limited the max samples for some required renderbuffer formats due to
- // non-conformant formats. In this case MAX_SAMPLES needs to be lowered accordingly.
- GLuint formatMaxSamples = formatCaps.getMaxSamples();
-
- // GLES 3.0.5 section 4.4.2.2: "Implementations must support creation of renderbuffers
- // in these required formats with up to the value of MAX_SAMPLES multisamples, with the
- // exception of signed and unsigned integer formats."
- if (formatInfo.componentType != GL_INT && formatInfo.componentType != GL_UNSIGNED_INT &&
- formatInfo.isRequiredRenderbufferFormat(getClientVersion()))
- {
- ASSERT(getClientVersion() < ES_3_0 || formatMaxSamples >= 4);
- mCaps.maxSamples = std::min(mCaps.maxSamples, formatMaxSamples);
- }
-
- // Handle GLES 3.1 MAX_*_SAMPLES values similarly to MAX_SAMPLES.
- if (getClientVersion() >= ES_3_1)
- {
- // GLES 3.1 section 9.2.5: "Implementations must support creation of renderbuffers
- // in these required formats with up to the value of MAX_SAMPLES multisamples, with
- // the exception that the signed and unsigned integer formats are required only to
- // support creation of renderbuffers with up to the value of MAX_INTEGER_SAMPLES
- // multisamples, which must be at least one."
- if (formatInfo.componentType == GL_INT ||
- formatInfo.componentType == GL_UNSIGNED_INT)
- {
- mCaps.maxIntegerSamples = std::min(mCaps.maxIntegerSamples, formatMaxSamples);
- }
-
- // GLES 3.1 section 19.3.1.
- if (formatCaps.texturable)
- {
- if (formatInfo.depthBits > 0)
- {
- mCaps.maxDepthTextureSamples =
- std::min(mCaps.maxDepthTextureSamples, formatMaxSamples);
- }
- else if (formatInfo.redBits > 0)
- {
- mCaps.maxColorTextureSamples =
- std::min(mCaps.maxColorTextureSamples, formatMaxSamples);
- }
- }
- }
- }
-
- if (formatCaps.texturable && formatInfo.compressed)
- {
- mCaps.compressedTextureFormats.push_back(sizedInternalFormat);
- }
-
- mTextureCaps.insert(sizedInternalFormat, formatCaps);
- }
-
- // If program binary is disabled, blank out the memory cache pointer.
- if (!mImplementation->getNativeExtensions().getProgramBinary)
- {
- mMemoryProgramCache = nullptr;
- }
-}
-
-void Context::initWorkarounds()
-{
- // Apply back-end workarounds.
- mImplementation->applyNativeWorkarounds(&mWorkarounds);
-
- // Lose the context upon out of memory error if the application is
- // expecting to watch for those events.
- mWorkarounds.loseContextOnOutOfMemory = (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
-}
-
-Error Context::prepareForDraw()
-{
- syncRendererState();
-
- if (isRobustResourceInitEnabled())
- {
- ANGLE_TRY(mGLState.clearUnclearedActiveTextures(this));
- ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureDrawAttachmentsInitialized(this));
- }
-
- return NoError();
-}
-
-void Context::syncRendererState()
-{
- mGLState.syncDirtyObjects(this);
- const State::DirtyBits &dirtyBits = mGLState.getDirtyBits();
- mImplementation->syncState(this, dirtyBits);
- mGLState.clearDirtyBits();
-}
-
-void Context::syncRendererState(const State::DirtyBits &bitMask,
- const State::DirtyObjects &objectMask)
-{
- mGLState.syncDirtyObjects(this, objectMask);
- const State::DirtyBits &dirtyBits = (mGLState.getDirtyBits() & bitMask);
- mImplementation->syncState(this, dirtyBits);
- mGLState.clearDirtyBits(dirtyBits);
-}
-
-void Context::blitFramebuffer(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter)
-{
- Framebuffer *drawFramebuffer = mGLState.getDrawFramebuffer();
- ASSERT(drawFramebuffer);
-
- Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
- Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
-
- syncStateForBlit();
-
- handleError(drawFramebuffer->blit(this, srcArea, dstArea, mask, filter));
-}
-
-void Context::clear(GLbitfield mask)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clear(this, mask));
-}
-
-void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clearBufferfv(this, buffer, drawbuffer, values));
-}
-
-void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clearBufferuiv(this, buffer, drawbuffer, values));
-}
-
-void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
-{
- syncStateForClear();
- handleError(mGLState.getDrawFramebuffer()->clearBufferiv(this, buffer, drawbuffer, values));
-}
-
-void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- Framebuffer *framebufferObject = mGLState.getDrawFramebuffer();
- ASSERT(framebufferObject);
-
- // If a buffer is not present, the clear has no effect
- if (framebufferObject->getDepthbuffer() == nullptr &&
- framebufferObject->getStencilbuffer() == nullptr)
- {
- return;
- }
-
- syncStateForClear();
- handleError(framebufferObject->clearBufferfi(this, buffer, drawbuffer, depth, stencil));
-}
-
-void Context::readPixels(GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- void *pixels)
-{
- if (width == 0 || height == 0)
- {
- return;
- }
-
- syncStateForReadPixels();
-
- Framebuffer *readFBO = mGLState.getReadFramebuffer();
- ASSERT(readFBO);
-
- Rectangle area(x, y, width, height);
- handleError(readFBO->readPixels(this, area, format, type, pixels));
-}
-
-void Context::copyTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // Only sync the read FBO
- mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
-
- Rectangle sourceArea(x, y, width, height);
-
- Framebuffer *framebuffer = mGLState.getReadFramebuffer();
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->copyImage(this, target, level, sourceArea, internalformat, framebuffer));
-}
-
-void Context::copyTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- if (width == 0 || height == 0)
- {
- return;
- }
-
- // Only sync the read FBO
- mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
-
- Offset destOffset(xoffset, yoffset, 0);
- Rectangle sourceArea(x, y, width, height);
-
- Framebuffer *framebuffer = mGLState.getReadFramebuffer();
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
-}
-
-void Context::copyTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- if (width == 0 || height == 0)
- {
- return;
- }
-
- // Only sync the read FBO
- mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
-
- Offset destOffset(xoffset, yoffset, zoffset);
- Rectangle sourceArea(x, y, width, height);
-
- Framebuffer *framebuffer = mGLState.getReadFramebuffer();
- Texture *texture = getTargetTexture(target);
- handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
-}
-
-void Context::framebufferTexture2D(GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObj = getTexture(texture);
-
- ImageIndex index = ImageIndex::MakeInvalid();
-
- if (textarget == GL_TEXTURE_2D)
- {
- index = ImageIndex::Make2D(level);
- }
- else if (textarget == GL_TEXTURE_RECTANGLE_ANGLE)
- {
- index = ImageIndex::MakeRectangle(level);
- }
- else if (textarget == GL_TEXTURE_2D_MULTISAMPLE)
- {
- ASSERT(level == 0);
- index = ImageIndex::Make2DMultisample();
- }
- else
- {
- ASSERT(IsCubeMapTextureTarget(textarget));
- index = ImageIndex::MakeCube(textarget, level);
- }
-
- framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObj);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferRenderbuffer(GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (renderbuffer != 0)
- {
- Renderbuffer *renderbufferObject = getRenderbuffer(renderbuffer);
-
- framebuffer->setAttachment(this, GL_RENDERBUFFER, attachment, gl::ImageIndex::MakeInvalid(),
- renderbufferObject);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferTextureLayer(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint layer)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObject = getTexture(texture);
-
- ImageIndex index = ImageIndex::MakeInvalid();
-
- if (textureObject->getTarget() == GL_TEXTURE_3D)
- {
- index = ImageIndex::Make3D(level, layer);
- }
- else
- {
- ASSERT(textureObject->getTarget() == GL_TEXTURE_2D_ARRAY);
- index = ImageIndex::Make2DArray(level, layer);
- }
-
- framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObject);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferTextureMultiviewLayeredANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObj = getTexture(texture);
-
- ImageIndex index = ImageIndex::Make2DArrayRange(level, baseViewIndex, numViews);
- framebuffer->setAttachmentMultiviewLayered(this, GL_TEXTURE, attachment, index, textureObj,
- numViews, baseViewIndex);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::framebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (texture != 0)
- {
- Texture *textureObj = getTexture(texture);
-
- ImageIndex index = ImageIndex::Make2D(level);
- framebuffer->setAttachmentMultiviewSideBySide(this, GL_TEXTURE, attachment, index,
- textureObj, numViews, viewportOffsets);
- }
- else
- {
- framebuffer->resetAttachment(this, attachment);
- }
-
- mGLState.setObjectDirty(target);
-}
-
-void Context::drawBuffers(GLsizei n, const GLenum *bufs)
-{
- Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
- ASSERT(framebuffer);
- framebuffer->setDrawBuffers(n, bufs);
- mGLState.setObjectDirty(GL_DRAW_FRAMEBUFFER);
-}
-
-void Context::readBuffer(GLenum mode)
-{
- Framebuffer *readFBO = mGLState.getReadFramebuffer();
- readFBO->setReadBuffer(mode);
- mGLState.setObjectDirty(GL_READ_FRAMEBUFFER);
-}
-
-void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- // Only sync the FBO
- mGLState.syncDirtyObject(this, target);
-
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- // The specification isn't clear what should be done when the framebuffer isn't complete.
- // We leave it up to the framebuffer implementation to decide what to do.
- handleError(framebuffer->discard(this, numAttachments, attachments));
-}
-
-void Context::invalidateFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments)
-{
- // Only sync the FBO
- mGLState.syncDirtyObject(this, target);
-
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->checkStatus(this) != GL_FRAMEBUFFER_COMPLETE)
- {
- return;
- }
-
- handleError(framebuffer->invalidate(this, numAttachments, attachments));
-}
-
-void Context::invalidateSubFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // Only sync the FBO
- mGLState.syncDirtyObject(this, target);
-
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (framebuffer->checkStatus(this) != GL_FRAMEBUFFER_COMPLETE)
- {
- return;
- }
-
- Rectangle area(x, y, width, height);
- handleError(framebuffer->invalidateSub(this, numAttachments, attachments, area));
-}
-
-void Context::texImage2D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- syncStateForTexImage();
-
- Extents size(width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
- size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::texImage3D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- syncStateForTexImage();
-
- Extents size(width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
- size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::texSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- // Zero sized uploads are valid but no-ops
- if (width == 0 || height == 0)
- {
- return;
- }
-
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, 0, width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
- type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::texSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- // Zero sized uploads are valid but no-ops
- if (width == 0 || height == 0 || depth == 0)
- {
- return;
- }
-
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, zoffset, width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
- type, reinterpret_cast<const uint8_t *>(pixels)));
-}
-
-void Context::compressedTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- const void *data)
-{
- syncStateForTexImage();
-
- Extents size(width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
- internalformat, size, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::compressedTexImage3D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const void *data)
-{
- syncStateForTexImage();
-
- Extents size(width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
- internalformat, size, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::compressedTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- const void *data)
-{
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, 0, width, height, 1);
- Texture *texture =
- getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
- handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
- format, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::compressedTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLsizei imageSize,
- const void *data)
-{
- // Zero sized uploads are valid but no-ops
- if (width == 0 || height == 0)
- {
- return;
- }
-
- syncStateForTexImage();
-
- Box area(xoffset, yoffset, zoffset, width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
- format, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
-}
-
-void Context::generateMipmap(GLenum target)
-{
- Texture *texture = getTargetTexture(target);
- handleError(texture->generateMipmap(this));
-}
-
-void Context::copyTextureCHROMIUM(GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint internalFormat,
- GLenum destType,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha)
-{
- syncStateForTexImage();
-
- gl::Texture *sourceTexture = getTexture(sourceId);
- gl::Texture *destTexture = getTexture(destId);
- handleError(destTexture->copyTexture(this, destTarget, destLevel, internalFormat, destType,
- sourceLevel, ConvertToBool(unpackFlipY),
- ConvertToBool(unpackPremultiplyAlpha),
- ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
-}
-
-void Context::copySubTextureCHROMIUM(GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha)
-{
- // Zero sized copies are valid but no-ops
- if (width == 0 || height == 0)
- {
- return;
- }
-
- syncStateForTexImage();
-
- gl::Texture *sourceTexture = getTexture(sourceId);
- gl::Texture *destTexture = getTexture(destId);
- Offset offset(xoffset, yoffset, 0);
- Rectangle area(x, y, width, height);
- handleError(destTexture->copySubTexture(this, destTarget, destLevel, offset, sourceLevel, area,
- ConvertToBool(unpackFlipY),
- ConvertToBool(unpackPremultiplyAlpha),
- ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
-}
-
-void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
-{
- syncStateForTexImage();
-
- gl::Texture *sourceTexture = getTexture(sourceId);
- gl::Texture *destTexture = getTexture(destId);
- handleError(destTexture->copyCompressedTexture(this, sourceTexture));
-}
-
-void Context::getBufferPointerv(BufferBinding target, GLenum pname, void **params)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- QueryBufferPointerv(buffer, pname, params);
-}
-
-void *Context::mapBuffer(BufferBinding target, GLenum access)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- Error error = buffer->map(this, access);
- if (error.isError())
- {
- handleError(error);
- return nullptr;
- }
-
- return buffer->getMapPointer();
-}
-
-GLboolean Context::unmapBuffer(BufferBinding target)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- GLboolean result;
- Error error = buffer->unmap(this, &result);
- if (error.isError())
- {
- handleError(error);
- return GL_FALSE;
- }
-
- return result;
-}
-
-void *Context::mapBufferRange(BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
-
- Error error = buffer->mapRange(this, offset, length, access);
- if (error.isError())
- {
- handleError(error);
- return nullptr;
- }
-
- return buffer->getMapPointer();
-}
-
-void Context::flushMappedBufferRange(BufferBinding /*target*/,
- GLintptr /*offset*/,
- GLsizeiptr /*length*/)
-{
- // We do not currently support a non-trivial implementation of FlushMappedBufferRange
-}
-
-void Context::syncStateForReadPixels()
-{
- syncRendererState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects);
-}
-
-void Context::syncStateForTexImage()
-{
- syncRendererState(mTexImageDirtyBits, mTexImageDirtyObjects);
-}
-
-void Context::syncStateForClear()
-{
- syncRendererState(mClearDirtyBits, mClearDirtyObjects);
-}
-
-void Context::syncStateForBlit()
-{
- syncRendererState(mBlitDirtyBits, mBlitDirtyObjects);
-}
-
-void Context::activeShaderProgram(GLuint pipeline, GLuint program)
-{
- UNIMPLEMENTED();
-}
-
-void Context::activeTexture(GLenum texture)
-{
- mGLState.setActiveSampler(texture - GL_TEXTURE0);
-}
-
-void Context::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- mGLState.setBlendColor(clamp01(red), clamp01(green), clamp01(blue), clamp01(alpha));
-}
-
-void Context::blendEquation(GLenum mode)
-{
- mGLState.setBlendEquation(mode, mode);
-}
-
-void Context::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- mGLState.setBlendEquation(modeRGB, modeAlpha);
-}
-
-void Context::blendFunc(GLenum sfactor, GLenum dfactor)
-{
- mGLState.setBlendFactors(sfactor, dfactor, sfactor, dfactor);
-}
-
-void Context::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- mGLState.setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-void Context::clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- mGLState.setColorClearValue(red, green, blue, alpha);
-}
-
-void Context::clearDepthf(GLfloat depth)
-{
- mGLState.setDepthClearValue(depth);
-}
-
-void Context::clearStencil(GLint s)
-{
- mGLState.setStencilClearValue(s);
-}
-
-void Context::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- mGLState.setColorMask(ConvertToBool(red), ConvertToBool(green), ConvertToBool(blue),
- ConvertToBool(alpha));
-}
-
-void Context::cullFace(CullFaceMode mode)
-{
- mGLState.setCullMode(mode);
-}
-
-void Context::depthFunc(GLenum func)
-{
- mGLState.setDepthFunc(func);
-}
-
-void Context::depthMask(GLboolean flag)
-{
- mGLState.setDepthMask(ConvertToBool(flag));
-}
-
-void Context::depthRangef(GLfloat zNear, GLfloat zFar)
-{
- mGLState.setDepthRange(zNear, zFar);
-}
-
-void Context::disable(GLenum cap)
-{
- mGLState.setEnableFeature(cap, false);
-}
-
-void Context::disableVertexAttribArray(GLuint index)
-{
- mGLState.setEnableVertexAttribArray(index, false);
-}
-
-void Context::enable(GLenum cap)
-{
- mGLState.setEnableFeature(cap, true);
-}
-
-void Context::enableVertexAttribArray(GLuint index)
-{
- mGLState.setEnableVertexAttribArray(index, true);
-}
-
-void Context::frontFace(GLenum mode)
-{
- mGLState.setFrontFace(mode);
-}
-
-void Context::hint(GLenum target, GLenum mode)
-{
- switch (target)
- {
- case GL_GENERATE_MIPMAP_HINT:
- mGLState.setGenerateMipmapHint(mode);
- break;
-
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- mGLState.setFragmentShaderDerivativeHint(mode);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::lineWidth(GLfloat width)
-{
- mGLState.setLineWidth(width);
-}
-
-void Context::pixelStorei(GLenum pname, GLint param)
-{
- switch (pname)
- {
- case GL_UNPACK_ALIGNMENT:
- mGLState.setUnpackAlignment(param);
- break;
-
- case GL_PACK_ALIGNMENT:
- mGLState.setPackAlignment(param);
- break;
-
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
- mGLState.setPackReverseRowOrder(param != 0);
- break;
-
- case GL_UNPACK_ROW_LENGTH:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
- mGLState.setUnpackRowLength(param);
- break;
-
- case GL_UNPACK_IMAGE_HEIGHT:
- ASSERT(getClientMajorVersion() >= 3);
- mGLState.setUnpackImageHeight(param);
- break;
-
- case GL_UNPACK_SKIP_IMAGES:
- ASSERT(getClientMajorVersion() >= 3);
- mGLState.setUnpackSkipImages(param);
- break;
-
- case GL_UNPACK_SKIP_ROWS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
- mGLState.setUnpackSkipRows(param);
- break;
-
- case GL_UNPACK_SKIP_PIXELS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
- mGLState.setUnpackSkipPixels(param);
- break;
-
- case GL_PACK_ROW_LENGTH:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
- mGLState.setPackRowLength(param);
- break;
-
- case GL_PACK_SKIP_ROWS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
- mGLState.setPackSkipRows(param);
- break;
-
- case GL_PACK_SKIP_PIXELS:
- ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
- mGLState.setPackSkipPixels(param);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::polygonOffset(GLfloat factor, GLfloat units)
-{
- mGLState.setPolygonOffsetParams(factor, units);
-}
-
-void Context::sampleCoverage(GLfloat value, GLboolean invert)
-{
- mGLState.setSampleCoverageParams(clamp01(value), ConvertToBool(invert));
-}
-
-void Context::sampleMaski(GLuint maskNumber, GLbitfield mask)
-{
- mGLState.setSampleMaskParams(maskNumber, mask);
-}
-
-void Context::scissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- mGLState.setScissorParams(x, y, width, height);
-}
-
-void Context::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilParams(func, ref, mask);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilBackParams(func, ref, mask);
- }
-}
-
-void Context::stencilMaskSeparate(GLenum face, GLuint mask)
-{
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilWritemask(mask);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilBackWritemask(mask);
- }
-}
-
-void Context::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilOperations(fail, zfail, zpass);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- mGLState.setStencilBackOperations(fail, zfail, zpass);
- }
-}
-
-void Context::vertexAttrib1f(GLuint index, GLfloat x)
-{
- GLfloat vals[4] = {x, 0, 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib1fv(GLuint index, const GLfloat *values)
-{
- GLfloat vals[4] = {values[0], 0, 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- GLfloat vals[4] = {x, y, 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib2fv(GLuint index, const GLfloat *values)
-{
- GLfloat vals[4] = {values[0], values[1], 0, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- GLfloat vals[4] = {x, y, z, 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib3fv(GLuint index, const GLfloat *values)
-{
- GLfloat vals[4] = {values[0], values[1], values[2], 1};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLfloat vals[4] = {x, y, z, w};
- mGLState.setVertexAttribf(index, vals);
-}
-
-void Context::vertexAttrib4fv(GLuint index, const GLfloat *values)
-{
- mGLState.setVertexAttribf(index, values);
-}
-
-void Context::vertexAttribPointer(GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr)
-{
- mGLState.setVertexAttribPointer(this, index, mGLState.getTargetBuffer(BufferBinding::Array),
- size, type, ConvertToBool(normalized), false, stride, ptr);
-}
-
-void Context::vertexAttribFormat(GLuint attribIndex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeOffset)
-{
- mGLState.setVertexAttribFormat(attribIndex, size, type, ConvertToBool(normalized), false,
- relativeOffset);
-}
-
-void Context::vertexAttribIFormat(GLuint attribIndex,
- GLint size,
- GLenum type,
- GLuint relativeOffset)
-{
- mGLState.setVertexAttribFormat(attribIndex, size, type, false, true, relativeOffset);
-}
-
-void Context::vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
-{
- mGLState.setVertexAttribBinding(this, attribIndex, bindingIndex);
-}
-
-void Context::vertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
-{
- mGLState.setVertexBindingDivisor(bindingIndex, divisor);
-}
-
-void Context::viewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- mGLState.setViewportParams(x, y, width, height);
-}
-
-void Context::vertexAttribIPointer(GLuint index,
- GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- mGLState.setVertexAttribPointer(this, index, mGLState.getTargetBuffer(BufferBinding::Array),
- size, type, false, true, stride, pointer);
-}
-
-void Context::vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- GLint vals[4] = {x, y, z, w};
- mGLState.setVertexAttribi(index, vals);
-}
-
-void Context::vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- GLuint vals[4] = {x, y, z, w};
- mGLState.setVertexAttribu(index, vals);
-}
-
-void Context::vertexAttribI4iv(GLuint index, const GLint *v)
-{
- mGLState.setVertexAttribi(index, v);
-}
-
-void Context::vertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- mGLState.setVertexAttribu(index, v);
-}
-
-void Context::getVertexAttribiv(GLuint index, GLenum pname, GLint *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribfv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribIiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- const VertexAttribCurrentValueData &currentValues =
- getGLState().getVertexAttribCurrentValue(index);
- const VertexArray *vao = getGLState().getVertexArray();
- QueryVertexAttribIuiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
- currentValues, pname, params);
-}
-
-void Context::getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
-{
- const VertexAttribute &attrib = getGLState().getVertexArray()->getVertexAttribute(index);
- QueryVertexAttribPointerv(attrib, pname, pointer);
-}
-
-void Context::debugMessageControl(GLenum source,
- GLenum type,
- GLenum severity,
- GLsizei count,
- const GLuint *ids,
- GLboolean enabled)
-{
- std::vector<GLuint> idVector(ids, ids + count);
- mGLState.getDebug().setMessageControl(source, type, severity, std::move(idVector),
- ConvertToBool(enabled));
-}
-
-void Context::debugMessageInsert(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- GLsizei length,
- const GLchar *buf)
-{
- std::string msg(buf, (length > 0) ? static_cast<size_t>(length) : strlen(buf));
- mGLState.getDebug().insertMessage(source, type, id, severity, std::move(msg));
-}
-
-void Context::debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam)
-{
- mGLState.getDebug().setCallback(callback, userParam);
-}
-
-GLuint Context::getDebugMessageLog(GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog)
-{
- return static_cast<GLuint>(mGLState.getDebug().getMessages(count, bufSize, sources, types, ids,
- severities, lengths, messageLog));
-}
-
-void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
-{
- std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message));
- mGLState.getDebug().pushGroup(source, id, std::move(msg));
- mImplementation->pushDebugGroup(source, id, length, message);
-}
-
-void Context::popDebugGroup()
-{
- mGLState.getDebug().popGroup();
- mImplementation->popDebugGroup();
-}
-
-void Context::bufferData(BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
- handleError(buffer->bufferData(this, target, data, size, usage));
-}
-
-void Context::bufferSubData(BufferBinding target,
- GLintptr offset,
- GLsizeiptr size,
- const void *data)
-{
- if (data == nullptr)
- {
- return;
- }
-
- Buffer *buffer = mGLState.getTargetBuffer(target);
- ASSERT(buffer);
- handleError(buffer->bufferSubData(this, target, data, size, offset));
-}
-
-void Context::attachShader(GLuint program, GLuint shader)
-{
- Program *programObject = mState.mShaderPrograms->getProgram(program);
- Shader *shaderObject = mState.mShaderPrograms->getShader(shader);
- ASSERT(programObject && shaderObject);
- programObject->attachShader(shaderObject);
-}
-
-const Workarounds &Context::getWorkarounds() const
-{
- return mWorkarounds;
-}
-
-void Context::copyBufferSubData(BufferBinding readTarget,
- BufferBinding writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size)
-{
- // if size is zero, the copy is a successful no-op
- if (size == 0)
- {
- return;
- }
-
- // TODO(jmadill): cache these.
- Buffer *readBuffer = mGLState.getTargetBuffer(readTarget);
- Buffer *writeBuffer = mGLState.getTargetBuffer(writeTarget);
-
- handleError(writeBuffer->copyBufferSubData(this, readBuffer, readOffset, writeOffset, size));
-}
-
-void Context::bindAttribLocation(GLuint program, GLuint index, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- // TODO(jmadill): Re-use this from the validation if possible.
- ASSERT(programObject);
- programObject->bindAttributeLocation(index, name);
-}
-
-void Context::bindBuffer(BufferBinding target, GLuint buffer)
-{
- Buffer *bufferObject = mState.mBuffers->checkBufferAllocation(mImplementation.get(), buffer);
- mGLState.setBufferBinding(this, target, bufferObject);
-}
-
-void Context::bindBufferBase(BufferBinding target, GLuint index, GLuint buffer)
-{
- bindBufferRange(target, index, buffer, 0, 0);
-}
-
-void Context::bindBufferRange(BufferBinding target,
- GLuint index,
- GLuint buffer,
- GLintptr offset,
- GLsizeiptr size)
-{
- Buffer *bufferObject = mState.mBuffers->checkBufferAllocation(mImplementation.get(), buffer);
- mGLState.setIndexedBufferBinding(this, target, index, bufferObject, offset, size);
-}
-
-void Context::bindFramebuffer(GLenum target, GLuint framebuffer)
-{
- if (target == GL_READ_FRAMEBUFFER || target == GL_FRAMEBUFFER)
- {
- bindReadFramebuffer(framebuffer);
- }
-
- if (target == GL_DRAW_FRAMEBUFFER || target == GL_FRAMEBUFFER)
- {
- bindDrawFramebuffer(framebuffer);
- }
-}
-
-void Context::bindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- ASSERT(target == GL_RENDERBUFFER);
- Renderbuffer *object =
- mState.mRenderbuffers->checkRenderbufferAllocation(mImplementation.get(), renderbuffer);
- mGLState.setRenderbufferBinding(this, object);
-}
-
-void Context::texStorage2DMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedsamplelocations)
-{
- Extents size(width, height, 1);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setStorageMultisample(this, target, samples, internalformat, size,
- ConvertToBool(fixedsamplelocations)));
-}
-
-void Context::getMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
-{
- // According to spec 3.1 Table 20.49: Framebuffer Dependent Values,
- // the sample position should be queried by DRAW_FRAMEBUFFER.
- mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER);
- const Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
-
- switch (pname)
- {
- case GL_SAMPLE_POSITION:
- handleError(framebuffer->getSamplePosition(index, val));
- break;
- default:
- UNREACHABLE();
- }
-}
-
-void Context::renderbufferStorage(GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
- GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
-
- Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- handleError(renderbuffer->setStorage(this, convertedInternalFormat, width, height));
-}
-
-void Context::renderbufferStorageMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
- GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
-
- Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- handleError(
- renderbuffer->setStorageMultisample(this, samples, convertedInternalFormat, width, height));
-}
-
-void Context::getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- const Sync *syncObject = getSync(sync);
- handleError(QuerySynciv(syncObject, pname, bufSize, length, values));
-}
-
-void Context::getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- QueryFramebufferParameteriv(framebuffer, pname, params);
-}
-
-void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- SetFramebufferParameteri(framebuffer, pname, param);
-}
-
-Error Context::getScratchBuffer(size_t requstedSizeBytes,
- angle::MemoryBuffer **scratchBufferOut) const
-{
- if (!mScratchBuffer.get(requstedSizeBytes, scratchBufferOut))
- {
- return OutOfMemory() << "Failed to allocate internal buffer.";
- }
- return NoError();
-}
-
-Error Context::getZeroFilledBuffer(size_t requstedSizeBytes,
- angle::MemoryBuffer **zeroBufferOut) const
-{
- if (!mZeroFilledBuffer.getInitialized(requstedSizeBytes, zeroBufferOut, 0))
- {
- return OutOfMemory() << "Failed to allocate internal buffer.";
- }
- return NoError();
-}
-
-void Context::dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ)
-{
- if (numGroupsX == 0u || numGroupsY == 0u || numGroupsZ == 0u)
- {
- return;
- }
-
- // TODO(jmadill): Dirty bits for compute.
- if (isRobustResourceInitEnabled())
- {
- ANGLE_CONTEXT_TRY(mGLState.clearUnclearedActiveTextures(this));
- }
-
- handleError(mImplementation->dispatchCompute(this, numGroupsX, numGroupsY, numGroupsZ));
-}
-
-void Context::dispatchComputeIndirect(GLintptr indirect)
-{
- UNIMPLEMENTED();
-}
-
-void Context::texStorage2D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height)
-{
- Extents size(width, height, 1);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setStorage(this, target, levels, internalFormat, size));
-}
-
-void Context::texStorage3D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height,
- GLsizei depth)
-{
- Extents size(width, height, depth);
- Texture *texture = getTargetTexture(target);
- handleError(texture->setStorage(this, target, levels, internalFormat, size));
-}
-
-void Context::memoryBarrier(GLbitfield barriers)
-{
- UNIMPLEMENTED();
-}
-
-void Context::memoryBarrierByRegion(GLbitfield barriers)
-{
- UNIMPLEMENTED();
-}
-
-GLenum Context::checkFramebufferStatus(GLenum target)
-{
- Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- return framebuffer->checkStatus(this);
-}
-
-void Context::compileShader(GLuint shader)
-{
- Shader *shaderObject = GetValidShader(this, shader);
- if (!shaderObject)
- {
- return;
- }
- shaderObject->compile(this);
-}
-
-void Context::deleteBuffers(GLsizei n, const GLuint *buffers)
-{
- for (int i = 0; i < n; i++)
- {
- deleteBuffer(buffers[i]);
- }
-}
-
-void Context::deleteFramebuffers(GLsizei n, const GLuint *framebuffers)
-{
- for (int i = 0; i < n; i++)
- {
- if (framebuffers[i] != 0)
- {
- deleteFramebuffer(framebuffers[i]);
- }
- }
-}
-
-void Context::deleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
-{
- for (int i = 0; i < n; i++)
- {
- deleteRenderbuffer(renderbuffers[i]);
- }
-}
-
-void Context::deleteTextures(GLsizei n, const GLuint *textures)
-{
- for (int i = 0; i < n; i++)
- {
- if (textures[i] != 0)
- {
- deleteTexture(textures[i]);
- }
- }
-}
-
-void Context::detachShader(GLuint program, GLuint shader)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
-
- Shader *shaderObject = getShader(shader);
- ASSERT(shaderObject);
-
- programObject->detachShader(this, shaderObject);
-}
-
-void Context::genBuffers(GLsizei n, GLuint *buffers)
-{
- for (int i = 0; i < n; i++)
- {
- buffers[i] = createBuffer();
- }
-}
-
-void Context::genFramebuffers(GLsizei n, GLuint *framebuffers)
-{
- for (int i = 0; i < n; i++)
- {
- framebuffers[i] = createFramebuffer();
- }
-}
-
-void Context::genRenderbuffers(GLsizei n, GLuint *renderbuffers)
-{
- for (int i = 0; i < n; i++)
- {
- renderbuffers[i] = createRenderbuffer();
- }
-}
-
-void Context::genTextures(GLsizei n, GLuint *textures)
-{
- for (int i = 0; i < n; i++)
- {
- textures[i] = createTexture();
- }
-}
-
-void Context::getActiveAttrib(GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getActiveAttribute(index, bufsize, length, size, type, name);
-}
-
-void Context::getActiveUniform(GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getActiveUniform(index, bufsize, length, size, type, name);
-}
-
-void Context::getAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getAttachedShaders(maxcount, count, shaders);
-}
-
-GLint Context::getAttribLocation(GLuint program, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- return programObject->getAttributeLocation(name);
-}
-
-void Context::getBooleanv(GLenum pname, GLboolean *params)
-{
- GLenum nativeType;
- unsigned int numParams = 0;
- getQueryParameterInfo(pname, &nativeType, &numParams);
-
- if (nativeType == GL_BOOL)
- {
- getBooleanvImpl(pname, params);
- }
- else
- {
- CastStateValues(this, nativeType, pname, numParams, params);
- }
-}
-
-void Context::getFloatv(GLenum pname, GLfloat *params)
-{
- GLenum nativeType;
- unsigned int numParams = 0;
- getQueryParameterInfo(pname, &nativeType, &numParams);
-
- if (nativeType == GL_FLOAT)
- {
- getFloatvImpl(pname, params);
- }
- else
- {
- CastStateValues(this, nativeType, pname, numParams, params);
- }
-}
-
-void Context::getIntegerv(GLenum pname, GLint *params)
-{
- GLenum nativeType;
- unsigned int numParams = 0;
- getQueryParameterInfo(pname, &nativeType, &numParams);
-
- if (nativeType == GL_INT)
- {
- getIntegervImpl(pname, params);
- }
- else
- {
- CastStateValues(this, nativeType, pname, numParams, params);
- }
-}
-
-void Context::getProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- QueryProgramiv(this, programObject, pname, params);
-}
-
-void Context::getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
-{
- UNIMPLEMENTED();
-}
-
-void Context::getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getInfoLog(bufsize, length, infolog);
-}
-
-void Context::getProgramPipelineInfoLog(GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog)
-{
- UNIMPLEMENTED();
-}
-
-void Context::getShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- Shader *shaderObject = getShader(shader);
- ASSERT(shaderObject);
- QueryShaderiv(this, shaderObject, pname, params);
-}
-
-void Context::getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog)
-{
- Shader *shaderObject = getShader(shader);
- ASSERT(shaderObject);
- shaderObject->getInfoLog(this, bufsize, length, infolog);
-}
-
-void Context::getShaderPrecisionFormat(GLenum shadertype,
- GLenum precisiontype,
- GLint *range,
- GLint *precision)
-{
- // TODO(jmadill): Compute shaders.
-
- switch (shadertype)
- {
- case GL_VERTEX_SHADER:
- switch (precisiontype)
- {
- case GL_LOW_FLOAT:
- mCaps.vertexLowpFloat.get(range, precision);
- break;
- case GL_MEDIUM_FLOAT:
- mCaps.vertexMediumpFloat.get(range, precision);
- break;
- case GL_HIGH_FLOAT:
- mCaps.vertexHighpFloat.get(range, precision);
- break;
-
- case GL_LOW_INT:
- mCaps.vertexLowpInt.get(range, precision);
- break;
- case GL_MEDIUM_INT:
- mCaps.vertexMediumpInt.get(range, precision);
- break;
- case GL_HIGH_INT:
- mCaps.vertexHighpInt.get(range, precision);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
- break;
-
- case GL_FRAGMENT_SHADER:
- switch (precisiontype)
- {
- case GL_LOW_FLOAT:
- mCaps.fragmentLowpFloat.get(range, precision);
- break;
- case GL_MEDIUM_FLOAT:
- mCaps.fragmentMediumpFloat.get(range, precision);
- break;
- case GL_HIGH_FLOAT:
- mCaps.fragmentHighpFloat.get(range, precision);
- break;
-
- case GL_LOW_INT:
- mCaps.fragmentLowpInt.get(range, precision);
- break;
- case GL_MEDIUM_INT:
- mCaps.fragmentMediumpInt.get(range, precision);
- break;
- case GL_HIGH_INT:
- mCaps.fragmentHighpInt.get(range, precision);
- break;
-
- default:
- UNREACHABLE();
- return;
- }
- break;
-
- default:
- UNREACHABLE();
- return;
- }
-}
-
-void Context::getShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source)
-{
- Shader *shaderObject = getShader(shader);
- ASSERT(shaderObject);
- shaderObject->getSource(bufsize, length, source);
-}
-
-void Context::getUniformfv(GLuint program, GLint location, GLfloat *params)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getUniformfv(this, location, params);
-}
-
-void Context::getUniformiv(GLuint program, GLint location, GLint *params)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getUniformiv(this, location, params);
-}
-
-GLint Context::getUniformLocation(GLuint program, const GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- return programObject->getUniformLocation(name);
-}
-
-GLboolean Context::isBuffer(GLuint buffer)
-{
- if (buffer == 0)
- {
- return GL_FALSE;
- }
-
- return (getBuffer(buffer) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isEnabled(GLenum cap)
-{
- return mGLState.getEnableFeature(cap);
-}
-
-GLboolean Context::isFramebuffer(GLuint framebuffer)
-{
- if (framebuffer == 0)
- {
- return GL_FALSE;
- }
-
- return (getFramebuffer(framebuffer) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isProgram(GLuint program)
-{
- if (program == 0)
- {
- return GL_FALSE;
- }
-
- return (getProgram(program) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isRenderbuffer(GLuint renderbuffer)
-{
- if (renderbuffer == 0)
- {
- return GL_FALSE;
- }
-
- return (getRenderbuffer(renderbuffer) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isShader(GLuint shader)
-{
- if (shader == 0)
- {
- return GL_FALSE;
- }
-
- return (getShader(shader) ? GL_TRUE : GL_FALSE);
-}
-
-GLboolean Context::isTexture(GLuint texture)
-{
- if (texture == 0)
- {
- return GL_FALSE;
- }
-
- return (getTexture(texture) ? GL_TRUE : GL_FALSE);
-}
-
-void Context::linkProgram(GLuint program)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- handleError(programObject->link(this));
- mGLState.onProgramExecutableChange(programObject);
-}
-
-void Context::releaseShaderCompiler()
-{
- mCompiler.set(this, nullptr);
-}
-
-void Context::shaderBinary(GLsizei n,
- const GLuint *shaders,
- GLenum binaryformat,
- const void *binary,
- GLsizei length)
-{
- // No binary shader formats are supported.
- UNIMPLEMENTED();
-}
-
-void Context::shaderSource(GLuint shader,
- GLsizei count,
- const GLchar *const *string,
- const GLint *length)
-{
- Shader *shaderObject = getShader(shader);
- ASSERT(shaderObject);
- shaderObject->setSource(count, string, length);
-}
-
-void Context::stencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- stencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
-}
-
-void Context::stencilMask(GLuint mask)
-{
- stencilMaskSeparate(GL_FRONT_AND_BACK, mask);
-}
-
-void Context::stencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- stencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
-}
-
-void Context::uniform1f(GLint location, GLfloat x)
-{
- Program *program = mGLState.getProgram();
- program->setUniform1fv(location, 1, &x);
-}
-
-void Context::uniform1fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform1fv(location, count, v);
-}
-
-void Context::uniform1i(GLint location, GLint x)
-{
- Program *program = mGLState.getProgram();
- if (program->setUniform1iv(location, 1, &x) == Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
-}
-
-void Context::uniform1iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.getProgram();
- if (program->setUniform1iv(location, count, v) == Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
-}
-
-void Context::uniform2f(GLint location, GLfloat x, GLfloat y)
-{
- GLfloat xy[2] = {x, y};
- Program *program = mGLState.getProgram();
- program->setUniform2fv(location, 1, xy);
-}
-
-void Context::uniform2fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform2fv(location, count, v);
-}
-
-void Context::uniform2i(GLint location, GLint x, GLint y)
-{
- GLint xy[2] = {x, y};
- Program *program = mGLState.getProgram();
- program->setUniform2iv(location, 1, xy);
-}
-
-void Context::uniform2iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform2iv(location, count, v);
-}
-
-void Context::uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- GLfloat xyz[3] = {x, y, z};
- Program *program = mGLState.getProgram();
- program->setUniform3fv(location, 1, xyz);
-}
-
-void Context::uniform3fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform3fv(location, count, v);
-}
-
-void Context::uniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- GLint xyz[3] = {x, y, z};
- Program *program = mGLState.getProgram();
- program->setUniform3iv(location, 1, xyz);
-}
-
-void Context::uniform3iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform3iv(location, count, v);
-}
-
-void Context::uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLfloat xyzw[4] = {x, y, z, w};
- Program *program = mGLState.getProgram();
- program->setUniform4fv(location, 1, xyzw);
-}
-
-void Context::uniform4fv(GLint location, GLsizei count, const GLfloat *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform4fv(location, count, v);
-}
-
-void Context::uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- GLint xyzw[4] = {x, y, z, w};
- Program *program = mGLState.getProgram();
- program->setUniform4iv(location, 1, xyzw);
-}
-
-void Context::uniform4iv(GLint location, GLsizei count, const GLint *v)
-{
- Program *program = mGLState.getProgram();
- program->setUniform4iv(location, count, v);
-}
-
-void Context::uniformMatrix2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix2fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix3fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix4fv(location, count, transpose, value);
-}
-
-void Context::validateProgram(GLuint program)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->validate(mCaps);
-}
-
-void Context::validateProgramPipeline(GLuint pipeline)
-{
- UNIMPLEMENTED();
-}
-
-void Context::getProgramBinary(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject != nullptr);
-
- handleError(programObject->saveBinary(this, binaryFormat, binary, bufSize, length));
-}
-
-void Context::programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject != nullptr);
-
- handleError(programObject->loadBinary(this, binaryFormat, binary, length));
-}
-
-void Context::uniform1ui(GLint location, GLuint v0)
-{
- Program *program = mGLState.getProgram();
- program->setUniform1uiv(location, 1, &v0);
-}
-
-void Context::uniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- Program *program = mGLState.getProgram();
- const GLuint xy[] = {v0, v1};
- program->setUniform2uiv(location, 1, xy);
-}
-
-void Context::uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- Program *program = mGLState.getProgram();
- const GLuint xyz[] = {v0, v1, v2};
- program->setUniform3uiv(location, 1, xyz);
-}
-
-void Context::uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- Program *program = mGLState.getProgram();
- const GLuint xyzw[] = {v0, v1, v2, v3};
- program->setUniform4uiv(location, 1, xyzw);
-}
-
-void Context::uniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniform1uiv(location, count, value);
-}
-void Context::uniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniform2uiv(location, count, value);
-}
-
-void Context::uniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniform3uiv(location, count, value);
-}
-
-void Context::uniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniform4uiv(location, count, value);
-}
-
-void Context::genQueries(GLsizei n, GLuint *ids)
-{
- for (GLsizei i = 0; i < n; i++)
- {
- GLuint handle = mQueryHandleAllocator.allocate();
- mQueryMap.assign(handle, nullptr);
- ids[i] = handle;
- }
-}
-
-void Context::deleteQueries(GLsizei n, const GLuint *ids)
-{
- for (int i = 0; i < n; i++)
- {
- GLuint query = ids[i];
-
- Query *queryObject = nullptr;
- if (mQueryMap.erase(query, &queryObject))
- {
- mQueryHandleAllocator.release(query);
- if (queryObject)
- {
- queryObject->release(this);
- }
- }
- }
-}
-
-GLboolean Context::isQuery(GLuint id)
-{
- return (getQuery(id, false, GL_NONE) != nullptr) ? GL_TRUE : GL_FALSE;
-}
-
-void Context::uniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix2x3fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix3x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix3x2fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix2x4fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix4x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix4x2fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix3x4fv(location, count, transpose, value);
-}
-
-void Context::uniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *program = mGLState.getProgram();
- program->setUniformMatrix4x3fv(location, count, transpose, value);
-}
-
-void Context::deleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
- {
- GLuint vertexArray = arrays[arrayIndex];
-
- if (arrays[arrayIndex] != 0)
- {
- VertexArray *vertexArrayObject = nullptr;
- if (mVertexArrayMap.erase(vertexArray, &vertexArrayObject))
- {
- if (vertexArrayObject != nullptr)
- {
- detachVertexArray(vertexArray);
- vertexArrayObject->onDestroy(this);
- }
-
- mVertexArrayHandleAllocator.release(vertexArray);
- }
- }
- }
-}
-
-void Context::genVertexArrays(GLsizei n, GLuint *arrays)
-{
- for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
- {
- GLuint vertexArray = mVertexArrayHandleAllocator.allocate();
- mVertexArrayMap.assign(vertexArray, nullptr);
- arrays[arrayIndex] = vertexArray;
- }
-}
-
-bool Context::isVertexArray(GLuint array)
-{
- if (array == 0)
- {
- return GL_FALSE;
- }
-
- VertexArray *vao = getVertexArray(array);
- return (vao != nullptr ? GL_TRUE : GL_FALSE);
-}
-
-void Context::endTransformFeedback()
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- transformFeedback->end(this);
-}
-
-void Context::transformFeedbackVaryings(GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
-}
-
-void Context::getTransformFeedbackVarying(GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLsizei *size,
- GLenum *type,
- GLchar *name)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
-}
-
-void Context::deleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- for (int i = 0; i < n; i++)
- {
- GLuint transformFeedback = ids[i];
- if (transformFeedback == 0)
- {
- continue;
- }
-
- TransformFeedback *transformFeedbackObject = nullptr;
- if (mTransformFeedbackMap.erase(transformFeedback, &transformFeedbackObject))
- {
- if (transformFeedbackObject != nullptr)
- {
- detachTransformFeedback(transformFeedback);
- transformFeedbackObject->release(this);
- }
-
- mTransformFeedbackHandleAllocator.release(transformFeedback);
- }
- }
-}
-
-void Context::genTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- for (int i = 0; i < n; i++)
- {
- GLuint transformFeedback = mTransformFeedbackHandleAllocator.allocate();
- mTransformFeedbackMap.assign(transformFeedback, nullptr);
- ids[i] = transformFeedback;
- }
-}
-
-bool Context::isTransformFeedback(GLuint id)
-{
- if (id == 0)
- {
- // The 3.0.4 spec [section 6.1.11] states that if ID is zero, IsTransformFeedback
- // returns FALSE
- return GL_FALSE;
- }
-
- const TransformFeedback *transformFeedback = getTransformFeedback(id);
- return ((transformFeedback != nullptr) ? GL_TRUE : GL_FALSE);
-}
-
-void Context::pauseTransformFeedback()
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- transformFeedback->pause();
-}
-
-void Context::resumeTransformFeedback()
-{
- TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
- transformFeedback->resume();
-}
-
-void Context::getUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- const Program *programObject = getProgram(program);
- programObject->getUniformuiv(this, location, params);
-}
-
-GLint Context::getFragDataLocation(GLuint program, const GLchar *name)
-{
- const Program *programObject = getProgram(program);
- return programObject->getFragDataLocation(name);
-}
-
-void Context::getUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices)
-{
- const Program *programObject = getProgram(program);
- if (!programObject->isLinked())
- {
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- uniformIndices[uniformId] = GL_INVALID_INDEX;
- }
- }
- else
- {
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- uniformIndices[uniformId] = programObject->getUniformIndex(uniformNames[uniformId]);
- }
- }
-}
-
-void Context::getActiveUniformsiv(GLuint program,
- GLsizei uniformCount,
- const GLuint *uniformIndices,
- GLenum pname,
- GLint *params)
-{
- const Program *programObject = getProgram(program);
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- const GLuint index = uniformIndices[uniformId];
- params[uniformId] = GetUniformResourceProperty(programObject, index, pname);
- }
-}
-
-GLuint Context::getUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- const Program *programObject = getProgram(program);
- return programObject->getUniformBlockIndex(uniformBlockName);
-}
-
-void Context::getActiveUniformBlockiv(GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params)
-{
- const Program *programObject = getProgram(program);
- QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params);
-}
-
-void Context::getActiveUniformBlockName(GLuint program,
- GLuint uniformBlockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *uniformBlockName)
-{
- const Program *programObject = getProgram(program);
- programObject->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-void Context::uniformBlockBinding(GLuint program,
- GLuint uniformBlockIndex,
- GLuint uniformBlockBinding)
-{
- Program *programObject = getProgram(program);
- programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
-}
-
-GLsync Context::fenceSync(GLenum condition, GLbitfield flags)
-{
- GLuint handle = mState.mSyncs->createSync(mImplementation.get());
- GLsync syncHandle = reinterpret_cast<GLsync>(static_cast<uintptr_t>(handle));
-
- Sync *syncObject = getSync(syncHandle);
- Error error = syncObject->set(condition, flags);
- if (error.isError())
- {
- deleteSync(syncHandle);
- handleError(error);
- return nullptr;
- }
-
- return syncHandle;
-}
-
-GLboolean Context::isSync(GLsync sync)
-{
- return (getSync(sync) != nullptr);
-}
-
-GLenum Context::clientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- Sync *syncObject = getSync(sync);
-
- GLenum result = GL_WAIT_FAILED;
- handleError(syncObject->clientWait(flags, timeout, &result));
- return result;
-}
-
-void Context::waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- Sync *syncObject = getSync(sync);
- handleError(syncObject->serverWait(flags, timeout));
-}
-
-void Context::getInteger64v(GLenum pname, GLint64 *params)
-{
- GLenum nativeType = GL_NONE;
- unsigned int numParams = 0;
- getQueryParameterInfo(pname, &nativeType, &numParams);
-
- if (nativeType == GL_INT_64_ANGLEX)
- {
- getInteger64vImpl(pname, params);
- }
- else
- {
- CastStateValues(this, nativeType, pname, numParams, params);
- }
-}
-
-void Context::getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params)
-{
- Buffer *buffer = mGLState.getTargetBuffer(target);
- QueryBufferParameteri64v(buffer, pname, params);
-}
-
-void Context::genSamplers(GLsizei count, GLuint *samplers)
-{
- for (int i = 0; i < count; i++)
- {
- samplers[i] = mState.mSamplers->createSampler();
- }
-}
-
-void Context::deleteSamplers(GLsizei count, const GLuint *samplers)
-{
- for (int i = 0; i < count; i++)
- {
- GLuint sampler = samplers[i];
-
- if (mState.mSamplers->getSampler(sampler))
- {
- detachSampler(sampler);
- }
-
- mState.mSamplers->deleteObject(this, sampler);
- }
-}
-
-void Context::getInternalformativ(GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params)
-{
- const TextureCaps &formatCaps = mTextureCaps.get(internalformat);
- QueryInternalFormativ(formatCaps, pname, bufSize, params);
-}
-
-void Context::programUniform1i(GLuint program, GLint location, GLint v0)
-{
- programUniform1iv(program, location, 1, &v0);
-}
-
-void Context::programUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
-{
- GLint xy[2] = {v0, v1};
- programUniform2iv(program, location, 1, xy);
-}
-
-void Context::programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
-{
- GLint xyz[3] = {v0, v1, v2};
- programUniform3iv(program, location, 1, xyz);
-}
-
-void Context::programUniform4i(GLuint program,
- GLint location,
- GLint v0,
- GLint v1,
- GLint v2,
- GLint v3)
-{
- GLint xyzw[4] = {v0, v1, v2, v3};
- programUniform4iv(program, location, 1, xyzw);
-}
-
-void Context::programUniform1ui(GLuint program, GLint location, GLuint v0)
-{
- programUniform1uiv(program, location, 1, &v0);
-}
-
-void Context::programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
-{
- GLuint xy[2] = {v0, v1};
- programUniform2uiv(program, location, 1, xy);
-}
-
-void Context::programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- GLuint xyz[3] = {v0, v1, v2};
- programUniform3uiv(program, location, 1, xyz);
-}
-
-void Context::programUniform4ui(GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLuint xyzw[4] = {v0, v1, v2, v3};
- programUniform4uiv(program, location, 1, xyzw);
-}
-
-void Context::programUniform1f(GLuint program, GLint location, GLfloat v0)
-{
- programUniform1fv(program, location, 1, &v0);
-}
-
-void Context::programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
-{
- GLfloat xy[2] = {v0, v1};
- programUniform2fv(program, location, 1, xy);
-}
-
-void Context::programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- GLfloat xyz[3] = {v0, v1, v2};
- programUniform3fv(program, location, 1, xyz);
-}
-
-void Context::programUniform4f(GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2,
- GLfloat v3)
-{
- GLfloat xyzw[4] = {v0, v1, v2, v3};
- programUniform4fv(program, location, 1, xyzw);
-}
-
-void Context::programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- if (programObject->setUniform1iv(location, count, value) ==
- Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
-}
-
-void Context::programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform2iv(location, count, value);
-}
-
-void Context::programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform3iv(location, count, value);
-}
-
-void Context::programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform4iv(location, count, value);
-}
-
-void Context::programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform1uiv(location, count, value);
-}
-
-void Context::programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform2uiv(location, count, value);
-}
-
-void Context::programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform3uiv(location, count, value);
-}
-
-void Context::programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform4uiv(location, count, value);
-}
-
-void Context::programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform1fv(location, count, value);
-}
-
-void Context::programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform2fv(location, count, value);
-}
-
-void Context::programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform3fv(location, count, value);
-}
-
-void Context::programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniform4fv(location, count, value);
-}
-
-void Context::programUniformMatrix2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix2fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix3fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix4fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix2x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix2x3fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix3x2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix3x2fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix2x4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix2x4fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix4x2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix4x2fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix3x4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix3x4fv(location, count, transpose, value);
-}
-
-void Context::programUniformMatrix4x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value)
-{
- Program *programObject = getProgram(program);
- ASSERT(programObject);
- programObject->setUniformMatrix4x3fv(location, count, transpose, value);
-}
-
-void Context::onTextureChange(const Texture *texture)
-{
- // Conservatively assume all textures are dirty.
- // TODO(jmadill): More fine-grained update.
- mGLState.setObjectDirty(GL_TEXTURE);
-}
-
-void Context::genProgramPipelines(GLsizei count, GLuint *pipelines)
-{
- for (int i = 0; i < count; i++)
- {
- pipelines[i] = createProgramPipeline();
- }
-}
-
-void Context::deleteProgramPipelines(GLsizei count, const GLuint *pipelines)
-{
- for (int i = 0; i < count; i++)
- {
- if (pipelines[i] != 0)
- {
- deleteProgramPipeline(pipelines[i]);
- }
- }
-}
-
-GLboolean Context::isProgramPipeline(GLuint pipeline)
-{
- if (pipeline == 0)
- {
- return GL_FALSE;
- }
-
- return (getProgramPipeline(pipeline) ? GL_TRUE : GL_FALSE);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Context.h b/src/3rdparty/angle/src/libANGLE/Context.h
deleted file mode 100644
index 38c4e7b4d1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Context.h
+++ /dev/null
@@ -1,1154 +0,0 @@
-//
-// 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/angleutils.h"
-#include "libANGLE/Caps.h"
-#include "libANGLE/Constants.h"
-#include "libANGLE/ContextState.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/HandleAllocator.h"
-#include "libANGLE/PackedGLEnums.h"
-#include "libANGLE/RefCountObject.h"
-#include "libANGLE/ResourceMap.h"
-#include "libANGLE/VertexAttribute.h"
-#include "libANGLE/Workarounds.h"
-#include "libANGLE/angletypes.h"
-
-namespace rx
-{
-class ContextImpl;
-class EGLImplFactory;
-}
-
-namespace egl
-{
-class AttributeMap;
-class Surface;
-struct Config;
-class Thread;
-}
-
-namespace gl
-{
-class Buffer;
-class Compiler;
-class FenceNV;
-class Sync;
-class Framebuffer;
-class MemoryProgramCache;
-class Program;
-class Query;
-class Renderbuffer;
-class Sampler;
-class Shader;
-class Texture;
-class TransformFeedback;
-class VertexArray;
-struct VertexAttribute;
-class ProgramPipeline;
-
-class Context final : public ValidationContext
-{
- public:
- Context(rx::EGLImplFactory *implFactory,
- const egl::Config *config,
- const Context *shareContext,
- TextureManager *shareTextures,
- MemoryProgramCache *memoryProgramCache,
- const egl::AttributeMap &attribs,
- const egl::DisplayExtensions &displayExtensions);
-
- egl::Error onDestroy(const egl::Display *display);
- ~Context() override;
-
- egl::Error makeCurrent(egl::Display *display, egl::Surface *surface);
- egl::Error releaseSurface(const egl::Display *display);
-
- // These create and destroy methods are merely pass-throughs to
- // ResourceManager, which owns these object types
- GLuint createBuffer();
- GLuint createShader(GLenum type);
- GLuint createProgram();
- GLuint createTexture();
- GLuint createRenderbuffer();
- GLuint createPaths(GLsizei range);
- GLuint createProgramPipeline();
- GLuint createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings);
-
- void deleteBuffer(GLuint buffer);
- void deleteShader(GLuint shader);
- void deleteProgram(GLuint program);
- void deleteTexture(GLuint texture);
- void deleteRenderbuffer(GLuint renderbuffer);
- void deletePaths(GLuint first, GLsizei range);
- void deleteProgramPipeline(GLuint pipeline);
-
- // CHROMIUM_path_rendering
- bool hasPathData(GLuint path) const;
- bool hasPath(GLuint path) const;
- void setPathCommands(GLuint path,
- GLsizei numCommands,
- const GLubyte *commands,
- GLsizei numCoords,
- GLenum coordType,
- const void *coords);
- void setPathParameterf(GLuint path, GLenum pname, GLfloat value);
- void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const;
- void setPathStencilFunc(GLenum func, GLint ref, GLuint mask);
-
- // Framebuffers are owned by the Context, so these methods do not pass through
- GLuint createFramebuffer();
- void deleteFramebuffer(GLuint framebuffer);
-
- // NV Fences are owned by the Context.
- GLuint createFenceNV();
- void deleteFenceNV(GLuint fence);
-
- void bindTexture(GLenum target, GLuint handle);
- void bindReadFramebuffer(GLuint framebufferHandle);
- void bindDrawFramebuffer(GLuint framebufferHandle);
- void bindVertexArray(GLuint vertexArrayHandle);
- void bindVertexBuffer(GLuint bindingIndex,
- GLuint bufferHandle,
- GLintptr offset,
- GLsizei stride);
- void bindSampler(GLuint textureUnit, GLuint samplerHandle);
- void bindImageTexture(GLuint unit,
- GLuint texture,
- GLint level,
- GLboolean layered,
- GLint layer,
- GLenum access,
- GLenum format);
- void useProgram(GLuint program);
- void useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
- void bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle);
- void bindProgramPipeline(GLuint pipelineHandle);
-
- void beginQuery(GLenum target, GLuint query);
- void endQuery(GLenum target);
- void queryCounter(GLuint id, GLenum target);
- void getQueryiv(GLenum target, GLenum pname, GLint *params);
- void getQueryObjectiv(GLuint id, GLenum pname, GLint *params);
- void getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- void getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
- void getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
-
- void vertexAttribDivisor(GLuint index, GLuint divisor);
- void vertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
-
- void getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params);
- void getFramebufferAttachmentParameteriv(GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params);
- void getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
-
- void getTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
- void getTexParameteriv(GLenum target, GLenum pname, GLint *params);
- void getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
- void getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void texParameterf(GLenum target, GLenum pname, GLfloat param);
- void texParameterfv(GLenum target, GLenum pname, const GLfloat *params);
- void texParameteri(GLenum target, GLenum pname, GLint param);
- void texParameteriv(GLenum target, GLenum pname, const GLint *params);
-
- void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
-
- void getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
-
- void programParameteri(GLuint program, GLenum pname, GLint value);
-
- GLuint getProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);
- void getProgramResourceName(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *name);
- GLint getProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
- void getProgramResourceiv(GLuint program,
- GLenum programInterface,
- GLuint index,
- GLsizei propCount,
- const GLenum *props,
- GLsizei bufSize,
- GLsizei *length,
- GLint *params);
-
- void getProgramInterfaceiv(GLuint program,
- GLenum programInterface,
- GLenum pname,
- GLint *params);
-
- Buffer *getBuffer(GLuint handle) const;
- FenceNV *getFenceNV(GLuint handle);
- Sync *getSync(GLsync handle) const;
- Texture *getTexture(GLuint handle) const;
- 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, GLenum type);
- Query *getQuery(GLuint handle) const;
- TransformFeedback *getTransformFeedback(GLuint handle) const;
- ProgramPipeline *getProgramPipeline(GLuint handle) const;
-
- void objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
- void objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
- void getObjectLabel(GLenum identifier,
- GLuint name,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *label) const;
- void getObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label) const;
-
- Texture *getTargetTexture(GLenum target) const;
- Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
-
- Compiler *getCompiler() const;
-
- bool isSampler(GLuint samplerName) const;
-
- bool isVertexArrayGenerated(GLuint vertexArray);
- bool isTransformFeedbackGenerated(GLuint vertexArray);
-
- void getBooleanv(GLenum pname, GLboolean *params);
- void getBooleanvImpl(GLenum pname, GLboolean *params);
- void getFloatv(GLenum pname, GLfloat *params);
- void getFloatvImpl(GLenum pname, GLfloat *params);
- void getIntegerv(GLenum pname, GLint *params);
- void getIntegervImpl(GLenum pname, GLint *params);
- void getInteger64vImpl(GLenum pname, GLint64 *params);
- void getPointerv(GLenum pname, void **params) const;
- void getBooleani_v(GLenum target, GLuint index, GLboolean *data);
- void getIntegeri_v(GLenum target, GLuint index, GLint *data);
- void getInteger64i_v(GLenum target, GLuint index, GLint64 *data);
-
- void activeShaderProgram(GLuint pipeline, GLuint program);
- void activeTexture(GLenum texture);
- void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void blendEquation(GLenum mode);
- void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
- void blendFunc(GLenum sfactor, GLenum dfactor);
- void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void clearDepthf(GLfloat depth);
- void clearStencil(GLint s);
- void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void cullFace(CullFaceMode mode);
- void depthFunc(GLenum func);
- void depthMask(GLboolean flag);
- void depthRangef(GLfloat zNear, GLfloat zFar);
- void disable(GLenum cap);
- void disableVertexAttribArray(GLuint index);
- void enable(GLenum cap);
- void enableVertexAttribArray(GLuint index);
- void frontFace(GLenum mode);
- void hint(GLenum target, GLenum mode);
- void lineWidth(GLfloat width);
- void pixelStorei(GLenum pname, GLint param);
- void polygonOffset(GLfloat factor, GLfloat units);
- void sampleCoverage(GLfloat value, GLboolean invert);
- void sampleMaski(GLuint maskNumber, GLbitfield mask);
- void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void stencilMaskSeparate(GLenum face, GLuint mask);
- void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- void vertexAttrib1f(GLuint index, GLfloat x);
- void vertexAttrib1fv(GLuint index, const GLfloat *values);
- void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void vertexAttrib2fv(GLuint index, const GLfloat *values);
- void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void vertexAttrib3fv(GLuint index, const GLfloat *values);
- void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void vertexAttrib4fv(GLuint index, const GLfloat *values);
- void vertexAttribFormat(GLuint attribIndex,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLuint relativeOffset);
- void vertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type, GLuint relativeOffset);
- void vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex);
- void vertexAttribPointer(GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const void *ptr);
- void vertexAttribIPointer(GLuint index,
- GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer);
- void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
-
- void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void vertexAttribI4iv(GLuint index, const GLint *v);
- void vertexAttribI4uiv(GLuint index, const GLuint *v);
- void getVertexAttribiv(GLuint index, GLenum pname, GLint *params);
- void getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void getVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);
-
- void debugMessageControl(GLenum source,
- GLenum type,
- GLenum severity,
- GLsizei count,
- const GLuint *ids,
- GLboolean enabled);
- void debugMessageInsert(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- GLsizei length,
- const GLchar *buf);
- void debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam);
- GLuint getDebugMessageLog(GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog);
- void pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);
- void popDebugGroup();
-
- void clear(GLbitfield mask);
- void clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values);
- void clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values);
- void clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values);
- void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-
- void drawArrays(GLenum mode, GLint first, GLsizei count);
- void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
-
- void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
- void drawElementsInstanced(GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices,
- GLsizei instances);
- void drawRangeElements(GLenum mode,
- GLuint start,
- GLuint end,
- GLsizei count,
- GLenum type,
- const void *indices);
- void drawArraysIndirect(GLenum mode, const void *indirect);
- void drawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
-
- void blitFramebuffer(GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter);
-
- void readPixels(GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- void *pixels);
-
- void copyTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border);
-
- void copyTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-
- void copyTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-
- void framebufferTexture2D(GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level);
-
- void framebufferRenderbuffer(GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer);
-
- void framebufferTextureLayer(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint layer);
- void framebufferTextureMultiviewLayeredANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLint baseViewIndex,
- GLsizei numViews);
- void framebufferTextureMultiviewSideBySideANGLE(GLenum target,
- GLenum attachment,
- GLuint texture,
- GLint level,
- GLsizei numViews,
- const GLint *viewportOffsets);
-
- void drawBuffers(GLsizei n, const GLenum *bufs);
- void readBuffer(GLenum mode);
-
- void discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void invalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void invalidateSubFramebuffer(GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height);
-
- void texImage2D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
- void texImage3D(GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels);
- void texSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const void *pixels);
- void texSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const void *pixels);
- void compressedTexImage2D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- const void *data);
- void compressedTexImage3D(GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLsizei imageSize,
- const void *data);
- void compressedTexSubImage2D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- const void *data);
- void compressedTexSubImage3D(GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLsizei imageSize,
- const void *data);
- void copyTextureCHROMIUM(GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint internalFormat,
- GLenum destType,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha);
- void copySubTextureCHROMIUM(GLuint sourceId,
- GLint sourceLevel,
- GLenum destTarget,
- GLuint destId,
- GLint destLevel,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLboolean unpackFlipY,
- GLboolean unpackPremultiplyAlpha,
- GLboolean unpackUnmultiplyAlpha);
- void compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
-
- void generateMipmap(GLenum target);
-
- void flush();
- void finish();
-
- void getBufferPointerv(BufferBinding target, GLenum pname, void **params);
- void *mapBuffer(BufferBinding target, GLenum access);
- GLboolean unmapBuffer(BufferBinding target);
- void *mapBufferRange(BufferBinding target,
- GLintptr offset,
- GLsizeiptr length,
- GLbitfield access);
- void flushMappedBufferRange(BufferBinding target, GLintptr offset, GLsizeiptr length);
-
- void beginTransformFeedback(GLenum primitiveMode);
-
- bool hasActiveTransformFeedback(GLuint program) const;
-
- void insertEventMarker(GLsizei length, const char *marker);
- void pushGroupMarker(GLsizei length, const char *marker);
- void popGroupMarker();
-
- void bindUniformLocation(GLuint program, GLint location, const GLchar *name);
- void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void renderbufferStorageMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height);
-
- void getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-
- // CHROMIUM_framebuffer_mixed_samples
- void setCoverageModulation(GLenum components);
-
- // CHROMIUM_path_rendering
- void loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix);
- void loadPathRenderingIdentityMatrix(GLenum matrixMode);
- void stencilFillPath(GLuint path, GLenum fillMode, GLuint mask);
- void stencilStrokePath(GLuint path, GLint reference, GLuint mask);
- void coverFillPath(GLuint path, GLenum coverMode);
- void coverStrokePath(GLuint path, GLenum coverMode);
- void stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
- void stencilThenCoverStrokePath(GLuint path, GLint reference, GLuint mask, GLenum coverMode);
- void coverFillPathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
- void coverStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
- void stencilFillPathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBAse,
- GLenum fillMode,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues);
- void stencilStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum transformType,
- const GLfloat *transformValues);
- void stencilThenCoverFillPathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLenum fillMode,
- GLuint mask,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
- void stencilThenCoverStrokePathInstanced(GLsizei numPaths,
- GLenum pathNameType,
- const void *paths,
- GLuint pathBase,
- GLint reference,
- GLuint mask,
- GLenum coverMode,
- GLenum transformType,
- const GLfloat *transformValues);
- void bindFragmentInputLocation(GLuint program, GLint location, const GLchar *name);
- void programPathFragmentInputGen(GLuint program,
- GLint location,
- GLenum genMode,
- GLint components,
- const GLfloat *coeffs);
-
- void bufferData(BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage);
- void bufferSubData(BufferBinding target, GLintptr offset, GLsizeiptr size, const void *data);
- void attachShader(GLuint program, GLuint shader);
- void bindAttribLocation(GLuint program, GLuint index, const GLchar *name);
- void bindBuffer(BufferBinding target, GLuint buffer);
- void bindBufferBase(BufferBinding target, GLuint index, GLuint buffer);
- void bindBufferRange(BufferBinding target,
- GLuint index,
- GLuint buffer,
- GLintptr offset,
- GLsizeiptr size);
- void bindFramebuffer(GLenum target, GLuint framebuffer);
- void bindRenderbuffer(GLenum target, GLuint renderbuffer);
-
- void texStorage2DMultisample(GLenum target,
- GLsizei samples,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLboolean fixedsamplelocations);
-
- void getMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
-
- void copyBufferSubData(BufferBinding readTarget,
- BufferBinding writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size);
-
- GLenum checkFramebufferStatus(GLenum target);
- void compileShader(GLuint shader);
- void deleteBuffers(GLsizei n, const GLuint *buffers);
- void deleteFramebuffers(GLsizei n, const GLuint *framebuffers);
- void deleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
- void deleteTextures(GLsizei n, const GLuint *textures);
- void detachShader(GLuint program, GLuint shader);
- void genBuffers(GLsizei n, GLuint *buffers);
- void genFramebuffers(GLsizei n, GLuint *framebuffers);
- void genRenderbuffers(GLsizei n, GLuint *renderbuffers);
- void genTextures(GLsizei n, GLuint *textures);
- void getActiveAttrib(GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name);
- void getActiveUniform(GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei *length,
- GLint *size,
- GLenum *type,
- GLchar *name);
- void getAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders);
- GLint getAttribLocation(GLuint program, const GLchar *name);
- void getProgramiv(GLuint program, GLenum pname, GLint *params);
- void getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
- void getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog);
- void getProgramPipelineInfoLog(GLuint pipeline,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *infoLog);
- void getShaderiv(GLuint shader, GLenum pname, GLint *params);
- void getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog);
- void getShaderPrecisionFormat(GLenum shadertype,
- GLenum precisiontype,
- GLint *range,
- GLint *precision);
- void getShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
- void getUniformfv(GLuint program, GLint location, GLfloat *params);
- void getUniformiv(GLuint program, GLint location, GLint *params);
- GLint getUniformLocation(GLuint program, const GLchar *name);
- GLboolean isBuffer(GLuint buffer);
- GLboolean isEnabled(GLenum cap);
- GLboolean isFramebuffer(GLuint framebuffer);
- GLboolean isProgram(GLuint program);
- GLboolean isRenderbuffer(GLuint renderbuffer);
- GLboolean isShader(GLuint shader);
- GLboolean isTexture(GLuint texture);
- void linkProgram(GLuint program);
- void releaseShaderCompiler();
- void shaderBinary(GLsizei n,
- const GLuint *shaders,
- GLenum binaryformat,
- const void *binary,
- GLsizei length);
- void shaderSource(GLuint shader,
- GLsizei count,
- const GLchar *const *string,
- const GLint *length);
- void stencilFunc(GLenum func, GLint ref, GLuint mask);
- void stencilMask(GLuint mask);
- void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void uniform1f(GLint location, GLfloat x);
- void uniform1fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform1i(GLint location, GLint x);
- void uniform1iv(GLint location, GLsizei count, const GLint *v);
- void uniform2f(GLint location, GLfloat x, GLfloat y);
- void uniform2fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform2i(GLint location, GLint x, GLint y);
- void uniform2iv(GLint location, GLsizei count, const GLint *v);
- void uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void uniform3fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform3i(GLint location, GLint x, GLint y, GLint z);
- void uniform3iv(GLint location, GLsizei count, const GLint *v);
- void uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void uniform4fv(GLint location, GLsizei count, const GLfloat *v);
- void uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
- void uniform4iv(GLint location, GLsizei count, const GLint *v);
- void uniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void uniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void validateProgram(GLuint program);
- void validateProgramPipeline(GLuint pipeline);
-
- void genQueries(GLsizei n, GLuint *ids);
- void deleteQueries(GLsizei n, const GLuint *ids);
- GLboolean isQuery(GLuint id);
-
- void uniform1ui(GLint location, GLuint v0);
- void uniform2ui(GLint location, GLuint v0, GLuint v1);
- void uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void uniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void uniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void uniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void uniform4uiv(GLint location, GLsizei count, const GLuint *value);
-
- void uniformMatrix2x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix3x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix2x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix4x2fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix3x4fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
- void uniformMatrix4x3fv(GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void deleteVertexArrays(GLsizei n, const GLuint *arrays);
- void genVertexArrays(GLsizei n, GLuint *arrays);
- bool isVertexArray(GLuint array);
-
- void endTransformFeedback();
- void transformFeedbackVaryings(GLuint program,
- GLsizei count,
- const GLchar *const *varyings,
- GLenum bufferMode);
- void getTransformFeedbackVarying(GLuint program,
- GLuint index,
- GLsizei bufSize,
- GLsizei *length,
- GLsizei *size,
- GLenum *type,
- GLchar *name);
-
- void deleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void genTransformFeedbacks(GLsizei n, GLuint *ids);
- bool isTransformFeedback(GLuint id);
- void pauseTransformFeedback();
- void resumeTransformFeedback();
-
- void getProgramBinary(GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- GLenum *binaryFormat,
- void *binary);
- void programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-
- void getUniformuiv(GLuint program, GLint location, GLuint *params);
- GLint getFragDataLocation(GLuint program, const GLchar *name);
- void getUniformIndices(GLuint program,
- GLsizei uniformCount,
- const GLchar *const *uniformNames,
- GLuint *uniformIndices);
- void getActiveUniformsiv(GLuint program,
- GLsizei uniformCount,
- const GLuint *uniformIndices,
- GLenum pname,
- GLint *params);
- GLuint getUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void getActiveUniformBlockiv(GLuint program,
- GLuint uniformBlockIndex,
- GLenum pname,
- GLint *params);
- void getActiveUniformBlockName(GLuint program,
- GLuint uniformBlockIndex,
- GLsizei bufSize,
- GLsizei *length,
- GLchar *uniformBlockName);
- void uniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-
- GLsync fenceSync(GLenum condition, GLbitfield flags);
- GLboolean isSync(GLsync sync);
- void deleteSync(GLsync sync);
- GLenum clientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void getInteger64v(GLenum pname, GLint64 *params);
-
- void getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params);
- void genSamplers(GLsizei count, GLuint *samplers);
- void deleteSamplers(GLsizei count, const GLuint *samplers);
- void getInternalformativ(GLenum target,
- GLenum internalformat,
- GLenum pname,
- GLsizei bufSize,
- GLint *params);
-
- void programUniform1i(GLuint program, GLint location, GLint v0);
- void programUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
- void programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
- void programUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
- void programUniform1ui(GLuint program, GLint location, GLuint v0);
- void programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
- void programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
- void programUniform4ui(GLuint program,
- GLint location,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3);
- void programUniform1f(GLuint program, GLint location, GLfloat v0);
- void programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
- void programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
- void programUniform4f(GLuint program,
- GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2,
- GLfloat v3);
- void programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
- void programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
- void programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
- void programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
-
- void programUniformMatrix2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix2x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix3x2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix2x4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix4x2fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix3x4fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void programUniformMatrix4x3fv(GLuint program,
- GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value);
-
- void deleteProgramPipelines(GLsizei n, const GLuint *pipelines);
- void genProgramPipelines(GLsizei n, GLuint *pipelines);
- GLboolean isProgramPipeline(GLuint pipeline);
-
- // Consumes the error.
- void handleError(const Error &error) override;
-
- GLenum getError();
- void markContextLost();
- bool isContextLost();
- GLenum getResetStatus();
- 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);
- void requestExtension(const char *name);
- size_t getRequestableExtensionStringCount() const;
-
- rx::ContextImpl *getImplementation() const { return mImplementation.get(); }
- const Workarounds &getWorkarounds() const;
-
- void getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
- void framebufferParameteri(GLenum target, GLenum pname, GLint param);
-
- Error getScratchBuffer(size_t requestedSizeBytes, angle::MemoryBuffer **scratchBufferOut) const;
- Error getZeroFilledBuffer(size_t requstedSizeBytes, angle::MemoryBuffer **zeroBufferOut) const;
-
- void dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ);
- void dispatchComputeIndirect(GLintptr indirect);
-
- MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
-
- template <EntryPoint EP, typename... ParamsT>
- void gatherParams(ParamsT &&... params);
-
- void texStorage2D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height);
- void texStorage3D(GLenum target,
- GLsizei levels,
- GLenum internalFormat,
- GLsizei width,
- GLsizei height,
- GLsizei depth);
-
- void memoryBarrier(GLbitfield barriers);
- void memoryBarrierByRegion(GLbitfield barriers);
-
- // Notification for a state change in a Texture.
- void onTextureChange(const Texture *texture);
-
- egl::Display *getCurrentDisplay() const { return mCurrentDisplay; }
- egl::Surface *getCurrentDrawSurface() const { return mCurrentSurface; }
- egl::Surface *getCurrentReadSurface() const { return mCurrentSurface; }
-
- bool isRobustResourceInitEnabled() const { return mGLState.isRobustResourceInitEnabled(); }
-
- private:
- Error prepareForDraw();
- void syncRendererState();
- void syncRendererState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask);
- void syncStateForReadPixels();
- void syncStateForTexImage();
- void syncStateForClear();
- void syncStateForBlit();
- VertexArray *checkVertexArrayAllocation(GLuint vertexArrayHandle);
- TransformFeedback *checkTransformFeedbackAllocation(GLuint transformFeedback);
-
- void detachBuffer(GLuint 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);
-
- void initRendererString();
- void initVersionStrings();
- void initExtensionStrings();
-
- void initCaps(const egl::DisplayExtensions &displayExtensions, bool robustResourceInit);
- void updateCaps();
- void initWorkarounds();
-
- LabeledObject *getLabeledObject(GLenum identifier, GLuint name) const;
- LabeledObject *getLabeledObjectFromPtr(const void *ptr) const;
-
- std::unique_ptr<rx::ContextImpl> mImplementation;
-
- // Caps to use for validation
- Caps mCaps;
- TextureCapsMap mTextureCaps;
- Extensions mExtensions;
- Limitations mLimitations;
-
- // Shader compiler. Lazily initialized hence the mutable value.
- mutable BindingPointer<Compiler> mCompiler;
-
- State mGLState;
-
- const egl::Config *mConfig;
- EGLenum mClientType;
-
- 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;
-
- // Recorded errors
- typedef std::set<GLenum> ErrorSet;
- ErrorSet mErrors;
-
- // Current/lost context flags
- bool mHasBeenCurrent;
- bool mContextLost;
- GLenum mResetStatus;
- bool mContextLostForced;
- GLenum mResetStrategy;
- bool mRobustAccess;
- egl::Surface *mCurrentSurface;
- egl::Display *mCurrentDisplay;
- Framebuffer *mSurfacelessFramebuffer;
- bool mWebGLContext;
- MemoryProgramCache *mMemoryProgramCache;
-
- State::DirtyBits mTexImageDirtyBits;
- State::DirtyObjects mTexImageDirtyObjects;
- State::DirtyBits mReadPixelsDirtyBits;
- State::DirtyObjects mReadPixelsDirtyObjects;
- State::DirtyBits mClearDirtyBits;
- State::DirtyObjects mClearDirtyObjects;
- State::DirtyBits mBlitDirtyBits;
- State::DirtyObjects mBlitDirtyObjects;
-
- Workarounds mWorkarounds;
-
- // Not really a property of context state. The size and contexts change per-api-call.
- mutable angle::ScratchBuffer mScratchBuffer;
- mutable angle::ScratchBuffer mZeroFilledBuffer;
-};
-
-template <EntryPoint EP, typename... ArgsT>
-ANGLE_INLINE void Context::gatherParams(ArgsT &&... args)
-{
- static_assert(sizeof(EntryPointParamType<EP>) <= kParamsBufferSize,
- "Params struct too large, please increase kParamsBufferSize.");
-
- mSavedArgsType = &EntryPointParamType<EP>::TypeInfo;
-
- // Skip doing any work for ParamsBase/Invalid type.
- if (!EntryPointParamType<EP>::TypeInfo.isValid())
- {
- return;
- }
-
- EntryPointParamType<EP> *objBuffer =
- reinterpret_cast<EntryPointParamType<EP> *>(mParamsBuffer.data());
- EntryPointParamType<EP>::template Factory<EP>(objBuffer, this, std::forward<ArgsT>(args)...);
-}
-
-} // namespace gl
-
-#endif // LIBANGLE_CONTEXT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/ContextState.cpp b/src/3rdparty/angle/src/libANGLE/ContextState.cpp
deleted file mode 100644
index d109cca76d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ContextState.cpp
+++ /dev/null
@@ -1,839 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-// Data.cpp: Container class for all GL relevant state, caps and objects
-
-#include "libANGLE/ContextState.h"
-
-#include "libANGLE/Framebuffer.h"
-#include "libANGLE/ResourceManager.h"
-
-namespace gl
-{
-
-namespace
-{
-
-template <typename T>
-using ContextStateMember = T *(ContextState::*);
-
-template <typename T>
-T *AllocateOrGetSharedResourceManager(const ContextState *shareContextState,
- ContextStateMember<T> member)
-{
- if (shareContextState)
- {
- T *resourceManager = (*shareContextState).*member;
- resourceManager->addRef();
- return resourceManager;
- }
- else
- {
- return new T();
- }
-}
-
-TextureManager *AllocateOrGetSharedTextureManager(const ContextState *shareContextState,
- TextureManager *shareTextures,
- ContextStateMember<TextureManager> member)
-{
- if (shareContextState)
- {
- TextureManager *textureManager = (*shareContextState).*member;
- ASSERT(shareTextures == nullptr || textureManager == shareTextures);
- textureManager->addRef();
- return textureManager;
- }
- else if (shareTextures)
- {
- TextureManager *textureManager = shareTextures;
- textureManager->addRef();
- return textureManager;
- }
- else
- {
- return new TextureManager();
- }
-}
-
-} // anonymous namespace
-
-ContextState::ContextState(ContextID contextIn,
- const ContextState *shareContextState,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *stateIn,
- const Caps &capsIn,
- const TextureCapsMap &textureCapsIn,
- const Extensions &extensionsIn,
- const Limitations &limitationsIn)
- : mClientVersion(clientVersion),
- mContext(contextIn),
- mState(stateIn),
- mCaps(capsIn),
- mTextureCaps(textureCapsIn),
- mExtensions(extensionsIn),
- mLimitations(limitationsIn),
- mBuffers(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mBuffers)),
- mShaderPrograms(
- AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mShaderPrograms)),
- mTextures(AllocateOrGetSharedTextureManager(shareContextState,
- shareTextures,
- &ContextState::mTextures)),
- mRenderbuffers(
- AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mRenderbuffers)),
- mSamplers(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSamplers)),
- mSyncs(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSyncs)),
- mPaths(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mPaths)),
- mFramebuffers(new FramebufferManager()),
- mPipelines(new ProgramPipelineManager())
-{
-}
-
-ContextState::~ContextState()
-{
- // Handles are released by the Context.
-}
-
-bool ContextState::isWebGL() const
-{
- return mExtensions.webglCompatibility;
-}
-
-bool ContextState::isWebGL1() const
-{
- return (isWebGL() && mClientVersion.major == 2);
-}
-
-const TextureCaps &ContextState::getTextureCap(GLenum internalFormat) const
-{
- return mTextureCaps.get(internalFormat);
-}
-
-ValidationContext::ValidationContext(const ValidationContext *shareContext,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *state,
- const Caps &caps,
- const TextureCapsMap &textureCaps,
- const Extensions &extensions,
- const Limitations &limitations,
- bool skipValidation)
- : mState(reinterpret_cast<ContextID>(this),
- shareContext ? &shareContext->mState : nullptr,
- shareTextures,
- clientVersion,
- state,
- caps,
- textureCaps,
- extensions,
- limitations),
- mSkipValidation(skipValidation),
- mDisplayTextureShareGroup(shareTextures != nullptr)
-{
-}
-
-ValidationContext::~ValidationContext()
-{
-}
-
-bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
-{
- // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
- // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
- // to the fact that it is stored internally as a float, and so would require conversion
- // if returned from Context::getIntegerv. Since this conversion is already implemented
- // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we
- // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling
- // application.
- switch (pname)
- {
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- *type = GL_INT;
- *numParams = static_cast<unsigned int>(getCaps().compressedTextureFormats.size());
- return true;
- }
- case GL_SHADER_BINARY_FORMATS:
- {
- *type = GL_INT;
- *numParams = static_cast<unsigned int>(getCaps().shaderBinaryFormats.size());
- return true;
- }
-
- case GL_MAX_VERTEX_ATTRIBS:
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- case GL_MAX_VARYING_VECTORS:
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- case GL_MAX_RENDERBUFFER_SIZE:
- case GL_NUM_SHADER_BINARY_FORMATS:
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- case GL_ARRAY_BUFFER_BINDING:
- case GL_FRAMEBUFFER_BINDING:
- case GL_RENDERBUFFER_BINDING:
- case GL_CURRENT_PROGRAM:
- case GL_PACK_ALIGNMENT:
- case GL_UNPACK_ALIGNMENT:
- case GL_GENERATE_MIPMAP_HINT:
- case GL_RED_BITS:
- case GL_GREEN_BITS:
- case GL_BLUE_BITS:
- case GL_ALPHA_BITS:
- case GL_DEPTH_BITS:
- case GL_STENCIL_BITS:
- case GL_ELEMENT_ARRAY_BUFFER_BINDING:
- case GL_CULL_FACE_MODE:
- case GL_FRONT_FACE:
- case GL_ACTIVE_TEXTURE:
- case GL_STENCIL_FUNC:
- case GL_STENCIL_VALUE_MASK:
- case GL_STENCIL_REF:
- case GL_STENCIL_FAIL:
- case GL_STENCIL_PASS_DEPTH_FAIL:
- case GL_STENCIL_PASS_DEPTH_PASS:
- case GL_STENCIL_BACK_FUNC:
- case GL_STENCIL_BACK_VALUE_MASK:
- case GL_STENCIL_BACK_REF:
- case GL_STENCIL_BACK_FAIL:
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
- case GL_STENCIL_BACK_PASS_DEPTH_PASS:
- case GL_DEPTH_FUNC:
- case GL_BLEND_SRC_RGB:
- case GL_BLEND_SRC_ALPHA:
- case GL_BLEND_DST_RGB:
- case GL_BLEND_DST_ALPHA:
- case GL_BLEND_EQUATION_RGB:
- case GL_BLEND_EQUATION_ALPHA:
- case GL_STENCIL_WRITEMASK:
- case GL_STENCIL_BACK_WRITEMASK:
- case GL_STENCIL_CLEAR_VALUE:
- case GL_SUBPIXEL_BITS:
- case GL_MAX_TEXTURE_SIZE:
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
- case GL_SAMPLE_BUFFERS:
- case GL_SAMPLES:
- case GL_IMPLEMENTATION_COLOR_READ_TYPE:
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_CUBE_MAP:
- case GL_RESET_NOTIFICATION_STRATEGY_EXT:
- {
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
- {
- if (!getExtensions().packReverseRowOrder)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE:
- case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
- {
- if (!getExtensions().textureRectangle)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- case GL_MAX_DRAW_BUFFERS_EXT:
- case GL_MAX_COLOR_ATTACHMENTS_EXT:
- {
- if ((getClientMajorVersion() < 3) && !getExtensions().drawBuffers)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- case GL_MAX_VIEWPORT_DIMS:
- {
- *type = GL_INT;
- *numParams = 2;
- return true;
- }
- case GL_VIEWPORT:
- case GL_SCISSOR_BOX:
- {
- *type = GL_INT;
- *numParams = 4;
- return true;
- }
- case GL_SHADER_COMPILER:
- case GL_SAMPLE_COVERAGE_INVERT:
- case GL_DEPTH_WRITEMASK:
- case GL_CULL_FACE: // CULL_FACE through DITHER are natural to IsEnabled,
- case GL_POLYGON_OFFSET_FILL: // but can be retrieved through the Get{Type}v queries.
- case GL_SAMPLE_ALPHA_TO_COVERAGE: // For this purpose, they are treated here as
- // bool-natural
- case GL_SAMPLE_COVERAGE:
- case GL_SCISSOR_TEST:
- case GL_STENCIL_TEST:
- case GL_DEPTH_TEST:
- case GL_BLEND:
- case GL_DITHER:
- case GL_CONTEXT_ROBUST_ACCESS_EXT:
- {
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
- case GL_COLOR_WRITEMASK:
- {
- *type = GL_BOOL;
- *numParams = 4;
- return true;
- }
- case GL_POLYGON_OFFSET_FACTOR:
- case GL_POLYGON_OFFSET_UNITS:
- case GL_SAMPLE_COVERAGE_VALUE:
- case GL_DEPTH_CLEAR_VALUE:
- case GL_LINE_WIDTH:
- {
- *type = GL_FLOAT;
- *numParams = 1;
- return true;
- }
- case GL_ALIASED_LINE_WIDTH_RANGE:
- case GL_ALIASED_POINT_SIZE_RANGE:
- case GL_DEPTH_RANGE:
- {
- *type = GL_FLOAT;
- *numParams = 2;
- return true;
- }
- case GL_COLOR_CLEAR_VALUE:
- case GL_BLEND_COLOR:
- {
- *type = GL_FLOAT;
- *numParams = 4;
- return true;
- }
- case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!getExtensions().textureFilterAnisotropic)
- {
- return false;
- }
- *type = GL_FLOAT;
- *numParams = 1;
- return true;
- case GL_TIMESTAMP_EXT:
- if (!getExtensions().disjointTimerQuery)
- {
- return false;
- }
- *type = GL_INT_64_ANGLEX;
- *numParams = 1;
- return true;
- case GL_GPU_DISJOINT_EXT:
- if (!getExtensions().disjointTimerQuery)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_COVERAGE_MODULATION_CHROMIUM:
- if (!getExtensions().framebufferMixedSamples)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- if (!getExtensions().eglStreamConsumerExternal && !getExtensions().eglImageExternal)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
-
- if (getExtensions().debug)
- {
- switch (pname)
- {
- case GL_DEBUG_LOGGED_MESSAGES:
- case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH:
- case GL_DEBUG_GROUP_STACK_DEPTH:
- case GL_MAX_DEBUG_MESSAGE_LENGTH:
- case GL_MAX_DEBUG_LOGGED_MESSAGES:
- case GL_MAX_DEBUG_GROUP_STACK_DEPTH:
- case GL_MAX_LABEL_LENGTH:
- *type = GL_INT;
- *numParams = 1;
- return true;
-
- case GL_DEBUG_OUTPUT_SYNCHRONOUS:
- case GL_DEBUG_OUTPUT:
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
- }
-
- if (getExtensions().multisampleCompatibility)
- {
- switch (pname)
- {
- case GL_MULTISAMPLE_EXT:
- case GL_SAMPLE_ALPHA_TO_ONE_EXT:
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
- }
-
- if (getExtensions().pathRendering)
- {
- switch (pname)
- {
- case GL_PATH_MODELVIEW_MATRIX_CHROMIUM:
- case GL_PATH_PROJECTION_MATRIX_CHROMIUM:
- *type = GL_FLOAT;
- *numParams = 16;
- return true;
- }
- }
-
- if (getExtensions().bindGeneratesResource)
- {
- switch (pname)
- {
- case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
- }
-
- if (getExtensions().clientArrays)
- {
- switch (pname)
- {
- case GL_CLIENT_ARRAYS_ANGLE:
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
- }
-
- if (getExtensions().sRGBWriteControl)
- {
- switch (pname)
- {
- case GL_FRAMEBUFFER_SRGB_EXT:
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
- }
-
- if (getExtensions().robustResourceInitialization &&
- pname == GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE)
- {
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
-
- if (getExtensions().programCacheControl && pname == GL_PROGRAM_CACHE_ENABLED_ANGLE)
- {
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
-
- // Check for ES3.0+ parameter names which are also exposed as ES2 extensions
- switch (pname)
- {
- // case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE // equivalent to FRAMEBUFFER_BINDING
- case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
- if ((getClientMajorVersion() < 3) && !getExtensions().framebufferBlit)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
-
- case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
- if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
-
- case GL_PROGRAM_BINARY_FORMATS_OES:
- if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = static_cast<unsigned int>(getCaps().programBinaryFormats.size());
- return true;
-
- case GL_PACK_ROW_LENGTH:
- case GL_PACK_SKIP_ROWS:
- case GL_PACK_SKIP_PIXELS:
- if ((getClientMajorVersion() < 3) && !getExtensions().packSubimage)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_UNPACK_ROW_LENGTH:
- case GL_UNPACK_SKIP_ROWS:
- case GL_UNPACK_SKIP_PIXELS:
- if ((getClientMajorVersion() < 3) && !getExtensions().unpackSubimage)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_VERTEX_ARRAY_BINDING:
- if ((getClientMajorVersion() < 3) && !getExtensions().vertexArrayObject)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_PIXEL_PACK_BUFFER_BINDING:
- case GL_PIXEL_UNPACK_BUFFER_BINDING:
- if ((getClientMajorVersion() < 3) && !getExtensions().pixelBufferObject)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_MAX_SAMPLES:
- {
- static_assert(GL_MAX_SAMPLES_ANGLE == GL_MAX_SAMPLES,
- "GL_MAX_SAMPLES_ANGLE not equal to GL_MAX_SAMPLES");
- if ((getClientMajorVersion() < 3) && !getExtensions().framebufferMultisample)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
-
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
- if ((getClientMajorVersion() < 3) && !getExtensions().standardDerivatives)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- }
-
- if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
- {
- if ((getClientVersion() < Version(3, 0)) && !getExtensions().drawBuffers)
- {
- return false;
- }
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
-
- if (getExtensions().multiview && pname == GL_MAX_VIEWS_ANGLE)
- {
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
-
- if (getClientVersion() < Version(3, 0))
- {
- return false;
- }
-
- // Check for ES3.0+ parameter names
- switch (pname)
- {
- case GL_MAX_UNIFORM_BUFFER_BINDINGS:
- case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
- case GL_UNIFORM_BUFFER_BINDING:
- case GL_TRANSFORM_FEEDBACK_BINDING:
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- case GL_COPY_READ_BUFFER_BINDING:
- case GL_COPY_WRITE_BUFFER_BINDING:
- case GL_SAMPLER_BINDING:
- case GL_READ_BUFFER:
- case GL_TEXTURE_BINDING_3D:
- case GL_TEXTURE_BINDING_2D_ARRAY:
- case GL_MAX_3D_TEXTURE_SIZE:
- case GL_MAX_ARRAY_TEXTURE_LAYERS:
- case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- case GL_MAX_COMBINED_UNIFORM_BLOCKS:
- case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
- case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
- case GL_MAX_VARYING_COMPONENTS:
- case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
- case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
- case GL_MIN_PROGRAM_TEXEL_OFFSET:
- case GL_MAX_PROGRAM_TEXEL_OFFSET:
- case GL_NUM_EXTENSIONS:
- case GL_MAJOR_VERSION:
- case GL_MINOR_VERSION:
- case GL_MAX_ELEMENTS_INDICES:
- case GL_MAX_ELEMENTS_VERTICES:
- case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
- case GL_UNPACK_IMAGE_HEIGHT:
- case GL_UNPACK_SKIP_IMAGES:
- {
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
-
- case GL_MAX_ELEMENT_INDEX:
- case GL_MAX_UNIFORM_BLOCK_SIZE:
- case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
- case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
- case GL_MAX_SERVER_WAIT_TIMEOUT:
- {
- *type = GL_INT_64_ANGLEX;
- *numParams = 1;
- return true;
- }
-
- case GL_TRANSFORM_FEEDBACK_ACTIVE:
- case GL_TRANSFORM_FEEDBACK_PAUSED:
- case GL_PRIMITIVE_RESTART_FIXED_INDEX:
- case GL_RASTERIZER_DISCARD:
- {
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
-
- case GL_MAX_TEXTURE_LOD_BIAS:
- {
- *type = GL_FLOAT;
- *numParams = 1;
- return true;
- }
- }
-
- if (getExtensions().requestExtension)
- {
- switch (pname)
- {
- case GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE:
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- }
-
- if (getClientVersion() < Version(3, 1))
- {
- return false;
- }
-
- switch (pname)
- {
- case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- case GL_DRAW_INDIRECT_BUFFER_BINDING:
- case GL_MAX_FRAMEBUFFER_WIDTH:
- case GL_MAX_FRAMEBUFFER_HEIGHT:
- case GL_MAX_FRAMEBUFFER_SAMPLES:
- case GL_MAX_SAMPLE_MASK_WORDS:
- case GL_MAX_COLOR_TEXTURE_SAMPLES:
- case GL_MAX_DEPTH_TEXTURE_SAMPLES:
- case GL_MAX_INTEGER_SAMPLES:
- case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET:
- case GL_MAX_VERTEX_ATTRIB_BINDINGS:
- case GL_MAX_VERTEX_ATTRIB_STRIDE:
- case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
- case GL_MAX_VERTEX_ATOMIC_COUNTERS:
- case GL_MAX_VERTEX_IMAGE_UNIFORMS:
- case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
- case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
- case GL_MAX_FRAGMENT_ATOMIC_COUNTERS:
- case GL_MAX_FRAGMENT_IMAGE_UNIFORMS:
- case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
- case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
- case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET:
- case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS:
- case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
- case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
- case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
- case GL_MAX_COMPUTE_UNIFORM_COMPONENTS:
- case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
- case GL_MAX_COMPUTE_ATOMIC_COUNTERS:
- case GL_MAX_COMPUTE_IMAGE_UNIFORMS:
- case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS:
- case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
- case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
- case GL_MAX_UNIFORM_LOCATIONS:
- case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS:
- case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE:
- case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS:
- case GL_MAX_COMBINED_ATOMIC_COUNTERS:
- case GL_MAX_IMAGE_UNITS:
- case GL_MAX_COMBINED_IMAGE_UNIFORMS:
- case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS:
- case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS:
- case GL_SHADER_STORAGE_BUFFER_BINDING:
- case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
- case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
- *type = GL_INT;
- *numParams = 1;
- return true;
- case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
- *type = GL_INT_64_ANGLEX;
- *numParams = 1;
- return true;
- case GL_SAMPLE_MASK:
- *type = GL_BOOL;
- *numParams = 1;
- return true;
- }
-
- return false;
-}
-
-bool ValidationContext::getIndexedQueryParameterInfo(GLenum target,
- GLenum *type,
- unsigned int *numParams)
-{
- if (getClientVersion() < Version(3, 0))
- {
- return false;
- }
-
- switch (target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- case GL_UNIFORM_BUFFER_BINDING:
- {
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- case GL_TRANSFORM_FEEDBACK_BUFFER_START:
- case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
- case GL_UNIFORM_BUFFER_START:
- case GL_UNIFORM_BUFFER_SIZE:
- {
- *type = GL_INT_64_ANGLEX;
- *numParams = 1;
- return true;
- }
- }
-
- if (getClientVersion() < Version(3, 1))
- {
- return false;
- }
-
- switch (target)
- {
- case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
- case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
- case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- case GL_SHADER_STORAGE_BUFFER_BINDING:
- case GL_VERTEX_BINDING_BUFFER:
- case GL_VERTEX_BINDING_DIVISOR:
- case GL_VERTEX_BINDING_OFFSET:
- case GL_VERTEX_BINDING_STRIDE:
- case GL_SAMPLE_MASK_VALUE:
- {
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
- case GL_ATOMIC_COUNTER_BUFFER_START:
- case GL_ATOMIC_COUNTER_BUFFER_SIZE:
- case GL_SHADER_STORAGE_BUFFER_START:
- case GL_SHADER_STORAGE_BUFFER_SIZE:
- {
- *type = GL_INT_64_ANGLEX;
- *numParams = 1;
- return true;
- }
- }
-
- return false;
-}
-
-Program *ValidationContext::getProgram(GLuint handle) const
-{
- return mState.mShaderPrograms->getProgram(handle);
-}
-
-Shader *ValidationContext::getShader(GLuint handle) const
-{
- return mState.mShaderPrograms->getShader(handle);
-}
-
-bool ValidationContext::isTextureGenerated(GLuint texture) const
-{
- return mState.mTextures->isHandleGenerated(texture);
-}
-
-bool ValidationContext::isBufferGenerated(GLuint buffer) const
-{
- return mState.mBuffers->isHandleGenerated(buffer);
-}
-
-bool ValidationContext::isRenderbufferGenerated(GLuint renderbuffer) const
-{
- return mState.mRenderbuffers->isHandleGenerated(renderbuffer);
-}
-
-bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const
-{
- return mState.mFramebuffers->isHandleGenerated(framebuffer);
-}
-
-bool ValidationContext::isProgramPipelineGenerated(GLuint pipeline) const
-{
- return mState.mPipelines->isHandleGenerated(pipeline);
-}
-
-bool ValidationContext::usingDisplayTextureShareGroup() const
-{
- return mDisplayTextureShareGroup;
-}
-
-GLenum ValidationContext::getConvertedRenderbufferFormat(GLenum internalformat) const
-{
- return mState.mExtensions.webglCompatibility && mState.mClientVersion.major == 2 &&
- internalformat == GL_DEPTH_STENCIL
- ? GL_DEPTH24_STENCIL8
- : internalformat;
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/ContextState.h b/src/3rdparty/angle/src/libANGLE/ContextState.h
deleted file mode 100644
index e6e9f4c6b0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ContextState.h
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-// ContextState: Container class for all GL context state, caps and objects.
-
-#ifndef LIBANGLE_CONTEXTSTATE_H_
-#define LIBANGLE_CONTEXTSTATE_H_
-
-#include "common/MemoryBuffer.h"
-#include "common/angleutils.h"
-#include "libANGLE/State.h"
-#include "libANGLE/Version.h"
-#include "libANGLE/params.h"
-
-namespace gl
-{
-class BufferManager;
-class ContextState;
-class FramebufferManager;
-class PathManager;
-class ProgramPipelineManager;
-class RenderbufferManager;
-class SamplerManager;
-class ShaderProgramManager;
-class SyncManager;
-class TextureManager;
-class ValidationContext;
-
-static constexpr Version ES_2_0 = Version(2, 0);
-static constexpr Version ES_3_0 = Version(3, 0);
-static constexpr Version ES_3_1 = Version(3, 1);
-
-using ContextID = uintptr_t;
-
-class ContextState final : angle::NonCopyable
-{
- public:
- ContextState(ContextID context,
- const ContextState *shareContextState,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *state,
- const Caps &caps,
- const TextureCapsMap &textureCaps,
- const Extensions &extensions,
- const Limitations &limitations);
- ~ContextState();
-
- ContextID getContextID() const { return mContext; }
- GLint getClientMajorVersion() const { return mClientVersion.major; }
- GLint getClientMinorVersion() const { return mClientVersion.minor; }
- const Version &getClientVersion() const { return mClientVersion; }
- const State &getState() const { return *mState; }
- const Caps &getCaps() const { return mCaps; }
- const TextureCapsMap &getTextureCaps() const { return mTextureCaps; }
- const Extensions &getExtensions() const { return mExtensions; }
- const Limitations &getLimitations() const { return mLimitations; }
-
- const TextureCaps &getTextureCap(GLenum internalFormat) const;
-
- bool usingDisplayTextureShareGroup() const;
-
- bool isWebGL() const;
- bool isWebGL1() const;
-
- private:
- friend class Context;
- friend class ValidationContext;
-
- Version mClientVersion;
- ContextID mContext;
- State *mState;
- const Caps &mCaps;
- const TextureCapsMap &mTextureCaps;
- const Extensions &mExtensions;
- const Limitations &mLimitations;
-
- BufferManager *mBuffers;
- ShaderProgramManager *mShaderPrograms;
- TextureManager *mTextures;
- RenderbufferManager *mRenderbuffers;
- SamplerManager *mSamplers;
- SyncManager *mSyncs;
- PathManager *mPaths;
- FramebufferManager *mFramebuffers;
- ProgramPipelineManager *mPipelines;
-};
-
-class ValidationContext : angle::NonCopyable
-{
- public:
- ValidationContext(const ValidationContext *shareContext,
- TextureManager *shareTextures,
- const Version &clientVersion,
- State *state,
- const Caps &caps,
- const TextureCapsMap &textureCaps,
- const Extensions &extensions,
- const Limitations &limitations,
- bool skipValidation);
- virtual ~ValidationContext();
-
- virtual void handleError(const Error &error) = 0;
-
- const ContextState &getContextState() const { return mState; }
- GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); }
- GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); }
- const Version &getClientVersion() const { return mState.getClientVersion(); }
- const State &getGLState() const { return mState.getState(); }
- 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; }
-
- // Specific methods needed for validation.
- bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
- bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
-
- Program *getProgram(GLuint handle) const;
- Shader *getShader(GLuint handle) const;
-
- bool isTextureGenerated(GLuint texture) const;
- bool isBufferGenerated(GLuint buffer) const;
- 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(); }
-
- template <typename T>
- const T &getParams() const;
-
- protected:
- ContextState mState;
- bool mSkipValidation;
- bool mDisplayTextureShareGroup;
-
- // Caches entry point parameters and values re-used between layers.
- mutable const ParamTypeInfo *mSavedArgsType;
- static constexpr size_t kParamsBufferSize = 64u;
- mutable std::array<uint8_t, kParamsBufferSize> mParamsBuffer;
-};
-
-template <typename T>
-const T &ValidationContext::getParams() const
-{
- const T *params = reinterpret_cast<T *>(mParamsBuffer.data());
- ASSERT(mSavedArgsType->hasDynamicType(T::TypeInfo));
- return *params;
-}
-
-} // namespace gl
-
-#endif // LIBANGLE_CONTEXTSTATE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Debug.cpp b/src/3rdparty/angle/src/libANGLE/Debug.cpp
deleted file mode 100644
index 96f30df98c..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Debug.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-//
-// 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.
-//
-
-// Debug.cpp: Defines debug state used for GL_KHR_debug
-
-#include "libANGLE/Debug.h"
-
-#include "common/debug.h"
-
-#include <algorithm>
-#include <tuple>
-
-namespace gl
-{
-
-Debug::Control::Control()
-{
-}
-
-Debug::Control::~Control()
-{
-}
-
-Debug::Control::Control(const Control &other) = default;
-
-Debug::Group::Group()
-{
-}
-
-Debug::Group::~Group()
-{
-}
-
-Debug::Group::Group(const Group &other) = default;
-
-Debug::Debug()
- : mOutputEnabled(false),
- mCallbackFunction(nullptr),
- mCallbackUserParam(nullptr),
- mMessages(),
- mMaxLoggedMessages(0),
- mOutputSynchronous(false),
- mGroups()
-{
- pushDefaultGroup();
-}
-
-Debug::~Debug()
-{
-}
-
-void Debug::setMaxLoggedMessages(GLuint maxLoggedMessages)
-{
- mMaxLoggedMessages = maxLoggedMessages;
-}
-
-void Debug::setOutputEnabled(bool enabled)
-{
- mOutputEnabled = enabled;
-}
-
-bool Debug::isOutputEnabled() const
-{
- return mOutputEnabled;
-}
-
-void Debug::setOutputSynchronous(bool synchronous)
-{
- mOutputSynchronous = synchronous;
-}
-
-bool Debug::isOutputSynchronous() const
-{
- return mOutputSynchronous;
-}
-
-void Debug::setCallback(GLDEBUGPROCKHR callback, const void *userParam)
-{
- mCallbackFunction = callback;
- mCallbackUserParam = userParam;
-}
-
-GLDEBUGPROCKHR Debug::getCallback() const
-{
- return mCallbackFunction;
-}
-
-const void *Debug::getUserParam() const
-{
- return mCallbackUserParam;
-}
-
-void Debug::insertMessage(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- const std::string &message)
-{
- std::string messageCopy(message);
- insertMessage(source, type, id, severity, std::move(messageCopy));
-}
-
-void Debug::insertMessage(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- std::string &&message)
-{
- if (!isMessageEnabled(source, type, id, severity))
- {
- return;
- }
-
- if (mCallbackFunction != nullptr)
- {
- // TODO(geofflang) Check the synchronous flag and potentially flush messages from another
- // thread.
- mCallbackFunction(source, type, id, severity, static_cast<GLsizei>(message.length()),
- message.c_str(), mCallbackUserParam);
- }
- else
- {
- if (mMessages.size() >= mMaxLoggedMessages)
- {
- // Drop messages over the limit
- return;
- }
-
- Message m;
- m.source = source;
- m.type = type;
- m.id = id;
- m.severity = severity;
- m.message = std::move(message);
-
- mMessages.push_back(std::move(m));
- }
-}
-
-size_t Debug::getMessages(GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog)
-{
- size_t messageCount = 0;
- size_t messageStringIndex = 0;
- while (messageCount <= count && !mMessages.empty())
- {
- const Message &m = mMessages.front();
-
- if (messageLog != nullptr)
- {
- // Check that this message can fit in the message buffer
- if (messageStringIndex + m.message.length() + 1 > static_cast<size_t>(bufSize))
- {
- break;
- }
-
- std::copy(m.message.begin(), m.message.end(), messageLog + messageStringIndex);
- messageStringIndex += m.message.length();
-
- messageLog[messageStringIndex] = '\0';
- messageStringIndex += 1;
- }
-
- if (sources != nullptr)
- {
- sources[messageCount] = m.source;
- }
-
- if (types != nullptr)
- {
- types[messageCount] = m.type;
- }
-
- if (ids != nullptr)
- {
- ids[messageCount] = m.id;
- }
-
- if (severities != nullptr)
- {
- severities[messageCount] = m.severity;
- }
-
- if (lengths != nullptr)
- {
- lengths[messageCount] = static_cast<GLsizei>(m.message.length());
- }
-
- mMessages.pop_front();
-
- messageCount++;
- }
-
- return messageCount;
-}
-
-size_t Debug::getNextMessageLength() const
-{
- return mMessages.empty() ? 0 : mMessages.front().message.length();
-}
-
-size_t Debug::getMessageCount() const
-{
- return mMessages.size();
-}
-
-void Debug::setMessageControl(GLenum source,
- GLenum type,
- GLenum severity,
- std::vector<GLuint> &&ids,
- bool enabled)
-{
- Control c;
- c.source = source;
- c.type = type;
- c.severity = severity;
- c.ids = std::move(ids);
- c.enabled = enabled;
-
- auto &controls = mGroups.back().controls;
- controls.push_back(std::move(c));
-}
-
-void Debug::pushGroup(GLenum source, GLuint id, std::string &&message)
-{
- insertMessage(source, GL_DEBUG_TYPE_PUSH_GROUP, id, GL_DEBUG_SEVERITY_NOTIFICATION,
- std::string(message));
-
- Group g;
- g.source = source;
- g.id = id;
- g.message = std::move(message);
- mGroups.push_back(std::move(g));
-}
-
-void Debug::popGroup()
-{
- // Make sure the default group is not about to be popped
- ASSERT(mGroups.size() > 1);
-
- Group g = mGroups.back();
- mGroups.pop_back();
-
- insertMessage(g.source, GL_DEBUG_TYPE_POP_GROUP, g.id, GL_DEBUG_SEVERITY_NOTIFICATION,
- g.message);
-}
-
-size_t Debug::getGroupStackDepth() const
-{
- return mGroups.size();
-}
-
-bool Debug::isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const
-{
- if (!mOutputEnabled)
- {
- return false;
- }
-
- for (auto groupIter = mGroups.rbegin(); groupIter != mGroups.rend(); groupIter++)
- {
- const auto &controls = groupIter->controls;
- for (auto controlIter = controls.rbegin(); controlIter != controls.rend(); controlIter++)
- {
- const auto &control = *controlIter;
-
- if (control.source != GL_DONT_CARE && control.source != source)
- {
- continue;
- }
-
- if (control.type != GL_DONT_CARE && control.type != type)
- {
- continue;
- }
-
- if (control.severity != GL_DONT_CARE && control.severity != severity)
- {
- continue;
- }
-
- if (!control.ids.empty() &&
- std::find(control.ids.begin(), control.ids.end(), id) == control.ids.end())
- {
- continue;
- }
-
- return control.enabled;
- }
- }
-
- return true;
-}
-
-void Debug::pushDefaultGroup()
-{
- Group g;
- g.source = GL_NONE;
- g.id = 0;
- g.message = "";
-
- Control c0;
- c0.source = GL_DONT_CARE;
- c0.type = GL_DONT_CARE;
- c0.severity = GL_DONT_CARE;
- c0.enabled = true;
- g.controls.push_back(std::move(c0));
-
- Control c1;
- c1.source = GL_DONT_CARE;
- c1.type = GL_DONT_CARE;
- c1.severity = GL_DEBUG_SEVERITY_LOW;
- c1.enabled = false;
- g.controls.push_back(std::move(c1));
-
- mGroups.push_back(std::move(g));
-}
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Debug.h b/src/3rdparty/angle/src/libANGLE/Debug.h
deleted file mode 100644
index 2c15c25e9a..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Debug.h
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// 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.
-//
-
-// Debug.h: Defines debug state used for GL_KHR_debug
-
-#ifndef LIBANGLE_DEBUG_H_
-#define LIBANGLE_DEBUG_H_
-
-#include "angle_gl.h"
-#include "common/angleutils.h"
-
-#include <deque>
-#include <string>
-#include <vector>
-
-namespace gl
-{
-
-class LabeledObject
-{
- public:
- virtual ~LabeledObject() {}
- virtual void setLabel(const std::string &label) = 0;
- virtual const std::string &getLabel() const = 0;
-};
-
-class Debug : angle::NonCopyable
-{
- public:
- Debug();
- ~Debug();
-
- void setMaxLoggedMessages(GLuint maxLoggedMessages);
-
- void setOutputEnabled(bool enabled);
- bool isOutputEnabled() const;
-
- void setOutputSynchronous(bool synchronous);
- bool isOutputSynchronous() const;
-
- void setCallback(GLDEBUGPROCKHR callback, const void *userParam);
- GLDEBUGPROCKHR getCallback() const;
- const void *getUserParam() const;
-
- void insertMessage(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- const std::string &message);
- void insertMessage(GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- std::string &&message);
-
- void setMessageControl(GLenum source,
- GLenum type,
- GLenum severity,
- std::vector<GLuint> &&ids,
- bool enabled);
- size_t getMessages(GLuint count,
- GLsizei bufSize,
- GLenum *sources,
- GLenum *types,
- GLuint *ids,
- GLenum *severities,
- GLsizei *lengths,
- GLchar *messageLog);
- size_t getNextMessageLength() const;
- size_t getMessageCount() const;
-
- void pushGroup(GLenum source, GLuint id, std::string &&message);
- void popGroup();
- size_t getGroupStackDepth() const;
-
- private:
- bool isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const;
-
- void pushDefaultGroup();
-
- struct Message
- {
- GLenum source;
- GLenum type;
- GLuint id;
- GLenum severity;
- std::string message;
- };
-
- struct Control
- {
- Control();
- ~Control();
- Control(const Control &other);
-
- GLenum source;
- GLenum type;
- GLenum severity;
- std::vector<GLuint> ids;
- bool enabled;
- };
-
- struct Group
- {
- Group();
- ~Group();
- Group(const Group &other);
-
- GLenum source;
- GLuint id;
- std::string message;
-
- std::vector<Control> controls;
- };
-
- bool mOutputEnabled;
- GLDEBUGPROCKHR mCallbackFunction;
- const void *mCallbackUserParam;
- std::deque<Message> mMessages;
- GLuint mMaxLoggedMessages;
- bool mOutputSynchronous;
- std::vector<Group> mGroups;
-};
-} // namespace gl
-
-#endif // LIBANGLE_DEBUG_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Device.cpp b/src/3rdparty/angle/src/libANGLE/Device.cpp
deleted file mode 100644
index 3ebf48b919..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Device.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// 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.
-//
-
-// Device.cpp: Implements the egl::Device class, representing the abstract
-// device. Implements EGLDevice.
-
-#include "libANGLE/Device.h"
-
-#include <iterator>
-
-#include <platform/Platform.h>
-#include <EGL/eglext.h>
-
-#include "common/debug.h"
-#include "common/platform.h"
-#include "libANGLE/renderer/DeviceImpl.h"
-
-#if defined(ANGLE_ENABLE_D3D11)
-#include "libANGLE/renderer/d3d/DeviceD3D.h"
-#endif
-
-namespace egl
-{
-
-template <typename T>
-static std::string GenerateExtensionsString(const T &extensions)
-{
- std::vector<std::string> extensionsVector = extensions.getStrings();
-
- std::ostringstream stream;
- std::copy(extensionsVector.begin(), extensionsVector.end(), std::ostream_iterator<std::string>(stream, " "));
- return stream.str();
-}
-
-typedef std::set<egl::Device *> DeviceSet;
-static DeviceSet *GetDeviceSet()
-{
- static DeviceSet devices;
- return &devices;
-}
-
-// Static factory methods
-egl::Error Device::CreateDevice(void *devicePointer, EGLint deviceType, Device **outDevice)
-{
- *outDevice = nullptr;
-
-#if defined(ANGLE_ENABLE_D3D11)
- if (deviceType == EGL_D3D11_DEVICE_ANGLE)
- {
- std::unique_ptr<rx::DeviceD3D> deviceD3D(new rx::DeviceD3D());
- ANGLE_TRY(deviceD3D->initialize(devicePointer, deviceType, EGL_TRUE));
- *outDevice = new Device(nullptr, deviceD3D.release());
- GetDeviceSet()->insert(*outDevice);
- return NoError();
- }
-#endif
-
- // Note that creating an EGL device from inputted D3D9 parameters isn't currently supported
- return EglBadAttribute();
-}
-
-egl::Error Device::CreateDevice(Display *owningDisplay, rx::DeviceImpl *impl, Device **outDevice)
-{
- *outDevice = new Device(owningDisplay, impl);
- GetDeviceSet()->insert(*outDevice);
- return NoError();
-}
-
-bool Device::IsValidDevice(Device *device)
-{
- const DeviceSet *deviceSet = GetDeviceSet();
- return deviceSet->find(device) != deviceSet->end();
-}
-
-Device::Device(Display *owningDisplay, rx::DeviceImpl *impl)
- : mOwningDisplay(owningDisplay), mImplementation(impl)
-{
- initDeviceExtensions();
-}
-
-Device::~Device()
-{
- ASSERT(GetDeviceSet()->find(this) != GetDeviceSet()->end());
- GetDeviceSet()->erase(this);
-
- if (mImplementation->deviceExternallySourced())
- {
- // If the device isn't externally sourced then it is up to the renderer to delete the impl
- SafeDelete(mImplementation);
- }
-}
-
-Error Device::getDevice(EGLAttrib *value)
-{
- void *nativeDevice = nullptr;
- egl::Error error = getImplementation()->getDevice(&nativeDevice);
- *value = reinterpret_cast<EGLAttrib>(nativeDevice);
- return error;
-}
-
-EGLint Device::getType()
-{
- return getImplementation()->getType();
-}
-
-void Device::initDeviceExtensions()
-{
- mImplementation->generateExtensions(&mDeviceExtensions);
- mDeviceExtensionString = GenerateExtensionsString(mDeviceExtensions);
-}
-
-const DeviceExtensions &Device::getExtensions() const
-{
- return mDeviceExtensions;
-}
-
-const std::string &Device::getExtensionString() const
-{
- return mDeviceExtensionString;
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/Device.h b/src/3rdparty/angle/src/libANGLE/Device.h
deleted file mode 100644
index 4bc58ff043..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Device.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// 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.
-//
-
-// Device.h: Implements the egl::Device class, representing the abstract
-// device. Implements EGLDevice.
-
-#ifndef LIBANGLE_DEVICE_H_
-#define LIBANGLE_DEVICE_H_
-
-#include "common/angleutils.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/Display.h"
-
-namespace rx
-{
-class DeviceImpl;
-}
-
-namespace egl
-{
-class Device final : angle::NonCopyable
-{
- public:
- virtual ~Device();
-
- Error getDevice(EGLAttrib *value);
- Display *getOwningDisplay() { return mOwningDisplay; };
- EGLint getType();
-
- const DeviceExtensions &getExtensions() const;
- const std::string &getExtensionString() const;
-
- rx::DeviceImpl *getImplementation() { return mImplementation; }
-
- static egl::Error CreateDevice(void *devicePointer, EGLint deviceType, Device **outDevice);
- static egl::Error CreateDevice(Display *owningDisplay,
- rx::DeviceImpl *impl,
- Device **outDevice);
-
- static bool IsValidDevice(Device *device);
-
- private:
- Device(Display *owningDisplay, rx::DeviceImpl *impl);
- void initDeviceExtensions();
-
- Display *mOwningDisplay;
- rx::DeviceImpl *mImplementation;
-
- DeviceExtensions mDeviceExtensions;
- std::string mDeviceExtensionString;
-};
-
-}
-
-#endif // LIBANGLE_DEVICE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Display.cpp b/src/3rdparty/angle/src/libANGLE/Display.cpp
deleted file mode 100644
index 0bb0bb05b1..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Display.cpp
+++ /dev/null
@@ -1,1240 +0,0 @@
-//
-// 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.
-//
-
-// Display.cpp: Implements the egl::Display class, representing the abstract
-// display on which graphics are drawn. Implements EGLDisplay.
-// [EGL 1.4] section 2.1.2 page 3.
-
-#include "libANGLE/Display.h"
-
-#include <algorithm>
-#include <iterator>
-#include <map>
-#include <sstream>
-#include <vector>
-
-#include <platform/Platform.h>
-#include <EGL/eglext.h>
-
-#include "common/debug.h"
-#include "common/mathutil.h"
-#include "common/platform.h"
-#include "common/utilities.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/Device.h"
-#include "libANGLE/histogram_macros.h"
-#include "libANGLE/Image.h"
-#include "libANGLE/Surface.h"
-#include "libANGLE/Stream.h"
-#include "libANGLE/ResourceManager.h"
-#include "libANGLE/renderer/DisplayImpl.h"
-#include "libANGLE/renderer/ImageImpl.h"
-#include "third_party/trace_event/trace_event.h"
-
-#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
-# include "libANGLE/renderer/d3d/DisplayD3D.h"
-#endif
-
-#if defined(ANGLE_ENABLE_OPENGL)
-# if defined(ANGLE_PLATFORM_WINDOWS)
-# include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
-# elif defined(ANGLE_USE_X11)
-# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
-# elif defined(ANGLE_PLATFORM_APPLE)
-# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
-# elif defined(ANGLE_USE_OZONE)
-# include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
-# elif defined(ANGLE_PLATFORM_ANDROID)
-# include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
-# else
-# error Unsupported OpenGL platform.
-# endif
-#endif
-
-#if defined(ANGLE_ENABLE_NULL)
-#include "libANGLE/renderer/null/DisplayNULL.h"
-#endif // defined(ANGLE_ENABLE_NULL)
-
-#if defined(ANGLE_ENABLE_VULKAN)
-#if defined(ANGLE_PLATFORM_WINDOWS)
-#include "libANGLE/renderer/vulkan/win32/DisplayVkWin32.h"
-#elif defined(ANGLE_PLATFORM_LINUX)
-#include "libANGLE/renderer/vulkan/xcb/DisplayVkXcb.h"
-#else
-#error Unsupported Vulkan platform.
-#endif
-#endif // defined(ANGLE_ENABLE_VULKAN)
-
-namespace egl
-{
-
-namespace
-{
-
-typedef std::map<EGLNativeWindowType, Surface*> WindowSurfaceMap;
-// Get a map of all EGL window surfaces to validate that no window has more than one EGL surface
-// associated with it.
-static WindowSurfaceMap *GetWindowSurfaces()
-{
- static WindowSurfaceMap windowSurfaces;
- return &windowSurfaces;
-}
-
-typedef std::map<EGLNativeDisplayType, Display *> ANGLEPlatformDisplayMap;
-static ANGLEPlatformDisplayMap *GetANGLEPlatformDisplayMap()
-{
- static ANGLEPlatformDisplayMap displays;
- return &displays;
-}
-
-typedef std::map<Device *, Display *> DevicePlatformDisplayMap;
-static DevicePlatformDisplayMap *GetDevicePlatformDisplayMap()
-{
- static DevicePlatformDisplayMap displays;
- return &displays;
-}
-
-rx::DisplayImpl *CreateDisplayFromDevice(Device *eglDevice, const DisplayState &state)
-{
- rx::DisplayImpl *impl = nullptr;
-
- switch (eglDevice->getType())
- {
-#if defined(ANGLE_ENABLE_D3D11)
- case EGL_D3D11_DEVICE_ANGLE:
- impl = new rx::DisplayD3D(state);
- break;
-#endif
-#if defined(ANGLE_ENABLE_D3D9)
- case EGL_D3D9_DEVICE_ANGLE:
- // Currently the only way to get EGLDeviceEXT representing a D3D9 device
- // is to retrieve one from an already-existing EGLDisplay.
- // When eglGetPlatformDisplayEXT is called with a D3D9 EGLDeviceEXT,
- // the already-existing display should be returned.
- // Therefore this codepath to create a new display from the device
- // should never be hit.
- UNREACHABLE();
- break;
-#endif
- default:
- UNREACHABLE();
- break;
- }
-
- ASSERT(impl != nullptr);
- return impl;
-}
-
-rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const DisplayState &state)
-{
- rx::DisplayImpl *impl = nullptr;
- EGLAttrib displayType =
- attribMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
- switch (displayType)
- {
- case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
-#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
- // Default to D3D displays
- impl = new rx::DisplayD3D(state);
-#elif defined(ANGLE_USE_X11)
- impl = new rx::DisplayGLX(state);
-#elif defined(ANGLE_PLATFORM_APPLE)
- impl = new rx::DisplayCGL(state);
-#elif defined(ANGLE_USE_OZONE)
- impl = new rx::DisplayOzone(state);
-#elif defined(ANGLE_PLATFORM_ANDROID)
- impl = new rx::DisplayAndroid(state);
-#else
- // No display available
- UNREACHABLE();
-#endif
- break;
-
- case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
- case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
-#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
- impl = new rx::DisplayD3D(state);
-#else
- // A D3D display was requested on a platform that doesn't support it
- UNREACHABLE();
-#endif
- break;
-
- case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
-#if defined(ANGLE_ENABLE_OPENGL)
-#if defined(ANGLE_PLATFORM_WINDOWS)
- impl = new rx::DisplayWGL(state);
-#elif defined(ANGLE_USE_X11)
- impl = new rx::DisplayGLX(state);
-#elif defined(ANGLE_PLATFORM_APPLE)
- impl = new rx::DisplayCGL(state);
-#elif defined(ANGLE_USE_OZONE)
- // This might work but has never been tried, so disallow for now.
- impl = nullptr;
-#elif defined(ANGLE_PLATFORM_ANDROID)
- // No GL support on this platform, fail display creation.
- impl = nullptr;
-#else
-#error Unsupported OpenGL platform.
-#endif
-#else
- // No display available
- UNREACHABLE();
-#endif // defined(ANGLE_ENABLE_OPENGL)
- break;
-
- case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
-#if defined(ANGLE_ENABLE_OPENGL)
-#if defined(ANGLE_PLATFORM_WINDOWS)
- impl = new rx::DisplayWGL(state);
-#elif defined(ANGLE_USE_X11)
- impl = new rx::DisplayGLX(state);
-#elif defined(ANGLE_USE_OZONE)
- impl = new rx::DisplayOzone(state);
-#elif defined(ANGLE_PLATFORM_ANDROID)
- impl = new rx::DisplayAndroid(state);
-#else
- // No GLES support on this platform, fail display creation.
- impl = nullptr;
-#endif
-#endif // defined(ANGLE_ENABLE_OPENGL)
- break;
-
- case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
-#if defined(ANGLE_ENABLE_VULKAN)
-#if defined(ANGLE_PLATFORM_WINDOWS)
- impl = new rx::DisplayVkWin32(state);
-#elif defined(ANGLE_PLATFORM_LINUX)
- impl = new rx::DisplayVkXcb(state);
-#else
-#error Unsupported Vulkan platform.
-#endif
-#else
- // No display available
- UNREACHABLE();
-#endif // defined(ANGLE_ENABLE_VULKAN)
- break;
-
- case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
-#if defined(ANGLE_ENABLE_NULL)
- impl = new rx::DisplayNULL(state);
-#else
- // No display available
- UNREACHABLE();
-#endif // defined(ANGLE_ENABLE_NULL)
- break;
-
- default:
- UNREACHABLE();
- break;
- }
-
- return impl;
-}
-
-void Display_logError(angle::PlatformMethods *platform, const char *errorMessage)
-{
- gl::Trace(gl::LOG_ERR, errorMessage);
-}
-
-void Display_logWarning(angle::PlatformMethods *platform, const char *warningMessage)
-{
- gl::Trace(gl::LOG_WARN, warningMessage);
-}
-
-void Display_logInfo(angle::PlatformMethods *platform, const char *infoMessage)
-{
- // Uncomment to get info spam
- // gl::Trace(gl::LOG_WARN, infoMessage);
-}
-
-void ANGLESetDefaultDisplayPlatform(angle::EGLDisplayType display)
-{
- angle::PlatformMethods *platformMethods = ANGLEPlatformCurrent();
- if (platformMethods->logError != angle::DefaultLogError)
- {
- // Don't reset pre-set Platform to Default
- return;
- }
-
- ANGLEResetDisplayPlatform(display);
- platformMethods->logError = Display_logError;
- platformMethods->logWarning = Display_logWarning;
- platformMethods->logInfo = Display_logInfo;
-}
-
-} // anonymous namespace
-
-DisplayState::DisplayState()
-{
-}
-
-DisplayState::~DisplayState()
-{
-}
-
-// static
-Display *Display::GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
- const AttributeMap &attribMap)
-{
- Display *display = nullptr;
-
- ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
- const auto &iter = displays->find(nativeDisplay);
- if (iter != displays->end())
- {
- display = iter->second;
- }
-
- if (display == nullptr)
- {
- // Validate the native display
- if (!Display::isValidNativeDisplay(nativeDisplay))
- {
- return nullptr;
- }
-
- display = new Display(EGL_PLATFORM_ANGLE_ANGLE, nativeDisplay, nullptr);
- displays->insert(std::make_pair(nativeDisplay, display));
- }
-
- // Apply new attributes if the display is not initialized yet.
- if (!display->isInitialized())
- {
- rx::DisplayImpl *impl = CreateDisplayFromAttribs(attribMap, display->getState());
- if (impl == nullptr)
- {
- // No valid display implementation for these attributes
- return nullptr;
- }
-
- display->setAttributes(impl, attribMap);
- }
-
- return display;
-}
-
-// static
-Display *Display::GetDisplayFromDevice(Device *device, const AttributeMap &attribMap)
-{
- Display *display = nullptr;
-
- ASSERT(Device::IsValidDevice(device));
-
- ANGLEPlatformDisplayMap *anglePlatformDisplays = GetANGLEPlatformDisplayMap();
- DevicePlatformDisplayMap *devicePlatformDisplays = GetDevicePlatformDisplayMap();
-
- // First see if this eglDevice is in use by a Display created using ANGLE platform
- for (auto &displayMapEntry : *anglePlatformDisplays)
- {
- egl::Display *iterDisplay = displayMapEntry.second;
- if (iterDisplay->getDevice() == device)
- {
- display = iterDisplay;
- }
- }
-
- if (display == nullptr)
- {
- // See if the eglDevice is in use by a Display created using the DEVICE platform
- const auto &iter = devicePlatformDisplays->find(device);
- if (iter != devicePlatformDisplays->end())
- {
- display = iter->second;
- }
- }
-
- if (display == nullptr)
- {
- // Otherwise create a new Display
- display = new Display(EGL_PLATFORM_DEVICE_EXT, 0, device);
- devicePlatformDisplays->insert(std::make_pair(device, display));
- }
-
- // Apply new attributes if the display is not initialized yet.
- if (!display->isInitialized())
- {
- rx::DisplayImpl *impl = CreateDisplayFromDevice(device, display->getState());
- display->setAttributes(impl, attribMap);
- }
-
- return display;
-}
-
-//static
-void Display::CleanupDisplays()
-{
- // ~Display takes care of removing the entry from the according map
- {
- ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
- while (!displays->empty())
- delete displays->begin()->second;
- }
-
- {
- DevicePlatformDisplayMap *displays = GetDevicePlatformDisplayMap();
- while (!displays->empty())
- delete displays->begin()->second;
- }
-}
-
-Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice)
- : mImplementation(nullptr),
- mDisplayId(displayId),
- mAttributeMap(),
- mConfigSet(),
- mContextSet(),
- mStreamSet(),
- mInitialized(false),
- mDeviceLost(false),
- mCaps(),
- mDisplayExtensions(),
- mDisplayExtensionString(),
- mVendorString(),
- mDevice(eglDevice),
- mPlatform(platform),
- mTextureManager(nullptr),
- mMemoryProgramCache(gl::kDefaultMaxProgramCacheMemoryBytes),
- mGlobalTextureShareGroupUsers(0),
- mProxyContext(this)
-{
-}
-
-Display::~Display()
-{
- // TODO(jmadill): When is this called?
- // terminate();
-
- if (mPlatform == EGL_PLATFORM_ANGLE_ANGLE)
- {
- ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
- ANGLEPlatformDisplayMap::iterator iter = displays->find(mDisplayId);
- if (iter != displays->end())
- {
- displays->erase(iter);
- }
- }
- else if (mPlatform == EGL_PLATFORM_DEVICE_EXT)
- {
- DevicePlatformDisplayMap *displays = GetDevicePlatformDisplayMap();
- DevicePlatformDisplayMap::iterator iter = displays->find(mDevice);
- if (iter != displays->end())
- {
- displays->erase(iter);
- }
- }
- else
- {
- UNREACHABLE();
- }
-
- mProxyContext.reset(nullptr);
-
- SafeDelete(mDevice);
- SafeDelete(mImplementation);
-}
-
-void Display::setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap)
-{
- ASSERT(!mInitialized);
-
- ASSERT(impl != nullptr);
- SafeDelete(mImplementation);
- mImplementation = impl;
-
- mAttributeMap = attribMap;
-}
-
-Error Display::initialize()
-{
- // TODO(jmadill): Store Platform in Display and init here.
- const angle::PlatformMethods *platformMethods =
- reinterpret_cast<const angle::PlatformMethods *>(
- mAttributeMap.get(EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX, 0));
- if (platformMethods != nullptr)
- {
- *ANGLEPlatformCurrent() = *platformMethods;
- }
- else
- {
- ANGLESetDefaultDisplayPlatform(this);
- }
-
- gl::InitializeDebugAnnotations(&mAnnotator);
-
- SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.DisplayInitializeMS");
- TRACE_EVENT0("gpu.angle", "egl::Display::initialize");
-
- ASSERT(mImplementation != nullptr);
-
- if (isInitialized())
- {
- return NoError();
- }
-
- Error error = mImplementation->initialize(this);
- if (error.isError())
- {
- // Log extended error message here
- ERR() << "ANGLE Display::initialize error " << error.getID() << ": " << error.getMessage();
- return error;
- }
-
- mCaps = mImplementation->getCaps();
-
- mConfigSet = mImplementation->generateConfigs();
- if (mConfigSet.size() == 0)
- {
- mImplementation->terminate();
- return EglNotInitialized();
- }
-
- initDisplayExtensions();
- initVendorString();
-
- // Populate the Display's EGLDeviceEXT if the Display wasn't created using one
- if (mPlatform != EGL_PLATFORM_DEVICE_EXT)
- {
- if (mDisplayExtensions.deviceQuery)
- {
- rx::DeviceImpl *impl = nullptr;
- ANGLE_TRY(mImplementation->getDevice(&impl));
- ANGLE_TRY(Device::CreateDevice(this, impl, &mDevice));
- }
- else
- {
- mDevice = nullptr;
- }
- }
- else
- {
- // For EGL_PLATFORM_DEVICE_EXT, mDevice should always be populated using
- // an external device
- ASSERT(mDevice != nullptr);
- }
-
- mProxyContext.reset(nullptr);
- gl::Context *proxyContext = new gl::Context(mImplementation, nullptr, nullptr, nullptr, nullptr,
- egl::AttributeMap(), mDisplayExtensions);
- mProxyContext.reset(proxyContext);
-
- mInitialized = true;
-
- return NoError();
-}
-
-Error Display::terminate()
-{
- ANGLE_TRY(makeCurrent(nullptr, nullptr, nullptr));
-
- mMemoryProgramCache.clear();
-
- mProxyContext.reset(nullptr);
-
- while (!mContextSet.empty())
- {
- ANGLE_TRY(destroyContext(*mContextSet.begin()));
- }
-
- // The global texture manager should be deleted with the last context that uses it.
- ASSERT(mGlobalTextureShareGroupUsers == 0 && mTextureManager == nullptr);
-
- while (!mImageSet.empty())
- {
- destroyImage(*mImageSet.begin());
- }
-
- while (!mStreamSet.empty())
- {
- destroyStream(*mStreamSet.begin());
- }
-
- while (!mState.surfaceSet.empty())
- {
- ANGLE_TRY(destroySurface(*mState.surfaceSet.begin()));
- }
-
- mConfigSet.clear();
-
- if (mDevice != nullptr && mDevice->getOwningDisplay() != nullptr)
- {
- // Don't delete the device if it was created externally using eglCreateDeviceANGLE
- // We also shouldn't set it to null in case eglInitialize() is called again later
- SafeDelete(mDevice);
- }
-
- mImplementation->terminate();
-
- mDeviceLost = false;
-
- mInitialized = false;
-
- gl::UninitializeDebugAnnotations();
-
- // TODO(jmadill): Store Platform in Display and deinit here.
- ANGLEResetDisplayPlatform(this);
-
- return NoError();
-}
-
-std::vector<const Config*> Display::getConfigs(const egl::AttributeMap &attribs) const
-{
- return mConfigSet.filter(attribs);
-}
-
-Error Display::createWindowSurface(const Config *configuration,
- EGLNativeWindowType window,
- const AttributeMap &attribs,
- Surface **outSurface)
-{
- if (mImplementation->testDeviceLost())
- {
- ANGLE_TRY(restoreLostDevice());
- }
-
- SurfacePointer surface(new WindowSurface(mImplementation, configuration, window, attribs),
- this);
- ANGLE_TRY(surface->initialize(this));
-
- ASSERT(outSurface != nullptr);
- *outSurface = surface.release();
- mState.surfaceSet.insert(*outSurface);
-
- WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
- ASSERT(windowSurfaces && windowSurfaces->find(window) == windowSurfaces->end());
- windowSurfaces->insert(std::make_pair(window, *outSurface));
-
- return NoError();
-}
-
-Error Display::createPbufferSurface(const Config *configuration,
- const AttributeMap &attribs,
- Surface **outSurface)
-{
- ASSERT(isInitialized());
-
- if (mImplementation->testDeviceLost())
- {
- ANGLE_TRY(restoreLostDevice());
- }
-
- SurfacePointer surface(new PbufferSurface(mImplementation, configuration, attribs), this);
- ANGLE_TRY(surface->initialize(this));
-
- ASSERT(outSurface != nullptr);
- *outSurface = surface.release();
- mState.surfaceSet.insert(*outSurface);
-
- return NoError();
-}
-
-Error Display::createPbufferFromClientBuffer(const Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const AttributeMap &attribs,
- Surface **outSurface)
-{
- ASSERT(isInitialized());
-
- if (mImplementation->testDeviceLost())
- {
- ANGLE_TRY(restoreLostDevice());
- }
-
- SurfacePointer surface(
- new PbufferSurface(mImplementation, configuration, buftype, clientBuffer, attribs), this);
- ANGLE_TRY(surface->initialize(this));
-
- ASSERT(outSurface != nullptr);
- *outSurface = surface.release();
- mState.surfaceSet.insert(*outSurface);
-
- return NoError();
-}
-
-Error Display::createPixmapSurface(const Config *configuration,
- NativePixmapType nativePixmap,
- const AttributeMap &attribs,
- Surface **outSurface)
-{
- ASSERT(isInitialized());
-
- if (mImplementation->testDeviceLost())
- {
- ANGLE_TRY(restoreLostDevice());
- }
-
- SurfacePointer surface(new PixmapSurface(mImplementation, configuration, nativePixmap, attribs),
- this);
- ANGLE_TRY(surface->initialize(this));
-
- ASSERT(outSurface != nullptr);
- *outSurface = surface.release();
- mState.surfaceSet.insert(*outSurface);
-
- return NoError();
-}
-
-Error Display::createImage(const gl::Context *context,
- EGLenum target,
- EGLClientBuffer buffer,
- const AttributeMap &attribs,
- Image **outImage)
-{
- ASSERT(isInitialized());
-
- if (mImplementation->testDeviceLost())
- {
- ANGLE_TRY(restoreLostDevice());
- }
-
- egl::ImageSibling *sibling = nullptr;
- if (IsTextureTarget(target))
- {
- sibling = context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
- }
- else if (IsRenderbufferTarget(target))
- {
- sibling = context->getRenderbuffer(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
- }
- else
- {
- UNREACHABLE();
- }
- ASSERT(sibling != nullptr);
-
- angle::UniqueObjectPointer<Image, gl::Context> imagePtr(
- new Image(mImplementation, target, sibling, attribs), context);
- ANGLE_TRY(imagePtr->initialize());
-
- Image *image = imagePtr.release();
-
- ASSERT(outImage != nullptr);
- *outImage = image;
-
- // Add this image to the list of all images and hold a ref to it.
- image->addRef();
- mImageSet.insert(image);
-
- return NoError();
-}
-
-Error Display::createStream(const AttributeMap &attribs, Stream **outStream)
-{
- ASSERT(isInitialized());
-
- Stream *stream = new Stream(this, attribs);
-
- ASSERT(stream != nullptr);
- mStreamSet.insert(stream);
-
- ASSERT(outStream != nullptr);
- *outStream = stream;
-
- return NoError();
-}
-
-Error Display::createContext(const Config *configuration,
- gl::Context *shareContext,
- const AttributeMap &attribs,
- gl::Context **outContext)
-{
- ASSERT(isInitialized());
-
- if (mImplementation->testDeviceLost())
- {
- ANGLE_TRY(restoreLostDevice());
- }
-
- // This display texture sharing will allow the first context to create the texture share group.
- bool usingDisplayTextureShareGroup =
- attribs.get(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE, EGL_FALSE) == EGL_TRUE;
- gl::TextureManager *shareTextures = nullptr;
-
- if (usingDisplayTextureShareGroup)
- {
- ASSERT((mTextureManager == nullptr) == (mGlobalTextureShareGroupUsers == 0));
- if (mTextureManager == nullptr)
- {
- mTextureManager = new gl::TextureManager();
- }
-
- mGlobalTextureShareGroupUsers++;
- shareTextures = mTextureManager;
- }
-
- gl::MemoryProgramCache *cachePointer = &mMemoryProgramCache;
-
- // Check context creation attributes to see if we should enable the cache.
- if (mAttributeMap.get(EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE, EGL_TRUE) == EGL_FALSE)
- {
- cachePointer = nullptr;
- }
-
- // A program cache size of zero indicates it should be disabled.
- if (mMemoryProgramCache.maxSize() == 0)
- {
- cachePointer = nullptr;
- }
-
- gl::Context *context =
- new gl::Context(mImplementation, configuration, shareContext, shareTextures, cachePointer,
- attribs, mDisplayExtensions);
-
- ASSERT(context != nullptr);
- mContextSet.insert(context);
-
- ASSERT(outContext != nullptr);
- *outContext = context;
- return NoError();
-}
-
-Error Display::makeCurrent(egl::Surface *drawSurface,
- egl::Surface *readSurface,
- gl::Context *context)
-{
- ANGLE_TRY(mImplementation->makeCurrent(drawSurface, readSurface, context));
-
- if (context != nullptr)
- {
- ASSERT(readSurface == drawSurface);
- ANGLE_TRY(context->makeCurrent(this, drawSurface));
- }
-
- return NoError();
-}
-
-Error Display::restoreLostDevice()
-{
- for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
- {
- if ((*ctx)->isResetNotificationEnabled())
- {
- // If reset notifications have been requested, application must delete all contexts first
- return EglContextLost();
- }
- }
-
- return mImplementation->restoreLostDevice(this);
-}
-
-Error Display::destroySurface(Surface *surface)
-{
- if (surface->getType() == EGL_WINDOW_BIT)
- {
- WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
- ASSERT(windowSurfaces);
-
- bool surfaceRemoved = false;
- for (WindowSurfaceMap::iterator iter = windowSurfaces->begin(); iter != windowSurfaces->end(); iter++)
- {
- if (iter->second == surface)
- {
- windowSurfaces->erase(iter);
- surfaceRemoved = true;
- break;
- }
- }
-
- ASSERT(surfaceRemoved);
- }
-
- mState.surfaceSet.erase(surface);
- ANGLE_TRY(surface->onDestroy(this));
- return NoError();
-}
-
-void Display::destroyImage(egl::Image *image)
-{
- auto iter = mImageSet.find(image);
- ASSERT(iter != mImageSet.end());
- (*iter)->release(mProxyContext.get());
- mImageSet.erase(iter);
-}
-
-void Display::destroyStream(egl::Stream *stream)
-{
- mStreamSet.erase(stream);
- SafeDelete(stream);
-}
-
-Error Display::destroyContext(gl::Context *context)
-{
- if (context->usingDisplayTextureShareGroup())
- {
- ASSERT(mGlobalTextureShareGroupUsers >= 1 && mTextureManager != nullptr);
- if (mGlobalTextureShareGroupUsers == 1)
- {
- // If this is the last context using the global share group, destroy the global texture
- // manager so that the textures can be destroyed while a context still exists
- mTextureManager->release(context);
- mTextureManager = nullptr;
- }
- mGlobalTextureShareGroupUsers--;
- }
-
- ANGLE_TRY(context->onDestroy(this));
- mContextSet.erase(context);
- SafeDelete(context);
- return NoError();
-}
-
-bool Display::isDeviceLost() const
-{
- ASSERT(isInitialized());
- return mDeviceLost;
-}
-
-bool Display::testDeviceLost()
-{
- ASSERT(isInitialized());
-
- if (!mDeviceLost && mImplementation->testDeviceLost())
- {
- notifyDeviceLost();
- }
-
- return mDeviceLost;
-}
-
-void Display::notifyDeviceLost()
-{
- if (mDeviceLost)
- {
- return;
- }
-
- for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end(); context++)
- {
- (*context)->markContextLost();
- }
-
- mDeviceLost = true;
-}
-
-Error Display::waitClient(const gl::Context *context) const
-{
- return mImplementation->waitClient(context);
-}
-
-Error Display::waitNative(const gl::Context *context, EGLint engine) const
-{
- return mImplementation->waitNative(context, engine);
-}
-
-const Caps &Display::getCaps() const
-{
- return mCaps;
-}
-
-bool Display::isInitialized() const
-{
- return mInitialized;
-}
-
-bool Display::isValidConfig(const Config *config) const
-{
- return mConfigSet.contains(config);
-}
-
-bool Display::isValidContext(const gl::Context *context) const
-{
- return mContextSet.find(const_cast<gl::Context *>(context)) != mContextSet.end();
-}
-
-bool Display::isValidSurface(const Surface *surface) const
-{
- return mState.surfaceSet.find(const_cast<Surface *>(surface)) != mState.surfaceSet.end();
-}
-
-bool Display::isValidImage(const Image *image) const
-{
- return mImageSet.find(const_cast<Image *>(image)) != mImageSet.end();
-}
-
-bool Display::isValidStream(const Stream *stream) const
-{
- return mStreamSet.find(const_cast<Stream *>(stream)) != mStreamSet.end();
-}
-
-bool Display::hasExistingWindowSurface(EGLNativeWindowType window)
-{
- WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
- ASSERT(windowSurfaces);
-
- return windowSurfaces->find(window) != windowSurfaces->end();
-}
-
-static ClientExtensions GenerateClientExtensions()
-{
- ClientExtensions extensions;
-
- extensions.clientExtensions = true;
- extensions.platformBase = true;
- extensions.platformANGLE = true;
-
-#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
- extensions.platformANGLED3D = true;
- extensions.platformDevice = true;
-#endif
-
-#if defined(ANGLE_ENABLE_OPENGL)
- extensions.platformANGLEOpenGL = true;
-#endif
-
-#if defined(ANGLE_ENABLE_NULL)
- extensions.platformANGLENULL = true;
-#endif
-
-#if defined(ANGLE_ENABLE_D3D11)
- extensions.deviceCreation = true;
- extensions.deviceCreationD3D11 = true;
- extensions.experimentalPresentPath = true;
-#endif
-
-#if defined(ANGLE_ENABLE_VULKAN)
- extensions.platformANGLEVulkan = true;
-#endif
-
-#if defined(ANGLE_USE_X11)
- extensions.x11Visual = true;
-#endif
-
- extensions.clientGetAllProcAddresses = true;
-
- return extensions;
-}
-
-template <typename T>
-static std::string GenerateExtensionsString(const T &extensions)
-{
- std::vector<std::string> extensionsVector = extensions.getStrings();
-
- std::ostringstream stream;
- std::copy(extensionsVector.begin(), extensionsVector.end(), std::ostream_iterator<std::string>(stream, " "));
- return stream.str();
-}
-
-// static
-const ClientExtensions &Display::GetClientExtensions()
-{
- static const ClientExtensions clientExtensions = GenerateClientExtensions();
- return clientExtensions;
-}
-
-// static
-const std::string &Display::GetClientExtensionString()
-{
- static const std::string clientExtensionsString =
- GenerateExtensionsString(GetClientExtensions());
- return clientExtensionsString;
-}
-
-void Display::initDisplayExtensions()
-{
- mDisplayExtensions = mImplementation->getExtensions();
-
- // Some extensions are always available because they are implemented in the EGL layer.
- mDisplayExtensions.createContext = true;
- mDisplayExtensions.createContextNoError = true;
- mDisplayExtensions.createContextWebGLCompatibility = true;
- mDisplayExtensions.createContextBindGeneratesResource = true;
- mDisplayExtensions.createContextClientArrays = true;
- mDisplayExtensions.pixelFormatFloat = true;
-
- // Force EGL_KHR_get_all_proc_addresses on.
- mDisplayExtensions.getAllProcAddresses = true;
-
- // Enable program cache control since it is not back-end dependent.
- mDisplayExtensions.programCacheControl = true;
-
- mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions);
-}
-
-bool Display::isValidNativeWindow(EGLNativeWindowType window) const
-{
- return mImplementation->isValidNativeWindow(window);
-}
-
-Error Display::validateClientBuffer(const Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const AttributeMap &attribs)
-{
- return mImplementation->validateClientBuffer(configuration, buftype, clientBuffer, attribs);
-}
-
-bool Display::isValidDisplay(const egl::Display *display)
-{
- const ANGLEPlatformDisplayMap *anglePlatformDisplayMap = GetANGLEPlatformDisplayMap();
- for (const auto &displayPair : *anglePlatformDisplayMap)
- {
- if (displayPair.second == display)
- {
- return true;
- }
- }
-
- const DevicePlatformDisplayMap *devicePlatformDisplayMap = GetDevicePlatformDisplayMap();
- for (const auto &displayPair : *devicePlatformDisplayMap)
- {
- if (displayPair.second == display)
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool Display::isValidNativeDisplay(EGLNativeDisplayType display)
-{
- // TODO(jmadill): handle this properly
- if (display == EGL_DEFAULT_DISPLAY)
- {
- return true;
- }
-
-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_STORE)
- if (display == EGL_SOFTWARE_DISPLAY_ANGLE ||
- display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
- display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
- {
- return true;
- }
- return (WindowFromDC(display) != nullptr);
-#else
- return true;
-#endif
-}
-
-void Display::initVendorString()
-{
- mVendorString = mImplementation->getVendorString();
-}
-
-const DisplayExtensions &Display::getExtensions() const
-{
- return mDisplayExtensions;
-}
-
-const std::string &Display::getExtensionString() const
-{
- return mDisplayExtensionString;
-}
-
-const std::string &Display::getVendorString() const
-{
- return mVendorString;
-}
-
-Device *Display::getDevice() const
-{
- return mDevice;
-}
-
-gl::Version Display::getMaxSupportedESVersion() const
-{
- return mImplementation->getMaxSupportedESVersion();
-}
-
-EGLint Display::programCacheGetAttrib(EGLenum attrib) const
-{
- switch (attrib)
- {
- case EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE:
- return static_cast<EGLint>(gl::kProgramHashLength);
-
- case EGL_PROGRAM_CACHE_SIZE_ANGLE:
- return static_cast<EGLint>(mMemoryProgramCache.entryCount());
-
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-Error Display::programCacheQuery(EGLint index,
- void *key,
- EGLint *keysize,
- void *binary,
- EGLint *binarysize)
-{
- ASSERT(index >= 0 && index < static_cast<EGLint>(mMemoryProgramCache.entryCount()));
-
- const angle::MemoryBuffer *programBinary = nullptr;
- gl::ProgramHash programHash;
- // TODO(jmadill): Make this thread-safe.
- bool result =
- mMemoryProgramCache.getAt(static_cast<size_t>(index), &programHash, &programBinary);
- if (!result)
- {
- return EglBadAccess() << "Program binary not accessible.";
- }
-
- ASSERT(keysize && binarysize);
-
- if (key)
- {
- ASSERT(*keysize == static_cast<EGLint>(gl::kProgramHashLength));
- memcpy(key, programHash.data(), gl::kProgramHashLength);
- }
-
- if (binary)
- {
- // Note: we check the size here instead of in the validation code, since we need to
- // access the cache as atomically as possible. It's possible that the cache contents
- // could change between the validation size check and the retrieval.
- if (programBinary->size() > static_cast<size_t>(*binarysize))
- {
- return EglBadAccess() << "Program binary too large or changed during access.";
- }
-
- memcpy(binary, programBinary->data(), programBinary->size());
- }
-
- *binarysize = static_cast<EGLint>(programBinary->size());
- *keysize = static_cast<EGLint>(gl::kProgramHashLength);
-
- return NoError();
-}
-
-Error Display::programCachePopulate(const void *key,
- EGLint keysize,
- const void *binary,
- EGLint binarysize)
-{
- ASSERT(keysize == static_cast<EGLint>(gl::kProgramHashLength));
-
- gl::ProgramHash programHash;
- memcpy(programHash.data(), key, gl::kProgramHashLength);
-
- mMemoryProgramCache.putBinary(programHash, reinterpret_cast<const uint8_t *>(binary),
- static_cast<size_t>(binarysize));
- return NoError();
-}
-
-EGLint Display::programCacheResize(EGLint limit, EGLenum mode)
-{
- switch (mode)
- {
- case EGL_PROGRAM_CACHE_RESIZE_ANGLE:
- {
- size_t initialSize = mMemoryProgramCache.size();
- mMemoryProgramCache.resize(static_cast<size_t>(limit));
- return static_cast<EGLint>(initialSize);
- }
-
- case EGL_PROGRAM_CACHE_TRIM_ANGLE:
- return static_cast<EGLint>(mMemoryProgramCache.trim(static_cast<size_t>(limit)));
-
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Display.h b/src/3rdparty/angle/src/libANGLE/Display.h
deleted file mode 100644
index 2a1c386d75..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Display.h
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// Copyright (c) 2002-2013 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.
-//
-
-// Display.h: Defines the egl::Display class, representing the abstract
-// display on which graphics are drawn. Implements EGLDisplay.
-// [EGL 1.4] section 2.1.2 page 3.
-
-#ifndef LIBANGLE_DISPLAY_H_
-#define LIBANGLE_DISPLAY_H_
-
-#include <set>
-#include <vector>
-
-#include "libANGLE/AttributeMap.h"
-#include "libANGLE/Caps.h"
-#include "libANGLE/Config.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/LoggingAnnotator.h"
-#include "libANGLE/MemoryProgramCache.h"
-#include "libANGLE/Version.h"
-
-namespace gl
-{
-class Context;
-class TextureManager;
-}
-
-namespace rx
-{
-class DisplayImpl;
-}
-
-namespace egl
-{
-class Device;
-class Image;
-class Surface;
-class Stream;
-class Thread;
-
-using SurfaceSet = std::set<Surface *>;
-
-struct DisplayState final : private angle::NonCopyable
-{
- DisplayState();
- ~DisplayState();
-
- SurfaceSet surfaceSet;
-};
-
-// Constant coded here as a sanity limit.
-constexpr EGLAttrib kProgramCacheSizeAbsoluteMax = 0x4000000;
-
-class Display final : angle::NonCopyable
-{
- public:
- ~Display();
-
- Error initialize();
- Error terminate();
-
- static Display *GetDisplayFromDevice(Device *device, const AttributeMap &attribMap);
- static Display *GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
- const AttributeMap &attribMap);
- static void CleanupDisplays();
-
- static const ClientExtensions &GetClientExtensions();
- static const std::string &GetClientExtensionString();
-
- std::vector<const Config *> getConfigs(const AttributeMap &attribs) const;
-
- Error createWindowSurface(const Config *configuration,
- EGLNativeWindowType window,
- const AttributeMap &attribs,
- Surface **outSurface);
- Error createPbufferSurface(const Config *configuration,
- const AttributeMap &attribs,
- Surface **outSurface);
- Error createPbufferFromClientBuffer(const Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const AttributeMap &attribs,
- Surface **outSurface);
- Error createPixmapSurface(const Config *configuration,
- NativePixmapType nativePixmap,
- const AttributeMap &attribs,
- Surface **outSurface);
-
- Error createImage(const gl::Context *context,
- EGLenum target,
- EGLClientBuffer buffer,
- const AttributeMap &attribs,
- Image **outImage);
-
- Error createStream(const AttributeMap &attribs, Stream **outStream);
-
- Error createContext(const Config *configuration,
- gl::Context *shareContext,
- const AttributeMap &attribs,
- gl::Context **outContext);
-
- Error makeCurrent(Surface *drawSurface, Surface *readSurface, gl::Context *context);
-
- Error destroySurface(Surface *surface);
- void destroyImage(Image *image);
- void destroyStream(Stream *stream);
- Error destroyContext(gl::Context *context);
-
- bool isInitialized() const;
- bool isValidConfig(const Config *config) const;
- bool isValidContext(const gl::Context *context) const;
- bool isValidSurface(const Surface *surface) const;
- bool isValidImage(const Image *image) const;
- bool isValidStream(const Stream *stream) const;
- bool isValidNativeWindow(EGLNativeWindowType window) const;
-
- Error validateClientBuffer(const Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const AttributeMap &attribs);
-
- static bool isValidDisplay(const Display *display);
- static bool isValidNativeDisplay(EGLNativeDisplayType display);
- static bool hasExistingWindowSurface(EGLNativeWindowType window);
-
- bool isDeviceLost() const;
- bool testDeviceLost();
- void notifyDeviceLost();
-
- Error waitClient(const gl::Context *context) const;
- Error waitNative(const gl::Context *context, EGLint engine) const;
-
- const Caps &getCaps() const;
-
- const DisplayExtensions &getExtensions() const;
- const std::string &getExtensionString() const;
- const std::string &getVendorString() const;
-
- EGLint programCacheGetAttrib(EGLenum attrib) const;
- Error programCacheQuery(EGLint index,
- void *key,
- EGLint *keysize,
- void *binary,
- EGLint *binarysize);
- Error programCachePopulate(const void *key,
- EGLint keysize,
- const void *binary,
- EGLint binarysize);
- EGLint programCacheResize(EGLint limit, EGLenum mode);
-
- const AttributeMap &getAttributeMap() const { return mAttributeMap; }
- EGLNativeDisplayType getNativeDisplayId() const { return mDisplayId; }
-
- rx::DisplayImpl *getImplementation() const { return mImplementation; }
- Device *getDevice() const;
- EGLenum getPlatform() const { return mPlatform; }
-
- gl::Version getMaxSupportedESVersion() const;
-
- const DisplayState &getState() const { return mState; }
-
- gl::Context *getProxyContext() const { return mProxyContext.get(); }
-
- private:
- Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
-
- void setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap);
-
- Error restoreLostDevice();
-
- void initDisplayExtensions();
- void initVendorString();
-
- DisplayState mState;
- rx::DisplayImpl *mImplementation;
-
- EGLNativeDisplayType mDisplayId;
- AttributeMap mAttributeMap;
-
- ConfigSet mConfigSet;
-
- typedef std::set<gl::Context*> ContextSet;
- ContextSet mContextSet;
-
- typedef std::set<Image *> ImageSet;
- ImageSet mImageSet;
-
- typedef std::set<Stream *> StreamSet;
- StreamSet mStreamSet;
-
- bool mInitialized;
- bool mDeviceLost;
-
- Caps mCaps;
-
- DisplayExtensions mDisplayExtensions;
- std::string mDisplayExtensionString;
-
- std::string mVendorString;
-
- Device *mDevice;
- EGLenum mPlatform;
- angle::LoggingAnnotator mAnnotator;
-
- gl::TextureManager *mTextureManager;
- gl::MemoryProgramCache mMemoryProgramCache;
- size_t mGlobalTextureShareGroupUsers;
-
- // This gl::Context is a simple proxy to the Display for the GL back-end entry points
- // that need access to implementation-specific data, like a Renderer object.
- angle::UniqueObjectPointer<gl::Context, Display> mProxyContext;
-};
-
-} // namespace egl
-
-#endif // LIBANGLE_DISPLAY_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Error.cpp b/src/3rdparty/angle/src/libANGLE/Error.cpp
deleted file mode 100644
index 388f0259fa..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Error.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Copyright (c) 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.
-//
-
-// Error.cpp: Implements the egl::Error and gl::Error classes which encapsulate API errors
-// and optional error messages.
-
-#include "libANGLE/Error.h"
-
-#include "common/angleutils.h"
-#include "common/debug.h"
-#include "common/utilities.h"
-
-#include <cstdarg>
-
-namespace
-{
-std::unique_ptr<std::string> EmplaceErrorString(std::string &&message)
-{
- return message.empty() ? std::unique_ptr<std::string>()
- : std::unique_ptr<std::string>(new std::string(std::move(message)));
-}
-} // anonymous namespace
-
-namespace gl
-{
-
-Error::Error(GLenum errorCode, std::string &&message)
- : mCode(errorCode), mID(errorCode), mMessage(EmplaceErrorString(std::move(message)))
-{
-}
-
-Error::Error(GLenum errorCode, GLuint id, std::string &&message)
- : mCode(errorCode), mID(id), mMessage(EmplaceErrorString(std::move(message)))
-{
-}
-
-void Error::createMessageString() const
-{
- if (!mMessage)
- {
- mMessage.reset(new std::string(GetGenericErrorMessage(mCode)));
- }
-}
-
-const std::string &Error::getMessage() const
-{
- createMessageString();
- return *mMessage;
-}
-
-bool Error::operator==(const Error &other) const
-{
- if (mCode != other.mCode)
- return false;
-
- // TODO(jmadill): Compare extended error codes instead of strings.
- if ((!mMessage || !other.mMessage) && (!mMessage != !other.mMessage))
- return false;
-
- return (*mMessage == *other.mMessage);
-}
-
-bool Error::operator!=(const Error &other) const
-{
- return !(*this == other);
-}
-
-std::ostream &operator<<(std::ostream &os, const Error &err)
-{
- return gl::FmtHexShort(os, err.getCode());
-}
-
-} // namespace gl
-
-namespace egl
-{
-
-Error::Error(EGLint errorCode, std::string &&message)
- : mCode(errorCode), mID(errorCode), mMessage(EmplaceErrorString(std::move(message)))
-{
-}
-
-Error::Error(EGLint errorCode, EGLint id, std::string &&message)
- : mCode(errorCode), mID(id), mMessage(EmplaceErrorString(std::move(message)))
-{
-}
-
-void Error::createMessageString() const
-{
- if (!mMessage)
- {
- mMessage.reset(new std::string(GetGenericErrorMessage(mCode)));
- }
-}
-
-const std::string &Error::getMessage() const
-{
- createMessageString();
- return *mMessage;
-}
-
-std::ostream &operator<<(std::ostream &os, const Error &err)
-{
- return gl::FmtHexShort(os, err.getCode());
-}
-
-} // namespace egl
diff --git a/src/3rdparty/angle/src/libANGLE/Error.h b/src/3rdparty/angle/src/libANGLE/Error.h
deleted file mode 100644
index 1d57bb8707..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Error.h
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// Copyright (c) 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.
-
-// Error.h: Defines the egl::Error and gl::Error classes which encapsulate API errors
-// and optional error messages.
-
-#ifndef LIBANGLE_ERROR_H_
-#define LIBANGLE_ERROR_H_
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include "angle_gl.h"
-#include "common/angleutils.h"
-#include "common/debug.h"
-
-#include <memory>
-#include <ostream>
-#include <string>
-
-namespace angle
-{
-template <typename ErrorT, typename ResultT, typename ErrorBaseT, ErrorBaseT NoErrorVal>
-class ANGLE_NO_DISCARD ErrorOrResultBase
-{
- public:
- ErrorOrResultBase(const ErrorT &error) : mError(error) {}
- ErrorOrResultBase(ErrorT &&error) : mError(std::move(error)) {}
-
- ErrorOrResultBase(ResultT &&result) : mError(NoErrorVal), mResult(std::forward<ResultT>(result))
- {
- }
-
- ErrorOrResultBase(const ResultT &result) : mError(NoErrorVal), mResult(result) {}
-
- bool isError() const { return mError.isError(); }
- const ErrorT &getError() const { return mError; }
- ResultT &&getResult() { return std::move(mResult); }
-
- private:
- ErrorT mError;
- ResultT mResult;
-};
-
-template <typename ErrorT, typename ErrorBaseT, ErrorBaseT NoErrorVal, typename CodeT, CodeT EnumT>
-class ErrorStreamBase : angle::NonCopyable
-{
- public:
- ErrorStreamBase() : mID(EnumT) {}
- ErrorStreamBase(GLuint id) : mID(id) {}
-
- template <typename T>
- ErrorStreamBase &operator<<(T value)
- {
- mErrorStream << value;
- return *this;
- }
-
- operator ErrorT() { return ErrorT(EnumT, mID, mErrorStream.str()); }
-
- template <typename ResultT>
- operator ErrorOrResultBase<ErrorT, ResultT, ErrorBaseT, NoErrorVal>()
- {
- return static_cast<ErrorT>(*this);
- }
-
- private:
- GLuint mID;
- std::ostringstream mErrorStream;
-};
-} // namespace angle
-
-namespace egl
-{
-class Error;
-} // namespace egl
-
-namespace gl
-{
-
-class ANGLE_NO_DISCARD Error final
-{
- public:
- explicit inline Error(GLenum errorCode);
- Error(GLenum errorCode, std::string &&message);
- Error(GLenum errorCode, GLuint id, std::string &&message);
- inline Error(const Error &other);
- inline Error(Error &&other);
- inline ~Error() = default;
-
- // automatic error type conversion
- inline Error(egl::Error &&eglErr);
- inline Error(egl::Error eglErr);
-
- inline Error &operator=(const Error &other);
- inline Error &operator=(Error &&other);
-
- inline GLenum getCode() const;
- inline GLuint getID() const;
- inline bool isError() const;
-
- const std::string &getMessage() const;
-
- // Useful for mocking and testing
- bool operator==(const Error &other) const;
- bool operator!=(const Error &other) const;
-
- private:
- void createMessageString() const;
-
- friend std::ostream &operator<<(std::ostream &os, const Error &err);
- friend class egl::Error;
-
- GLenum mCode;
- GLuint mID;
- mutable std::unique_ptr<std::string> mMessage;
-};
-
-template <typename ResultT>
-using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, GLenum, GL_NO_ERROR>;
-
-namespace priv
-{
-
-template <GLenum EnumT>
-using ErrorStream = angle::ErrorStreamBase<Error, GLenum, GL_NO_ERROR, GLenum, EnumT>;
-
-} // namespace priv
-
-using InternalError = priv::ErrorStream<GL_INVALID_OPERATION>;
-
-using InvalidEnum = priv::ErrorStream<GL_INVALID_ENUM>;
-using InvalidValue = priv::ErrorStream<GL_INVALID_VALUE>;
-using InvalidOperation = priv::ErrorStream<GL_INVALID_OPERATION>;
-using StackOverflow = priv::ErrorStream<GL_STACK_OVERFLOW>;
-using StackUnderflow = priv::ErrorStream<GL_STACK_UNDERFLOW>;
-using OutOfMemory = priv::ErrorStream<GL_OUT_OF_MEMORY>;
-using InvalidFramebufferOperation = priv::ErrorStream<GL_INVALID_FRAMEBUFFER_OPERATION>;
-
-inline Error NoError()
-{
- return Error(GL_NO_ERROR);
-}
-
-using LinkResult = ErrorOrResult<bool>;
-
-} // namespace gl
-
-namespace egl
-{
-
-class ANGLE_NO_DISCARD Error final
-{
- public:
- explicit inline Error(EGLint errorCode);
- Error(EGLint errorCode, std::string &&message);
- Error(EGLint errorCode, EGLint id, std::string &&message);
- inline Error(const Error &other);
- inline Error(Error &&other);
- inline ~Error() = default;
-
- // automatic error type conversion
- inline Error(gl::Error &&glErr);
- inline Error(gl::Error glErr);
-
- inline Error &operator=(const Error &other);
- inline Error &operator=(Error &&other);
-
- inline EGLint getCode() const;
- inline EGLint getID() const;
- inline bool isError() const;
-
- const std::string &getMessage() const;
-
- private:
- void createMessageString() const;
-
- friend std::ostream &operator<<(std::ostream &os, const Error &err);
- friend class gl::Error;
-
- EGLint mCode;
- EGLint mID;
- mutable std::unique_ptr<std::string> mMessage;
-};
-
-template <typename ResultT>
-using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, EGLint, EGL_SUCCESS>;
-
-namespace priv
-{
-
-template <EGLint EnumT>
-using ErrorStream = angle::ErrorStreamBase<Error, EGLint, EGL_SUCCESS, EGLint, EnumT>;
-
-} // namespace priv
-
-using EglNotInitialized = priv::ErrorStream<EGL_NOT_INITIALIZED>;
-using EglBadAccess = priv::ErrorStream<EGL_BAD_ACCESS>;
-using EglBadAlloc = priv::ErrorStream<EGL_BAD_ALLOC>;
-using EglBadAttribute = priv::ErrorStream<EGL_BAD_ATTRIBUTE>;
-using EglBadConfig = priv::ErrorStream<EGL_BAD_CONFIG>;
-using EglBadContext = priv::ErrorStream<EGL_BAD_CONTEXT>;
-using EglBadCurrentSurface = priv::ErrorStream<EGL_BAD_CURRENT_SURFACE>;
-using EglBadDisplay = priv::ErrorStream<EGL_BAD_DISPLAY>;
-using EglBadMatch = priv::ErrorStream<EGL_BAD_MATCH>;
-using EglBadNativeWindow = priv::ErrorStream<EGL_BAD_NATIVE_WINDOW>;
-using EglBadParameter = priv::ErrorStream<EGL_BAD_PARAMETER>;
-using EglBadSurface = priv::ErrorStream<EGL_BAD_SURFACE>;
-using EglContextLost = priv::ErrorStream<EGL_CONTEXT_LOST>;
-using EglBadStream = priv::ErrorStream<EGL_BAD_STREAM_KHR>;
-using EglBadState = priv::ErrorStream<EGL_BAD_STATE_KHR>;
-using EglBadDevice = priv::ErrorStream<EGL_BAD_DEVICE_EXT>;
-
-inline Error NoError()
-{
- return Error(EGL_SUCCESS);
-}
-
-} // namespace egl
-
-#define ANGLE_CONCAT1(x, y) x##y
-#define ANGLE_CONCAT2(x, y) ANGLE_CONCAT1(x, y)
-#define ANGLE_LOCAL_VAR ANGLE_CONCAT2(_localVar, __LINE__)
-
-#define ANGLE_TRY_TEMPLATE(EXPR, FUNC) \
- { \
- auto ANGLE_LOCAL_VAR = EXPR; \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- FUNC(ANGLE_LOCAL_VAR); \
- } \
- } \
- ANGLE_EMPTY_STATEMENT
-
-#define ANGLE_RETURN(X) return X;
-#define ANGLE_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_RETURN);
-
-#define ANGLE_TRY_RESULT(EXPR, RESULT) \
- { \
- auto ANGLE_LOCAL_VAR = EXPR; \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- return ANGLE_LOCAL_VAR.getError(); \
- } \
- RESULT = ANGLE_LOCAL_VAR.getResult(); \
- } \
- ANGLE_EMPTY_STATEMENT
-
-// TODO(jmadill): Introduce way to store errors to a const Context.
-#define ANGLE_SWALLOW_ERR(EXPR) \
- { \
- auto ANGLE_LOCAL_VAR = EXPR; \
- if (ANGLE_LOCAL_VAR.isError()) \
- { \
- ERR() << "Unhandled internal error: " << ANGLE_LOCAL_VAR; \
- } \
- } \
- ANGLE_EMPTY_STATEMENT
-
-#undef ANGLE_LOCAL_VAR
-#undef ANGLE_CONCAT2
-#undef ANGLE_CONCAT1
-
-#include "Error.inl"
-
-#endif // LIBANGLE_ERROR_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Error.inl b/src/3rdparty/angle/src/libANGLE/Error.inl
deleted file mode 100644
index 4632830ce0..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Error.inl
+++ /dev/null
@@ -1,189 +0,0 @@
-//
-// Copyright (c) 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.
-
-// Error.inl: Inline definitions of egl::Error and gl::Error classes which encapsulate API errors
-// and optional error messages.
-
-#include "common/angleutils.h"
-
-#include <cstdarg>
-
-namespace gl
-{
-
-Error::Error(GLenum errorCode)
- : mCode(errorCode),
- mID(errorCode)
-{
-}
-
-Error::Error(const Error &other)
- : mCode(other.mCode),
- mID(other.mID)
-{
- if (other.mMessage)
- {
- createMessageString();
- *mMessage = *(other.mMessage);
- }
-}
-
-Error::Error(Error &&other)
- : mCode(other.mCode),
- mID(other.mID),
- mMessage(std::move(other.mMessage))
-{
-}
-
-// automatic error type conversion
-Error::Error(egl::Error &&eglErr)
- : mCode(GL_INVALID_OPERATION),
- mID(0),
- mMessage(std::move(eglErr.mMessage))
-{
-}
-
-Error::Error(egl::Error eglErr)
- : mCode(GL_INVALID_OPERATION),
- mID(0),
- mMessage(std::move(eglErr.mMessage))
-{
-}
-
-Error &Error::operator=(const Error &other)
-{
- mCode = other.mCode;
- mID = other.mID;
-
- if (other.mMessage)
- {
- createMessageString();
- *mMessage = *(other.mMessage);
- }
- else
- {
- mMessage.release();
- }
-
- return *this;
-}
-
-Error &Error::operator=(Error &&other)
-{
- if (this != &other)
- {
- mCode = other.mCode;
- mID = other.mID;
- mMessage = std::move(other.mMessage);
- }
-
- return *this;
-}
-
-GLenum Error::getCode() const
-{
- return mCode;
-}
-
-GLuint Error::getID() const
-{
- return mID;
-}
-
-bool Error::isError() const
-{
- return (mCode != GL_NO_ERROR);
-}
-
-} // namespace gl
-
-namespace egl
-{
-
-Error::Error(EGLint errorCode)
- : mCode(errorCode),
- mID(0)
-{
-}
-
-Error::Error(const Error &other)
- : mCode(other.mCode),
- mID(other.mID)
-{
- if (other.mMessage)
- {
- createMessageString();
- *mMessage = *(other.mMessage);
- }
-}
-
-Error::Error(Error &&other)
- : mCode(other.mCode),
- mID(other.mID),
- mMessage(std::move(other.mMessage))
-{
-}
-
-// automatic error type conversion
-Error::Error(gl::Error &&glErr)
- : mCode(EGL_BAD_ACCESS),
- mID(0),
- mMessage(std::move(glErr.mMessage))
-{
-}
-
-Error::Error(gl::Error glErr)
- : mCode(EGL_BAD_ACCESS),
- mID(0),
- mMessage(std::move(glErr.mMessage))
-{
-}
-
-Error &Error::operator=(const Error &other)
-{
- mCode = other.mCode;
- mID = other.mID;
-
- if (other.mMessage)
- {
- createMessageString();
- *mMessage = *(other.mMessage);
- }
- else
- {
- mMessage.release();
- }
-
- return *this;
-}
-
-Error &Error::operator=(Error &&other)
-{
- if (this != &other)
- {
- mCode = other.mCode;
- mID = other.mID;
- mMessage = std::move(other.mMessage);
- }
-
- return *this;
-}
-
-EGLint Error::getCode() const
-{
- return mCode;
-}
-
-EGLint Error::getID() const
-{
- return mID;
-}
-
-bool Error::isError() const
-{
- return (mCode != EGL_SUCCESS);
-}
-
-}
diff --git a/src/3rdparty/angle/src/libANGLE/ErrorStrings.h b/src/3rdparty/angle/src/libANGLE/ErrorStrings.h
deleted file mode 100644
index 93d64482d9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/ErrorStrings.h
+++ /dev/null
@@ -1,173 +0,0 @@
-//
-// Copyright (c) 2017 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.
-//
-
-// ErrorStrings.h: Contains mapping of commonly used error messages
-
-#ifndef LIBANGLE_ERRORSTRINGS_H_
-#define LIBANGLE_ERRORSTRINGS_H_
-
-#define ERRMSG(name, message) \
- static const constexpr char *kError##name = static_cast<const char *>(message);
-#define ANGLE_VALIDATION_ERR(context, error, errorName) \
- context->handleError(error << kError##errorName)
-
-namespace gl
-{
-ERRMSG(BufferNotBound, "A buffer must be bound.");
-ERRMSG(CompressedTextureDimensionsMustMatchData,
- "Compressed texture dimensions must exactly match the dimensions of the data passed in.");
-ERRMSG(CompressedTexturesNotAttachable, "Compressed textures cannot be attached to a framebuffer.");
-ERRMSG(CubemapFacesEqualDimensions, "Each cubemap face must have equal width and height.");
-ERRMSG(CubemapIncomplete,
- "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size.");
-ERRMSG(DefaultFramebufferInvalidAttachment,
- "Invalid attachment when the default framebuffer is bound.");
-ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachments");
-ERRMSG(EnumNotSupported, "Enum is not currently supported.");
-ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1");
-ERRMSG(ES31Required, "OpenGL ES 3.1 Required");
-ERRMSG(ES3Required, "OpenGL ES 3.0 Required.");
-ERRMSG(ExceedsMaxElement, "Element value exceeds maximum element index.");
-ERRMSG(ExpectedProgramName, "Expected a program name, but found a shader name.");
-ERRMSG(ExpectedShaderName, "Expected a shader name, but found a program name.");
-ERRMSG(ExtensionNotEnabled, "Extension is not enabled.");
-ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Texture.");
-ERRMSG(FramebufferIncompleteAttachment,
- "Attachment type must be compatible with attachment object.");
-ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation.");
-ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count.");
-ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS.");
-ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS.");
-ERRMSG(InsufficientBufferSize, "Insufficient buffer size.");
-ERRMSG(InsufficientVertexBufferSize, "Vertex buffer is not big enough for the draw call");
-ERRMSG(IntegerOverflow, "Integer overflow.");
-ERRMSG(InvalidAttachment, "Invalid Attachment Type.");
-ERRMSG(InvalidBlendEquation, "Invalid blend equation.");
-ERRMSG(InvalidBlendFunction, "Invalid blend function.");
-ERRMSG(InvalidBorder, "Border must be 0.");
-ERRMSG(InvalidBufferTypes, "Invalid buffer target enum.");
-ERRMSG(InvalidBufferUsage, "Invalid buffer usage enum.");
-ERRMSG(InvalidClearMask, "Invalid mask bits.");
-ERRMSG(InvalidConstantColor,
- "CONSTANT_COLOR (or ONE_MINUS_CONSTANT_COLOR) and CONSTANT_ALPHA (or "
- "ONE_MINUS_CONSTANT_ALPHA) cannot be used together as source and destination factors in the "
- "blend function.");
-ERRMSG(InvalidCoverMode, "Invalid cover mode.");
-ERRMSG(InvalidCullMode, "Cull mode not recognized.");
-ERRMSG(InvalidDebugSeverity, "Invalid debug severity.");
-ERRMSG(InvalidDebugSource, "Invalid debug source.");
-ERRMSG(InvalidDebugType, "Invalid debug type.");
-ERRMSG(InvalidDepthRange, "Near value cannot be greater than far.");
-ERRMSG(InvalidDrawMode, "Invalid draw mode.");
-ERRMSG(InvalidDrawModeTransformFeedback,
- "Draw mode must match current transform feedback object's draw mode.");
-ERRMSG(InvalidFillMode, "Invalid fill mode.");
-ERRMSG(InvalidFilterTexture, "Texture only supports NEAREST and LINEAR filtering.");
-ERRMSG(InvalidFormat, "Invalid format.");
-ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target.");
-ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture.");
-ERRMSG(InvalidFramebufferAttachmentParameter, "Invalid parameter name for framebuffer attachment.");
-ERRMSG(InvalidInternalFormat, "Invalid internal format.");
-ERRMSG(InvalidMatrixMode, "Invalid matrix mode.");
-ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
-ERRMSG(InvalidName, "Invalid name.");
-ERRMSG(InvalidNameCharacters, "Name contains invalid characters.");
-ERRMSG(InvalidPname, "Invalid pname.");
-ERRMSG(InvalidPrecision, "Invalid or unsupported precision type.");
-ERRMSG(InvalidProgramName, "Program object expected.");
-ERRMSG(InvalidQueryId, "Invalid query Id.");
-ERRMSG(InvalidQueryTarget, "Invalid query target.");
-ERRMSG(InvalidQueryType, "Invalid query type.");
-ERRMSG(InvalidRange, "Invalid range.");
-ERRMSG(InvalidRenderbufferInternalFormat, "Invalid renderbuffer internalformat.");
-ERRMSG(InvalidRenderbufferTarget, "Invalid renderbuffer target.");
-ERRMSG(InvalidRenderbufferTextureParameter, "Invalid parameter name for renderbuffer attachment.");
-ERRMSG(InvalidRenderbufferWidthHeight,
- "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size.");
-ERRMSG(InvalidSampleMaskNumber,
- "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS.");
-ERRMSG(InvalidSampler, "Sampler is not valid");
-ERRMSG(InvalidShaderName, "Shader object expected.");
-ERRMSG(InvalidShaderType, "Invalid shader type.");
-ERRMSG(InvalidStencil, "Invalid stencil.");
-ERRMSG(InvalidStencilBitMask, "Invalid stencil bit mask.");
-ERRMSG(InvalidTarget, "Invalid target.");
-ERRMSG(InvalidTextureFilterParam, "Texture filter not recognized.");
-ERRMSG(InvalidTextureRange, "Cannot be less than 0 or greater than maximum number of textures.");
-ERRMSG(InvalidTextureTarget, "Invalid or unsupported texture target.");
-ERRMSG(InvalidTextureWrap, "Texture wrap mode not recognized.");
-ERRMSG(InvalidType, "Invalid type.");
-ERRMSG(InvalidTypePureInt, "Invalid type, should be integer");
-ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8.");
-ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4.");
-ERRMSG(InvalidWidth, "Invalid width.");
-ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type.");
-ERRMSG(LevelNotZero, "Texture level must be zero.");
-ERRMSG(MismatchedByteCountType, "Buffer size does not align with data type.");
-ERRMSG(MismatchedFormat, "Format must match internal format.");
-ERRMSG(MismatchedTargetAndFormat, "Invalid texture target and format combination.");
-ERRMSG(MismatchedTypeAndFormat, "Invalid format and type combination.");
-ERRMSG(MismatchedVariableProgram, "Variable is not part of the current program.");
-ERRMSG(MissingReadAttachment, "Missing read attachment.");
-ERRMSG(MustHaveElementArrayBinding, "Must have element array buffer binding.");
-ERRMSG(NameBeginsWithGL, "Attributes that begin with 'gl_' are not allowed.");
-ERRMSG(NegativeAttachments, "Negative number of attachments.");
-ERRMSG(NegativeBufferSize, "Negative buffer size.");
-ERRMSG(NegativeCount, "Negative count.");
-ERRMSG(NegativeLength, "Negative length.");
-ERRMSG(NegativeMaxCount, "Negative maxcount.");
-ERRMSG(NegativeOffset, "Negative offset.");
-ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero.");
-ERRMSG(NegativeSize, "Cannot have negative height or width.");
-ERRMSG(NegativeStart, "Cannot have negative start.");
-ERRMSG(NegativeStride, "Cannot have negative stride.");
-ERRMSG(NoSuchPath, "No such path object.");
-ERRMSG(NoTransformFeedbackOutputVariables,
- "The active program has specified no output variables to record.");
-ERRMSG(NoZeroDivisor, "At least one enabled attribute must have a divisor of zero.");
-ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated.");
-ERRMSG(OffsetMustBeMultipleOfType, "Offset must be a multiple of the passed in datatype.");
-ERRMSG(OutsideOfBounds, "Parameter outside of bounds.");
-ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer.");
-ERRMSG(PixelDataNotNull, "Pixel data must be null.");
-ERRMSG(PixelDataNull, "Pixel data cannot be null.");
-ERRMSG(ProgramDoesNotExist, "Program doesn't exist.");
-ERRMSG(ProgramNotBound, "A program must be bound.");
-ERRMSG(ProgramNotLinked, "Program not linked.");
-ERRMSG(QueryActive, "Query is active.");
-ERRMSG(QueryExtensionNotEnabled, "Query extension not enabled.");
-ERRMSG(ReadBufferNone, "Read buffer is GL_NONE.");
-ERRMSG(RenderbufferNotBound, "A renderbuffer must be bound.");
-ERRMSG(ResourceMaxTextureSize, "Desired resource size is greater than max texture size.");
-ERRMSG(ShaderAttachmentHasShader, "Shader attachment already has a shader.");
-ERRMSG(ShaderSourceInvalidCharacters, "Shader source contains invalid characters.");
-ERRMSG(ShaderToDetachMustBeAttached,
- "Shader to be detached must be currently attached to the program.");
-ERRMSG(SourceTextureTooSmall, "The specified dimensions are outside of the bounds of the texture.");
-ERRMSG(StencilReferenceMaskOrMismatch,
- "Stencil reference and mask values must be the same for front facing and back facing "
- "triangles.");
-ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype.");
-ERRMSG(TextureNotBound, "A texture must be bound.");
-ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture.");
-ERRMSG(TransformFeedbackDoesNotExist, "Transform feedback object that does not exist.");
-ERRMSG(TypeMismatch,
- "Passed in texture target and format must match the one originally used to define the "
- "texture.");
-ERRMSG(TypeNotUnsignedShortByte, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported.");
-ERRMSG(UniformSizeMismatch, "Uniform size does not match uniform method.");
-ERRMSG(UnknownParameter, "Unknown parameter value.");
-ERRMSG(VertexArrayNoBuffer, "An enabled vertex array has no buffer.");
-ERRMSG(VertexArrayNoBufferPointer, "An enabled vertex array has no buffer and no pointer.");
-ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative.");
-ERRMSG(Webgl2NameLengthLimitExceeded, "Location lengths must not be greater than 1024 characters.");
-ERRMSG(WebglBindAttribLocationReservedPrefix,
- "Attributes that begin with 'webgl_', or '_webgl_' are not allowed.");
-ERRMSG(WebglNameLengthLimitExceeded,
- "Location name lengths must not be greater than 256 characters.");
-}
-#undef ERRMSG
-#endif // LIBANGLE_ERRORSTRINGS_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Fence.cpp b/src/3rdparty/angle/src/libANGLE/Fence.cpp
deleted file mode 100644
index 9c4d381673..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Fence.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-//
-// Copyright (c) 2002-2013 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.
-//
-
-// Fence.cpp: Implements the gl::FenceNV and gl::Sync classes, which support the GL_NV_fence
-// extension and GLES3 sync objects.
-
-#include "libANGLE/Fence.h"
-
-#include "angle_gl.h"
-
-#include "common/utilities.h"
-#include "libANGLE/renderer/FenceNVImpl.h"
-#include "libANGLE/renderer/SyncImpl.h"
-
-namespace gl
-{
-
-FenceNV::FenceNV(rx::FenceNVImpl *impl)
- : mFence(impl),
- mIsSet(false),
- mStatus(GL_FALSE),
- mCondition(GL_NONE)
-{
-}
-
-FenceNV::~FenceNV()
-{
- SafeDelete(mFence);
-}
-
-Error FenceNV::set(GLenum condition)
-{
- Error error = mFence->set(condition);
- if (error.isError())
- {
- return error;
- }
-
- mCondition = condition;
- mStatus = GL_FALSE;
- mIsSet = true;
-
- return NoError();
-}
-
-Error FenceNV::test(GLboolean *outResult)
-{
- // Flush the command buffer by default
- Error error = mFence->test(&mStatus);
- if (error.isError())
- {
- return error;
- }
-
- *outResult = mStatus;
- return NoError();
-}
-
-Error FenceNV::finish()
-{
- ASSERT(mIsSet);
-
- gl::Error error = mFence->finish();
- if (error.isError())
- {
- return error;
- }
-
- mStatus = GL_TRUE;
-
- return NoError();
-}
-
-Sync::Sync(rx::SyncImpl *impl, GLuint id)
- : RefCountObject(id),
- mFence(impl),
- mLabel(),
- mCondition(GL_SYNC_GPU_COMMANDS_COMPLETE),
- mFlags(0)
-{
-}
-
-Error Sync::onDestroy(const Context *context)
-{
- return NoError();
-}
-
-Sync::~Sync()
-{
- SafeDelete(mFence);
-}
-
-void Sync::setLabel(const std::string &label)
-{
- mLabel = label;
-}
-
-const std::string &Sync::getLabel() const
-{
- return mLabel;
-}
-
-Error Sync::set(GLenum condition, GLbitfield flags)
-{
- Error error = mFence->set(condition, flags);
- if (error.isError())
- {
- return error;
- }
-
- mCondition = condition;
- mFlags = flags;
- return NoError();
-}
-
-Error Sync::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult)
-{
- ASSERT(mCondition != GL_NONE);
- return mFence->clientWait(flags, timeout, outResult);
-}
-
-Error Sync::serverWait(GLbitfield flags, GLuint64 timeout)
-{
- return mFence->serverWait(flags, timeout);
-}
-
-Error Sync::getStatus(GLint *outResult) const
-{
- return mFence->getStatus(outResult);
-}
-
-} // namespace gl
diff --git a/src/3rdparty/angle/src/libANGLE/Fence.h b/src/3rdparty/angle/src/libANGLE/Fence.h
deleted file mode 100644
index 24bc689ca3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Fence.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// Copyright (c) 2002-2013 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.
-//
-
-// Fence.h: Defines the gl::FenceNV and gl::Sync classes, which support the GL_NV_fence
-// extension and GLES3 sync objects.
-
-#ifndef LIBANGLE_FENCE_H_
-#define LIBANGLE_FENCE_H_
-
-#include "libANGLE/Debug.h"
-#include "libANGLE/Error.h"
-#include "libANGLE/RefCountObject.h"
-
-#include "common/angleutils.h"
-
-namespace rx
-{
-class FenceNVImpl;
-class SyncImpl;
-}
-
-namespace gl
-{
-
-class FenceNV final : angle::NonCopyable
-{
- public:
- explicit FenceNV(rx::FenceNVImpl *impl);
- virtual ~FenceNV();
-
- Error set(GLenum condition);
- Error test(GLboolean *outResult);
- Error finish();
-
- bool isSet() const { return mIsSet; }
- GLboolean getStatus() const { return mStatus; }
- GLenum getCondition() const { return mCondition; }
-
- private:
- rx::FenceNVImpl *mFence;
-
- bool mIsSet;
-
- GLboolean mStatus;
- GLenum mCondition;
-};
-
-class Sync final : public RefCountObject, public LabeledObject
-{
- public:
- Sync(rx::SyncImpl *impl, GLuint id);
- ~Sync() override;
-
- Error onDestroy(const Context *context) override;
-
- void setLabel(const std::string &label) override;
- const std::string &getLabel() const override;
-
- Error set(GLenum condition, GLbitfield flags);
- Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult);
- Error serverWait(GLbitfield flags, GLuint64 timeout);
- Error getStatus(GLint *outResult) const;
-
- GLenum getCondition() const { return mCondition; }
- GLbitfield getFlags() const { return mFlags; }
-
- private:
- rx::SyncImpl *mFence;
-
- std::string mLabel;
-
- GLenum mCondition;
- GLbitfield mFlags;
-};
-
-} // namespace gl
-
-#endif // LIBANGLE_FENCE_H_
diff --git a/src/3rdparty/angle/src/libANGLE/Framebuffer.cpp b/src/3rdparty/angle/src/libANGLE/Framebuffer.cpp
deleted file mode 100644
index 48e71685b3..0000000000
--- a/src/3rdparty/angle/src/libANGLE/Framebuffer.cpp
+++ /dev/null
@@ -1,2182 +0,0 @@
-//
-// 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.
-//
-
-// Framebuffer.cpp: Implements the gl::Framebuffer class. Implements GL framebuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
-
-#include "libANGLE/Framebuffer.h"
-
-#include "common/Optional.h"
-#include "common/bitset_utils.h"
-#include "common/utilities.h"
-#include "libANGLE/Config.h"
-#include "libANGLE/Context.h"
-#include "libANGLE/Display.h"
-#include "libANGLE/FramebufferAttachment.h"
-#include "libANGLE/Renderbuffer.h"
-#include "libANGLE/Surface.h"
-#include "libANGLE/Texture.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/renderer/ContextImpl.h"
-#include "libANGLE/renderer/FramebufferImpl.h"
-#include "libANGLE/renderer/GLImplFactory.h"
-#include "libANGLE/renderer/RenderbufferImpl.h"
-#include "libANGLE/renderer/SurfaceImpl.h"
-
-using namespace angle;
-
-namespace gl
-{
-
-namespace
-{
-
-void BindResourceChannel(OnAttachmentDirtyBinding *binding, FramebufferAttachmentObject *resource)
-{
- binding->bind(resource ? resource->getDirtyChannel() : nullptr);
-}
-
-bool CheckMultiviewStateMatchesForCompleteness(const FramebufferAttachment *firstAttachment,
- const FramebufferAttachment *secondAttachment)
-{
- ASSERT(firstAttachment && secondAttachment);
- ASSERT(firstAttachment->isAttached() && secondAttachment->isAttached());
-
- if (firstAttachment->getNumViews() != secondAttachment->getNumViews())
- {
- return false;
- }
- if (firstAttachment->getBaseViewIndex() != secondAttachment->getBaseViewIndex())
- {
- return false;
- }
- if (firstAttachment->getMultiviewLayout() != secondAttachment->getMultiviewLayout())
- {
- return false;
- }
- if (firstAttachment->getMultiviewViewportOffsets() !=
- secondAttachment->getMultiviewViewportOffsets())
- {
- return false;
- }
- return true;
-}
-
-bool CheckAttachmentCompleteness(const Context *context, const FramebufferAttachment &attachment)
-{
- ASSERT(attachment.isAttached());
-
- const Extents &size = attachment.getSize();
- if (size.width == 0 || size.height == 0)
- {
- return false;
- }
-
- const InternalFormat &format = *attachment.getFormat().info;
- if (!format.renderSupport(context->getClientVersion(), context->getExtensions()))
- {
- return false;
- }
-
- if (attachment.type() == GL_TEXTURE)
- {
- if (attachment.layer() >= size.depth)
- {
- return false;
- }
-
- // ES3 specifies that cube map texture attachments must be cube complete.
- // This language is missing from the ES2 spec, but we enforce it here because some
- // desktop OpenGL drivers also enforce this validation.
- // TODO(jmadill): Check if OpenGL ES2 drivers enforce cube completeness.
- const Texture *texture = attachment.getTexture();
- ASSERT(texture);
- if (texture->getTarget() == GL_TEXTURE_CUBE_MAP &&
- !texture->getTextureState().isCubeComplete())
- {
- return false;
- }
-
- if (!texture->getImmutableFormat())
- {
- GLuint attachmentMipLevel = static_cast<GLuint>(attachment.mipLevel());
-
- // From the ES 3.0 spec, pg 213:
- // If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is TEXTURE and the value of
- // FRAMEBUFFER_ATTACHMENT_OBJECT_NAME does not name an immutable-format texture,
- // then the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL must be in the
- // range[levelbase, q], where levelbase is the value of TEXTURE_BASE_LEVEL and q is
- // the effective maximum texture level defined in the Mipmapping discussion of
- // section 3.8.10.4.
- if (attachmentMipLevel < texture->getBaseLevel() ||
- attachmentMipLevel > texture->getMipmapMaxLevel())
- {
- return false;
- }
-
- // Form the ES 3.0 spec, pg 213/214:
- // If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is TEXTURE and the value of
- // FRAMEBUFFER_ATTACHMENT_OBJECT_NAME does not name an immutable-format texture and
- // the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL is not levelbase, then the
- // texture must be mipmap complete, and if FRAMEBUFFER_ATTACHMENT_OBJECT_NAME names
- // a cubemap texture, the texture must also be cube complete.
- if (attachmentMipLevel != texture->getBaseLevel() && !texture->isMipmapComplete())
- {
- return false;
- }
- }
- }
-
- return true;
-};
-
-bool CheckAttachmentSampleCompleteness(const Context *context,
- const FramebufferAttachment &attachment,
- bool colorAttachment,
- Optional<int> *samples,
- Optional<bool> *fixedSampleLocations)
-{
- ASSERT(attachment.isAttached());
-
- if (attachment.type() == GL_TEXTURE)
- {
- const Texture *texture = attachment.getTexture();
- ASSERT(texture);
-
- const ImageIndex &attachmentImageIndex = attachment.getTextureImageIndex();
-
- // ES3.1 (section 9.4) requires that the value of TEXTURE_FIXED_SAMPLE_LOCATIONS should be
- // the same for all attached textures.
- bool fixedSampleloc = texture->getFixedSampleLocations(attachmentImageIndex.type,
- attachmentImageIndex.mipIndex);
- if (fixedSampleLocations->valid() && fixedSampleloc != fixedSampleLocations->value())
- {
- return false;
- }
- else
- {
- *fixedSampleLocations = fixedSampleloc;
- }
- }
-
- if (samples->valid())
- {
- if (attachment.getSamples() != samples->value())
- {
- if (colorAttachment)
- {
- // APPLE_framebuffer_multisample, which EXT_draw_buffers refers to, requires that
- // all color attachments have the same number of samples for the FBO to be complete.
- return false;
- }
- else
- {
- // CHROMIUM_framebuffer_mixed_samples allows a framebuffer to be considered complete
- // when its depth or stencil samples are a multiple of the number of color samples.
- if (!context->getExtensions().framebufferMixedSamples)
- {
- return false;
- }
-
- if ((attachment.getSamples() % std::max(samples->value(), 1)) != 0)
- {
- return false;
- }
- }
- }
- }
- else
- {
- *samples = attachment.getSamples();
- }
-
- return true;
-}
-
-// Needed to index into the attachment arrays/bitsets.
-static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) ==
- gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX,
- "Framebuffer Dirty bit mismatch");
-static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) ==
- gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT,
- "Framebuffer Dirty bit mismatch");
-static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS + 1) ==
- gl::Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT,
- "Framebuffer Dirty bit mismatch");
-
-Error InitAttachment(const Context *context, FramebufferAttachment *attachment)
-{
- ASSERT(attachment->isAttached());
- if (attachment->initState() == InitState::MayNeedInit)
- {
- ANGLE_TRY(attachment->initializeContents(context));
- }
- return NoError();
-}
-
-bool IsColorMaskedOut(const BlendState &blend)
-{
- return (!blend.colorMaskRed && !blend.colorMaskGreen && !blend.colorMaskBlue &&
- !blend.colorMaskAlpha);
-}
-
-bool IsDepthMaskedOut(const DepthStencilState &depthStencil)
-{
- return !depthStencil.depthMask;
-}
-
-bool IsStencilMaskedOut(const DepthStencilState &depthStencil)
-{
- return ((depthStencil.stencilMask & depthStencil.stencilWritemask) == 0);
-}
-
-bool IsClearBufferMaskedOut(const Context *context, GLenum buffer)
-{
- switch (buffer)
- {
- case GL_COLOR:
- return IsColorMaskedOut(context->getGLState().getBlendState());
- case GL_DEPTH:
- return IsDepthMaskedOut(context->getGLState().getDepthStencilState());
- case GL_STENCIL:
- return IsStencilMaskedOut(context->getGLState().getDepthStencilState());
- case GL_DEPTH_STENCIL:
- return IsDepthMaskedOut(context->getGLState().getDepthStencilState()) &&
- IsStencilMaskedOut(context->getGLState().getDepthStencilState());
- default:
- UNREACHABLE();
- return true;
- }
-}
-
-} // anonymous namespace
-
-// This constructor is only used for default framebuffers.
-FramebufferState::FramebufferState()
- : mLabel(),
- mColorAttachments(1),
- mDrawBufferStates(1, GL_BACK),
- mReadBufferState(GL_BACK),
- mDefaultWidth(0),
- mDefaultHeight(0),
- mDefaultSamples(0),
- mDefaultFixedSampleLocations(GL_FALSE),
- mWebGLDepthStencilConsistent(true)
-{
- ASSERT(mDrawBufferStates.size() > 0);
- mEnabledDrawBuffers.set(0);
-}
-
-FramebufferState::FramebufferState(const Caps &caps)
- : mLabel(),
- mColorAttachments(caps.maxColorAttachments),
- mDrawBufferStates(caps.maxDrawBuffers, GL_NONE),
- mReadBufferState(GL_COLOR_ATTACHMENT0_EXT),
- mDefaultWidth(0),
- mDefaultHeight(0),
- mDefaultSamples(0),
- mDefaultFixedSampleLocations(GL_FALSE),
- mWebGLDepthStencilConsistent(true)
-{
- ASSERT(mDrawBufferStates.size() > 0);
- mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
-}
-
-FramebufferState::~FramebufferState()
-{
-}
-
-const std::string &FramebufferState::getLabel()
-{
- return mLabel;
-}
-
-const FramebufferAttachment *FramebufferState::getAttachment(GLenum attachment) const
-{
- if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
- {
- return getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
- }
-
- switch (attachment)
- {
- case GL_COLOR:
- case GL_BACK:
- return getColorAttachment(0);
- case GL_DEPTH:
- case GL_DEPTH_ATTACHMENT:
- return getDepthAttachment();
- case GL_STENCIL:
- case GL_STENCIL_ATTACHMENT:
- return getStencilAttachment();
- case GL_DEPTH_STENCIL:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- return getDepthStencilAttachment();
- default:
- UNREACHABLE();
- return nullptr;
- }
-}
-
-size_t FramebufferState::getReadIndex() const
-{
- ASSERT(mReadBufferState == GL_BACK ||
- (mReadBufferState >= GL_COLOR_ATTACHMENT0 && mReadBufferState <= GL_COLOR_ATTACHMENT15));
- size_t readIndex = (mReadBufferState == GL_BACK
- ? 0
- : static_cast<size_t>(mReadBufferState - GL_COLOR_ATTACHMENT0));
- ASSERT(readIndex < mColorAttachments.size());
- return readIndex;
-}
-
-const FramebufferAttachment *FramebufferState::getReadAttachment() const
-{
- if (mReadBufferState == GL_NONE)
- {
- return nullptr;
- }
- size_t readIndex = getReadIndex();
- return mColorAttachments[readIndex].isAttached() ? &mColorAttachments[readIndex] : nullptr;
-}
-
-const FramebufferAttachment *FramebufferState::getFirstNonNullAttachment() const
-{
- auto *colorAttachment = getFirstColorAttachment();
- if (colorAttachment)
- {
- return colorAttachment;
- }
- return getDepthOrStencilAttachment();
-}
-
-const FramebufferAttachment *FramebufferState::getFirstColorAttachment() const
-{
- for (const FramebufferAttachment &colorAttachment : mColorAttachments)
- {
- if (colorAttachment.isAttached())
- {
- return &colorAttachment;
- }
- }
-
- return nullptr;
-}
-
-const FramebufferAttachment *FramebufferState::getDepthOrStencilAttachment() const
-{
- if (mDepthAttachment.isAttached())
- {
- return &mDepthAttachment;
- }
- if (mStencilAttachment.isAttached())
- {
- return &mStencilAttachment;
- }
- return nullptr;
-}
-
-const FramebufferAttachment *FramebufferState::getStencilOrDepthStencilAttachment() const
-{
- if (mStencilAttachment.isAttached())
- {
- return &mStencilAttachment;
- }
- return getDepthStencilAttachment();
-}
-
-const FramebufferAttachment *FramebufferState::getColorAttachment(size_t colorAttachment) const
-{
- ASSERT(colorAttachment < mColorAttachments.size());
- return mColorAttachments[colorAttachment].isAttached() ? &mColorAttachments[colorAttachment]
- : nullptr;
-}
-
-const FramebufferAttachment *FramebufferState::getDepthAttachment() const
-{
- return mDepthAttachment.isAttached() ? &mDepthAttachment : nullptr;
-}
-
-const FramebufferAttachment *FramebufferState::getStencilAttachment() const
-{
- return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr;
-}
-
-const FramebufferAttachment *FramebufferState::getDepthStencilAttachment() const
-{
- // A valid depth-stencil attachment has the same resource bound to both the
- // depth and stencil attachment points.
- if (mDepthAttachment.isAttached() && mStencilAttachment.isAttached() &&
- mDepthAttachment == mStencilAttachment)
- {
- return &mDepthAttachment;
- }
-
- return nullptr;
-}
-
-bool FramebufferState::attachmentsHaveSameDimensions() const
-{
- Optional<Extents> attachmentSize;
-
- auto hasMismatchedSize = [&attachmentSize](const FramebufferAttachment &attachment) {
- if (!attachment.isAttached())
- {
- return false;
- }
-
- if (!attachmentSize.valid())
- {
- attachmentSize = attachment.getSize();
- return false;
- }
-
- const auto &prevSize = attachmentSize.value();
- const auto &curSize = attachment.getSize();
- return (curSize.width != prevSize.width || curSize.height != prevSize.height);
- };
-
- for (const auto &attachment : mColorAttachments)
- {
- if (hasMismatchedSize(attachment))
- {
- return false;
- }
- }
-
- if (hasMismatchedSize(mDepthAttachment))
- {
- return false;
- }
-
- return !hasMismatchedSize(mStencilAttachment);
-}
-
-const gl::FramebufferAttachment *FramebufferState::getDrawBuffer(size_t drawBufferIdx) const
-{
- ASSERT(drawBufferIdx < mDrawBufferStates.size());
- if (mDrawBufferStates[drawBufferIdx] != GL_NONE)
- {
- // ES3 spec: "If the GL is bound to a draw framebuffer object, the ith buffer listed in bufs
- // must be COLOR_ATTACHMENTi or NONE"
- ASSERT(mDrawBufferStates[drawBufferIdx] == GL_COLOR_ATTACHMENT0 + drawBufferIdx ||
- (drawBufferIdx == 0 && mDrawBufferStates[drawBufferIdx] == GL_BACK));
- return getAttachment(mDrawBufferStates[drawBufferIdx]);
- }
- else
- {
- return nullptr;
- }
-}
-
-size_t FramebufferState::getDrawBufferCount() const
-{
- return mDrawBufferStates.size();
-}
-
-bool FramebufferState::colorAttachmentsAreUniqueImages() const
-{
- for (size_t firstAttachmentIdx = 0; firstAttachmentIdx < mColorAttachments.size();
- firstAttachmentIdx++)
- {
- const gl::FramebufferAttachment &firstAttachment = mColorAttachments[firstAttachmentIdx];
- if (!firstAttachment.isAttached())
- {
- continue;
- }
-
- for (size_t secondAttachmentIdx = firstAttachmentIdx + 1;
- secondAttachmentIdx < mColorAttachments.size(); secondAttachmentIdx++)
- {
- const gl::FramebufferAttachment &secondAttachment =
- mColorAttachments[secondAttachmentIdx];
- if (!secondAttachment.isAttached())
- {
- continue;
- }
-
- if (firstAttachment == secondAttachment)
- {
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool FramebufferState::hasDepth() const
-{
- return (mDepthAttachment.isAttached() && mDepthAttachment.getDepthSize() > 0);
-}
-
-bool FramebufferState::hasStencil() const
-{
- return (mStencilAttachment.isAttached() && mStencilAttachment.getStencilSize() > 0);
-}
-
-GLsizei FramebufferState::getNumViews() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return FramebufferAttachment::kDefaultNumViews;
- }
- return attachment->getNumViews();
-}
-
-const std::vector<Offset> *FramebufferState::getViewportOffsets() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return nullptr;
- }
- return &attachment->getMultiviewViewportOffsets();
-}
-
-GLenum FramebufferState::getMultiviewLayout() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return GL_NONE;
- }
- return attachment->getMultiviewLayout();
-}
-
-int FramebufferState::getBaseViewIndex() const
-{
- const FramebufferAttachment *attachment = getFirstNonNullAttachment();
- if (attachment == nullptr)
- {
- return GL_NONE;
- }
- return attachment->getBaseViewIndex();
-}
-
-Box FramebufferState::getDimensions() const
-{
- ASSERT(attachmentsHaveSameDimensions());
- ASSERT(getFirstNonNullAttachment() != nullptr);
- Extents extents = getFirstNonNullAttachment()->getSize();
- return Box(0, 0, 0, extents.width, extents.height, extents.depth);
-}
-
-Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id)
- : mState(caps),
- mImpl(factory->createFramebuffer(mState)),
- mId(id),
- mCachedStatus(),
- mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
- mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
-{
- ASSERT(mId != 0);
- ASSERT(mImpl != nullptr);
- ASSERT(mState.mColorAttachments.size() == static_cast<size_t>(caps.maxColorAttachments));
-
- for (uint32_t colorIndex = 0;
- colorIndex < static_cast<uint32_t>(mState.mColorAttachments.size()); ++colorIndex)
- {
- mDirtyColorAttachmentBindings.emplace_back(this, DIRTY_BIT_COLOR_ATTACHMENT_0 + colorIndex);
- }
-}
-
-Framebuffer::Framebuffer(const egl::Display *display, egl::Surface *surface)
- : mState(),
- mImpl(surface->getImplementation()->createDefaultFramebuffer(mState)),
- mId(0),
- mCachedStatus(GL_FRAMEBUFFER_COMPLETE),
- mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
- mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
-{
- ASSERT(mImpl != nullptr);
- mDirtyColorAttachmentBindings.emplace_back(this, DIRTY_BIT_COLOR_ATTACHMENT_0);
-
- const Context *proxyContext = display->getProxyContext();
-
- setAttachmentImpl(proxyContext, GL_FRAMEBUFFER_DEFAULT, GL_BACK, gl::ImageIndex::MakeInvalid(),
- surface, FramebufferAttachment::kDefaultNumViews,
- FramebufferAttachment::kDefaultBaseViewIndex,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
-
- if (surface->getConfig()->depthSize > 0)
- {
- setAttachmentImpl(
- proxyContext, GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, gl::ImageIndex::MakeInvalid(), surface,
- FramebufferAttachment::kDefaultNumViews, FramebufferAttachment::kDefaultBaseViewIndex,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
- }
-
- if (surface->getConfig()->stencilSize > 0)
- {
- setAttachmentImpl(proxyContext, GL_FRAMEBUFFER_DEFAULT, GL_STENCIL,
- gl::ImageIndex::MakeInvalid(), surface,
- FramebufferAttachment::kDefaultNumViews,
- FramebufferAttachment::kDefaultBaseViewIndex,
- FramebufferAttachment::kDefaultMultiviewLayout,
- FramebufferAttachment::kDefaultViewportOffsets);
- }
-}
-
-Framebuffer::Framebuffer(rx::GLImplFactory *factory)
- : mState(),
- mImpl(factory->createFramebuffer(mState)),
- mId(0),
- mCachedStatus(GL_FRAMEBUFFER_UNDEFINED_OES),
- mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
- mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
-{
- mDirtyColorAttachmentBindings.emplace_back(this, DIRTY_BIT_COLOR_ATTACHMENT_0);
-}
-
-Framebuffer::~Framebuffer()
-{
- SafeDelete(mImpl);
-}
-
-void Framebuffer::onDestroy(const Context *context)
-{
- for (auto &attachment : mState.mColorAttachments)
- {
- attachment.detach(context);
- }
- mState.mDepthAttachment.detach(context);
- mState.mStencilAttachment.detach(context);
- mState.mWebGLDepthAttachment.detach(context);
- mState.mWebGLStencilAttachment.detach(context);
- mState.mWebGLDepthStencilAttachment.detach(context);
-
- mImpl->destroy(context);
-}
-
-void Framebuffer::destroyDefault(const egl::Display *display)
-{
- mImpl->destroyDefault(display);
-}
-
-void Framebuffer::setLabel(const std::string &label)
-{
- mState.mLabel = label;
-}
-
-const std::string &Framebuffer::getLabel() const
-{
- return mState.mLabel;
-}
-
-bool Framebuffer::detachTexture(const Context *context, GLuint textureId)
-{
- return detachResourceById(context, GL_TEXTURE, textureId);
-}
-
-bool Framebuffer::detachRenderbuffer(const Context *context, GLuint renderbufferId)
-{
- return detachResourceById(context, GL_RENDERBUFFER, renderbufferId);
-}
-
-bool Framebuffer::detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId)
-{
- bool found = false;
-
- for (size_t colorIndex = 0; colorIndex < mState.mColorAttachments.size(); ++colorIndex)
- {
- if (detachMatchingAttachment(context, &mState.mColorAttachments[colorIndex], resourceType,
- resourceId, DIRTY_BIT_COLOR_ATTACHMENT_0 + colorIndex))
- {
- found = true;
- }
- }
-
- if (context->isWebGL1())
- {
- const std::array<FramebufferAttachment *, 3> attachments = {
- {&mState.mWebGLDepthStencilAttachment, &mState.mWebGLDepthAttachment,
- &mState.mWebGLStencilAttachment}};
- for (FramebufferAttachment *attachment : attachments)
- {
- if (attachment->isAttached() && attachment->type() == resourceType &&
- attachment->id() == resourceId)
- {
- resetAttachment(context, attachment->getBinding());
- found = true;
- }
- }
- }
- else
- {
- if (detachMatchingAttachment(context, &mState.mDepthAttachment, resourceType, resourceId,
- DIRTY_BIT_DEPTH_ATTACHMENT))
- {
- found = true;
- }
- if (detachMatchingAttachment(context, &mState.mStencilAttachment, resourceType, resourceId,
- DIRTY_BIT_STENCIL_ATTACHMENT))
- {
- found = true;
- }
- }
-
- return found;
-}
-
-bool Framebuffer::detachMatchingAttachment(const Context *context,
- FramebufferAttachment *attachment,
- GLenum matchType,
- GLuint matchId,
- size_t dirtyBit)
-{
- if (attachment->isAttached() && attachment->type() == matchType && attachment->id() == matchId)
- {
- attachment->detach(context);
- mDirtyBits.set(dirtyBit);
- mState.mResourceNeedsInit.set(dirtyBit, false);
- return true;
- }
-
- return false;
-}
-
-const FramebufferAttachment *Framebuffer::getColorbuffer(size_t colorAttachment) const
-{
- return mState.getColorAttachment(colorAttachment);
-}
-
-const FramebufferAttachment *Framebuffer::getDepthbuffer() const
-{
- return mState.getDepthAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getStencilbuffer() const
-{
- return mState.getStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
-{
- return mState.getDepthStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
-{
- return mState.getDepthOrStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getStencilOrDepthStencilAttachment() const
-{
- return mState.getStencilOrDepthStencilAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getReadColorbuffer() const
-{
- return mState.getReadAttachment();
-}
-
-GLenum Framebuffer::getReadColorbufferType() const
-{
- const FramebufferAttachment *readAttachment = mState.getReadAttachment();
- return (readAttachment != nullptr ? readAttachment->type() : GL_NONE);
-}
-
-const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
-{
- return mState.getFirstColorAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getFirstNonNullAttachment() const
-{
- return mState.getFirstNonNullAttachment();
-}
-
-const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
-{
- return mState.getAttachment(attachment);
-}
-
-size_t Framebuffer::getDrawbufferStateCount() const
-{
- return mState.mDrawBufferStates.size();
-}
-
-GLenum Framebuffer::getDrawBufferState(size_t drawBuffer) const
-{
- ASSERT(drawBuffer < mState.mDrawBufferStates.size());
- return mState.mDrawBufferStates[drawBuffer];
-}
-
-const std::vector<GLenum> &Framebuffer::getDrawBufferStates() const
-{
- return mState.getDrawBufferStates();
-}
-
-void Framebuffer::setDrawBuffers(size_t count, const GLenum *buffers)
-{
- auto &drawStates = mState.mDrawBufferStates;
-
- ASSERT(count <= drawStates.size());
- std::copy(buffers, buffers + count, drawStates.begin());
- std::fill(drawStates.begin() + count, drawStates.end(), GL_NONE);
- mDirtyBits.set(DIRTY_BIT_DRAW_BUFFERS);
-
- mState.mEnabledDrawBuffers.reset();
- for (size_t index = 0; index < count; ++index)
- {
- if (drawStates[index] != GL_NONE && mState.mColorAttachments[index].isAttached())
- {
- mState.mEnabledDrawBuffers.set(index);
- }
- }
-}
-
-const FramebufferAttachment *Framebuffer::getDrawBuffer(size_t drawBuffer) const
-{
- return mState.getDrawBuffer(drawBuffer);
-}
-
-GLenum Framebuffer::getDrawbufferWriteType(size_t drawBuffer) const
-{
- const FramebufferAttachment *attachment = mState.getDrawBuffer(drawBuffer);
- if (attachment == nullptr)
- {
- return GL_NONE;
- }
-
- GLenum componentType = attachment->getFormat().info->componentType;
- switch (componentType)
- {
- case GL_INT:
- case GL_UNSIGNED_INT:
- return componentType;
-
- default:
- return GL_FLOAT;
- }
-}
-
-bool Framebuffer::hasEnabledDrawBuffer() const
-{
- for (size_t drawbufferIdx = 0; drawbufferIdx < mState.mDrawBufferStates.size(); ++drawbufferIdx)
- {
- if (getDrawBuffer(drawbufferIdx) != nullptr)
- {
- return true;
- }
- }
-
- return false;
-}
-
-GLenum Framebuffer::getReadBufferState() const
-{
- return mState.mReadBufferState;
-}
-
-void Framebuffer::setReadBuffer(GLenum buffer)
-{
- ASSERT(buffer == GL_BACK || buffer == GL_NONE ||
- (buffer >= GL_COLOR_ATTACHMENT0 &&
- (buffer - GL_COLOR_ATTACHMENT0) < mState.mColorAttachments.size()));
- mState.mReadBufferState = buffer;
- mDirtyBits.set(DIRTY_BIT_READ_BUFFER);
-}
-
-size_t Framebuffer::getNumColorBuffers() const
-{
- return mState.mColorAttachments.size();
-}
-
-bool Framebuffer::hasDepth() const
-{
- return mState.hasDepth();
-}
-
-bool Framebuffer::hasStencil() const
-{
- return mState.hasStencil();
-}
-
-bool Framebuffer::usingExtendedDrawBuffers() const
-{
- for (size_t drawbufferIdx = 1; drawbufferIdx < mState.mDrawBufferStates.size(); ++drawbufferIdx)
- {
- if (getDrawBuffer(drawbufferIdx) != nullptr)
- {
- return true;
- }
- }
-
- return false;
-}
-
-void Framebuffer::invalidat